ENLIGHTEN
Cross-platform desktop GUI for Wasatch Photonics spectrometers
Loading...
Searching...
No Matches
enlighten.device.Multispec.Multispec Class Reference

This class orchestrates ENLIGHTEN's simultaneous connection to multiple spectrometers in parallel. More...

Public Member Functions

 __init__ (self, ctl)
 
 add (self, device)
 
 add_color_button (self)
 The Qt Designer doesn't let us emplace pyqtgraph objects (I think?), so add this button at runtime.
 
bool any_has_excitation (self)
 
 change_device_setting (self, setting, value=0, all_=False)
 send commands to device thread via (name, value) pickleable tuples
 
 check_callback (self)
 
None check_ejected_unplugged (self, list[DeviceID] connected_devices)
 Goes through the set of ejected spectrometers and checks if they still appear in the list of connected devices.
 
bool check_hardware_curve_present (self, name, spec_id)
 
 check_hide_others_callback (self)
 
bool check_spec_user_ejected (self, DeviceID device_id)
 
 choose_color (self, spec, ignore_auto=False)
 
 clear_reset (self, device_id)
 
 color_changed_callback (self, btn)
 The user has manually selected a color for the current spectrometer, so save and apply it.
 
 combo_callback (self)
 If the selected MultiSpec spectrometer changes, update affected objects.
 
int count (self)
 
Spectrometer current_spectrometer (self)
 
 eject_current_spec (self)
 
 found_desired (self)
 
 get_clones (self, device_id)
 This function hopefully won't need to be retained, but is being added to analyze a developmental bug in which apparently the same spectrometer connected twice, and both instances continued to function :-(.
 
DeviceID get_combo_device_id (self)
 
int get_combo_index (self, spec)
 
 get_hardware_feature_curve (self, name, spec_id)
 
Spectrometer get_spectrometer (self, device_id)
 
 get_spectrometers (self)
 
bool have_any_andor (self)
 
bool have_any_in_process (self)
 
 hide (self, spec)
 
bool is_autocolor (self)
 
bool is_connected (self, device_id)
 
bool is_current_spectrometer (self, spec)
 
bool is_disconnecting (self, str device_id)
 
bool is_gave_up (self, device_id)
 
bool is_ignore (self, device_id)
 
bool is_in_process (self, device_id)
 
 is_in_reset (self, device_id)
 
bool is_selected (self, device_id)
 
 lock_callback (self)
 
 make_pen (self, spec)
 
 read_spec_object (self, device_id)
 
 register_hardware_feature_curve (self, name, spec_id, curve)
 
 register_strip_feature (self, feature)
 MZ: Whut?
 
 reject_undesireable (self, device)
 
bool remove (self, spec=None, silent=False)
 
 remove_all (self)
 
 remove_hardware_curve (self, name, spec_id)
 
 remove_in_process (self, device_id)
 
 reset_seen (self)
 
 reset_tries (self, device_id)
 
 select_next_spectrometer (self)
 
 select_prev_spectrometer (self)
 
 set_app_state (self, field, value, all_=False)
 Update the given SpectrometerApplicationState field for the current spectrometer, or for all spectrometers if locking is enabled.
 
None set_disconnecting (self, str device_id, bool status)
 Records that we are kicking off a spectrometer so Enlighten doesn't accidentally pick it up.
 
 set_gave_up (self, device_id)
 Sets in_process value to None, indicating that we've given up trying to connect to that device_id (it is permanently but inactively "in process").
 
 set_ignore (self, device_id)
 
 set_in_process (self, device_id, WasatchDeviceWrapper device)
 
 set_in_reset (self, device_id)
 
 set_state (self, field, value)
 Update the given SpectrometerState field for the current spectrometer, or for all spectrometers if locking is enabled.
 
 unhide (self, spec)
 
 update_color (self)
 
 update_hide_others (self)
 
 update_spectrometer_colors (self)
 
 update_widget (self)
 

Public Attributes

 button_color = self.add_color_button()
 
 button_lock = cfu.pushButton_multiSpec_lock
 
 check_autocolor = cfu.checkBox_multiSpec_autocolor
 
 check_callback
 
 check_hide_others = cfu.checkBox_multiSpec_hide_others
 
 check_hide_others_callback
 
 color_changed_callback
 
 combo_callback
 
 combo_spectrometer = cfu.comboBox_multiSpec
 
 ctl = ctl
 
 device_id = None
 
dict disconnecting = {}
 
 eject_button = cfu.pushButton_eject
 
 eject_current_spec
 
dict ejected = set()
 
 frame_widget = cfu.frame_multiSpecWidget
 
