sleap.gui.overlays.pafs

Overlay for part affinity fields.

Currently a DataOverlay gets data from a model (i.e., it runs inference on the current frame) and then uses a MultiQuiverPlot object to show the resulting part affinity fields.

class sleap.gui.overlays.pafs.MultiQuiverPlot(frame: numpy.array = None, show: list = None, decimation: int = 1, scale: float = 1.0, *args, **kwargs)[source]

QtWidgets.QGraphicsObject to display multiple quiver plots in a QtWidgets.QGraphicsView.

Parameters
  • frame (numpy.array) – Data for one frame of quiver plot data. Shape of array should be (channels, height, width).

  • show (list, optional) – List of channels to show. If None, show all channels.

  • decimation (int, optional) – Decimation factor. If 1, show every arrow.

Returns

None.

Note

Each channel corresponds to two (h, w) arrays: x and y for the vector.

When initialized, creates one child QuiverPlot item for each channel.

boundingRect() → PySide2.QtCore.QRectF[source]

Method required by Qt.

paint(painter, option, widget=None)[source]

Method required by Qt.

class sleap.gui.overlays.pafs.PafOverlay(labels: sleap.io.dataset.Labels = None, player: sleap.gui.widgets.video.QtVideoPlayer = None, data: Sequence = None, overlay_class: Optional[Union[ConfMapsPlot, MultiQuiverPlot]] = None)[source]

Class show pafs saved in HDF5 (not currently used).

class sleap.gui.overlays.pafs.QuiverPlot(field_x: numpy.array = None, field_y: numpy.array = None, color=[255, 255, 255], decimation=1, scale=1, *args, **kwargs)[source]

QtWidgets.QGraphicsObject for drawing single quiver plot.

Parameters
  • field_x (numpy.array) – (h, w) array of x component of vectors.

  • field_y (numpy.array) – (h, w) array of y component of vectors.

  • color (list, optional) – Arrow color. Format as (r, g, b) array.

  • decimation (int, optional) – Decimation factor. If 1, show every arrow.

Returns

None.

boundingRect() → PySide2.QtCore.QRectF[source]

Method called by Qt in order to determine whether object is in visible frame.

paint(painter, option, widget=None)[source]

Method called by Qt to draw object.