Skip to content
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

Grouped and overridable default values for slider widgets #357

Open
wants to merge 5 commits into
base: dev
Choose a base branch
from

Conversation

hightower8083
Copy link
Contributor

In general, when working with the slider, one often needs to check many boxes and fine-tune the plots. At the same time re-initialize of time-series requires re-initialization of slider and discards its setup. So it can happen that when one does quick checks on the simulation state during its progress via slider, the slider state (widget values) has to be reset manually.

This PR offers a simple and less invasive solution to fix and manipulate default widget values. Example of usage:

# get a dictionary with default values
from openpmd_viewer.openpmd_timeseries.interactive import default_plot_profile as plot_profile

#override some values of choice
plot_profile['FieldColorbarMin'] = -5e6     # still have to check-activate the range
plot_profile['FieldColorbarMax'] = 5e6
plot_profile['ParticlesAlwaysRefresh'] = False
plot_profile['FieldAlwaysRefresh'] = False

# slider with new defaults
ts.slider(plot_profile=plot_profile)

Even without the access to override option , I think its in general more clear to have the initial widget values grouped in the code rather then distributed.

@ax3l ax3l requested a review from RemiLehe April 20, 2023 18:26
@ax3l
Copy link
Member

ax3l commented Apr 20, 2023

This is really cool, great idea.

If @RemiLehe agrees to the current approach, then we should add this to an example, e.g., tutorials/3_Introduction-to-the-GUI.ipynb, so people find it :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants