acoular 24.3__py3-none-any.whl → 24.7__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 +119 -54
- acoular/calib.py +29 -38
- acoular/configuration.py +132 -82
- acoular/demo/__init__.py +10 -4
- acoular/demo/acoular_demo.py +73 -55
- acoular/environments.py +270 -264
- acoular/fastFuncs.py +366 -196
- acoular/fbeamform.py +1797 -1934
- acoular/grids.py +504 -548
- acoular/h5cache.py +74 -83
- acoular/h5files.py +159 -142
- acoular/internal.py +13 -14
- acoular/microphones.py +57 -53
- acoular/sdinput.py +57 -53
- acoular/signals.py +180 -178
- acoular/sources.py +920 -724
- acoular/spectra.py +353 -363
- acoular/tbeamform.py +416 -416
- acoular/tfastfuncs.py +180 -104
- acoular/tools/__init__.py +25 -0
- acoular/tools/aiaa.py +185 -0
- acoular/tools/helpers.py +189 -0
- acoular/tools/metrics.py +165 -0
- acoular/tprocess.py +1240 -1182
- acoular/traitsviews.py +513 -501
- acoular/trajectory.py +50 -52
- acoular/version.py +5 -6
- acoular/xml/minidsp_uma-16.xml +20 -0
- acoular/xml/{minidsp_uma16.xml → minidsp_uma-16_mirrored.xml} +3 -0
- {acoular-24.3.dist-info → acoular-24.7.dist-info}/METADATA +58 -39
- acoular-24.7.dist-info/RECORD +50 -0
- {acoular-24.3.dist-info → acoular-24.7.dist-info}/WHEEL +1 -1
- acoular-24.7.dist-info/licenses/LICENSE +28 -0
- acoular/fileimport.py +0 -380
- acoular/nidaqimport.py +0 -273
- acoular/tests/reference_data/BeamformerBase.npy +0 -0
- 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/BeamformerCapon.npy +0 -0
- acoular/tests/reference_data/BeamformerClean.npy +0 -0
- acoular/tests/reference_data/BeamformerCleansc.npy +0 -0
- acoular/tests/reference_data/BeamformerCleant.npy +0 -0
- acoular/tests/reference_data/BeamformerCleantSq.npy +0 -0
- acoular/tests/reference_data/BeamformerCleantSqTraj.npy +0 -0
- acoular/tests/reference_data/BeamformerCleantTraj.npy +0 -0
- acoular/tests/reference_data/BeamformerDamas.npy +0 -0
- acoular/tests/reference_data/BeamformerDamasPlus.npy +0 -0
- acoular/tests/reference_data/BeamformerEig.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/BeamformerFunctional.npy +0 -0
- acoular/tests/reference_data/BeamformerGIB.npy +0 -0
- acoular/tests/reference_data/BeamformerGridlessOrth.npy +0 -0
- acoular/tests/reference_data/BeamformerMusic.npy +0 -0
- acoular/tests/reference_data/BeamformerOrth.npy +0 -0
- acoular/tests/reference_data/BeamformerSODIX.npy +0 -0
- acoular/tests/reference_data/BeamformerTime.npy +0 -0
- acoular/tests/reference_data/BeamformerTimeSq.npy +0 -0
- acoular/tests/reference_data/BeamformerTimeSqTraj.npy +0 -0
- acoular/tests/reference_data/BeamformerTimeTraj.npy +0 -0
- acoular/tests/reference_data/Environment.npy +0 -0
- acoular/tests/reference_data/Example1_numerical_values_testsum.h5 +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/GeneralFlowEnvironment.npy +0 -0
- acoular/tests/reference_data/OctaveFilterBank__.npy +0 -0
- acoular/tests/reference_data/OpenJet.npy +0 -0
- acoular/tests/reference_data/PointSource.npy +0 -0
- acoular/tests/reference_data/PowerSpectra_csm.npy +0 -0
- acoular/tests/reference_data/PowerSpectra_ev.npy +0 -0
- acoular/tests/reference_data/RotatingFlow.npy +0 -0
- acoular/tests/reference_data/SlotJet.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/reference_data/UniformFlowEnvironment.npy +0 -0
- acoular/tests/reference_data/beamformer_traj_time_data.h5 +0 -0
- acoular/tests/run_tests.sh +0 -18
- acoular/tests/run_tests_osx.sh +0 -16
- acoular/tests/test.npy +0 -0
- acoular/tests/test_beamformer_results.py +0 -213
- acoular/tests/test_classes.py +0 -60
- acoular/tests/test_digest.py +0 -125
- acoular/tests/test_environments.py +0 -73
- acoular/tests/test_example1.py +0 -124
- acoular/tests/test_grid.py +0 -92
- acoular/tests/test_integrate.py +0 -102
- acoular/tests/test_signals.py +0 -60
- acoular/tests/test_sources.py +0 -65
- acoular/tests/test_spectra.py +0 -38
- acoular/tests/test_timecache.py +0 -35
- acoular/tests/test_tprocess.py +0 -90
- acoular/tests/test_traj_beamformer_results.py +0 -164
- acoular/tests/unsupported/SpeedComparison/OvernightTestcasesBeamformer_nMics32_nGridPoints100_nFreqs4_nTrials10.png +0 -0
- acoular/tests/unsupported/SpeedComparison/cythonBeamformer.pyx +0 -237
- acoular/tests/unsupported/SpeedComparison/mainForCython.py +0 -103
- acoular/tests/unsupported/SpeedComparison/mainForParallelJit.py +0 -143
- acoular/tests/unsupported/SpeedComparison/setupCythonOpenMP.py +0 -63
- acoular/tests/unsupported/SpeedComparison/sharedFunctions.py +0 -153
- acoular/tests/unsupported/SpeedComparison/timeOverNMics_AllImportantMethods.png +0 -0
- acoular/tests/unsupported/SpeedComparison/timeOverNMics_faverage.png +0 -0
- acoular/tests/unsupported/SpeedComparison/vglOptimierungFAverage.py +0 -204
- acoular/tests/unsupported/SpeedComparison/vglOptimierungGaussSeidel.py +0 -182
- acoular/tests/unsupported/SpeedComparison/vglOptimierungR_BEAMFULL_INVERSE.py +0 -764
- acoular/tests/unsupported/SpeedComparison/vglOptimierungR_BEAM_OS.py +0 -231
- acoular/tests/unsupported/SpeedComparison/whatsFastestWayFor_absASquared.py +0 -48
- acoular/tests/unsupported/functionalBeamformer.py +0 -123
- acoular/tests/unsupported/precisionTest.py +0 -153
- acoular/tests/unsupported/validationOfBeamformerFuncsPOSTAcoularIntegration.py +0 -254
- acoular/tests/unsupported/validationOfBeamformerFuncsPREeAcoularIntegration.py +0 -531
- acoular/tools.py +0 -422
- acoular-24.3.dist-info/RECORD +0 -148
- acoular-24.3.dist-info/licenses/LICENSE +0 -29
- {acoular-24.3.dist-info → acoular-24.7.dist-info}/licenses/AUTHORS.rst +0 -0
acoular/__init__.py
CHANGED
|
@@ -1,60 +1,125 @@
|
|
|
1
|
-
#
|
|
2
|
-
#------------------------------------------------------------------------------
|
|
1
|
+
# ------------------------------------------------------------------------------
|
|
3
2
|
# Copyright (c) Acoular Development Team.
|
|
4
|
-
|
|
3
|
+
# ------------------------------------------------------------------------------
|
|
5
4
|
|
|
6
|
-
"""
|
|
7
|
-
The Acoular library: several classes for the implemetation of
|
|
8
|
-
acoustic beamforming
|
|
9
|
-
"""
|
|
5
|
+
"""The Acoular library: several classes for the implementation of acoustic beamforming."""
|
|
10
6
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
import os
|
|
14
|
-
|
|
15
|
-
from .configuration import config
|
|
7
|
+
import os
|
|
16
8
|
|
|
17
|
-
from .
|
|
18
|
-
bk_mat_import, datx_import
|
|
19
|
-
try:
|
|
20
|
-
from .nidaqimport import nidaq_import
|
|
21
|
-
except:
|
|
22
|
-
pass
|
|
23
|
-
|
|
24
|
-
try:
|
|
25
|
-
from .sdinput import SoundDeviceSamplesGenerator
|
|
26
|
-
except:
|
|
27
|
-
pass
|
|
28
|
-
|
|
29
|
-
from .tbeamform import IntegratorSectorTime, \
|
|
30
|
-
BeamformerTime, BeamformerTimeSq, BeamformerTimeTraj, BeamformerTimeSqTraj,\
|
|
31
|
-
BeamformerCleant, BeamformerCleantSq, BeamformerCleantTraj, BeamformerCleantSqTraj
|
|
32
|
-
from .tprocess import SamplesGenerator, TimeInOut, MaskedTimeInOut, ChannelMixer, \
|
|
33
|
-
Mixer, TimeAverage, TimeReverse, TimePower, FiltFiltOctave, FiltOctave, TimeCache, \
|
|
34
|
-
WriteWAV, WriteH5, SpatialInterpolator, SpatialInterpolatorRotation, Trigger, \
|
|
35
|
-
SampleSplitter, AngleTracker, SpatialInterpolatorConstantRotation, Filter, \
|
|
36
|
-
TimeExpAverage, FiltFreqWeight, TimeCumAverage, FilterBank, OctaveFilterBank, TimeConvolve
|
|
9
|
+
from . import demo, tools
|
|
37
10
|
from .calib import Calib
|
|
38
|
-
from .
|
|
39
|
-
from .
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
11
|
+
from .configuration import config
|
|
12
|
+
from .environments import (
|
|
13
|
+
Environment,
|
|
14
|
+
FlowField,
|
|
15
|
+
GeneralFlowEnvironment,
|
|
16
|
+
OpenJet,
|
|
17
|
+
RotatingFlow,
|
|
18
|
+
SlotJet,
|
|
19
|
+
UniformFlowEnvironment,
|
|
20
|
+
cartToCyl,
|
|
21
|
+
cylToCart,
|
|
22
|
+
)
|
|
23
|
+
from .fbeamform import (
|
|
24
|
+
BeamformerAdaptiveGrid,
|
|
25
|
+
BeamformerBase,
|
|
26
|
+
BeamformerCapon,
|
|
27
|
+
BeamformerClean,
|
|
28
|
+
BeamformerCleansc,
|
|
29
|
+
BeamformerCMF,
|
|
30
|
+
BeamformerDamas,
|
|
31
|
+
BeamformerDamasPlus,
|
|
32
|
+
BeamformerEig,
|
|
33
|
+
BeamformerFunctional,
|
|
34
|
+
BeamformerGIB,
|
|
35
|
+
BeamformerGridlessOrth,
|
|
36
|
+
BeamformerMusic,
|
|
37
|
+
BeamformerOrth,
|
|
38
|
+
BeamformerSODIX,
|
|
39
|
+
L_p,
|
|
40
|
+
PointSpreadFunction,
|
|
41
|
+
SteeringVector,
|
|
42
|
+
integrate,
|
|
43
|
+
)
|
|
44
|
+
from .grids import (
|
|
45
|
+
CircSector,
|
|
46
|
+
ConvexSector,
|
|
47
|
+
Grid,
|
|
48
|
+
ImportGrid,
|
|
49
|
+
LineGrid,
|
|
50
|
+
MergeGrid,
|
|
51
|
+
MultiSector,
|
|
52
|
+
PolySector,
|
|
53
|
+
RectGrid,
|
|
54
|
+
RectGrid3D,
|
|
55
|
+
RectSector,
|
|
56
|
+
RectSector3D,
|
|
57
|
+
Sector,
|
|
58
|
+
)
|
|
43
59
|
from .microphones import MicGeom
|
|
44
|
-
from .
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
60
|
+
from .sdinput import SoundDeviceSamplesGenerator
|
|
61
|
+
from .signals import (
|
|
62
|
+
FiltWNoiseGenerator,
|
|
63
|
+
GenericSignalGenerator,
|
|
64
|
+
PNoiseGenerator,
|
|
65
|
+
SignalGenerator,
|
|
66
|
+
SineGenerator,
|
|
67
|
+
WNoiseGenerator,
|
|
68
|
+
)
|
|
69
|
+
from .sources import (
|
|
70
|
+
LineSource,
|
|
71
|
+
MaskedTimeSamples,
|
|
72
|
+
MovingLineSource,
|
|
73
|
+
MovingPointSource,
|
|
74
|
+
MovingPointSourceDipole,
|
|
75
|
+
PointSource,
|
|
76
|
+
PointSourceConvolve,
|
|
77
|
+
PointSourceDipole,
|
|
78
|
+
SourceMixer,
|
|
79
|
+
SphericalHarmonicSource,
|
|
80
|
+
TimeSamples,
|
|
81
|
+
UncorrelatedNoiseSource,
|
|
82
|
+
)
|
|
83
|
+
from .spectra import BaseSpectra, FFTSpectra, PowerSpectra, PowerSpectraImport, synthetic
|
|
84
|
+
from .spectra import PowerSpectra as EigSpectra
|
|
85
|
+
from .tbeamform import (
|
|
86
|
+
BeamformerCleant,
|
|
87
|
+
BeamformerCleantSq,
|
|
88
|
+
BeamformerCleantSqTraj,
|
|
89
|
+
BeamformerCleantTraj,
|
|
90
|
+
BeamformerTime,
|
|
91
|
+
BeamformerTimeSq,
|
|
92
|
+
BeamformerTimeSqTraj,
|
|
93
|
+
BeamformerTimeTraj,
|
|
94
|
+
IntegratorSectorTime,
|
|
95
|
+
)
|
|
96
|
+
from .tprocess import (
|
|
97
|
+
AngleTracker,
|
|
98
|
+
ChannelMixer,
|
|
99
|
+
Filter,
|
|
100
|
+
FilterBank,
|
|
101
|
+
FiltFiltOctave,
|
|
102
|
+
FiltFreqWeight,
|
|
103
|
+
FiltOctave,
|
|
104
|
+
MaskedTimeInOut,
|
|
105
|
+
Mixer,
|
|
106
|
+
OctaveFilterBank,
|
|
107
|
+
SamplesGenerator,
|
|
108
|
+
SampleSplitter,
|
|
109
|
+
SpatialInterpolator,
|
|
110
|
+
SpatialInterpolatorConstantRotation,
|
|
111
|
+
SpatialInterpolatorRotation,
|
|
112
|
+
TimeAverage,
|
|
113
|
+
TimeCache,
|
|
114
|
+
TimeConvolve,
|
|
115
|
+
TimeCumAverage,
|
|
116
|
+
TimeExpAverage,
|
|
117
|
+
TimeInOut,
|
|
118
|
+
TimePower,
|
|
119
|
+
TimeReverse,
|
|
120
|
+
Trigger,
|
|
121
|
+
WriteH5,
|
|
122
|
+
WriteWAV,
|
|
123
|
+
)
|
|
124
|
+
from .trajectory import Trajectory
|
|
125
|
+
from .version import __author__, __date__, __version__
|
acoular/calib.py
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
#
|
|
2
|
-
#pylint: disable-msg=E0611, E1101, C0103, R0901, R0902, R0903, R0904, W0232
|
|
3
|
-
#------------------------------------------------------------------------------
|
|
1
|
+
# ------------------------------------------------------------------------------
|
|
4
2
|
# Copyright (c) Acoular Development Team.
|
|
5
|
-
|
|
6
|
-
"""
|
|
7
|
-
Implements calibration of multichannel time signals.
|
|
3
|
+
# ------------------------------------------------------------------------------
|
|
4
|
+
"""Implements calibration of multichannel time signals.
|
|
8
5
|
|
|
9
6
|
.. autosummary::
|
|
10
7
|
:toctree: generated/
|
|
@@ -13,69 +10,64 @@ Implements calibration of multichannel time signals.
|
|
|
13
10
|
"""
|
|
14
11
|
|
|
15
12
|
# imports from other packages
|
|
16
|
-
from numpy import array
|
|
17
|
-
from traits.api import HasPrivateTraits, CLong, File, CArray, Property, \
|
|
18
|
-
cached_property, on_trait_change
|
|
19
13
|
from os import path
|
|
20
14
|
|
|
15
|
+
from numpy import array
|
|
16
|
+
from traits.api import CArray, CLong, File, HasPrivateTraits, Property, cached_property, on_trait_change
|
|
17
|
+
|
|
21
18
|
# acoular imports
|
|
22
19
|
from .internal import digest
|
|
23
20
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
Container for calibration data in `*.xml` format
|
|
27
|
-
|
|
21
|
+
|
|
22
|
+
class Calib(HasPrivateTraits):
|
|
23
|
+
"""Container for calibration data in `*.xml` format.
|
|
24
|
+
|
|
28
25
|
This class serves as interface to load calibration data for the used
|
|
29
|
-
microphone array.
|
|
26
|
+
microphone array. The calibration factors are stored as [Pa/unit].
|
|
30
27
|
"""
|
|
31
28
|
|
|
32
29
|
#: Name of the .xml file to be imported.
|
|
33
|
-
from_file = File(filter=['*.xml'],
|
|
34
|
-
desc="name of the xml file to import")
|
|
30
|
+
from_file = File(filter=['*.xml'], desc='name of the xml file to import')
|
|
35
31
|
|
|
36
32
|
#: Basename of the .xml-file. Readonly / is set automatically.
|
|
37
|
-
basename = Property(
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
#: Number of microphones in the calibration data,
|
|
33
|
+
basename = Property(depends_on='from_file', desc='basename of xml file')
|
|
34
|
+
|
|
35
|
+
#: Number of microphones in the calibration data,
|
|
41
36
|
#: is set automatically / read from file.
|
|
42
|
-
num_mics = CLong(
|
|
43
|
-
desc="number of microphones in the geometry")
|
|
37
|
+
num_mics = CLong(0, desc='number of microphones in the geometry')
|
|
44
38
|
|
|
45
|
-
#: Array of calibration factors,
|
|
39
|
+
#: Array of calibration factors,
|
|
46
40
|
#: is set automatically / read from file.
|
|
47
|
-
data = CArray(
|
|
48
|
-
desc="calibration data")
|
|
41
|
+
data = CArray(desc='calibration data')
|
|
49
42
|
|
|
50
43
|
# Internal identifier
|
|
51
|
-
digest = Property(
|
|
44
|
+
digest = Property(depends_on=['basename'])
|
|
52
45
|
|
|
53
46
|
@cached_property
|
|
54
|
-
def _get_digest(
|
|
47
|
+
def _get_digest(self):
|
|
55
48
|
return digest(self)
|
|
56
|
-
|
|
49
|
+
|
|
57
50
|
@cached_property
|
|
58
|
-
def _get_basename(
|
|
51
|
+
def _get_basename(self):
|
|
59
52
|
if not path.isfile(self.from_file):
|
|
60
53
|
return ''
|
|
61
54
|
return path.splitext(path.basename(self.from_file))[0]
|
|
62
|
-
|
|
55
|
+
|
|
63
56
|
@on_trait_change('basename')
|
|
64
|
-
def import_data(
|
|
65
|
-
"""
|
|
66
|
-
Loads the calibration data from `*.xml` file .
|
|
67
|
-
"""
|
|
57
|
+
def import_data(self):
|
|
58
|
+
"""Loads the calibration data from `*.xml` file ."""
|
|
68
59
|
if not path.isfile(self.from_file):
|
|
69
60
|
# empty calibration
|
|
70
|
-
if self.basename=='':
|
|
71
|
-
self.data = None
|
|
61
|
+
if self.basename == '':
|
|
62
|
+
self.data = None
|
|
72
63
|
self.num_mics = 0
|
|
73
64
|
# no file there
|
|
74
65
|
else:
|
|
75
|
-
self.data = array([1.0
|
|
66
|
+
self.data = array([1.0], 'd')
|
|
76
67
|
self.num_mics = 1
|
|
77
68
|
return
|
|
78
69
|
import xml.dom.minidom
|
|
70
|
+
|
|
79
71
|
doc = xml.dom.minidom.parse(self.from_file)
|
|
80
72
|
names = []
|
|
81
73
|
data = []
|
|
@@ -84,4 +76,3 @@ class Calib( HasPrivateTraits ):
|
|
|
84
76
|
data.append(float(element.getAttribute('factor')))
|
|
85
77
|
self.data = array(data, 'd')
|
|
86
78
|
self.num_mics = self.data.shape[0]
|
|
87
|
-
|
acoular/configuration.py
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
#
|
|
2
|
-
#pylint: disable-msg=E0611, E1101, C0103, R0901, R0902, R0903, R0904, W0232
|
|
3
|
-
#------------------------------------------------------------------------------
|
|
1
|
+
# ------------------------------------------------------------------------------
|
|
4
2
|
# Copyright (c) Acoular Development Team.
|
|
5
|
-
|
|
3
|
+
# ------------------------------------------------------------------------------
|
|
6
4
|
"""Implements global configuration of Acoular.
|
|
7
5
|
|
|
8
6
|
.. autosummary::
|
|
@@ -12,9 +10,10 @@
|
|
|
12
10
|
config
|
|
13
11
|
"""
|
|
14
12
|
|
|
15
|
-
|
|
13
|
+
import importlib.util
|
|
14
|
+
import sys
|
|
15
|
+
from os import environ, mkdir, path
|
|
16
16
|
from warnings import warn
|
|
17
|
-
import sys
|
|
18
17
|
|
|
19
18
|
# When numpy is using OpenBLAS then it runs with OPENBLAS_NUM_THREADS which may lead to
|
|
20
19
|
# overcommittment when called from within numba jitted function that run on
|
|
@@ -23,56 +22,64 @@ import sys
|
|
|
23
22
|
# only respected once numpy starts. Later on, it cannot be changed.
|
|
24
23
|
|
|
25
24
|
# we check if numpy already loaded
|
|
26
|
-
if 'numpy' in sys.modules:
|
|
27
|
-
# numpy is loaded
|
|
25
|
+
if 'numpy' in sys.modules:
|
|
26
|
+
# numpy is loaded
|
|
28
27
|
# temporarily route stdout to string
|
|
29
28
|
import io
|
|
30
|
-
|
|
29
|
+
|
|
30
|
+
import numpy as np
|
|
31
|
+
|
|
31
32
|
orig_stdout = sys.stdout
|
|
32
33
|
temp_stdout = io.StringIO()
|
|
33
34
|
sys.stdout = temp_stdout
|
|
34
|
-
|
|
35
|
+
np.show_config()
|
|
35
36
|
sys.stdout = orig_stdout
|
|
36
37
|
# check if it uses OpenBLAS or another library
|
|
37
38
|
if 'openblas' in temp_stdout.getvalue().lower():
|
|
38
39
|
# it's OpenBLAS, set numba threads=1 to avoid overcommittment
|
|
39
40
|
import numba
|
|
41
|
+
|
|
40
42
|
numba.set_num_threads(1)
|
|
41
|
-
warn(
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
43
|
+
warn(
|
|
44
|
+
'We detected that Numpy is already loaded and uses OpenBLAS. Because '
|
|
45
|
+
'this conflicts with Numba parallel execution, we disable parallel '
|
|
46
|
+
'execution for now and processing might be slower. To speed up, '
|
|
47
|
+
'either import Numpy after Acoular or set environment variable '
|
|
48
|
+
'OPENBLAS_NUM_THREADS=1 before start of the program.',
|
|
49
|
+
UserWarning,
|
|
50
|
+
stacklevel=2,
|
|
51
|
+
)
|
|
47
52
|
else:
|
|
48
53
|
# numpy is not loaded
|
|
49
|
-
environ['OPENBLAS_NUM_THREADS'] =
|
|
54
|
+
environ['OPENBLAS_NUM_THREADS'] = '1'
|
|
50
55
|
|
|
51
56
|
# this loads numpy, so we have to defer loading until OpenBLAS check is done
|
|
52
|
-
from traits.api import
|
|
57
|
+
from traits.api import Bool, Either, HasStrictTraits, Property, Str, Trait, cached_property
|
|
58
|
+
|
|
53
59
|
|
|
54
60
|
class Config(HasStrictTraits):
|
|
55
|
-
"""
|
|
56
|
-
This class implements the global configuration of the Acoular package.
|
|
61
|
+
"""Implements the global configuration of the Acoular package.
|
|
57
62
|
|
|
58
|
-
An instance of this class can be accessed for adjustment of the following
|
|
63
|
+
An instance of this class can be accessed for adjustment of the following
|
|
59
64
|
properties.
|
|
60
65
|
General caching behaviour can be controlled by :attr:`global_caching`.
|
|
61
|
-
The package used to read and write .h5 files can be specified
|
|
62
|
-
by :attr:`h5library`.
|
|
66
|
+
The package used to read and write .h5 files can be specified
|
|
67
|
+
by :attr:`h5library`.
|
|
63
68
|
|
|
64
|
-
Example:
|
|
69
|
+
Example:
|
|
70
|
+
--------
|
|
65
71
|
For using Acoular with h5py package and overwrite existing cache:
|
|
66
|
-
|
|
67
|
-
>>>
|
|
68
|
-
>>>
|
|
69
|
-
>>>
|
|
72
|
+
|
|
73
|
+
>>> import acoular
|
|
74
|
+
>>> acoular.config.h5library = 'h5py'
|
|
75
|
+
>>> acoular.config.global_caching = 'overwrite'
|
|
76
|
+
|
|
70
77
|
"""
|
|
71
|
-
|
|
78
|
+
|
|
72
79
|
def __init__(self):
|
|
73
80
|
HasStrictTraits.__init__(self)
|
|
74
81
|
self._assert_h5library()
|
|
75
|
-
|
|
82
|
+
|
|
76
83
|
#: Flag that globally defines caching behaviour of Acoular classes
|
|
77
84
|
#: defaults to 'individual'.
|
|
78
85
|
#:
|
|
@@ -82,25 +89,26 @@ class Config(HasStrictTraits):
|
|
|
82
89
|
#: * 'readonly': Acoular classes do not actively cache, but read from cache if existing.
|
|
83
90
|
#: * 'overwrite': Acoular classes replace existing cachefile content with new data.
|
|
84
91
|
global_caching = Property()
|
|
85
|
-
|
|
86
|
-
_global_caching = Trait('individual','all','none','readonly','overwrite')
|
|
87
92
|
|
|
88
|
-
|
|
89
|
-
|
|
93
|
+
_global_caching = Trait('individual', 'all', 'none', 'readonly', 'overwrite')
|
|
94
|
+
|
|
95
|
+
#: Flag that globally defines package used to read and write .h5 files
|
|
96
|
+
#: defaults to 'pytables'. It is also possible to set it to 'tables', which is an alias for 'pytables'.
|
|
97
|
+
#: If 'pytables' can not be imported, 'h5py' is used.
|
|
90
98
|
h5library = Property()
|
|
91
|
-
|
|
92
|
-
_h5library =
|
|
93
|
-
|
|
99
|
+
|
|
100
|
+
_h5library = Either('pytables', 'tables', 'h5py', default='pytables')
|
|
101
|
+
|
|
94
102
|
#: Defines the path to the directory containing Acoulars cache files.
|
|
95
103
|
#: If the specified :attr:`cache_dir` directory does not exist,
|
|
96
|
-
#: it will be created. attr:`cache_dir` defaults to current session path.
|
|
104
|
+
#: it will be created. :attr:`cache_dir` defaults to current session path.
|
|
97
105
|
cache_dir = Property()
|
|
98
106
|
|
|
99
|
-
_cache_dir = Str(
|
|
107
|
+
_cache_dir = Str('')
|
|
100
108
|
|
|
101
|
-
#: Defines the working directory containing files
|
|
102
|
-
#:
|
|
103
|
-
#: Defaults to current session path.
|
|
109
|
+
#: Defines the working directory containing data files. Used only by
|
|
110
|
+
#: :class:`~acoular.tprocess.WriteH5` class.
|
|
111
|
+
#: Defaults to current session path.
|
|
104
112
|
td_dir = Property()
|
|
105
113
|
|
|
106
114
|
_td_dir = Str(path.curdir)
|
|
@@ -108,61 +116,103 @@ class Config(HasStrictTraits):
|
|
|
108
116
|
#: Boolean Flag that determines whether user has access to traitsui features.
|
|
109
117
|
#: Defaults to False.
|
|
110
118
|
use_traitsui = Property()
|
|
111
|
-
|
|
119
|
+
|
|
112
120
|
_use_traitsui = Bool(False)
|
|
113
|
-
|
|
114
|
-
|
|
121
|
+
|
|
122
|
+
#: Boolean Flag that determines whether tables is installed.
|
|
123
|
+
have_tables = Property()
|
|
124
|
+
|
|
125
|
+
#: Boolean Flag that determines whether h5py is installed.
|
|
126
|
+
have_h5py = Property()
|
|
127
|
+
|
|
128
|
+
#: Boolean Flag that determines whether matplotlib is installed.
|
|
129
|
+
have_matplotlib = Property()
|
|
130
|
+
|
|
131
|
+
#: Boolean Flag that determines whether pylops is installed.
|
|
132
|
+
have_pylops = Property()
|
|
133
|
+
|
|
134
|
+
#: Boolean Flag that determines whether sounddevice is installed.
|
|
135
|
+
have_sounddevice = Property()
|
|
136
|
+
|
|
137
|
+
#: Boolean Flag that determines whether the package is installed.
|
|
138
|
+
have_traitsui = Property()
|
|
139
|
+
|
|
115
140
|
def _get_global_caching(self):
|
|
116
141
|
return self._global_caching
|
|
117
142
|
|
|
118
|
-
def _set_global_caching(self,
|
|
119
|
-
self._global_caching =
|
|
120
|
-
|
|
143
|
+
def _set_global_caching(self, value):
|
|
144
|
+
self._global_caching = value
|
|
145
|
+
|
|
121
146
|
def _get_h5library(self):
|
|
122
147
|
return self._h5library
|
|
123
|
-
|
|
124
|
-
def _set_h5library(self,
|
|
125
|
-
self._h5library =
|
|
126
|
-
|
|
148
|
+
|
|
149
|
+
def _set_h5library(self, name):
|
|
150
|
+
self._h5library = name
|
|
151
|
+
|
|
127
152
|
def _get_use_traitsui(self):
|
|
128
153
|
return self._use_traitsui
|
|
129
|
-
|
|
154
|
+
|
|
130
155
|
def _set_use_traitsui(self, use_tui):
|
|
131
|
-
if use_tui:
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
self._use_traitsui = use_tui
|
|
135
|
-
|
|
156
|
+
if use_tui and not self.have_traitsui:
|
|
157
|
+
error_msg = 'TraitsUI package is not installed!'
|
|
158
|
+
raise ImportError(error_msg)
|
|
159
|
+
self._use_traitsui = use_tui
|
|
160
|
+
|
|
136
161
|
def _assert_h5library(self):
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
import h5py
|
|
143
|
-
self.h5library = 'h5py'
|
|
144
|
-
except:
|
|
145
|
-
raise ImportError("packages h5py and pytables are missing!")
|
|
162
|
+
if not self.have_tables and not self.have_h5py:
|
|
163
|
+
msg = 'Packages H5py and PyTables are missing! At least one of them is required for Acoular to work.'
|
|
164
|
+
raise ImportError(msg)
|
|
165
|
+
if not self.have_tables:
|
|
166
|
+
self.h5library = 'h5py'
|
|
146
167
|
|
|
147
168
|
def _get_cache_dir(self):
|
|
148
|
-
if self._cache_dir ==
|
|
149
|
-
cache_dir = path.join(path.curdir,'cache')
|
|
169
|
+
if self._cache_dir == '':
|
|
170
|
+
cache_dir = path.join(path.curdir, 'cache')
|
|
150
171
|
if not path.exists(cache_dir):
|
|
151
172
|
mkdir(cache_dir)
|
|
152
173
|
self._cache_dir = cache_dir
|
|
153
174
|
return self._cache_dir
|
|
154
|
-
|
|
155
|
-
def _set_cache_dir(self,cdir):
|
|
175
|
+
|
|
176
|
+
def _set_cache_dir(self, cdir):
|
|
156
177
|
if not path.exists(cdir):
|
|
157
178
|
mkdir(cdir)
|
|
158
179
|
self._cache_dir = cdir
|
|
159
180
|
|
|
160
181
|
def _get_td_dir(self):
|
|
161
182
|
return self._td_dir
|
|
162
|
-
|
|
163
|
-
def _set_td_dir(self,tddir):
|
|
183
|
+
|
|
184
|
+
def _set_td_dir(self, tddir):
|
|
164
185
|
self._td_dir = tddir
|
|
165
186
|
|
|
187
|
+
def _have_module(self, module_name):
|
|
188
|
+
spec = importlib.util.find_spec(module_name)
|
|
189
|
+
return spec is not None
|
|
190
|
+
|
|
191
|
+
@cached_property
|
|
192
|
+
def _get_have_matplotlib(self):
|
|
193
|
+
return self._have_module('matplotlib')
|
|
194
|
+
|
|
195
|
+
@cached_property
|
|
196
|
+
def _get_have_pylops(self):
|
|
197
|
+
return self._have_module('pylops')
|
|
198
|
+
|
|
199
|
+
@cached_property
|
|
200
|
+
def _get_have_sounddevice(self):
|
|
201
|
+
return self._have_module('sounddevice')
|
|
202
|
+
|
|
203
|
+
@cached_property
|
|
204
|
+
def _get_have_tables(self):
|
|
205
|
+
return self._have_module('tables')
|
|
206
|
+
|
|
207
|
+
@cached_property
|
|
208
|
+
def _get_have_h5py(self):
|
|
209
|
+
return self._have_module('h5py')
|
|
210
|
+
|
|
211
|
+
@cached_property
|
|
212
|
+
def _get_have_traitsui(self):
|
|
213
|
+
return self._have_module('traitsui')
|
|
214
|
+
|
|
215
|
+
|
|
166
216
|
config = Config()
|
|
167
217
|
"""
|
|
168
218
|
This instance implements the global configuration of the Acoular package.
|
|
@@ -174,10 +224,10 @@ General caching behaviour can be controlled by the :attr:`global_caching` attrib
|
|
|
174
224
|
* 'readonly': Acoular classes do not actively cache, but read from cache if existing.
|
|
175
225
|
* 'overwrite': Acoular classes replace existing cachefile content with new data.
|
|
176
226
|
|
|
177
|
-
The package used to read and write .h5 files can be specified
|
|
178
|
-
by :attr:`h5library`:
|
|
179
|
-
* '
|
|
180
|
-
* '
|
|
227
|
+
The package used to read and write .h5 files can be specified
|
|
228
|
+
by :attr:`h5library`:
|
|
229
|
+
* 'PyTables': Use 'tables' (or 'pytables', depending on python distribution).
|
|
230
|
+
* 'H5py': Use 'h5py'.
|
|
181
231
|
|
|
182
232
|
Some Acoular classes support GUI elements for usage with tools from the TraitsUI package.
|
|
183
233
|
If desired, this package has to be installed manually, as it is not a prerequisite for
|
|
@@ -186,10 +236,10 @@ To enable the functionality, the flag attribute :attr:`use_traitsui` has to be s
|
|
|
186
236
|
Note: this is independent from the GUI tools implemented in the spectAcoular package.
|
|
187
237
|
|
|
188
238
|
|
|
189
|
-
Example:
|
|
239
|
+
Example:
|
|
190
240
|
For using Acoular with h5py package and overwrite existing cache:
|
|
191
|
-
|
|
192
|
-
>>>
|
|
193
|
-
>>>
|
|
194
|
-
>>>
|
|
241
|
+
|
|
242
|
+
>>> import acoular
|
|
243
|
+
>>> acoular.config.h5library = "h5py"
|
|
244
|
+
>>> acoular.config.global_caching = "overwrite"
|
|
195
245
|
"""
|
acoular/demo/__init__.py
CHANGED
|
@@ -1,7 +1,13 @@
|
|
|
1
|
-
#
|
|
2
|
-
#------------------------------------------------------------------------------
|
|
1
|
+
# ------------------------------------------------------------------------------
|
|
3
2
|
# Copyright (c) Acoular Development Team.
|
|
4
|
-
|
|
3
|
+
# ------------------------------------------------------------------------------
|
|
4
|
+
"""The Acoular demo.
|
|
5
5
|
|
|
6
|
+
.. autosummary::
|
|
7
|
+
:toctree: generated/
|
|
6
8
|
|
|
7
|
-
|
|
9
|
+
acoular_demo
|
|
10
|
+
|
|
11
|
+
"""
|
|
12
|
+
|
|
13
|
+
from . import acoular_demo
|