New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Further improvements to the demos #17
Comments
Outputs that can be refreshed live (when sliding):
Outputs that can be refreshed at release / button press:
|
@jourdain Thanks for the list. I'll try to do that. Something I noticed about def update_seeds(y1, y2, resolution, colorByField, presetName):
viz = Viz(os.path.join(os.path.dirname(__file__), "data"))
viz.updateSeedPoints(y1, y2, resolution)
return [
viz.getSeedState(),
viz.getTubesMesh(colorByField),
viz.getColorRange(),
presetName,
random.random(), # trigger a render
] Moreover, this approach is signfiicantly slower since we are re-reading the files in |
If you know which user is which in a request/callback, just create and lookup a Viz per users. The |
I just tried to change how the Viz object is initialized by moving the expensive computations (loading See commit: a69ecaf |
What you've done is technically the same thing as sharing a |
1 similar comment
What you've done is technically the same thing as sharing a |
That's good to know. I was initially worried about user 1 and user 2 simultaneously updating the seeds with their sliders (e.g. ms apart) but that shouldn't really be an issue since each worker will have its own instance of I've already committed a69ecaf but I'm happy to reverse it |
I would revert it, unless it is more readable for you. |
I'm not sure I understand; here I'm creating a new def update_seeds(y1, y2, resolution, colorByField, presetName):
viz = Viz(tunnelReader, bike_mesh)
viz.updateSeedPoints(y1, y2, resolution)
return [
viz.getSeedState(),
viz.getTubesMesh(colorByField),
viz.getColorRange(),
presetName,
random.random(), # trigger a render
] Did you mean that the objects from the |
I reverted the commit in 318a5ab |
No, what I mean is that creating 1 Viz object per user or sharing it across all the users will produce the same/valid result across the users. Basically there is no benefit of creating and deleting a Viz object. |
I see, thank you |
Seems like it happens when both sliders are close to -1, or both are close to 1 |
The position of the slider should not matter. |
If I set the line seeds to -1 in the initialization (rather than using callbacks): class Viz():
def __init__(self, data_directory):
...
# Seeds settings
self.resolution = 10
self.point1 = [-0.4, -1, 0.05]
self.point2 = [-0.4, -1, 1.5] I seem to get this error stopping the app from booting: (venv) (base) xhlu@XHL-Desktop:~/dev/dash-vtk$ python demos/usage-vtk-cfd/app.py
Traceback (most recent call last):
File "demos/usage-vtk-cfd/app.py", line 128, in <module>
state=viz.getTubesMesh('p'),
File "demos/usage-vtk-cfd/app.py", line 80, in getTubesMesh
mesh_state = to_mesh_state(ds, color_by_field_name)
File "/home/xhlu/dev/dash-vtk/dash_vtk/utils/vtk.py", line 37, in to_mesh_state
points = vtk_to_numpy(polydata.GetPoints().GetData()).ravel()
AttributeError: 'NoneType' object has no attribute 'GetData' |
I see, I guess I clipped the domain in that region. What it means is that it doesn't have any geometry to generate. In other words |
I should probably guard my converter for that, but for the demo, you could shrink the range to ensure that we will always have a streamline. |
Sounds good! |
Thank you. I updated the sliders in 605a735 and there doesn't seem to be any other problems. If you are happy with that I'll merge the PR. |
Here are some improvements i'd like to make to the demos; @jourdain feel free to share your thoughts on them:
@jourdain You mentioned about updating the sliders on change (instead of on release) for certain cases:
Could you remind me which ones you mentioned?
The text was updated successfully, but these errors were encountered: