acoular 23.6__py3-none-any.whl → 24.3__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 +2 -2
- acoular/configuration.py +37 -1
- acoular/environments.py +15 -9
- acoular/fastFuncs.py +199 -472
- acoular/fbeamform.py +168 -109
- acoular/grids.py +33 -114
- acoular/sources.py +77 -3
- acoular/spectra.py +2 -2
- acoular/tbeamform.py +15 -8
- acoular/tests/reference_data/BeamformerBaseFalse1.npy +0 -0
- acoular/tests/reference_data/BeamformerBaseFalse2.npy +0 -0
- acoular/tests/reference_data/BeamformerBaseFalse3.npy +0 -0
- acoular/tests/reference_data/BeamformerBaseFalse4.npy +0 -0
- acoular/tests/reference_data/BeamformerBaseTrue1.npy +0 -0
- acoular/tests/reference_data/BeamformerBaseTrue2.npy +0 -0
- acoular/tests/reference_data/BeamformerBaseTrue3.npy +0 -0
- acoular/tests/reference_data/BeamformerBaseTrue4.npy +0 -0
- acoular/tests/reference_data/BeamformerCMFLassoLarsBIC.npy +0 -0
- acoular/tests/reference_data/BeamformerCMFNNLS.npy +0 -0
- acoular/tests/reference_data/BeamformerCleantSqTraj.npy +0 -0
- acoular/tests/reference_data/BeamformerCleantTraj.npy +0 -0
- acoular/tests/reference_data/BeamformerEigFalse1.npy +0 -0
- acoular/tests/reference_data/BeamformerEigFalse2.npy +0 -0
- acoular/tests/reference_data/BeamformerEigFalse3.npy +0 -0
- acoular/tests/reference_data/BeamformerEigFalse4.npy +0 -0
- acoular/tests/reference_data/BeamformerEigTrue1.npy +0 -0
- acoular/tests/reference_data/BeamformerEigTrue2.npy +0 -0
- acoular/tests/reference_data/BeamformerEigTrue3.npy +0 -0
- acoular/tests/reference_data/BeamformerEigTrue4.npy +0 -0
- acoular/tests/reference_data/BeamformerGIB.npy +0 -0
- acoular/tests/reference_data/BeamformerSODIX.npy +0 -0
- acoular/tests/reference_data/FiltFiltOctave__.npy +0 -0
- acoular/tests/reference_data/FiltFiltOctave_band_100_0_fraction_Thirdoctave_.npy +0 -0
- acoular/tests/reference_data/FiltFreqWeight_weight_A_.npy +0 -0
- acoular/tests/reference_data/FiltFreqWeight_weight_C_.npy +0 -0
- acoular/tests/reference_data/FiltFreqWeight_weight_Z_.npy +0 -0
- acoular/tests/reference_data/FiltOctave__.npy +0 -0
- acoular/tests/reference_data/FiltOctave_band_100_0_fraction_Thirdoctave_.npy +0 -0
- acoular/tests/reference_data/Filter__.npy +0 -0
- acoular/tests/reference_data/OctaveFilterBank__.npy +0 -0
- acoular/tests/reference_data/TimeAverage__.npy +0 -0
- acoular/tests/reference_data/TimeCumAverage__.npy +0 -0
- acoular/tests/reference_data/TimeExpAverage_weight_F_.npy +0 -0
- acoular/tests/reference_data/TimeExpAverage_weight_I_.npy +0 -0
- acoular/tests/reference_data/TimeExpAverage_weight_S_.npy +0 -0
- acoular/tests/reference_data/TimeInOut__.npy +0 -0
- acoular/tests/reference_data/TimePower__.npy +0 -0
- acoular/tests/reference_data/TimeReverse__.npy +0 -0
- acoular/tests/test_beamformer_results.py +39 -8
- acoular/tests/test_grid.py +92 -0
- acoular/tests/test_integrate.py +102 -0
- acoular/tests/test_tprocess.py +52 -0
- acoular/tests/test_traj_beamformer_results.py +2 -2
- acoular/tfastfuncs.py +24 -25
- acoular/tools.py +144 -2
- acoular/tprocess.py +91 -102
- acoular/version.py +2 -2
- acoular-24.3.dist-info/METADATA +181 -0
- {acoular-23.6.dist-info → acoular-24.3.dist-info}/RECORD +62 -25
- {acoular-23.6.dist-info → acoular-24.3.dist-info}/WHEEL +1 -1
- {acoular-23.6.dist-info → acoular-24.3.dist-info}/licenses/LICENSE +1 -1
- acoular/tests/reference_data/BeamformerCMF.npy +0 -0
- acoular-23.6.dist-info/METADATA +0 -82
- {acoular-23.6.dist-info → acoular-24.3.dist-info}/licenses/AUTHORS.rst +0 -0
acoular/__init__.py
CHANGED
|
@@ -44,14 +44,14 @@ from .microphones import MicGeom
|
|
|
44
44
|
from .spectra import BaseSpectra, FFTSpectra, PowerSpectra, PowerSpectraImport, PowerSpectra as EigSpectra, synthetic
|
|
45
45
|
|
|
46
46
|
from .fbeamform import BeamformerBase, BeamformerCapon, BeamformerEig, \
|
|
47
|
-
BeamformerMusic, BeamformerDamas, BeamformerDamasPlus, BeamformerOrth,BeamformerCleansc, \
|
|
47
|
+
BeamformerMusic, BeamformerDamas, BeamformerDamasPlus, BeamformerOrth, BeamformerCleansc, \
|
|
48
48
|
BeamformerCMF,BeamformerSODIX, BeamformerClean, BeamformerFunctional, BeamformerGIB, L_p, integrate, \
|
|
49
49
|
PointSpreadFunction, SteeringVector, BeamformerAdaptiveGrid, BeamformerGridlessOrth
|
|
50
50
|
|
|
51
51
|
from .sources import PointSource, MovingPointSource, \
|
|
52
52
|
TimeSamples, MaskedTimeSamples, PointSourceDipole, UncorrelatedNoiseSource, \
|
|
53
53
|
SourceMixer, SphericalHarmonicSource, LineSource, MovingPointSourceDipole, \
|
|
54
|
-
MovingLineSource
|
|
54
|
+
MovingLineSource, PointSourceConvolve
|
|
55
55
|
from .signals import SineGenerator, WNoiseGenerator, SignalGenerator,\
|
|
56
56
|
PNoiseGenerator, GenericSignalGenerator, FiltWNoiseGenerator
|
|
57
57
|
|
acoular/configuration.py
CHANGED
|
@@ -12,7 +12,43 @@
|
|
|
12
12
|
config
|
|
13
13
|
"""
|
|
14
14
|
|
|
15
|
-
from os import path, mkdir
|
|
15
|
+
from os import path, mkdir, environ
|
|
16
|
+
from warnings import warn
|
|
17
|
+
import sys
|
|
18
|
+
|
|
19
|
+
# When numpy is using OpenBLAS then it runs with OPENBLAS_NUM_THREADS which may lead to
|
|
20
|
+
# overcommittment when called from within numba jitted function that run on
|
|
21
|
+
# NUMBA_NUM_THREADS. If overcommitted, things get extremely! slow. Therefore we make an
|
|
22
|
+
# attempt to avoid this situation. The main problem is that OPENBLAS_NUM_THREADS is
|
|
23
|
+
# only respected once numpy starts. Later on, it cannot be changed.
|
|
24
|
+
|
|
25
|
+
# we check if numpy already loaded
|
|
26
|
+
if 'numpy' in sys.modules:
|
|
27
|
+
# numpy is loaded
|
|
28
|
+
# temporarily route stdout to string
|
|
29
|
+
import io
|
|
30
|
+
import numpy
|
|
31
|
+
orig_stdout = sys.stdout
|
|
32
|
+
temp_stdout = io.StringIO()
|
|
33
|
+
sys.stdout = temp_stdout
|
|
34
|
+
numpy.show_config()
|
|
35
|
+
sys.stdout = orig_stdout
|
|
36
|
+
# check if it uses OpenBLAS or another library
|
|
37
|
+
if 'openblas' in temp_stdout.getvalue().lower():
|
|
38
|
+
# it's OpenBLAS, set numba threads=1 to avoid overcommittment
|
|
39
|
+
import numba
|
|
40
|
+
numba.set_num_threads(1)
|
|
41
|
+
warn("We detected that Numpy is already loaded and uses OpenBLAS. Because "
|
|
42
|
+
"this conflicts with Numba parallel execution, we disable parallel "
|
|
43
|
+
"execution for now and processing might be slower. To speed up, "
|
|
44
|
+
"either import Numpy after Acoular or set environment variable "
|
|
45
|
+
"OPENBLAS_NUM_THREADS=1 before start of the program.",
|
|
46
|
+
UserWarning, stacklevel = 2)
|
|
47
|
+
else:
|
|
48
|
+
# numpy is not loaded
|
|
49
|
+
environ['OPENBLAS_NUM_THREADS'] = "1"
|
|
50
|
+
|
|
51
|
+
# this loads numpy, so we have to defer loading until OpenBLAS check is done
|
|
16
52
|
from traits.api import Trait, Bool, Str, Property, HasStrictTraits
|
|
17
53
|
|
|
18
54
|
class Config(HasStrictTraits):
|
acoular/environments.py
CHANGED
|
@@ -18,9 +18,9 @@
|
|
|
18
18
|
|
|
19
19
|
"""
|
|
20
20
|
import numba as nb
|
|
21
|
-
from numpy import array, isscalar, float32, float64, newaxis,
|
|
21
|
+
from numpy import array, isscalar, float32, float64, newaxis, \
|
|
22
22
|
sqrt, arange, pi, exp, sin, cos, arccos, zeros_like, empty, dot, hstack, \
|
|
23
|
-
vstack, identity, cross, sign, arctan2, matmul, sum,
|
|
23
|
+
vstack, identity, cross, sign, arctan2, matmul, sum, ascontiguousarray
|
|
24
24
|
from numpy.linalg.linalg import norm
|
|
25
25
|
from scipy.integrate import ode
|
|
26
26
|
from scipy.interpolate import LinearNDInterpolator
|
|
@@ -28,10 +28,10 @@ from scipy.spatial import ConvexHull
|
|
|
28
28
|
from traits.api import HasPrivateTraits, Float, Property, Int, \
|
|
29
29
|
CArray, cached_property, Trait, Dict
|
|
30
30
|
|
|
31
|
-
from .internal import digest
|
|
31
|
+
from .internal import digest
|
|
32
32
|
|
|
33
|
-
f64ro = nb.types.Array(nb.types.float64,2,'
|
|
34
|
-
f32ro = nb.types.Array(nb.types.float32,2,'
|
|
33
|
+
f64ro = nb.types.Array(nb.types.float64,2,'C',readonly=True)
|
|
34
|
+
f32ro = nb.types.Array(nb.types.float32,2,'C',readonly=True)
|
|
35
35
|
|
|
36
36
|
@nb.njit([(f64ro, f64ro), (f64ro, f32ro), (f32ro, f64ro),(f32ro, f32ro)],
|
|
37
37
|
cache=True, fastmath=True)
|
|
@@ -47,11 +47,17 @@ def dist_mat(gpos,mpos):
|
|
|
47
47
|
"""
|
|
48
48
|
_,M = mpos.shape
|
|
49
49
|
_,N = gpos.shape
|
|
50
|
-
rm = empty((N,M),dtype=
|
|
50
|
+
rm = empty((N,M),dtype=gpos.dtype)
|
|
51
|
+
TWO = rm.dtype.type(2.0) # make sure to have a float32 or float 64 literal
|
|
52
|
+
m0 = mpos[0]
|
|
53
|
+
m1 = mpos[1]
|
|
54
|
+
m2 = mpos[2]
|
|
51
55
|
for n in range(N):
|
|
52
|
-
|
|
56
|
+
g0 = gpos[0,n]
|
|
57
|
+
g1 = gpos[1,n]
|
|
58
|
+
g2 = gpos[2,n]
|
|
53
59
|
for m in range(M):
|
|
54
|
-
rm[n,m] = sqrt((
|
|
60
|
+
rm[n,m] = sqrt((g0 - m0[m])**TWO + (g1 - m1[m])**TWO + (g2 - m2[m])**TWO)
|
|
55
61
|
return rm
|
|
56
62
|
|
|
57
63
|
|
|
@@ -156,7 +162,7 @@ class Environment( HasPrivateTraits ):
|
|
|
156
162
|
"""
|
|
157
163
|
if isscalar(mpos):
|
|
158
164
|
mpos = array((0, 0, 0), dtype = float64)[:, newaxis]
|
|
159
|
-
rm = dist_mat(gpos,mpos)
|
|
165
|
+
rm = dist_mat(ascontiguousarray(gpos),ascontiguousarray(mpos))
|
|
160
166
|
# mpos = mpos[:, newaxis, :]
|
|
161
167
|
# rmv = gpos[:, :, newaxis]-mpos
|
|
162
168
|
# rm = sum(rmv*rmv, 0)**0.5
|