ENLIGHTEN
Cross-platform desktop GUI for Wasatch Photonics spectrometers
Loading...
Searching...
No Matches
wasatch.AndorDevice.AndorDevice Class Reference

This is the basic implementation of our interface with Andor cameras. More...

Inheritance diagram for wasatch.AndorDevice.AndorDevice:
[legend]
Collaboration diagram for wasatch.AndorDevice.AndorDevice:
[legend]

Public Member Functions

 __init__ (self, device_id, message_queue=None, alert_queue=None)
 
 acquire_data (self)
 
 check_result (self, result, func)
 Public Methods.
 
 connect (self)
 
 get_detector_temperature_degC (self)
 
 get_error_code (self, code)
 
 get_error_code_long (self, code)
 
 get_serial_number (self)
 
 high_gain_mode_enable (self, enabled)
 
 init_detector_area (self)
 
 init_detector_speed (self)
 
 init_tec_setpoint (self)
 
 load_error_codes (self)
 
 not_implemented (self)
 
 save_config (self, eeprom=None)
 The user has edited the "virtual EEPROM", for instance using ENLIGHTEN's EEPROM Editor, and wants to save the new EEPROM.
 
 set_fan_enable (self, x)
 
 set_integration_time_ms (self, ms)
 
 set_scans_to_average (self, value)
 
 set_shutter_enable (self, enable)
 
 set_take_one_request (self, tor)
 
 set_tec_setpoint (self, set_temp)
 
 set_vertical_binning (self, roi)
 Note that this follows the same (start, end) vertical ROI API as FeatureInterfaceDevice.set_vertical_binning, and dynamically translates that into the (middle, height) Andor API.
 
 toggle_tec (self, toggle_state)
 
 update_config_from_eeprom (self, eeprom)
 Populates a dict used to update the configuration file self.config_file from self.settings.eeprom members.
 
- Public Member Functions inherited from wasatch.InterfaceDevice.InterfaceDevice
 __init__ (self)
 Any class that communicates to a spectrometer should inherit this class.
 
 handle_requests (self, requests)
 

Public Attributes

 alert_queue = alert_queue
 
int boxcar_half_width = 0
 
list command_queue = []
 
 config_dir = os.path.join(self._get_default_data_dir(), 'config')
 
 config_file = os.path.join(self.config_dir, self.serial + '.json')
 
dict config_names_to_eeprom
 
dict config_values
 
bool connected = False
 
 dark = None
 
 device_id = device_id
 
bool dll_fail = True
 
 driver = None
 
dict error_codes
 
list gain_idx = []
 
list gain_options = []
 
 height = yPixels.value
 
bool immediate_mode = False
 
 integration_time_ms = ms
 
int last_battery_percentage = 0
 
 last_memory_check = datetime.now()
 
 message_queue = message_queue
 
 pixels = xPixels.value
 
 process_id = os.getpid()
 
int scan_count = 0
 
str serial = f"CCD-{sn.value}"
 
int session_reading_count = 0
 
 setpoint_deg_c = self.settings.eeprom.startup_temp_degC
 
 settings = SpectrometerSettings(self.device_id)
 
int spec_index = 0
 
int sum_count = 0
 
 summed_spectrum = None
 
 take_one_request = None
 
bool tec_enabled = True
 
 temperature_cache_timestamp = None
 
 temperature_cache_value = None
 
- Public Attributes inherited from wasatch.InterfaceDevice.InterfaceDevice
dict process_f = {}
 
int remaining_throwaways = 0
 

Static Public Attributes

int SHUTTER_SPEED_MS = 50
 
int SUCCESS = 20002
 
float TEMPERATURE_CACHE_SEC = 1.0
 

Protected Member Functions

 _check_config_file (self)
 
 _close_ex_shutter (self)
 
 _get_default_data_dir (self)
 
 _get_spectrum_raw (self)
 
 _init_process_funcs (self)
 
 _load_config_values (self)
 Loads configuration from file self.config_file and populates self.settings.eeprom with members.
 
 _obtain_gain_info (self)
 
 _open_ex_shutter (self)
 
 _queue_message (self, setting, value)
 Private Methods.
 
 _take_one_averaged_reading (self)
 

Protected Attributes

int _scan_averaging = 1
 

Detailed Description

This is the basic implementation of our interface with Andor cameras.

Todo

have check_result return a SpectrometerResponse

try to auto-detect whether x-axis needs inverted via DLL.GetImageFlip()

########################################################################## This class adopts the external device interface structure. This involves receiving a request through the handle_request function. A request is processed based on the key in the request. The processing function passes the commands to the requested device. Once it receives a response from the connected device it then passes that back up the chain.

                           Enlighten Request
                                   |
                            handle_requests
                                   |
                              -----------
                             |  |  |  |  |  
         { get_laser status, acquire, set_laser_watchdog, etc....}
                             |  |  |  |  |  
                              -----------
                                   |
                     {self.driver.some_andor_sdk_call}

