Wasatch.NET 2.4.14
.NET application driver for Wasatch Photonics spectrometers
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Public Attributes | Protected Member Functions | Package Functions | Properties | Private Member Functions | Private Attributes | List of all members
WasatchNET.MockSpectrometer Class Reference
Inheritance diagram for WasatchNET.MockSpectrometer:
[legend]
Collaboration diagram for WasatchNET.MockSpectrometer:
[legend]

Public Types

enum  SAMPLE_METHOD { EXACT , LINEAR_INTERPOLATION , NOISY_LINEAR_INTERPOLATION }
 
- Public Types inherited from WasatchNET.Spectrometer
enum  LaserPowerResolution { LASER_POWER_RESOLUTION_100 , LASER_POWER_RESOLUTION_1000 , LASER_POWER_RESOLUTION_MANUAL }
 When setting laser power as a percentage (see setLaserPowerPercentage), this enum determines the possible resolution (granularity) of the selectable power. More...
 
enum  UntetheredCaptureStatus {
  IDLE = 0 , DARK = 1 , WARMUP = 2 , SAMPLE = 3 ,
  PROCESSING = 4 , ERROR = 5
}
 

Public Member Functions

void addData (string src, int integrationTime, double[] spectrum)
 
void addFrame (string src, int integrationTime, ushort[] spectrum)
 
void clearData ()
 
override void close ()
 
override ushort[] getFrame ()
 
string[] getSources ()
 
override double[] getSpectrum (bool forceNew=false)
 Mock spectrometer does not play very nice with the current unique key system since it doesn't actually use USB. So here we remove the error calls (we wouldn't really anticipate USB errors anyway!)
 
bool initSpectrometer (string jsonFile)
 
bool open (uint pixels)
 
override bool reconnect ()
 
void seedNoise (int seed)
 
override bool setLaserPowerPercentage (float perc)
 
void setSource (string src)
 
- Public Member Functions inherited from WasatchNET.Spectrometer
void cancelCurrentAcquisition ()
 
virtual void changeSPITrigger (bool edge, bool firmwareThrow)
 
virtual void close ()
 
double[] correctRamanIntensity (double[] spectrum)
 Performs SRM correction on the given spectrum using the ROI and coefficients on EEPROM. Non-ROI pixels are not corrected. If ROI or relative intensity coefficients appear invalid, original spectrum is returned.
 
void dontCache (Opcodes op)
 
bool eraseStorage ()
 
void flushReaders ()
 
ushort getDAC_UNUSED ()
 
virtual ushort[] getFrame ()
 
virtual double[] getSpectrum (bool forceNew=false)
 Take a single complete spectrum, including any configured scan averaging, boxcar, dark subtraction, inversion, binning, and optionally relative intensity correction.
 
byte[] getStorage (UInt16 page)
 
UntetheredCaptureStatus getUntetheredCaptureStatus ()
 
bool haveCache (Opcodes op)
 
virtual bool loadFromJSON (string pathname)
 
virtual bool reconnect ()
 
virtual void regenerateWavelengths ()
 
bool resetFPGA ()
 
bool sendFeedback (UInt16 sequence)
 
bool sendSWTrigger ()
 
bool setDFUMode ()
 Put the ARM microcontroller into DFU mode for firmware update.
 
virtual bool setLaserPowerPercentage (float perc)
 
void useCache (Opcodes op)
 
void close ()
 
double[] getSpectrum (bool forceNew)
 Take a single complete spectrum, including any configured scan averaging, boxcar and dark subtraction.
 
bool reconnect ()
 
void regenerateWavelengths ()
 
bool setDFUMode ()
 Put the ARM microcontroller into DFU mode for firmware update.
 
bool setLaserPowerPercentage (float perc)
 Set laser power to the specified percentage.
 

Public Attributes

bool noisy = true
 
SAMPLE_METHOD sampleMethod = SAMPLE_METHOD.NOISY_LINEAR_INTERPOLATION
 
- Public Attributes inherited from WasatchNET.Spectrometer
int acquisitionMaxRetries = 2
 If a call to Spectrometer.getSpectrum() fails, how many internal (within WasatchNET) retries should be attempted (includes re-sending an ACQUIRE opcode).
 
int delayAfterBulkEndpointErrorMS = 100
 If there is an error reading one of the bulk endpoints, pause this many milliseconds in hopes of the bus resetting itself (does not automatically retry).
 
bool fastAreaScan = false
 
float lastDetectorTemperatureDegC = UNINITIALIZED_TEMPERATURE_DEG_C
 A cached value of the last-measured detector temperature. This is automatically updated following spectral reads if readTemperatureAfterSpectrum is set.
 
int multiChannelPosition = -1
 If the spectrometer is deployed in a multi-channel configuration, this provides a place to store an integral position in the Spectrometer object. (defaults to -1, an invalid position)
 
bool readTemperatureAfterSpectrum = false
 If enabled, Wasatch.NET will automatically read the detector temperature following every successful call to getSpectrum(). That temperature can then be read from lastDetectorTemperatureDegC, without inducing any spectrometer communications.
 

Protected Member Functions

override double[] getSpectrumRaw (bool skipTrigger=false)
 just the bytes, ma'am
 
- Protected Member Functions inherited from WasatchNET.Spectrometer
void correctBadPixels (ref double[] spectrum)
 If a spectrometer has bad_pixels configured in the EEPROM, then average over them in the driver.
 
virtual double[] getAreaScanLightweight ()
 
