7.5.5.1.6. pymodaq_gui.plotting.data_viewers.viewer2D module

class pymodaq_gui.plotting.data_viewers.viewer2D.Histogrammer(histogram_container: QWidget, histogram_refs=['red', 'green', 'blue'])[source]

Bases: QObject

Attributes:
autolevels

Methods

set_gradient([histo, gradient])

Change the color gradient of the specified histogram :param histo: :type histo: (str) either 'red', 'green', 'blue', 'spread' or 'all' :param gradient: :type gradient: (str or Gradient)

activated

add_histogram

affect_histo_to_imageitems

get_histogram

get_histograms

gradient_changed

set_autolevels

setup_histograms

show_hide_histogram

activated(histo_action_checked)[source]
add_histogram(histogram)[source]
affect_histo_to_imageitems(image_items)[source]
get_histogram(name)[source]
get_histograms()[source]
set_autolevels(isautolevels=True)[source]
set_gradient(histo='red', gradient='grey')[source]

Change the color gradient of the specified histogram :param histo: :type histo: (str) either ‘red’, ‘green’, ‘blue’, ‘spread’ or ‘all’ :param gradient: :type gradient: (str or Gradient)

setup_histograms()[source]
show_hide_histogram(checked, are_items_visible)[source]
property autolevels
gradient_changed

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

class pymodaq_gui.plotting.data_viewers.viewer2D.ImageDisplayer(plotitem, data_distribution: DataDistribution)[source]

Bases: QObject

This Object deals with the display of 2D data with a plotitem

Attributes:
autolevels
labels
legend

Methods

get_image

get_images

set_autolevels

show_legend

update_data

update_display_items

update_image_visibility

updated_item

get_image(name)[source]
get_images()[source]
set_autolevels(isautolevel)[source]
show_legend(show=True)[source]
update_data(dwa: DataWithAxes)[source]
update_display_items(labels: List[str] = None)[source]
update_image_visibility(are_items_visible)[source]
property autolevels
property labels
property legend
updated_item

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

class pymodaq_gui.plotting.data_viewers.viewer2D.IsoCurver(image_source, histogram_parent)[source]

Bases: QObject

Methods

set_isocurve_data

setup_iso_curve

show_hide_iso

update_histogram_parent

update_image_source

update_isocurve

set_isocurve_data(data)[source]
setup_iso_curve(parent_image_item='red')[source]
show_hide_iso(show=True)[source]
update_histogram_parent(histogram)[source]
update_image_source(image_source)[source]
update_isocurve()[source]
class pymodaq_gui.plotting.data_viewers.viewer2D.View2D(parent_widget=None)[source]

Bases: ActionManager, QObject

Attributes:
plotitem

Methods

get_crosshair_position()

Convenience function from the Crosshair

get_crosshair_signal()

Convenience function from the Crosshair

move_scale_roi_target([pos, size])

