|
Wasatch.NET 2.4.14
.NET application driver for Wasatch Photonics spectrometers
|
Controls the automatic (background) optimization of a spectrometer's integration time to within 'targetCountThreshold' counts of 'targetCounts' intensity goal. More...
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() |
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.
|
inline |
Instantiate a new IntegrationOptimizer on a particular Spectrometer.
| spec | the Spectrometer whose integration time should be optimized |
|
inlineprivate |
|
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>
|
private |
| uint WasatchNET.IntegrationOptimizer.maxIterations = 20 |
how many acquisitions the algorithm can attempt
| uint WasatchNET.IntegrationOptimizer.maxSaneIntegrationTimeMS = 10000 |
longest integration time you're willing to consider
| Spectrometer WasatchNET.IntegrationOptimizer.spec |
the Spectrometer being optimized
| uint WasatchNET.IntegrationOptimizer.startMS = 10 |
initial integration time for first iteration
| 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.
| int WasatchNET.IntegrationOptimizer.targetCounts = 40000 |
the intensity you want to reach
| int WasatchNET.IntegrationOptimizer.targetCountThreshold = 2500 |
error margin around the targetCounts intensity