7.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: Iterable[float])[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(self)

prod(qvect)

vectoriel product length along z

unitVector(self)

copy

norm

normalVector_not_vectorized

translate_to

vectorize

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

scalar product

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

vectoriel product length along z

translate_to(point=PyQt5.QtCore.QPointF())[source]
unitVector(self) QLineF[source]
vectorize()[source]
class pymodaq_gui.plotting.utils.plot_utils.RoiInfo(origin: Point | Iterable[float], size: Point | Iterable[float], angle: float = None, centered: bool = False, color: Tuple[int, int, int] = (255, 0, 0), roi_class: type = None, index: int = 0)[source]

Bases: object

DataClass holding info about a given ROI

Parameters:
Attributes:
angle
roi_class

Methods

to_slices()

Get slices to be used directly to slice DataWithAxes

center_origin

info_from_linear_roi

info_from_rect_roi

center_origin()[source]
classmethod info_from_linear_roi(roi: LinearROI)[source]
classmethod info_from_rect_roi(roi: RectROI)[source]
to_slices() Iterable[slice][source]

Get slices to be used directly to slice DataWithAxes

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: Point | ndarray, origin: Point = None)[source]

Bases: object

Attributes:
coordinates
origin

Methods

copy

cross

dot

norm

unit_vector

copy()[source]
cross(other: Vector)[source]
dot(other: Vector)[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]
sig_double_clicked

int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Type:

pyqtSignal(*types, name

Type:

str = …, revision

pymodaq_gui.plotting.utils.plot_utils.get_sub_segmented_positions(spacing: float, points: List[Point]) List[ndarray][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:

The list of the coordinates of the 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:

  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: tuple, nstyle=3)[source]