############################################################################

Constructor & Destructor Documentation

◆ __init__()

wasatch.AndorDevice.AndorDevice.__init__ ( self,
device_id,
message_queue = None,
alert_queue = None )

Member Function Documentation

◆ _check_config_file()

wasatch.AndorDevice.AndorDevice._check_config_file ( self)
protected

◆ _close_ex_shutter()

wasatch.AndorDevice.AndorDevice._close_ex_shutter ( self)
protected

◆ _get_default_data_dir()

wasatch.AndorDevice.AndorDevice._get_default_data_dir ( self)
protected

◆ _get_spectrum_raw()

wasatch.AndorDevice.AndorDevice._get_spectrum_raw ( self)
protected
Todo
missing bad-pixel correction

◆ _init_process_funcs()

wasatch.AndorDevice.AndorDevice._init_process_funcs ( self)
protected

◆ _load_config_values()

wasatch.AndorDevice.AndorDevice._load_config_values ( self)
protected

Loads configuration from file self.config_file and populates self.settings.eeprom with members.

◆ _obtain_gain_info()

wasatch.AndorDevice.AndorDevice._obtain_gain_info ( self)
protected

◆ _open_ex_shutter()

wasatch.AndorDevice.AndorDevice._open_ex_shutter ( self)
protected

◆ _queue_message()

wasatch.AndorDevice.AndorDevice._queue_message ( self,
setting,
value )
protected

Private Methods.

If an upstream queue is defined, send the name-value pair. Does nothing if the caller hasn't provided a queue.

"setting" is application (caller) dependent, but ENLIGHTEN currently uses "marquee_info" and "marquee_error".

◆ _take_one_averaged_reading()

wasatch.AndorDevice.AndorDevice._take_one_averaged_reading ( self)
protected
Note
this may be collecting a dark spectrum requested through TakeOneRequest.take_dark
Returns
Reading

◆ acquire_data()

wasatch.AndorDevice.AndorDevice.acquire_data ( self)

◆ check_result()

wasatch.AndorDevice.AndorDevice.check_result ( self,
result,
func )

Public Methods.

◆ connect()

wasatch.AndorDevice.AndorDevice.connect ( self)

◆ get_detector_temperature_degC()

wasatch.AndorDevice.AndorDevice.get_detector_temperature_degC ( self)

◆ get_error_code()

wasatch.AndorDevice.AndorDevice.get_error_code ( self,
code )

◆ get_error_code_long()

wasatch.AndorDevice.AndorDevice.get_error_code_long ( self,
code )

◆ get_serial_number()

wasatch.AndorDevice.AndorDevice.get_serial_number ( self)

◆ high_gain_mode_enable()

wasatch.AndorDevice.AndorDevice.high_gain_mode_enable ( self,
enabled )

◆ init_detector_area()

wasatch.AndorDevice.AndorDevice.init_detector_area ( self)

◆ init_detector_speed()

wasatch.AndorDevice.AndorDevice.init_detector_speed ( self)

◆ init_tec_setpoint()

wasatch.AndorDevice.AndorDevice.init_tec_setpoint ( self)

◆ load_error_codes()

wasatch.AndorDevice.AndorDevice.load_error_codes ( self)
See also
ATMCD32D.H

◆ not_implemented()

wasatch.AndorDevice.AndorDevice.not_implemented ( self)

◆ save_config()

wasatch.AndorDevice.AndorDevice.save_config ( self,
eeprom = None )

The user has edited the "virtual EEPROM", for instance using ENLIGHTEN's EEPROM Editor, and wants to save the new EEPROM.

Therefore we need to generate a fresh JSON equivalent and write it to disk.

Parameters
eepromif provided, overwrite current settings with those in the passed dict before writing to disk

◆ set_fan_enable()

wasatch.AndorDevice.AndorDevice.set_fan_enable ( self,
x )

◆ set_integration_time_ms()

wasatch.AndorDevice.AndorDevice.set_integration_time_ms ( self,
ms )

◆ set_scans_to_average()

wasatch.AndorDevice.AndorDevice.set_scans_to_average ( self,
value )

◆ set_shutter_enable()

wasatch.AndorDevice.AndorDevice.set_shutter_enable ( self,
enable )

◆ set_take_one_request()

wasatch.AndorDevice.AndorDevice.set_take_one_request ( self,
tor )

◆ set_tec_setpoint()

wasatch.AndorDevice.AndorDevice.set_tec_setpoint ( self,
set_temp )

◆ set_vertical_binning()

wasatch.AndorDevice.AndorDevice.set_vertical_binning ( self,
roi )

Note that this follows the same (start, end) vertical ROI API as FeatureInterfaceDevice.set_vertical_binning, and dynamically translates that into the (middle, height) Andor API.

◆ toggle_tec()