virtual double[] getSpectrumRaw (bool skipTrigger=false)
 just the bytes, ma'am
 

Package Functions

 MockSpectrometer (UsbRegistry usbReg, int index=0)
 Simple, relatively flexible mock spectrometer General workflow is addData(source, time, spectrum) -> setSource(source) for as many different sources as desired Once these calls are made, the spectrometer will produce data, optionally with noise, for the set source With current implementation, need at least two integration times per source to interpolate and create "new" spectra Temperatures will be randomly produced based on the given setpoint.
 
override bool open ()
 
- Package Functions inherited from WasatchNET.Spectrometer
byte[] getCmd (Opcodes opcode, int len, ushort wIndex=0, int fullLen=0)
 Execute a request-response control transaction using the given opcode.
 
byte[] getCmd2 (Opcodes opcode, int len, ushort wIndex=0, int fakeBufferLengthARM=0)
 Execute a request-response transfer with a "second-tier" request.
 
virtual bool open ()
 
bool sendCmd (Opcodes opcode, ushort wValue=0, ushort wIndex=0, byte[] buf=null)
 send a single control transfer command (response not checked)
 
bool sendCmd2 (Opcodes opcode, ushort wIndex=0, byte[] buf=null)
 send a single 2nd-tier control transfer command (response not checked)
 
 Spectrometer (UsbRegistry usbReg)
 

Properties

override bool areaScanEnabled [get, set]
 Configure detector for 2D image mode.
 
override bool batteryCharging [get]
 
override float batteryPercentage [get]
 
override float detectorGain [get, set]
 Maps to an FPGA register inside the spectrometer used to scale pixels read from the ADC to optimize dynamic range.
 
override float detectorGainOdd [get, set]
 (InGaAs-only) Companion property to detectorGain, which on InGaAs detectors applies only to even-numbered pixels.
 
override short detectorOffset [get, set]
 Maps to an FPGA register inside the spectrometer used to offset the pixels (dark baseline) read from the ADC to optimize dynamic range.
 
override short detectorOffsetOdd [get, set]
 (InGaAs-only) Companion property to detectorOffset, which on InGaAs detectors applies only to even-numbered pixels.
 
override bool detectorTECEnabled [get, set]
 
override ushort detectorTECSetpointRaw [get, set]
 
override float detectorTemperatureDegC [get]
 
override string firmwareRevision [get]
 
override string fpgaRevision [get]
 
override bool highGainModeEnabled [get, set]
 
override uint integrationTimeMS [get, set]
 Current integration time in milliseconds.
 
override bool isARM [get]
 
override bool isInGaAs [get]
 
override bool laserEnabled [get, set]
 Whether the laser has been REQUESTED TO FIRE by the software and firmware.
 
override bool laserInterlockEnabled [get]
 True if the laser can fire (interlock circuit is CLOSED), false if the laser cannot fire (interlock circuit is OPEN).

 
override UInt64 laserModulationPeriod [get, set]
 When defining the laser modulation duty cycle, the length (period) of the duty cycle in microsec.
 
override UInt64 laserModulationPulseWidth [get, set]
 When defining the laser modulation duty cycle, the length (width) of the period during which the laser is enabled.
 
override float laserTemperatureDegC [get]
 convert the raw laser temperature reading into degrees centigrade
 
override ushort laserTemperatureRaw [get]
 Synonym for primaryADC.
 
override byte laserTemperatureSetpointRaw [get, set]
 FACTORY ONLY.
 
override ushort secondaryADC [get]
 This is provided for spectrometers with a secondary ADC connected to an external laser, photodiode or what-have-you. Attempts to read it on spectrometers where it has not been configured can result in indeterminate behavior; therefore, hasSecondaryADC is provided to allow callers to selectively enable this function if they believe they are using supported hardware.
 
override TRIGGER_SOURCE triggerSource [get, set]
 Whether acquisitions are triggered "internally" (via the ACQUIRE opcode sent by software) or "externally" (via an electrical signal wired to the accessory connector).
 
- Properties inherited from WasatchNET.Spectrometer
virtual bool accessoryEnabled [get, set]
 Determines whether or not the Gen1.5 accessory connector's features can be used.
 
int acquireCount = 0 [get, protected set]
 Allows application to track how many ACQUIRE_SPECTRUM commands have been sent to the spectrometer (including throwaways and retries).
 
uint? acquisitionTimeoutMS [get, set]
 Convenience accessor to set an explicit acquisition timeout.

 
uint acquisitionTimeoutRelativeMS [set]
 Allows the NEXT acquisition timeout to be set relative to "now" as an offiset in milliseconds.
 
DateTime? acquisitionTimeoutTimestamp = null [get, set]
 Allows the NEXT acquisition timeout to be set to an explicit objective future timestamp.
 
ushort actualFrames [get]
 How many frames have been read since last power cycle (has overflow)
 
uint actualIntegrationTimeUS [get]
 Return integration time + clock-out time (and laser pulse time if externally triggered).
 
ushort adcRaw [get]
 
virtual bool areaScanEnabled [get, set]
 Configure detector for 2D image mode.
 
bool autoTrigger [get, set]
 Whether the driver should automatically send a software trigger on calls to getSpectrum() when triggerSource is set to INTERNAL. (defaults true)
 
virtual bool batteryCharging [get]
 
virtual float batteryPercentage [get]
 
uint batteryStateRaw [get]
 
virtual uint boxcarHalfWidth [get, set]
 Perform post-acquisition high-frequency smoothing by averaging together "n" pixels to either side of each acquired pixel; zero to disable (default).
 
