8.6.6.4.4. pymodaq_gui.plotting.utils.plot_utils module
- class pymodaq_gui.plotting.utils.plot_utils.Data0DWithHistory(Nsamples=200, sync_x_axis=True)[source]
Bases:
objectObject to store scalar values and keep a history of a given length to them
- Attributes:
- data
- length
- size
- sync_x_axis
- timestamps
- xaxis
Methods
add_data_dict(datas[, timestamp])Add datas to the history on the form of a dict of key/data pairs (data is a numpy 0D array) :param datas: :type datas:
dictadd_data_list(data[, timestamp])Add datas to the history :param data: :type data:
listadd_data
clear_data
- add_data_dict(datas, timestamp=None)[source]
Add datas to the history on the form of a dict of key/data pairs (data is a numpy 0D array) :param datas: :type datas:
dict
- property data
- property length
- property size
- property timestamps
- property xaxis
- class pymodaq_gui.plotting.utils.plot_utils.DetachablePanel(widget, dock, title, detached, orientation=<Orientation.Horizontal: 1>, layout_config_path=None, is_shown=<function DetachablePanel.<lambda>>)[source]
Bases:
objectShow/hide a
WidgetWithLabelTitleeither docked or floatingWraps the show/hide logic shared by every dockable, detachable side-panel (settings, controls, ROIs, …): when detached (or there is no dock at all) the widget is a floating top-level window; otherwise it lives inside dock.
Also owns the attach/detach state, which starts from detached (typically an app-wide config default) but can be overridden live for this instance via the widget’s sig_attach_detach signal (see
WidgetWithLabelTitle) - if the panel is visible when the user toggles attach/detach, it is immediately re-shown in the new mode.- Parameters:
widget (
QWidget) – Created with attachable=True; closable is up to the callerdock (
Optional[Dock]) – Dock to host the widget when attached; if None the widget can only floattitle (
str) – Window title used while floatingdetached (
bool) – Initial attach/detach stateorientation (
Orientation) – Forwarded todisplay_in_dock()while attached; ignored if layout_config_path is given, in which case the dock’s ownDockLayoutMenudecides insteadlayout_config_path (
Optional[Tuple[str,...]]) – If given (and dock is not None), installs (or reuses) aDockLayoutMenuon the dock’s title bar, letting the user pick and persist how panels sharing this dock are arrangedis_shown (
Callable[[],bool]) – Returns whether the panel is currently supposed to be visible; used to decide whether an attach/detach toggle should immediately re-render it
- Attributes:
- orientation
Methods
show
- property orientation
- class pymodaq_gui.plotting.utils.plot_utils.DockLayoutMenu(dock, config_path, on_change=None)[source]
Bases:
objectRight-click menu on a shared Dock’s title bar to choose how the panels docked into it (settings, controls, ROIs, …) are arranged, and remember that choice
Several unrelated panels (e.g. every actuator’s settings widget) can land in the same Dock via
display_in_dock(); the arrangement is therefore a property of the Dock itself, not of any one panel. One instance is installed per Dock (seeget_dock_layout_menu()), and changing the layout reflows every widget currently docked into it by removing and re-adding them via display_in_dock.- Parameters:
dock (
Dock)config_path (
Tuple[str,...]) – Config entry holding the choice, e.g. (‘pymodaq’, ‘control_modules’, ‘settings_dock_layout’).on_change (
Optional[Callable[[Orientation],None]]) – Replaces the default reflow for docks not managed throughdisplay_in_dock().
- class pymodaq_gui.plotting.utils.plot_utils.Point(*elt)[source]
Bases:
object- Attributes:
- coordinates
Methods
copy
- property coordinates
- class pymodaq_gui.plotting.utils.plot_utils.QVector(*elt)[source]
Bases:
QLineFMethods
dot(qvect)scalar product
prod(qvect)vectoriel product length along z
copy
norm
normalVector
normalVector_not_vectorized
translate_to
unitVector
vectorize
- class pymodaq_gui.plotting.utils.plot_utils.Vector(coordinates, origin=None)[source]
Bases:
object- Attributes:
- coordinates
- origin
Methods
copy
cross
dot
norm
unit_vector
- property coordinates
- property origin
- class pymodaq_gui.plotting.utils.plot_utils.ViewBox(parent=None, border=None, lockAspect=False, enableMouse=True, invertY=False, enableMenu=True, name=None, invertX=False)[source]
Bases:
ViewBoxCustom ViewBox used to enable other properties compared to parent class: pg.ViewBox
Methods
mouseClickEvent
sig_double_clicked
- sig_double_clicked
- staticMetaObject = PySide6.QtCore.QMetaObject("ViewBox" inherits "ViewBox": Methods: #35 type=Signal, signature=sig_double_clicked(double,double), parameters=double, double )
- pymodaq_gui.plotting.utils.plot_utils.display_in_dock(show, widget, dock, orientation=<Orientation.Horizontal: 1>)[source]
Get the
DockLayoutMenuon this dock’s title bar, creating it on first use.- Return type:
- pymodaq_gui.plotting.utils.plot_utils.get_sub_segmented_n_positions(spacing, points, limit=None)[source]
Number of Points returned by get_sub_segmented_positions, without building them
- Parameters:
spacing (
float) – Distance between two subpointspoints (
List[Point]) – List of Points in arbitrary dimension forming segments one want to sample with a distance equal to spacinglimit (
int) – If the raw number of positions (total length / spacing) exceeds this limit, it is returned directly instead of the exact one (the exact count is then not needed and may be huge to compute)
- Return type:
- pymodaq_gui.plotting.utils.plot_utils.get_sub_segmented_positions(spacing, points)[source]
Get Points coordinates spaced in between subsequent Points
- pymodaq_gui.plotting.utils.plot_utils.makeAlphaTriangles(data, lut=None, levels=None, scale=None, useRGBA=False)[source]
Convert an array of values into an ARGB array suitable for building QImages, OpenGL textures, etc.
Returns the ARGB array (unsigned byte) and a boolean indicating whether there is alpha channel data. This is a two stage process:
compute the polygons (triangles) from triangulation of the points
Rescale the data based on the values in the levels argument (min, max).
Determine the final output by passing the rescaled values through a lookup table.
Both stages are optional.
Arguments:
data
numpy array of int/float types. If
levels
List [min, max]; optionally rescale data before converting through the lookup table. The data is rescaled such that min->0 and max->*scale*:
rescaled = (clip(data, min, max) - min) * (*scale* / (max - min))
It is also possible to use a 2D (N,2) array of values for levels. In this case, it is assumed that each pair of min,max values in the levels array should be applied to a different subset of the input data (for example, the input data may already have RGB values and the levels are used to independently scale each channel). The use of this feature requires that levels.shape[0] == data.shape[-1].
scale
The maximum value to which data will be rescaled before being passed through the lookup table (or returned if there is no lookup table). By default this will be set to the length of the lookup table, or 255 if no lookup table is provided.
lut
Optional lookup table (array with dtype=ubyte). Values in data will be converted to color by indexing directly from lut. The output data shape will be input.shape + lut.shape[1:]. Lookup tables can be built using ColorMap or GradientWidget.
useRGBA
If True, the data is returned in RGBA order (useful for building OpenGL textures). The default is False, which returns in ARGB order for use with QImage (Note that ‘ARGB’ is a term used by the Qt documentation; the actual order is BGRA).