Unit symbol has only one param now, not multiple in a tuple, added string representation for a qty

This commit is contained in:
Anne de Jong 2021-01-28 22:17:32 +01:00
parent 5c3cae730f
commit 022108f99e
4 changed files with 36 additions and 6 deletions

View File

@ -163,7 +163,11 @@ cdef class Daq:
daqconfig = &(pydaqconfig.config)
devinfo = &(pydevinfo.devinfo)
self.daq_device = cppDaq.createDaq(devinfo[0], daqconfig[0])
try:
self.daq_device = cppDaq.createDaq(devinfo[0], daqconfig[0])
except Exception as e:
print(e)
raise
self.nFramesPerBlock = self.daq_device.framesPerBlock()
self.samplerate = self.daq_device.samplerate()

View File

@ -8,7 +8,7 @@ Description:
Data Acquistiion (DAQ) device descriptors, and the DAQ devices themselves
"""
__all__ = ['DaqChannel', 'DaqConfiguration', 'DaqConfigurations']
__all__ = ['DaqConfiguration', 'DaqConfigurations']
from ..lasp_common import lasp_shelve, SIQtys, Qty
from .lasp_device_common import DaqChannel
import json

View File

@ -42,6 +42,28 @@ cdef class DeviceInfo:
return self.devinfo.prefSampleRateIndex
@property
def prefSampleRate(self):
return self.availableSampleRates[
self.prefSampleRateIndex]
@property
def prefFramesPerBlockIndex(self):
return self.devinfo.prefFramesPerBlockIndex
@property
def prefFramesPerBlock(self):
return self.availableFramesPerBlock[
self.prefFramesPerBlockIndex]
@property
def prefDataTypeIndex(self):
return self.devinfo.prefDataTypeIndex
@property
def prefDataType(self):
return self.availableDataTypes[
self.prefDataTypeIndex]
@property
def hasInputIEPE(self):
return self.devinfo.hasInputIEPE

View File

@ -52,18 +52,22 @@ class Qty:
level_ref_name: str
level_ref_value: str
def __str__(self):
return self.name + f' [{self.unit_symb}]'
class SIQtys:
N = Qty(name='Number',
unit_name='No unit / full scale',
unit_symb=('-'),
unit_symb='-',
level_unit=('dBFS',),
level_ref_name=('Full scale sine wave',),
level_ref_value=(dBFS_REF,)
)
AP = Qty(name='Acoustic Pressure',
unit_name='Pascal',
unit_symb=('Pa', 'muPa'),
unit_symb='Pa',
level_unit=('dB SPL','dBPa'),
level_ref_name=('2 micropascal', '1 pascal',),
level_ref_value=(P_REF, 1)
@ -71,13 +75,13 @@ class SIQtys:
V = Qty(name='Voltage',
unit_name='Volt',
unit_symb='V',
unit_symb=('V'),
level_unit=('dBV',), # dBV
level_ref_name=('1V',),
level_ref_value=(1.0,),
)
types = (N, AP, V)
default = N
default = AP
default_index = 0
@staticmethod