virtual bool continuousAcquisitionEnable [get, set]
 After the first trigger is received, no further triggers are required; spectrometer will enter free-running mode.
 
virtual byte continuousFrames [get, set]
 When not using "continous acquisitions" with external triggers, how many spectra to acquire per trigger event.
 
virtual double[] dark [get, set]
 Perform automatic dark subtraction by setting this property to an acquired dark spectrum; leave "null" to disable.
 
virtual float detectorGain [get, set]
 Maps to an FPGA register inside the spectrometer used to scale pixels read from the ADC to optimize dynamic range.
 
virtual float detectorGainOdd [get, set]
 (InGaAs-only) Companion property to detectorGain, which on InGaAs detectors applies only to even-numbered pixels.
 
virtual short detectorOffset [get, set]
 Maps to an FPGA register inside the spectrometer used to offset the pixels (dark baseline) read from the ADC to optimize dynamic range.
 
virtual short detectorOffsetOdd [get, set]
 (InGaAs-only) Companion property to detectorOffset, which on InGaAs detectors applies only to even-numbered pixels.
 
ushort detectorSensingThreshold [get, set]
 
bool detectorSensingThresholdEnabled [get, set]
 
virtual UInt16 detectorStartLine [get, set]
 
virtual UInt16 detectorStopLine [get, set]
 
virtual bool detectorTECEnabled [get, set]
 
virtual float detectorTECSetpointDegC [get, set]
 
virtual ushort detectorTECSetpointRaw [get, set]
 
double detectorTemperatureCacheTimeMS = 1000 [get, set]
 
virtual float detectorTemperatureDegC [get]
 
virtual ushort detectorTemperatureRaw [get]
 
EEPROM eeprom [get, protected set]
 configuration settings stored in the spectrometer's EEPROM
 
bool errorOnTimeout = true [get, set]
 Whether an ERROR should be logged on a timeout event (default true)
 
virtual float excitationWavelengthNM [get, set]
 
FeatureIdentification featureIdentification [get, set]
 metadata inferred from the spectrometer's USB PID
 
virtual string firmwareRevision [get]
 
FPGAOptions fpgaOptions [get, private set]
 set of compilation options used to compile the FPGA firmware in this spectrometer
 
virtual string fpgaRevision [get]
 
FRAM fram [get, protected set]
 
virtual bool hasLaser [get]
 
bool hasMarker [get, set]
 Some spectrometers send a start-of-frame marker in the first pixel of the spectrum.
 
bool hasSecondaryADC = false [get, set]
 This should be replaced with an FGPACompilationFlag or EEPROM field at some point.
 
virtual bool highGainModeEnabled [get, set]
 
HORIZONTAL_BINNING horizontalBinning [get, set]
 
string id [get]
 couples serial number with channel position
 
virtual uint integrationTimeMS [get, set]
 Current integration time in milliseconds.
 
virtual bool isARM [get]
 
bool isGen15 [get]
 Whether the spectrometer uses a "Gen 1.5" accessory connector.
 
virtual bool isInGaAs [get]
 
bool isOCT = false [get, protected set]
 Optical Coherence Tomography (OCT) spectrometers differ from "standard" spectrometers in several respects, such as producing both 2D and 3D imagery.
 
bool isSiG [get]
 
bool isSPI = false [get, protected set]
 Whether the spectrometer uses Serial Peripheral Interface (as opposed to USB for instance).
 
bool isStroker = false [get, protected set]
 Stroker is a legacy board firmware with older PID (not 0x1000, 0x2000 or 0x4000), doesn't conform to Feature Identification Device (FID) Protocol, and lacking an EEPROM.
 
virtual bool lampEnabled [get, set]
 Whether the lamp attached via Gen 1.5 attachment has been requested to be turned on by the software and firmware.
 
virtual bool laserEnabled [get, set]
 Whether the laser has been REQUESTED TO FIRE by the software and firmware.
 
virtual bool laserFiring [get]
 Whether the laser is ACTUALLY FIRING, according to the laser driver and laser interlock board.
 
virtual bool laserInterlockEnabled [get]
 True if the laser can fire (interlock circuit is CLOSED), false if the laser cannot fire (interlock circuit is OPEN).

 
UInt64 laserModulationDuration [get, set]
 If you only want the laser to be modulated for a portion of each acquisition (rare), how long in microseconds should the laser be modulated during each integration.
 
bool laserModulationEnabled [get, set]
 
bool laserModulationLinkedToIntegrationTime [get, set]
 
virtual UInt64 laserModulationPeriod [get, set]
 When defining the laser modulation duty cycle, the length (period) of the duty cycle in microsec.
 
UInt64 laserModulationPulseDelay [get, set]
 If you want the laser modulation to start part-way through an acquisition, this defines the delay in microseconds from the beginning of the integration until laser modulation begins.
 
virtual UInt64 laserModulationPulseWidth [get, set]
 When defining the laser modulation duty cycle, the length (width) of the period during which the laser is enabled.
 
virtual LaserPowerResolution laserPowerResolution = LaserPowerResolution.LASER_POWER_RESOLUTION_1000 [get, set]
 
virtual float laserPowerSetpointMW [get, set]
 Use this to set the laser output power in milliWatts.
 
bool laserRampingEnabled [get, set]
 disabled to deconflict area scan
 
virtual float laserTemperatureDegC [get]
 convert the raw laser temperature reading into degrees centigrade
 
virtual ushort laserTemperatureRaw [get]
 Synonym for primaryADC.
 
