erlab.interactive.imagetool.core¶
Provides core functionality of imagetool.
Functions
|
Sync decorated methods across multiple |
Classes
|
A interactive tool based on |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Internal class for handling linked |
- class erlab.interactive.imagetool.core.ImageSlicerArea(parent=None, data=None, cmap='magma', gamma=0.5, zeroCentered=False, rad2deg=False, *, bench=False, image_cls=None, plotdata_cls=None)[source]¶
Bases:
QWidget
A interactive tool based on
pyqtgraph
for exploring 3D data.- Parameters:
parent (QWidget | None) – Parent widget.
data (xr.DataArray | npt.ArrayLike | None) – Data to display. The data must have 2 to 4 dimensions.
cmap (str | pg.ColorMap) – Default colormap of the data.
gamma (float) – Default power law normalization of the colormap.
zeroCentered (bool) – If
True
, the normalization is applied symmetrically from the midpoint of the colormap.rad2deg (bool | Iterable[str]) – If
True
anddata
is notNone
, converts some known angle coordinates to degrees. If an iterable of strings is given, only the coordinates that correspond to the given strings are converted.bench (bool) – Prints the fps on Ctrl + drag, for debug purposes
- Signals:
sigDataChanged()
sigCurrentCursorChanged(index)
sigViewOptionChanged()
sigCursorCountChanged(n_cursors) – Inherited from
erlab.interactive.slicer.ArraySlicer
.sigIndexChanged(cursor, axes) – Inherited from
erlab.interactive.slicer.ArraySlicer
.sigBinChanged(cursor, axes) – Inherited from
erlab.interactive.slicer.ArraySlicer
.sigShapeChanged() – Inherited from
erlab.interactive.slicer.ArraySlicer
.
- adjust_layout(horiz_pad=45, vert_pad=30, font_size=11.0, r=(1.2, 1.5, 3.0, 1.0))[source]¶
Determine the padding and aspect ratios.
- Parameters:
Notes
Axes indices and layout parameters.
┌───────────┬───────────┐ r[0] │ 1 │ 6 │ │ ├───────────┤ ├───────────┤ 3 │ r[1] │ 4 ├───────────┤ │ │ 7 │ │───────────┼───────┬───┤ │ │ │ │ r[2] │ 0 │ 5 │ 2 │ │ │ │ │ └───────────┴───────┴───┘ r[3] * r[2]
- set_colormap(cmap=None, gamma=None, reversed=None, highContrast=None, zeroCentered=None, update=True)[source]¶
- set_data(data, rad2deg=False)[source]¶
Set the data to be displayed.
- Parameters:
data (xr.DataArray | npt.ArrayLike) – The data to be displayed. If a
xarray.DataArray
is given, the dimensions and coordinates are used to determine the axes of the plots. If axarray.Dataset
is given, the first data variable is used. If anumpy.ndarray
is given, it is converted to axarray.DataArray
with default dimensions.rad2deg (bool | Iterable[str]) – If
True
, converts coords along dimensions that have angle-like names to degrees. If an iterable of strings is given, coordinates for dimensions that correspond to the given strings are converted.
- update_values(values, update=True)[source]¶
Update only the values of the data.
The coords and shape of the data array are not changed.
- Parameters:
values (npt.NDArray | xr.DataArray) – The new values to be set. If a
xarray.DataArray
is given, the dimensions must match the current data array. If anumpy.ndarray
is given, the shape must match the current data array. Note that if the user has transposed the current data array, passing anumpy.ndarray
with the original shape will fail.update (bool) – If
True
, the plots are updated after setting the new values.
Note
This method only checks for matching dimension name and shape, and does not check for equal coordinate values.
- COLORS: tuple[QColor, ...] = (<PyQt6.QtGui.QColor object>, <PyQt6.QtGui.QColor object>, <PyQt6.QtGui.QColor object>, <PyQt6.QtGui.QColor object>, <PyQt6.QtGui.QColor object>, <PyQt6.QtGui.QColor object>, <PyQt6.QtGui.QColor object>)¶
PySide6.QtGui.QColor
s for multiple cursors.
- property array_slicer: ArraySlicer¶
- property data: xarray.DataArray¶
- property main_image: ItoolPlotItem¶
Return the main PlotItem.