Bugfix of channel names in measurement. Set default frequency weighting to Z, in stead of A, on advice of Casper
This commit is contained in:
parent
377291ccf4
commit
b3ce37591f
@ -336,11 +336,11 @@ class FreqWeighting:
|
||||
"""
|
||||
Frequency weighting types
|
||||
"""
|
||||
Z = ('Z', 'Z-weighting')
|
||||
A = ('A', 'A-weighting')
|
||||
C = ('C', 'C-weighting')
|
||||
Z = ('Z', 'Z-weighting')
|
||||
types = (A, C, Z)
|
||||
default = A
|
||||
default = Z
|
||||
default_index = 0
|
||||
|
||||
@staticmethod
|
||||
|
@ -208,11 +208,16 @@ class Measurement:
|
||||
self.N = (self.nblocks * self.blocksize)
|
||||
self.T = self.N / self.samplerate
|
||||
|
||||
# Due to a previous bug, the channel names were not stored
|
||||
# consistently, i.e. as 'channel_names' and later camelcase.
|
||||
try:
|
||||
self._channel_names = f.attrs['channel_names']
|
||||
self._channelNames = f.attrs['channel_names']
|
||||
except KeyError:
|
||||
try:
|
||||
self._channelNames = f.attrs['channelNames']
|
||||
except KeyError:
|
||||
# No channel names found in measurement file
|
||||
self._channel_names = [f'Unnamed {i}' for i in range(self.nchannels)]
|
||||
self._channelNames = [f'Unnamed {i}' for i in range(self.nchannels)]
|
||||
|
||||
# comment = read-write thing
|
||||
try:
|
||||
@ -232,7 +237,6 @@ class Measurement:
|
||||
|
||||
self._time = f.attrs['time']
|
||||
|
||||
|
||||
try:
|
||||
qtys_json = f.attrs['qtys']
|
||||
# Load quantity data
|
||||
@ -244,6 +248,10 @@ class Measurement:
|
||||
self._qtys = [SIQtys.default for i in range(self.nchannels)]
|
||||
|
||||
def setAttribute(self, atrname, value):
|
||||
"""
|
||||
Set an attribute in the measurement file, and keep a local copy in
|
||||
memory for efficient accessing.
|
||||
"""
|
||||
with self.file('r+') as f:
|
||||
# Update comment attribute in the file
|
||||
f.attrs[atrname] = value
|
||||
@ -256,7 +264,7 @@ class Measurement:
|
||||
|
||||
@property
|
||||
def channelNames(self):
|
||||
return self._channel_names
|
||||
return self._channelNames
|
||||
|
||||
@channelNames.setter
|
||||
def channelNames(self, newchnames):
|
||||
|
8
setup.py
8
setup.py
@ -27,16 +27,16 @@ setup(
|
||||
long_description_content_type="text/markdown",
|
||||
# ext_modules=[CMakeExtension('lasp/wrappers.so'),
|
||||
# ],
|
||||
package_data={'lasp': ['wrappers.so']},
|
||||
#package_data={'lasp': ['wrappers.so']},
|
||||
author='J.A. de Jong - ASCEE',
|
||||
author_email="j.a.dejong@ascee.nl",
|
||||
install_requires=['matplotlib>=1.0',
|
||||
'scipy>=1.0', 'numpy>=1.0', 'h5py',
|
||||
'dataclasses_json',
|
||||
'scipy>=1.0', 'numpy>=1.0', 'h5py==3.2.0',
|
||||
'dataclasses_json', 'cython',
|
||||
],
|
||||
license='MIT',
|
||||
description="Library for Acoustic Signal Processing",
|
||||
keywords="",
|
||||
url="https://www.ascee.nl/lasp/", # project home page, if any
|
||||
url="https://www.ascee.nl/lasp/", # project home page
|
||||
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user