acoular 25.1__py3-none-any.whl → 25.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/trajectory.py CHANGED
@@ -19,30 +19,80 @@ from .internal import digest
19
19
 
20
20
 
21
21
  class Trajectory(HasStrictTraits):
22
- """Describes a trajectory from sampled points.
23
-
24
- Based on a discrete number of points in space and time, a
25
- continuous trajectory is calculated using spline interpolation
26
- of positions between samples.
27
22
  """
28
-
29
- #: Dictionary that assigns discrete time instants (keys) to
30
- #: sampled `(x, y, z)` positions along the trajectory (values).
23
+ Represents a trajectory as a continuous curve derived from sampled points.
24
+
25
+ The :class:`Trajectory` class computes a smooth, continuous path through a set of discrete
26
+ points in space and time using spline interpolation. It also supports evaluating the trajectory
27
+ and its derivatives at arbitrary time instants.
28
+
29
+ It can be used to:
30
+ - define the traveling path of a moving sound source, e.g. for microphone array data
31
+ simulation (see :class:`~acoular.sources.MovingPointSource`)
32
+ - move a source grid along a certain path to create a fixed focus
33
+ (see :class:`~acoular.tbeamform.BeamformerTimeTraj`
34
+ and :class:`~acoular.tbeamform.BeamformerCleantTraj`)
35
+
36
+ Exemplary use can also be seen in the
37
+ :ref:`rotating point source example<rotating_point_source>`.
38
+
39
+ See Also
40
+ --------
41
+ :class:`~acoular.sources.MovingPointSource` : Model a point source moving along a trajectory.
42
+ :class:`~acoular.sources.MovingPointSourceDipole` :
43
+ Model a point source dipole moving along a trajectory.
44
+ :class:`~acoular.sources.MovingLineSource` : Model a line source moving along a trajectory.
45
+ :class:`~acoular.tbeamform.BeamformerCleantTraj` :
46
+ Beamformer implementing the CLEAN method :cite:`Kujawski2020` in time domain
47
+ for moving sources with known trajectory.
48
+ :class:`~acoular.tbeamform.BeamformerTimeTraj` :
49
+ Basic time domain beamformer with time signal output for a grid moving along a trajectory.
50
+ :func:`scipy.interpolate.splprep` : Underlying spline generation function.
51
+ :func:`scipy.interpolate.splev` : Used for evaluating the spline.
52
+
53
+ Notes
54
+ -----
55
+ - Spline interpolation provides a smooth trajectory that passes through all sampled points.
56
+ The interpolation order is adjusted automatically based on the number of points.
57
+ - The trajectory can be used in simulations where a source's motion must be modeled
58
+ continuously.
59
+
60
+ Examples
61
+ --------
62
+ Create a trajectory and evaluate positions and velocities:
63
+
64
+ >>> from acoular import Trajectory
65
+ >>> points = {0.0: (0.0, 0.0, 0.0), 1.0: (1.0, 0.0, 0.0), 2.0: (2.0, 1.0, 0.0)}
66
+ >>> tr = Trajectory(points=points)
67
+ >>>
68
+ >>> tr.location(1.5) # Position at t=1.5
69
+ [array(1.5), array(0.375), array(0.)]
70
+ >>>
71
+ >>> for pos in tr.traj(0.0, 2.0, 0.5): # Positions every 0.5 seconds
72
+ ... print(pos)
73
+ (np.float64(0.0), np.float64(0.0), np.float64(0.0))
74
+ (np.float64(0.5), np.float64(-0.125), np.float64(0.0))
75
+ (np.float64(1.0), np.float64(0.0), np.float64(0.0))
76
+ (np.float64(1.5), np.float64(0.375), np.float64(0.0))
77
+ """ # noqa W505
78
+
79
+ #: Dictionary mapping time instants (keys, as floats) to sampled ``(x, y, z)`` positions
80
+ #: (values, as tuples of floats) along the trajectory.
31
81
  points = Dict(
32
82
  key_trait=Float,
33
83
  value_trait=Tuple(Float, Float, Float),
34
84
  desc='sampled positions along the trajectory',
35
85
  )
36
86
 
37
- #: Tuple of the start and end time, is set automatically
38
- #: (depending on :attr:`points`).
87
+ #: Automatically determined tuple ``(t_min, t_max)`` representing the start and end times of the
88
+ #: trajectory, based on the keys in :attr:`points`.
39
89
  interval = Property()
40
90
  # t_min, t_max tuple
41
91
 
42
- #: Spline data, internal use.
92
+ #: Internal representation of the spline, generated using :func:`scipy.interpolate.splprep`.
43
93
  tck = Property()
44
94
 
45
- # internal identifier
95
+ #: A unique identifier for the trajectory, based on its points. (read-only)
46
96
  digest = Property(depends_on=['points[]'])
47
97
 
48
98
  @cached_property
@@ -62,54 +112,80 @@ class Trajectory(HasStrictTraits):
62
112
  return tcku[0]
63
113
 
64
114
  def location(self, t, der=0):
65
- """Returns the positions for one or more instants in time.
115
+ """
116
+ Compute the trajectory's position or derivatives at specified times.
66
117
 
67
118
  Parameters
68
119
  ----------
69
- t : array of floats
70
- Instances in time to calculate the positions at.
71
- der : integer
72
- The order of derivative of the spline to compute, defaults to 0.
120
+ t : :class:`float` or array of :class:`floats<float>`
121
+ Time instant(s) at which to compute the position(s) or derivative(s).
122
+ der : :class:`int`, optional
123
+ Order of the derivative to compute:
124
+ - ``0`` for positions (default),
125
+ - ``1`` for velocities,
126
+ - ``2`` for accelerations, etc.
73
127
 
74
128
  Returns
75
129
  -------
76
- (x, y, z) : tuple with arrays of floats
77
- Positions at the given times; `x`, `y` and `z` have the same shape as `t`.
130
+ :class:`numpy.ndarray`
131
+ ``(x, y, z)`` arrays representing the trajectory's position (or derivative) at the given
132
+ time(s). The shape matches that of ``t``.
78
133
 
134
+ Examples
135
+ --------
136
+ >>> import acoular as ac
137
+ >>>
138
+ >>> points = {0.0: (0.0, 0.0, 0.0), 1.0: (1.0, 2.0, 0.0), 2.0: (2.0, 4.0, 0.0)}
139
+ >>> tr = ac.Trajectory(points=points)
140
+ >>> tr.location(1.0) # Position at t=1.0
141
+ [array(1.), array(2.), array(0.)]
142
+ >>> tr.location([0.5, 1.5], der=1) # Velocity at t=0.5 and t=1.5
143
+ [array([1., 1.]), array([2., 2.]), array([0., 0.])]
79
144
  """
80
145
  return splev(t, self.tck, der)
81
146
 
82
147
  def traj(self, t_start, t_end=None, delta_t=None, der=0):
83
- """Python generator that yields locations along the trajectory.
148
+ """
149
+ Interate through trajectory positions or derivatives at specified intervals.
84
150
 
85
151
  Parameters
86
152
  ----------
87
- t_start : float
88
- Starting time of the trajectory, defaults to the earliest
89
- time in :attr:`points`.
90
- t_end : float
91
- Ending time of the trajectory, defaults to the latest
92
- time in :attr:`points`.
93
- delta_t : float
94
- Time interval between yielded trajectory points, defaults to earliest
95
- time in :attr:`points`.
96
-
97
- Returns
98
- -------
99
- (x, y, z) : tuples of floats
100
- Positions at the desired times are yielded.
153
+ t_start : :class:`float`
154
+ Start time for the trajectory. Default is earliest key in :attr:`points`.
155
+ t_end : :class:`float`, optional
156
+ End time of the trajectory. Default is the latest key in :attr:`points`.
157
+ delta_t : :class:`float`, optional
158
+ Time interval between consecutive points to yield. Default is the value of ``t_start``.
159
+ der : int, optional
160
+ Order of the derivative to compute:
161
+ - ``0`` for positions (default),
162
+ - ``1`` for velocities,
163
+ - ``2`` for accelerations, etc.
164
+
165
+ Yields
166
+ ------
167
+ :class:`tuple` of :class:`floats<float>`
168
+ ``(x, y, z)`` positions or derivatives at the specified time intervals.
169
+
170
+ Notes
171
+ -----
172
+ The function precomputes all interpolated locations for efficiency and yields them
173
+ sequentially.
101
174
 
102
175
  Examples
103
176
  --------
104
- x.traj(0.1)
105
- Yields the position every 0.1 s within the
106
- given :attr:`interval`.
107
- x.traj(2.5, 4.5, 0.1)
108
- Yields the position every 0.1 s between 2.5 s and 4.5 s.
109
- x.traj(0.1, der=1)
110
- Yields the 1st derivative of the spline (= velocity vector) every 0.1 s
111
- within the given :attr:`interval`.
112
-
177
+ Create a trajectory and iterate through the positions in the :attr:`interval`:
178
+
179
+ >>> import acoular as ac
180
+ >>>
181
+ >>> points = {0.0: (0.0, 0.0, 0.0), 1.0: (1.0, 0.0, 0.0), 2.0: (2.0, 1.0, 0.0)}
182
+ >>> tr = ac.Trajectory(points=points)
183
+ >>> for pos in tr.traj(0.0, 2.0, 0.5):
184
+ ... print(pos)
185
+ (np.float64(0.0), np.float64(0.0), np.float64(0.0))
186
+ (np.float64(0.5), np.float64(-0.125), np.float64(0.0))
187
+ (np.float64(1.0), np.float64(0.0), np.float64(0.0))
188
+ (np.float64(1.5), np.float64(0.375), np.float64(0.0))
113
189
  """
114
190
  if not delta_t:
115
191
  delta_t = t_start
acoular/version.py CHANGED
@@ -4,5 +4,5 @@
4
4
 
5
5
  # separate file to find out about version without importing the acoular lib
6
6
  __author__ = 'Acoular Development Team'
7
- __date__ = '31 January 2024'
8
- __version__ = '25.01'
7
+ __date__ = '12 March 2025'
8
+ __version__ = '25.03'
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: acoular
3
- Version: 25.1
3
+ Version: 25.3
4
4
  Summary: Python library for acoustic beamforming
5
5
  Project-URL: homepage, https://acoular.org
6
6
  Project-URL: documentation, https://acoular.org
@@ -197,12 +197,13 @@ If you are interested in contributing, have a look at the [CONTRIBUTING.md](CONT
197
197
  This reads data from 64 microphone channels and computes a beamforming map for the 8kHz third octave band:
198
198
 
199
199
  ```python
200
- from os.path import join, split
200
+ from pathlib import Path
201
+
201
202
  import acoular as ac
202
203
  import matplotlib.pylab as plt
203
204
 
204
205
  # this file contains the microphone coordinates
205
- micgeofile = join(split(ac.__file__)[0],'xml','array_64.xml')
206
+ micgeofile = Path(ac.__file__).parent / 'xml' / 'array_64.xml'
206
207
  # set up object managing the microphone coordinates
207
208
  mg = ac.MicGeom( file=micgeofile )
208
209
  # generate test data, in real life this would come from an array measurement
@@ -214,7 +215,7 @@ ps = ac.PowerSpectra( source=ts, block_size=128, window='Hanning' )
214
215
  # alternatively, you can use the in-memory Mixer object directly:
215
216
  # ps = ac.PowerSpectra( source=p, block_size=128, window='Hanning' )
216
217
  # set up object managing the mapping grid
217
- rg = ac.RectGrid( x_min=-0.2, x_max=0.2, y_min=-0.2, y_max=0.2, z=0.3, \
218
+ rg = ac.RectGrid( x_min=-0.2, x_max=0.2, y_min=-0.2, y_max=0.2, z=-0.3, \
218
219
  increment=0.01 )
219
220
  # set up steering vector, implicitely contains also the standard quiescent
220
221
  # environment with standard speed of sound
@@ -229,7 +230,7 @@ Lm = ac.L_p( pm )
229
230
  # plot the map
230
231
  plt.imshow( Lm.T, origin='lower', vmin=Lm.max()-10, extent=rg.extend(), \
231
232
  interpolation='bicubic')
232
- plt.title(f'Beamformer (base) for 3 sources measured for 8000 Hz')
233
+ plt.title('Beamformer (base) for 3 sources measured for 8000 Hz')
233
234
  plt.xlabel('x in m')
234
235
  plt.ylabel('y in m')
235
236
  plt.colorbar(label=r'$L_p$')
@@ -3,30 +3,30 @@ acoular/base.py,sha256=gqFsfgSG1YrS-BAmV44ao6ckXo7v5B2VMX86QH3QowE,10717
3
3
  acoular/calib.py,sha256=P46L1U8Lk0_BSY3AQz0KO4g8rsZmi47j3YaQOlHK64A,7133
4
4
  acoular/configuration.py,sha256=QQU5HWjXEDMuMU3LEoaDnDszhqeJzCGhZ5oGbsW2qFY,8630
5
5
  acoular/deprecation.py,sha256=lfmCRvwYu_tXSEk5HfYDmagPCVBL7082m3oq5kvxOZ8,3810
6
- acoular/environments.py,sha256=EBkoj3Xo9VmR6qI6kKXZzCFqLtVP-XS95nAF3xqd2AQ,22498
6
+ acoular/environments.py,sha256=tWRJSCzIa0eSBX2AGjrWciz12mq2nPzs0AAQc9yFGqk,35998
7
7
  acoular/fastFuncs.py,sha256=6Iqm-xy2T7qBaYpdpgUquup6JkAwdURhSXfAEkgqVOs,37362
8
8
  acoular/fbeamform.py,sha256=IY7RlM_7Yl8UjCgnDPVmAEmBASS83yGsefg6OAcWFCk,99057
9
- acoular/fprocess.py,sha256=tEeuzjlWxftcwnrF0KsoKoN_9hQ-zHKax98ssa2o4Zc,14734
10
- acoular/grids.py,sha256=fINM66R59BPHD0myBarkbDBNjt7vdhXR2VI4_vxj5Nw,39631
9
+ acoular/fprocess.py,sha256=NK3Nt2jD0Dvq5kPLWvodFRGKd9oIpk6Rgy_U48R49Yg,20706
10
+ acoular/grids.py,sha256=Mcc9lmh5qXLfAxu5mpImPNkUuEcd2wEas74ovlarmuY,58981
11
11
  acoular/h5cache.py,sha256=tHCJjHs26ZnRtPO6uj9PqJ2xMEEJup-A8FoiiojkkLw,4166
12
12
  acoular/h5files.py,sha256=RKMBfbFX8d_d4JEnyMyHQQjN74EhW6W4CE-drmDZakY,7553
13
13
  acoular/internal.py,sha256=qgluN_4Br7U74keTiavbmxRMkcNkoHcL1TihKTcMEBs,829
14
- acoular/microphones.py,sha256=muyIDWdfbjQfahJmiHTjl1KJlw0Exfcw0oSGZCXrQLI,4534
15
- acoular/process.py,sha256=NOiMULyH3aYFHRp3uKnPvLQuvz0HLXkzvHDHJzMQtfE,30099
14
+ acoular/microphones.py,sha256=IrPDPB4v4mM2ONLkwODjgOVPTMZSSPoMAFXjAMp4QEw,10591
15
+ acoular/process.py,sha256=86wfR87RsSpYqa7ZmC4FtmEmp4zPDL0ICq8QdiTYLeI,41043
16
16
  acoular/sdinput.py,sha256=93uQaO5Zt2DV83iyeoFMaPXww1rp0PP4HB6M-C2FDak,5109
17
- acoular/signals.py,sha256=GDJkM1oDFzhS8ibm1BVWGvJy2Gd-GBDZGs4fW94LqvA,12344
18
- acoular/sources.py,sha256=E8hBtpaAkY3VecdCWyfyIbP0wY06nKX6lr2KMaQETdg,55679
19
- acoular/spectra.py,sha256=53Piz1NPE7BTNUCkv0Dwe8AUQn8XiKWgFuKH01j2xN8,21160
17
+ acoular/signals.py,sha256=ue_KtTbrcMUzX_aUM8pqhm3jviNGeh32Nk-wXrCVw_g,24416
18
+ acoular/sources.py,sha256=7-XHQMeiE2D4NSxgbGpFDwZL08Xb92New6lsTxDwbfs,97225
19
+ acoular/spectra.py,sha256=oU5m124tlvlIaN3MbqZarHw9hO6hMowpg3WY6FFqRXo,28837
20
20
  acoular/tbeamform.py,sha256=-CAvutAY4VK4cILq1GOu7oTjwNh_R0gjVCLjLmM-5U0,30857
21
21
  acoular/tfastfuncs.py,sha256=q2ZbDoWmFbGMZw1TT_h-21hn24qGi2of_ZqJVoLMYhc,7901
22
22
  acoular/tprocess.py,sha256=gm6lvIJogR0_S17StsXe4e_y2dssTLyaPH0mb-6ykN0,77502
23
23
  acoular/traitsviews.py,sha256=VO-i509WAMQG7KuJatlCWeexZeTAFEjmjbNDkGSfzX4,13773
24
- acoular/trajectory.py,sha256=vWYIMERnJ6SNOe3pyVL_Z-hsY2NjmOZTTdcRhCSUU7E,3943
25
- acoular/version.py,sha256=sdJuvOcO1kksddYczK0fqVXPreUk9IC3tOBHGsqhemU,380
24
+ acoular/trajectory.py,sha256=cOawITHARdcsBwpHfBleosltDwU-31xtOlZ7clrcbvA,7910
25
+ acoular/version.py,sha256=G10HLGx_t9fD3x7HMmmPoYx8REcItCTTVwu8YXjN1MA,378
26
26
  acoular/aiaa/__init__.py,sha256=5RhoERGQmLBf6uosr9hYHWy_MruKiyR5x-8cMRX4hT4,420
27
27
  acoular/aiaa/aiaa.py,sha256=WvQFr7D37QhdUVgrBOifE76zX9FFe1eexumQd1_3_2M,6310
28
28
  acoular/demo/__init__.py,sha256=fxf0-D7Pxepi0bmxPwCj3Yo-vgCC37faTLlPaotMkB0,380
29
- acoular/demo/acoular_demo.py,sha256=7JrR1hIXXDScOcohfhEJaZsfegu0CmfCoqe8SmJ8zZ4,3497
29
+ acoular/demo/acoular_demo.py,sha256=HDANP1vA5OXBkuolpCeWRt8hr_jFKnu_sQRbCtbApPo,3513
30
30
  acoular/tools/__init__.py,sha256=z8RHRQhcmqkUKwD8v3pInpAMN8csPcN5J4Z9QXu_GjQ,511
31
31
  acoular/tools/helpers.py,sha256=L9Bi6WmGBiyF_Xz5L5wtIgk0tobd4FX8gG6mfGA8z2k,13468
32
32
  acoular/tools/metrics.py,sha256=y6TsavywfnuMScBcFxIrcKcDuC55WfIGkNFnCuuuj3Y,6136
@@ -49,8 +49,8 @@ acoular/xml/gfai_ring32.xml,sha256=liKaGpfgUn8R1psDmiw6qqpZi5SwtPWBRhwhqy7YuOc,1
49
49
  acoular/xml/minidsp_uma-16.xml,sha256=oBj7J96RTDZufsQ7S4rw0jAvLOoykJaIGgl6_2gMON4,1140
50
50
  acoular/xml/minidsp_uma-16_mirrored.xml,sha256=l6LUPIsEVg7HPMbs9NbnqZyFhpCSYS70glsbyH3IUOE,1418
51
51
  acoular/xml/tub_vogel64.xml,sha256=PixVMx5hMJjgBOekH46uu6D3ODqYVOLlk82zkYl4EBM,4424
52
- acoular-25.1.dist-info/METADATA,sha256=nO3qOShX0uZtIhJXcz-jPUnBT43a6uKXCVE2fH7Y_G0,12774
53
- acoular-25.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
54
- acoular-25.1.dist-info/licenses/AUTHORS.rst,sha256=445q_Us_TnQx8s_GP2yringU2DMTk3-ycrk2REtSsx0,382
55
- acoular-25.1.dist-info/licenses/LICENSE,sha256=tbw7-nx204gXCo8p-NwwR7w8oKvNMWB4H07FTT6V9p8,1505
56
- acoular-25.1.dist-info/RECORD,,
52
+ acoular-25.3.dist-info/METADATA,sha256=M_4x0wwsiPt3Pi93mMs1ryK-v3MrqiVT5R50bgo7PMM,12769
53
+ acoular-25.3.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
54
+ acoular-25.3.dist-info/licenses/AUTHORS.rst,sha256=445q_Us_TnQx8s_GP2yringU2DMTk3-ycrk2REtSsx0,382
55
+ acoular-25.3.dist-info/licenses/LICENSE,sha256=tbw7-nx204gXCo8p-NwwR7w8oKvNMWB4H07FTT6V9p8,1505
56
+ acoular-25.3.dist-info/RECORD,,
File without changes