virtual byte laserTemperatureSetpointRaw [get, set]
 FACTORY ONLY.
 
double[] lastSpectrum [get, protected set]
 Useful if you lost the results of getSpectrum, or if you want to peek into ongoing multi-acquisition tasks like scan averaging or optimization.
 
uint lineLength [get]
 
int linesPerFrame [get, protected set]
 
string model [get]
 spectrometer model
 
bool multiChannelSelected [get, set]
 Multichannel convenience accessor (default false)
 
bool optActualIntegrationTime [get]
 
bool optAreaScan [get]
 Whether area scan mode is supported.
 
bool optCFSelect [get]
 Internal firmware name for the highGainModeEnabled feature available on InGaAs detectors.
 
FPGA_DATA_HEADER optDataHeaderTag [get]
 
bool optHorizontalBinning [get]
 
FPGA_INTEG_TIME_RES optIntegrationTimeResolution [get]
 
FPGA_LASER_CONTROL optLaserControl [get]
 
FPGA_LASER_TYPE optLaserType [get]
 
double[] pixelAxis [get]
 convenience accesor for pixel axis (lazy-loaded), for parallelism with wavelengths and wavenumbers
 
uint pixels [get, protected set]
 how many pixels does the spectrometer have (spectrum length)
 
ushort primaryADC [get]
 
bool ramanIntensityCorrectionEnabled [get, set]
 Whether to correct the y-axis using SRM-derived correction factors, stored as coefficients on the spectrometer.
 
virtual double[] reference [get, set]
 Simplify reference-based techniques (absorbance, reflectance, transmission etc) by allowing a reference to be stored with the Spectrometer, similar to dark.

 
virtual uint scanAveraging [get, set]
 How many acquisitions to average together (0 or 1 for no averaging). (default 1)
 
bool scanAveragingIsContinuous [get, set]
 Whether the "scanAveraging" property should automatically configure continuousAcquisitionEnable and continuousFrames. (default false)
 
virtual ushort secondaryADC [get]
 This is provided for spectrometers with a secondary ADC connected to an external laser, photodiode or what-have-you. Attempts to read it on spectrometers where it has not been configured can result in indeterminate behavior; therefore, hasSecondaryADC is provided to allow callers to selectively enable this function if they believe they are using supported hardware.
 
byte selectedADC [get, set]
 
virtual string serialNumber [get]
 spectrometer serial number
 
int shiftedMarkerCount = 0 [get, private set]
 For spectrometer firmware providing "start of spectrum markers", provides a count of how many INCORRECT markers were found in the MOST RECENT spectrum.
 
int spectrumCount = 0 [get, protected set]
 Allows application to track how many successful (non-null) calls have been made to getSpectrum (whether averaged or otherwise).
 
bool throwawayADCRead = true [get, set]
 Whether the driver should automatically perform a throwaway ADC read when changing the selected ADC. (defaults true)
 
bool throwawayAfterIntegrationTime [get, set]
 Whether the driver should automatically generate a throwaway "stability" measurement after changing integration time. (defaults false)
 
uint triggerDelay [get, set]
 A configurable delay from when an inbound trigger signal is received by the spectrometer, until the triggered acquisition actually starts.
 
EXTERNAL_TRIGGER_OUTPUT triggerOutput [get, set]
 
virtual TRIGGER_SOURCE triggerSource [get, set]
 Whether acquisitions are triggered "internally" (via the ACQUIRE opcode sent by software) or "externally" (via an electrical signal wired to the accessory connector).
 
string uniqueKey [get, set]
 
bool untetheredAcquisitionEnabled = false [get, set]
 Untethered operation requires an argument to ACQUIRE, and polls before reading spectrum.
 
bool useReadoutMutex [get, set]
 Whether to synchronize all spectral reads with a class-level (static) mutex.

 
double[] wavelengths [get, protected set]
 pre-populated array of wavelengths (nm) by pixel, generated from eeprom.wavecalCoeffs
 
double[] wavenumbers [get, protected set]
 pre-populated array of Raman shifts in wavenumber (1/cm) by pixel, generated from wavelengths[] and excitationNM
 
- Properties inherited from WasatchNET.ISpectrometer
bool accessoryEnabled [get, set]
 Determines whether or not the Gen1.5 accessory connector's features can be used.
 
ushort actualFrames [get]
 How many frames have been read since last power cycle (has overflow)
 
uint actualIntegrationTimeUS [get]
 Return integration time + clock-out time (and laser pulse time if externally triggered).
 
bool areaScanEnabled [get, set]
 Configure detector for 2D image mode.
 
bool batteryCharging [get]
 
float batteryPercentage [get]
 
uint batteryStateRaw [get]
 
uint boxcarHalfWidth [get, set]
 Perform post-acquisition high-frequency smoothing by averaging together "n" pixels to either side of each acquired pixel; zero to disable (default).
 
bool continuousAcquisitionEnable [get, set]
 After the first trigger is received, no further triggers are required; spectrometer will enter free-running mode.
 
byte continuousFrames [get, set]
 When not using "continous acquisitions" with external triggers, how many spectra to acquire per trigger event.
 
double[] dark [get, set]
 Perform automatic dark subtraction by setting this property to an acquired dark spectrum; leave "null" to disable.
 
float detectorGain [get, set]
 Maps to an FPGA register inside the spectrometer used to scale pixels read from the ADC to optimize dynamic range.
 
float detectorGainOdd [get, set]
 (InGaAs-only) Companion property to detectorGain, which on InGaAs detectors applies only to even-numbered pixels.
 
