acoular 24.5__tar.gz → 24.10__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.5 → acoular-24.10}/.gitignore +9 -9
- {acoular-24.5 → acoular-24.10}/PKG-INFO +49 -8
- {acoular-24.5 → acoular-24.10}/README.md +9 -3
- {acoular-24.5 → acoular-24.10}/acoular/__init__.py +17 -11
- acoular-24.10/acoular/base.py +312 -0
- {acoular-24.5 → acoular-24.10}/acoular/configuration.py +23 -16
- {acoular-24.5 → acoular-24.10}/acoular/demo/acoular_demo.py +28 -35
- {acoular-24.5 → acoular-24.10}/acoular/environments.py +20 -15
- {acoular-24.5 → acoular-24.10}/acoular/fastFuncs.py +40 -40
- {acoular-24.5 → acoular-24.10}/acoular/fbeamform.py +1100 -1130
- acoular-24.10/acoular/fprocess.py +368 -0
- {acoular-24.5 → acoular-24.10}/acoular/grids.py +36 -22
- {acoular-24.5 → acoular-24.10}/acoular/h5cache.py +34 -34
- {acoular-24.5 → acoular-24.10}/acoular/h5files.py +13 -13
- {acoular-24.5 → acoular-24.10}/acoular/internal.py +3 -3
- acoular-24.10/acoular/process.py +464 -0
- {acoular-24.5 → acoular-24.10}/acoular/sdinput.py +24 -4
- {acoular-24.5 → acoular-24.10}/acoular/signals.py +20 -6
- {acoular-24.5 → acoular-24.10}/acoular/sources.py +140 -56
- {acoular-24.5 → acoular-24.10}/acoular/spectra.py +34 -53
- {acoular-24.5 → acoular-24.10}/acoular/tbeamform.py +264 -142
- {acoular-24.5 → acoular-24.10}/acoular/tfastfuncs.py +17 -18
- {acoular-24.5 → acoular-24.10}/acoular/tools/__init__.py +2 -0
- {acoular-24.5 → acoular-24.10}/acoular/tools/aiaa.py +7 -8
- {acoular-24.5 → acoular-24.10}/acoular/tools/helpers.py +2 -2
- {acoular-24.5 → acoular-24.10}/acoular/tools/metrics.py +1 -1
- acoular-24.10/acoular/tools/utils.py +210 -0
- {acoular-24.5 → acoular-24.10}/acoular/tprocess.py +168 -532
- {acoular-24.5 → acoular-24.10}/acoular/traitsviews.py +5 -3
- {acoular-24.5 → acoular-24.10}/acoular/version.py +2 -2
- {acoular-24.5 → acoular-24.10}/pyproject.toml +39 -20
- {acoular-24.5 → acoular-24.10}/AUTHORS.rst +0 -0
- {acoular-24.5 → acoular-24.10}/LICENSE +0 -0
- {acoular-24.5 → acoular-24.10}/acoular/calib.py +0 -0
- {acoular-24.5 → acoular-24.10}/acoular/demo/__init__.py +0 -0
- {acoular-24.5 → acoular-24.10}/acoular/microphones.py +0 -0
- {acoular-24.5 → acoular-24.10}/acoular/trajectory.py +0 -0
- {acoular-24.5 → acoular-24.10}/acoular/xml/HW90D240_f10.xml +0 -0
- {acoular-24.5 → acoular-24.10}/acoular/xml/W90_D105_f10.xml +0 -0
- {acoular-24.5 → acoular-24.10}/acoular/xml/acousticam_2c.xml +0 -0
- {acoular-24.5 → acoular-24.10}/acoular/xml/acousticam_4c.xml +0 -0
- {acoular-24.5 → acoular-24.10}/acoular/xml/array38.xml +0 -0
- {acoular-24.5 → acoular-24.10}/acoular/xml/array92x.xml +0 -0
- {acoular-24.5 → acoular-24.10}/acoular/xml/array_56.xml +0 -0
- {acoular-24.5 → acoular-24.10}/acoular/xml/array_56_10_9.xml +0 -0
- {acoular-24.5 → acoular-24.10}/acoular/xml/array_56_bomb.xml +0 -0
- {acoular-24.5 → acoular-24.10}/acoular/xml/array_56_v2.xml +0 -0
- {acoular-24.5 → acoular-24.10}/acoular/xml/array_64.xml +0 -0
- {acoular-24.5 → acoular-24.10}/acoular/xml/array_84_10_9.xml +0 -0
- {acoular-24.5 → acoular-24.10}/acoular/xml/array_84_bomb_v3.xml +0 -0
- {acoular-24.5 → acoular-24.10}/acoular/xml/calib_vw_ring32.xml +0 -0
- {acoular-24.5 → acoular-24.10}/acoular/xml/gfai_ring32.xml +0 -0
- {acoular-24.5 → acoular-24.10}/acoular/xml/minidsp_uma-16.xml +0 -0
- {acoular-24.5 → acoular-24.10}/acoular/xml/minidsp_uma-16_mirrored.xml +0 -0
- {acoular-24.5 → acoular-24.10}/acoular/xml/tub_vogel64.xml +0 -0
|
@@ -1,14 +1,7 @@
|
|
|
1
1
|
# files and file types to ignore
|
|
2
2
|
*.pyc
|
|
3
|
-
*.pyd
|
|
4
3
|
*.so
|
|
5
4
|
*~
|
|
6
|
-
examples/three_sources.h5
|
|
7
|
-
examples/all_bf.sav
|
|
8
|
-
examples/benchmark/results/
|
|
9
|
-
MANIFEST
|
|
10
|
-
|
|
11
|
-
# ignore the build directories
|
|
12
5
|
*.egg-info/
|
|
13
6
|
.eggs/
|
|
14
7
|
build/
|
|
@@ -23,7 +16,14 @@ __pycache__/
|
|
|
23
16
|
*.nbc
|
|
24
17
|
*.nbi
|
|
25
18
|
*.pyd
|
|
26
|
-
docs/source/api_ref/generated/
|
|
27
19
|
.vscode/
|
|
20
|
+
.venv*
|
|
28
21
|
|
|
29
|
-
|
|
22
|
+
MANIFEST
|
|
23
|
+
|
|
24
|
+
examples/all_bf.sav
|
|
25
|
+
examples/benchmark/results/
|
|
26
|
+
**/three_sources.h5
|
|
27
|
+
docs/source/sg_execution_times.rst
|
|
28
|
+
docs/source/api_ref/generated/
|
|
29
|
+
docs/source/auto_examples/**/*
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: acoular
|
|
3
|
-
Version: 24.
|
|
3
|
+
Version: 24.10
|
|
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,23 +42,58 @@ 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
|
|
50
48
|
Classifier: Topic :: Scientific/Engineering :: Physics
|
|
51
|
-
Requires-Python: <=12,>=3.
|
|
49
|
+
Requires-Python: <=12,>=3.10
|
|
52
50
|
Requires-Dist: numba
|
|
53
51
|
Requires-Dist: numpy
|
|
54
52
|
Requires-Dist: scikit-learn
|
|
55
53
|
Requires-Dist: scipy>=1.1.0
|
|
56
|
-
Requires-Dist: tables
|
|
54
|
+
Requires-Dist: tables
|
|
57
55
|
Requires-Dist: traits>=6.0
|
|
56
|
+
Provides-Extra: dev
|
|
57
|
+
Requires-Dist: graphviz; extra == 'dev'
|
|
58
|
+
Requires-Dist: h5py; extra == 'dev'
|
|
59
|
+
Requires-Dist: hatch; extra == 'dev'
|
|
60
|
+
Requires-Dist: ipython; extra == 'dev'
|
|
61
|
+
Requires-Dist: matplotlib; extra == 'dev'
|
|
62
|
+
Requires-Dist: numpydoc; extra == 'dev'
|
|
63
|
+
Requires-Dist: pickleshare; extra == 'dev'
|
|
64
|
+
Requires-Dist: pylops; extra == 'dev'
|
|
65
|
+
Requires-Dist: pytest; extra == 'dev'
|
|
66
|
+
Requires-Dist: pytest-cov; extra == 'dev'
|
|
67
|
+
Requires-Dist: pyyaml; extra == 'dev'
|
|
68
|
+
Requires-Dist: ruff==0.4.1; extra == 'dev'
|
|
69
|
+
Requires-Dist: setuptools; extra == 'dev'
|
|
70
|
+
Requires-Dist: sounddevice; extra == 'dev'
|
|
71
|
+
Requires-Dist: sphinx; extra == 'dev'
|
|
72
|
+
Requires-Dist: sphinx-gallery; extra == 'dev'
|
|
73
|
+
Requires-Dist: sphinxcontrib-bibtex; extra == 'dev'
|
|
74
|
+
Requires-Dist: traitsui; extra == 'dev'
|
|
75
|
+
Provides-Extra: docs
|
|
76
|
+
Requires-Dist: graphviz; extra == 'docs'
|
|
77
|
+
Requires-Dist: ipython; extra == 'docs'
|
|
78
|
+
Requires-Dist: matplotlib; extra == 'docs'
|
|
79
|
+
Requires-Dist: numpydoc; extra == 'docs'
|
|
80
|
+
Requires-Dist: pickleshare; extra == 'docs'
|
|
81
|
+
Requires-Dist: setuptools; extra == 'docs'
|
|
82
|
+
Requires-Dist: sounddevice; extra == 'docs'
|
|
83
|
+
Requires-Dist: sphinx; extra == 'docs'
|
|
84
|
+
Requires-Dist: sphinx-gallery; extra == 'docs'
|
|
85
|
+
Requires-Dist: sphinxcontrib-bibtex; extra == 'docs'
|
|
58
86
|
Provides-Extra: full
|
|
59
87
|
Requires-Dist: matplotlib; extra == 'full'
|
|
60
88
|
Requires-Dist: pylops; extra == 'full'
|
|
61
89
|
Requires-Dist: sounddevice; extra == 'full'
|
|
90
|
+
Provides-Extra: tests
|
|
91
|
+
Requires-Dist: h5py; extra == 'tests'
|
|
92
|
+
Requires-Dist: pytest; extra == 'tests'
|
|
93
|
+
Requires-Dist: pytest-cov; extra == 'tests'
|
|
94
|
+
Requires-Dist: pyyaml; extra == 'tests'
|
|
95
|
+
Requires-Dist: sounddevice; extra == 'tests'
|
|
96
|
+
Requires-Dist: traitsui; extra == 'tests'
|
|
62
97
|
Description-Content-Type: text/markdown
|
|
63
98
|
|
|
64
99
|

