acoular 24.10__py3-none-any.whl → 25.1__py3-none-any.whl
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/__init__.py +5 -2
- acoular/aiaa/__init__.py +12 -0
- acoular/{tools → aiaa}/aiaa.py +23 -28
- acoular/base.py +75 -55
- acoular/calib.py +129 -34
- acoular/configuration.py +11 -9
- acoular/demo/__init__.py +1 -0
- acoular/demo/acoular_demo.py +29 -16
- acoular/deprecation.py +85 -0
- acoular/environments.py +31 -19
- acoular/fastFuncs.py +90 -84
- acoular/fbeamform.py +203 -411
- acoular/fprocess.py +49 -41
- acoular/grids.py +101 -143
- acoular/h5cache.py +29 -40
- acoular/h5files.py +2 -6
- acoular/microphones.py +50 -59
- acoular/process.py +366 -59
- acoular/sdinput.py +23 -20
- acoular/signals.py +116 -109
- acoular/sources.py +201 -240
- acoular/spectra.py +53 -229
- acoular/tbeamform.py +79 -202
- acoular/tfastfuncs.py +21 -21
- acoular/tools/__init__.py +2 -8
- acoular/tools/helpers.py +216 -2
- acoular/tools/metrics.py +4 -4
- acoular/tools/utils.py +106 -200
- acoular/tprocess.py +348 -309
- acoular/traitsviews.py +10 -10
- acoular/trajectory.py +7 -10
- acoular/version.py +2 -2
- {acoular-24.10.dist-info → acoular-25.1.dist-info}/METADATA +38 -17
- acoular-25.1.dist-info/RECORD +56 -0
- {acoular-24.10.dist-info → acoular-25.1.dist-info}/WHEEL +1 -1
- acoular-24.10.dist-info/RECORD +0 -54
- {acoular-24.10.dist-info → acoular-25.1.dist-info}/licenses/AUTHORS.rst +0 -0
- {acoular-24.10.dist-info → acoular-25.1.dist-info}/licenses/LICENSE +0 -0
acoular/tbeamform.py
CHANGED
|
@@ -18,7 +18,6 @@
|
|
|
18
18
|
"""
|
|
19
19
|
|
|
20
20
|
# imports from other packages
|
|
21
|
-
from warnings import warn
|
|
22
21
|
|
|
23
22
|
from numpy import (
|
|
24
23
|
arange,
|
|
@@ -38,14 +37,13 @@ from numpy import (
|
|
|
38
37
|
r_,
|
|
39
38
|
s_,
|
|
40
39
|
sqrt,
|
|
41
|
-
sum,
|
|
40
|
+
sum, # noqa: A004
|
|
42
41
|
unique,
|
|
43
42
|
where,
|
|
44
43
|
zeros,
|
|
45
44
|
)
|
|
46
45
|
from scipy.linalg import norm
|
|
47
|
-
from traits.api import Bool, CArray,
|
|
48
|
-
from traits.trait_errors import TraitError
|
|
46
|
+
from traits.api import Bool, CArray, Enum, Float, Instance, Int, List, Map, Property, Range, cached_property
|
|
49
47
|
|
|
50
48
|
from .base import SamplesGenerator, TimeOut
|
|
51
49
|
from .fbeamform import SteeringVector
|
|
@@ -53,8 +51,8 @@ from .grids import RectGrid
|
|
|
53
51
|
|
|
54
52
|
# acoular imports
|
|
55
53
|
from .internal import digest
|
|
54
|
+
from .process import SamplesBuffer
|
|
56
55
|
from .tfastfuncs import _delayandsum4, _delayandsum5, _delays
|
|
57
|
-
from .tools.utils import SamplesBuffer
|
|
58
56
|
from .trajectory import Trajectory
|
|
59
57
|
|
|
60
58
|
|
|
@@ -74,9 +72,8 @@ def const_power_weight(bf):
|
|
|
74
72
|
-------
|
|
75
73
|
array of floats
|
|
76
74
|
The weight factors.
|
|
77
|
-
|
|
78
75
|
"""
|
|
79
|
-
r = bf.steer.env._r(zeros((3, 1)), bf.steer.mics.
|
|
76
|
+
r = bf.steer.env._r(zeros((3, 1)), bf.steer.mics.pos) # distances to center
|
|
80
77
|
# round the relative distances to one decimal place
|
|
81
78
|
r = (r / r.max()).round(decimals=1)
|
|
82
79
|
ru, ind = unique(r, return_inverse=True)
|
|
@@ -103,140 +100,23 @@ class BeamformerTime(TimeOut):
|
|
|
103
100
|
# Instance of :class:`~acoular.fbeamform.SteeringVector` or its derived classes
|
|
104
101
|
# that contains information about the steering vector. This is a private trait.
|
|
105
102
|
# Do not set this directly, use `steer` trait instead.
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
#: :class:`~acoular.fbeamform.SteeringVector` or derived object.
|
|
109
|
-
#: Defaults to :class:`~acoular.fbeamform.SteeringVector` object.
|
|
110
|
-
steer = Property(desc='steering vector object')
|
|
111
|
-
|
|
112
|
-
def _get_steer(self):
|
|
113
|
-
return self._steer_obj
|
|
114
|
-
|
|
115
|
-
def _set_steer(self, steer):
|
|
116
|
-
if type(steer) == SteeringVector:
|
|
117
|
-
# This condition may be replaced at a later time by: isinstance(steer, SteeringVector): -- (derived classes allowed)
|
|
118
|
-
self._steer_obj = steer
|
|
119
|
-
elif steer in ('true level', 'true location', 'classic', 'inverse'):
|
|
120
|
-
# Type of steering vectors, see also :ref:`Sarradj, 2012<Sarradj2012>`.
|
|
121
|
-
msg = (
|
|
122
|
-
"Deprecated use of 'steer' trait. Please use the 'steer' with an object of class "
|
|
123
|
-
"'SteeringVector'. Using a string to specify the steer type will be removed in "
|
|
124
|
-
'version 25.01.'
|
|
125
|
-
)
|
|
126
|
-
warn(
|
|
127
|
-
msg,
|
|
128
|
-
DeprecationWarning,
|
|
129
|
-
stacklevel=2,
|
|
130
|
-
)
|
|
131
|
-
self._steer_obj.steer_type = steer
|
|
132
|
-
else:
|
|
133
|
-
raise (TraitError(args=self, name='steer', info='SteeringVector', value=steer))
|
|
134
|
-
|
|
135
|
-
# --- List of backwards compatibility traits and their setters/getters -----------
|
|
136
|
-
|
|
137
|
-
# :class:`~acoular.environments.Environment` or derived object.
|
|
138
|
-
# Deprecated! Only kept for backwards compatibility.
|
|
139
|
-
# Now governed by :attr:`steer` trait.
|
|
140
|
-
env = Property()
|
|
141
|
-
|
|
142
|
-
def _get_env(self):
|
|
143
|
-
return self._steer_obj.env
|
|
144
|
-
|
|
145
|
-
def _set_env(self, env):
|
|
146
|
-
msg = (
|
|
147
|
-
"Deprecated use of 'env' trait. Please use the 'steer' trait with an object of class "
|
|
148
|
-
"'SteeringVector'. The 'env' trait will be removed in version 25.01."
|
|
149
|
-
)
|
|
150
|
-
warn(msg, DeprecationWarning, stacklevel=2)
|
|
151
|
-
self._steer_obj.env = env
|
|
152
|
-
|
|
153
|
-
# The speed of sound.
|
|
154
|
-
# Deprecated! Only kept for backwards compatibility.
|
|
155
|
-
# Now governed by :attr:`steer` trait.
|
|
156
|
-
c = Property()
|
|
157
|
-
|
|
158
|
-
def _get_c(self):
|
|
159
|
-
return self._steer_obj.env.c
|
|
160
|
-
|
|
161
|
-
def _set_c(self, c):
|
|
162
|
-
msg = (
|
|
163
|
-
"Deprecated use of 'c' trait. Please use the 'steer' trait with an object of class "
|
|
164
|
-
"'SteeringVector'. The 'c' trait will be removed in version 25.01."
|
|
165
|
-
)
|
|
166
|
-
warn(msg, DeprecationWarning, stacklevel=2)
|
|
167
|
-
self._steer_obj.env.c = c
|
|
168
|
-
|
|
169
|
-
# :class:`~acoular.grids.Grid`-derived object that provides the grid locations.
|
|
170
|
-
# Deprecated! Only kept for backwards compatibility.
|
|
171
|
-
# Now governed by :attr:`steer` trait.
|
|
172
|
-
grid = Property()
|
|
173
|
-
|
|
174
|
-
def _get_grid(self):
|
|
175
|
-
return self._steer_obj.grid
|
|
176
|
-
|
|
177
|
-
def _set_grid(self, grid):
|
|
178
|
-
msg = (
|
|
179
|
-
"Deprecated use of 'grid' trait. Please use the 'steer' trait with an object of class "
|
|
180
|
-
"'SteeringVector'. The 'grid' trait will be removed in version 25.01."
|
|
181
|
-
)
|
|
182
|
-
warn(msg, DeprecationWarning, stacklevel=2)
|
|
183
|
-
self._steer_obj.grid = grid
|
|
184
|
-
|
|
185
|
-
# :class:`~acoular.microphones.MicGeom` object that provides the microphone locations.
|
|
186
|
-
# Deprecated! Only kept for backwards compatibility.
|
|
187
|
-
# Now governed by :attr:`steer` trait
|
|
188
|
-
mpos = Property()
|
|
189
|
-
|
|
190
|
-
def _get_mpos(self):
|
|
191
|
-
return self._steer_obj.mics
|
|
192
|
-
|
|
193
|
-
def _set_mpos(self, mpos):
|
|
194
|
-
msg = (
|
|
195
|
-
"Deprecated use of 'mpos' trait. Please use the 'steer' trait with an object of class "
|
|
196
|
-
"'SteeringVector' which has an attribute 'mics'. The 'mpos' trait will be removed in version 25.01."
|
|
197
|
-
)
|
|
198
|
-
warn(msg, DeprecationWarning, stacklevel=2)
|
|
199
|
-
self._steer_obj.mics = mpos
|
|
200
|
-
|
|
201
|
-
# Sound travel distances from microphone array center to grid points (r0)
|
|
202
|
-
# and all array mics to grid points (rm). Readonly.
|
|
203
|
-
# Deprecated! Only kept for backwards compatibility.
|
|
204
|
-
# Now governed by :attr:`steer` trait
|
|
205
|
-
r0 = Property()
|
|
206
|
-
|
|
207
|
-
def _get_r0(self):
|
|
208
|
-
msg = (
|
|
209
|
-
"Deprecated use of 'r0' trait. Please use the 'steer' trait with an object of class "
|
|
210
|
-
"'SteeringVector'. The 'r0' trait will be removed in version 25.01."
|
|
211
|
-
)
|
|
212
|
-
warn(msg, DeprecationWarning, stacklevel=2)
|
|
213
|
-
return self._steer_obj.r0
|
|
214
|
-
|
|
215
|
-
rm = Property()
|
|
216
|
-
|
|
217
|
-
def _get_rm(self):
|
|
218
|
-
msg = (
|
|
219
|
-
"Deprecated use of 'rm' trait. Please use the 'steer' trait with an object of class "
|
|
220
|
-
"'SteeringVector'. The 'rm' trait will be removed in version 25.01."
|
|
221
|
-
)
|
|
222
|
-
warn(msg, DeprecationWarning, stacklevel=2)
|
|
223
|
-
return self._steer_obj.rm
|
|
224
|
-
|
|
225
|
-
# --- End of backwards compatibility traits --------------------------------------
|
|
103
|
+
steer = Instance(SteeringVector, args=())
|
|
226
104
|
|
|
227
105
|
#: Number of channels in output (=number of grid points).
|
|
228
|
-
|
|
106
|
+
num_channels = Property()
|
|
229
107
|
|
|
230
108
|
#: Spatial weighting function.
|
|
231
|
-
weights =
|
|
109
|
+
weights = Map(possible_weights, default_value='none', desc='spatial weighting function')
|
|
232
110
|
# (from timedomain.possible_weights)
|
|
233
111
|
|
|
234
112
|
# internal identifier
|
|
235
113
|
digest = Property(
|
|
236
|
-
depends_on=['
|
|
114
|
+
depends_on=['steer.digest', 'source.digest', 'weights'],
|
|
237
115
|
)
|
|
238
116
|
|
|
239
|
-
|
|
117
|
+
def _get_num_channels(self):
|
|
118
|
+
return self.steer.grid.size
|
|
119
|
+
|
|
240
120
|
def _get_digest(self):
|
|
241
121
|
return digest(self)
|
|
242
122
|
|
|
@@ -258,8 +138,8 @@ class BeamformerTime(TimeOut):
|
|
|
258
138
|
Yields
|
|
259
139
|
------
|
|
260
140
|
numpy.ndarray
|
|
261
|
-
Samples in blocks of shape (num, :attr:`~BeamformerTime.
|
|
262
|
-
:attr:`~BeamformerTime.
|
|
141
|
+
Samples in blocks of shape (num, :attr:`~BeamformerTime.num_channels`).
|
|
142
|
+
:attr:`~BeamformerTime.num_channels` is usually very \
|
|
263
143
|
large (number of grid points).
|
|
264
144
|
The last block returned by the generator may be shorter than num.
|
|
265
145
|
"""
|
|
@@ -267,13 +147,13 @@ class BeamformerTime(TimeOut):
|
|
|
267
147
|
steer_func = self.steer._steer_funcs_time[self.steer.steer_type]
|
|
268
148
|
fdtype = float64
|
|
269
149
|
idtype = int64
|
|
270
|
-
|
|
150
|
+
num_mics = self.steer.mics.num_mics
|
|
271
151
|
n_index = arange(0, num + 1)[:, newaxis]
|
|
272
152
|
c = self.steer.env.c / self.source.sample_freq
|
|
273
|
-
amp = empty((1, self.grid.size,
|
|
274
|
-
# delays = empty((1,self.grid.size,
|
|
275
|
-
d_index = empty((1, self.grid.size,
|
|
276
|
-
d_interp2 = empty((1, self.grid.size,
|
|
153
|
+
amp = empty((1, self.steer.grid.size, num_mics), dtype=fdtype)
|
|
154
|
+
# delays = empty((1,self.steer.grid.size,num_mics),dtype=fdtype)
|
|
155
|
+
d_index = empty((1, self.steer.grid.size, num_mics), dtype=idtype)
|
|
156
|
+
d_interp2 = empty((1, self.steer.grid.size, num_mics), dtype=fdtype)
|
|
277
157
|
steer_func(self.steer.rm[newaxis, :, :], self.steer.r0[newaxis, :], amp)
|
|
278
158
|
_delays(self.steer.rm[newaxis, :, :], c, d_interp2, d_index)
|
|
279
159
|
amp.shape = amp.shape[1:]
|
|
@@ -316,7 +196,7 @@ class BeamformerTime(TimeOut):
|
|
|
316
196
|
imax = argmax(powPhi)
|
|
317
197
|
t_float = d_interp2[imax] + d_index[imax] + n_index
|
|
318
198
|
t_ind = t_float.astype(int64)
|
|
319
|
-
for m in range(
|
|
199
|
+
for m in range(num_mics):
|
|
320
200
|
p_res_copy[t_ind[: num + 1, m], m] -= self.damp * interp(
|
|
321
201
|
t_ind[: num + 1, m],
|
|
322
202
|
t_float[:num, m],
|
|
@@ -346,8 +226,8 @@ class BeamformerTime(TimeOut):
|
|
|
346
226
|
|
|
347
227
|
def _delay_and_sum(self, num, p_res, d_interp2, d_index, amp):
|
|
348
228
|
"""Standard delay-and-sum method."""
|
|
349
|
-
result = empty((num, self.grid.size), dtype=float) # output array
|
|
350
|
-
autopow = empty((num, self.grid.size), dtype=float) # output array
|
|
229
|
+
result = empty((num, self.steer.grid.size), dtype=float) # output array
|
|
230
|
+
autopow = empty((num, self.steer.grid.size), dtype=float) # output array
|
|
351
231
|
_delayandsum4(p_res, d_index, d_interp2, amp, result, autopow)
|
|
352
232
|
return result, autopow
|
|
353
233
|
|
|
@@ -363,7 +243,7 @@ class BeamformerTimeSq(BeamformerTime):
|
|
|
363
243
|
|
|
364
244
|
# internal identifier
|
|
365
245
|
digest = Property(
|
|
366
|
-
depends_on=['
|
|
246
|
+
depends_on=['steer.digest', 'source.digest', 'r_diag', 'weights'],
|
|
367
247
|
)
|
|
368
248
|
|
|
369
249
|
@cached_property
|
|
@@ -385,8 +265,8 @@ class BeamformerTimeSq(BeamformerTime):
|
|
|
385
265
|
Yields
|
|
386
266
|
------
|
|
387
267
|
numpy.ndarray
|
|
388
|
-
Samples in blocks of shape (num, :attr:`~BeamformerTime.
|
|
389
|
-
:attr:`~BeamformerTime.
|
|
268
|
+
Samples in blocks of shape (num, :attr:`~BeamformerTime.num_channels`).
|
|
269
|
+
:attr:`~BeamformerTime.num_channels` is usually very \
|
|
390
270
|
large (number of grid points).
|
|
391
271
|
The last block returned by the generator may be shorter than num.
|
|
392
272
|
"""
|
|
@@ -400,7 +280,7 @@ class BeamformerTimeTraj(BeamformerTime):
|
|
|
400
280
|
|
|
401
281
|
#: :class:`~acoular.trajectory.Trajectory` or derived object.
|
|
402
282
|
#: Start time is assumed to be the same as for the samples.
|
|
403
|
-
trajectory =
|
|
283
|
+
trajectory = Instance(Trajectory, desc='trajectory of the grid center')
|
|
404
284
|
|
|
405
285
|
#: Reference vector, perpendicular to the y-axis of moving grid.
|
|
406
286
|
rvec = CArray(dtype=float, shape=(3,), value=array((0, 0, 0)), desc='reference vector')
|
|
@@ -409,19 +289,18 @@ class BeamformerTimeTraj(BeamformerTime):
|
|
|
409
289
|
conv_amp = Bool(False, desc='determines if convective amplification of source is considered')
|
|
410
290
|
|
|
411
291
|
#: Floating point and integer precision
|
|
412
|
-
precision =
|
|
292
|
+
precision = Enum(64, 32, desc='numeric precision')
|
|
413
293
|
|
|
414
294
|
# internal identifier
|
|
415
295
|
digest = Property(
|
|
416
296
|
depends_on=[
|
|
417
|
-
'
|
|
297
|
+
'steer.digest',
|
|
418
298
|
'source.digest',
|
|
419
299
|
'weights',
|
|
420
300
|
'precision',
|
|
421
301
|
'rvec',
|
|
422
302
|
'conv_amp',
|
|
423
303
|
'trajectory.digest',
|
|
424
|
-
'__class__',
|
|
425
304
|
],
|
|
426
305
|
)
|
|
427
306
|
|
|
@@ -439,7 +318,7 @@ class BeamformerTimeTraj(BeamformerTime):
|
|
|
439
318
|
return array([a[1] * b[2] - a[2] * b[1], a[2] * b[0] - a[0] * b[2], a[0] * b[1] - a[1] * b[0]])
|
|
440
319
|
|
|
441
320
|
start_t = 0.0
|
|
442
|
-
gpos = self.grid.
|
|
321
|
+
gpos = self.steer.grid.pos
|
|
443
322
|
trajg = self.trajectory.traj(start_t, delta_t=1 / self.source.sample_freq)
|
|
444
323
|
trajg1 = self.trajectory.traj(start_t, delta_t=1 / self.source.sample_freq, der=1)
|
|
445
324
|
rflag = (self.rvec == 0).all() # flag translation vs. rotation
|
|
@@ -465,14 +344,14 @@ class BeamformerTimeTraj(BeamformerTime):
|
|
|
465
344
|
vvec = array(g1) # velocity vector
|
|
466
345
|
ma = norm(vvec) / self.steer.env.c # machnumber
|
|
467
346
|
fdv = (vvec / sqrt((vvec * vvec).sum()))[:, newaxis] # unit vecor velocity
|
|
468
|
-
mpos = self.steer.mics.
|
|
347
|
+
mpos = self.steer.mics.pos[:, newaxis, :]
|
|
469
348
|
rmv = tpos[:, :, newaxis] - mpos
|
|
470
349
|
return (ma * sum(rmv.reshape((3, -1)) * fdv, 0) / rm.reshape(-1)).reshape(rm.shape)
|
|
471
350
|
|
|
472
351
|
def get_r0(self, tpos):
|
|
473
352
|
if isscalar(self.steer.ref) and self.steer.ref > 0:
|
|
474
353
|
return self.steer.ref # full((self.steer.grid.size,), self.steer.ref)
|
|
475
|
-
return self.env._r(tpos)
|
|
354
|
+
return self.steer.env._r(tpos)
|
|
476
355
|
|
|
477
356
|
def result(self, num=2048):
|
|
478
357
|
"""Python generator that yields the time-domain beamformer output.
|
|
@@ -489,8 +368,8 @@ class BeamformerTimeTraj(BeamformerTime):
|
|
|
489
368
|
Yields
|
|
490
369
|
------
|
|
491
370
|
numpy.ndarray
|
|
492
|
-
Samples in blocks of shape (num, :attr:`~BeamformerTime.
|
|
493
|
-
:attr:`~BeamformerTime.
|
|
371
|
+
Samples in blocks of shape (num, :attr:`~BeamformerTime.num_channels`).
|
|
372
|
+
:attr:`~BeamformerTime.num_channels` is usually very \
|
|
494
373
|
large (number of grid points).
|
|
495
374
|
The last block returned by the generator may be shorter than num.
|
|
496
375
|
"""
|
|
@@ -503,17 +382,17 @@ class BeamformerTimeTraj(BeamformerTime):
|
|
|
503
382
|
idtype = int32
|
|
504
383
|
w = self._get_weights()
|
|
505
384
|
c = self.steer.env.c / self.source.sample_freq
|
|
506
|
-
|
|
507
|
-
mpos = self.steer.mics.
|
|
508
|
-
m_index = arange(
|
|
385
|
+
num_mics = self.steer.mics.num_mics
|
|
386
|
+
mpos = self.steer.mics.pos.astype(fdtype)
|
|
387
|
+
m_index = arange(num_mics, dtype=idtype)
|
|
509
388
|
n_index = arange(num, dtype=idtype)[:, newaxis]
|
|
510
|
-
blockrm = empty((num, self.grid.size,
|
|
511
|
-
blockrmconv = empty((num, self.grid.size,
|
|
512
|
-
amp = empty((num, self.grid.size,
|
|
513
|
-
# delays = empty((num,self.grid.size,
|
|
514
|
-
d_index = empty((num, self.grid.size,
|
|
515
|
-
d_interp2 = empty((num, self.grid.size,
|
|
516
|
-
blockr0 = empty((num, self.grid.size), dtype=fdtype)
|
|
389
|
+
blockrm = empty((num, self.steer.grid.size, num_mics), dtype=fdtype)
|
|
390
|
+
blockrmconv = empty((num, self.steer.grid.size, num_mics), dtype=fdtype)
|
|
391
|
+
amp = empty((num, self.steer.grid.size, num_mics), dtype=fdtype)
|
|
392
|
+
# delays = empty((num,self.steer.grid.size,num_mics),dtype=fdtype)
|
|
393
|
+
d_index = empty((num, self.steer.grid.size, num_mics), dtype=idtype)
|
|
394
|
+
d_interp2 = empty((num, self.steer.grid.size, num_mics), dtype=fdtype)
|
|
395
|
+
blockr0 = empty((num, self.steer.grid.size), dtype=fdtype)
|
|
517
396
|
movgpos = self._get_moving_gpos() # create moving grid pos generator
|
|
518
397
|
movgspeed = self.trajectory.traj(0.0, delta_t=1 / self.source.sample_freq, der=1)
|
|
519
398
|
weights = self._get_weights()
|
|
@@ -585,7 +464,7 @@ class BeamformerTimeTraj(BeamformerTime):
|
|
|
585
464
|
ind_min = t_float.min(0).astype(idtype)
|
|
586
465
|
# store time history at max power focus point
|
|
587
466
|
h = Phi[:num, imax] * blockr0[:num, imax]
|
|
588
|
-
for m in range(
|
|
467
|
+
for m in range(num_mics):
|
|
589
468
|
# subtract interpolated time history from microphone signals
|
|
590
469
|
p_res[ind_min[m] : ind_max[m], m] -= self.damp * interp(
|
|
591
470
|
t_ind[ind_min[m] : ind_max[m]],
|
|
@@ -617,8 +496,8 @@ class BeamformerTimeTraj(BeamformerTime):
|
|
|
617
496
|
def _delay_and_sum(self, num, p_res, d_interp2, d_index, amp):
|
|
618
497
|
"""Standard delay-and-sum method."""
|
|
619
498
|
fdtype = float64 if self.precision == 64 else float32
|
|
620
|
-
result = empty((num, self.grid.size), dtype=fdtype) # output array
|
|
621
|
-
autopow = empty((num, self.grid.size), dtype=fdtype) # output array
|
|
499
|
+
result = empty((num, self.steer.grid.size), dtype=fdtype) # output array
|
|
500
|
+
autopow = empty((num, self.steer.grid.size), dtype=fdtype) # output array
|
|
622
501
|
_delayandsum5(p_res, d_index, d_interp2, amp, result, autopow)
|
|
623
502
|
return result, autopow
|
|
624
503
|
|
|
@@ -632,7 +511,7 @@ class BeamformerTimeSqTraj(BeamformerTimeSq, BeamformerTimeTraj):
|
|
|
632
511
|
# internal identifier
|
|
633
512
|
digest = Property(
|
|
634
513
|
depends_on=[
|
|
635
|
-
'
|
|
514
|
+
'steer.digest',
|
|
636
515
|
'source.digest',
|
|
637
516
|
'r_diag',
|
|
638
517
|
'weights',
|
|
@@ -640,7 +519,6 @@ class BeamformerTimeSqTraj(BeamformerTimeSq, BeamformerTimeTraj):
|
|
|
640
519
|
'rvec',
|
|
641
520
|
'conv_amp',
|
|
642
521
|
'trajectory.digest',
|
|
643
|
-
'__class__',
|
|
644
522
|
],
|
|
645
523
|
)
|
|
646
524
|
|
|
@@ -663,8 +541,8 @@ class BeamformerTimeSqTraj(BeamformerTimeSq, BeamformerTimeTraj):
|
|
|
663
541
|
Yields
|
|
664
542
|
------
|
|
665
543
|
numpy.ndarray
|
|
666
|
-
Samples in blocks of shape (num, :attr:`~BeamformerTime.
|
|
667
|
-
:attr:`~BeamformerTime.
|
|
544
|
+
Samples in blocks of shape (num, :attr:`~BeamformerTime.num_channels`).
|
|
545
|
+
:attr:`~BeamformerTime.num_channels` is usually very \
|
|
668
546
|
large (number of grid points).
|
|
669
547
|
The last block returned by the generator may be shorter than num.
|
|
670
548
|
"""
|
|
@@ -690,7 +568,7 @@ class BeamformerCleant(BeamformerTime):
|
|
|
690
568
|
|
|
691
569
|
# internal identifier
|
|
692
570
|
digest = Property(
|
|
693
|
-
depends_on=['
|
|
571
|
+
depends_on=['steer.digest', 'source.digest', 'weights', 'damp', 'n_iter'],
|
|
694
572
|
)
|
|
695
573
|
|
|
696
574
|
@cached_property
|
|
@@ -700,7 +578,8 @@ class BeamformerCleant(BeamformerTime):
|
|
|
700
578
|
def result(self, num=2048):
|
|
701
579
|
"""Python generator that yields the deconvolved time-domain beamformer output.
|
|
702
580
|
|
|
703
|
-
The output starts for signals that were emitted from the :class:`~acoular.grids.Grid` at
|
|
581
|
+
The output starts for signals that were emitted from the :class:`~acoular.grids.Grid` at
|
|
582
|
+
`t=0`.
|
|
704
583
|
|
|
705
584
|
Parameters
|
|
706
585
|
----------
|
|
@@ -711,8 +590,8 @@ class BeamformerCleant(BeamformerTime):
|
|
|
711
590
|
Yields
|
|
712
591
|
------
|
|
713
592
|
numpy.ndarray
|
|
714
|
-
Samples in blocks of shape (num, :attr:`~BeamformerTime.
|
|
715
|
-
:attr:`~BeamformerTime.
|
|
593
|
+
Samples in blocks of shape (num, :attr:`~BeamformerTime.num_channels`).
|
|
594
|
+
:attr:`~BeamformerTime.num_channels` is usually very \
|
|
716
595
|
large (number of grid points).
|
|
717
596
|
The last block returned by the generator may be shorter than num.
|
|
718
597
|
"""
|
|
@@ -732,7 +611,7 @@ class BeamformerCleantSq(BeamformerCleant):
|
|
|
732
611
|
|
|
733
612
|
# internal identifier
|
|
734
613
|
digest = Property(
|
|
735
|
-
depends_on=['
|
|
614
|
+
depends_on=['steer.digest', 'source.digest', 'weights', 'damp', 'n_iter', 'r_diag'],
|
|
736
615
|
)
|
|
737
616
|
|
|
738
617
|
@cached_property
|
|
@@ -742,9 +621,9 @@ class BeamformerCleantSq(BeamformerCleant):
|
|
|
742
621
|
def result(self, num=2048):
|
|
743
622
|
"""Python generator that yields the *squared* deconvolved time-domain beamformer output.
|
|
744
623
|
|
|
745
|
-
The output starts for signals that were emitted from the :class:`~acoular.grids.Grid` at
|
|
746
|
-
Per default, block-wise removal of autocorrelation is performed, which can be turned
|
|
747
|
-
:attr:`r_diag` to `False`.
|
|
624
|
+
The output starts for signals that were emitted from the :class:`~acoular.grids.Grid` at
|
|
625
|
+
`t=0`. Per default, block-wise removal of autocorrelation is performed, which can be turned
|
|
626
|
+
of by setting :attr:`r_diag` to `False`.
|
|
748
627
|
|
|
749
628
|
Parameters
|
|
750
629
|
----------
|
|
@@ -755,8 +634,8 @@ class BeamformerCleantSq(BeamformerCleant):
|
|
|
755
634
|
Yields
|
|
756
635
|
------
|
|
757
636
|
numpy.ndarray
|
|
758
|
-
Samples in blocks of shape (num, :attr:`~BeamformerTime.
|
|
759
|
-
:attr:`~BeamformerTime.
|
|
637
|
+
Samples in blocks of shape (num, :attr:`~BeamformerTime.num_channels`).
|
|
638
|
+
:attr:`~BeamformerTime.num_channels` is usually very \
|
|
760
639
|
large (number of grid points).
|
|
761
640
|
The last block returned by the generator may be shorter than num.
|
|
762
641
|
"""
|
|
@@ -771,16 +650,15 @@ class BeamformerCleantTraj(BeamformerCleant, BeamformerTimeTraj):
|
|
|
771
650
|
"""
|
|
772
651
|
|
|
773
652
|
#: Floating point and integer precision
|
|
774
|
-
precision =
|
|
653
|
+
precision = Enum(32, 64, desc='numeric precision')
|
|
775
654
|
|
|
776
655
|
# internal identifier
|
|
777
656
|
digest = Property(
|
|
778
657
|
depends_on=[
|
|
779
|
-
'
|
|
658
|
+
'steer.digest',
|
|
780
659
|
'source.digest',
|
|
781
660
|
'weights',
|
|
782
661
|
'precision',
|
|
783
|
-
'__class__',
|
|
784
662
|
'damp',
|
|
785
663
|
'n_iter',
|
|
786
664
|
'rvec',
|
|
@@ -796,7 +674,8 @@ class BeamformerCleantTraj(BeamformerCleant, BeamformerTimeTraj):
|
|
|
796
674
|
def result(self, num=2048):
|
|
797
675
|
"""Python generator that yields the deconvolved time-domain beamformer output.
|
|
798
676
|
|
|
799
|
-
The output starts for signals that were emitted from the :class:`~acoular.grids.Grid` at
|
|
677
|
+
The output starts for signals that were emitted from the :class:`~acoular.grids.Grid` at
|
|
678
|
+
`t=0`.
|
|
800
679
|
|
|
801
680
|
Parameters
|
|
802
681
|
----------
|
|
@@ -807,8 +686,8 @@ class BeamformerCleantTraj(BeamformerCleant, BeamformerTimeTraj):
|
|
|
807
686
|
Yields
|
|
808
687
|
------
|
|
809
688
|
numpy.ndarray
|
|
810
|
-
Samples in blocks of shape (num, :attr:`~BeamformerTime.
|
|
811
|
-
:attr:`~BeamformerTime.
|
|
689
|
+
Samples in blocks of shape (num, :attr:`~BeamformerTime.num_channels`).
|
|
690
|
+
:attr:`~BeamformerTime.num_channels` is usually very \
|
|
812
691
|
large (number of grid points).
|
|
813
692
|
The last block returned by the generator may be shorter than num.
|
|
814
693
|
"""
|
|
@@ -829,11 +708,10 @@ class BeamformerCleantSqTraj(BeamformerCleantTraj, BeamformerTimeSq):
|
|
|
829
708
|
# internal identifier
|
|
830
709
|
digest = Property(
|
|
831
710
|
depends_on=[
|
|
832
|
-
'
|
|
711
|
+
'steer.digest',
|
|
833
712
|
'source.digest',
|
|
834
713
|
'weights',
|
|
835
714
|
'precision',
|
|
836
|
-
'__class__',
|
|
837
715
|
'damp',
|
|
838
716
|
'n_iter',
|
|
839
717
|
'rvec',
|
|
@@ -850,9 +728,9 @@ class BeamformerCleantSqTraj(BeamformerCleantTraj, BeamformerTimeSq):
|
|
|
850
728
|
def result(self, num=2048):
|
|
851
729
|
"""Python generator that yields the *squared* deconvolved time-domain beamformer output.
|
|
852
730
|
|
|
853
|
-
The output starts for signals that were emitted from the :class:`~acoular.grids.Grid` at
|
|
854
|
-
Per default, block-wise removal of autocorrelation is performed, which can be turned
|
|
855
|
-
:attr:`r_diag` to `False`.
|
|
731
|
+
The output starts for signals that were emitted from the :class:`~acoular.grids.Grid` at
|
|
732
|
+
`t=0`. Per default, block-wise removal of autocorrelation is performed, which can be turned
|
|
733
|
+
of by setting :attr:`r_diag` to `False`.
|
|
856
734
|
|
|
857
735
|
Parameters
|
|
858
736
|
----------
|
|
@@ -863,8 +741,8 @@ class BeamformerCleantSqTraj(BeamformerCleantTraj, BeamformerTimeSq):
|
|
|
863
741
|
Yields
|
|
864
742
|
------
|
|
865
743
|
numpy.ndarray
|
|
866
|
-
Samples in blocks of shape (num, :attr:`~BeamformerTime.
|
|
867
|
-
:attr:`~BeamformerTime.
|
|
744
|
+
Samples in blocks of shape (num, :attr:`~BeamformerTime.num_channels`).
|
|
745
|
+
:attr:`~BeamformerTime.num_channels` is usually very \
|
|
868
746
|
large (number of grid points).
|
|
869
747
|
The last block returned by the generator may be shorter than num.
|
|
870
748
|
"""
|
|
@@ -878,20 +756,20 @@ class IntegratorSectorTime(TimeOut):
|
|
|
878
756
|
source = Instance(SamplesGenerator)
|
|
879
757
|
|
|
880
758
|
#: :class:`~acoular.grids.RectGrid` object that provides the grid locations.
|
|
881
|
-
grid =
|
|
759
|
+
grid = Instance(RectGrid, desc='beamforming grid')
|
|
882
760
|
|
|
883
761
|
#: List of sectors in grid
|
|
884
762
|
sectors = List()
|
|
885
763
|
|
|
886
|
-
#: Clipping, in
|
|
764
|
+
#: Clipping, in Decibel relative to maximum (negative values)
|
|
887
765
|
clip = Float(-350.0)
|
|
888
766
|
|
|
889
767
|
#: Number of channels in output (= number of sectors).
|
|
890
|
-
|
|
768
|
+
num_channels = Property(depends_on=['sectors'])
|
|
891
769
|
|
|
892
770
|
# internal identifier
|
|
893
771
|
digest = Property(
|
|
894
|
-
depends_on=['sectors', 'clip', 'grid.digest', 'source.digest'
|
|
772
|
+
depends_on=['sectors', 'clip', 'grid.digest', 'source.digest'],
|
|
895
773
|
)
|
|
896
774
|
|
|
897
775
|
@cached_property
|
|
@@ -899,7 +777,7 @@ class IntegratorSectorTime(TimeOut):
|
|
|
899
777
|
return digest(self)
|
|
900
778
|
|
|
901
779
|
@cached_property
|
|
902
|
-
def
|
|
780
|
+
def _get_num_channels(self):
|
|
903
781
|
return len(self.sectors)
|
|
904
782
|
|
|
905
783
|
def result(self, num=1):
|
|
@@ -914,14 +792,13 @@ class IntegratorSectorTime(TimeOut):
|
|
|
914
792
|
|
|
915
793
|
Returns
|
|
916
794
|
-------
|
|
917
|
-
Samples in blocks of shape (num, :attr:`
|
|
918
|
-
:attr:`
|
|
795
|
+
Samples in blocks of shape (num, :attr:`num_channels`).
|
|
796
|
+
:attr:`num_channels` is the number of sectors.
|
|
919
797
|
The last block may be shorter than num.
|
|
920
|
-
|
|
921
798
|
"""
|
|
922
799
|
inds = [self.grid.indices(*sector) for sector in self.sectors]
|
|
923
800
|
gshape = self.grid.shape
|
|
924
|
-
o = empty((num, self.
|
|
801
|
+
o = empty((num, self.num_channels), dtype=float) # output array
|
|
925
802
|
for r in self.source.result(num):
|
|
926
803
|
ns = r.shape[0]
|
|
927
804
|
mapshape = (ns,) + gshape
|