short detectorOffset [get, set]
 Maps to an FPGA register inside the spectrometer used to offset the pixels (dark baseline) read from the ADC to optimize dynamic range.
 
short detectorOffsetOdd [get, set]
 (InGaAs-only) Companion property to detectorOffset, which on InGaAs detectors applies only to even-numbered pixels.
 
ushort detectorSensingThreshold [get, set]
 
bool detectorSensingThresholdEnabled [get, set]
 
bool detectorTECEnabled [get, set]
 
float detectorTECSetpointDegC [get, set]
 
ushort detectorTECSetpointRaw [get, set]
 
double detectorTemperatureCacheTimeMS [get, set]
 
float detectorTemperatureDegC [get]
 
ushort detectorTemperatureRaw [get]
 
EEPROM eeprom [get]
 configuration settings stored in the spectrometer's EEPROM
 
float excitationWavelengthNM [get, set]
 
FeatureIdentification featureIdentification [get]
 metadata inferred from the spectrometer's USB PID
 
string firmwareRevision [get]
 
FPGAOptions fpgaOptions [get]
 set of compilation options used to compile the FPGA firmware in this spectrometer
 
string fpgaRevision [get]
 
bool hasLaser [get]
 
bool hasSecondaryADC [get, set]
 This should be replaced with an FGPACompilationFlag or EEPROM field at some point.
 
bool highGainModeEnabled [get, set]
 
uint integrationTimeMS [get, set]
 Current integration time in milliseconds.
 
bool isARM [get]
 
bool isGen15 [get]
 
bool isInGaAs [get]
 
bool isSiG [get]
 
bool isSPI [get]
 
bool lampEnabled [get, set]
 Whether the lamp attached via Gen 1.5 attachment has been requested to be turned on by the software and firmware.
 
bool laserEnabled [get, set]
 Whether the laser has been REQUESTED TO FIRE by the software and firmware.
 
bool laserFiring [get]
 Whether the laser is ACTUALLY FIRING, according to the laser driver and laser interlock board.
 
bool laserInterlockEnabled [get]
 True if the laser can fire (interlock circuit is CLOSED), false if the laser cannot fire (interlock circuit is OPEN).

 
UInt64 laserModulationDuration [get, set]
 If you only want the laser to be modulated for a portion of each acquisition (rare), how long in microseconds should the laser be modulated during each integration.
 
bool laserModulationEnabled [get, set]
 
bool laserModulationLinkedToIntegrationTime [get, set]
 
UInt64 laserModulationPeriod [get, set]
 When defining the laser modulation duty cycle, the length (period) of the duty cycle in microsec.
 
UInt64 laserModulationPulseDelay [get, set]
 If you want the laser modulation to start part-way through an acquisition, this defines the delay in microseconds from the beginning of the integration until laser modulation begins.
 
UInt64 laserModulationPulseWidth [get, set]
 When defining the laser modulation duty cycle, the length (width) of the period during which the laser is enabled.
 
Spectrometer.LaserPowerResolution laserPowerResolution [get, set]
 
bool laserRampingEnabled [get, set]
 
float laserTemperatureDegC [get]
 convert the raw laser temperature reading into degrees centigrade
 
ushort laserTemperatureRaw [get]
 Synonym for primaryADC.
 
byte laserTemperatureSetpointRaw [get, set]
 FACTORY ONLY.
 
uint lineLength [get]
 
string model [get]
 spectrometer model
 
bool optActualIntegrationTime [get]
 
bool optAreaScan [get]
 Whether area scan mode is supported.
 
bool optCFSelect [get]
 Internal firmware name for the highGainModeEnabled feature available on InGaAs detectors.
 
FPGA_DATA_HEADER optDataHeaderTag [get]
 
bool optHorizontalBinning [get]
 
FPGA_INTEG_TIME_RES optIntegrationTimeResolution [get]
 
FPGA_LASER_CONTROL optLaserControl [get]
 
FPGA_LASER_TYPE optLaserType [get]
 
uint pixels [get]
 how many pixels does the spectrometer have (spectrum length)
 
ushort primaryADC [get]
 
bool ramanIntensityCorrectionEnabled [get, set]
 
uint scanAveraging [get, set]
 How many acquisitions to average together (zero for no averaging)
 
ushort secondaryADC [get]
 This is provided for spectrometers with a secondary ADC connected to an external laser, photodiode or what-have-you. Attempts to read it on spectrometers where it has not been configured can result in indeterminate behavior; therefore, hasSecondaryADC is provided to allow callers to selectively enable this function if they believe they are using supported hardware.
 
string serialNumber [get]
 spectrometer serial number
 
uint triggerDelay [get, set]
 A configurable delay from when an inbound trigger signal is received by the spectrometer, until the triggered acquisition actually starts.
 
EXTERNAL_TRIGGER_OUTPUT triggerOutput [get, set]
 
TRIGGER_SOURCE triggerSource [get, set]
 Whether acquisitions are triggered "internally" (via the ACQUIRE opcode sent by software) or "externally" (via an electrical signal wired to the accessory connector).
 
double[] wavelengths [get]
 pre-populated array of wavelengths (nm) by pixel, generated from eeprom.wavecalCoeffs
 
double[] wavenumbers [get]
 pre-populated array of Raman shifts in wavenumber (1/cm) by pixel, generated from wavelengths[] and excitationNM
 

Private Member Functions

double addNoise (double data, double mean, double sd)
 
double[] addNoise (double[] data, double mean, double sd)
 