bool hide_others = False
 
dict ignore = {}
 
dict in_process = {}
 
 layout_colors = cfu.horizontalLayout_multiSpec_colors
 
 lock_callback
 
list lockable_widgets
 
bool locked = False
 
dict reset_spec_objs = {}
 
 seen_colors = set()
 
dict serial_colors = {}
 
dict spec_detector_temp_curves = {}
 
 spec_hardware_feature_curves = defaultdict(dict)
 
dict spec_hardware_live_curves = {}
 
 spec_in_reset = defaultdict(int)
 
dict spec_laser_temp_curves = {}
 
dict spec_roi_curtains = {}
 
dict spectrometers = {}
 
list strip_features = []
 

Detailed Description

This class orchestrates ENLIGHTEN's simultaneous connection to multiple spectrometers in parallel.

For the first two years of its life (2016-2018), ENLIGHTEN could only connect to one spectrometer at a time. Everything was hard-coded to assume a single spectrometer, and in many cases state was mastered in GUI widgets themselves, such that there was literally no place to store, for instance, the current integration time or laser enable status of a second spectrometer.

Refactoring such a fundamental aspect of the application was a big deal, so this class was created to encapsulate the 1-to-many relationships.

At some point I might rename this to be just "Spectrometers," in parallel with "Measurements" etc.

It's worth considering whether to give Multispec a shutting_down flag, or a callback to get it, but the tear-down process is sufficiently lightweight to just let it ride.

Constructor & Destructor Documentation

◆ __init__()

enlighten.device.Multispec.Multispec.__init__ ( self,
ctl )

Member Function Documentation

◆ add()

enlighten.device.Multispec.Multispec.add ( self,
device )

◆ add_color_button()

enlighten.device.Multispec.Multispec.add_color_button ( self)

The Qt Designer doesn't let us emplace pyqtgraph objects (I think?), so add this button at runtime.

◆ any_has_excitation()

bool enlighten.device.Multispec.Multispec.any_has_excitation ( self)

◆ change_device_setting()

enlighten.device.Multispec.Multispec.change_device_setting ( self,
setting,
value = 0,
all_ = False )

send commands to device thread via (name, value) pickleable tuples

◆ check_callback()

enlighten.device.Multispec.Multispec.check_callback ( self)

◆ check_ejected_unplugged()

None enlighten.device.Multispec.Multispec.check_ejected_unplugged ( self,
list[DeviceID] connected_devices )

Goes through the set of ejected spectrometers and checks if they still appear in the list of connected devices.

If they don't, this means a user ejected spec has been physically unplugged and should be removed from the set so the user can plug it back in

◆ check_hardware_curve_present()

bool enlighten.device.Multispec.Multispec.check_hardware_curve_present ( self,
name,
spec_id )

◆ check_hide_others_callback()

enlighten.device.Multispec.Multispec.check_hide_others_callback ( self)

◆ check_spec_user_ejected()

bool enlighten.device.Multispec.Multispec.check_spec_user_ejected ( self,
DeviceID device_id )

◆ choose_color()

enlighten.device.Multispec.Multispec.choose_color ( self,
spec,
ignore_auto = False )

◆ clear_reset()

enlighten.device.Multispec.Multispec.clear_reset ( self,
device_id )

◆ color_changed_callback()

enlighten.device.Multispec.Multispec.color_changed_callback ( self,
btn )

The user has manually selected a color for the current spectrometer, so save and apply it.

◆ combo_callback()

enlighten.device.Multispec.Multispec.combo_callback ( self)

If the selected MultiSpec spectrometer changes, update affected objects.

◆ count()

int enlighten.device.Multispec.Multispec.count ( self)

◆ current_spectrometer()

Spectrometer enlighten.device.Multispec.Multispec.current_spectrometer ( self)

◆ eject_current_spec()

enlighten.device.Multispec.Multispec.eject_current_spec ( self)

◆ found_desired()

enlighten.device.Multispec.Multispec.found_desired ( self)
Returns
True if we're only looking for one spectrometer, and already found it

◆ get_clones()

enlighten.device.Multispec.Multispec.get_clones ( self,
device_id )

This function hopefully won't need to be retained, but is being added to analyze a developmental bug in which apparently the same spectrometer connected twice, and both instances continued to function :-(.

◆ get_combo_device_id()

DeviceID enlighten.device.Multispec.Multispec.get_combo_device_id ( self)

◆ get_combo_index()

int enlighten.device.Multispec.Multispec.get_combo_index ( self,
spec )

◆ get_hardware_feature_curve()

