Wasatch.NET 2.4.14
.NET application driver for Wasatch Photonics spectrometers
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Public Attributes | Private Member Functions | Private Attributes | List of all members
WasatchNET.IntegrationOptimizer Class Reference

Controls the automatic (background) optimization of a spectrometer's integration time to within 'targetCountThreshold' counts of 'targetCounts' intensity goal. More...

Collaboration diagram for WasatchNET.IntegrationOptimizer:
[legend]

Public Types

enum  Status { PENDING , SUCCESS , ERROR }
 

Public Member Functions

 IntegrationOptimizer (Spectrometer spec)
 Instantiate a new IntegrationOptimizer on a particular Spectrometer.
 
async void start ()
 Start the background integration. Note that this will generate a series of integrations in a background thread. Spectrometer communications during an ongoing optimization may be compromised and parallel activity could yield unpredictable results.
 

Public Attributes

uint maxIterations = 20
 how many acquisitions the algorithm can attempt
 
uint maxSaneIntegrationTimeMS = 10000
 longest integration time you're willing to consider
 
Spectrometer spec
 the Spectrometer being optimized
 
uint startMS = 10
 initial integration time for first iteration
 
Status status = Status.PENDING
 Current (or final) status of the IntegrationOptimizer. Defaults to PENDING at construction, and switches to SUCCESS or ERROR only at completion.
 
int targetCounts = 40000
 the intensity you want to reach
 
int targetCountThreshold = 2500
 error margin around the targetCounts intensity
 

Private Member Functions

void run ()
 

Private Attributes

Logger logger = Logger.getInstance()
 

Detailed Description

Controls the automatic (background) optimization of a spectrometer's integration time to within 'targetCountThreshold' counts of 'targetCounts' intensity goal.

This class is similar to the PeakIntegrationOptimizer (PIO) in WPSpecCal, but simpler, as it only optimizes "full spectra" (uses the maximum height of the entire spectrum), rather than allowing individual peaks to be optimized to target levels.

The typical use-case would be to instantiate the IntegrationOptimizer with a reference to the spectrometer you want to optimize, then tweak the values of any public parameters (targetCounts, targetCountThreshold, maxIterations, maxSaneItegrationTimeMS, startMS etc) you wish. Then call start(), and internally poll the object until status no longer reads PENDING (switches to either SUCCESS or ERROR). At that time, you can read the Spectrometer's integration time to obtain the converged value.

While polling, you can graph the intermediate spectra if you wish, using Spectrometer.lastSpectrum. See MultiChannelDemo.Form1.graphIntegrationSpectra for examples.

Member Enumeration Documentation

◆ Status

Enumerator
PENDING 
SUCCESS 
ERROR 

Constructor & Destructor Documentation

◆ IntegrationOptimizer()

WasatchNET.IntegrationOptimizer.IntegrationOptimizer ( Spectrometer  spec)
inline

Instantiate a new IntegrationOptimizer on a particular Spectrometer.

Parameters
specthe Spectrometer whose integration time should be optimized

Member Function Documentation

◆ run()

void WasatchNET.IntegrationOptimizer.run ( )
inlineprivate

◆ start()

async void WasatchNET.IntegrationOptimizer.start ( )
inline

Start the background integration. Note that this will generate a series of integrations in a background thread. Spectrometer communications during an ongoing optimization may be compromised and parallel activity could yield unpredictable results.

<todo> consider an additional lock, beyond acquisitionLock, to preclude user commands during internal activities </todo>

Member Data Documentation

◆ logger

Logger WasatchNET.IntegrationOptimizer.logger = Logger.getInstance()
private

◆ maxIterations

uint WasatchNET.IntegrationOptimizer.maxIterations = 20

how many acquisitions the algorithm can attempt

◆ maxSaneIntegrationTimeMS

uint WasatchNET.IntegrationOptimizer.maxSaneIntegrationTimeMS = 10000

longest integration time you're willing to consider

◆ spec

Spectrometer WasatchNET.IntegrationOptimizer.spec

the Spectrometer being optimized

◆ startMS

uint WasatchNET.IntegrationOptimizer.startMS = 10

initial integration time for first iteration

◆ status

Status WasatchNET.IntegrationOptimizer.status = Status.PENDING

Current (or final) status of the IntegrationOptimizer. Defaults to PENDING at construction, and switches to SUCCESS or ERROR only at completion.

◆ targetCounts

int WasatchNET.IntegrationOptimizer.targetCounts = 40000

the intensity you want to reach

◆ targetCountThreshold

int WasatchNET.IntegrationOptimizer.targetCountThreshold = 2500

error margin around the targetCounts intensity


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