ushort[] interpolateFrames ()
 
double[] interpolateSamples ()
 Creates an interpolated spectrum based on the integration time and the collected samples The call to this function assumes the current source is in the data dictionary, if not it will return an array of 0s.
 

Private Attributes

string currentSource = ""
 
uint darkBaseline = 0
 
bool InGaAs = false
 
Dictionary< string, SortedDictionary< int, ushort[]> > interpolationFrames = new Dictionary<string, SortedDictionary<int, ushort[]>>()
 
Dictionary< string, SortedDictionary< int, double[]> > interpolationSamples = new Dictionary<string, SortedDictionary<int, double[]>>()
 Collection of spectra for simulating various samples. In practice, accessing individual spectra (as double arrays) will look like => interpolationSamples["Xe"][120].
 
Random noiseMaker = new Random()
 
double sensitivity = 1.0
 

Additional Inherited Members

- Static Public Attributes inherited from WasatchNET.Spectrometer
const byte DEVICE_TO_HOST = 0xc0
 
const byte HOST_TO_DEVICE = 0x40
 
const int LEGACY_VERTICAL_PIXELS = 70
 for Stroker Area Scan
 
const ushort SPECTRUM_START_MARKER = 0xffff
 
const float UNINITIALIZED_TEMPERATURE_DEG_C = -999
 
- Protected Attributes inherited from WasatchNET.Spectrometer
bool accessoryEnabled_ = false
 
object acquisitionLock = new object()
 synchronizes getSpectrum, integrationTimeMS, scanAveraging, dark and boxcarHalfWidth
 
object adcLock = new object()
 
bool areaScanEnabled_ = false
 
uint boxcarHalfWidth_
 
bool currentAcquisitionCancelled
 
double[] dark_
 
bool detectorTECEnabled_
 
float detectorTECSetpointDegC_ = UNINITIALIZED_TEMPERATURE_DEG_C
 
ushort detectorTECSetpointRaw_
 
uint integrationTimeMS_
 
bool lampEnabled_ = false
 
bool laserEnabled_
 
bool laserHasFired_
 
UInt64 laserModulationPeriod_
 
UInt64 laserModulationPulseWidth_
 
float laserPowerSetpointMW_ = 0
 
byte laserTemperatureSetpointRaw_
 
Logger logger = Logger.getInstance()
 
double[] reference_
 
uint scanAveraging_ = 1
 
TRIGGER_SOURCE triggerSource_ = TRIGGER_SOURCE.INTERNAL
 
- Package Attributes inherited from WasatchNET.Spectrometer
Dictionary< Opcodes, byte > cmd = OpcodeHelper.getInstance().getDict()
 
bool shuttingDown = false
 
SpectrometerUptime uptime
 

Member Enumeration Documentation

◆ SAMPLE_METHOD

Enumerator
EXACT 
LINEAR_INTERPOLATION 
NOISY_LINEAR_INTERPOLATION 

Constructor & Destructor Documentation

◆ MockSpectrometer()

WasatchNET.MockSpectrometer.MockSpectrometer ( UsbRegistry  usbReg,
int  index = 0 
)
inlinepackage

Simple, relatively flexible mock spectrometer General workflow is addData(source, time, spectrum) -> setSource(source) for as many different sources as desired Once these calls are made, the spectrometer will produce data, optionally with noise, for the set source With current implementation, need at least two integration times per source to interpolate and create "new" spectra Temperatures will be randomly produced based on the given setpoint.

Member Function Documentation

◆ addData()

void WasatchNET.MockSpectrometer.addData ( string  src,
int  integrationTime,
double[]  spectrum 
)
inline

◆ addFrame()

void WasatchNET.MockSpectrometer.addFrame ( string  src,
int  integrationTime,
ushort[]  spectrum 
)
inline

◆ addNoise() [1/2]

double WasatchNET.MockSpectrometer.addNoise ( double  data,
double  mean,
double  sd 
)
inlineprivate

◆ addNoise() [2/2]

double[] WasatchNET.MockSpectrometer.addNoise ( double[]  data,
double  mean,
double  sd 
)
inlineprivate

◆ clearData()

void WasatchNET.MockSpectrometer.clearData ( )
inline

◆ close()

override void WasatchNET.MockSpectrometer.close ( )
inlinevirtual

Reimplemented from WasatchNET.Spectrometer.

◆ getFrame()

override ushort[] WasatchNET.MockSpectrometer.getFrame ( )
inlinevirtual

Reimplemented from WasatchNET.Spectrometer.

◆ getSources()

string[] WasatchNET.MockSpectrometer.getSources ( )
inline

◆ getSpectrum()

override double[] WasatchNET.MockSpectrometer.getSpectrum ( bool  forceNew = false)
inlinevirtual

Mock spectrometer does not play very nice with the current unique key system since it doesn't actually use USB. So here we remove the error calls (we wouldn't really anticipate USB errors anyway!)

Parameters
forceNew
Returns

Reimplemented from WasatchNET.Spectrometer.

◆ getSpectrumRaw()

override double[] WasatchNET.MockSpectrometer.getSpectrumRaw ( bool  skipTrigger = false)
inlineprotectedvirtual

just the bytes, ma'am

Parameters
skipTriggerallows getSpectrum to suppress SW triggers when scanAveraging, on scans after the first, if scanAveragingIsContinuous

Reimplemented from WasatchNET.Spectrometer.

◆ initSpectrometer()

bool WasatchNET.MockSpectrometer.initSpectrometer ( string  jsonFile)
inline