enlighten.device.Multispec.Multispec.get_hardware_feature_curve ( self,
name,
spec_id )

◆ get_spectrometer()

Spectrometer enlighten.device.Multispec.Multispec.get_spectrometer ( self,
device_id )

◆ get_spectrometers()

enlighten.device.Multispec.Multispec.get_spectrometers ( self)

◆ have_any_andor()

bool enlighten.device.Multispec.Multispec.have_any_andor ( self)
Note
there may be a clever way to do this too

◆ have_any_in_process()

bool enlighten.device.Multispec.Multispec.have_any_in_process ( self)
Returns
True if any in_process devices are honestly still in-process (i.e. not "gave up")
Note
I think there's a cleverer way to do this in Python now

◆ hide()

enlighten.device.Multispec.Multispec.hide ( self,
spec )

◆ is_autocolor()

bool enlighten.device.Multispec.Multispec.is_autocolor ( self)

◆ is_connected()

bool enlighten.device.Multispec.Multispec.is_connected ( self,
device_id )

◆ is_current_spectrometer()

bool enlighten.device.Multispec.Multispec.is_current_spectrometer ( self,
spec )

◆ is_disconnecting()

bool enlighten.device.Multispec.Multispec.is_disconnecting ( self,
str device_id )

◆ is_gave_up()

bool enlighten.device.Multispec.Multispec.is_gave_up ( self,
device_id )

◆ is_ignore()

bool enlighten.device.Multispec.Multispec.is_ignore ( self,
device_id )

◆ is_in_process()

bool enlighten.device.Multispec.Multispec.is_in_process ( self,
device_id )
Returns
True if in_process at all (including None, indicating "gave up")

◆ is_in_reset()

enlighten.device.Multispec.Multispec.is_in_reset ( self,
device_id )

◆ is_selected()

bool enlighten.device.Multispec.Multispec.is_selected ( self,
device_id )

◆ lock_callback()

enlighten.device.Multispec.Multispec.lock_callback ( self)

◆ make_pen()

enlighten.device.Multispec.Multispec.make_pen ( self,
spec )
Note
that even though we determine color locally, we still pass the widget back to make_pen to allow config-based configuration of style, width etc
Returns
QPen

◆ read_spec_object()

enlighten.device.Multispec.Multispec.read_spec_object ( self,
device_id )

◆ register_hardware_feature_curve()

enlighten.device.Multispec.Multispec.register_hardware_feature_curve ( self,
name,
spec_id,
curve )

◆ register_strip_feature()

enlighten.device.Multispec.Multispec.register_strip_feature ( self,
feature )

MZ: Whut?

◆ reject_undesireable()

enlighten.device.Multispec.Multispec.reject_undesireable ( self,
device )
Returns
True if we're only looking for one spectrometer, and this isn't it

◆ remove()

bool enlighten.device.Multispec.Multispec.remove ( self,
spec = None,
silent = False )
Returns
success

◆ remove_all()

enlighten.device.Multispec.Multispec.remove_all ( self)

◆ remove_hardware_curve()

enlighten.device.Multispec.Multispec.remove_hardware_curve ( self,
name,
spec_id )

◆ remove_in_process()

enlighten.device.Multispec.Multispec.remove_in_process ( self,
device_id )

◆ reset_seen()

enlighten.device.Multispec.Multispec.reset_seen ( self)

◆ reset_tries()

enlighten.device.Multispec.Multispec.reset_tries ( self,
device_id )

◆ select_next_spectrometer()

enlighten.device.Multispec.Multispec.select_next_spectrometer ( self)

◆ select_prev_spectrometer()

enlighten.device.Multispec.Multispec.select_prev_spectrometer ( self)

◆ set_app_state()

enlighten.device.Multispec.Multispec.set_app_state ( self,
field,
value,
all_ = False )

Update the given SpectrometerApplicationState field for the current spectrometer, or for all spectrometers if locking is enabled.

◆ set_disconnecting()

None enlighten.device.Multispec.Multispec.set_disconnecting ( self,
str device_id,
bool status )

Records that we are kicking off a spectrometer so Enlighten doesn't accidentally pick it up.

◆ set_gave_up()

enlighten.device.Multispec.Multispec.set_gave_up ( self,
device_id )

Sets in_process value to None, indicating that we've given up trying to connect to that device_id (it is permanently but inactively "in process").

◆ set_ignore()

enlighten.device.Multispec.Multispec.set_ignore ( self,
device_id )

◆ set_in_process()

enlighten.device.Multispec.Multispec.set_in_process ( self,
device_id,
WasatchDeviceWrapper device )

