DynExp
Highly flexible laboratory automation for dynamically changing experiments.
Loading...
Searching...
No Matches
DynExp::Units Namespace Reference

Enumerations

enum class  UnitType {
  Arbitrary , LogicLevel , Counts , Volt ,
  Ampere , Power_W , Power_dBm , Index ,
  Time_s , Time_ms , Time_us , Time_ns ,
  Time_ps , Freq_Hz , Freq_kHz , Freq_MHz ,
  Freq_GHz , Freq_THz , Inv_cm , Wavelength_nm ,
  TperSqrtHz , Unitless , UnitlessInt
}
 Units which can be used with DynExp instruments. More...
 

Functions

bool IsIntegerUnit (UnitType Unit)
 Checks whether Unit implies integer values.
 
bool IsIntensityUnit (UnitType Unit)
 Checks whether Unit is an intensity-like unit.
 
bool IsTimeUnit (UnitType Unit)
 Checks whether Unit is a time-like unit.
 
bool IsTimeUnitStrict (UnitType Unit)
 Checks whether Unit is a time unit (excluding UnitType::Index).
 
bool IsIndexUnit (UnitType Unit)
 Checks whether Unit is a sample index unit (UnitType::Index).
 
bool IsFrequencyUnit (UnitType Unit)
 Checks whether Unit is a frequency-like unit.
 
const char * UnitCategoryToStr (UnitType Unit)
 Returns a descriptive string of the given unit's category (e.g. 'intensity').
 
const char * UnitTypeToStr (UnitType Unit)
 Returns a descriptive string of the given unit's type (e.g. 'dBm').
 
std::string UnitToStr (UnitType Unit)
 Returns a descriptive string of a respective unit category and type to be e.g. used in plots.
 

Variables

static constexpr double SpeedOfLight = 2.99792458e8
 Speed of light in vacuum in m/s.
 

Enumeration Type Documentation

◆ UnitType

enum class DynExp::Units::UnitType
strong

Units which can be used with DynExp instruments.

Warning
If this is changed, also update DynExpInstr::ToProtoFrequencyUnitType(DynExp::Units::UnitType) in gRPCInstrument.h and DynExpInstr::ToProtoIntensityUnitType(DynExp::Units::UnitType) in gRPCInstrument.h and DynExpInstr::ToDataStreamInstrumentUnitType(DynExpProto::Common::IntensityUnitType) in NetworkDataStreamInstrument.h and DynExpInstr::ToLaserUnitType(DynExpProto::Common::FrequencyUnitType) in NetworkLaser.h and DynExpInstr::ToLaserUnitType(DynExpProto::Common::IntensityUnitType) in NetworkLaser.h and DynExpInstr::ToSpectrometerUnitType(DynExpProto::Common::FrequencyUnitType) in NetworkSpectrometer.h and DynExpInstr::ToSpectrometerUnitType(DynExpProto::Common::IntensityUnitType) in NetworkSpectrometer.h and FrequencyUnitType enumeration in Common.proto and IntensityUnitType enumeration in Common.proto.
Enumerator
Arbitrary 

Arbitrary units (a.u.)

LogicLevel 

Logic level (TTL) units (1 or 0)

Counts 

Count rate in counts per second (cps)

Volt 

Voltage in Volt (V)

Ampere 

Electric current in Ampere (A)

Power_W 

Power in Watt (W)

Power_dBm 

Power in dBm.

Index 

Sample index.

Time_s 

Time in s.

Time_ms 

Time in ms.

Time_us 

Time in us.

Time_ns 

Time in ns.

Time_ps 

Time in ps.

Freq_Hz 

Frequency in Hz.

Freq_kHz 

Frequency in kHz.

Freq_MHz 

Frequency in MHz.

Freq_GHz 

Frequency in GHz.

Freq_THz 

Frequency in THz.

Inv_cm 

Wavenumber in 1/cm.

Wavelength_nm 

Wavelength in nm.

TperSqrtHz 

Magnetic field amplitude spectral density in T/sqrt(Hz)

Unitless 

Unitless scalar number.

UnitlessInt 

Unitless scalar integer number.

Definition at line 28 of file Units.h.

Function Documentation

◆ IsFrequencyUnit()

bool DynExp::Units::IsFrequencyUnit ( UnitType  Unit)

Checks whether Unit is a frequency-like unit.

Parameters
UnitUnit type as used by DynExp instruments.
Returns
Returns true if Unit is frequency-like, false otherwise.

Definition at line 58 of file Units.cpp.

◆ IsIndexUnit()

bool DynExp::Units::IsIndexUnit ( UnitType  Unit)

Checks whether Unit is a sample index unit (UnitType::Index).

Parameters
UnitUnit type as used by DynExp instruments.
Returns
Returns true if Unit is a sample index unit, false otherwise.

Definition at line 53 of file Units.cpp.

◆ IsIntegerUnit()

bool DynExp::Units::IsIntegerUnit ( UnitType  Unit)

Checks whether Unit implies integer values.

Parameters
UnitUnit type as used by DynExp instruments.
Returns
Returns true if Unit implies integer values, false otherwise.

Definition at line 7 of file Units.cpp.

◆ IsIntensityUnit()

bool DynExp::Units::IsIntensityUnit ( UnitType  Unit)

Checks whether Unit is an intensity-like unit.

Parameters
UnitUnit type as used by DynExp instruments.
Returns
Returns true if Unit is intensity-like, false otherwise.

Definition at line 19 of file Units.cpp.

◆ IsTimeUnit()

bool DynExp::Units::IsTimeUnit ( UnitType  Unit)

Checks whether Unit is a time-like unit.

Parameters
UnitUnit type as used by DynExp instruments.
Returns
Returns true if Unit is time-like, false otherwise.

Definition at line 34 of file Units.cpp.

◆ IsTimeUnitStrict()

bool DynExp::Units::IsTimeUnitStrict ( UnitType  Unit)

Checks whether Unit is a time unit (excluding UnitType::Index).

Parameters
UnitUnit type as used by DynExp instruments.
Returns
Returns true if Unit is a time, false otherwise.

Definition at line 48 of file Units.cpp.

◆ UnitCategoryToStr()

const char * DynExp::Units::UnitCategoryToStr ( UnitType  Unit)

Returns a descriptive string of the given unit's category (e.g. 'intensity').

Parameters
UnitUnit type as used by DynExp instruments.
Returns
Returns the human-readable unit category string.

Definition at line 73 of file Units.cpp.

◆ UnitToStr()

std::string DynExp::Units::UnitToStr ( UnitType  Unit)

Returns a descriptive string of a respective unit category and type to be e.g. used in plots.

Parameters
UnitUnit type as used by DynExp instruments.
Returns
Returns the human-readable string, like '[category] in [type]'.

Definition at line 135 of file Units.cpp.

◆ UnitTypeToStr()

const char * DynExp::Units::UnitTypeToStr ( UnitType  Unit)

Returns a descriptive string of the given unit's type (e.g. 'dBm').

Parameters
UnitUnit type as used by DynExp instruments.
Returns
Returns the human-readable unit type string.

Definition at line 104 of file Units.cpp.

Variable Documentation

◆ SpeedOfLight

constexpr double DynExp::Units::SpeedOfLight = 2.99792458e8
staticconstexpr

Speed of light in vacuum in m/s.

Definition at line 128 of file Units.h.