◆ interpolateFrames()

ushort[] WasatchNET.MockSpectrometer.interpolateFrames ( )
inlineprivate

◆ interpolateSamples()

double[] WasatchNET.MockSpectrometer.interpolateSamples ( )
inlineprivate

Creates an interpolated spectrum based on the integration time and the collected samples The call to this function assumes the current source is in the data dictionary, if not it will return an array of 0s.

Parameters
forceNewnot used in base class (provided for specialized subclasses)
Returns
An interpolated spectrum based on the stored data and current source

◆ open() [1/2]

override bool WasatchNET.MockSpectrometer.open ( )
inlinepackagevirtual

Reimplemented from WasatchNET.Spectrometer.

◆ open() [2/2]

bool WasatchNET.MockSpectrometer.open ( uint  pixels)
inline

◆ reconnect()

override bool WasatchNET.MockSpectrometer.reconnect ( )
inlinevirtual

Reimplemented from WasatchNET.Spectrometer.

◆ seedNoise()

void WasatchNET.MockSpectrometer.seedNoise ( int  seed)
inline

◆ setLaserPowerPercentage()

override bool WasatchNET.MockSpectrometer.setLaserPowerPercentage ( float  perc)
inlinevirtual
Parameters
perca normalized floating-point percentage from 0.0 to 1.0 (100%)

Not implemented as a property because it truly isn't; it's a complex combination of actual spectrometer properties.

Technically you don't need to call this function at all, and can set the laserModulationPulseWidth, laserModulationPulsePeriod and laserModulationEnabled properties directly if you wish.

Alternately, you can use the laserPowerSetpointMW property to set laser power in mW, provided a suitable laser power calibration is loaded onto the EEPROM.

Reimplemented from WasatchNET.Spectrometer.

◆ setSource()

void WasatchNET.MockSpectrometer.setSource ( string  src)
inline

Member Data Documentation

◆ currentSource

string WasatchNET.MockSpectrometer.currentSource = ""
private

◆ darkBaseline

uint WasatchNET.MockSpectrometer.darkBaseline = 0
private

◆ InGaAs

bool WasatchNET.MockSpectrometer.InGaAs = false
private

◆ interpolationFrames

Dictionary<string, SortedDictionary<int, ushort[]> > WasatchNET.MockSpectrometer.interpolationFrames = new Dictionary<string, SortedDictionary<int, ushort[]>>()
private

◆ interpolationSamples

Dictionary<string, SortedDictionary<int, double[]> > WasatchNET.MockSpectrometer.interpolationSamples = new Dictionary<string, SortedDictionary<int, double[]>>()
private

Collection of spectra for simulating various samples. In practice, accessing individual spectra (as double arrays) will look like => interpolationSamples["Xe"][120].

◆ noiseMaker

Random WasatchNET.MockSpectrometer.noiseMaker = new Random()
private

◆ noisy

bool WasatchNET.MockSpectrometer.noisy = true

◆ sampleMethod

SAMPLE_METHOD WasatchNET.MockSpectrometer.sampleMethod = SAMPLE_METHOD.NOISY_LINEAR_INTERPOLATION

◆ sensitivity

double WasatchNET.MockSpectrometer.sensitivity = 1.0
private

Property Documentation

◆ areaScanEnabled

override bool WasatchNET.MockSpectrometer.areaScanEnabled
getset

Configure detector for 2D image mode.

Not supported on all spectrometers.

Wasatch spectrometers normally "vertically bins" pixel columns on the detector, outputting the spectrum as a one-dimensional array of intensities by pixel.

For production alignment, an "area scan" imaging mode is provided to output each row on the detector as a separate line, so client software can reconstruct a 2D image of the light patterns spread across the detector. In this mode, the intensity value of the first pixel of each line is overwritten by the row index, to ensure the 2D image is received and displayed correctly.

Implements WasatchNET.ISpectrometer.

◆ batteryCharging

override bool WasatchNET.MockSpectrometer.batteryCharging
get

◆ batteryPercentage

override float WasatchNET.MockSpectrometer.batteryPercentage
get

◆ detectorGain

override float WasatchNET.MockSpectrometer.detectorGain
getset

Maps to an FPGA register inside the spectrometer used to scale pixels read from the ADC to optimize dynamic range.

Not normally changed by customer code. Values are normally read from the EEPROM and written back to the spectrometer's FPGA by the driver at initialization.

Altering this value may degrade spectrometer performance.

Implements WasatchNET.ISpectrometer.

◆ detectorGainOdd

override float WasatchNET.MockSpectrometer.detectorGainOdd
getset

(InGaAs-only) Companion property to detectorGain, which on InGaAs detectors applies only to even-numbered pixels.

Implements WasatchNET.ISpectrometer.

◆ detectorOffset

override short WasatchNET.MockSpectrometer.detectorOffset
getset

Maps to an FPGA register inside the spectrometer used to offset the pixels (dark baseline) read from the ADC to optimize dynamic range.

Not normally changed by customer code. Values are normally read from the EEPROM and written back to the spectrometer's FPGA by the driver at initialization.

Altering this value may degrade spectrometer performance.

Implements WasatchNET.ISpectrometer.

◆ detectorOffsetOdd

override short WasatchNET.MockSpectrometer.detectorOffsetOdd
getset

(InGaAs-only) Companion property to detectorOffset, which on InGaAs detectors applies only to even-numbered pixels.

Implements WasatchNET.ISpectrometer.

◆ detectorTECEnabled