wasatch.AndorDevice.AndorDevice.toggle_tec ( self,
toggle_state )

◆ update_config_from_eeprom()

wasatch.AndorDevice.AndorDevice.update_config_from_eeprom ( self,
eeprom )

Populates a dict used to update the configuration file self.config_file from self.settings.eeprom members.

Member Data Documentation

◆ _scan_averaging

int wasatch.AndorDevice.AndorDevice._scan_averaging = 1
protected

◆ alert_queue

wasatch.AndorDevice.AndorDevice.alert_queue = alert_queue

◆ boxcar_half_width

int wasatch.AndorDevice.AndorDevice.boxcar_half_width = 0

◆ command_queue

list wasatch.AndorDevice.AndorDevice.command_queue = []

◆ config_dir

wasatch.AndorDevice.AndorDevice.config_dir = os.path.join(self._get_default_data_dir(), 'config')

◆ config_file

wasatch.AndorDevice.AndorDevice.config_file = os.path.join(self.config_dir, self.serial + '.json')

◆ config_names_to_eeprom

dict wasatch.AndorDevice.AndorDevice.config_names_to_eeprom
Initial value:
= {
'wp_serial_number': 'serial_number',
'wp_model': 'model'
}

◆ config_values

wasatch.AndorDevice.AndorDevice.config_values
Initial value:
= {
'detector_serial_number': self.serial,
'wavelength_coeffs': [0,1,0,0,0],
'excitation_nm_float': 0,
'raman_intensity_coeffs': [],
'raman_intensity_calibration_order': 0,
'invert_x_axis': False,
'roi_horizontal_start': 0,
'roi_horizontal_end': 0,
'roi_vertical_region_1_start': 0,
'roi_vertical_region_1_end': 0,
'stubbed': True
}

◆ connected

bool wasatch.AndorDevice.AndorDevice.connected = False

◆ dark

wasatch.AndorDevice.AndorDevice.dark = None

◆ device_id

wasatch.AndorDevice.AndorDevice.device_id = device_id

◆ dll_fail

bool wasatch.AndorDevice.AndorDevice.dll_fail = True

◆ driver

wasatch.AndorDevice.AndorDevice.driver = None

◆ error_codes

dict wasatch.AndorDevice.AndorDevice.error_codes

◆ gain_idx

list wasatch.AndorDevice.AndorDevice.gain_idx = []

◆ gain_options

list wasatch.AndorDevice.AndorDevice.gain_options = []

◆ height

wasatch.AndorDevice.AndorDevice.height = yPixels.value

◆ immediate_mode

bool wasatch.AndorDevice.AndorDevice.immediate_mode = False

◆ integration_time_ms

wasatch.AndorDevice.AndorDevice.integration_time_ms = ms

◆ last_battery_percentage

int wasatch.AndorDevice.AndorDevice.last_battery_percentage = 0

◆ last_memory_check

wasatch.AndorDevice.AndorDevice.last_memory_check = datetime.now()

◆ message_queue

wasatch.AndorDevice.AndorDevice.message_queue = message_queue

◆ pixels

wasatch.AndorDevice.AndorDevice.pixels = xPixels.value

◆ process_id

wasatch.AndorDevice.AndorDevice.process_id = os.getpid()

◆ scan_count

int wasatch.AndorDevice.AndorDevice.scan_count = 0

◆ serial

str wasatch.AndorDevice.AndorDevice.serial = f"CCD-{sn.value}"

◆ session_reading_count

int wasatch.AndorDevice.AndorDevice.session_reading_count = 0

◆ setpoint_deg_c

wasatch.AndorDevice.AndorDevice.setpoint_deg_c = self.settings.eeprom.startup_temp_degC

◆ settings

wasatch.AndorDevice.AndorDevice.settings = SpectrometerSettings(self.device_id)

◆ SHUTTER_SPEED_MS

wasatch.AndorDevice.AndorDevice.SHUTTER_SPEED_MS = 50
static

◆ spec_index

wasatch.AndorDevice.AndorDevice.spec_index = 0

◆ SUCCESS

int wasatch.AndorDevice.AndorDevice.SUCCESS = 20002
static

◆ sum_count

wasatch.AndorDevice.AndorDevice.sum_count = 0

◆ summed_spectrum

wasatch.AndorDevice.AndorDevice.summed_spectrum = None

◆ take_one_request

wasatch.AndorDevice.AndorDevice.take_one_request = None

◆ tec_enabled

bool wasatch.AndorDevice.AndorDevice.tec_enabled = True

◆ TEMPERATURE_CACHE_SEC

float wasatch.AndorDevice.AndorDevice.TEMPERATURE_CACHE_SEC = 1.0
static

◆ temperature_cache_timestamp

wasatch.AndorDevice.AndorDevice.temperature_cache_timestamp = None

◆ temperature_cache_value

wasatch.AndorDevice.AndorDevice.temperature_cache_value = None

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