DynExp
Highly flexible laboratory automation for dynamically changing experiments.
Loading...
Searching...
No Matches
Units.h
Go to the documentation of this file.
1// This file is part of DynExp.
2
9#pragma once
10
11#include <string>
12
13namespace DynExp::Units
14{
28 enum class UnitType {
29 // Intensity-like
30 Arbitrary,
32 Counts,
33 Volt,
34 Ampere,
35 Power_W,
36 Power_dBm,
37 //
38 // Time-like
39 Index,
40 Time_s,
41 Time_ms,
42 Time_us,
43 Time_ns,
44 Time_ps,
45 //
46 // Frequency-like
47 Freq_Hz,
48 Freq_kHz,
49 Freq_MHz,
50 Freq_GHz,
51 Freq_THz,
52 Inv_cm,
54 //
55 // Other
57 Unitless,
59 };
60
66 bool IsIntegerUnit(UnitType Unit);
67
73 bool IsIntensityUnit(UnitType Unit);
74
80 bool IsTimeUnit(UnitType Unit);
81
87 bool IsTimeUnitStrict(UnitType Unit);
88
94 bool IsIndexUnit(UnitType Unit);
95
101 bool IsFrequencyUnit(UnitType Unit);
102
108 const char* UnitCategoryToStr(UnitType Unit);
109
115 const char* UnitTypeToStr(UnitType Unit);
116
123 std::string UnitToStr(UnitType Unit);
124
128 static constexpr double SpeedOfLight = 2.99792458e8;
129}
bool IsIndexUnit(UnitType Unit)
Checks whether Unit is a sample index unit (UnitType::Index).
Definition Units.cpp:53
bool IsTimeUnit(UnitType Unit)
Checks whether Unit is a time-like unit.
Definition Units.cpp:34
UnitType
Units which can be used with DynExp instruments.
Definition Units.h:28
@ TperSqrtHz
Magnetic field amplitude spectral density in T/sqrt(Hz)
@ Freq_THz
Frequency in THz.
@ Ampere
Electric current in Ampere (A)
@ Inv_cm
Wavenumber in 1/cm.
@ Power_dBm
Power in dBm.
@ Arbitrary
Arbitrary units (a.u.)
@ Unitless
Unitless scalar number.
@ LogicLevel
Logic level (TTL) units (1 or 0)
@ Freq_Hz
Frequency in Hz.
@ Freq_GHz
Frequency in GHz.
@ Wavelength_nm
Wavelength in nm.
@ Index
Sample index.
@ Freq_kHz
Frequency in kHz.
@ UnitlessInt
Unitless scalar integer number.
@ Freq_MHz
Frequency in MHz.
@ Power_W
Power in Watt (W)
@ Volt
Voltage in Volt (V)
@ Counts
Count rate in counts per second (cps)
std::string UnitToStr(UnitType Unit)
Returns a descriptive string of a respective unit category and type to be e.g. used in plots.
Definition Units.cpp:135
const char * UnitCategoryToStr(UnitType Unit)
Returns a descriptive string of the given unit's category (e.g. 'intensity').
Definition Units.cpp:73
static constexpr double SpeedOfLight
Speed of light in vacuum in m/s.
Definition Units.h:128
bool IsIntensityUnit(UnitType Unit)
Checks whether Unit is an intensity-like unit.
Definition Units.cpp:19
bool IsIntegerUnit(UnitType Unit)
Checks whether Unit implies integer values.
Definition Units.cpp:7
bool IsTimeUnitStrict(UnitType Unit)
Checks whether Unit is a time unit (excluding UnitType::Index).
Definition Units.cpp:48
bool IsFrequencyUnit(UnitType Unit)
Checks whether Unit is a frequency-like unit.
Definition Units.cpp:58
const char * UnitTypeToStr(UnitType Unit)
Returns a descriptive string of the given unit's type (e.g. 'dBm').
Definition Units.cpp:104