Bugfixes: smoothing, measurement file attribute channelNames is now definite. Improved error messages

This commit is contained in:
Anne de Jong 2021-05-23 15:13:11 +02:00
parent b3ce37591f
commit 2d05019f61
7 changed files with 18 additions and 24 deletions

View File

@ -192,6 +192,8 @@ class AvStreamProcess(mp.Process):
output to the devices.
"""
super().__init__()
self.pipe = pipe
self.msg_qlist = msg_qlist
self.indata_qlist = indata_qlist
@ -203,7 +205,9 @@ class AvStreamProcess(mp.Process):
# In, out, duplex
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):
"""

View File

@ -79,7 +79,7 @@ class SIQtys:
unit_name='No unit / full scale',
unit_symb='-',
level_unit=('dBFS',),
level_ref_name=('Full scale sine wave',),
level_ref_name=('Relative to full scale sine wave',),
level_ref_value=(dBFS_REF,)
)
AP = Qty(name='Acoustic Pressure',
@ -98,7 +98,7 @@ class SIQtys:
level_ref_value=(1.0,),
)
types = (N, AP, V)
default = AP
default = N
default_index = 0
@staticmethod

View File

@ -211,12 +211,14 @@ class Measurement:
# Due to a previous bug, the channel names were not stored
# consistently, i.e. as 'channel_names' and later camelcase.
try:
self._channelNames = f.attrs['channel_names']
self._channelNames = f.attrs['channelNames']
except KeyError:
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:
# 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)]
# comment = read-write thing

View File

@ -194,7 +194,7 @@ class Recording:
f.attrs['nchannels'] = nchannels
f.attrs['blocksize'] = blocksize
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()
self.blocksize = blocksize
self.fs = md.fs

View File

@ -111,6 +111,11 @@ class SiggenProcess(mp.Process):
dataq: The queue to put generated signal on
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.siggendata = siggendata
@ -123,7 +128,6 @@ class SiggenProcess(mp.Process):
self.nblocks_buffer = max(
1, int(QUEUE_BUFFER_TIME * fs/ nframes_per_block)
)
super().__init__()
def newSiggen(self, siggendata: SiggenData):
"""

View File

@ -154,8 +154,6 @@ def smoothSpectralData(freq, M, sw: SmoothingWidth,
if st == SmoothingType.levels:
Psm = 10*np.log10(Psm)
elif st == SmoothingType.tf:
Psm = np.sqrt(Psm)
return Psm

View File

@ -1,24 +1,10 @@
#!/usr/bin/env python3
#!/usr/bin/env python3.8
# -*- coding: utf-8 -*-
"""
@author: J.A. de Jong - ASCEE
"""
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(
name="LASP",
version="1.0",