jaxtfwaves 0.3.1__tar.gz → 0.4.0__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.
- {jaxtfwaves-0.3.1 → jaxtfwaves-0.4.0}/PKG-INFO +1 -1
- {jaxtfwaves-0.3.1 → jaxtfwaves-0.4.0}/pyproject.toml +3 -3
- {jaxtfwaves-0.3.1/src/tfplugins → jaxtfwaves-0.4.0/src/jaxtfplugins}/sobhbwaveform/sobhbwaveform_ripple.py +7 -7
- {jaxtfwaves-0.3.1/src/tfwaves → jaxtfwaves-0.4.0/src/jaxtfwaves}/stft.py +12 -23
- {jaxtfwaves-0.3.1/src/tfwaves → jaxtfwaves-0.4.0/src/jaxtfwaves}/tlt_adapters.py +3 -2
- {jaxtfwaves-0.3.1/src/tfwaves → jaxtfwaves-0.4.0/src/jaxtfwaves}/waveform.py +91 -2
- {jaxtfwaves-0.3.1 → jaxtfwaves-0.4.0}/tests/test_stft.py +10 -4
- {jaxtfwaves-0.3.1 → jaxtfwaves-0.4.0}/tests/test_tlt_adapters.py +12 -11
- {jaxtfwaves-0.3.1 → jaxtfwaves-0.4.0}/tests/test_waveform.py +1 -1
- {jaxtfwaves-0.3.1 → jaxtfwaves-0.4.0}/uv.lock +4 -4
- {jaxtfwaves-0.3.1 → jaxtfwaves-0.4.0}/.gitattributes +0 -0
- {jaxtfwaves-0.3.1 → jaxtfwaves-0.4.0}/.gitignore +0 -0
- {jaxtfwaves-0.3.1 → jaxtfwaves-0.4.0}/.gitlab-ci.yml +0 -0
- {jaxtfwaves-0.3.1 → jaxtfwaves-0.4.0}/.pre-commit-config.yaml +0 -0
- {jaxtfwaves-0.3.1 → jaxtfwaves-0.4.0}/README.md +0 -0
- {jaxtfwaves-0.3.1 → jaxtfwaves-0.4.0}/notebooks/EMRI.ipynb +0 -0
- {jaxtfwaves-0.3.1 → jaxtfwaves-0.4.0}/notebooks/emri-example-2.ipynb +0 -0
- {jaxtfwaves-0.3.1 → jaxtfwaves-0.4.0}/notebooks/emri-example-tdi.ipynb +0 -0
- {jaxtfwaves-0.3.1 → jaxtfwaves-0.4.0}/notebooks/emri-example.ipynb +0 -0
- {jaxtfwaves-0.3.1 → jaxtfwaves-0.4.0}/notebooks/fd-linear-chirp_example.ipynb +0 -0
- {jaxtfwaves-0.3.1 → jaxtfwaves-0.4.0}/notebooks/linear-chirp-example-multiple-modes.ipynb +0 -0
- {jaxtfwaves-0.3.1 → jaxtfwaves-0.4.0}/notebooks/linear-chirp-example-tdi.ipynb +0 -0
- {jaxtfwaves-0.3.1 → jaxtfwaves-0.4.0}/notebooks/linear-chirp-example.ipynb +0 -0
- {jaxtfwaves-0.3.1 → jaxtfwaves-0.4.0}/notebooks/sobhb-example-ripple.ipynb +0 -0
- {jaxtfwaves-0.3.1 → jaxtfwaves-0.4.0}/notebooks/sobhb-example.ipynb +0 -0
- {jaxtfwaves-0.3.1 → jaxtfwaves-0.4.0}/notebooks/tlt-api-tour.ipynb +0 -0
- {jaxtfwaves-0.3.1/src/tfplugins → jaxtfwaves-0.4.0/src/jaxtfplugins}/__init__.py +0 -0
- {jaxtfwaves-0.3.1/src/tfplugins → jaxtfwaves-0.4.0/src/jaxtfplugins}/sobhbwaveform/__init__.py +0 -0
- {jaxtfwaves-0.3.1/src/tfplugins → jaxtfwaves-0.4.0/src/jaxtfplugins}/sobhbwaveform/sobhbparams.py +0 -0
- {jaxtfwaves-0.3.1/src/tfwaves → jaxtfwaves-0.4.0/src/jaxtfwaves}/__init__.py +0 -0
- {jaxtfwaves-0.3.1/src/tfwaves → jaxtfwaves-0.4.0/src/jaxtfwaves}/interpolation.py +0 -0
- {jaxtfwaves-0.3.1/src/tfwaves → jaxtfwaves-0.4.0/src/jaxtfwaves}/response.py +0 -0
- {jaxtfwaves-0.3.1/src/tfwaves → jaxtfwaves-0.4.0/src/jaxtfwaves}/utils.py +0 -0
- {jaxtfwaves-0.3.1 → jaxtfwaves-0.4.0}/tests/__init__.py +0 -0
- {jaxtfwaves-0.3.1 → jaxtfwaves-0.4.0}/tests/orbits.h5 +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: jaxtfwaves
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.4.0
|
|
4
4
|
Summary: Fast time-frequency gravitational-wave response package for LISA data analysis with a JAX backend
|
|
5
5
|
Author-email: Gael Servignat <servignat@apc.in2p3.fr>, Quentin Baghi <quentin.baghi@protonmail.com>, Saptarshi Ghosh <saptarshi.ghosh@apc.in2p3.fr>
|
|
6
6
|
Requires-Python: <3.14,>=3.12
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "jaxtfwaves"
|
|
3
|
-
version = "0.
|
|
3
|
+
version = "0.4.0"
|
|
4
4
|
description = "Fast time-frequency gravitational-wave response package for LISA data analysis with a JAX backend"
|
|
5
5
|
authors = [
|
|
6
6
|
{name = "Gael Servignat",email = "servignat@apc.in2p3.fr"},
|
|
@@ -36,10 +36,10 @@ requires = ["hatchling>=1.27.0"]
|
|
|
36
36
|
build-backend = "hatchling.build"
|
|
37
37
|
|
|
38
38
|
[tool.hatch.build.targets.wheel]
|
|
39
|
-
packages = ["src/
|
|
39
|
+
packages = ["src/jaxtfwaves", "src/jaxtfplugins"]
|
|
40
40
|
|
|
41
41
|
[tool.uv.sources]
|
|
42
|
-
typed-lisa-toolkit = { git = "https://gitlab.in2p3.fr/lisa-apc/typed-lisa-toolkit.git", tag = "0.6.
|
|
42
|
+
typed-lisa-toolkit = { git = "https://gitlab.in2p3.fr/lisa-apc/typed-lisa-toolkit.git", tag = "0.6.3" }
|
|
43
43
|
|
|
44
44
|
[dependency-groups]
|
|
45
45
|
dev = [
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
|
|
5
5
|
import lisaconstants
|
|
6
6
|
|
|
7
|
-
from
|
|
8
|
-
from
|
|
7
|
+
from jaxtfwaves.interpolation import JAXCubicSpline, JAXHermiteSpline
|
|
8
|
+
from jaxtfwaves.waveform import FDWaveform
|
|
9
9
|
|
|
10
10
|
from .sobhbparams import SOBHBParams
|
|
11
11
|
|
|
@@ -90,12 +90,12 @@ class SOBHBWaveform(FDWaveform):
|
|
|
90
90
|
|
|
91
91
|
# --- Computation methods ---
|
|
92
92
|
@jax.jit
|
|
93
|
-
def
|
|
93
|
+
def compute_harmonic_amplitudes(self, freq: jax.typing.ArrayLike) -> jax.Array:
|
|
94
94
|
amplitudes = self.amp_spline(jnp.abs(freq))
|
|
95
95
|
return jnp.where(freq < 0.0, self.fact_neg * amplitudes, self.fact_pos * amplitudes)
|
|
96
96
|
|
|
97
97
|
@jax.jit
|
|
98
|
-
def
|
|
98
|
+
def compute_amplitudes(self, freq: jax.typing.ArrayLike) -> jax.Array:
|
|
99
99
|
"""Computes pure amplitude without Ylm factors"""
|
|
100
100
|
return self.amp_spline(jnp.abs(freq))
|
|
101
101
|
|
|
@@ -146,7 +146,7 @@ class SOBHBWaveform(FDWaveform):
|
|
|
146
146
|
self.compute_times_derivatives(freq),
|
|
147
147
|
)
|
|
148
148
|
|
|
149
|
-
def
|
|
149
|
+
def compute_harmonic_amplitudes_and_phases_derivatives(self, freq: jax.typing.ArrayLike):
|
|
150
150
|
"""
|
|
151
151
|
Compute amplitudes, phases, times, and times derivatives all in a row
|
|
152
152
|
|
|
@@ -162,7 +162,7 @@ class SOBHBWaveform(FDWaveform):
|
|
|
162
162
|
"""
|
|
163
163
|
|
|
164
164
|
return (
|
|
165
|
-
self.
|
|
165
|
+
self.compute_harmonic_amplitudes(freq),
|
|
166
166
|
self.compute_phases(freq),
|
|
167
167
|
self.compute_times(freq),
|
|
168
168
|
self.compute_times_derivatives(freq),
|
|
@@ -171,7 +171,7 @@ class SOBHBWaveform(FDWaveform):
|
|
|
171
171
|
def compute_strain(self, freq: jax.typing.ArrayLike, ssb: bool = False) -> jax.Array:
|
|
172
172
|
"""Compute source-frame gravitational wave strain."""
|
|
173
173
|
|
|
174
|
-
amp = self.
|
|
174
|
+
amp = self.compute_harmonic_amplitudes(freq)
|
|
175
175
|
phase = self.compute_phases(freq)
|
|
176
176
|
|
|
177
177
|
if ssb:
|
|
@@ -275,7 +275,7 @@ class STFTWaveform(ABC):
|
|
|
275
275
|
Indices of time bins
|
|
276
276
|
"""
|
|
277
277
|
offsets = jnp.arange(-di, di + 1)
|
|
278
|
-
return
|
|
278
|
+
return get_nonzero_indices_pure(f_tau, self.delta_t, self.f_bins, offsets)
|
|
279
279
|
|
|
280
280
|
@abstractmethod
|
|
281
281
|
def compute_arm_response_tf(self, **kwargs):
|
|
@@ -434,7 +434,7 @@ class TimeToTFWaveform(STFTWaveform):
|
|
|
434
434
|
t_bins = jnp.asarray(self.t_bins)
|
|
435
435
|
|
|
436
436
|
# Compute amplitude and phase derivatives vs time
|
|
437
|
-
waveform_vars = self.waveform.
|
|
437
|
+
waveform_vars = self.waveform.compute_harmonic_amplitudes_and_phases_derivatives(t_bins)
|
|
438
438
|
|
|
439
439
|
if ssb:
|
|
440
440
|
psi_ldc = self.waveform.compute_polarization_angle()
|
|
@@ -444,9 +444,9 @@ class TimeToTFWaveform(STFTWaveform):
|
|
|
444
444
|
waveform_vars = (amp, phi, dphi, ddphi)
|
|
445
445
|
|
|
446
446
|
# Get the indices of non-zero frequency bins (size (2*di+1, [n_modes,] n_times))
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
447
|
+
indices_f, indices_t = self.get_nonzero_indices(
|
|
448
|
+
waveform_vars[2],
|
|
449
|
+
di=di,
|
|
450
450
|
)
|
|
451
451
|
|
|
452
452
|
# Get the frequencies at the sparse support
|
|
@@ -570,8 +570,10 @@ class FrequencyToTFWaveform(STFTWaveform):
|
|
|
570
570
|
"""
|
|
571
571
|
tau_f = self.waveform.compute_times(self.waveform.freq) + self.t_start
|
|
572
572
|
f_tau = f_of_t_from_dphi(tau_f, self.waveform.freq, self.t_bins)
|
|
573
|
-
|
|
574
|
-
|
|
573
|
+
indices_f, indices_t = self.get_nonzero_indices(
|
|
574
|
+
f_tau,
|
|
575
|
+
di=di,
|
|
576
|
+
)
|
|
575
577
|
f = self.f_bins[indices_f]
|
|
576
578
|
t = self.t_bins[indices_t] - self.t_start
|
|
577
579
|
return indices_f, indices_t, f, t
|
|
@@ -602,8 +604,8 @@ class FrequencyToTFWaveform(STFTWaveform):
|
|
|
602
604
|
# Compute relevant indices
|
|
603
605
|
indices_f, indices_t, f, t = self._prepare_sparse_track_grid(di=di)
|
|
604
606
|
|
|
605
|
-
waveform_vars_plus = self.waveform.
|
|
606
|
-
waveform_vars_minus = self.waveform.
|
|
607
|
+
waveform_vars_plus = self.waveform.compute_harmonic_amplitudes_and_phases_derivatives(f)
|
|
608
|
+
waveform_vars_minus = self.waveform.compute_harmonic_amplitudes_and_phases_derivatives(-f)
|
|
607
609
|
|
|
608
610
|
# if waveform_vars_plus[0].ndim > 1:
|
|
609
611
|
# n_modes = waveform_vars_plus[0].shape[0]
|
|
@@ -613,7 +615,6 @@ class FrequencyToTFWaveform(STFTWaveform):
|
|
|
613
615
|
psi = self.waveform.compute_polarization_angle()
|
|
614
616
|
ssb_fact = compute_ssb_fact(psi, ssb=ssb)
|
|
615
617
|
|
|
616
|
-
# s_plus, s_cross = jax.jit(stft_for_one_waveform, static_argnums=6)(
|
|
617
618
|
s_plus, s_cross = stft_for_one_waveform(
|
|
618
619
|
waveform_vars_plus,
|
|
619
620
|
waveform_vars_minus,
|
|
@@ -647,7 +648,7 @@ class FrequencyToTFWaveform(STFTWaveform):
|
|
|
647
648
|
# Compute relevant indices
|
|
648
649
|
indices_f, indices_t, f, t = self._prepare_sparse_track_grid(di=di)
|
|
649
650
|
|
|
650
|
-
waveform_vars = self.waveform.
|
|
651
|
+
waveform_vars = self.waveform.compute_amplitudes_and_phases_derivatives(f)
|
|
651
652
|
|
|
652
653
|
# Build exact bin edges matching t-bins to avoid arange floating-step drift.
|
|
653
654
|
time_span = (
|
|
@@ -792,9 +793,6 @@ def get_nonzero_indices_pure(f_tau, delta_t, f_bins, offsets):
|
|
|
792
793
|
return jnp.squeeze(indices_f), indices_t
|
|
793
794
|
|
|
794
795
|
|
|
795
|
-
vmapped_get_nonzero_indices_pure = jax.vmap(get_nonzero_indices_pure, in_axes=(0, None, None, None))
|
|
796
|
-
|
|
797
|
-
|
|
798
796
|
def stft_for_one_waveform(
|
|
799
797
|
vars_plus_i,
|
|
800
798
|
vars_minus_i,
|
|
@@ -825,15 +823,6 @@ def stft_for_one_waveform(
|
|
|
825
823
|
return s_plus_i, s_cross_i
|
|
826
824
|
|
|
827
825
|
|
|
828
|
-
stft_for_many_jitted = jax.jit(
|
|
829
|
-
jax.vmap(
|
|
830
|
-
stft_for_one_waveform,
|
|
831
|
-
in_axes=(0, 0, 0, 0, 0, None, None),
|
|
832
|
-
),
|
|
833
|
-
static_argnums=6,
|
|
834
|
-
)
|
|
835
|
-
|
|
836
|
-
|
|
837
826
|
def single_wvf_arm_response_tf(
|
|
838
827
|
f_bins,
|
|
839
828
|
fplus,
|
|
@@ -27,6 +27,7 @@ TLT source: ``typed_lisa_toolkit.types.data.stftdata``
|
|
|
27
27
|
"""
|
|
28
28
|
|
|
29
29
|
import jax.numpy as jnp
|
|
30
|
+
from typed_lisa_toolkit import linspace_from_array as _tlt_linspace_from_array
|
|
30
31
|
from typed_lisa_toolkit import stft as _tlt_stft
|
|
31
32
|
from typed_lisa_toolkit import stftdata as _tlt_stftdata
|
|
32
33
|
|
|
@@ -134,8 +135,8 @@ def sparse_stft_from_tracks(
|
|
|
134
135
|
:,
|
|
135
136
|
] # (1,1,1,1,n_sparse)
|
|
136
137
|
return _tlt_stft(
|
|
137
|
-
jnp.asarray(f_bins, dtype=float),
|
|
138
|
-
jnp.asarray(t_bins, dtype=float),
|
|
138
|
+
_tlt_linspace_from_array(jnp.asarray(f_bins, dtype=float)),
|
|
139
|
+
_tlt_linspace_from_array(jnp.asarray(t_bins, dtype=float)),
|
|
139
140
|
entries,
|
|
140
141
|
sparse_indices=sparse_indices,
|
|
141
142
|
)
|
|
@@ -39,6 +39,14 @@ class Waveform:
|
|
|
39
39
|
"""
|
|
40
40
|
raise NotImplementedError("This method should be implemented by subclasses.")
|
|
41
41
|
|
|
42
|
+
def compute_harmonic_amplitudes(self, *args, **kwargs):
|
|
43
|
+
"""
|
|
44
|
+
Compute the harmonic amplitudes (i.e. weighted by spherical harmonics)
|
|
45
|
+
from the waveform parameters.
|
|
46
|
+
Placeholder for actual implementation.
|
|
47
|
+
"""
|
|
48
|
+
raise NotImplementedError("This method should be implemented by subclasses.")
|
|
49
|
+
|
|
42
50
|
def compute_phases(self, *args, **kwargs):
|
|
43
51
|
"""
|
|
44
52
|
Compute the phases from the waveform parameters.
|
|
@@ -70,6 +78,23 @@ class Waveform:
|
|
|
70
78
|
|
|
71
79
|
raise NotImplementedError("This method should be implemented by subclasses.")
|
|
72
80
|
|
|
81
|
+
def compute_harmonic_amplitudes_and_phases_derivatives(self, *args, **kwargs):
|
|
82
|
+
"""
|
|
83
|
+
Compute amplitudes, phases, frequencies, and frequency derivatives all in a row
|
|
84
|
+
|
|
85
|
+
Parameters
|
|
86
|
+
----------
|
|
87
|
+
tau : ndarray
|
|
88
|
+
STFT times
|
|
89
|
+
|
|
90
|
+
Returns
|
|
91
|
+
-------
|
|
92
|
+
a_tau, phi_tau, f_tau, df_tau
|
|
93
|
+
phases, frequencies, frequency derivatives
|
|
94
|
+
"""
|
|
95
|
+
|
|
96
|
+
raise NotImplementedError("This method should be implemented by subclasses.")
|
|
97
|
+
|
|
73
98
|
def compute_polarization_angle(self, *args, **kwargs):
|
|
74
99
|
"""
|
|
75
100
|
Compute the polarization angle. May not be relevant for all waveforms.
|
|
@@ -120,6 +145,28 @@ class TDWaveform(Waveform):
|
|
|
120
145
|
self.compute_frequencies_derivatives(*args, **kwargs),
|
|
121
146
|
)
|
|
122
147
|
|
|
148
|
+
def compute_harmonic_amplitudes_and_phases_derivatives(self, *args, **kwargs):
|
|
149
|
+
"""
|
|
150
|
+
Compute amplitudes, phases, frequencies, and frequency derivatives all in a row
|
|
151
|
+
|
|
152
|
+
Parameters
|
|
153
|
+
----------
|
|
154
|
+
tau : ndarray
|
|
155
|
+
STFT times
|
|
156
|
+
|
|
157
|
+
Returns
|
|
158
|
+
-------
|
|
159
|
+
a_tau, phi_tau, f_tau, df_tau
|
|
160
|
+
phases, frequencies, frequency derivatives
|
|
161
|
+
"""
|
|
162
|
+
|
|
163
|
+
return (
|
|
164
|
+
self.compute_harmonic_amplitudes(*args, **kwargs),
|
|
165
|
+
self.compute_phases(*args, **kwargs),
|
|
166
|
+
self.compute_frequencies(*args, **kwargs),
|
|
167
|
+
self.compute_frequencies_derivatives(*args, **kwargs),
|
|
168
|
+
)
|
|
169
|
+
|
|
123
170
|
|
|
124
171
|
class FDWaveform(Waveform):
|
|
125
172
|
"""
|
|
@@ -174,6 +221,28 @@ class FDWaveform(Waveform):
|
|
|
174
221
|
self.compute_times_derivatives(*args, **kwargs),
|
|
175
222
|
)
|
|
176
223
|
|
|
224
|
+
def compute_harmonic_amplitudes_and_phases_derivatives(self, *args, **kwargs):
|
|
225
|
+
"""
|
|
226
|
+
Compute amplitudes, phases, times, and times derivatives all in a row
|
|
227
|
+
|
|
228
|
+
Parameters
|
|
229
|
+
----------
|
|
230
|
+
freq : ndarray
|
|
231
|
+
STFT frequencies
|
|
232
|
+
|
|
233
|
+
Returns
|
|
234
|
+
-------
|
|
235
|
+
a_tau, phi_tau, tau_f, dtau_f
|
|
236
|
+
phases, times, times derivatives
|
|
237
|
+
"""
|
|
238
|
+
|
|
239
|
+
return (
|
|
240
|
+
self.compute_harmonic_amplitudes(*args, **kwargs),
|
|
241
|
+
self.compute_phases(*args, **kwargs),
|
|
242
|
+
self.compute_times(*args, **kwargs),
|
|
243
|
+
self.compute_times_derivatives(*args, **kwargs),
|
|
244
|
+
)
|
|
245
|
+
|
|
177
246
|
|
|
178
247
|
class LinearChirp(TDWaveform):
|
|
179
248
|
"""
|
|
@@ -219,6 +288,16 @@ class LinearChirp(TDWaveform):
|
|
|
219
288
|
# Implement the logic for computing amplitudes for linear chirp
|
|
220
289
|
return jnp.ones_like(tau)
|
|
221
290
|
|
|
291
|
+
def compute_harmonic_amplitudes(self, *args, **kwargs):
|
|
292
|
+
"""
|
|
293
|
+
Compute the amplitudes for the linear chirp waveform.
|
|
294
|
+
Returns an array of size n_modes x n_times
|
|
295
|
+
"""
|
|
296
|
+
# The first argument is time
|
|
297
|
+
tau = args[0]
|
|
298
|
+
# Assuming by convention sky loc that give Ylm weight of 1.
|
|
299
|
+
return self.compute_amplitudes(tau)
|
|
300
|
+
|
|
222
301
|
def compute_phases(self, *args, **kwargs):
|
|
223
302
|
"""
|
|
224
303
|
Construct the phase and amplitude splines for the linear chirp waveform.
|
|
@@ -256,7 +335,7 @@ class LinearChirp(TDWaveform):
|
|
|
256
335
|
tau = args[0]
|
|
257
336
|
# Implement the logic for computing strain for linear chirp
|
|
258
337
|
phases = self.compute_phases(tau)
|
|
259
|
-
amplitudes = self.
|
|
338
|
+
amplitudes = self.compute_harmonic_amplitudes(tau)
|
|
260
339
|
if self.n_modes > 1:
|
|
261
340
|
return jnp.sum(amplitudes * jnp.exp(-1j * phases), axis=0)
|
|
262
341
|
return amplitudes * jnp.exp(-1j * phases)
|
|
@@ -307,6 +386,16 @@ class FDLinearChirp(FDWaveform):
|
|
|
307
386
|
# Implement the logic for computing amplitudes for linear chirp
|
|
308
387
|
return jnp.ones_like(freq) / jnp.sqrt(self.fdot0)
|
|
309
388
|
|
|
389
|
+
def compute_harmonic_amplitudes(self, *args, **kwargs):
|
|
390
|
+
"""
|
|
391
|
+
Compute the harmonic amplitudes (i.e. weighted by spherical harmonics)
|
|
392
|
+
for the linear chirp waveform.
|
|
393
|
+
"""
|
|
394
|
+
# The first argument is time
|
|
395
|
+
freq = args[0]
|
|
396
|
+
# Assuming by convention sky loc that give Ylm weight of 1.
|
|
397
|
+
return self.compute_amplitudes(freq)
|
|
398
|
+
|
|
310
399
|
def compute_phases(self, *args, **kwargs):
|
|
311
400
|
"""
|
|
312
401
|
Compute the phase for the linear chirp waveform.
|
|
@@ -341,7 +430,7 @@ class FDLinearChirp(FDWaveform):
|
|
|
341
430
|
freq = args[0]
|
|
342
431
|
# Implement the logic for computing strain for linear chirp
|
|
343
432
|
phases = self.compute_phases(freq)
|
|
344
|
-
amplitudes = self.
|
|
433
|
+
amplitudes = self.compute_harmonic_amplitudes(freq)
|
|
345
434
|
return amplitudes * jnp.exp(-1j * phases)
|
|
346
435
|
|
|
347
436
|
def compute_windowing_factor(self, *args):
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#! /usr/bin/env python3
|
|
2
2
|
# -*- coding: utf-8 -*-
|
|
3
|
-
"""Test classes and functions in the
|
|
3
|
+
"""Test classes and functions in the jaxtfwaves.stft module."""
|
|
4
4
|
|
|
5
5
|
from pathlib import Path
|
|
6
6
|
|
|
@@ -8,8 +8,8 @@ import jax.numpy as jnp
|
|
|
8
8
|
import numpy as np
|
|
9
9
|
from scipy.signal import ShortTimeFFT
|
|
10
10
|
|
|
11
|
-
from
|
|
12
|
-
from
|
|
11
|
+
from jaxtfwaves.stft import FrequencyToTFWaveform, ObservationConfig, TimeToTFWaveform
|
|
12
|
+
from jaxtfwaves.waveform import FDLinearChirp, LinearChirp
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
def test_stft_waveform_initialization():
|
|
@@ -36,7 +36,13 @@ def test_stft_waveform_initialization():
|
|
|
36
36
|
)
|
|
37
37
|
|
|
38
38
|
stft_waveform = TimeToTFWaveform(
|
|
39
|
-
win,
|
|
39
|
+
win,
|
|
40
|
+
hop,
|
|
41
|
+
fs,
|
|
42
|
+
None,
|
|
43
|
+
waveform=None,
|
|
44
|
+
config=config,
|
|
45
|
+
channel="AET2",
|
|
40
46
|
)
|
|
41
47
|
assert stft_waveform.fs == fs
|
|
42
48
|
assert stft_waveform.dt == 1 / fs
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
#! /usr/bin/env python3
|
|
2
2
|
# -*- coding: utf-8 -*-
|
|
3
|
-
"""Tests for
|
|
3
|
+
"""Tests for jaxtfwaves typed-lisa-toolkit adapter helpers."""
|
|
4
4
|
|
|
5
5
|
import jax
|
|
6
6
|
import jax.numpy as jnp
|
|
7
7
|
import numpy as np
|
|
8
8
|
import pytest
|
|
9
9
|
|
|
10
|
-
from
|
|
11
|
-
from
|
|
10
|
+
from jaxtfwaves.stft import STFTWaveform
|
|
11
|
+
from jaxtfwaves.tlt_adapters import (
|
|
12
12
|
TDI_CHANNELS_AET,
|
|
13
13
|
TDI_CHANNELS_XYZ,
|
|
14
14
|
hphc_stfts_from_tracks,
|
|
@@ -122,14 +122,16 @@ def test_stftdata_from_tdi_builds_expected_channels():
|
|
|
122
122
|
|
|
123
123
|
assert list(stft_data.keys()) == ["X", "Y", "Z"]
|
|
124
124
|
assert np.asarray(stft_data.entries).shape == (1, 3, 1, 1, 4)
|
|
125
|
-
|
|
125
|
+
np.testing.assert_array_equal(np.asarray(stft_data["X"].entries).ravel(), tdi_values[:, 0])
|
|
126
|
+
np.testing.assert_array_equal(np.asarray(stft_data["Y"].entries).ravel(), tdi_values[:, 1])
|
|
127
|
+
np.testing.assert_array_equal(np.asarray(stft_data["Z"].entries).ravel(), tdi_values[:, 2])
|
|
126
128
|
|
|
127
129
|
|
|
128
|
-
def
|
|
129
|
-
"""
|
|
130
|
+
def test_stftdata_from_tdi_raises_under_jit_tracing():
|
|
131
|
+
"""Current TLT mapping-based stftdata construction is not JIT-traceable.
|
|
130
132
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
+
The mapping path enforces Linspace axes through a Python boolean check,
|
|
134
|
+
which raises when axis values are JAX tracers.
|
|
133
135
|
"""
|
|
134
136
|
f_bins = jnp.linspace(0.1, 1.0, 8)
|
|
135
137
|
t_bins = jnp.linspace(0.0, 10.0, 5)
|
|
@@ -148,11 +150,10 @@ def test_stftdata_from_tdi_accepts_jax_tracers_under_jit():
|
|
|
148
150
|
@jax.jit
|
|
149
151
|
def build(values):
|
|
150
152
|
stft_data = stftdata_from_tdi(values, indices_f, indices_t, f_bins, t_bins)
|
|
151
|
-
# Ensure we can consume wrapped data inside a traced context.
|
|
152
153
|
return jnp.sum(jnp.real(stft_data.entries))
|
|
153
154
|
|
|
154
|
-
|
|
155
|
-
|
|
155
|
+
with pytest.raises(jax.errors.TracerBoolConversionError):
|
|
156
|
+
build(tdi_values)
|
|
156
157
|
|
|
157
158
|
|
|
158
159
|
def test_stftdata_from_tdi_raises_on_channel_mismatch():
|
|
@@ -595,7 +595,7 @@ wheels = [
|
|
|
595
595
|
|
|
596
596
|
[[package]]
|
|
597
597
|
name = "jaxtfwaves"
|
|
598
|
-
version = "0.
|
|
598
|
+
version = "0.4.0"
|
|
599
599
|
source = { editable = "." }
|
|
600
600
|
dependencies = [
|
|
601
601
|
{ name = "flax" },
|
|
@@ -638,7 +638,7 @@ requires-dist = [
|
|
|
638
638
|
{ name = "numpy" },
|
|
639
639
|
{ name = "ripplegw", marker = "extra == 'sobhbwaveform'", specifier = ">=0.0.9,<0.0.10" },
|
|
640
640
|
{ name = "scipy" },
|
|
641
|
-
{ name = "typed-lisa-toolkit", git = "https://gitlab.in2p3.fr/lisa-apc/typed-lisa-toolkit.git?tag=0.6.
|
|
641
|
+
{ name = "typed-lisa-toolkit", git = "https://gitlab.in2p3.fr/lisa-apc/typed-lisa-toolkit.git?tag=0.6.3" },
|
|
642
642
|
]
|
|
643
643
|
provides-extras = ["sobhbwaveform", "plugins"]
|
|
644
644
|
|
|
@@ -1720,8 +1720,8 @@ wheels = [
|
|
|
1720
1720
|
|
|
1721
1721
|
[[package]]
|
|
1722
1722
|
name = "typed-lisa-toolkit"
|
|
1723
|
-
version = "0.6.
|
|
1724
|
-
source = { git = "https://gitlab.in2p3.fr/lisa-apc/typed-lisa-toolkit.git?tag=0.6.
|
|
1723
|
+
version = "0.6.3"
|
|
1724
|
+
source = { git = "https://gitlab.in2p3.fr/lisa-apc/typed-lisa-toolkit.git?tag=0.6.3#e5656c0f88aae4f2b76605e55c993e430748d1d4" }
|
|
1725
1725
|
dependencies = [
|
|
1726
1726
|
{ name = "array-api-compat" },
|
|
1727
1727
|
{ name = "h5py" },
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{jaxtfwaves-0.3.1/src/tfplugins → jaxtfwaves-0.4.0/src/jaxtfplugins}/sobhbwaveform/__init__.py
RENAMED
|
File without changes
|
{jaxtfwaves-0.3.1/src/tfplugins → jaxtfwaves-0.4.0/src/jaxtfplugins}/sobhbwaveform/sobhbparams.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|