diff --git a/lasp/device/lasp_daq.pyx b/lasp/device/lasp_daq.pyx index b974a1a..c05854e 100644 --- a/lasp/device/lasp_daq.pyx +++ b/lasp/device/lasp_daq.pyx @@ -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() diff --git a/lasp/device/lasp_daqconfig.pyx b/lasp/device/lasp_daqconfig.pyx index b315e96..b1d382f 100644 --- a/lasp/device/lasp_daqconfig.pyx +++ b/lasp/device/lasp_daqconfig.pyx @@ -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 diff --git a/lasp/device/lasp_deviceinfo.pyx b/lasp/device/lasp_deviceinfo.pyx index 1a6a670..2ead824 100644 --- a/lasp/device/lasp_deviceinfo.pyx +++ b/lasp/device/lasp_deviceinfo.pyx @@ -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 diff --git a/lasp/lasp_common.py b/lasp/lasp_common.py index 38bbb0d..2125b73 100644 --- a/lasp/lasp_common.py +++ b/lasp/lasp_common.py @@ -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