Bugfixes: smoothing, measurement file attribute channelNames is now definite. Improved error messages
This commit is contained in:
parent
b3ce37591f
commit
2d05019f61
@ -192,6 +192,8 @@ class AvStreamProcess(mp.Process):
|
|||||||
output to the devices.
|
output to the devices.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
super().__init__()
|
||||||
|
|
||||||
self.pipe = pipe
|
self.pipe = pipe
|
||||||
self.msg_qlist = msg_qlist
|
self.msg_qlist = msg_qlist
|
||||||
self.indata_qlist = indata_qlist
|
self.indata_qlist = indata_qlist
|
||||||
@ -203,7 +205,9 @@ class AvStreamProcess(mp.Process):
|
|||||||
# In, out, duplex
|
# In, out, duplex
|
||||||
self.streams = {t: None for t in list(AvType)}
|
self.streams = {t: None for t in list(AvType)}
|
||||||
|
|
||||||
super().__init__()
|
# When this is set, a kill on the main process will also kill the
|
||||||
|
# siggen process. Highly wanted feature
|
||||||
|
self.daemon = True
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
"""
|
"""
|
||||||
|
@ -79,7 +79,7 @@ class SIQtys:
|
|||||||
unit_name='No unit / full scale',
|
unit_name='No unit / full scale',
|
||||||
unit_symb='-',
|
unit_symb='-',
|
||||||
level_unit=('dBFS',),
|
level_unit=('dBFS',),
|
||||||
level_ref_name=('Full scale sine wave',),
|
level_ref_name=('Relative to full scale sine wave',),
|
||||||
level_ref_value=(dBFS_REF,)
|
level_ref_value=(dBFS_REF,)
|
||||||
)
|
)
|
||||||
AP = Qty(name='Acoustic Pressure',
|
AP = Qty(name='Acoustic Pressure',
|
||||||
@ -98,7 +98,7 @@ class SIQtys:
|
|||||||
level_ref_value=(1.0,),
|
level_ref_value=(1.0,),
|
||||||
)
|
)
|
||||||
types = (N, AP, V)
|
types = (N, AP, V)
|
||||||
default = AP
|
default = N
|
||||||
default_index = 0
|
default_index = 0
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
@ -211,12 +211,14 @@ class Measurement:
|
|||||||
# Due to a previous bug, the channel names were not stored
|
# Due to a previous bug, the channel names were not stored
|
||||||
# consistently, i.e. as 'channel_names' and later camelcase.
|
# consistently, i.e. as 'channel_names' and later camelcase.
|
||||||
try:
|
try:
|
||||||
self._channelNames = f.attrs['channel_names']
|
self._channelNames = f.attrs['channelNames']
|
||||||
except KeyError:
|
except KeyError:
|
||||||
try:
|
try:
|
||||||
self._channelNames = f.attrs['channelNames']
|
self._channelNames = f.attrs['channel_names']
|
||||||
|
logging.info("Measurement file obtained which stores channel names with *old* attribute 'channel_names'")
|
||||||
except KeyError:
|
except KeyError:
|
||||||
# No channel names found in measurement file
|
# No channel names found in measurement file
|
||||||
|
logging.info('No channel name data found in measurement')
|
||||||
self._channelNames = [f'Unnamed {i}' for i in range(self.nchannels)]
|
self._channelNames = [f'Unnamed {i}' for i in range(self.nchannels)]
|
||||||
|
|
||||||
# comment = read-write thing
|
# comment = read-write thing
|
||||||
|
@ -194,7 +194,7 @@ class Recording:
|
|||||||
f.attrs['nchannels'] = nchannels
|
f.attrs['nchannels'] = nchannels
|
||||||
f.attrs['blocksize'] = blocksize
|
f.attrs['blocksize'] = blocksize
|
||||||
f.attrs['sensitivity'] = [ch.sensitivity for ch in md.in_ch]
|
f.attrs['sensitivity'] = [ch.sensitivity for ch in md.in_ch]
|
||||||
f.attrs['channel_names'] = [ch.channel_name for ch in md.in_ch]
|
f.attrs['channelNames'] = [ch.channel_name for ch in md.in_ch]
|
||||||
f.attrs['time'] = time.time()
|
f.attrs['time'] = time.time()
|
||||||
self.blocksize = blocksize
|
self.blocksize = blocksize
|
||||||
self.fs = md.fs
|
self.fs = md.fs
|
||||||
|
@ -111,6 +111,11 @@ class SiggenProcess(mp.Process):
|
|||||||
dataq: The queue to put generated signal on
|
dataq: The queue to put generated signal on
|
||||||
pipe: Control and status messaging pipe
|
pipe: Control and status messaging pipe
|
||||||
"""
|
"""
|
||||||
|
super().__init__()
|
||||||
|
|
||||||
|
# When this is set, a kill on the main process will also kill the
|
||||||
|
# siggen process. Highly wanted feature
|
||||||
|
self.daemon = True
|
||||||
|
|
||||||
self.dataq = dataq
|
self.dataq = dataq
|
||||||
self.siggendata = siggendata
|
self.siggendata = siggendata
|
||||||
@ -123,7 +128,6 @@ class SiggenProcess(mp.Process):
|
|||||||
self.nblocks_buffer = max(
|
self.nblocks_buffer = max(
|
||||||
1, int(QUEUE_BUFFER_TIME * fs/ nframes_per_block)
|
1, int(QUEUE_BUFFER_TIME * fs/ nframes_per_block)
|
||||||
)
|
)
|
||||||
super().__init__()
|
|
||||||
|
|
||||||
def newSiggen(self, siggendata: SiggenData):
|
def newSiggen(self, siggendata: SiggenData):
|
||||||
"""
|
"""
|
||||||
|
@ -154,8 +154,6 @@ def smoothSpectralData(freq, M, sw: SmoothingWidth,
|
|||||||
|
|
||||||
if st == SmoothingType.levels:
|
if st == SmoothingType.levels:
|
||||||
Psm = 10*np.log10(Psm)
|
Psm = 10*np.log10(Psm)
|
||||||
elif st == SmoothingType.tf:
|
|
||||||
Psm = np.sqrt(Psm)
|
|
||||||
|
|
||||||
return Psm
|
return Psm
|
||||||
|
|
||||||
|
16
setup.py
16
setup.py
@ -1,24 +1,10 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3.8
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
"""
|
"""
|
||||||
@author: J.A. de Jong - ASCEE
|
@author: J.A. de Jong - ASCEE
|
||||||
"""
|
"""
|
||||||
from setuptools import setup, find_packages
|
from setuptools import setup, find_packages
|
||||||
|
|
||||||
|
|
||||||
# class CMakeExtension(Extension):
|
|
||||||
# """
|
|
||||||
# An extension to run the cmake build
|
|
||||||
#
|
|
||||||
# This simply overrides the base extension class so that setuptools
|
|
||||||
# doesn't try to build your sources for you
|
|
||||||
# """
|
|
||||||
#
|
|
||||||
# def __init__(self, name, sources=[]):
|
|
||||||
#
|
|
||||||
# super().__init__(name=name, sources=sources)
|
|
||||||
|
|
||||||
|
|
||||||
setup(
|
setup(
|
||||||
name="LASP",
|
name="LASP",
|
||||||
version="1.0",
|
version="1.0",
|
||||||
|
Loading…
Reference in New Issue
Block a user