5#include <pybind11/numpy.h>
6#include <pybind11/stl.h>
10namespace py = pybind11;
15 py::class_<DataTypeDescriptor> dtype_desc(m,
"DataTypeDescriptor");
22 py::enum_<DataTypeDescriptor::DataType>(dtype_desc,
"DataType")
32 dtype_desc.def_static(
"fromStr", [](
const std::string &dtype_str) {
33 decltype(
dtype_map.cbegin()) d = std::find_if(
35 [&dtype_str](
const auto &d) { return d.second.name == dtype_str; });
39 throw std::runtime_error(dtype_str +
" not found in list of data types");
45 py::class_<DaqApi> daqapi(m,
"DaqApi");
49 daqapi.def(
"__str__", [](
const DaqApi &d) {
return std::string(d); });
52 py::class_<DaqConfiguration> daqconfig(m,
"DaqConfiguration");
54 py::class_<DaqChannel> daqchannel(m,
"DaqChannel");
55 daqchannel.def(py::init<>());
61 daqchannel.def_readwrite(
"digitalHighpassCutOn",
65 py::enum_<DaqChannel::Qty>(daqchannel,
"Qty")
77 daqconfig.def(py::init<>());
78 daqconfig.def(py::init<const DeviceInfo &>());
82 daqconfig.def_readwrite(
"sampleRateIndex",
86 daqconfig.def_readwrite(
"framesPerBlockIndex",
94 daqconfig.def_readwrite(
"inchannel_config",
96 daqconfig.def_readwrite(
"outchannel_config",
101 py::arg(
"include_monitor") =
true);
Class that specifies API related information. An API configuration is part of the DAQConfiguration an...
unsigned api_specific_subcode
Stores channel configuration data for each channel. I.e. the physical quantity measured,...
double sensitivity
The conversion between recorded physical unit and stored / outputed number, i.e. Number/Volt or Numbe...
double digitalHighPassCutOn
Whether to enable a digital high pass on the signal before passing the result in case of input,...
bool IEPEEnabled
For input-only: enable IEPE constant current power supply for this channel. Only for hardware that is...
int rangeIndex
Index in possible ranges for input / output.
bool ACCouplingMode
Whether to enable HW AC-coupling for this channel.
Qty qty
The physical quantity that is inputed / outputed.
bool enabled
Whether the channel is enabled.
static DaqConfiguration fromTOML(const std::string &toml)
Load in a DAQConfiguration from TOML.
std::vector< DaqChannel > enabledInChannels(const bool include_monitor=true) const
Return list of enabled input channels.
int framesPerBlockIndex
The index in the array of frames per block that can be used for the device.
int dataTypeIndex
Required datatype for output, should be present in the list.
std::vector< DaqChannel > inchannel_config
Channel configuration for input channels.
bool monitorOutput
If set to true and if the device has this capability, the output channels are added as input channels...
string device_name
The internal device name this DAQ configuration applies to.
std::string toTOML() const
Export the class to TOML markup language.
int sampleRateIndex
Index in list of sample rates that are available for the device.
std::vector< DaqChannel > outchannel_config
Channel configuration for output channels.
void setAllInputEnabled(bool val)
Set all input channels to enabled / disabled state.
bool match(const DeviceInfo &devinfo) const
Check to see whether the DAQ configuration matches with the device. This means, some basic checks are...
void setAllOutputEnabled(bool val)
Set all output channels to enabled / disabled state.
unsigned sw
Sample width of a single sample, in bytes.
string name
Name of the datatype.
bool is_floating
Whether the datatype is a floating point Y/N.
DataType
Basic data types coming from a DAQ that we can deal with. The naming will be self-explainging.
DataType dtype
The number from the enumeration.
const std::map< DataTypeDescriptor::DataType, const DataTypeDescriptor > dtype_map
void init_daqconfiguration(py::module &m)