acoular 24.5__tar.gz → 24.7__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.7}/.gitignore +8 -9
- {acoular-24.5 → acoular-24.7}/PKG-INFO +24 -4
- {acoular-24.5 → acoular-24.7}/README.md +8 -2
- {acoular-24.5 → acoular-24.7}/acoular/__init__.py +3 -6
- {acoular-24.5 → acoular-24.7}/acoular/configuration.py +20 -13
- acoular-24.7/acoular/demo/acoular_demo.py +98 -0
- {acoular-24.5 → acoular-24.7}/acoular/environments.py +13 -10
- {acoular-24.5 → acoular-24.7}/acoular/fastFuncs.py +40 -40
- {acoular-24.5 → acoular-24.7}/acoular/fbeamform.py +895 -1088
- {acoular-24.5 → acoular-24.7}/acoular/grids.py +5 -5
- {acoular-24.5 → acoular-24.7}/acoular/h5cache.py +34 -34
- {acoular-24.5 → acoular-24.7}/acoular/h5files.py +13 -13
- {acoular-24.5 → acoular-24.7}/acoular/internal.py +3 -3
- {acoular-24.5 → acoular-24.7}/acoular/sdinput.py +10 -1
- {acoular-24.5 → acoular-24.7}/acoular/signals.py +15 -1
- {acoular-24.5 → acoular-24.7}/acoular/sources.py +120 -49
- {acoular-24.5 → acoular-24.7}/acoular/spectra.py +5 -5
- {acoular-24.5 → acoular-24.7}/acoular/tbeamform.py +5 -6
- {acoular-24.5 → acoular-24.7}/acoular/tfastfuncs.py +17 -18
- {acoular-24.5 → acoular-24.7}/acoular/tools/aiaa.py +4 -5
- {acoular-24.5 → acoular-24.7}/acoular/tprocess.py +82 -82
- {acoular-24.5 → acoular-24.7}/acoular/version.py +2 -2
- {acoular-24.5 → acoular-24.7}/pyproject.toml +24 -4
- acoular-24.5/acoular/demo/acoular_demo.py +0 -105
- {acoular-24.5 → acoular-24.7}/AUTHORS.rst +0 -0
- {acoular-24.5 → acoular-24.7}/LICENSE +0 -0
- {acoular-24.5 → acoular-24.7}/acoular/calib.py +0 -0
- {acoular-24.5 → acoular-24.7}/acoular/demo/__init__.py +0 -0
- {acoular-24.5 → acoular-24.7}/acoular/microphones.py +0 -0
- {acoular-24.5 → acoular-24.7}/acoular/tools/__init__.py +0 -0
- {acoular-24.5 → acoular-24.7}/acoular/tools/helpers.py +0 -0
- {acoular-24.5 → acoular-24.7}/acoular/tools/metrics.py +0 -0
- {acoular-24.5 → acoular-24.7}/acoular/traitsviews.py +0 -0
- {acoular-24.5 → acoular-24.7}/acoular/trajectory.py +0 -0
- {acoular-24.5 → acoular-24.7}/acoular/xml/HW90D240_f10.xml +0 -0
- {acoular-24.5 → acoular-24.7}/acoular/xml/W90_D105_f10.xml +0 -0
- {acoular-24.5 → acoular-24.7}/acoular/xml/acousticam_2c.xml +0 -0
- {acoular-24.5 → acoular-24.7}/acoular/xml/acousticam_4c.xml +0 -0
- {acoular-24.5 → acoular-24.7}/acoular/xml/array38.xml +0 -0
- {acoular-24.5 → acoular-24.7}/acoular/xml/array92x.xml +0 -0
- {acoular-24.5 → acoular-24.7}/acoular/xml/array_56.xml +0 -0
- {acoular-24.5 → acoular-24.7}/acoular/xml/array_56_10_9.xml +0 -0
- {acoular-24.5 → acoular-24.7}/acoular/xml/array_56_bomb.xml +0 -0
- {acoular-24.5 → acoular-24.7}/acoular/xml/array_56_v2.xml +0 -0
- {acoular-24.5 → acoular-24.7}/acoular/xml/array_64.xml +0 -0
- {acoular-24.5 → acoular-24.7}/acoular/xml/array_84_10_9.xml +0 -0
- {acoular-24.5 → acoular-24.7}/acoular/xml/array_84_bomb_v3.xml +0 -0
- {acoular-24.5 → acoular-24.7}/acoular/xml/calib_vw_ring32.xml +0 -0
- {acoular-24.5 → acoular-24.7}/acoular/xml/gfai_ring32.xml +0 -0
- {acoular-24.5 → acoular-24.7}/acoular/xml/minidsp_uma-16.xml +0 -0
- {acoular-24.5 → acoular-24.7}/acoular/xml/minidsp_uma-16_mirrored.xml +0 -0
- {acoular-24.5 → acoular-24.7}/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,13 @@ __pycache__/
|
|
|
23
16
|
*.nbc
|
|
24
17
|
*.nbi
|
|
25
18
|
*.pyd
|
|
26
|
-
docs/source/api_ref/generated/
|
|
27
19
|
.vscode/
|
|
28
20
|
|
|
29
|
-
|
|
21
|
+
MANIFEST
|
|
22
|
+
|
|
23
|
+
examples/all_bf.sav
|
|
24
|
+
examples/benchmark/results/
|
|
25
|
+
**/three_sources.h5
|
|
26
|
+
docs/source/sg_execution_times.rst
|
|
27
|
+
docs/source/api_ref/generated/
|
|
28
|
+
docs/source/auto_examples/**/*
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: acoular
|
|
3
|
-
Version: 24.
|
|
3
|
+
Version: 24.7
|
|
4
4
|
Summary: Python library for acoustic beamforming
|
|
5
5
|
Project-URL: homepage, https://acoular.org
|
|
6
6
|
Project-URL: documentation, https://acoular.org
|
|
@@ -50,11 +50,25 @@ Classifier: Programming Language :: Python :: 3.12
|
|
|
50
50
|
Classifier: Topic :: Scientific/Engineering :: Physics
|
|
51
51
|
Requires-Python: <=12,>=3.8
|
|
52
52
|
Requires-Dist: numba
|
|
53
|
-
Requires-Dist: numpy
|
|
53
|
+
Requires-Dist: numpy<2.0
|
|
54
54
|
Requires-Dist: scikit-learn
|
|
55
55
|
Requires-Dist: scipy>=1.1.0
|
|
56
56
|
Requires-Dist: tables>=3.4.4
|
|
57
57
|
Requires-Dist: traits>=6.0
|
|
58
|
+
Provides-Extra: dev
|
|
59
|
+
Requires-Dist: graphviz; extra == 'dev'
|
|
60
|
+
Requires-Dist: hatch; extra == 'dev'
|
|
61
|
+
Requires-Dist: ipython; extra == 'dev'
|
|
62
|
+
Requires-Dist: matplotlib; extra == 'dev'
|
|
63
|
+
Requires-Dist: numpydoc; extra == 'dev'
|
|
64
|
+
Requires-Dist: pickleshare; extra == 'dev'
|
|
65
|
+
Requires-Dist: pylops; extra == 'dev'
|
|
66
|
+
Requires-Dist: pytest; extra == 'dev'
|
|
67
|
+
Requires-Dist: ruff==0.4.1; extra == 'dev'
|
|
68
|
+
Requires-Dist: sounddevice; extra == 'dev'
|
|
69
|
+
Requires-Dist: sphinx; extra == 'dev'
|
|
70
|
+
Requires-Dist: sphinx-gallery; extra == 'dev'
|
|
71
|
+
Requires-Dist: traitsui; extra == 'dev'
|
|
58
72
|
Provides-Extra: full
|
|
59
73
|
Requires-Dist: matplotlib; extra == 'full'
|
|
60
74
|
Requires-Dist: pylops; extra == 'full'
|
|
@@ -135,12 +149,17 @@ For more detailed installation instructions, see the [documentation](https://aco
|
|
|
135
149
|
# Documentation and help
|
|
136
150
|
Documentation is available [here](https://acoular.org) with a
|
|
137
151
|
[getting started](https://acoular.org/get_started/index.html) section and
|
|
138
|
-
[examples](https://acoular.org/
|
|
152
|
+
[examples](https://acoular.org/auto_examples/index.html).
|
|
139
153
|
|
|
140
154
|
The Acoular [blog](https://acoular.github.io/blog/) contains some tutorials.
|
|
141
155
|
|
|
142
156
|
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
157
|
|
|
158
|
+
# Contributing
|
|
159
|
+
|
|
160
|
+
We are always happy to welcome new contributors to the project.
|
|
161
|
+
If you are interested in contributing, have a look at the [CONTRIBUTING.md](CONTRIBUTING.md) file.
|
|
162
|
+
|
|
144
163
|
# Example
|
|
145
164
|
This reads data from 64 microphone channels and computes a beamforming map for the 8kHz third octave band:
|
|
146
165
|
|
|
@@ -176,5 +195,6 @@ interpolation='bicubic')
|
|
|
176
195
|
colorbar()
|
|
177
196
|
```
|
|
178
197
|
|
|
179
|
-
|
|
180
198
|

|
|
199
|
+
|
|
200
|
+
|
|
@@ -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
|
|
|
@@ -113,5 +118,6 @@ interpolation='bicubic')
|
|
|
113
118
|
colorbar()
|
|
114
119
|
```
|
|
115
120
|
|
|
116
|
-
|
|
117
121
|

|
|
122
|
+
|
|
123
|
+
|
|
@@ -6,14 +6,9 @@
|
|
|
6
6
|
|
|
7
7
|
import os
|
|
8
8
|
|
|
9
|
-
from .configuration import config
|
|
10
|
-
from .version import __author__, __date__, __version__
|
|
11
|
-
|
|
12
|
-
if config.have_sounddevice:
|
|
13
|
-
from .sdinput import SoundDeviceSamplesGenerator
|
|
14
|
-
|
|
15
9
|
from . import demo, tools
|
|
16
10
|
from .calib import Calib
|
|
11
|
+
from .configuration import config
|
|
17
12
|
from .environments import (
|
|
18
13
|
Environment,
|
|
19
14
|
FlowField,
|
|
@@ -62,6 +57,7 @@ from .grids import (
|
|
|
62
57
|
Sector,
|
|
63
58
|
)
|
|
64
59
|
from .microphones import MicGeom
|
|
60
|
+
from .sdinput import SoundDeviceSamplesGenerator
|
|
65
61
|
from .signals import (
|
|
66
62
|
FiltWNoiseGenerator,
|
|
67
63
|
GenericSignalGenerator,
|
|
@@ -126,3 +122,4 @@ from .tprocess import (
|
|
|
126
122
|
WriteWAV,
|
|
127
123
|
)
|
|
128
124
|
from .trajectory import Trajectory
|
|
125
|
+
from .version import __author__, __date__, __version__
|
|
@@ -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
|
|
|
@@ -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
|
"""
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
# ------------------------------------------------------------------------------
|
|
2
|
+
# Copyright (c) Acoular Development Team.
|
|
3
|
+
# ------------------------------------------------------------------------------
|
|
4
|
+
"""Demo for Acoular.
|
|
5
|
+
|
|
6
|
+
To run the demo, execute the following commands:
|
|
7
|
+
|
|
8
|
+
.. code-block:: python
|
|
9
|
+
|
|
10
|
+
import acoular
|
|
11
|
+
|
|
12
|
+
acoular.demo.acoular_demo.run()
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
Generates a test data set for three sources, analyzes them and generates a
|
|
16
|
+
map of the three sources.
|
|
17
|
+
|
|
18
|
+
The simulation generates the sound pressure at 64 microphones that are
|
|
19
|
+
arrangend in the 'array64' geometry, which is part of the package. The sound
|
|
20
|
+
pressure signals are sampled at 51200 Hz for a duration of 1 second.
|
|
21
|
+
|
|
22
|
+
Source location (relative to array center) and RMS in 1 m distance:
|
|
23
|
+
|
|
24
|
+
====== =============== ======
|
|
25
|
+
Source Location RMS
|
|
26
|
+
====== =============== ======
|
|
27
|
+
1 (-0.1,-0.1,0.3) 1.0 Pa
|
|
28
|
+
2 (0.15,0,0.3) 0.7 Pa
|
|
29
|
+
3 (0,0.1,0.3) 0.5 Pa
|
|
30
|
+
====== =============== ======
|
|
31
|
+
|
|
32
|
+
"""
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def run():
|
|
36
|
+
"""Run the Acoular demo."""
|
|
37
|
+
from pathlib import Path
|
|
38
|
+
|
|
39
|
+
import acoular as ac
|
|
40
|
+
|
|
41
|
+
ac.config.global_caching = 'none'
|
|
42
|
+
|
|
43
|
+
# set up the parameters
|
|
44
|
+
sfreq = 51200
|
|
45
|
+
duration = 1
|
|
46
|
+
nsamples = duration * sfreq
|
|
47
|
+
micgeofile = Path(ac.__file__).parent / 'xml' / 'array_64.xml'
|
|
48
|
+
h5savefile = 'three_sources.h5'
|
|
49
|
+
|
|
50
|
+
# generate test data, in real life this would come from an array measurement
|
|
51
|
+
mg = ac.MicGeom(from_file=micgeofile)
|
|
52
|
+
n1 = ac.WNoiseGenerator(sample_freq=sfreq, numsamples=nsamples, seed=1)
|
|
53
|
+
n2 = ac.WNoiseGenerator(sample_freq=sfreq, numsamples=nsamples, seed=2, rms=0.7)
|
|
54
|
+
n3 = ac.WNoiseGenerator(sample_freq=sfreq, numsamples=nsamples, seed=3, rms=0.5)
|
|
55
|
+
p1 = ac.PointSource(signal=n1, mics=mg, loc=(-0.1, -0.1, 0.3))
|
|
56
|
+
p2 = ac.PointSource(signal=n2, mics=mg, loc=(0.15, 0, 0.3))
|
|
57
|
+
p3 = ac.PointSource(signal=n3, mics=mg, loc=(0, 0.1, 0.3))
|
|
58
|
+
pa = ac.Mixer(source=p1, sources=[p2, p3])
|
|
59
|
+
wh5 = ac.WriteH5(source=pa, name=h5savefile)
|
|
60
|
+
wh5.save()
|
|
61
|
+
|
|
62
|
+
# analyze the data and generate map
|
|
63
|
+
|
|
64
|
+
ps = ac.PowerSpectra(time_data=pa, block_size=128, window='Hanning')
|
|
65
|
+
|
|
66
|
+
rg = ac.RectGrid(x_min=-0.2, x_max=0.2, y_min=-0.2, y_max=0.2, z=0.3, increment=0.01)
|
|
67
|
+
st = ac.SteeringVector(grid=rg, mics=mg)
|
|
68
|
+
|
|
69
|
+
bb = ac.BeamformerBase(freq_data=ps, steer=st)
|
|
70
|
+
pm = bb.synthetic(8000, 3)
|
|
71
|
+
spl = ac.L_p(pm)
|
|
72
|
+
|
|
73
|
+
if ac.config.have_matplotlib:
|
|
74
|
+
from pylab import axis, colorbar, figure, imshow, plot, show
|
|
75
|
+
|
|
76
|
+
# show map
|
|
77
|
+
imshow(spl.T, origin='lower', vmin=spl.max() - 10, extent=rg.extend(), interpolation='bicubic')
|
|
78
|
+
colorbar()
|
|
79
|
+
|
|
80
|
+
# plot microphone geometry
|
|
81
|
+
figure(2)
|
|
82
|
+
plot(mg.mpos[0], mg.mpos[1], 'o')
|
|
83
|
+
axis('equal')
|
|
84
|
+
|
|
85
|
+
show()
|
|
86
|
+
|
|
87
|
+
else:
|
|
88
|
+
print('Matplotlib not found! Please install matplotlib if you want to plot the results.')
|
|
89
|
+
print('For consolation we do an ASCII map plot of the results here.')
|
|
90
|
+
grayscale = '@%#*+=-:. '[::-1]
|
|
91
|
+
ind = ((spl.T - spl.max() + 9).clip(0, 9)).astype(int)[::-1]
|
|
92
|
+
print(78 * '-')
|
|
93
|
+
print('|\n'.join([' '.join(['|'] + [grayscale[i] for i in row[2:-1]]) for row in ind]) + '|')
|
|
94
|
+
print(7 * '-', ''.join([f'{grayscale[i]}={int(spl.max())-9+i}dB ' for i in range(1, 10)]), 6 * '-')
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
if __name__ == '__main__':
|
|
98
|
+
run()
|
|
@@ -85,7 +85,7 @@ def dist_mat(gpos, mpos):
|
|
|
85
85
|
return rm
|
|
86
86
|
|
|
87
87
|
|
|
88
|
-
def cartToCyl(x, Q=None):
|
|
88
|
+
def cartToCyl(x, Q=None): # noqa: N802, N803
|
|
89
89
|
"""Returns the cylindrical coordinate representation of a input position
|
|
90
90
|
which was before transformed into a modified cartesian coordinate, which
|
|
91
91
|
has flow into positive z direction.
|
|
@@ -111,7 +111,7 @@ def cartToCyl(x, Q=None):
|
|
|
111
111
|
return array([arctan2(x[1], x[0]), sqrt(x[0] ** 2 + x[1] ** 2), x[2]])
|
|
112
112
|
|
|
113
113
|
|
|
114
|
-
def cylToCart(x, Q=None):
|
|
114
|
+
def cylToCart(x, Q=None): # noqa: N802, N803
|
|
115
115
|
"""Returns the cartesian coordinate representation of a input position
|
|
116
116
|
which was before transformed into a cylindrical coordinate, which
|
|
117
117
|
has flow into positive z direction.
|
|
@@ -303,9 +303,12 @@ class SlotJet(FlowField):
|
|
|
303
303
|
#: Width of the slot, defaults to 0.2 .
|
|
304
304
|
B = Float(0.2, desc='nozzle diameter')
|
|
305
305
|
|
|
306
|
+
#: Nondimensional length of zone of flow establishment (jet core length), defaults to 5.2
|
|
307
|
+
l = Float(5.2, desc='flow establishment length') # noqa: E741
|
|
308
|
+
|
|
306
309
|
# internal identifier
|
|
307
310
|
digest = Property(
|
|
308
|
-
depends_on=['v0', 'origin', 'flow', 'plane', 'B'],
|
|
311
|
+
depends_on=['v0', 'origin', 'flow', 'plane', 'B', 'l'],
|
|
309
312
|
)
|
|
310
313
|
|
|
311
314
|
@cached_property
|
|
@@ -330,7 +333,6 @@ class SlotJet(FlowField):
|
|
|
330
333
|
given location.
|
|
331
334
|
|
|
332
335
|
"""
|
|
333
|
-
# TODO: better to make sure that self.flow and self.plane are indeed unit vectors before
|
|
334
336
|
# normalize
|
|
335
337
|
flow = self.flow / norm(self.flow)
|
|
336
338
|
plane = self.plane / norm(self.plane)
|
|
@@ -342,7 +344,7 @@ class SlotJet(FlowField):
|
|
|
342
344
|
# local co-ordinate system
|
|
343
345
|
x = dot(flow, xx1)
|
|
344
346
|
y = dot(yy, xx1)
|
|
345
|
-
x1 = 0.
|
|
347
|
+
x1 = 0.5668 / self.l * x # C1 in Albertson1950
|
|
346
348
|
h1 = abs(y) + sqrt(pi) * 0.5 * x1 - 0.5 * self.B
|
|
347
349
|
if h1 < 0.0:
|
|
348
350
|
# core jet
|
|
@@ -382,9 +384,12 @@ class OpenJet(FlowField):
|
|
|
382
384
|
#: Diameter of the nozzle, defaults to 0.2 .
|
|
383
385
|
D = Float(0.2, desc='nozzle diameter')
|
|
384
386
|
|
|
387
|
+
#: Nondimensional length of zone of flow establishment (jet core length), defaults to 6.2
|
|
388
|
+
l = Float(6.2, desc='flow establishment length') # noqa: E741
|
|
389
|
+
|
|
385
390
|
# internal identifier
|
|
386
391
|
digest = Property(
|
|
387
|
-
depends_on=['v0', 'origin', 'D'],
|
|
392
|
+
depends_on=['v0', 'origin', 'D', 'l'],
|
|
388
393
|
)
|
|
389
394
|
|
|
390
395
|
@cached_property
|
|
@@ -411,7 +416,7 @@ class OpenJet(FlowField):
|
|
|
411
416
|
"""
|
|
412
417
|
x, y, z = xx - self.origin
|
|
413
418
|
r = sqrt(y * y + z * z)
|
|
414
|
-
x1 = 0.
|
|
419
|
+
x1 = 0.5022 / self.l * x # C2 in Albertson1950
|
|
415
420
|
h1 = r + x1 - 0.5 * self.D
|
|
416
421
|
U = self.v0 * exp(-h1 * h1 / (2 * x1 * x1))
|
|
417
422
|
if h1 < 0.0:
|
|
@@ -497,7 +502,7 @@ class RotatingFlow(FlowField):
|
|
|
497
502
|
return v, dv
|
|
498
503
|
|
|
499
504
|
|
|
500
|
-
def spiral_sphere(N, Om=None, b=None): # change to 4*pi
|
|
505
|
+
def spiral_sphere(N, Om=None, b=None): # noqa: N803 # change to 4*pi
|
|
501
506
|
"""Internal helper function for the raycasting that returns an array of
|
|
502
507
|
unit vectors (N, 3) giving equally distributed directions on a part of
|
|
503
508
|
sphere given by the center direction b and the solid angle Om.
|
|
@@ -589,8 +594,6 @@ class GeneralFlowEnvironment(Environment):
|
|
|
589
594
|
gt = empty((gpos.shape[-1], mpos.shape[-1]))
|
|
590
595
|
for micnum, x0 in enumerate(mpos.T):
|
|
591
596
|
key = x0.tobytes() # make array hashable
|
|
592
|
-
# TODO: the interpolator also depends the roi, so idict keys should also depend on roi
|
|
593
|
-
# OR the idict should be cleaned if roi changes
|
|
594
597
|
try:
|
|
595
598
|
li = self.idict[key] # fetch stored interpolator
|
|
596
599
|
except KeyError:
|
|
@@ -8,9 +8,9 @@ computational costs. All functionalities are optimized via NUMBA.
|
|
|
8
8
|
import numba as nb
|
|
9
9
|
import numpy as np
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
CACHED_OPTION = True # if True: saves the numba func as compiled func in sub directory
|
|
12
|
+
PARALLEL_OPTION = 'parallel' # if numba.guvectorize is used: 'CPU' for single threading; 'parallel' for multithreading; 'cuda' for calculating on GPU
|
|
13
|
+
FAST_OPTION = True # fastmath options
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
# Formerly known as 'faverage'
|
|
@@ -19,9 +19,9 @@ fastOption = True # fastmath options
|
|
|
19
19
|
nb.complex128[:, :, ::1](nb.complex128[:, :, ::1], nb.complex128[:, ::1]),
|
|
20
20
|
nb.complex64[:, :, ::1](nb.complex64[:, :, ::1], nb.complex64[:, ::1]),
|
|
21
21
|
],
|
|
22
|
-
cache=
|
|
22
|
+
cache=CACHED_OPTION,
|
|
23
23
|
parallel=True,
|
|
24
|
-
fastmath=
|
|
24
|
+
fastmath=FAST_OPTION,
|
|
25
25
|
)
|
|
26
26
|
def calcCSM(csm, SpecAllMics):
|
|
27
27
|
"""Adds a given spectrum to the Cross-Spectral-Matrix (CSM).
|
|
@@ -216,7 +216,7 @@ def beamformerFreq(steerVecType, boolRemovedDiagOfCSM, normFactor, inputTupleSte
|
|
|
216
216
|
nb.float64[::1],
|
|
217
217
|
),
|
|
218
218
|
],
|
|
219
|
-
cache=
|
|
219
|
+
cache=CACHED_OPTION,
|
|
220
220
|
parallel=True,
|
|
221
221
|
error_model='numpy',
|
|
222
222
|
)
|
|
@@ -306,7 +306,7 @@ def _freqBeamformer_FullCSM(
|
|
|
306
306
|
nb.float64[::1],
|
|
307
307
|
),
|
|
308
308
|
],
|
|
309
|
-
cache=
|
|
309
|
+
cache=CACHED_OPTION,
|
|
310
310
|
parallel=True,
|
|
311
311
|
error_model='numpy',
|
|
312
312
|
)
|
|
@@ -389,9 +389,9 @@ def _freqBeamformer_EigValues(
|
|
|
389
389
|
[(nb.complex128[:, :], nb.complex128[:], nb.float64[:], nb.float64[:], nb.float64[:])],
|
|
390
390
|
'(m,m),(m),()->(),()',
|
|
391
391
|
nopython=True,
|
|
392
|
-
target=
|
|
393
|
-
cache=
|
|
394
|
-
fastmath=
|
|
392
|
+
target=PARALLEL_OPTION,
|
|
393
|
+
cache=CACHED_OPTION,
|
|
394
|
+
fastmath=FAST_OPTION,
|
|
395
395
|
)
|
|
396
396
|
def _freqBeamformer_SpecificSteerVec_FullCSM(csm, steerVec, signalLossNormalization, result, normalizeSteer):
|
|
397
397
|
# see bottom of information header of 'beamformerFreq' for information on which steps are taken, in order to gain speed improvements.
|
|
@@ -419,9 +419,9 @@ def _freqBeamformer_SpecificSteerVec_FullCSM(csm, steerVec, signalLossNormalizat
|
|
|
419
419
|
[(nb.complex128[:, :], nb.complex128[:], nb.float64[:], nb.float64[:], nb.float64[:])],
|
|
420
420
|
'(m,m),(m),()->(),()',
|
|
421
421
|
nopython=True,
|
|
422
|
-
target=
|
|
423
|
-
cache=
|
|
424
|
-
fastmath=
|
|
422
|
+
target=PARALLEL_OPTION,
|
|
423
|
+
cache=CACHED_OPTION,
|
|
424
|
+
fastmath=FAST_OPTION,
|
|
425
425
|
)
|
|
426
426
|
def _freqBeamformer_SpecificSteerVec_CsmRemovedDiag(csm, steerVec, signalLossNormalization, result, normalizeSteer):
|
|
427
427
|
# see bottom of information header of 'beamformerFreq' for information on which steps are taken, in order to gain speed improvements.
|
|
@@ -446,9 +446,9 @@ def _freqBeamformer_SpecificSteerVec_CsmRemovedDiag(csm, steerVec, signalLossNor
|
|
|
446
446
|
[(nb.float64[:], nb.complex128[:, :], nb.complex128[:], nb.float64[:], nb.float64[:], nb.float64[:])],
|
|
447
447
|
'(e),(m,e),(m),()->(),()',
|
|
448
448
|
nopython=True,
|
|
449
|
-
target=
|
|
450
|
-
cache=
|
|
451
|
-
fastmath=
|
|
449
|
+
target=PARALLEL_OPTION,
|
|
450
|
+
cache=CACHED_OPTION,
|
|
451
|
+
fastmath=FAST_OPTION,
|
|
452
452
|
)
|
|
453
453
|
def _freqBeamformer_EigValProb_SpecificSteerVec_FullCSM(
|
|
454
454
|
eigVal,
|
|
@@ -482,9 +482,9 @@ def _freqBeamformer_EigValProb_SpecificSteerVec_FullCSM(
|
|
|
482
482
|
[(nb.float64[:], nb.complex128[:, :], nb.complex128[:], nb.float64[:], nb.float64[:], nb.float64[:])],
|
|
483
483
|
'(e),(m,e),(m),()->(),()',
|
|
484
484
|
nopython=True,
|
|
485
|
-
target=
|
|
486
|
-
cache=
|
|
487
|
-
fastmath=
|
|
485
|
+
target=PARALLEL_OPTION,
|
|
486
|
+
cache=CACHED_OPTION,
|
|
487
|
+
fastmath=FAST_OPTION,
|
|
488
488
|
)
|
|
489
489
|
def _freqBeamformer_EigValProb_SpecificSteerVec_CsmRemovedDiag(
|
|
490
490
|
eigVal,
|
|
@@ -599,12 +599,12 @@ def calcPointSpreadFunction(steerVecType, distGridToArrayCenter, distGridToAllMi
|
|
|
599
599
|
],
|
|
600
600
|
'(),(m),(s),(s,m),()->(s)',
|
|
601
601
|
nopython=True,
|
|
602
|
-
target=
|
|
603
|
-
cache=
|
|
604
|
-
fastmath=
|
|
602
|
+
target=PARALLEL_OPTION,
|
|
603
|
+
cache=CACHED_OPTION,
|
|
604
|
+
fastmath=FAST_OPTION,
|
|
605
605
|
)
|
|
606
606
|
def _psf_Formulation1AkaClassic(
|
|
607
|
-
distGridToArrayCenter,
|
|
607
|
+
distGridToArrayCenter, # noqa ARG001
|
|
608
608
|
distGridToAllMics,
|
|
609
609
|
distSourcesToArrayCenter,
|
|
610
610
|
distSourcesToAllMics,
|
|
@@ -632,9 +632,9 @@ def _psf_Formulation1AkaClassic(
|
|
|
632
632
|
],
|
|
633
633
|
'(),(m),(s),(s,m),()->(s)',
|
|
634
634
|
nopython=True,
|
|
635
|
-
target=
|
|
636
|
-
cache=
|
|
637
|
-
fastmath=
|
|
635
|
+
target=PARALLEL_OPTION,
|
|
636
|
+
cache=CACHED_OPTION,
|
|
637
|
+
fastmath=FAST_OPTION,
|
|
638
638
|
)
|
|
639
639
|
def _psf_Formulation2AkaInverse(
|
|
640
640
|
distGridToArrayCenter,
|
|
@@ -669,9 +669,9 @@ def _psf_Formulation2AkaInverse(
|
|
|
669
669
|
],
|
|
670
670
|
'(),(m),(s),(s,m),()->(s)',
|
|
671
671
|
nopython=True,
|
|
672
|
-
target=
|
|
673
|
-
cache=
|
|
674
|
-
fastmath=
|
|
672
|
+
target=PARALLEL_OPTION,
|
|
673
|
+
cache=CACHED_OPTION,
|
|
674
|
+
fastmath=FAST_OPTION,
|
|
675
675
|
)
|
|
676
676
|
def _psf_Formulation3AkaTrueLevel(
|
|
677
677
|
distGridToArrayCenter,
|
|
@@ -708,12 +708,12 @@ def _psf_Formulation3AkaTrueLevel(
|
|
|
708
708
|
],
|
|
709
709
|
'(),(m),(s),(s,m),()->(s)',
|
|
710
710
|
nopython=True,
|
|
711
|
-
target=
|
|
712
|
-
cache=
|
|
713
|
-
fastmath=
|
|
711
|
+
target=PARALLEL_OPTION,
|
|
712
|
+
cache=CACHED_OPTION,
|
|
713
|
+
fastmath=FAST_OPTION,
|
|
714
714
|
)
|
|
715
715
|
def _psf_Formulation4AkaTrueLocation(
|
|
716
|
-
distGridToArrayCenter,
|
|
716
|
+
distGridToArrayCenter, # noqa ARG001
|
|
717
717
|
distGridToAllMics,
|
|
718
718
|
distSourcesToArrayCenter,
|
|
719
719
|
distSourcesToAllMics,
|
|
@@ -743,7 +743,7 @@ def _psf_Formulation4AkaTrueLocation(
|
|
|
743
743
|
# CURRENTLY NOT NEEDED, AS CUSTOM PSF WILL BE CALCULATED IN fbeamform.SteeringVector WITH THE USE OF Trait transfer
|
|
744
744
|
# @nb.guvectorize([(nb.float64[:], nb.float64[:], nb.float64[:], nb.float64[:,:], nb.float64[:], nb.float64[:]),
|
|
745
745
|
# (nb.float64[:], nb.float64[:], nb.float64[:], nb.float64[:,:], nb.float64[:], nb.float32[:])],
|
|
746
|
-
# '(),(m),(s),(s,m),()->(s)', nopython=True, target=
|
|
746
|
+
# '(),(m),(s),(s,m),()->(s)', nopython=True, target=PARALLEL_OPTION, cache=CACHED_OPTION)
|
|
747
747
|
# def _psf_SpecificSteerVec(steerVec, steerVecSources, result):
|
|
748
748
|
# nMics = len(steerVec)
|
|
749
749
|
# for cntSources in range(steerVecSources.shape[0]):
|
|
@@ -765,9 +765,9 @@ def _psf_Formulation4AkaTrueLocation(
|
|
|
765
765
|
],
|
|
766
766
|
'(g,g),(g),(),()->(g)',
|
|
767
767
|
nopython=True,
|
|
768
|
-
target=
|
|
769
|
-
cache=
|
|
770
|
-
fastmath=
|
|
768
|
+
target=PARALLEL_OPTION,
|
|
769
|
+
cache=CACHED_OPTION,
|
|
770
|
+
fastmath=FAST_OPTION,
|
|
771
771
|
)
|
|
772
772
|
def damasSolverGaussSeidel(A, dirtyMap, nIterations, relax, damasSolution):
|
|
773
773
|
"""Solves the DAMAS inverse problem via modified gauss seidel.
|
|
@@ -847,9 +847,9 @@ def calcTransfer(distGridToArrayCenter, distGridToAllMics, waveNumber):
|
|
|
847
847
|
[(nb.float64[:], nb.float64[:], nb.float64[:], nb.complex128[:])],
|
|
848
848
|
'(),(m),()->(m)',
|
|
849
849
|
nopython=True,
|
|
850
|
-
target=
|
|
851
|
-
cache=
|
|
852
|
-
fastmath=
|
|
850
|
+
target=PARALLEL_OPTION,
|
|
851
|
+
cache=CACHED_OPTION,
|
|
852
|
+
fastmath=FAST_OPTION,
|
|
853
853
|
)
|
|
854
854
|
def _transferCoreFunc(distGridToArrayCenter, distGridToAllMics, waveNumber, result):
|
|
855
855
|
nMics = distGridToAllMics.shape[0]
|