Skip to main content

set_active_time_point()

Selects the active time step on time-aware readers (for example, PVDReader).

Delegates to TimeReader.set_active_time_point() on the underlying reader.

If the current reader is not time-aware, this method is a silent no-op and returns None.

Parameters
  • time_point (int) — Zero-based index of the time step to activate. Supports Python negative indexing: 0 selects the first time step, -1 the last, -2 the second-to-last, and so on.
Returns
  • None
note

After calling set_active_time_point(), the next call to show() or export() will re-read the mesh at the newly selected time step. You can inspect the resulting time value with active_time_value, or retrieve all available time values via time_values.

Example

from pyemsi import Plotter, examples

file_path = examples.transient_path()
p = Plotter(file_path)

print(p.number_time_points) # 10
print(p.time_values) # [0.01, 0.02, 0.03, ..., 0.1]

p.set_active_time_point(0) # first time step (t = 0.01 s)
p.set_active_time_point(-1) # last time step (t = 0.1 s, equivalent to index 9)
p.set_active_time_point(-2) # second-to-last (t = 0.09 s, equivalent to index 8)

p.set_scalar("B-Mag (T)")
p.show()

See also