Rolling Plot

The RollingPlotModule class provides methods to interact with Rolling Plot modules.

Note

The Rolling Plot saves the acquired data in the host PC’s RAM. For long-term data capture, consider using Data loggers instead to save the acquired data directly to disk.

Creating and controlling a Rolling Plot module

The following example demonstrates how to instantiate a Rolling Plot module, configure its sampling parameters, run an acquisition, and export the resulting data:

rolling = project.modules.create(ModuleType.ROLLING_PLOT)
rolling.add_variables(["Vdc"])
rolling.set_sampling_frequency(frequency_hz=1000.0)
rolling.set_window(window_s=5.0)
rolling.play()
# ... run the experiment ...
rolling.pause()
rolling.export("C:/imperix/captures/data.mat")

API Reference

class imperix.RollingPlotModule(cockpit: Cockpit, data: dict[str, Any])
export(path: str | PathLike[str], *, plot: int = 0, timeout: float | None | UseDefaultTimeout = UseDefaultTimeout.TOKEN) None

Export acquired data from one plot to a CSV or MAT file.

Parameters:
  • path – Absolute path where the file will be written, as a string or Path. The file extension selects the export format. The supported extensions are .csv and .mat.

  • plot – Index of the plot to export. Defaults to 0 (the first plot).

  • timeout – Maximum time to wait for a response in seconds.

Raises:

InvalidStateError – If Cockpit cannot export the acquired data.

stop(*, timeout: float | None | UseDefaultTimeout = UseDefaultTimeout.TOKEN) None

Stops the acquisition.

Parameters:

timeout – Maximum time to wait for a response in seconds.

Raises:

InvalidStateError – If the acquisition cannot be stopped.

set_window(*, window_s: float, timeout: float | None | UseDefaultTimeout = UseDefaultTimeout.TOKEN) None

Set the acquisition window duration.

Parameters:
  • window_s – Window duration in seconds.

  • timeout – Maximum time to wait for a response in seconds.

Raises:

InvalidStateError – If Cockpit cannot update the acquisition window.

add_plot(*, timeout: float | None | UseDefaultTimeout = UseDefaultTimeout.TOKEN) int

Creates a new plot.

Parameters:

timeout – Maximum time to wait for a response in seconds.

Returns:

The index of the newly created plot.

Raises:

InvalidStateError – If Cockpit cannot create the plot.

remove_plot(plot: int, *, timeout: float | None | UseDefaultTimeout = UseDefaultTimeout.TOKEN) None

Deletes a plot.

Parameters:
  • plot – index of the plot to remove.

  • timeout – Maximum time to wait for a response in seconds.

Raises:

InvalidStateError – If this is the only remaining plot or Cockpit cannot remove it.

plot_count(*, timeout: float | None | UseDefaultTimeout = UseDefaultTimeout.TOKEN) int

Returns the current number of plots.

Parameters:

timeout – Maximum time to wait for a response in seconds.

Returns:

Number of plots in the scope.

list_variables(*, plot: int = 0, timeout: float | None | UseDefaultTimeout = UseDefaultTimeout.TOKEN) Any

Returns the list of variables in a plot.

Parameters:
  • plot – plot index. Defaults to 0.

  • timeout – Maximum time to wait for a response in seconds.

Returns:

A list of variable names on the given plot.

add_variables(names: Sequence[str], *, plot: int = 0, timeout: float | None | UseDefaultTimeout = UseDefaultTimeout.TOKEN) None

Adds variables by name.

Parameters:
  • names – Name(s) of the variables to add.

  • plot – plot index to add them to. Defaults to 0 (the first plot).

  • timeout – Maximum time to wait for a response in seconds.

Example::

rolling_plot.add_variables([“Va”, “Vb”, “Vc”])

Raises:

InvalidStateError – If Cockpit cannot add the variables.

remove_variables(names: Sequence[str], *, plot: int = 0, timeout: float | None | UseDefaultTimeout = UseDefaultTimeout.TOKEN) None

Removes variables from this scope by name.

Parameters:
  • names – Name(s) of the variables to remove.

  • plot – plot index to add them to. Defaults to 0 (the first plot).

  • timeout – Maximum time to wait for a response in seconds.

Raises:

InvalidStateError – If Cockpit cannot remove the variables.

set_sampling_frequency(*, frequency_hz: float, timeout: float | None | UseDefaultTimeout = UseDefaultTimeout.TOKEN) None

Sets the sampling rate.

Parameters:
  • frequency_hz – Acquisition sampling rate in Hz.

  • timeout – Maximum time to wait for a response in seconds.

Raises:

InvalidStateError – If Cockpit cannot update the sampling frequency.

play(*, timeout: float | None | UseDefaultTimeout = UseDefaultTimeout.TOKEN) None

Starts or resumes acquisition.

Parameters:

timeout – Maximum time to wait for a response in seconds.

Raises:

InvalidStateError – If the acquisition cannot be started.

pause(*, timeout: float | None | UseDefaultTimeout = UseDefaultTimeout.TOKEN) None

Pause acquisition without clearing the data.

Parameters:

timeout – Maximum time to wait for a response in seconds.

Raises:

InvalidStateError – If the acquisition cannot be paused.