◆ set_in_reset()

enlighten.device.Multispec.Multispec.set_in_reset ( self,
device_id )

◆ set_state()

enlighten.device.Multispec.Multispec.set_state ( self,
field,
value )

Update the given SpectrometerState field for the current spectrometer, or for all spectrometers if locking is enabled.

◆ unhide()

enlighten.device.Multispec.Multispec.unhide ( self,
spec )

◆ update_color()

enlighten.device.Multispec.Multispec.update_color ( self)

◆ update_hide_others()

enlighten.device.Multispec.Multispec.update_hide_others ( self)

◆ update_spectrometer_colors()

enlighten.device.Multispec.Multispec.update_spectrometer_colors ( self)

◆ update_widget()

enlighten.device.Multispec.Multispec.update_widget ( self)

Member Data Documentation

◆ button_color

enlighten.device.Multispec.Multispec.button_color = self.add_color_button()

◆ button_lock

enlighten.device.Multispec.Multispec.button_lock = cfu.pushButton_multiSpec_lock

◆ check_autocolor

enlighten.device.Multispec.Multispec.check_autocolor = cfu.checkBox_multiSpec_autocolor

◆ check_callback

enlighten.device.Multispec.Multispec.check_callback

◆ check_hide_others

enlighten.device.Multispec.Multispec.check_hide_others = cfu.checkBox_multiSpec_hide_others

◆ check_hide_others_callback

enlighten.device.Multispec.Multispec.check_hide_others_callback

◆ color_changed_callback

enlighten.device.Multispec.Multispec.color_changed_callback

◆ combo_callback

enlighten.device.Multispec.Multispec.combo_callback

◆ combo_spectrometer

enlighten.device.Multispec.Multispec.combo_spectrometer = cfu.comboBox_multiSpec

◆ ctl

enlighten.device.Multispec.Multispec.ctl = ctl

◆ device_id

enlighten.device.Multispec.Multispec.device_id = None

◆ disconnecting

dict enlighten.device.Multispec.Multispec.disconnecting = {}

◆ eject_button

enlighten.device.Multispec.Multispec.eject_button = cfu.pushButton_eject

◆ eject_current_spec

enlighten.device.Multispec.Multispec.eject_current_spec

◆ ejected

enlighten.device.Multispec.Multispec.ejected = set()

◆ frame_widget

enlighten.device.Multispec.Multispec.frame_widget = cfu.frame_multiSpecWidget

◆ hide_others

bool enlighten.device.Multispec.Multispec.hide_others = False

◆ ignore

dict enlighten.device.Multispec.Multispec.ignore = {}

◆ in_process

dict enlighten.device.Multispec.Multispec.in_process = {}

◆ layout_colors

enlighten.device.Multispec.Multispec.layout_colors = cfu.horizontalLayout_multiSpec_colors

◆ lock_callback

enlighten.device.Multispec.Multispec.lock_callback

◆ lockable_widgets

list enlighten.device.Multispec.Multispec.lockable_widgets
Initial value:
= [ cfu.lightSourceWidget_shaded, # includes LaserWatchdog
cfu.detectorControlWidget_shaded,
cfu.displayAxisWidget_shaded,
cfu.scanAveragingWidget_shaded,
cfu.boxcarWidget_shaded ]

◆ locked

enlighten.device.Multispec.Multispec.locked = False

◆ reset_spec_objs

dict enlighten.device.Multispec.Multispec.reset_spec_objs = {}

◆ seen_colors

enlighten.device.Multispec.Multispec.seen_colors = set()

◆ serial_colors

dict enlighten.device.Multispec.Multispec.serial_colors = {}

◆ spec_detector_temp_curves

dict enlighten.device.Multispec.Multispec.spec_detector_temp_curves = {}

◆ spec_hardware_feature_curves

enlighten.device.Multispec.Multispec.spec_hardware_feature_curves = defaultdict(dict)

◆ spec_hardware_live_curves

dict enlighten.device.Multispec.Multispec.spec_hardware_live_curves = {}

◆ spec_in_reset

enlighten.device.Multispec.Multispec.spec_in_reset = defaultdict(int)

◆ spec_laser_temp_curves

dict enlighten.device.Multispec.Multispec.spec_laser_temp_curves = {}

◆ spec_roi_curtains

dict enlighten.device.Multispec.Multispec.spec_roi_curtains = {}

◆ spectrometers

enlighten.device.Multispec.Multispec.spectrometers = {}

◆ strip_features

list enlighten.device.Multispec.Multispec.strip_features = []

The documentation for this class was generated from the following file: