acoular 25.4__tar.gz → 25.10__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.
Files changed (58) hide show
  1. {acoular-25.4 → acoular-25.10}/.gitignore +3 -0
  2. {acoular-25.4 → acoular-25.10}/PKG-INFO +8 -4
  3. {acoular-25.4 → acoular-25.10}/README.md +2 -2
  4. {acoular-25.4 → acoular-25.10}/acoular/__init__.py +2 -4
  5. {acoular-25.4 → acoular-25.10}/acoular/aiaa/aiaa.py +10 -10
  6. {acoular-25.4 → acoular-25.10}/acoular/base.py +12 -34
  7. {acoular-25.4 → acoular-25.10}/acoular/calib.py +20 -19
  8. {acoular-25.4 → acoular-25.10}/acoular/configuration.py +3 -3
  9. {acoular-25.4 → acoular-25.10}/acoular/demo/__init__.py +6 -1
  10. {acoular-25.4 → acoular-25.10}/acoular/demo/acoular_demo.py +34 -10
  11. {acoular-25.4 → acoular-25.10}/acoular/deprecation.py +10 -1
  12. {acoular-25.4 → acoular-25.10}/acoular/environments.py +107 -117
  13. {acoular-25.4 → acoular-25.10}/acoular/fastFuncs.py +16 -10
  14. {acoular-25.4 → acoular-25.10}/acoular/fbeamform.py +300 -402
  15. {acoular-25.4 → acoular-25.10}/acoular/fprocess.py +7 -33
  16. {acoular-25.4 → acoular-25.10}/acoular/grids.py +228 -134
  17. {acoular-25.4 → acoular-25.10}/acoular/h5cache.py +10 -4
  18. {acoular-25.4 → acoular-25.10}/acoular/h5files.py +106 -9
  19. {acoular-25.4 → acoular-25.10}/acoular/internal.py +4 -0
  20. {acoular-25.4 → acoular-25.10}/acoular/microphones.py +22 -10
  21. {acoular-25.4 → acoular-25.10}/acoular/process.py +7 -53
  22. {acoular-25.4 → acoular-25.10}/acoular/sdinput.py +8 -5
  23. {acoular-25.4 → acoular-25.10}/acoular/signals.py +29 -27
  24. {acoular-25.4 → acoular-25.10}/acoular/sources.py +205 -335
  25. {acoular-25.4 → acoular-25.10}/acoular/spectra.py +33 -43
  26. {acoular-25.4 → acoular-25.10}/acoular/tbeamform.py +220 -199
  27. {acoular-25.4 → acoular-25.10}/acoular/tools/helpers.py +52 -33
  28. {acoular-25.4 → acoular-25.10}/acoular/tools/metrics.py +5 -10
  29. acoular-25.10/acoular/tprocess.py +2862 -0
  30. {acoular-25.4 → acoular-25.10}/acoular/traitsviews.py +1 -3
  31. {acoular-25.4 → acoular-25.10}/acoular/trajectory.py +5 -5
  32. {acoular-25.4 → acoular-25.10}/acoular/version.py +4 -3
  33. {acoular-25.4 → acoular-25.10}/pyproject.toml +9 -7
  34. acoular-25.4/acoular/tprocess.py +0 -2117
  35. {acoular-25.4 → acoular-25.10}/AUTHORS.rst +0 -0
  36. {acoular-25.4 → acoular-25.10}/LICENSE +0 -0
  37. {acoular-25.4 → acoular-25.10}/acoular/aiaa/__init__.py +0 -0
  38. {acoular-25.4 → acoular-25.10}/acoular/tfastfuncs.py +0 -0
  39. {acoular-25.4 → acoular-25.10}/acoular/tools/__init__.py +0 -0
  40. {acoular-25.4 → acoular-25.10}/acoular/tools/utils.py +0 -0
  41. {acoular-25.4 → acoular-25.10}/acoular/xml/HW90D240_f10.xml +0 -0
  42. {acoular-25.4 → acoular-25.10}/acoular/xml/W90_D105_f10.xml +0 -0
  43. {acoular-25.4 → acoular-25.10}/acoular/xml/acousticam_2c.xml +0 -0
  44. {acoular-25.4 → acoular-25.10}/acoular/xml/acousticam_4c.xml +0 -0
  45. {acoular-25.4 → acoular-25.10}/acoular/xml/array38.xml +0 -0
  46. {acoular-25.4 → acoular-25.10}/acoular/xml/array92x.xml +0 -0
  47. {acoular-25.4 → acoular-25.10}/acoular/xml/array_56.xml +0 -0
  48. {acoular-25.4 → acoular-25.10}/acoular/xml/array_56_10_9.xml +0 -0
  49. {acoular-25.4 → acoular-25.10}/acoular/xml/array_56_bomb.xml +0 -0
  50. {acoular-25.4 → acoular-25.10}/acoular/xml/array_56_v2.xml +0 -0
  51. {acoular-25.4 → acoular-25.10}/acoular/xml/array_64.xml +0 -0
  52. {acoular-25.4 → acoular-25.10}/acoular/xml/array_84_10_9.xml +0 -0
  53. {acoular-25.4 → acoular-25.10}/acoular/xml/array_84_bomb_v3.xml +0 -0
  54. {acoular-25.4 → acoular-25.10}/acoular/xml/calib_vw_ring32.xml +0 -0
  55. {acoular-25.4 → acoular-25.10}/acoular/xml/gfai_ring32.xml +0 -0
  56. {acoular-25.4 → acoular-25.10}/acoular/xml/minidsp_uma-16.xml +0 -0
  57. {acoular-25.4 → acoular-25.10}/acoular/xml/minidsp_uma-16_mirrored.xml +0 -0
  58. {acoular-25.4 → acoular-25.10}/acoular/xml/tub_vogel64.xml +0 -0
@@ -24,6 +24,9 @@ MANIFEST
24
24
  examples/all_bf.sav
25
25
  examples/benchmark/results/
26
26
  **/three_sources.h5
27
+ **/three_sources_1d.h5
28
+ **/three_sources_2d.h5
29
+ **/three_sources_3d.h5
27
30
  docs/source/sg_execution_times.rst
28
31
  docs/source/api_ref/generated/
29
32
  docs/source/auto_examples/**/*
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: acoular
3
- Version: 25.4
3
+ Version: 25.10
4
4
  Summary: Python library for acoustic beamforming
5
5
  Project-URL: homepage, https://acoular.org
6
6
  Project-URL: documentation, https://acoular.org
@@ -51,7 +51,7 @@ Requires-Python: <3.14,>=3.10
51
51
  Requires-Dist: numba
52
52
  Requires-Dist: numpy
53
53
  Requires-Dist: scikit-learn
54
- Requires-Dist: scipy>=1.1.0
54
+ Requires-Dist: scipy!=1.16.*,>=1.1.0
55
55
  Requires-Dist: tables
56
56
  Requires-Dist: traits>=6.0
57
57
  Provides-Extra: dev
@@ -62,6 +62,7 @@ Requires-Dist: ipython; extra == 'dev'
62
62
  Requires-Dist: matplotlib; extra == 'dev'
63
63
  Requires-Dist: numpydoc; extra == 'dev'
64
64
  Requires-Dist: pickleshare; extra == 'dev'
65
+ Requires-Dist: pydata-sphinx-theme; extra == 'dev'
65
66
  Requires-Dist: pylops; extra == 'dev'
66
67
  Requires-Dist: pytest; extra == 'dev'
67
68
  Requires-Dist: pytest-cases; extra == 'dev'
@@ -75,6 +76,7 @@ Requires-Dist: ruff==0.8.1; extra == 'dev'
75
76
  Requires-Dist: setuptools; extra == 'dev'
76
77
  Requires-Dist: sounddevice; extra == 'dev'
77
78
  Requires-Dist: sphinx; extra == 'dev'
79
+ Requires-Dist: sphinx-copybutton; extra == 'dev'
78
80
  Requires-Dist: sphinx-gallery; extra == 'dev'
79
81
  Requires-Dist: sphinxcontrib-bibtex; extra == 'dev'
80
82
  Requires-Dist: traitsui; extra == 'dev'
@@ -84,9 +86,11 @@ Requires-Dist: ipython; extra == 'docs'
84
86
  Requires-Dist: matplotlib; extra == 'docs'
85
87
  Requires-Dist: numpydoc; extra == 'docs'
86
88
  Requires-Dist: pickleshare; extra == 'docs'
89
+ Requires-Dist: pydata-sphinx-theme; extra == 'docs'
87
90
  Requires-Dist: setuptools; extra == 'docs'
88
91
  Requires-Dist: sounddevice; extra == 'docs'
89
92
  Requires-Dist: sphinx; extra == 'docs'
93
+ Requires-Dist: sphinx-copybutton; extra == 'docs'
90
94
  Requires-Dist: sphinx-gallery; extra == 'docs'
91
95
  Requires-Dist: sphinxcontrib-bibtex; extra == 'docs'
92
96
  Provides-Extra: full
@@ -228,7 +232,7 @@ pm = bb.synthetic( 8000, 3 )
228
232
  # compute the sound pressure level
229
233
  Lm = ac.L_p( pm )
230
234
  # plot the map
231
- plt.imshow( Lm.T, origin='lower', vmin=Lm.max()-10, extent=rg.extend(), \
235
+ plt.imshow( Lm.T, origin='lower', vmin=Lm.max()-10, extent=rg.extent, \
232
236
  interpolation='bicubic')
233
237
  plt.title('Beamformer (base) for 3 sources measured for 8000 Hz')
234
238
  plt.xlabel('x in m')
@@ -238,6 +242,6 @@ plt.savefig('three_sources.png', dpi=300, bbox_inches='tight')
238
242
  plt.show()
239
243
  ```
240
244
 
241
- ![result](https://github.com/acoular/acoular/blob/master/docs/source/get_started/three_source_py3_colormap.png?raw=true)
245
+ ![result](https://github.com/acoular/acoular/blob/master/docs/source/user_guide/three_source_py3_colormap.png?raw=true)
242
246
 
243
247
 
@@ -118,7 +118,7 @@ pm = bb.synthetic( 8000, 3 )
118
118
  # compute the sound pressure level
119
119
  Lm = ac.L_p( pm )
120
120
  # plot the map
121
- plt.imshow( Lm.T, origin='lower', vmin=Lm.max()-10, extent=rg.extend(), \
121
+ plt.imshow( Lm.T, origin='lower', vmin=Lm.max()-10, extent=rg.extent, \
122
122
  interpolation='bicubic')
123
123
  plt.title('Beamformer (base) for 3 sources measured for 8000 Hz')
124
124
  plt.xlabel('x in m')
@@ -128,6 +128,6 @@ plt.savefig('three_sources.png', dpi=300, bbox_inches='tight')
128
128
  plt.show()
129
129
  ```
130
130
 
131
- ![result](https://github.com/acoular/acoular/blob/master/docs/source/get_started/three_source_py3_colormap.png?raw=true)
131
+ ![result](https://github.com/acoular/acoular/blob/master/docs/source/user_guide/three_source_py3_colormap.png?raw=true)
132
132
 
133
133
 
@@ -16,7 +16,6 @@ from .base import (
16
16
  SamplesGenerator,
17
17
  SpectraGenerator,
18
18
  SpectraOut,
19
- TimeInOut,
20
19
  TimeOut,
21
20
  )
22
21
  from .calib import Calib
@@ -52,7 +51,7 @@ from .fbeamform import (
52
51
  SteeringVector,
53
52
  integrate,
54
53
  )
55
- from .fprocess import IRFFT, RFFT, AutoPowerSpectra, CrossPowerSpectra, FFTSpectra
54
+ from .fprocess import IRFFT, RFFT, AutoPowerSpectra, CrossPowerSpectra
56
55
  from .grids import (
57
56
  CircSector,
58
57
  ConvexSector,
@@ -69,7 +68,7 @@ from .grids import (
69
68
  Sector,
70
69
  )
71
70
  from .microphones import MicGeom
72
- from .process import Average, Cache, SampleSplitter, TimeAverage, TimeCache
71
+ from .process import Average, Cache, SampleSplitter
73
72
  from .sdinput import SoundDeviceSamplesGenerator
74
73
  from .signals import (
75
74
  FiltWNoiseGenerator,
@@ -117,7 +116,6 @@ from .tprocess import (
117
116
  FiltFiltOctave,
118
117
  FiltFreqWeight,
119
118
  FiltOctave,
120
- MaskedTimeInOut,
121
119
  MaskedTimeOut,
122
120
  Mixer,
123
121
  OctaveFilterBank,
@@ -27,18 +27,17 @@ Examples
27
27
 
28
28
  import contextlib
29
29
 
30
- from numpy import array
30
+ import numpy as np
31
31
  from traits.api import (
32
32
  File,
33
33
  Instance,
34
34
  Property,
35
35
  Union,
36
36
  cached_property,
37
- on_trait_change,
37
+ observe,
38
38
  property_depends_on,
39
39
  )
40
40
 
41
- from acoular.deprecation import deprecated_alias
42
41
  from acoular.h5files import H5FileBase, _get_h5file_class
43
42
  from acoular.internal import digest
44
43
  from acoular.microphones import MicGeom
@@ -85,7 +84,6 @@ class TriggerAIAABenchmark(TimeSamplesAIAABenchmark):
85
84
  (self.num_samples, self.num_channels) = self.data.shape
86
85
 
87
86
 
88
- @deprecated_alias({'name': 'file'})
89
87
  class CsmAIAABenchmark(PowerSpectraImport):
90
88
  """Class to load the CSM that is stored in AIAA Benchmark HDF5 file."""
91
89
 
@@ -115,8 +113,8 @@ class CsmAIAABenchmark(PowerSpectraImport):
115
113
  def _get_basename(self):
116
114
  return get_file_basename(self.file)
117
115
 
118
- @on_trait_change('basename')
119
- def load_data(self):
116
+ @observe('basename')
117
+ def _load_data(self, event): # noqa ARG002
120
118
  """Open the .h5 file and set attributes."""
121
119
  if self.h5f is not None:
122
120
  with contextlib.suppress(OSError):
@@ -156,7 +154,7 @@ class CsmAIAABenchmark(PowerSpectraImport):
156
154
  ndarray
157
155
  Array of length *block_size/2+1* containing the sample frequencies.
158
156
  """
159
- return array(self.h5f.get_data_by_reference('/CsmData/binCenterFrequenciesHz')[:].flatten(), dtype=float)
157
+ return np.array(self.h5f.get_data_by_reference('/CsmData/binCenterFrequenciesHz')[:].flatten(), dtype=float)
160
158
 
161
159
 
162
160
  class MicAIAABenchmark(MicGeom):
@@ -172,9 +170,11 @@ class MicAIAABenchmark(MicGeom):
172
170
  None, File(filter=['*.h5'], exists=True), desc='name of the h5 file containing the microphone geometry'
173
171
  )
174
172
 
175
- @on_trait_change('file')
176
- def _import_mpos(self):
177
- """Import the microphone positions from .h5 file.
173
+ @observe('file')
174
+ def _import_mpos(self, event): # noqa ARG002
175
+ """
176
+ Import the microphone positions from .h5 file.
177
+
178
178
  Called when :attr:`basename` changes.
179
179
  """
180
180
  file = _get_h5file_class()
@@ -7,6 +7,12 @@ The classes in this module are abstract base classes that provide a common inter
7
7
  that generate an output via the generator :meth:`result` in block-wise manner. They are not intended
8
8
  to be used directly, but to be subclassed by classes that implement the actual signal processing.
9
9
 
10
+ .. inheritance-diagram::
11
+ acoular.base
12
+ :top-classes:
13
+ acoular.base.Generator
14
+ :parts: 1
15
+
10
16
  .. autosummary::
11
17
  :toctree: generated/
12
18
 
@@ -16,7 +22,6 @@ to be used directly, but to be subclassed by classes that implement the actual s
16
22
  InOut
17
23
  TimeOut
18
24
  SpectraOut
19
- TimeInOut
20
25
  """
21
26
 
22
27
  from abc import abstractmethod
@@ -33,11 +38,9 @@ from traits.api import (
33
38
  )
34
39
 
35
40
  # acoular imports
36
- from .deprecation import deprecated_alias
37
41
  from .internal import digest
38
42
 
39
43
 
40
- @deprecated_alias({'numchannels': 'num_channels', 'numsamples': 'num_samples'})
41
44
  class Generator(ABCHasStrictTraits):
42
45
  """Interface for any generating signal processing block.
43
46
 
@@ -157,10 +160,9 @@ class SpectraGenerator(Generator):
157
160
  """
158
161
 
159
162
 
160
- @deprecated_alias({'numchannels': 'num_channels', 'numsamples': 'num_samples'}, read_only=True)
161
163
  class TimeOut(SamplesGenerator):
162
- """Abstract base class for any signal processing block that receives data from any
163
- :attr:`source` domain and returns time domain signals.
164
+ """
165
+ Abstract base class receiving from a :attr:`source` and returning time domain signals.
164
166
 
165
167
  It provides a base class that can be used to create signal processing blocks that receive data
166
168
  from any generating :attr:`source` and generates a time signal output via the generator
@@ -205,10 +207,9 @@ class TimeOut(SamplesGenerator):
205
207
  """
206
208
 
207
209
 
208
- @deprecated_alias({'numchannels': 'num_channels', 'numsamples': 'num_samples', 'numfreqs': 'num_freqs'}, read_only=True)
209
210
  class SpectraOut(SpectraGenerator):
210
- """Abstract base class for any signal processing block that receives data from any
211
- :attr:`source` domain and returns frequency domain signals.
211
+ """
212
+ Abstract base class receiving from a :attr:`source` and returning frequency domain signals.
212
213
 
213
214
  It provides a base class that can be used to create signal processing blocks that receive data
214
215
  from any generating :attr:`source` domain and generates a frequency domain output via the
@@ -260,10 +261,9 @@ class SpectraOut(SpectraGenerator):
260
261
  """
261
262
 
262
263
 
263
- @deprecated_alias({'numchannels': 'num_channels', 'numsamples': 'num_samples'}, read_only=True)
264
264
  class InOut(SamplesGenerator, SpectraGenerator):
265
- """Abstract base class for any signal processing block that receives data from any
266
- :attr:`source` domain and returns signals in the same domain.
265
+ """
266
+ Abstract base class receiving from a :attr:`source` and returning signals in the same domain.
267
267
 
268
268
  It provides a base class that can be used to create signal processing blocks that receive data
269
269
  from any generating :attr:`source` and generates an output via the generator :meth:`result` in
@@ -308,25 +308,3 @@ class InOut(SamplesGenerator, SpectraGenerator):
308
308
  numpy.ndarray
309
309
  Two-dimensional output data block of shape (num, ...)
310
310
  """
311
-
312
-
313
- class TimeInOut(TimeOut):
314
- """Deprecated alias for :class:`~acoular.base.TimeOut`.
315
-
316
- .. deprecated:: 24.10
317
- Using :class:`~acoular.base.TimeInOut` is deprecated and will be removed in Acoular 25.07.
318
- Use :class:`~acoular.base.TimeOut` instead.
319
- """
320
-
321
- #: Data source; :class:`~acoular.base.SamplesGenerator` or derived object.
322
- source = Instance(SamplesGenerator)
323
-
324
- def __init__(self, *args, **kwargs):
325
- super().__init__(*args, **kwargs)
326
- import warnings
327
-
328
- warnings.warn(
329
- 'TimeInOut is deprecated and will be removed in Acoular 25.07. Use TimeOut instead.',
330
- DeprecationWarning,
331
- stacklevel=2,
332
- )
@@ -3,6 +3,12 @@
3
3
  # ------------------------------------------------------------------------------
4
4
  """Implements calibration of multichannel time signals.
5
5
 
6
+ .. inheritance-diagram::
7
+ acoular.calib
8
+ :top-classes:
9
+ acoular.base.InOut
10
+ :parts: 1
11
+
6
12
  .. autosummary::
7
13
  :toctree: generated/
8
14
 
@@ -12,19 +18,14 @@
12
18
  # imports from other packages
13
19
  import xml.dom.minidom
14
20
 
15
- from numpy import array, newaxis
16
- from traits.api import CArray, CInt, File, List, Property, Union, cached_property, on_trait_change
17
-
18
- import acoular as ac
19
-
20
- from .base import InOut
21
+ import numpy as np
22
+ from traits.api import CArray, CInt, File, List, Property, Union, cached_property, observe
21
23
 
22
24
  # acoular imports
23
- from .deprecation import deprecated_alias
25
+ from .base import InOut, SamplesGenerator, SpectraGenerator
24
26
  from .internal import digest
25
27
 
26
28
 
27
- @deprecated_alias({'from_file': 'file'})
28
29
  class Calib(InOut):
29
30
  """Processing block for handling calibration data in `*.xml` or NumPy format.
30
31
 
@@ -72,7 +73,6 @@ class Calib(InOut):
72
73
  0.07458428+0.49657939j 1.772696 +3.92233098j 3.19543248+0.17988554j
73
74
  0.3379041 -3.93342331j 0.93949242+2.5328611j 2.97352574+0.j ]]
74
75
 
75
- Deprecated and will be removed in Acoular 25.10:
76
76
  This class serves as interface to load calibration data for the used
77
77
  microphone array. The calibration factors are stored as [Pa/unit].
78
78
  """
@@ -100,8 +100,9 @@ class Calib(InOut):
100
100
  # Internal identifier
101
101
  digest = Property(depends_on=['source.digest', 'data'])
102
102
 
103
- @on_trait_change('data')
104
- def set_num_mics(self):
103
+ @observe('data')
104
+ def _update_num_mics(self, event): # noqa ARG002
105
+ """Sets the number of microphones based on the shape of the data array."""
105
106
  self.num_mics = self.data.shape[0]
106
107
 
107
108
  @cached_property
@@ -109,14 +110,14 @@ class Calib(InOut):
109
110
  if len(self.invalid_channels) == 0:
110
111
  return slice(0, None, None)
111
112
  allr = [i for i in range(self.num_mics) if i not in self.invalid_channels]
112
- return array(allr)
113
+ return np.array(allr)
113
114
 
114
115
  @cached_property
115
116
  def _get_digest(self):
116
117
  return digest(self)
117
118
 
118
- @on_trait_change('file')
119
- def import_data(self):
119
+ @observe('file')
120
+ def _import_data(self, event): # noqa ARG002
120
121
  """Loads the calibration data from `*.xml` file ."""
121
122
  doc = xml.dom.minidom.parse(self.file)
122
123
  names = []
@@ -124,7 +125,7 @@ class Calib(InOut):
124
125
  for element in doc.getElementsByTagName('pos'):
125
126
  names.append(element.getAttribute('Name'))
126
127
  data.append(float(element.getAttribute('factor')))
127
- self.data = array(data, 'd')
128
+ self.data = np.array(data, 'd')
128
129
  self.num_mics = self.data.shape[0]
129
130
 
130
131
  def __validate_data(self):
@@ -136,13 +137,13 @@ class Calib(InOut):
136
137
  msg = 'No source data available.'
137
138
  raise ValueError(msg)
138
139
  tobj = self.source
139
- while isinstance(tobj, ac.InOut):
140
+ while isinstance(tobj, InOut):
140
141
  tobj = tobj.source
141
- if isinstance(tobj, ac.SamplesGenerator) and (self.data[self.channels].shape[0] != tobj.num_channels):
142
+ if isinstance(tobj, SamplesGenerator) and (self.data[self.channels].shape[0] != tobj.num_channels):
142
143
  msg = f'calibration data shape {self.data[self.channels].shape[0]} does not match \
143
144
  source data shape {tobj.num_channels}'
144
145
  raise ValueError(msg)
145
- if isinstance(tobj, ac.SpectraGenerator) and (
146
+ if isinstance(tobj, SpectraGenerator) and (
146
147
  self.data[self.channels].shape[0] != tobj.num_channels * tobj.num_freqs
147
148
  ):
148
149
  msg = f'calibration data shape {self.data[self.channels].shape[0]} does not match \
@@ -170,4 +171,4 @@ class Calib(InOut):
170
171
  """
171
172
  self.__validate_data()
172
173
  for block in self.source.result(num):
173
- yield block * self.data[self.channels][newaxis]
174
+ yield block * self.data[self.channels][np.newaxis]
@@ -39,9 +39,9 @@ if 'numpy' in sys.modules:
39
39
  # check if it uses OpenBLAS or another library
40
40
  if 'openblas' in temp_stdout.getvalue().lower() and environ.get('OPENBLAS_NUM_THREADS') != '1':
41
41
  # it's OpenBLAS, set numba threads=1 to avoid overcommittment
42
- import numba
42
+ import numba as nb
43
43
 
44
- numba.set_num_threads(1)
44
+ nb.set_num_threads(1)
45
45
  warn(
46
46
  'We detected that Numpy is already loaded and uses OpenBLAS. Because '
47
47
  'this conflicts with Numba parallel execution, we disable parallel '
@@ -68,7 +68,7 @@ class Config(HasStrictTraits):
68
68
  The package used to read and write .h5 files can be specified
69
69
  by :attr:`h5library`.
70
70
 
71
- Example:
71
+ Examples
72
72
  --------
73
73
  For using Acoular with h5py package and overwrite existing cache:
74
74
 
@@ -11,4 +11,9 @@
11
11
  """
12
12
 
13
13
  from . import acoular_demo
14
- from .acoular_demo import create_three_sources
14
+ from .acoular_demo import (
15
+ create_three_sources,
16
+ create_three_sources_1d,
17
+ create_three_sources_2d,
18
+ create_three_sources_3d,
19
+ )
@@ -33,28 +33,52 @@ Source Location RMS
33
33
 
34
34
 
35
35
  def create_three_sources(mg, h5savefile='three_sources.h5'):
36
- """Create three noise sources and return them as Mixer."""
37
- import acoular as ac
36
+ """
37
+ Create three noise sources and return them as Mixer.
38
+
39
+ Alias for :func:`create_three_sources_2d`.
40
+ """
41
+ return create_three_sources_2d(mg, h5savefile=h5savefile)
42
+
38
43
 
39
- # set up the parameters
44
+ def _create_three_sources(mg, locs, h5savefile='', sfreq=51200, duration=1):
45
+ """Create three noise sources with custom locations and return them as Mixer."""
46
+ import acoular as ac
40
47
 
41
- sfreq = 51200
42
- duration = 1
43
48
  nsamples = duration * sfreq
44
49
 
45
50
  n1 = ac.WNoiseGenerator(sample_freq=sfreq, num_samples=nsamples, seed=1)
46
51
  n2 = ac.WNoiseGenerator(sample_freq=sfreq, num_samples=nsamples, seed=2, rms=0.7)
47
52
  n3 = ac.WNoiseGenerator(sample_freq=sfreq, num_samples=nsamples, seed=3, rms=0.5)
48
- p1 = ac.PointSource(signal=n1, mics=mg, loc=(-0.1, -0.1, -0.3))
49
- p2 = ac.PointSource(signal=n2, mics=mg, loc=(0.15, 0, -0.3))
50
- p3 = ac.PointSource(signal=n3, mics=mg, loc=(0, 0.1, -0.3))
51
- pa = ac.Mixer(source=p1, sources=[p2, p3])
53
+
54
+ noises = [n1, n2, n3]
55
+ ps = [ac.PointSource(signal=n, mics=mg, loc=loc) for n, loc in list(zip(noises, locs))]
56
+ pa = ac.Mixer(source=ps[0], sources=ps[1:])
57
+
52
58
  if h5savefile:
53
59
  wh5 = ac.WriteH5(source=pa, file=h5savefile)
54
60
  wh5.save()
55
61
  return pa
56
62
 
57
63
 
64
+ def create_three_sources_1d(mg, h5savefile='three_sources_1d.h5'):
65
+ """Create three noise sources on a 1D line and return them as Mixer."""
66
+ locs = [(-0.1, 0, -0.3), (0.15, 0, -0.3), (0, 0, -0.3)]
67
+ return _create_three_sources(mg, locs, h5savefile=h5savefile)
68
+
69
+
70
+ def create_three_sources_2d(mg, h5savefile='three_sources_2d.h5'):
71
+ """Create three noise sources in a 2D plane and return them as Mixer."""
72
+ locs = [(-0.1, -0.1, -0.3), (0.15, 0, -0.3), (0, 0.1, -0.3)]
73
+ return _create_three_sources(mg, locs, h5savefile=h5savefile)
74
+
75
+
76
+ def create_three_sources_3d(mg, h5savefile='three_sources_3d.h5'):
77
+ """Create three noise sources in 3D space and return them as Mixer."""
78
+ locs = [(-0.1, -0.1, -0.3), (0.15, 0, -0.17), (0, 0.1, -0.25)]
79
+ return _create_three_sources(mg, locs, h5savefile=h5savefile)
80
+
81
+
58
82
  def run():
59
83
  """Run the Acoular demo."""
60
84
  from pathlib import Path
@@ -87,7 +111,7 @@ def run():
87
111
  from matplotlib.pyplot import axis, colorbar, figure, imshow, plot, show
88
112
 
89
113
  # show map
90
- imshow(spl.T, origin='lower', vmin=spl.max() - 10, extent=rg.extend(), interpolation='bicubic')
114
+ imshow(spl.T, origin='lower', vmin=spl.max() - 10, extent=rg.extent, interpolation='bicubic')
91
115
  colorbar()
92
116
 
93
117
  # plot microphone geometry
@@ -1,6 +1,13 @@
1
1
  # ------------------------------------------------------------------------------
2
2
  # Copyright (c) Acoular Development Team.
3
3
  # ------------------------------------------------------------------------------
4
+ """Implements helper functions for deprecation handling.
5
+
6
+ .. autosummary::
7
+ :toctree: generated/
8
+
9
+ deprecated_alias
10
+ """
4
11
 
5
12
  from warnings import warn
6
13
 
@@ -8,7 +15,9 @@ from traits.api import Property
8
15
 
9
16
 
10
17
  def deprecated_alias(old2new, read_only=False, removal_version=''):
11
- """Decorator function for deprecating renamed class traits.
18
+ """
19
+ Decorator function for deprecating renamed class traits.
20
+
12
21
  Replaced traits should no longer be part of the class definition
13
22
  and only mentioned in this decorator's parameter list.
14
23
  The replacement trait has to be defined in the updated class and