|
ENLIGHTEN
Cross-platform desktop GUI for Wasatch Photonics spectrometers
|
Encapsulate the large graph in the center of ENLIGHTEN's Scope Capture screen. More...
Public Member Functions | |
| __init__ (self, ctl, name, legend=None, lock_marker=False, plot=None) | |
| This can be constructed in two ways. | |
| add_curve (self, name, y=[], x=None, pen=None, spec=None, measurement=None, rehide=True, in_legend=True) | |
| This was originally used used by ThumbnailWidget, when clicking the "show
trace" thumbnail button. | |
| add_item (self, item) | |
| called by Cursor to add its InfiniteLine to the graph | |
| add_roi_region (self, region) | |
| Horizontal ROI. | |
| copy_to_clipboard_callback (self) | |
| enable_axis_selection (self, flag) | |
| enable_wavenumbers (self, flag) | |
| get_x_axis_unit (self) | |
| in_pixels (self) | |
| in_wavelengths (self) | |
| in_wavenumbers (self) | |
| invert_x_axis (self) | |
| populate_scope_capture (self) | |
| populate_scope_setup (self) | |
| register_observer (self, event, callback) | |
| remove_curve (self, name=None, measurement_id=None) | |
| If nobody else persists the curve, this will delete the curve object itself from memory, as well removing it from the graph. | |
| remove_from_legend (self, name=None, measurement_id=None) | |
| remove_roi_region (self, region) | |
| rescale_curves (self) | |
| Iterates through all the curves currently shown on the graph and updates them to the correct x-axis. | |
| reset_axes (self) | |
| set_data (self, curve, y=None, x=None, label=None) | |
| set_x_axis (self, enum) | |
| when the Mode changes, update axis as appropriate | |
| set_x_axis_label (self, text, locked=False) | |
| extra provides margin from the frame bottom...probably would be better with CSS | |
| set_y_axis (self, enum) | |
| Only sets the "intention" to use the specified axis label; in reference- based modes, don't actually switch to the target axis until processing requirements are met (i.e., a reference has been taken). | |
| toggle_lock_axes (self) | |
| toggle_zoom (self) | |
| update_axis_callback (self) | |
| update_combo_tooltip (self) | |
| update_curve_marker (self, curve) | |
| update_marker (self) | |
| update_visibility (self) | |
Public Attributes | |
| button_copy = cfu.pushButton_copy_to_clipboard | |
| button_invert = cfu.pushButton_invert_x_axis | |
| button_lock_axes = cfu.pushButton_lock_axes | |
| button_zoom = cfu.pushButton_zoom_graph | |
| cb_marker = cfu.checkBox_graph_marker | |
| combo_axis = cfu.displayAxis_comboBox_axis | |
| copy_to_clipboard_callback | |
| ctl = ctl | |
| str | current_x_axis = self.combo_axis.currentIndex() |
| current_y_axis = common.Axes.COUNTS | |
| list | hide_when_zoomed = [ cfu.frame_new_save_col_holder, cfu.controlWidget ] |
| intended_y_axis = common.Axes.COUNTS | |
| invert_x_axis | |
| bool | inverted = False |
| layout = cfu.layout_scope_capture_graphs | |
| legend = legend | |
| live_curve = self.live_plot.plot([], pen=self.ctl.gui.make_pen(widget="live")) | |
| live_plot = pyqtgraph.PlotWidget(name="Live Scope") | |
| lock_marker = lock_marker | |
| name = name | |
| dict | observers = {} |
| plot = plot | |
| bool | show_marker = False |
| stacked_widget = cfu.stackedWidget_scope_setup_live_spectrum | |
| toggle_lock_axes | |
| toggle_zoom | |
| update_axis_callback | |
| update_marker | |
| bool | x_axis_locked = False |
| bool | y_axis_locked = False |
| bool | zoomed = False |
Encapsulate the large graph in the center of ENLIGHTEN's Scope Capture screen.
This was intended to be a singleton, as the ENLIGHTEN GUI was basically written around one large central graph, but there can now be a second instance of this object used to control the "plugin graph" used by Plugin.PluginController.
We probably want to look into refactoring something (maybe split this class in half?), as some of these attributes / methods could be applied to "any graph", while others were intended to be specific to the main Scope Capture graph.
We are not making full use of pyqtgraph's power, in part because it turns out that surprisingly little of pyqtgraph is documented online. To get a better sense of its power, you should install and run the examples as described:
In particular, we should:
| enlighten.scope.Graph.Graph.__init__ | ( | self, | |
| ctl, | |||
| name, | |||
| legend = None, | |||
| lock_marker = False, | |||
| plot = None ) |
This can be constructed in two ways.
By default, the Graph populates its own chart and legend (the one used by most of ENLIGHTEN). However, it also allows an external caller (like PluginController) to pass-in an already-constructed chart and legend. Perhaps we need a GraphFactory?
| enlighten.scope.Graph.Graph.add_curve | ( | self, | |
| name, | |||
| y = [], | |||
| x = None, | |||
| pen = None, | |||
| spec = None, | |||
| measurement = None, | |||
| rehide = True, | |||
| in_legend = True ) |
This was originally used used by ThumbnailWidget, when clicking the "show trace" thumbnail button.
It's now also being used by BaselineCorrectionFeature, RamanShiftCorrection, etc.
| enlighten.scope.Graph.Graph.add_item | ( | self, | |
| item ) |
called by Cursor to add its InfiniteLine to the graph
| enlighten.scope.Graph.Graph.add_roi_region | ( | self, | |
| region ) |
Horizontal ROI.
| enlighten.scope.Graph.Graph.copy_to_clipboard_callback | ( | self | ) |
| enlighten.scope.Graph.Graph.enable_axis_selection | ( | self, | |
| flag ) |
| enlighten.scope.Graph.Graph.enable_wavenumbers | ( | self, | |
| flag ) |
| enlighten.scope.Graph.Graph.get_x_axis_unit | ( | self | ) |
| enlighten.scope.Graph.Graph.in_pixels | ( | self | ) |
| enlighten.scope.Graph.Graph.in_wavelengths | ( | self | ) |
| enlighten.scope.Graph.Graph.in_wavenumbers | ( | self | ) |
| enlighten.scope.Graph.Graph.invert_x_axis | ( | self | ) |
| enlighten.scope.Graph.Graph.populate_scope_capture | ( | self | ) |
| enlighten.scope.Graph.Graph.populate_scope_setup | ( | self | ) |
| enlighten.scope.Graph.Graph.register_observer | ( | self, | |
| event, | |||
| callback ) |
| enlighten.scope.Graph.Graph.remove_curve | ( | self, | |
| name = None, | |||
| measurement_id = None ) |
If nobody else persists the curve, this will delete the curve object itself from memory, as well removing it from the graph.
| enlighten.scope.Graph.Graph.remove_from_legend | ( | self, | |
| name = None, | |||
| measurement_id = None ) |
| enlighten.scope.Graph.Graph.remove_roi_region | ( | self, | |
| region ) |
| enlighten.scope.Graph.Graph.rescale_curves | ( | self | ) |
Iterates through all the curves currently shown on the graph and updates them to the correct x-axis.
| enlighten.scope.Graph.Graph.reset_axes | ( | self | ) |
| enlighten.scope.Graph.Graph.set_data | ( | self, | |
| curve, | |||
| y = None, | |||
| x = None, | |||
| label = None ) |
| enlighten.scope.Graph.Graph.set_x_axis | ( | self, | |
| enum ) |
when the Mode changes, update axis as appropriate
| enlighten.scope.Graph.Graph.set_x_axis_label | ( | self, | |
| text, | |||
| locked = False ) |
extra
provides margin from the frame bottom...probably would be better with CSS
| enlighten.scope.Graph.Graph.set_y_axis | ( | self, | |
| enum ) |
Only sets the "intention" to use the specified axis label; in reference- based modes, don't actually switch to the target axis until processing requirements are met (i.e., a reference has been taken).
| enlighten.scope.Graph.Graph.toggle_lock_axes | ( | self | ) |
| enlighten.scope.Graph.Graph.toggle_zoom | ( | self | ) |
| enlighten.scope.Graph.Graph.update_axis_callback | ( | self | ) |
| enlighten.scope.Graph.Graph.update_combo_tooltip | ( | self | ) |
| enlighten.scope.Graph.Graph.update_curve_marker | ( | self, | |
| curve ) |
| enlighten.scope.Graph.Graph.update_marker | ( | self | ) |
| enlighten.scope.Graph.Graph.update_visibility | ( | self | ) |
| enlighten.scope.Graph.Graph.button_copy = cfu.pushButton_copy_to_clipboard |
| enlighten.scope.Graph.Graph.button_invert = cfu.pushButton_invert_x_axis |
| enlighten.scope.Graph.Graph.button_lock_axes = cfu.pushButton_lock_axes |
| enlighten.scope.Graph.Graph.button_zoom = cfu.pushButton_zoom_graph |
| enlighten.scope.Graph.Graph.cb_marker = cfu.checkBox_graph_marker |
| enlighten.scope.Graph.Graph.combo_axis = cfu.displayAxis_comboBox_axis |
| enlighten.scope.Graph.Graph.copy_to_clipboard_callback |
| enlighten.scope.Graph.Graph.ctl = ctl |
| enlighten.scope.Graph.Graph.current_x_axis = self.combo_axis.currentIndex() |
| enlighten.scope.Graph.Graph.current_y_axis = common.Axes.COUNTS |
| list enlighten.scope.Graph.Graph.hide_when_zoomed = [ cfu.frame_new_save_col_holder, cfu.controlWidget ] |
| enlighten.scope.Graph.Graph.intended_y_axis = common.Axes.COUNTS |
| enlighten.scope.Graph.Graph.invert_x_axis |
| enlighten.scope.Graph.Graph.inverted = False |
| enlighten.scope.Graph.Graph.layout = cfu.layout_scope_capture_graphs |
| enlighten.scope.Graph.Graph.legend = legend |
| enlighten.scope.Graph.Graph.live_curve = self.live_plot.plot([], pen=self.ctl.gui.make_pen(widget="live")) |
| enlighten.scope.Graph.Graph.live_plot = pyqtgraph.PlotWidget(name="Live Scope") |
| enlighten.scope.Graph.Graph.lock_marker = lock_marker |
| enlighten.scope.Graph.Graph.name = name |
| dict enlighten.scope.Graph.Graph.observers = {} |
| enlighten.scope.Graph.Graph.plot = plot |
| bool enlighten.scope.Graph.Graph.show_marker = False |
| enlighten.scope.Graph.Graph.stacked_widget = cfu.stackedWidget_scope_setup_live_spectrum |
| enlighten.scope.Graph.Graph.toggle_lock_axes |
| enlighten.scope.Graph.Graph.toggle_zoom |
| enlighten.scope.Graph.Graph.update_axis_callback |
| enlighten.scope.Graph.Graph.update_marker |
| bool enlighten.scope.Graph.Graph.x_axis_locked = False |
| enlighten.scope.Graph.Graph.y_axis_locked = False |
| enlighten.scope.Graph.Graph.zoomed = False |