Wasatch.PY
Python application driver for Wasatch Photonics spectrometers
Loading...
Searching...
No Matches
wasatch.AutoRaman.AutoRaman Class Reference

Public Member Functions

 __init__ (self, idevice, auto_collection_mode=False)
 
 bump_progress_bar (self)
 
 enable_and_warmup_laser (self)
 
 from_db_to_linear (self, x)
 
 from_linear_to_db (self, x)
 
 get_auto_spectrum (self, request)
 
 get_avg_spectrum (self, int_time, gain_db, num_avg=1, throwaway=True, first=None, label="unknown")
 
 get_laser_warning_delay_sec (self)
 wrappers over stupidly complicated WasatchDevice interface
 
 get_spectrum (self)
 
 inter_spectrum_delay (self)
 
 measure (self, auto_raman_request)
 
 measure_firmware (self, auto_raman_request)
 
 measure_software (self, auto_raman_request)
 
 optimize_acquisition_parameters (self, request)
 
 save (self, spectrum, label=None)
 
 set_gain_db (self, db)
 
 set_integration_time_ms (self, ms)
 
 set_laser_enable (self, flag)
 

Public Attributes

 auto_collection_mode = auto_collection_mode
 Optimize Acquisition Parameters.
 
 idevice = idevice
 
bool optimizing = False
 Generate Measurement Plan.
 
int progress_count = 0
 
int progress_total = 0
 
 settings = self.idevice.settings
 
 start_time = datetime.now()
 

Static Public Attributes

int INTER_SPECTRA_DELAY_MS = 100
 

Detailed Description

This class encapsulates Dieter's Auto-Raman algorithm, which optimizes
integration time (and gain on XS series spectrometers) to achieve a
target window of counts, then uses the configured measurement time
to maximize scan averaging at with those acquisition parameters.

As calling software will not necessarily expect the configured "default"
integration time and gain to change, the class restores those to previous
levels after a measurement.

@par Auto-Collection mode

Auto-Collection mode was added to support STARVIS sensors with their
much-deeper dynamic range. Essentially this skips the "optimization"
step of balancing integration time and gain, and simply uses
AutoRamanRequest.max_integ_ms. Gain is left at whatever is already
configured.

@par InterfaceDevice handle

AutoRaman needs an InterfaceDevice to request spectra, fire the laser etc.
The provided InterfaceDevice should support the following features:

- device_id
- settings
- queue_message()
- check_alert()
- handle_request()
    - sensor
        * get_spectrum([auto_raman_params])
        * set_integration_time_ms
        * set_detector_gain
    - laser
        * can_laser_fire
        * is_laser_firing
        * set_laser_enable
        * get_laser_tec_mode
        * get_ambient_temperature_degC
        * get_laser_warning_delay_sec
        * set_laser_warning_delay_sec

@par Design Considerations

Mark made the following changes from Dieter's original algo:

- don't take throwaways during averaged signal or dark collections,
  as acquisition parameters aren't changing and sensor should be
  stable
- don't include laser warning delay when computing num_avg, since
  laser is already enabled and firing

Mark also made the following decisions regarding ENLIGHTEN integration:

- return the optimized integration time and gain back to ENLIGHTEN
  in the Reading object so they will be the new GUI settings if the
  user simply hits "Play" to resume free-running spectra.
- ENLIGHTEN will override the init_int_time and init_gain defaults
  in AutoRamanRequest so that if the user hits "Auto-Raman Measurement"
  a second time, the previous settings will be used as the new starting
  point, and (ideally) the initial spectrum will determine that no further
  optimization is required.

Points to consider:

- consider rolling the "last optimization" measurement directly into the
  averaged sample spectra (since it had its own throwaway and presumably
  represents a "stable" reading). This could potentially allow for one more
  averaged dark, depending on max_ms.
- ENLIGHTEN's laser button should still be able to turn the laser OFF at
  any point.

Constructor & Destructor Documentation

◆ __init__()

wasatch.AutoRaman.AutoRaman.__init__ ( self,
idevice,
auto_collection_mode = False )

Member Function Documentation

◆ bump_progress_bar()

wasatch.AutoRaman.AutoRaman.bump_progress_bar ( self)

◆ enable_and_warmup_laser()

wasatch.AutoRaman.AutoRaman.enable_and_warmup_laser ( self)

◆ from_db_to_linear()

wasatch.AutoRaman.AutoRaman.from_db_to_linear ( self,
x )
                                            #

Software Implementation # #

◆ from_linear_to_db()

wasatch.AutoRaman.AutoRaman.from_linear_to_db ( self,
x )

◆ get_auto_spectrum()

wasatch.AutoRaman.AutoRaman.get_auto_spectrum ( self,
request )
This is the "Auto-Raman algorithm." Everything that matters happens here.

@returns a Reading with spectrum, dark and sum_count populated

◆ get_avg_spectrum()

wasatch.AutoRaman.AutoRaman.get_avg_spectrum ( self,
int_time,
gain_db,
num_avg = 1,
throwaway = True,
first = None,
label = "unknown" )
 Takes a single throwaway, then averages num_avg spectra 

◆ get_laser_warning_delay_sec()

wasatch.AutoRaman.AutoRaman.get_laser_warning_delay_sec ( self)

wrappers over stupidly complicated WasatchDevice interface

◆ get_spectrum()

wasatch.AutoRaman.AutoRaman.get_spectrum ( self)

◆ inter_spectrum_delay()

wasatch.AutoRaman.AutoRaman.inter_spectrum_delay ( self)

◆ measure()

wasatch.AutoRaman.AutoRaman.measure ( self,
auto_raman_request )

◆ measure_firmware()

wasatch.AutoRaman.AutoRaman.measure_firmware ( self,
auto_raman_request )
                                            #

Firmware Implementation # #

◆ measure_software()

wasatch.AutoRaman.AutoRaman.measure_software ( self,
auto_raman_request )
@returns a Reading wrapped in a SpectrometerResponse

◆ optimize_acquisition_parameters()

wasatch.AutoRaman.AutoRaman.optimize_acquisition_parameters ( self,
request )
 Assumes laser already enabled and warmed-up 

◆ save()

wasatch.AutoRaman.AutoRaman.save ( self,
spectrum,
label = None )
 Save each spectrum in row-ordered CSV if debug environment variable enabled 

◆ set_gain_db()

wasatch.AutoRaman.AutoRaman.set_gain_db ( self,
db )

◆ set_integration_time_ms()

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

◆ set_laser_enable()

wasatch.AutoRaman.AutoRaman.set_laser_enable ( self,
flag )

Member Data Documentation

◆ auto_collection_mode

wasatch.AutoRaman.AutoRaman.auto_collection_mode = auto_collection_mode

Optimize Acquisition Parameters.

◆ idevice

wasatch.AutoRaman.AutoRaman.idevice = idevice

◆ INTER_SPECTRA_DELAY_MS

int wasatch.AutoRaman.AutoRaman.INTER_SPECTRA_DELAY_MS = 100
static

◆ optimizing

bool wasatch.AutoRaman.AutoRaman.optimizing = False

Generate Measurement Plan.

◆ progress_count

int wasatch.AutoRaman.AutoRaman.progress_count = 0

◆ progress_total

wasatch.AutoRaman.AutoRaman.progress_total = 0

◆ settings

wasatch.AutoRaman.AutoRaman.settings = self.idevice.settings

◆ start_time

wasatch.AutoRaman.AutoRaman.start_time = datetime.now()

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