acoular 24.5__py3-none-any.whl → 24.10__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 +17 -11
- acoular/base.py +312 -0
- acoular/configuration.py +23 -16
- acoular/demo/acoular_demo.py +28 -35
- acoular/environments.py +20 -15
- acoular/fastFuncs.py +40 -40
- acoular/fbeamform.py +1100 -1130
- acoular/fprocess.py +368 -0
- acoular/grids.py +36 -22
- acoular/h5cache.py +34 -34
- acoular/h5files.py +13 -13
- acoular/internal.py +3 -3
- acoular/process.py +464 -0
- acoular/sdinput.py +24 -4
- acoular/signals.py +20 -6
- acoular/sources.py +140 -56
- acoular/spectra.py +34 -53
- acoular/tbeamform.py +264 -142
- acoular/tfastfuncs.py +17 -18
- acoular/tools/__init__.py +2 -0
- acoular/tools/aiaa.py +7 -8
- acoular/tools/helpers.py +2 -2
- acoular/tools/metrics.py +1 -1
- acoular/tools/utils.py +210 -0
- acoular/tprocess.py +168 -532
- acoular/traitsviews.py +5 -3
- acoular/version.py +2 -2
- {acoular-24.5.dist-info → acoular-24.10.dist-info}/METADATA +49 -8
- acoular-24.10.dist-info/RECORD +54 -0
- {acoular-24.5.dist-info → acoular-24.10.dist-info}/WHEEL +1 -1
- acoular-24.5.dist-info/RECORD +0 -50
- {acoular-24.5.dist-info → acoular-24.10.dist-info}/licenses/AUTHORS.rst +0 -0
- {acoular-24.5.dist-info → acoular-24.10.dist-info}/licenses/LICENSE +0 -0
acoular/environments.py
CHANGED
|
@@ -43,9 +43,9 @@ from numpy import (
|
|
|
43
43
|
vstack,
|
|
44
44
|
zeros_like,
|
|
45
45
|
)
|
|
46
|
-
from numpy.linalg.linalg import norm
|
|
47
46
|
from scipy.integrate import ode
|
|
48
47
|
from scipy.interpolate import LinearNDInterpolator
|
|
48
|
+
from scipy.linalg import norm
|
|
49
49
|
from scipy.spatial import ConvexHull
|
|
50
50
|
from traits.api import CArray, Dict, Float, HasPrivateTraits, Int, Property, Trait, cached_property
|
|
51
51
|
|
|
@@ -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.
|
|
@@ -283,8 +283,9 @@ class FlowField(HasPrivateTraits):
|
|
|
283
283
|
|
|
284
284
|
|
|
285
285
|
class SlotJet(FlowField):
|
|
286
|
-
"""Provides an analytical approximation of the flow field of a slot jet
|
|
287
|
-
|
|
286
|
+
"""Provides an analytical approximation of the flow field of a slot jet.
|
|
287
|
+
|
|
288
|
+
See :cite:`Albertson1950` for details.
|
|
288
289
|
"""
|
|
289
290
|
|
|
290
291
|
#: Exit velocity at jet origin, i.e. the nozzle. Defaults to 0.
|
|
@@ -303,9 +304,12 @@ class SlotJet(FlowField):
|
|
|
303
304
|
#: Width of the slot, defaults to 0.2 .
|
|
304
305
|
B = Float(0.2, desc='nozzle diameter')
|
|
305
306
|
|
|
307
|
+
#: Nondimensional length of zone of flow establishment (jet core length), defaults to 5.2
|
|
308
|
+
l = Float(5.2, desc='flow establishment length') # noqa: E741
|
|
309
|
+
|
|
306
310
|
# internal identifier
|
|
307
311
|
digest = Property(
|
|
308
|
-
depends_on=['v0', 'origin', 'flow', 'plane', 'B'],
|
|
312
|
+
depends_on=['v0', 'origin', 'flow', 'plane', 'B', 'l'],
|
|
309
313
|
)
|
|
310
314
|
|
|
311
315
|
@cached_property
|
|
@@ -330,7 +334,6 @@ class SlotJet(FlowField):
|
|
|
330
334
|
given location.
|
|
331
335
|
|
|
332
336
|
"""
|
|
333
|
-
# TODO: better to make sure that self.flow and self.plane are indeed unit vectors before
|
|
334
337
|
# normalize
|
|
335
338
|
flow = self.flow / norm(self.flow)
|
|
336
339
|
plane = self.plane / norm(self.plane)
|
|
@@ -342,7 +345,7 @@ class SlotJet(FlowField):
|
|
|
342
345
|
# local co-ordinate system
|
|
343
346
|
x = dot(flow, xx1)
|
|
344
347
|
y = dot(yy, xx1)
|
|
345
|
-
x1 = 0.
|
|
348
|
+
x1 = 0.5668 / self.l * x # C1 in Albertson1950
|
|
346
349
|
h1 = abs(y) + sqrt(pi) * 0.5 * x1 - 0.5 * self.B
|
|
347
350
|
if h1 < 0.0:
|
|
348
351
|
# core jet
|
|
@@ -362,8 +365,9 @@ class SlotJet(FlowField):
|
|
|
362
365
|
|
|
363
366
|
|
|
364
367
|
class OpenJet(FlowField):
|
|
365
|
-
"""Provides an analytical approximation of the flow field of an open jet
|
|
366
|
-
|
|
368
|
+
"""Provides an analytical approximation of the flow field of an open jet.
|
|
369
|
+
|
|
370
|
+
See :cite:`Albertson1950` for details.
|
|
367
371
|
|
|
368
372
|
Notes
|
|
369
373
|
-----
|
|
@@ -382,9 +386,12 @@ class OpenJet(FlowField):
|
|
|
382
386
|
#: Diameter of the nozzle, defaults to 0.2 .
|
|
383
387
|
D = Float(0.2, desc='nozzle diameter')
|
|
384
388
|
|
|
389
|
+
#: Nondimensional length of zone of flow establishment (jet core length), defaults to 6.2
|
|
390
|
+
l = Float(6.2, desc='flow establishment length') # noqa: E741
|
|
391
|
+
|
|
385
392
|
# internal identifier
|
|
386
393
|
digest = Property(
|
|
387
|
-
depends_on=['v0', 'origin', 'D'],
|
|
394
|
+
depends_on=['v0', 'origin', 'D', 'l'],
|
|
388
395
|
)
|
|
389
396
|
|
|
390
397
|
@cached_property
|
|
@@ -411,7 +418,7 @@ class OpenJet(FlowField):
|
|
|
411
418
|
"""
|
|
412
419
|
x, y, z = xx - self.origin
|
|
413
420
|
r = sqrt(y * y + z * z)
|
|
414
|
-
x1 = 0.
|
|
421
|
+
x1 = 0.5022 / self.l * x # C2 in Albertson1950
|
|
415
422
|
h1 = r + x1 - 0.5 * self.D
|
|
416
423
|
U = self.v0 * exp(-h1 * h1 / (2 * x1 * x1))
|
|
417
424
|
if h1 < 0.0:
|
|
@@ -497,7 +504,7 @@ class RotatingFlow(FlowField):
|
|
|
497
504
|
return v, dv
|
|
498
505
|
|
|
499
506
|
|
|
500
|
-
def spiral_sphere(N, Om=None, b=None): # change to 4*pi
|
|
507
|
+
def spiral_sphere(N, Om=None, b=None): # noqa: N803 # change to 4*pi
|
|
501
508
|
"""Internal helper function for the raycasting that returns an array of
|
|
502
509
|
unit vectors (N, 3) giving equally distributed directions on a part of
|
|
503
510
|
sphere given by the center direction b and the solid angle Om.
|
|
@@ -589,8 +596,6 @@ class GeneralFlowEnvironment(Environment):
|
|
|
589
596
|
gt = empty((gpos.shape[-1], mpos.shape[-1]))
|
|
590
597
|
for micnum, x0 in enumerate(mpos.T):
|
|
591
598
|
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
599
|
try:
|
|
595
600
|
li = self.idict[key] # fetch stored interpolator
|
|
596
601
|
except KeyError:
|
acoular/fastFuncs.py
CHANGED
|
@@ -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]
|