override bool WasatchNET.MockSpectrometer.detectorTECEnabled
getset

◆ detectorTECSetpointRaw

override ushort WasatchNET.MockSpectrometer.detectorTECSetpointRaw
getset

◆ detectorTemperatureDegC

override float WasatchNET.MockSpectrometer.detectorTemperatureDegC
get

◆ firmwareRevision

override string WasatchNET.MockSpectrometer.firmwareRevision
get

◆ fpgaRevision

override string WasatchNET.MockSpectrometer.fpgaRevision
get

◆ highGainModeEnabled

override bool WasatchNET.MockSpectrometer.highGainModeEnabled
getset

◆ integrationTimeMS

override uint WasatchNET.MockSpectrometer.integrationTimeMS
getset

Current integration time in milliseconds.

Implements WasatchNET.ISpectrometer.

◆ isARM

override bool WasatchNET.MockSpectrometer.isARM
get

◆ isInGaAs

override bool WasatchNET.MockSpectrometer.isInGaAs
get

◆ laserEnabled

override bool WasatchNET.MockSpectrometer.laserEnabled
getset

Whether the laser has been REQUESTED TO FIRE by the software and firmware.

Implements WasatchNET.ISpectrometer.

◆ laserInterlockEnabled

override bool WasatchNET.MockSpectrometer.laserInterlockEnabled
get

True if the laser can fire (interlock circuit is CLOSED), false if the laser cannot fire (interlock circuit is OPEN).

Requires FeatureMask.HAS_INTERLOCK_FEEDBACK.

Implements WasatchNET.ISpectrometer.

◆ laserModulationPeriod

override UInt64 WasatchNET.MockSpectrometer.laserModulationPeriod
getset

When defining the laser modulation duty cycle, the length (period) of the duty cycle in microsec.

Warning: Laser modulation commands are normally internally set by the function setLaserPowerPercentage().

     Value is in microseconds, range 40bit.</remarks> 

Implements WasatchNET.ISpectrometer.

◆ laserModulationPulseWidth

override UInt64 WasatchNET.MockSpectrometer.laserModulationPulseWidth
getset

When defining the laser modulation duty cycle, the length (width) of the period during which the laser is enabled.

Warning: Laser modulation commands are normally internally set by the function setLaserPowerPercentage().

     Value is in microseconds, range 40bit.

     Example: if period was 100us, and pulseWidth was 20us, then the laser would fire 1/5 of the time and therefore operating
     at 20% power.

Implements WasatchNET.ISpectrometer.

◆ laserTemperatureDegC

override float WasatchNET.MockSpectrometer.laserTemperatureDegC
get

convert the raw laser temperature reading into degrees centigrade

Returns
laser temperature in °C

https://www.ipslasers.com/data-sheets/SM-TO-56-Data-Sheet-IPS.pdf

Laser temperature conversion doesn't use EEPROM coeffs at all. Most Wasatch Raman systems use an IPS Wavelength-Stabilized TO-56 laser, which internally uses a Betatherm 10K3CG3 thermistor.

The official conversion from thermistor resistance (in ohms) to degC is:

1 / ( C1

  • C2 * ln(ohms)
  • C3 * pow(ln(ohms), 3) )

273.15

Where: C1 = 0.00113 C2 = 0.000234 C3 = 8.78e-8

Early Dash / ENLIGHTEN implementations used a simpler curve-fit which yielded nearly identical performance.

Implements WasatchNET.ISpectrometer.

◆ laserTemperatureRaw

override ushort WasatchNET.MockSpectrometer.laserTemperatureRaw
get

Synonym for primaryADC.

selectedADC primaryADC

Implements WasatchNET.ISpectrometer.

◆ laserTemperatureSetpointRaw

override byte WasatchNET.MockSpectrometer.laserTemperatureSetpointRaw
getset

FACTORY ONLY.

WARNING: raising this value above 63 will "increase temperature AND volatility", while lowering this value below 63 will "decrease temperature WHILE increasing volatility".

During factory turning of the potentiometer on the laser driver controller board, this function is used to temporarily offset the TEC DAC setpoint from its default power-up value of 63.

End-users should not adjust this value at runtime, as the potentiometer has already been locked-down at a point optimized for laser power stability over temperature; any changes to this value from the default value of 63 will only increase the chances of power instability, including mode-hopping and hysteresis effects.

See RamanSpecCal's LaserTemperatureTest documentation for additional information.

Note that input values will automatically be capped at 7-bit (0, 127), the operative range of the laser TEC DAC.

Also note that although this property includes the word "temperature" because the setpoint relates to and will change the laser's central temperature, you cannot set a specific temperature setpoint in degC, as the final temperature is generated in hardware as a combination of the DAC setpoint value and the physical potentiometer.

Implements WasatchNET.ISpectrometer.

◆ secondaryADC

override ushort WasatchNET.MockSpectrometer.secondaryADC
get

This is provided for spectrometers with a secondary ADC connected to an external laser, photodiode or what-have-you. Attempts to read it on spectrometers where it has not been configured can result in indeterminate behavior; therefore, hasSecondaryADC is provided to allow callers to selectively enable this function if they believe they are using supported hardware.

Implements WasatchNET.ISpectrometer.

◆ triggerSource

override TRIGGER_SOURCE WasatchNET.MockSpectrometer.triggerSource
getset

Whether acquisitions are triggered "internally" (via the ACQUIRE opcode sent by software) or "externally" (via an electrical signal wired to the accessory connector).

Implements WasatchNET.ISpectrometer.


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