acoular 24.7__tar.gz → 25.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {acoular-24.7 → acoular-25.1}/.gitignore +1 -0
- {acoular-24.7 → acoular-25.1}/PKG-INFO +63 -21
- {acoular-24.7 → acoular-25.1}/README.md +22 -13
- {acoular-24.7 → acoular-25.1}/acoular/__init__.py +21 -9
- acoular-25.1/acoular/aiaa/__init__.py +12 -0
- {acoular-24.7/acoular/tools → acoular-25.1/acoular/aiaa}/aiaa.py +26 -31
- acoular-25.1/acoular/base.py +332 -0
- acoular-25.1/acoular/calib.py +173 -0
- {acoular-24.7 → acoular-25.1}/acoular/configuration.py +13 -11
- {acoular-24.7 → acoular-25.1}/acoular/demo/__init__.py +1 -0
- {acoular-24.7 → acoular-25.1}/acoular/demo/acoular_demo.py +30 -17
- acoular-25.1/acoular/deprecation.py +85 -0
- {acoular-24.7 → acoular-25.1}/acoular/environments.py +38 -24
- {acoular-24.7 → acoular-25.1}/acoular/fastFuncs.py +90 -84
- {acoular-24.7 → acoular-25.1}/acoular/fbeamform.py +342 -387
- acoular-25.1/acoular/fprocess.py +376 -0
- {acoular-24.7 → acoular-25.1}/acoular/grids.py +122 -150
- {acoular-24.7 → acoular-25.1}/acoular/h5cache.py +29 -40
- {acoular-24.7 → acoular-25.1}/acoular/h5files.py +2 -6
- acoular-25.1/acoular/microphones.py +130 -0
- acoular-25.1/acoular/process.py +771 -0
- {acoular-24.7 → acoular-25.1}/acoular/sdinput.py +35 -21
- {acoular-24.7 → acoular-25.1}/acoular/signals.py +120 -113
- {acoular-24.7 → acoular-25.1}/acoular/sources.py +208 -234
- {acoular-24.7 → acoular-25.1}/acoular/spectra.py +59 -254
- {acoular-24.7 → acoular-25.1}/acoular/tbeamform.py +280 -280
- {acoular-24.7 → acoular-25.1}/acoular/tfastfuncs.py +21 -21
- {acoular-24.7 → acoular-25.1}/acoular/tools/__init__.py +3 -7
- acoular-25.1/acoular/tools/helpers.py +403 -0
- {acoular-24.7 → acoular-25.1}/acoular/tools/metrics.py +5 -5
- acoular-25.1/acoular/tools/utils.py +116 -0
- {acoular-24.7 → acoular-25.1}/acoular/tprocess.py +416 -741
- {acoular-24.7 → acoular-25.1}/acoular/traitsviews.py +15 -13
- {acoular-24.7 → acoular-25.1}/acoular/trajectory.py +7 -10
- {acoular-24.7 → acoular-25.1}/acoular/version.py +2 -2
- {acoular-24.7 → acoular-25.1}/pyproject.toml +75 -34
- acoular-24.7/acoular/calib.py +0 -78
- acoular-24.7/acoular/microphones.py +0 -139
- acoular-24.7/acoular/tools/helpers.py +0 -189
- {acoular-24.7 → acoular-25.1}/AUTHORS.rst +0 -0
- {acoular-24.7 → acoular-25.1}/LICENSE +0 -0
- {acoular-24.7 → acoular-25.1}/acoular/internal.py +0 -0
- {acoular-24.7 → acoular-25.1}/acoular/xml/HW90D240_f10.xml +0 -0
- {acoular-24.7 → acoular-25.1}/acoular/xml/W90_D105_f10.xml +0 -0
- {acoular-24.7 → acoular-25.1}/acoular/xml/acousticam_2c.xml +0 -0
- {acoular-24.7 → acoular-25.1}/acoular/xml/acousticam_4c.xml +0 -0
- {acoular-24.7 → acoular-25.1}/acoular/xml/array38.xml +0 -0
- {acoular-24.7 → acoular-25.1}/acoular/xml/array92x.xml +0 -0
- {acoular-24.7 → acoular-25.1}/acoular/xml/array_56.xml +0 -0
- {acoular-24.7 → acoular-25.1}/acoular/xml/array_56_10_9.xml +0 -0
- {acoular-24.7 → acoular-25.1}/acoular/xml/array_56_bomb.xml +0 -0
- {acoular-24.7 → acoular-25.1}/acoular/xml/array_56_v2.xml +0 -0
- {acoular-24.7 → acoular-25.1}/acoular/xml/array_64.xml +0 -0
- {acoular-24.7 → acoular-25.1}/acoular/xml/array_84_10_9.xml +0 -0
- {acoular-24.7 → acoular-25.1}/acoular/xml/array_84_bomb_v3.xml +0 -0
- {acoular-24.7 → acoular-25.1}/acoular/xml/calib_vw_ring32.xml +0 -0
- {acoular-24.7 → acoular-25.1}/acoular/xml/gfai_ring32.xml +0 -0
- {acoular-24.7 → acoular-25.1}/acoular/xml/minidsp_uma-16.xml +0 -0
- {acoular-24.7 → acoular-25.1}/acoular/xml/minidsp_uma-16_mirrored.xml +0 -0
- {acoular-24.7 → acoular-25.1}/acoular/xml/tub_vogel64.xml +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: acoular
|
|
3
|
-
Version:
|
|
3
|
+
Version: 25.1
|
|
4
4
|
Summary: Python library for acoustic beamforming
|
|
5
5
|
Project-URL: homepage, https://acoular.org
|
|
6
6
|
Project-URL: documentation, https://acoular.org
|
|
@@ -42,21 +42,21 @@ Classifier: Development Status :: 5 - Production/Stable
|
|
|
42
42
|
Classifier: Intended Audience :: Education
|
|
43
43
|
Classifier: Intended Audience :: Science/Research
|
|
44
44
|
Classifier: License :: OSI Approved :: BSD License
|
|
45
|
-
Classifier: Programming Language :: Python :: 3.8
|
|
46
|
-
Classifier: Programming Language :: Python :: 3.9
|
|
47
45
|
Classifier: Programming Language :: Python :: 3.10
|
|
48
46
|
Classifier: Programming Language :: Python :: 3.11
|
|
49
47
|
Classifier: Programming Language :: Python :: 3.12
|
|
48
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
50
49
|
Classifier: Topic :: Scientific/Engineering :: Physics
|
|
51
|
-
Requires-Python:
|
|
50
|
+
Requires-Python: <3.14,>=3.10
|
|
52
51
|
Requires-Dist: numba
|
|
53
|
-
Requires-Dist: numpy
|
|
52
|
+
Requires-Dist: numpy
|
|
54
53
|
Requires-Dist: scikit-learn
|
|
55
54
|
Requires-Dist: scipy>=1.1.0
|
|
56
|
-
Requires-Dist: tables
|
|
55
|
+
Requires-Dist: tables
|
|
57
56
|
Requires-Dist: traits>=6.0
|
|
58
57
|
Provides-Extra: dev
|
|
59
58
|
Requires-Dist: graphviz; extra == 'dev'
|
|
59
|
+
Requires-Dist: h5py; extra == 'dev'
|
|
60
60
|
Requires-Dist: hatch; extra == 'dev'
|
|
61
61
|
Requires-Dist: ipython; extra == 'dev'
|
|
62
62
|
Requires-Dist: matplotlib; extra == 'dev'
|
|
@@ -64,15 +64,48 @@ Requires-Dist: numpydoc; extra == 'dev'
|
|
|
64
64
|
Requires-Dist: pickleshare; extra == 'dev'
|
|
65
65
|
Requires-Dist: pylops; extra == 'dev'
|
|
66
66
|
Requires-Dist: pytest; extra == 'dev'
|
|
67
|
-
Requires-Dist:
|
|
67
|
+
Requires-Dist: pytest-cases; extra == 'dev'
|
|
68
|
+
Requires-Dist: pytest-cov; extra == 'dev'
|
|
69
|
+
Requires-Dist: pytest-env; extra == 'dev'
|
|
70
|
+
Requires-Dist: pytest-mock; extra == 'dev'
|
|
71
|
+
Requires-Dist: pytest-profiling; extra == 'dev'
|
|
72
|
+
Requires-Dist: pytest-regtest; extra == 'dev'
|
|
73
|
+
Requires-Dist: pyyaml; extra == 'dev'
|
|
74
|
+
Requires-Dist: ruff==0.8.1; extra == 'dev'
|
|
75
|
+
Requires-Dist: setuptools; extra == 'dev'
|
|
68
76
|
Requires-Dist: sounddevice; extra == 'dev'
|
|
69
77
|
Requires-Dist: sphinx; extra == 'dev'
|
|
70
78
|
Requires-Dist: sphinx-gallery; extra == 'dev'
|
|
79
|
+
Requires-Dist: sphinxcontrib-bibtex; extra == 'dev'
|
|
71
80
|
Requires-Dist: traitsui; extra == 'dev'
|
|
81
|
+
Provides-Extra: docs
|
|
82
|
+
Requires-Dist: graphviz; extra == 'docs'
|
|
83
|
+
Requires-Dist: ipython; extra == 'docs'
|
|
84
|
+
Requires-Dist: matplotlib; extra == 'docs'
|
|
85
|
+
Requires-Dist: numpydoc; extra == 'docs'
|
|
86
|
+
Requires-Dist: pickleshare; extra == 'docs'
|
|
87
|
+
Requires-Dist: setuptools; extra == 'docs'
|
|
88
|
+
Requires-Dist: sounddevice; extra == 'docs'
|
|
89
|
+
Requires-Dist: sphinx; extra == 'docs'
|
|
90
|
+
Requires-Dist: sphinx-gallery; extra == 'docs'
|
|
91
|
+
Requires-Dist: sphinxcontrib-bibtex; extra == 'docs'
|
|
72
92
|
Provides-Extra: full
|
|
73
93
|
Requires-Dist: matplotlib; extra == 'full'
|
|
74
94
|
Requires-Dist: pylops; extra == 'full'
|
|
75
95
|
Requires-Dist: sounddevice; extra == 'full'
|
|
96
|
+
Provides-Extra: tests
|
|
97
|
+
Requires-Dist: h5py; extra == 'tests'
|
|
98
|
+
Requires-Dist: pylops; extra == 'tests'
|
|
99
|
+
Requires-Dist: pytest; extra == 'tests'
|
|
100
|
+
Requires-Dist: pytest-cases; extra == 'tests'
|
|
101
|
+
Requires-Dist: pytest-cov; extra == 'tests'
|
|
102
|
+
Requires-Dist: pytest-env; extra == 'tests'
|
|
103
|
+
Requires-Dist: pytest-mock; extra == 'tests'
|
|
104
|
+
Requires-Dist: pytest-profiling; extra == 'tests'
|
|
105
|
+
Requires-Dist: pytest-regtest; extra == 'tests'
|
|
106
|
+
Requires-Dist: pyyaml; extra == 'tests'
|
|
107
|
+
Requires-Dist: sounddevice; extra == 'tests'
|
|
108
|
+
Requires-Dist: traitsui; extra == 'tests'
|
|
76
109
|
Description-Content-Type: text/markdown
|
|
77
110
|
|
|
78
111
|

