widgets
EpmSlider
Bases: Slider
Slider widget for visualizing phase mapping and cycles in EPM data.
This widget allows interactive visualization of phasefields, critical points (CBs), forks, and wavefronts.
epm = epm
instance-attribute
__init__(epm)
Initialize the EpmSlider with optional visualization layers.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
epm |
ExtendedPhaseMapping
|
ExtendedPhaseMapping object containing phasefield and cycle data. |
required |
add_critical_cycles(name='CBs', scalar_column='top_charge', cmap='bwr', line_width=7.5, clim=(-1, 1), **kwargs)
Add critical cycles (CBs) to the slider visualization.
add_noncritical_cycles(name='forks', color='white', line_width=7.5, **kwargs)
Add non-critical cycles (forks) to the slider visualization.
add_phasefield(name='phasefield', interpolate_before_map=False, clim=(-np.pi, np.pi), cmap='twilight', **kwargs)
Add the phasefield scalar field to the slider.
add_points(points, scalars, label, position, name=None, **kwargs)
Add a point cloud with a checkbox toggle.
add_wavefronts(name='wavefronts', color='green', line_width=7.5, **kwargs)
Add wavefront cycles to the slider visualization.
toggle(name, flag)
Toggle actor visibility.
Plot
General class for plotting.
Attributes:
| Name | Type | Description |
|---|---|---|
plotter |
Plotter
|
PyVista plotter object. |
builders |
dict
|
Dictionary of object builders. |
visible_objects |
list
|
List of visible objects. |
actors |
dict
|
Dictionary of pyvista actors. |
actors = {}
instance-attribute
builders = {}
instance-attribute
plotter = pv.Plotter()
instance-attribute
visible_objects = []
instance-attribute
__init__()
Initialize the Plot object.
add_data(name, builder, **kwargs)
Add a new data object to the plot, along with its builder and configuration.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name |
str
|
Name of the data object. |
required |
builder |
ObjectBuilder
|
Builder instance for the data object. |
required |
**kwargs |
Any
|
Optional keyword arguments for the mesh. |
{}
|
add_opacity_slider()
Add an opacity slider widget to the plotter for adjusting mesh opacity.
show()
Show the Plot window.
update_opacity(value)
Update the opacity of the phasefield mesh.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value |
float
|
Opacity to update the phasefield mesh to. |
required |
Slider
Bases: Plot
Slider class for visualizing data over time and updating opacity.
Attributes:
| Name | Type | Description |
|---|---|---|
data |
dict
|
Dictionary of data to visualize. |
builders |
dict
|
Dictionary of object builders. |
visible_objects |
list
|
List of visible objects. |
actors |
dict
|
Dictionary of pyvista actors. |
plotter |
Plotter
|
PyVista plotter object. |
current_time_index |
int
|
Current time index. |
time_axis |
ndarray | None
|
Array of time values for the slider. |
slider_widget |
The PyVista slider widget instance. |
current_time_index = 0
instance-attribute
slider_widget = None
instance-attribute
time_axis = time_axis
instance-attribute
__init__(time_axis)
Initialize the Slider.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
time_axis |
ndarray | None
|
Array of time values for the slider. If None, must be set before using time-dependent features. |
required |
add_time_slider()
Add a time slider widget to the plotter for time navigation.
key_press_callback(obj, event)
Handle key press events for time navigation in the slider.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
obj |
vtkObject
|
VTK object triggering the event. |
required |
event |
vtkEvent
|
VTK event. |
required |
show()
Show the slider window, initialize objects, sliders, and event handlers.
update_objects(time, prev_time=-1.0)
Update the objects in the slider for a given timestep.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
prev_time |
float
|
Previous timestep to update the objects for. |
-1.0
|
time |
float
|
Current timestep to update the objects for. |
required |
update_time(value)
Update the slider to a specific time value.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value |
float
|
Time to update the slider to. |
required |
update_time_by_index(index)
Update the slider to a specific time index.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
index |
int
|
Index of the time to update the slider to. |
required |