DynExp
Highly flexible laboratory automation for dynamically changing experiments.
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 
6 namespace 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 
60  {
61  return std::move(CurrentSpectrum);
62  }
63 
65  {
66  return CurrentSpectrum;
67  }
68 
70  {
71  CurrentSpectrum = std::move(Other);
72  }
73 
75  {
77  }
78 
80  {
86  SilentModeEnabled = false;
87 
89 
91  }
92 
94  {
95  }
96 
98  {
99  }
100 
102  {
103  }
104 
105  void Spectrometer::SetSilentMode(bool Enable, DynExp::TaskBase::CallbackType CallbackFunc) const
106  {
107  }
108 
110  {
112  }
113 
115  {
117  }
118 }
Defines a meta instrument for a spectrometer.
Type describing a spectrum as acquired by the Spectrometer instrument.
Definition: Spectrometer.h:121
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)
Definition: Spectrometer.h:179
SpectrumType()
Constructs a SpectrumType instance with FrequencyUnit set to FrequencyUnitType::Hz and IntensityUnit ...
Definition: Spectrometer.h:127
IntensityUnitType IntensityUnit
The spectrum's intensity (y-axis) unit.
Definition: Spectrometer.h:177
FrequencyUnitType FrequencyUnit
The spectrum's frequency (x-axis) unit.
Definition: Spectrometer.h:176
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.
Definition: Spectrometer.h:267
TimeType MaxExposureTime
Maximal exposure time the spectrometer supports.
Definition: Spectrometer.h:264
SpectrumType CurrentSpectrum
Current spectrum acquired by the spectrometer. Logical const-ness: allow const member function GetSpe...
Definition: Spectrometer.h:275
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.
Definition: Spectrometer.h:263
std::chrono::milliseconds TimeType
Time type describing the spectrometer's times like its exposure time.
Definition: Spectrometer.h:71
static const char * FrequencyUnitTypeToStr(const FrequencyUnitType &Unit)
Returns a descriptive string of a respective frequency unit to be e.g. used in plots.
Definition: Spectrometer.cpp:8
double CurrentLowerFrequency
Current lower frequency limit where the spectrum acquisition begins.
Definition: Spectrometer.h:266
FrequencyUnitType
Supported spectrometer frequency units.
Definition: Spectrometer.h:78
IntensityUnitType
Supported spectrometer intensity units.
Definition: Spectrometer.h:89
@ Counts
Number of counts (arbitrary unit)
TimeType CurrentExposureTime
Current exposure time of the spectrometer.
Definition: Spectrometer.h:265
bool SilentModeEnabled
Indicates whether the spectrometer's silent mode is turned on, i.e. the spectrometer's fans are turne...
Definition: Spectrometer.h:268
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...
Definition: Instrument.h:1254
Accumulates include statements to provide a precompiled header.