|
|
@@ -164,35 +197,44 @@ If you are interested in contributing, have a look at the [CONTRIBUTING.md](CONT
|
|
|
164
197
|
This reads data from 64 microphone channels and computes a beamforming map for the 8kHz third octave band:
|
|
165
198
|
|
|
166
199
|
```python
|
|
167
|
-
from os import
|
|
168
|
-
import acoular
|
|
169
|
-
|
|
200
|
+
from os.path import join, split
|
|
201
|
+
import acoular as ac
|
|
202
|
+
import matplotlib.pylab as plt
|
|
170
203
|
|
|
171
204
|
# this file contains the microphone coordinates
|
|
172
|
-
micgeofile =
|
|
205
|
+
micgeofile = join(split(ac.__file__)[0],'xml','array_64.xml')
|
|
173
206
|
# set up object managing the microphone coordinates
|
|
174
|
-
mg =
|
|
207
|
+
mg = ac.MicGeom( file=micgeofile )
|
|
208
|
+
# generate test data, in real life this would come from an array measurement
|
|
209
|
+
p = ac.demo.create_three_sources(mg, h5savefile='three_sources.h5')
|
|
175
210
|
# set up object managing the microphone array data (usually from measurement)
|
|
176
|
-
ts =
|
|
211
|
+
ts = ac.TimeSamples( file='three_sources.h5')
|
|
177
212
|
# set up object managing the cross spectral matrix computation
|
|
178
|
-
ps =
|
|
213
|
+
ps = ac.PowerSpectra( source=ts, block_size=128, window='Hanning' )
|
|
214
|
+
# alternatively, you can use the in-memory Mixer object directly:
|
|
215
|
+
# ps = ac.PowerSpectra( source=p, block_size=128, window='Hanning' )
|
|
179
216
|
# set up object managing the mapping grid
|
|
180
|
-
rg =
|
|
217
|
+
rg = ac.RectGrid( x_min=-0.2, x_max=0.2, y_min=-0.2, y_max=0.2, z=0.3, \
|
|
181
218
|
increment=0.01 )
|
|
182
219
|
# set up steering vector, implicitely contains also the standard quiescent
|
|
183
220
|
# environment with standard speed of sound
|
|
184
|
-
st =
|
|
221
|
+
st = ac.SteeringVector( grid = rg, mics=mg )
|
|
185
222
|
# set up the object managing the delay & sum beamformer
|
|
186
|
-
bb =
|
|
223
|
+
bb = ac.BeamformerBase( freq_data=ps, steer=st )
|
|
187
224
|
# request the result in the 8kHz third octave band from approriate FFT-Lines
|
|
188
225
|
# this starts the actual computation (data intake, FFT, Welch CSM, beamforming)
|
|
189
226
|
pm = bb.synthetic( 8000, 3 )
|
|
190
227
|
# compute the sound pressure level
|
|
191
|
-
Lm =
|
|
228
|
+
Lm = ac.L_p( pm )
|
|
192
229
|
# plot the map
|
|
193
|
-
imshow( Lm.T, origin='lower', vmin=Lm.max()-10, extent=rg.extend(), \
|
|
230
|
+
plt.imshow( Lm.T, origin='lower', vmin=Lm.max()-10, extent=rg.extend(), \
|
|
194
231
|
interpolation='bicubic')
|
|
195
|
-
|
|
232
|
+
plt.title(f'Beamformer (base) for 3 sources measured for 8000 Hz')
|
|
233
|
+
plt.xlabel('x in m')
|
|
234
|
+
plt.ylabel('y in m')
|
|
235
|
+
plt.colorbar(label=r'$L_p$')
|
|
236
|
+
plt.savefig('three_sources.png', dpi=300, bbox_inches='tight')
|
|
237
|
+
plt.show()
|
|
196
238
|
```
|
|
197
239
|
|
|
198
240
|

|
|
@@ -87,35 +87,44 @@ If you are interested in contributing, have a look at the [CONTRIBUTING.md](CONT
|
|
|
87
87
|
This reads data from 64 microphone channels and computes a beamforming map for the 8kHz third octave band:
|
|
88
88
|
|
|
89
89
|
```python
|
|
90
|
-
from os import
|
|
91
|
-
import acoular
|
|
92
|
-
|
|
90
|
+
from os.path import join, split
|
|
91
|
+
import acoular as ac
|
|
92
|
+
import matplotlib.pylab as plt
|
|
93
93
|
|
|
94
94
|
# this file contains the microphone coordinates
|
|
95
|
-
micgeofile =
|
|
95
|
+
micgeofile = join(split(ac.__file__)[0],'xml','array_64.xml')
|
|
96
96
|
# set up object managing the microphone coordinates
|
|
97
|
-
mg =
|
|
97
|
+
mg = ac.MicGeom( file=micgeofile )
|
|
98
|
+
# generate test data, in real life this would come from an array measurement
|
|
99
|
+
p = ac.demo.create_three_sources(mg, h5savefile='three_sources.h5')
|
|
98
100
|
# set up object managing the microphone array data (usually from measurement)
|
|
99
|
-
ts =
|
|
101
|
+
ts = ac.TimeSamples( file='three_sources.h5')
|
|
100
102
|
# set up object managing the cross spectral matrix computation
|
|
101
|
-
ps =
|
|
103
|
+
ps = ac.PowerSpectra( source=ts, block_size=128, window='Hanning' )
|
|
104
|
+
# alternatively, you can use the in-memory Mixer object directly:
|
|
105
|
+
# ps = ac.PowerSpectra( source=p, block_size=128, window='Hanning' )
|
|
102
106
|
# set up object managing the mapping grid
|
|
103
|
-
rg =
|
|
107
|
+
rg = ac.RectGrid( x_min=-0.2, x_max=0.2, y_min=-0.2, y_max=0.2, z=0.3, \
|
|
104
108
|
increment=0.01 )
|
|
105
109
|
# set up steering vector, implicitely contains also the standard quiescent
|
|
106
110
|
# environment with standard speed of sound
|
|
107
|
-
st =
|
|
111
|
+
st = ac.SteeringVector( grid = rg, mics=mg )
|
|
108
112
|
# set up the object managing the delay & sum beamformer
|
|
109
|
-
bb =
|
|
113
|
+
bb = ac.BeamformerBase( freq_data=ps, steer=st )
|
|
110
114
|
# request the result in the 8kHz third octave band from approriate FFT-Lines
|
|
111
115
|
# this starts the actual computation (data intake, FFT, Welch CSM, beamforming)
|
|
112
116
|
pm = bb.synthetic( 8000, 3 )
|
|
113
117
|
# compute the sound pressure level
|
|
114
|
-
Lm =
|
|
118
|
+
Lm = ac.L_p( pm )
|
|
115
119
|
# plot the map
|
|
116
|
-
imshow( Lm.T, origin='lower', vmin=Lm.max()-10, extent=rg.extend(), \
|
|
120
|
+
plt.imshow( Lm.T, origin='lower', vmin=Lm.max()-10, extent=rg.extend(), \
|
|
117
121
|
interpolation='bicubic')
|
|
118
|
-
|
|
122
|
+
plt.title(f'Beamformer (base) for 3 sources measured for 8000 Hz')
|
|
123
|
+
plt.xlabel('x in m')
|
|
124
|
+
plt.ylabel('y in m')
|
|
125
|
+
plt.colorbar(label=r'$L_p$')
|
|
126
|
+
plt.savefig('three_sources.png', dpi=300, bbox_inches='tight')
|
|
127
|
+
plt.show()
|
|
119
128
|
```
|
|
120
129
|
|
|
121
130
|

|
|
@@ -4,11 +4,22 @@
|
|
|
4
4
|
|
|
5
5
|
"""The Acoular library: several classes for the implementation of acoustic beamforming."""
|
|
6
6
|
|
|
7
|
-
import os
|
|
7
|
+
import os # noqa: I001
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
from .calib import Calib
|
|
9
|
+
# config must be imported before any submodules containing numpy, see #322.
|
|
11
10
|
from .configuration import config
|
|
11
|
+
|
|
12
|
+
from . import demo, tools, aiaa
|
|
13
|
+
from .base import (
|
|
14
|
+
Generator,
|
|
15
|
+
InOut,
|
|
16
|
+
SamplesGenerator,
|
|
17
|
+
SpectraGenerator,
|
|
18
|
+
SpectraOut,
|
|
19
|
+
TimeInOut,
|
|
20
|
+
TimeOut,
|
|
21
|
+
)
|
|
22
|
+
from .calib import Calib
|
|
12
23
|
from .environments import (
|
|
13
24
|
Environment,
|
|
14
25
|
FlowField,
|
|
@@ -41,6 +52,7 @@ from .fbeamform import (
|
|
|
41
52
|
SteeringVector,
|
|
42
53
|
integrate,
|
|
43
54
|
)
|
|
55
|
+
from .fprocess import IRFFT, RFFT, AutoPowerSpectra, CrossPowerSpectra, FFTSpectra
|
|
44
56
|
from .grids import (
|
|
45
57
|
CircSector,
|
|
46
58
|
ConvexSector,
|
|
@@ -57,10 +69,13 @@ from .grids import (
|
|
|
57
69
|
Sector,
|
|
58
70
|
)
|
|
59
71
|
from .microphones import MicGeom
|
|
72
|
+
from .process import Average, Cache, SampleSplitter, TimeAverage, TimeCache
|
|
60
73
|
from .sdinput import SoundDeviceSamplesGenerator
|
|
61
74
|
from .signals import (
|
|
62
75
|
FiltWNoiseGenerator,
|
|
63
76
|
GenericSignalGenerator,
|
|
77
|
+
NoiseGenerator,
|
|
78
|
+
PeriodicSignalGenerator,
|
|
64
79
|
PNoiseGenerator,
|
|
65
80
|
SignalGenerator,
|
|
66
81
|
SineGenerator,
|
|
@@ -80,7 +95,8 @@ from .sources import (
|
|
|
80
95
|
TimeSamples,
|
|
81
96
|
UncorrelatedNoiseSource,
|
|
82
97
|
)
|
|
83
|
-
from .
|
|
98
|
+
from .tools.helpers import synthetic
|
|
99
|
+
from .spectra import BaseSpectra, PowerSpectra, PowerSpectraImport
|
|
84
100
|
from .spectra import PowerSpectra as EigSpectra
|
|
85
101
|
from .tbeamform import (
|
|
86
102
|
BeamformerCleant,
|
|
@@ -102,19 +118,15 @@ from .tprocess import (
|
|
|
102
118
|
FiltFreqWeight,
|
|
103
119
|
FiltOctave,
|
|
104
120
|
MaskedTimeInOut,
|
|
121
|
+
MaskedTimeOut,
|
|
105
122
|
Mixer,
|
|
106
123
|
OctaveFilterBank,
|
|
107
|
-
SamplesGenerator,
|
|
108
|
-
SampleSplitter,
|
|
109
124
|
SpatialInterpolator,
|
|
110
125
|
SpatialInterpolatorConstantRotation,
|
|
111
126
|
SpatialInterpolatorRotation,
|
|
112
|
-
TimeAverage,
|
|
113
|
-
TimeCache,
|
|
114
127
|
TimeConvolve,
|
|
115
128
|
TimeCumAverage,
|
|
116
129
|
TimeExpAverage,
|
|
117
|
-
TimeInOut,
|
|
118
130
|
TimePower,
|
|
119
131
|
TimeReverse,
|
|
120
132
|
Trigger,
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# ------------------------------------------------------------------------------
|
|
2
|
+
# Copyright (c) Acoular Development Team.
|
|
3
|
+
# ------------------------------------------------------------------------------
|
|
4
|
+
"""Provides classes for importing AIAA Array Benchmarks.
|
|
5
|
+
|
|
6
|
+
.. autosummary::
|
|
7
|
+
:toctree: generated/
|
|
8
|
+
|
|
9
|
+
aiaa
|
|
10
|
+
"""
|
|
11
|
+
|
|
12
|
+
from .aiaa import CsmAIAABenchmark, MicAIAABenchmark, TimeSamplesAIAABenchmark, TriggerAIAABenchmark
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# ------------------------------------------------------------------------------
|
|
2
2
|
# Copyright (c) Acoular Development Team.
|
|
3
3
|
# ------------------------------------------------------------------------------
|
|
4
|
-
"""Classes for importing AIAA Array Benchmarks
|
|
5
|
-
|
|
4
|
+
"""Classes for importing AIAA Array Benchmarks.
|
|
5
|
+
|
|
6
6
|
These classes allow importing data from HDF5 files following the specifications of
|
|
7
7
|
the AIAA microphone array methods benchmarking effort:
|
|
8
8
|
https://www-docs.b-tu.de/fg-akustik/public/veroeffentlichungen/ArrayMethodsFileFormatsR2P4Release.pdf .
|
|
@@ -12,8 +12,8 @@ the framework.
|
|
|
12
12
|
|
|
13
13
|
Examples
|
|
14
14
|
--------
|
|
15
|
-
>>> micgeom = MicAIAABenchmark(
|
|
16
|
-
>>> timedata = TimeSamplesAIAABenchmark(
|
|
15
|
+
>>> micgeom = MicAIAABenchmark(file='some_benchmarkdata.h5') # doctest: +SKIP
|
|
16
|
+
>>> timedata = TimeSamplesAIAABenchmark(file='some_benchmarkdata.h5') # doctest: +SKIP
|
|
17
17
|
|
|
18
18
|
|
|
19
19
|
.. autosummary::
|
|
@@ -23,10 +23,9 @@ Examples
|
|
|
23
23
|
TriggerAIAABenchmark
|
|
24
24
|
CsmAIAABenchmark
|
|
25
25
|
MicAIAABenchmark
|
|
26
|
-
"""
|
|
26
|
+
""" # noqa: W505
|
|
27
27
|
|
|
28
28
|
import contextlib
|
|
29
|
-
from os import path
|
|
30
29
|
|
|
31
30
|
from numpy import array
|
|
32
31
|
from traits.api import (
|
|
@@ -38,11 +37,13 @@ from traits.api import (
|
|
|
38
37
|
property_depends_on,
|
|
39
38
|
)
|
|
40
39
|
|
|
40
|
+
from acoular.deprecation import deprecated_alias
|
|
41
41
|
from acoular.h5files import H5FileBase, _get_h5file_class
|
|
42
42
|
from acoular.internal import digest
|
|
43
43
|
from acoular.microphones import MicGeom
|
|
44
44
|
from acoular.sources import TimeSamples
|
|
45
45
|
from acoular.spectra import PowerSpectraImport
|
|
46
|
+
from acoular.tools.utils import get_file_basename
|
|
46
47
|
|
|
47
48
|
|
|
48
49
|
class TimeSamplesAIAABenchmark(TimeSamples):
|
|
@@ -54,13 +55,13 @@ class TimeSamplesAIAABenchmark(TimeSamples):
|
|
|
54
55
|
objects.
|
|
55
56
|
"""
|
|
56
57
|
|
|
57
|
-
def
|
|
58
|
+
def _load_timedata(self):
|
|
58
59
|
"""Loads timedata from .h5 file. Only for internal use."""
|
|
59
60
|
self.data = self.h5f.get_data_by_reference('MicrophoneData/microphoneDataPa')
|
|
60
61
|
self.sample_freq = self.h5f.get_node_attribute(self.data, 'sampleRateHz')
|
|
61
|
-
(self.
|
|
62
|
+
(self.num_samples, self.num_channels) = self.data.shape
|
|
62
63
|
|
|
63
|
-
def
|
|
64
|
+
def _load_metadata(self):
|
|
64
65
|
"""Loads metadata from .h5 file. Only for internal use."""
|
|
65
66
|
self.metadata = {}
|
|
66
67
|
if '/MetaData' in self.h5f:
|
|
@@ -76,27 +77,28 @@ class TriggerAIAABenchmark(TimeSamplesAIAABenchmark):
|
|
|
76
77
|
and and provides information about this data.
|
|
77
78
|
"""
|
|
78
79
|
|
|
79
|
-
def
|
|
80
|
+
def _load_timedata(self):
|
|
80
81
|
"""Loads timedata from .h5 file. Only for internal use."""
|
|
81
82
|
self.data = self.h5f.get_data_by_reference('TachoData/tachoDataV')
|
|
82
83
|
self.sample_freq = self.h5f.get_node_attribute(self.data, 'sampleRateHz')
|
|
83
|
-
(self.
|
|
84
|
+
(self.num_samples, self.num_channels) = self.data.shape
|
|
84
85
|
|
|
85
86
|
|
|
87
|
+
@deprecated_alias({'name': 'file'})
|
|
86
88
|
class CsmAIAABenchmark(PowerSpectraImport):
|
|
87
89
|
"""Class to load the CSM that is stored in AIAA Benchmark HDF5 file."""
|
|
88
90
|
|
|
89
91
|
#: Full name of the .h5 file with data
|
|
90
|
-
|
|
92
|
+
file = File(filter=['*.h5'], exists=True, desc='name of data file')
|
|
91
93
|
|
|
92
94
|
#: Basename of the .h5 file with data, is set automatically.
|
|
93
95
|
basename = Property(
|
|
94
|
-
depends_on='
|
|
96
|
+
depends_on=['file'],
|
|
95
97
|
desc='basename of data file',
|
|
96
98
|
)
|
|
97
99
|
|
|
98
100
|
#: number of channels
|
|
99
|
-
|
|
101
|
+
num_channels = Property()
|
|
100
102
|
|
|
101
103
|
#: HDF5 file object
|
|
102
104
|
h5f = Instance(H5FileBase, transient=True)
|
|
@@ -110,19 +112,16 @@ class CsmAIAABenchmark(PowerSpectraImport):
|
|
|
110
112
|
|
|
111
113
|
@cached_property
|
|
112
114
|
def _get_basename(self):
|
|
113
|
-
return
|
|
115
|
+
return get_file_basename(self.file)
|
|
114
116
|
|
|
115
117
|
@on_trait_change('basename')
|
|
116
118
|
def load_data(self):
|
|
117
119
|
"""Open the .h5 file and set attributes."""
|
|
118
|
-
if not path.isfile(self.name):
|
|
119
|
-
# no file there
|
|
120
|
-
raise OSError('No such file: %s' % self.name)
|
|
121
120
|
if self.h5f is not None:
|
|
122
121
|
with contextlib.suppress(OSError):
|
|
123
122
|
self.h5f.close()
|
|
124
123
|
file = _get_h5file_class()
|
|
125
|
-
self.h5f = file(self.
|
|
124
|
+
self.h5f = file(self.file)
|
|
126
125
|
|
|
127
126
|
# @property_depends_on( 'block_size, ind_low, ind_high' )
|
|
128
127
|
def _get_indices(self):
|
|
@@ -131,15 +130,15 @@ class CsmAIAABenchmark(PowerSpectraImport):
|
|
|
131
130
|
except IndexError:
|
|
132
131
|
return range(0)
|
|
133
132
|
|
|
134
|
-
@property_depends_on('digest')
|
|
135
|
-
def
|
|
133
|
+
@property_depends_on(['digest'])
|
|
134
|
+
def _get_num_channels(self):
|
|
136
135
|
try:
|
|
137
136
|
attrs = self.h5f.get_data_by_reference('MetaData/ArrayAttributes')
|
|
138
137
|
return self.h5f.get_node_attribute(attrs, 'microphoneCount')
|
|
139
138
|
except IndexError:
|
|
140
139
|
return 0
|
|
141
140
|
|
|
142
|
-
@property_depends_on('digest')
|
|
141
|
+
@property_depends_on(['digest'])
|
|
143
142
|
def _get_csm(self):
|
|
144
143
|
"""Loads cross spectral matrix from file."""
|
|
145
144
|
csmre = self.h5f.get_data_by_reference('/CsmData/csmReal')[:].transpose((2, 0, 1))
|
|
@@ -167,19 +166,15 @@ class MicAIAABenchmark(MicGeom):
|
|
|
167
166
|
file containing the measurement data.
|
|
168
167
|
"""
|
|
169
168
|
|
|
170
|
-
#: Name of the .h5-file from
|
|
171
|
-
|
|
169
|
+
#: Name of the .h5-file from which to read the data.
|
|
170
|
+
file = File(filter=['*.h5'], exists=True, desc='name of the h5 file containing the microphone geometry')
|
|
172
171
|
|
|
173
|
-
@on_trait_change('
|
|
172
|
+
@on_trait_change('file')
|
|
174
173
|
def import_mpos(self):
|
|
175
174
|
"""Import the microphone positions from .h5 file.
|
|
176
175
|
Called when :attr:`basename` changes.
|
|
177
176
|
"""
|
|
178
|
-
if not path.isfile(self.from_file):
|
|
179
|
-
# no file there
|
|
180
|
-
raise OSError('No such file: %s' % self.from_file)
|
|
181
|
-
|
|
182
177
|
file = _get_h5file_class()
|
|
183
|
-
h5f = file(self.
|
|
184
|
-
self.
|
|
178
|
+
h5f = file(self.file, mode='r')
|
|
179
|
+
self.pos_total = h5f.get_data_by_reference('MetaData/ArrayAttributes/microphonePositionsM')[:].swapaxes(0, 1)
|
|
185
180
|
h5f.close()
|