|
|
@@ -135,12 +170,17 @@ For more detailed installation instructions, see the [documentation](https://aco
|
|
|
135
170
|
# Documentation and help
|
|
136
171
|
Documentation is available [here](https://acoular.org) with a
|
|
137
172
|
[getting started](https://acoular.org/get_started/index.html) section and
|
|
138
|
-
[examples](https://acoular.org/
|
|
173
|
+
[examples](https://acoular.org/auto_examples/index.html).
|
|
139
174
|
|
|
140
175
|
The Acoular [blog](https://acoular.github.io/blog/) contains some tutorials.
|
|
141
176
|
|
|
142
177
|
If you discover problems with the Acoular software, please report them using the [issue tracker](https://github.com/acoular/acoular/issues) on GitHub. Please use the [Acoular discussions forum](https://github.com/acoular/acoular/discussions) for practical questions, discussions, and demos.
|
|
143
178
|
|
|
179
|
+
# Contributing
|
|
180
|
+
|
|
181
|
+
We are always happy to welcome new contributors to the project.
|
|
182
|
+
If you are interested in contributing, have a look at the [CONTRIBUTING.md](CONTRIBUTING.md) file.
|
|
183
|
+
|
|
144
184
|
# Example
|
|
145
185
|
This reads data from 64 microphone channels and computes a beamforming map for the 8kHz third octave band:
|
|
146
186
|
|
|
@@ -156,7 +196,7 @@ mg = acoular.MicGeom( from_file=micgeofile )
|
|
|
156
196
|
# set up object managing the microphone array data (usually from measurement)
|
|
157
197
|
ts = acoular.TimeSamples( name='three_sources.h5' )
|
|
158
198
|
# set up object managing the cross spectral matrix computation
|
|
159
|
-
ps = acoular.PowerSpectra(
|
|
199
|
+
ps = acoular.PowerSpectra( source=ts, block_size=128, window='Hanning' )
|
|
160
200
|
# set up object managing the mapping grid
|
|
161
201
|
rg = acoular.RectGrid( x_min=-0.2, x_max=0.2, y_min=-0.2, y_max=0.2, z=0.3, \
|
|
162
202
|
increment=0.01 )
|
|
@@ -176,5 +216,6 @@ interpolation='bicubic')
|
|
|
176
216
|
colorbar()
|
|
177
217
|
```
|
|
178
218
|
|
|
179
|
-
|
|
180
219
|

|
|
220
|
+
|
|
221
|
+
|
|
@@ -72,12 +72,17 @@ For more detailed installation instructions, see the [documentation](https://aco
|
|
|
72
72
|
# Documentation and help
|
|
73
73
|
Documentation is available [here](https://acoular.org) with a
|
|
74
74
|
[getting started](https://acoular.org/get_started/index.html) section and
|
|
75
|
-
[examples](https://acoular.org/
|
|
75
|
+
[examples](https://acoular.org/auto_examples/index.html).
|
|
76
76
|
|
|
77
77
|
The Acoular [blog](https://acoular.github.io/blog/) contains some tutorials.
|
|
78
78
|
|
|
79
79
|
If you discover problems with the Acoular software, please report them using the [issue tracker](https://github.com/acoular/acoular/issues) on GitHub. Please use the [Acoular discussions forum](https://github.com/acoular/acoular/discussions) for practical questions, discussions, and demos.
|
|
80
80
|
|
|
81
|
+
# Contributing
|
|
82
|
+
|
|
83
|
+
We are always happy to welcome new contributors to the project.
|
|
84
|
+
If you are interested in contributing, have a look at the [CONTRIBUTING.md](CONTRIBUTING.md) file.
|
|
85
|
+
|
|
81
86
|
# Example
|
|
82
87
|
This reads data from 64 microphone channels and computes a beamforming map for the 8kHz third octave band:
|
|
83
88
|
|
|
@@ -93,7 +98,7 @@ mg = acoular.MicGeom( from_file=micgeofile )
|
|
|
93
98
|
# set up object managing the microphone array data (usually from measurement)
|
|
94
99
|
ts = acoular.TimeSamples( name='three_sources.h5' )
|
|
95
100
|
# set up object managing the cross spectral matrix computation
|
|
96
|
-
ps = acoular.PowerSpectra(
|
|
101
|
+
ps = acoular.PowerSpectra( source=ts, block_size=128, window='Hanning' )
|
|
97
102
|
# set up object managing the mapping grid
|
|
98
103
|
rg = acoular.RectGrid( x_min=-0.2, x_max=0.2, y_min=-0.2, y_max=0.2, z=0.3, \
|
|
99
104
|
increment=0.01 )
|
|
@@ -113,5 +118,6 @@ interpolation='bicubic')
|
|
|
113
118
|
colorbar()
|
|
114
119
|
```
|
|
115
120
|
|
|
116
|
-
|
|
117
121
|

|
|
122
|
+
|
|
123
|
+
|
|
@@ -4,15 +4,21 @@
|
|
|
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
|
+
# config must be imported before any submodules containing numpy, see #322.
|
|
9
10
|
from .configuration import config
|
|
10
|
-
from .version import __author__, __date__, __version__
|
|
11
|
-
|
|
12
|
-
if config.have_sounddevice:
|
|
13
|
-
from .sdinput import SoundDeviceSamplesGenerator
|
|
14
11
|
|
|
15
12
|
from . import demo, tools
|
|
13
|
+
from .base import (
|
|
14
|
+
Generator,
|
|
15
|
+
InOut,
|
|
16
|
+
SamplesGenerator,
|
|
17
|
+
SpectraGenerator,
|
|
18
|
+
SpectraOut,
|
|
19
|
+
TimeInOut,
|
|
20
|
+
TimeOut,
|
|
21
|
+
)
|
|
16
22
|
from .calib import Calib
|
|
17
23
|
from .environments import (
|
|
18
24
|
Environment,
|
|
@@ -46,6 +52,7 @@ from .fbeamform import (
|
|
|
46
52
|
SteeringVector,
|
|
47
53
|
integrate,
|
|
48
54
|
)
|
|
55
|
+
from .fprocess import IRFFT, RFFT, AutoPowerSpectra, CrossPowerSpectra, FFTSpectra
|
|
49
56
|
from .grids import (
|
|
50
57
|
CircSector,
|
|
51
58
|
ConvexSector,
|
|
@@ -62,6 +69,8 @@ from .grids import (
|
|
|
62
69
|
Sector,
|
|
63
70
|
)
|
|
64
71
|
from .microphones import MicGeom
|
|
72
|
+
from .process import Average, Cache, SampleSplitter, TimeAverage, TimeCache
|
|
73
|
+
from .sdinput import SoundDeviceSamplesGenerator
|
|
65
74
|
from .signals import (
|
|
66
75
|
FiltWNoiseGenerator,
|
|
67
76
|
GenericSignalGenerator,
|
|
@@ -84,7 +93,7 @@ from .sources import (
|
|
|
84
93
|
TimeSamples,
|
|
85
94
|
UncorrelatedNoiseSource,
|
|
86
95
|
)
|
|
87
|
-
from .spectra import BaseSpectra,
|
|
96
|
+
from .spectra import BaseSpectra, PowerSpectra, PowerSpectraImport, synthetic
|
|
88
97
|
from .spectra import PowerSpectra as EigSpectra
|
|
89
98
|
from .tbeamform import (
|
|
90
99
|
BeamformerCleant,
|
|
@@ -106,19 +115,15 @@ from .tprocess import (
|
|
|
106
115
|
FiltFreqWeight,
|
|
107
116
|
FiltOctave,
|
|
108
117
|
MaskedTimeInOut,
|
|
118
|
+
MaskedTimeOut,
|
|
109
119
|
Mixer,
|
|
110
120
|
OctaveFilterBank,
|
|
111
|
-
SamplesGenerator,
|
|
112
|
-
SampleSplitter,
|
|
113
121
|
SpatialInterpolator,
|
|
114
122
|
SpatialInterpolatorConstantRotation,
|
|
115
123
|
SpatialInterpolatorRotation,
|
|
116
|
-
TimeAverage,
|
|
117
|
-
TimeCache,
|
|
118
124
|
TimeConvolve,
|
|
119
125
|
TimeCumAverage,
|
|
120
126
|
TimeExpAverage,
|
|
121
|
-
TimeInOut,
|
|
122
127
|
TimePower,
|
|
123
128
|
TimeReverse,
|
|
124
129
|
Trigger,
|
|
@@ -126,3 +131,4 @@ from .tprocess import (
|
|
|
126
131
|
WriteWAV,
|
|
127
132
|
)
|
|
128
133
|
from .trajectory import Trajectory
|
|
134
|
+
from .version import __author__, __date__, __version__
|
|
@@ -0,0 +1,312 @@
|
|
|
1
|
+
# ------------------------------------------------------------------------------
|
|
2
|
+
# Copyright (c) Acoular Development Team.
|
|
3
|
+
# ------------------------------------------------------------------------------
|
|
4
|
+
"""Implements base classes for signal processing blocks in Acoular.
|
|
5
|
+
|
|
6
|
+
The classes in this module are abstract base classes that provide a common interface for all classes that generate an
|
|
7
|
+
output via the generator :meth:`result` in block-wise manner. They are not intended to be used directly, but to be
|
|
8
|
+
subclassed by classes that implement the actual signal processing.
|
|
9
|
+
|
|
10
|
+
.. autosummary::
|
|
11
|
+
:toctree: generated/
|
|
12
|
+
|
|
13
|
+
Generator
|
|
14
|
+
SamplesGenerator
|
|
15
|
+
SpectraGenerator
|
|
16
|
+
InOut
|
|
17
|
+
TimeOut
|
|
18
|
+
SpectraOut
|
|
19
|
+
TimeInOut
|
|
20
|
+
"""
|
|
21
|
+
|
|
22
|
+
from traits.api import (
|
|
23
|
+
CArray,
|
|
24
|
+
CLong,
|
|
25
|
+
Delegate,
|
|
26
|
+
Float,
|
|
27
|
+
HasPrivateTraits,
|
|
28
|
+
Instance,
|
|
29
|
+
Property,
|
|
30
|
+
cached_property,
|
|
31
|
+
)
|
|
32
|
+
|
|
33
|
+
from acoular.internal import digest
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
class Generator(HasPrivateTraits):
|
|
37
|
+
"""Interface for any generating signal processing block.
|
|
38
|
+
|
|
39
|
+
It provides a common interface for all classes, which generate an output via the generator :meth:`result`
|
|
40
|
+
in block-wise manner. It has a common set of traits that are used by all classes that implement this interface.
|
|
41
|
+
This includes the sampling frequency of the signal (:attr:`sample_freq`) and the number of samples (:attr:`numsamples`).
|
|
42
|
+
A private trait :attr:`digest` is used to store the internal identifier of the object, which is a hash of the object's
|
|
43
|
+
attributes. This is used to check if the object's internal state has changed.
|
|
44
|
+
"""
|
|
45
|
+
|
|
46
|
+
#: Sampling frequency of the signal, defaults to 1.0
|
|
47
|
+
sample_freq = Float(1.0, desc='sampling frequency')
|
|
48
|
+
|
|
49
|
+
#: Number of signal samples
|
|
50
|
+
numsamples = CLong
|
|
51
|
+
|
|
52
|
+
# internal identifier
|
|
53
|
+
digest = Property(depends_on=['sample_freq', 'numsamples'])
|
|
54
|
+
|
|
55
|
+
def _get_digest(self):
|
|
56
|
+
return digest(self)
|
|
57
|
+
|
|
58
|
+
def result(self, num):
|
|
59
|
+
"""Python generator that yields the output block-wise.
|
|
60
|
+
|
|
61
|
+
This method needs to be implemented by the derived classes.
|
|
62
|
+
|
|
63
|
+
Parameters
|
|
64
|
+
----------
|
|
65
|
+
num : int
|
|
66
|
+
The size of the first dimension of the blocks to be yielded
|
|
67
|
+
|
|
68
|
+
Yields
|
|
69
|
+
------
|
|
70
|
+
numpy.ndarray
|
|
71
|
+
Two-dimensional output data block of shape (num, ...)
|
|
72
|
+
"""
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
class SamplesGenerator(Generator):
|
|
76
|
+
"""Interface for any generating multi-channel time domain signal processing block.
|
|
77
|
+
|
|
78
|
+
It provides a common interface for all SamplesGenerator classes, which generate an output via the generator :meth:`result`
|
|
79
|
+
in block-wise manner. This class has no real functionality on its own and should not be used directly.
|
|
80
|
+
"""
|
|
81
|
+
|
|
82
|
+
#: Number of channels
|
|
83
|
+
numchannels = CLong
|
|
84
|
+
|
|
85
|
+
# internal identifier
|
|
86
|
+
digest = Property(depends_on=['sample_freq', 'numchannels', 'numsamples'])
|
|
87
|
+
|
|
88
|
+
def _get_digest(self):
|
|
89
|
+
return digest(self)
|
|
90
|
+
|
|
91
|
+
def result(self, num):
|
|
92
|
+
"""Python generator that yields the output block-wise.
|
|
93
|
+
|
|
94
|
+
Parameters
|
|
95
|
+
----------
|
|
96
|
+
num : int
|
|
97
|
+
This parameter defines the size of the blocks to be yielded
|
|
98
|
+
(i.e. the number of samples per block)
|
|
99
|
+
|
|
100
|
+
Yields
|
|
101
|
+
------
|
|
102
|
+
numpy.ndarray
|
|
103
|
+
The two-dimensional time-data block of shape (num, numchannels).
|
|
104
|
+
"""
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
class SpectraGenerator(Generator):
|
|
108
|
+
"""Interface for any generating multi-channel signal frequency domain processing block.
|
|
109
|
+
|
|
110
|
+
It provides a common interface for all SpectraGenerator classes, which generate an output via the generator :meth:`result`
|
|
111
|
+
in block-wise manner. This class has no real functionality on its own and should not be used directly.
|
|
112
|
+
"""
|
|
113
|
+
|
|
114
|
+
#: Number of channels
|
|
115
|
+
numchannels = CLong
|
|
116
|
+
|
|
117
|
+
#: Number of frequencies
|
|
118
|
+
numfreqs = CLong
|
|
119
|
+
|
|
120
|
+
#: 1-D array of frequencies
|
|
121
|
+
freqs = CArray
|
|
122
|
+
|
|
123
|
+
#: The length of the block used to calculate the spectra
|
|
124
|
+
block_size = CLong
|
|
125
|
+
|
|
126
|
+
# internal identifier
|
|
127
|
+
digest = Property(depends_on=['sample_freq', 'numchannels', 'numsamples', 'numfreqs', 'block_size'])
|
|
128
|
+
|
|
129
|
+
def _get_digest(self):
|
|
130
|
+
return digest(self)
|
|
131
|
+
|
|
132
|
+
def result(self, num=1):
|
|
133
|
+
"""Python generator that yields the output block-wise.
|
|
134
|
+
|
|
135
|
+
Parameters
|
|
136
|
+
----------
|
|
137
|
+
num : integer
|
|
138
|
+
This parameter defines the size of the number of snapshots to be yielded.
|
|
139
|
+
Defaults to 1.
|
|
140
|
+
|
|
141
|
+
Yields
|
|
142
|
+
------
|
|
143
|
+
numpy.ndarray
|
|
144
|
+
A two-dimensional block of shape (num, numchannels*numfreqs).
|
|
145
|
+
"""
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
class TimeOut(SamplesGenerator):
|
|
149
|
+
"""Abstract base class for any signal processing block that receives data from any :attr:`source` domain and returns
|
|
150
|
+
time domain signals.
|
|
151
|
+
|
|
152
|
+
It provides a base class that can be used to create signal processing blocks that receive data from any
|
|
153
|
+
generating :attr:`source` and generates a time signal output via the generator :meth:`result` in block-wise manner.
|
|
154
|
+
"""
|
|
155
|
+
|
|
156
|
+
#: Data source; :class:`~acoular.base.Generator` or derived object.
|
|
157
|
+
source = Instance(Generator)
|
|
158
|
+
|
|
159
|
+
#: Sampling frequency of output signal, as given by :attr:`source`.
|
|
160
|
+
sample_freq = Delegate('source')
|
|
161
|
+
|
|
162
|
+
#: Number of channels in output, as given by :attr:`source`.
|
|
163
|
+
numchannels = Delegate('source')
|
|
164
|
+
|
|
165
|
+
#: Number of samples in output, as given by :attr:`source`.
|
|
166
|
+
numsamples = Delegate('source')
|
|
167
|
+
|
|
168
|
+
# internal identifier
|
|
169
|
+
digest = Property(depends_on=['source.digest'])
|
|
170
|
+
|
|
171
|
+
@cached_property
|
|
172
|
+
def _get_digest(self):
|
|
173
|
+
return digest(self)
|
|
174
|
+
|
|
175
|
+
def result(self, num):
|
|
176
|
+
"""Python generator that processes the source data and yields the time-signal block-wise.
|
|
177
|
+
|
|
178
|
+
This method needs to be implemented by the derived classes.
|
|
179
|
+
|
|
180
|
+
Parameters
|
|
181
|
+
----------
|
|
182
|
+
num : int
|
|
183
|
+
This parameter defines the size of the blocks to be yielded
|
|
184
|
+
(i.e. the number of samples per block)
|
|
185
|
+
|
|
186
|
+
Yields
|
|
187
|
+
------
|
|
188
|
+
numpy.ndarray
|
|
189
|
+
Two-dimensional output data block of shape (num, numchannels)
|
|
190
|
+
"""
|
|
191
|
+
yield from self.source.result(num)
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
class SpectraOut(SpectraGenerator):
|
|
195
|
+
"""Abstract base class for any signal processing block that receives data from any :attr:`source` domain and
|
|
196
|
+
returns frequency domain signals.
|
|
197
|
+
|
|
198
|
+
It provides a base class that can be used to create signal processing blocks that receive data from any
|
|
199
|
+
generating :attr:`source` domain and generates a frequency domain output via the generator :meth:`result`
|
|
200
|
+
in block-wise manner.
|
|
201
|
+
"""
|
|
202
|
+
|
|
203
|
+
#: Data source; :class:`~acoular.base.Generator` or derived object.
|
|
204
|
+
source = Instance(Generator)
|
|
205
|
+
|
|
206
|
+
#: Sampling frequency of output signal, as given by :attr:`source`.
|
|
207
|
+
sample_freq = Delegate('source')
|
|
208
|
+
|
|
209
|
+
#: Number of channels in output, as given by :attr:`source`.
|
|
210
|
+
numchannels = Delegate('source')
|
|
211
|
+
|
|
212
|
+
#: Number of snapshots in output, as given by :attr:`source`.
|
|
213
|
+
numsamples = Delegate('source')
|
|
214
|
+
|
|
215
|
+
#: Number of frequencies in output, as given by :attr:`source`.
|
|
216
|
+
numfreqs = Delegate('source')
|
|
217
|
+
|
|
218
|
+
#: 1-D array of frequencies, as given by :attr:`source`.
|
|
219
|
+
freqs = Delegate('source')
|
|
220
|
+
|
|
221
|
+
#: The size of the block used to calculate the spectra
|
|
222
|
+
block_size = Delegate('source')
|
|
223
|
+
|
|
224
|
+
# internal identifier
|
|
225
|
+
digest = Property(depends_on=['source.digest'])
|
|
226
|
+
|
|
227
|
+
@cached_property
|
|
228
|
+
def _get_digest(self):
|
|
229
|
+
return digest(self)
|
|
230
|
+
|
|
231
|
+
def result(self, num=1):
|
|
232
|
+
"""Python generator that processes the source data and yields the output block-wise.
|
|
233
|
+
|
|
234
|
+
This method needs to be implemented by the derived classes.
|
|
235
|
+
|
|
236
|
+
num : integer
|
|
237
|
+
This parameter defines the the number of snapshots to be yielded.
|
|
238
|
+
Defaults to 1.
|
|
239
|
+
|
|
240
|
+
Yields
|
|
241
|
+
------
|
|
242
|
+
numpy.ndarray
|
|
243
|
+
A two-dimensional block of shape (num, numchannels*numfreqs).
|
|
244
|
+
"""
|
|
245
|
+
yield from self.source.result(num)
|
|
246
|
+
|
|
247
|
+
|
|
248
|
+
class InOut(SamplesGenerator, SpectraGenerator):
|
|
249
|
+
"""Abstract base class for any signal processing block that receives data from any :attr:`source` domain and returns
|
|
250
|
+
signals in the same domain.
|
|
251
|
+
|
|
252
|
+
It provides a base class that can be used to create signal processing blocks that receive data from any
|
|
253
|
+
generating :attr:`source` and generates an output via the generator :meth:`result` in block-wise manner.
|
|
254
|
+
"""
|
|
255
|
+
|
|
256
|
+
#: Data source; :class:`~acoular.base.Generator` or derived object.
|
|
257
|
+
source = Instance(Generator)
|
|
258
|
+
|
|
259
|
+
#: Sampling frequency of output signal, as given by :attr:`source`.
|
|
260
|
+
sample_freq = Delegate('source')
|
|
261
|
+
|
|
262
|
+
#: Number of channels in output, as given by :attr:`source`.
|
|
263
|
+
numchannels = Delegate('source')
|
|
264
|
+
|
|
265
|
+
#: Number of samples / snapshots in output, as given by :attr:`source`.
|
|
266
|
+
numsamples = Delegate('source')
|
|
267
|
+
|
|
268
|
+
# internal identifier
|
|
269
|
+
digest = Property(depends_on=['source.digest'])
|
|
270
|
+
|
|
271
|
+
@cached_property
|
|
272
|
+
def _get_digest(self):
|
|
273
|
+
return digest(self)
|
|
274
|
+
|
|
275
|
+
def result(self, num):
|
|
276
|
+
"""Python generator that processes the source data and yields the output block-wise.
|
|
277
|
+
|
|
278
|
+
This method needs to be implemented by the derived classes.
|
|
279
|
+
|
|
280
|
+
Parameters
|
|
281
|
+
----------
|
|
282
|
+
num : int
|
|
283
|
+
The size of the first dimension of the blocks to be yielded
|
|
284
|
+
|
|
285
|
+
Yields
|
|
286
|
+
------
|
|
287
|
+
numpy.ndarray
|
|
288
|
+
Two-dimensional output data block of shape (num, ...)
|
|
289
|
+
"""
|
|
290
|
+
yield from self.source.result(num)
|
|
291
|
+
|
|
292
|
+
|
|
293
|
+
class TimeInOut(TimeOut):
|
|
294
|
+
"""Deprecated alias for :class:`~acoular.base.TimeOut`.
|
|
295
|
+
|
|
296
|
+
.. deprecated:: 24.10
|
|
297
|
+
Using :class:`~acoular.base.TimeInOut` is deprecated and will be removed in Acoular 25.07.
|
|
298
|
+
Use :class:`~acoular.base.TimeOut` instead.
|
|
299
|
+
"""
|
|
300
|
+
|
|
301
|
+
#: Data source; :class:`~acoular.base.SamplesGenerator` or derived object.
|
|
302
|
+
source = Instance(SamplesGenerator)
|
|
303
|
+
|
|
304
|
+
def __init__(self, *args, **kwargs):
|
|
305
|
+
super().__init__(*args, **kwargs)
|
|
306
|
+
import warnings
|
|
307
|
+
|
|
308
|
+
warnings.warn(
|
|
309
|
+
'TimeInOut is deprecated and will be removed in Acoular 25.07. Use TimeOut instead.',
|
|
310
|
+
DeprecationWarning,
|
|
311
|
+
stacklevel=2,
|
|
312
|
+
)
|
|
@@ -35,7 +35,7 @@ if 'numpy' in sys.modules:
|
|
|
35
35
|
np.show_config()
|
|
36
36
|
sys.stdout = orig_stdout
|
|
37
37
|
# check if it uses OpenBLAS or another library
|
|
38
|
-
if 'openblas' in temp_stdout.getvalue().lower():
|
|
38
|
+
if 'openblas' in temp_stdout.getvalue().lower() and environ.get('OPENBLAS_NUM_THREADS') != '1':
|
|
39
39
|
# it's OpenBLAS, set numba threads=1 to avoid overcommittment
|
|
40
40
|
import numba
|
|
41
41
|
|
|
@@ -54,7 +54,7 @@ else:
|
|
|
54
54
|
environ['OPENBLAS_NUM_THREADS'] = '1'
|
|
55
55
|
|
|
56
56
|
# this loads numpy, so we have to defer loading until OpenBLAS check is done
|
|
57
|
-
from traits.api import Bool,
|
|
57
|
+
from traits.api import Bool, Enum, HasStrictTraits, Property, Str, Trait, cached_property
|
|
58
58
|
|
|
59
59
|
|
|
60
60
|
class Config(HasStrictTraits):
|
|
@@ -70,9 +70,9 @@ class Config(HasStrictTraits):
|
|
|
70
70
|
--------
|
|
71
71
|
For using Acoular with h5py package and overwrite existing cache:
|
|
72
72
|
|
|
73
|
-
>>>
|
|
74
|
-
>>>
|
|
75
|
-
>>>
|
|
73
|
+
>>> import acoular
|
|
74
|
+
>>> acoular.config.h5library = 'h5py'
|
|
75
|
+
>>> acoular.config.global_caching = 'overwrite'
|
|
76
76
|
|
|
77
77
|
"""
|
|
78
78
|
|
|
@@ -97,7 +97,7 @@ class Config(HasStrictTraits):
|
|
|
97
97
|
#: If 'pytables' can not be imported, 'h5py' is used.
|
|
98
98
|
h5library = Property()
|
|
99
99
|
|
|
100
|
-
_h5library =
|
|
100
|
+
_h5library = Enum('pytables', 'tables', 'h5py')
|
|
101
101
|
|
|
102
102
|
#: Defines the path to the directory containing Acoulars cache files.
|
|
103
103
|
#: If the specified :attr:`cache_dir` directory does not exist,
|
|
@@ -134,25 +134,28 @@ class Config(HasStrictTraits):
|
|
|
134
134
|
#: Boolean Flag that determines whether sounddevice is installed.
|
|
135
135
|
have_sounddevice = Property()
|
|
136
136
|
|
|
137
|
+
#: Boolean Flag that determines whether the package is installed.
|
|
138
|
+
have_traitsui = Property()
|
|
139
|
+
|
|
137
140
|
def _get_global_caching(self):
|
|
138
141
|
return self._global_caching
|
|
139
142
|
|
|
140
|
-
def _set_global_caching(self,
|
|
141
|
-
self._global_caching =
|
|
143
|
+
def _set_global_caching(self, value):
|
|
144
|
+
self._global_caching = value
|
|
142
145
|
|
|
143
146
|
def _get_h5library(self):
|
|
144
147
|
return self._h5library
|
|
145
148
|
|
|
146
|
-
def _set_h5library(self,
|
|
147
|
-
self._h5library =
|
|
149
|
+
def _set_h5library(self, name):
|
|
150
|
+
self._h5library = name
|
|
148
151
|
|
|
149
152
|
def _get_use_traitsui(self):
|
|
150
153
|
return self._use_traitsui
|
|
151
154
|
|
|
152
155
|
def _set_use_traitsui(self, use_tui):
|
|
153
|
-
if use_tui:
|
|
154
|
-
|
|
155
|
-
|
|
156
|
+
if use_tui and not self.have_traitsui:
|
|
157
|
+
error_msg = 'TraitsUI package is not installed!'
|
|
158
|
+
raise ImportError(error_msg)
|
|
156
159
|
self._use_traitsui = use_tui
|
|
157
160
|
|
|
158
161
|
def _assert_h5library(self):
|
|
@@ -205,6 +208,10 @@ class Config(HasStrictTraits):
|
|
|
205
208
|
def _get_have_h5py(self):
|
|
206
209
|
return self._have_module('h5py')
|
|
207
210
|
|
|
211
|
+
@cached_property
|
|
212
|
+
def _get_have_traitsui(self):
|
|
213
|
+
return self._have_module('traitsui')
|
|
214
|
+
|
|
208
215
|
|
|
209
216
|
config = Config()
|
|
210
217
|
"""
|
|
@@ -232,7 +239,7 @@ Note: this is independent from the GUI tools implemented in the spectAcoular pac
|
|
|
232
239
|
Example:
|
|
233
240
|
For using Acoular with h5py package and overwrite existing cache:
|
|
234
241
|
|
|
235
|
-
>>>
|
|
236
|
-
>>>
|
|
237
|
-
>>>
|
|
242
|
+
>>> import acoular
|
|
243
|
+
>>> acoular.config.h5library = "h5py"
|
|
244
|
+
>>> acoular.config.global_caching = "overwrite"
|
|
238
245
|
"""
|