DynExp
Highly flexible laboratory automation for dynamically changing experiments.
Loading...
Searching...
No Matches
Spectrometer.cpp
Go to the documentation of this file.
1// This file is part of DynExp.
2
3#include "stdafx.h"
4#include "Spectrometer.h"
5
6namespace DynExpInstr
7{
9 {
10 switch (Unit)
11 {
12 case FrequencyUnitType::Hz: return "Hz";
13 case FrequencyUnitType::nm: return "nm";
14 case FrequencyUnitType::Inv_cm: return "1/cm";
15 default: return "<unknown unit>";
16 }
17 }
18
20 {
21 switch (Unit)
22 {
23 case IntensityUnitType::Counts: return "#";
24 default: return "<unknown unit>";
25 }
26 }
27
29 : FrequencyUnit(Other.FrequencyUnit), IntensityUnit(Other.IntensityUnit), Samples(std::move(Other.Samples))
30 {
31 Other.Reset();
32 }
33
35 {
36 FrequencyUnit = Other.FrequencyUnit;
37 IntensityUnit = Other.IntensityUnit;
38 Samples = Other.Samples;
39
40 return *this;
41 }
42
44 {
45 FrequencyUnit = Other.FrequencyUnit;
46 IntensityUnit = Other.IntensityUnit;
47 Samples = std::move(Other.Samples);
48
49 Other.Reset();
50
51 return *this;
52 }
53
55 {
56 Samples.clear();
57 }
58
63
68
70 {
71 CurrentSpectrum = std::move(Other);
72 }
73
78
92
96
100
104
106 {
107 }
108
113
118}
Defines a meta instrument for a spectrometer.
Type describing a spectrum as acquired by the Spectrometer instrument.
SpectrumType & operator=(const SpectrumType &Other)
Copies a SpectrumType instance's content to this instance.
std::map< double, double > Samples
Samples of the spectrum as tuples in units (FrequencyUnit, IntensityUnit)
SpectrumType()
Constructs a SpectrumType instance with FrequencyUnit set to FrequencyUnitType::Hz and IntensityUnit ...
IntensityUnitType IntensityUnit
The spectrum's intensity (y-axis) unit.
FrequencyUnitType FrequencyUnit
The spectrum's frequency (x-axis) unit.
void Reset()
Removes all samples from the spectrum (clears Samples).
SpectrumType GetSpectrumCopy() const
Copying getter for CurrentSpectrum. This function is more expensive than GetSpectrum().
double CurrentUpperFrequency
Current upper frequency limit where the spectrum acquisition ends.
TimeType MaxExposureTime
Maximal exposure time the spectrometer supports.
SpectrumType CurrentSpectrum
Current spectrum acquired by the spectrometer. Logical const-ness: allow const member function GetSpe...
void SetSpectrum(SpectrumType &&Other)
Setter for CurrentSpectrum.
static const char * IntensityUnitTypeToStr(const IntensityUnitType &Unit)
Returns a descriptive string of a respective intensity unit to be e.g. used in plots.
void ClearSpectrum() const
Resets CurrentSpectrum by calling SpectrumType::Reset().
void ResetImpl(dispatch_tag< InstrumentDataBase >) override final
SpectrumType GetSpectrum() const
Moving getter for CurrentSpectrum.
TimeType MinExposureTime
Minimal exposure time the spectrometer supports.
std::chrono::milliseconds TimeType
Time type describing the spectrometer's times like its exposure time.
static const char * FrequencyUnitTypeToStr(const FrequencyUnitType &Unit)
Returns a descriptive string of a respective frequency unit to be e.g. used in plots.
double CurrentLowerFrequency
Current lower frequency limit where the spectrum acquisition begins.
FrequencyUnitType
Supported spectrometer frequency units.
IntensityUnitType
Supported spectrometer intensity units.
@ Counts
Number of counts (arbitrary unit)
TimeType CurrentExposureTime
Current exposure time of the spectrometer.
bool SilentModeEnabled
Indicates whether the spectrometer's silent mode is turned on, i.e. the spectrometer's fans are turne...
virtual void SetSilentMode(bool Enable, DynExp::TaskBase::CallbackType CallbackFunc=nullptr) const
Enables or disables the spectrometer's silent mode, i.e. disables or enables e.g. the spectrometer's ...
void ResetImpl(dispatch_tag< InstrumentBase >) override final
virtual void Abort(DynExp::TaskBase::CallbackType CallbackFunc=nullptr) const
Aborts a currently running spectrum acquisition.
Refer to ParamsBase::dispatch_tag.
Definition Instrument.h:146
Refer to ParamsBase::dispatch_tag.
Definition Object.h:2018
std::function< void(const TaskBase &, ExceptionContainer &)> CallbackType
Type of a callback function which is invoked when a task has finished, failed or has been aborted....
Definition Instrument.h:939
Thrown when a requested feature is either under development and thus not implemented yet or when a sp...
Definition Exception.h:299
DynExp's instrument namespace contains the implementation of DynExp instruments which extend DynExp's...
Accumulates include statements to provide a precompiled header.