20 namespace SpectrometerTasks
252 void ResetImpl(dispatch_tag<InstrumentDataBase>)
override final;
292 virtual const char*
GetParamClassTag() const noexcept
override {
return "SpectrometerParams"; }
333 constexpr
static auto Name() noexcept {
return "Spectrometer"; }
334 constexpr
static auto Category() noexcept {
return "Image Capturing"; }
347 virtual std::chrono::milliseconds
GetTaskQueueDelay()
const override {
return std::chrono::milliseconds(50); }
Implementation of DynExp instrument objects.
Configurator class for Spectrometer.
virtual ~SpectrometerConfigurator()=0
SpectrometerConfigurator()=default
Type describing a spectrum as acquired by the Spectrometer instrument.
auto GetFrequencyUnit() const noexcept
Getter for FrequencyUnit.
SpectrumType & operator=(const SpectrumType &Other)
Copies a SpectrumType instance's content to this instance.
auto GetIntensityUnit() const noexcept
Getter for IntensityUnit.
SpectrumType(FrequencyUnitType FrequencyUnit, IntensityUnitType IntensityUnit)
Constructs a SpectrumType instance with the specified units.
bool HasSpectrum() const noexcept
Indicates whether the spectrum is empty.
std::map< double, double > Samples
Samples of the spectrum as tuples in units (FrequencyUnit, IntensityUnit)
SpectrumType(const SpectrumType &Other)
Copy-constructs a SpectrumType instance.
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.
auto & GetSpectrum() const noexcept
Getter for Samples.
auto & GetSpectrum() noexcept
Getter for Samples.
void Reset()
Removes all samples from the spectrum (clears Samples).
Data class for Spectrometer.
virtual void ResetImpl(dispatch_tag< SpectrometerData >)
void SetMinExposureTime(double MinExposureTime) noexcept
Setter for MinExposureTime.
SpectrometerData()=default
auto GetCapturingState() const noexcept
Returns the spectrometer's current capturing state.
SpectrumType GetSpectrumCopy() const
Copying getter for CurrentSpectrum. This function is more expensive than GetSpectrum().
auto GetMaxExposureTime() const noexcept
Getter for MaxExposureTime.
auto GetSilentModeEnabled() const noexcept
Getter for SilentModeEnabled.
void SetCurrentExposureTime(TimeType CurrentExposureTime) noexcept
Setter for CurrentExposureTime.
virtual double GetCapturingProgressChild() const noexcept
Determines the progress of a spectrum acquisition.
void SetCurrentLowerFrequency(double CurrentLowerFrequency) noexcept
Setter for CurrentLowerFrequency.
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...
CapturingStateType
Possible spectrometer states.
@ Warning
The spectrometer is in a warning state, but still ready to acquire a spectrum.
@ Capturing
The spectrometer is currently acquiring a spectrum.
@ Error
The spectrometer is in an error state.
@ Ready
The spectrometer is ready to acquire a spectrum.
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.
void SetMinExposureTime(TimeType MinExposureTime) noexcept
Setter for MinExposureTime.
void SetCurrentExposureTime(double CurrentExposureTime) noexcept
Setter for CurrentExposureTime.
virtual ~SpectrometerData()=default
auto GetCurrentExposureTime() const noexcept
Getter for CurrentExposureTime.
auto GetCurrentLowerFrequency() const noexcept
Getter for CurrentLowerFrequency.
TimeType MinExposureTime
Minimal exposure time the spectrometer supports.
auto GetCapturingProgress() const noexcept
Determines the progress of a spectrum acquisition.
std::chrono::milliseconds TimeType
Time type describing the spectrometer's times like its exposure time.
void SetCurrentUpperFrequency(double CurrentUpperFrequency) noexcept
Setter for CurrentUpperFrequency.
void SetMaxExposureTime(TimeType MaxExposureTime) noexcept
Setter for MaxExposureTime.
static const char * FrequencyUnitTypeToStr(const FrequencyUnitType &Unit)
Returns a descriptive string of a respective frequency unit to be e.g. used in plots.
bool HasSpectrum() const noexcept
Indicates whether the spectrum is empty.
void SetMaxExposureTime(double MaxExposureTime) noexcept
Setter for MaxExposureTime.
double CurrentLowerFrequency
Current lower frequency limit where the spectrum acquisition begins.
auto GetCurrentUpperFrequency() const noexcept
Getter for CurrentUpperFrequency.
bool IsCapturing() const noexcept
Determines whether the spectrometer is currently acquiring a spectrum.
virtual CapturingStateType GetCapturingStateChild() const noexcept=0
Returns the spectrometer's current capturing state.
auto GetMinExposureTime() const noexcept
Getter for MinExposureTime.
FrequencyUnitType
Supported spectrometer frequency units.
@ Inv_cm
Wavenumber in 1/cm.
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...
void SetSilentModeEnabled(bool Enable) noexcept
Setter for SilentModeEnabled.
Parameter class for Spectrometer.
virtual void ConfigureParamsImpl(dispatch_tag< SpectrometerParams >)
Called by DynExp::ParamsBase::ConfigureParams() as a starting point for the tag dispatch mechanism to...
SpectrometerParams(DynExp::ItemIDType ID, const DynExp::DynExpCore &Core)
Constructs the parameters for a Spectrometer instance.
DummyParam Dummy
Dummy parameter which is to be owned once by parameter classes that do not contain any other paramete...
virtual const char * GetParamClassTag() const noexcept override
This function is intended to be overridden once in each derived class returning the name of the respe...
virtual ~SpectrometerParams()=0
void ConfigureParamsImpl(dispatch_tag< InstrumentParamsBase >) override final
Defines a task for deinitializing an instrument within an instrument inheritance hierarchy....
void ExitFuncImpl(dispatch_tag< ExitTaskBase >, DynExp::InstrumentInstance &Instance) override final
virtual void ExitFuncImpl(dispatch_tag< ExitTask >, DynExp::InstrumentInstance &Instance)
Deinitializes the respective instrument within the instrument inheritance hierarchy....
Defines a task for initializing an instrument within an instrument inheritance hierarchy....
virtual void InitFuncImpl(dispatch_tag< InitTask >, DynExp::InstrumentInstance &Instance)
Initializes the respective instrument within the instrument inheritance hierarchy....
void InitFuncImpl(dispatch_tag< InitTaskBase >, DynExp::InstrumentInstance &Instance) override final
Defines a task for updating an instrument within an instrument inheritance hierarchy....
void UpdateFuncImpl(dispatch_tag< UpdateTaskBase >, DynExp::InstrumentInstance &Instance) override final
virtual void UpdateFuncImpl(dispatch_tag< UpdateTask >, DynExp::InstrumentInstance &Instance)
Updates the respective instrument within the instrument inheritance hierarchy. Call UpdateFuncImpl() ...
Meta instrument for a spectrometer.
virtual void Record(DynExp::TaskBase::CallbackType CallbackFunc=nullptr) const =0
Starts the acquisition of a single spectrum.
virtual SpectrometerData::FrequencyUnitType GetFrequencyUnit() const =0
Determines the frequency (x-axis) unit of the spectra acquired by the derived instrument.
virtual std::string GetName() const override
Returns the name of this Object type.
virtual double GetMinFrequency() const =0
Determines the minimal lower frequency limit where the spectrum acquisition can begin.
Spectrometer(const std::thread::id OwnerThreadID, DynExp::ParamsBasePtrType &&Params)
Constructs an instrument instance.
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 ...
virtual void ResetImpl(dispatch_tag< Spectrometer >)=0
Refer to DynExp::Object::Reset(). Using tag dispatch mechanism to ensure that ResetImpl() of every de...
void ResetImpl(dispatch_tag< InstrumentBase >) override final
virtual std::chrono::milliseconds GetTaskQueueDelay() const override
Specifies in which time intervals the instrument's task queue runs to handle pending tasks.
virtual ~Spectrometer()=0
constexpr static auto Category() noexcept
Every derived class has to redefine this function.
virtual void Abort(DynExp::TaskBase::CallbackType CallbackFunc=nullptr) const
Aborts a currently running spectrum acquisition.
virtual SpectrometerData::IntensityUnitType GetIntensityUnit() const =0
Determines the intensity (y-axis) unit of the spectra acquired by the derived instrument.
constexpr static auto Name() noexcept
Every derived class has to redefine this function.
virtual void SetFrequencyRange(double LowerFrequency, double UpperFrequency, DynExp::TaskBase::CallbackType CallbackFunc=nullptr) const =0
Sets the spectrometer's frequency range where the spectrum acquisition begins and ends.
virtual double GetMaxFrequency() const =0
Determines the maximal upper frequency limit where the spectrum acquisition can end.
virtual std::string GetCategory() const override
Returns the category of this Object type.
virtual void SetExposureTime(SpectrometerData::TimeType ExposureTime, DynExp::TaskBase::CallbackType CallbackFunc=nullptr) const =0
Sets the spectrometer's exposure time.
DynExp's core class acts as the interface between the user interface and DynExp's internal data like ...
Defines a task for deinitializing an instrument within an instrument inheritance hierarchy....
Refer to DynExp::ParamsBase::dispatch_tag.
Defines a task for initializing an instrument within an instrument inheritance hierarchy....
Refer to DynExp::ParamsBase::dispatch_tag.
Base class for instruments. Instruments comprise virtual devices (meta instruments) and physial devic...
InstrumentBase(const std::thread::id OwnerThreadID, ParamsBasePtrType &&Params)
Constructs an instrument instance.
Configurator class for InstrumentBase.
Data structure to contain data which is synchronized in between different threads....
Refer to ParamsBase::dispatch_tag.
Defines data for a thread belonging to a InstrumentBase instance. Refer to RunnableInstance.
Parameter class for InstrumentBase.
InstrumentParamsBase(ItemIDType ID, const DynExpCore &Core)
Constructs the parameters for a InstrumentBase instance.
const std::thread::id OwnerThreadID
Thread id of the thread which has constructed (and owns) this Object instance.
const ParamsBasePtrType Params
Pointer to the parameter class instance belonging to this Object instance.
Refer to ParamsBase::dispatch_tag.
Dummy parameter which is to be owned once by parameter classes that do not contain any other paramete...
const ItemIDType ID
ID of the Object this parameter class instance belongs to.
const DynExpCore & Core
Reference to DynExp's core.
Tag for function dispatching mechanism within this class used when derived classes are not intended t...
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....
Defines a task for updating an instrument within an instrument inheritance hierarchy....
Refer to DynExp::ParamsBase::dispatch_tag.
DynExp's instrument namespace contains the implementation of DynExp instruments which extend DynExp's...
std::unique_ptr< ParamsBase > ParamsBasePtrType
Alias for a pointer to the parameter system base class ParamsBase.
size_t ItemIDType
ID type of objects/items managed by DynExp.
Accumulates include statements to provide a precompiled header.