Move and scale the target ROI (used to display a particular area, for instance the currently scanned points during a scan :param pos: :type pos: (iterable) setting the central position of the ROI in the view :param size: :type size: (iterable) setting the size of the ROI

scale_axis(xaxis, yaxis)

scale view coordinates from the regular axes to the scaled/offset ones

set_axis_label(position[, label, units])

Convenience method to set label and unit of any view axes :param position: :type position: (str) any of AXIS_POSITIONS :param label: :type label: (str) text of the axis label :param units: :type units: (str) units of the axis label

set_axis_scaling([position, scaling, ...])

Method used to update the scaling of the right and top axes in order to translate pixels to real coordinates :param position: :type position: (str) axis position either one of AXIS_POSITIONS :param scaling: :type scaling: (float) scaling of the axis :param offset: :type offset: (float) offset of the axis :param label: :type label: (str) text of the axis label :param units: :type units: (str) units of the axis label

set_crosshair_position(*positions)

Convenience function from the Crosshair

setup_actions()

Method where to create actions to be subclassed.

unscale_axis(xaxis, yaxis)

scale view coordinates from the scaled/offset axes to the regular ones

update_roi_channels(index[, roi_type])

Update the use_channel setting each time a ROI is added

add_roi_displayer

clear_plot_item

collapse_lineout_widgets

connect_things

display_crosshair_lineouts

display_images

display_roi_lineouts

get_axis

get_axis_label

get_data_at

get_double_clicked

get_view_range

get_visible_images

lock_aspect_ratio

move_left_splitter

move_right_splitter

notify_visibility_data_displayer

prepare_image_widget_for_lineouts

prepare_ui

remove_roi_displayer

roi_clicked

set_image_displayer

set_image_labels

setup_graphs

setup_widgets

show_ROI_select

show_hide_crosshair

show_hide_histogram

show_legend

show_lineout_widgets

show_roi_target

update_colors

add_roi_displayer(index, roi_type='', roi_name='')[source]
clear_plot_item()[source]
collapse_lineout_widgets()[source]
connect_things()[source]
display_crosshair_lineouts(crosshair_dte: DataToExport)[source]
display_images(datas)[source]
display_roi_lineouts(roi_dte: DataToExport)[source]
get_axis(position='left') AxisItem_Scaled[source]
get_axis_label(position)[source]
get_crosshair_position()[source]

Convenience function from the Crosshair

get_crosshair_signal()[source]

Convenience function from the Crosshair

get_data_at(name='red', xy=(0, 0))[source]
get_double_clicked()[source]
get_view_range()[source]
get_visible_images()[source]
lock_aspect_ratio()[source]
move_left_splitter(pos, index)[source]
move_right_splitter(pos, index)[source]
move_scale_roi_target(pos=None, size=None)[source]

Move and scale the target ROI (used to display a particular area, for instance the currently scanned points during a scan :param pos: :type pos: (iterable) setting the central position of the ROI in the view :param size: :type size: (iterable) setting the size of the ROI

notify_visibility_data_displayer()[source]
prepare_image_widget_for_lineouts(ratio=0.7)[source]
prepare_ui()[source]
remove_roi_displayer(roi_name='')[source]
roi_clicked(isroichecked=True)[source]
scale_axis(xaxis, yaxis)[source]

scale view coordinates from the regular axes to the scaled/offset ones

set_axis_label(position, label='', units='')[source]

Convenience method to set label and unit of any view axes :param position: :type position: (str) any of AXIS_POSITIONS :param label: :type label: (str) text of the axis label :param units: :type units: (str) units of the axis label

set_axis_scaling(position='top', scaling=1, offset=0, label='', units='Pxls')[source]

Method used to update the scaling of the right and top axes in order to translate pixels to real coordinates :param position: :type position: (str) axis position either one of AXIS_POSITIONS :param scaling: :type scaling: (float) scaling of the axis :param offset: :type offset: (float) offset of the axis :param label: :type label: (str) text of the axis label :param units: :type units: (str) units of the axis label

set_crosshair_position(*positions)[source]

Convenience function from the Crosshair

set_image_displayer(data_distribution: DataDistribution)[source]
set_image_labels(labels: List[str])[source]
setup_actions()[source]

Method where to create actions to be subclassed. Mandatory

Examples

>>> self.add_action('Quit', 'close2', "Quit program")
>>> self.add_action('Grab', 'camera', "Grab from camera", checkable=True)
>>> self.add_action('Load', 'Open', "Load target file (.h5, .png, .jpg) or data from camera", checkable=False)
>>> self.add_action('Save', 'SaveAs', "Save current data", checkable=False)

See also

ActionManager.add_action

setup_graphs(graphs_layout)[source]
setup_widgets()[source]
show_ROI_select()[source]
show_hide_crosshair(show=True)[source]
show_hide_histogram(show=True)[source]
show_legend(show=True)[source]
show_lineout_widgets()[source]
show_roi_target(show=True)[source]
unscale_axis(xaxis, yaxis)[source]

scale view coordinates from the scaled/offset axes to the regular ones

update_colors(colors: list)[source]
update_roi_channels(index, roi_type='')[source]

Update the use_channel setting each time a ROI is added

lineout_types = ['hor', 'ver', 'int']
property plotitem
class pymodaq_gui.plotting.data_viewers.viewer2D.Viewer2D(parent: QWidget = None, title='')[source]

Bases: ViewerBase

Object managing plotting and manipulation of 2D data using a View2D

Attributes:
crosshair

Convenience method

image_widget

Convenience method

roi_manager

Convenience method

roi_target

To be implemented if necessary (Viewer1D and above)

x_axis
y_axis

Methods

activate_roi([activate])

Activate the Roi manager using the corresponding action

get_axes_from_view(data)

Obtain axes info from the view

get_data_at()

Convenience method

move_roi_target([pos, size])

move a specific read only ROI at the given position on the viewer

set_crosshair_position(xpos, ypos)

Convenience method to set the crosshair positions

set_gradient(image_key, gradient)

convenience function

set_image_transform()

Deactivate some tool buttons if data type is "spread" then apply transform_image

show_roi([show, show_roi_widget])

convenience function to control roi

autolevels_first

crosshair_changed

double_clicked

prepare_connect_ui

process_crosshair_lineouts

process_roi_lineouts

roi_changed

selected_region_changed

set_visible_items

transform_image

update_crosshair_data

update_data

activate_roi(activate=True)[source]

Activate the Roi manager using the corresponding action

autolevels_first()[source]
crosshair_changed()[source]
double_clicked(posx, posy)[source]
get_axes_from_view(data: DataWithAxes)[source]

Obtain axes info from the view

Only for uniform data

get_data_at()[source]

Convenience method

move_roi_target(pos: Iterable[float] = None, size: Iterable[float] = (1, 1))[source]

move a specific read only ROI at the given position on the viewer

prepare_connect_ui()[source]
process_crosshair_lineouts(dte)[source]
process_roi_lineouts(roi_dte: DataToExport)[source]
roi_changed(*args, **kwargs)[source]
selected_region_changed()[source]
set_crosshair_position(xpos, ypos)[source]

Convenience method to set the crosshair positions

set_gradient(image_key, gradient)[source]

convenience function

set_image_transform() DataRaw[source]

Deactivate some tool buttons if data type is “spread” then apply transform_image

set_visible_items()[source]
show_roi(show=True, show_roi_widget=True)[source]

convenience function to control roi

transform_image(dwa: DataWithAxes)[source]
update_crosshair_data(crosshair_dte: DataToExport)[source]
update_data()[source]
property crosshair

Convenience method

property image_widget

Convenience method

property roi_manager

Convenience method

property roi_target: ROI

To be implemented if necessary (Viewer1D and above)

property x_axis
property y_axis
pymodaq_gui.plotting.data_viewers.viewer2D.generate_uniform_data() DataRaw[source]
pymodaq_gui.plotting.data_viewers.viewer2D.histogram_factory(image_item=None, gradient='red')[source]

Create a pyqtgraph HistogramLUTWidget widget (histogram) and link it to the corresponding image_item :param image_item: :type image_item: (ImageItem) the image item to be linked with the histogram :param gradient: :type gradient: (str) either ‘red’, ‘green’, ‘blue’, ‘spread’ or one of the Gradients

Return type:

HistogramLUTWidget instance

pymodaq_gui.plotting.data_viewers.viewer2D.image_item_factory(item_type='uniform', axisOrder='row-major', pen='r')[source]
pymodaq_gui.plotting.data_viewers.viewer2D.main(data_distribution='uniform')[source]

either ‘uniform’ or ‘spread’

pymodaq_gui.plotting.data_viewers.viewer2D.main_spread()[source]
pymodaq_gui.plotting.data_viewers.viewer2D.main_view()[source]
pymodaq_gui.plotting.data_viewers.viewer2D.plot_data(viewer2D: Viewer2D, ndata: int = 2)[source]
pymodaq_gui.plotting.data_viewers.viewer2D.print_roi_select(rect)[source]