8.5.5.4.4. pymodaq_gui.plotting.utils.plot_utils module

class pymodaq_gui.plotting.utils.plot_utils.Data0DWithHistory(Nsamples=200)[source]

Bases: object

Object to store scalar values and keep a history of a given length to them

Attributes:
datas
length
size
xaxis

Methods

add_datas

clear_data

clear_data()[source]
add_datas

Dispatch methods based on type signature

See also

Dispatcher

property datas
property length
property size
property xaxis
class pymodaq_gui.plotting.utils.plot_utils.Point(*elt)[source]

Bases: object

Attributes:
coordinates

Methods

copy

copy()[source]
property coordinates
class pymodaq_gui.plotting.utils.plot_utils.QVector(*elt)[source]

Bases: QLineF

Methods

dot(qvect)

scalar product

normalVector()

prod(qvect)

vectoriel product length along z

unitVector()

copy

norm

normalVector_not_vectorized

translate_to

vectorize

copy()[source]
dot(qvect)[source]

scalar product

norm()[source]
normalVector()[source]
normalVector_not_vectorized()[source]
prod(qvect)[source]

vectoriel product length along z

translate_to(point=PyQt6.QtCore.QPointF())[source]
unitVector()[source]
vectorize()[source]
class pymodaq_gui.plotting.utils.plot_utils.RoiInfo(origin, size, angle=None, centered=False, color=(255, 0, 0), roi_class=None, index=0)[source]

Bases: object

DataClass holding info about a given ROI

Parameters:
Attributes:
angle
roi_class

Methods

from_slices(slices)

Return a ROIInfo instance from a list of slices

to_slices()

Get slices to be used directly to slice DataWithAxes

center_origin

info_from_linear_roi

info_from_rect_roi

classmethod from_slices(slices)[source]

Return a ROIInfo instance from a list of slices

Return type:

RoiInfo

classmethod info_from_linear_roi(roi)[source]
classmethod info_from_rect_roi(roi)[source]
center_origin()[source]
to_slices()[source]

Get slices to be used directly to slice DataWithAxes

Return type:

Iterable[slice]

angle: float = None
centered: bool = False
color: Tuple[int, int, int] = (255, 0, 0)
index: int = 0
origin: Point | Iterable[float]
roi_class: type = None
size: Point | Iterable[float]
class pymodaq_gui.plotting.utils.plot_utils.Vector(coordinates, origin=None)[source]

Bases: object

Attributes:
coordinates
origin

Methods

copy

cross

dot

norm

unit_vector

copy()[source]
cross(other)[source]
dot(other)[source]
norm()[source]
unit_vector()[source]
property coordinates
property origin
class pymodaq_gui.plotting.utils.plot_utils.View_cust(parent=None, border=None, lockAspect=False, enableMouse=True, invertY=False, enableMenu=True, name=None, invertX=False)[source]

Bases: ViewBox

Custom ViewBox used to enable other properties compared to parent class: pg.ViewBox

Methods

mouseClickEvent

sig_double_clicked

mouseClickEvent(ev)[source]
pymodaq_gui.plotting.utils.plot_utils.get_sub_segmented_positions(spacing, points)[source]

Get Points coordinates spaced in between subsequent Points

Parameters:
  • spacing (float) – Distance between two subpoints

  • points (List[Point]) – List of Points in arbitrary dimension forming segments one want to sample with a distance equal to spacing

Returns:

List[np.ndarray]

Return type:

List[ndarray]

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:

  1. compute the polygons (triangles) from triangulation of the points

  2. Rescale the data based on the values in the levels argument (min, max).

  3. 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).

pymodaq_gui.plotting.utils.plot_utils.makePolygons(tri)[source]
pymodaq_gui.plotting.utils.plot_utils.make_dashed_pens(color, nstyle=3)[source]