LASP 1.0
Library for Acoustic Signal Processing
Loading...
Searching...
No Matches
lasp_measurementset.py
Go to the documentation of this file.
1"""
2Provides class MeasurementSet, a class used to perform checks and adjustments
3on a group of measurements at the same time.
4
5"""
6__all__ = ['MeasurementSet']
7from .lasp_measurement import Measurement
8from typing import List
9
10
11class MeasurementSet(list):
12 """
13 Group of measurements that have some correspondence to one another. Class
14 is used to operate on multiple measurements at once.
15
16 """
17 def __init__(self, mlist: List[Measurement] =[]):
18 """
19 Initialize a measurement set
20
21 Args:
22 mlist: Measurement list
23
24 """
25 if any([not isinstance(i, Measurement) for i in mlist]):
26 raise TypeError('Object in list should be of Measurement type')
27
28 super().__init__(mlist)
29
30 def measTimeSame(self):
31 """
32 Returns True if all measurements have the same measurement
33 time (recorded time)
34
35 """
36 if len(self) > 0:
37 first = self[0].N
38 return all([first == meas.N for meas in self])
39 else:
40 return False
41
42 def measSimilar(self):
43 """
44 Similar means: channel metadata is the same, and the measurement time
45 is the same. It means that the recorded data is, of course, different.
46
47 Returns:
48 True if measChannelsSame() and measTimeSame() else False
49
50 """
51 return self.measTimeSame() and self.measChannelsSame()
52
53
55 """
56 This method is used to check whether a set of measurements can be
57 accessed in a loop, i.e. for computing power spectra or sound levels on
58 a set of measurements, simultaneously. If the channel data is the same
59 (name, sensitivity, ...) it returns True.
60 """
61 if len(self) > 0:
62 first = self[0].channelConfig
63 return all([first == meas.channelConfig for meas in self])
64 else:
65 return False
66
Group of measurements that have some correspondence to one another.
measTimeSame(self)
Returns True if all measurements have the same measurement time (recorded time)
__init__(self, List[Measurement] mlist=[])
Initialize a measurement set.
measSimilar(self)
Similar means: channel metadata is the same, and the measurement time is the same.
measChannelsSame(self)
This method is used to check whether a set of measurements can be accessed in a loop,...