ml4gw 0.4.2__py3-none-any.whl → 0.5.1__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.

Potentially problematic release.


This version of ml4gw might be problematic. Click here for more details.

@@ -1,306 +1,331 @@
1
1
  import torch
2
- from torchtyping import TensorType
2
+ from jaxtyping import Float
3
3
 
4
- GAMMA = 0.577215664901532860606512090082402431
5
- """Euler-Mascheroni constant. Same as lal.GAMMA"""
4
+ from ml4gw.constants import MPC_SEC, MTSUN_SI, PI
5
+ from ml4gw.constants import EulerGamma as GAMMA
6
+ from ml4gw.types import BatchTensor, FrequencySeries1d
6
7
 
7
- MSUN_SI = 1.988409870698050731911960804878414216e30
8
- """Solar mass in kg. Same as lal.MSUN_SI"""
9
8
 
10
- MTSUN_SI = 4.925490947641266978197229498498379006e-6
11
- """1 solar mass in seconds. Same value as lal.MTSUN_SI"""
9
+ class TaylorF2(torch.nn.Module):
10
+ def __init__(self):
11
+ super().__init__()
12
12
 
13
- PI = 3.141592653589793238462643383279502884
14
- """Archimedes constant. Same as lal.PI"""
15
-
16
- MPC_SEC = 1.02927125e14
17
- """
18
- 1 Mpc in seconds.
19
- """
13
+ def forward(
14
+ self,
15
+ f: FrequencySeries1d,
16
+ chirp_mass: BatchTensor,
17
+ mass_ratio: BatchTensor,
18
+ chi1: BatchTensor,
19
+ chi2: BatchTensor,
20
+ distance: BatchTensor,
21
+ phic: BatchTensor,
22
+ inclination: BatchTensor,
23
+ f_ref: float,
24
+ ):
25
+ """
26
+ TaylorF2 up to 3.5 PN in phase. Newtonian SPA amplitude.
20
27
 
28
+ Args:
29
+ f:
30
+ Frequency series in Hz.
31
+ chirp_mass:
32
+ Chirp mass in solar masses
33
+ mass_ratio:
34
+ Mass ratio m1/m2
35
+ chi1:
36
+ Spin of m1
37
+ chi2:
38
+ Spin of m2
39
+ distance:
40
+ Luminosity distance
41
+ phic:
42
+ Phase at coalescence
43
+ inclination:
44
+ Inclination angle
45
+ f_ref:
46
+ Reference frequency
21
47
 
22
- def taylorf2_phase(
23
- Mf: TensorType,
24
- mass1: TensorType,
25
- mass2: TensorType,
26
- chi1: TensorType,
27
- chi2: TensorType,
28
- ) -> TensorType:
29
- """
30
- Calculate the inspiral phase for the TaylorF2.
31
- """
32
- M = mass1 + mass2
33
- eta = mass1 * mass2 / M / M
34
- m1byM = mass1 / M
35
- m2byM = mass2 / M
36
- chi1sq = chi1 * chi1
37
- chi2sq = chi2 * chi2
48
+ Returns:
49
+ hc, hp: Tuple[torch.Tensor, torch.Tensor]
50
+ Cross and plus polarizations
51
+ """
38
52
 
39
- v0 = torch.ones_like(Mf)
40
- v1 = (PI * Mf) ** (1.0 / 3.0)
41
- v2 = v1 * v1
42
- v3 = v2 * v1
43
- v4 = v3 * v1
44
- v5 = v4 * v1
45
- v6 = v5 * v1
46
- v7 = v6 * v1
47
- logv = torch.log(v1)
48
- v5_logv = v5 * logv
49
- v6_logv = v6 * logv
53
+ # shape assumed (n_batch, params)
54
+ if (
55
+ chirp_mass.shape[0] != mass_ratio.shape[0]
56
+ or chirp_mass.shape[0] != chi1.shape[0]
57
+ or chi1.shape[0] != chi2.shape[0]
58
+ or chi2.shape[0] != distance.shape[0]
59
+ or distance.shape[0] != phic.shape[0]
60
+ or phic.shape[0] != inclination.shape[0]
61
+ ):
62
+ raise RuntimeError("Tensors should have same batch size")
63
+ mass2 = chirp_mass * (1.0 + mass_ratio) ** 0.2 / mass_ratio**0.6
64
+ mass1 = mass_ratio * mass2
65
+ cfac = torch.cos(inclination)
66
+ pfac = 0.5 * (1.0 + cfac * cfac)
50
67
 
51
- # Phase coeffeciencts from https://git.ligo.org/lscsoft/lalsuite/-/blob/master/lalsimulation/lib/LALSimInspiralPNCoefficients.c # noqa E501
52
- pfaN = 3.0 / (128.0 * eta)
53
- pfa_v0 = 1.0
54
- pfa_v1 = 0.0
55
- pfa_v2 = 5.0 * (74.3 / 8.4 + 11.0 * eta) / 9.0
56
- pfa_v3 = -16.0 * PI
57
- # SO contributions at 1.5 PN
58
- pfa_v3 += (
59
- m1byM * (25.0 + 38.0 / 3.0 * m1byM) * chi1
60
- + m2byM * (25.0 + 38.0 / 3.0 * m2byM) * chi2
61
- )
62
- pfa_v4 = (
63
- 5.0
64
- * (3058.673 / 7.056 + 5429.0 / 7.0 * eta + 617.0 * eta * eta)
65
- / 72.0
66
- )
67
- # SO, SS, S1,2-squared contributions
68
- pfa_v4 += (
69
- 247.0 / 4.8 * eta * chi1 * chi2
70
- + -721.0 / 4.8 * eta * chi1 * chi2
71
- + (-720.0 / 9.6 * m1byM * m1byM + 1.0 / 9.6 * m1byM * m1byM) * chi1sq
72
- + (-720.0 / 9.6 * m2byM * m2byM + 1.0 / 9.6 * m2byM * m2byM) * chi2sq
73
- + (240.0 / 9.6 * m1byM * m1byM + -7.0 / 9.6 * m1byM * m1byM) * chi1sq
74
- + (240.0 / 9.6 * m2byM * m2byM + -7.0 / 9.6 * m2byM * m2byM) * chi2sq
75
- )
76
- pfa_v5logv = 5.0 / 3.0 * (772.9 / 8.4 - 13.0 * eta) * PI
77
- pfa_v5 = 5.0 / 9.0 * (772.9 / 8.4 - 13.0 * eta) * PI
78
- # SO coefficient for 2.5 PN
79
- pfa_v5logv += 3.0 * (
80
- -m1byM
81
- * (
82
- 1391.5 / 8.4
83
- - 10.0 / 3.0 * m1byM * (1.0 - m1byM)
84
- + m1byM * (1276.0 / 8.1 + 170.0 / 9.0 * m1byM * (1.0 - m1byM))
85
- )
86
- * chi1
87
- - m2byM
88
- * (
89
- 1391.5 / 8.4
90
- - 10.0 / 3.0 * m2byM * (1.0 - m2byM)
91
- + m2byM * (1276.0 / 8.1 + 170.0 / 9.0 * m2byM * (1.0 - m2byM))
92
- )
93
- * chi2
94
- )
95
- pfa_v5 += (
96
- -m1byM
97
- * (
98
- 1391.5 / 8.4
99
- - 10.0 / 3.0 * m1byM * (1.0 - m1byM)
100
- + m1byM * (1276.0 / 8.1 + 170.0 / 9.0 * m1byM * (1.0 - m1byM))
101
- )
102
- * chi1
103
- + -m2byM
104
- * (
105
- 1391.5 / 8.4
106
- - 10.0 / 3.0 * m2byM * (1.0 - m2byM)
107
- + m2byM * (1276.0 / 8.1 + 170.0 / 9.0 * m2byM * (1.0 - m2byM))
108
- )
109
- * chi2
110
- )
111
- pfa_v6logv = -684.8 / 2.1
112
- pfa_v6 = (
113
- 11583.231236531 / 4.694215680
114
- - 640.0 / 3.0 * PI * PI
115
- - 684.8 / 2.1 * GAMMA
116
- + eta * (-15737.765635 / 3.048192 + 225.5 / 1.2 * PI * PI)
117
- + eta * eta * 76.055 / 1.728
118
- - eta * eta * eta * 127.825 / 1.296
119
- + pfa_v6logv * torch.log(torch.tensor(4.0))
120
- )
121
- # SO + S1-S2 + S-squared contribution at 3 PN
122
- pfa_v6 += (
123
- PI * m1byM * (1490.0 / 3.0 + m1byM * 260.0) * chi1
124
- + PI * m2byM * (1490.0 / 3.0 + m2byM * 260.0) * chi2
125
- + (326.75 / 1.12 + 557.5 / 1.8 * eta) * eta * chi1 * chi2
126
- + (
127
- (4703.5 / 8.4 + 2935.0 / 6.0 * m1byM - 120.0 * m1byM * m1byM)
128
- * m1byM
129
- * m1byM
130
- + (
131
- -4108.25 / 6.72
132
- - 108.5 / 1.2 * m1byM
133
- + 125.5 / 3.6 * m1byM * m1byM
134
- )
135
- * m1byM
136
- * m1byM
137
- )
138
- * chi1sq
139
- + (
140
- (4703.5 / 8.4 + 2935.0 / 6.0 * m2byM - 120.0 * m2byM * m2byM)
141
- * m2byM
142
- * m2byM
143
- + (
144
- -4108.25 / 6.72
145
- - 108.5 / 1.2 * m2byM
146
- + 125.5 / 3.6 * m2byM * m2byM
147
- )
148
- * m2byM
149
- * m2byM
68
+ htilde = self.taylorf2_htilde(
69
+ f, mass1, mass2, chi1, chi2, distance, phic, f_ref
150
70
  )
151
- * chi2sq
152
- )
153
- pfa_v7 = PI * (
154
- 770.96675 / 2.54016 + 378.515 / 1.512 * eta - 740.45 / 7.56 * eta * eta
155
- )
156
- # SO contribution at 3.5 PN
157
- pfa_v7 += (
158
- m1byM
159
- * (
160
- -17097.8035 / 4.8384
161
- + eta * 28764.25 / 6.72
162
- + eta * eta * 47.35 / 1.44
163
- + m1byM
164
- * (
165
- -7189.233785 / 1.524096
166
- + eta * 458.555 / 3.024
167
- - eta * eta * 534.5 / 7.2
168
- )
169
- )
170
- ) * chi1 + (
171
- m2byM
172
- * (
173
- -17097.8035 / 4.8384
174
- + eta * 28764.25 / 6.72
175
- + eta * eta * 47.35 / 1.44
176
- + m2byM
177
- * (
178
- -7189.233785 / 1.524096
179
- + eta * 458.555 / 3.024
180
- - eta * eta * 534.5 / 7.2
181
- )
182
- )
183
- ) * chi2
184
- # construct power series
185
- phasing = (v7.T * pfa_v7).T
186
- phasing += (v6.T * pfa_v6 + v6_logv.T * pfa_v6logv).T
187
- phasing += (v5.T * pfa_v5 + v5_logv.T * pfa_v5logv).T
188
- phasing += (v4.T * pfa_v4).T
189
- phasing += (v3.T * pfa_v3).T
190
- phasing += (v2.T * pfa_v2).T
191
- phasing += (v1.T * pfa_v1).T
192
- phasing += (v0.T * pfa_v0).T
193
- # Divide by 0PN v-dependence
194
- phasing /= v5
195
- # Multiply by 0PN coefficient
196
- phasing = (phasing.T * pfaN).T
197
-
198
- # Derivative of phase w.r.t Mf
199
- # dPhi/dMf = dPhi/dv dv/dMf
200
- Dphasing = (2.0 * v7.T * pfa_v7).T
201
- Dphasing += (v6.T * (pfa_v6 + pfa_v6logv)).T
202
- Dphasing += (v6_logv.T * pfa_v6logv).T
203
- Dphasing += (v5.T * pfa_v5logv).T
204
- Dphasing += (-1.0 * v4.T * pfa_v4).T
205
- Dphasing += (-2.0 * v3.T * pfa_v3).T
206
- Dphasing += (-3.0 * v2.T * pfa_v2).T
207
- Dphasing += (-4.0 * v1.T * pfa_v1).T
208
- Dphasing += -5.0 * v0
209
- Dphasing /= 3.0 * v1 * v7
210
- Dphasing *= PI
211
- Dphasing = (Dphasing.T * pfaN).T
212
71
 
213
- return phasing, Dphasing
72
+ hp = (htilde.mT * pfac).mT
73
+ hc = -1j * (htilde.mT * cfac).mT
214
74
 
75
+ return hc, hp
215
76
 
216
- def taylorf2_amplitude(
217
- Mf: TensorType, mass1, mass2, eta, distance
218
- ) -> TensorType:
219
- mass1_s = mass1 * MTSUN_SI
220
- mass2_s = mass2 * MTSUN_SI
221
- v = (PI * Mf) ** (1.0 / 3.0)
222
- v10 = v**10
77
+ def taylorf2_htilde(
78
+ self,
79
+ f: FrequencySeries1d,
80
+ mass1: BatchTensor,
81
+ mass2: BatchTensor,
82
+ chi1: BatchTensor,
83
+ chi2: BatchTensor,
84
+ distance: BatchTensor,
85
+ phic: BatchTensor,
86
+ f_ref: float,
87
+ ) -> Float[FrequencySeries1d, " batch"]:
88
+ mass1_s = mass1 * MTSUN_SI
89
+ mass2_s = mass2 * MTSUN_SI
90
+ M_s = mass1_s + mass2_s
91
+ eta = mass1_s * mass2_s / M_s / M_s
223
92
 
224
- # Flux and energy coefficient at newtonian
225
- FTaN = 32.0 * eta * eta / 5.0
226
- dETaN = 2 * (-eta / 2.0)
93
+ Mf = torch.outer(M_s, f)
94
+ Mf_ref = torch.outer(M_s, f_ref * torch.ones_like(f))
227
95
 
228
- amp0 = -4.0 * mass1_s * mass2_s * (PI / 12.0) ** 0.5
96
+ Psi, _ = self.taylorf2_phase(Mf, mass1, mass2, chi1, chi2)
97
+ Psi_ref, _ = self.taylorf2_phase(Mf_ref, mass1, mass2, chi1, chi2)
229
98
 
230
- amp0 /= distance * MPC_SEC
231
- flux = (v10.T * FTaN).T
232
- dEnergy = (v.T * dETaN).T
233
- amp = torch.sqrt(-dEnergy / flux) * v
234
- amp = (amp.T * amp0).T
99
+ Psi = (Psi.mT - 2 * phic).mT
100
+ Psi -= Psi_ref
235
101
 
236
- return amp
102
+ amp0 = self.taylorf2_amplitude(Mf, mass1, mass2, eta, distance)
103
+ h0 = amp0 * torch.exp(-1j * (Psi - PI / 4))
104
+ return h0
237
105
 
106
+ def taylorf2_amplitude(
107
+ self,
108
+ Mf: BatchTensor,
109
+ mass1: BatchTensor,
110
+ mass2: BatchTensor,
111
+ eta: BatchTensor,
112
+ distance: BatchTensor,
113
+ ) -> Float[FrequencySeries1d, " batch"]:
114
+ mass1_s = mass1 * MTSUN_SI
115
+ mass2_s = mass2 * MTSUN_SI
116
+ v = (PI * Mf) ** (1.0 / 3.0)
117
+ v10 = v**10
238
118
 
239
- def taylorf2_htilde(
240
- f: TensorType,
241
- mass1: TensorType,
242
- mass2: TensorType,
243
- chi1: TensorType,
244
- chi2: TensorType,
245
- distance: TensorType,
246
- phic: TensorType,
247
- f_ref: float,
248
- ):
249
- mass1_s = mass1 * MTSUN_SI
250
- mass2_s = mass2 * MTSUN_SI
251
- M_s = mass1_s + mass2_s
252
- eta = mass1_s * mass2_s / M_s / M_s
119
+ # Flux and energy coefficient at newtonian
120
+ FTaN = 32.0 * eta * eta / 5.0
121
+ dETaN = 2 * (-eta / 2.0)
253
122
 
254
- Mf = torch.outer(M_s, f)
255
- Mf_ref = torch.outer(M_s, f_ref * torch.ones_like(f))
123
+ amp0 = -4.0 * mass1_s * mass2_s * (PI / 12.0) ** 0.5
256
124
 
257
- Psi, _ = taylorf2_phase(Mf, mass1, mass2, chi1, chi2)
258
- Psi_ref, _ = taylorf2_phase(Mf_ref, mass1, mass2, chi1, chi2)
125
+ amp0 /= distance * MPC_SEC
126
+ flux = (v10.mT * FTaN).mT
127
+ dEnergy = (v.mT * dETaN).mT
128
+ amp = torch.sqrt(-dEnergy / flux) * v
129
+ amp = (amp.mT * amp0).mT
259
130
 
260
- Psi = (Psi.T - 2 * phic).T
261
- Psi -= Psi_ref
131
+ return amp
262
132
 
263
- amp0 = taylorf2_amplitude(Mf, mass1, mass2, eta, distance)
264
- h0 = amp0 * torch.exp(-1j * (Psi - PI / 4))
265
- return h0
133
+ def taylorf2_phase(
134
+ self,
135
+ Mf: BatchTensor,
136
+ mass1: BatchTensor,
137
+ mass2: BatchTensor,
138
+ chi1: BatchTensor,
139
+ chi2: BatchTensor,
140
+ ) -> Float[FrequencySeries1d, " batch"]:
141
+ """
142
+ Calculate the inspiral phase for the TaylorF2.
143
+ """
144
+ M = mass1 + mass2
145
+ eta = mass1 * mass2 / M / M
146
+ m1byM = mass1 / M
147
+ m2byM = mass2 / M
148
+ chi1sq = chi1 * chi1
149
+ chi2sq = chi2 * chi2
266
150
 
151
+ v0 = torch.ones_like(Mf)
152
+ v1 = (PI * Mf) ** (1.0 / 3.0)
153
+ v2 = v1 * v1
154
+ v3 = v2 * v1
155
+ v4 = v3 * v1
156
+ v5 = v4 * v1
157
+ v6 = v5 * v1
158
+ v7 = v6 * v1
159
+ logv = torch.log(v1)
160
+ v5_logv = v5 * logv
161
+ v6_logv = v6 * logv
267
162
 
268
- def TaylorF2(
269
- f: TensorType,
270
- mass1: TensorType,
271
- mass2: TensorType,
272
- chi1: TensorType,
273
- chi2: TensorType,
274
- distance: TensorType,
275
- phic: TensorType,
276
- inclination: TensorType,
277
- f_ref: float,
278
- ):
279
- """
280
- TaylorF2 up to 3.5 PN in phase. Newtonian SPA amplitude.
281
-
282
- Returns:
283
- --------
284
- hp, hc
285
- """
286
- # shape assumed (n_batch, params)
287
- if (
288
- mass1.shape[0] != mass2.shape[0]
289
- or mass2.shape[0] != chi1.shape[0]
290
- or chi1.shape[0] != chi2.shape[0]
291
- or chi2.shape[0] != distance.shape[0]
292
- or distance.shape[0] != phic.shape[0]
293
- or phic.shape[0] != inclination.shape[0]
294
- ):
295
- raise RuntimeError("Tensors should have same batch size")
296
- cfac = torch.cos(inclination)
297
- pfac = 0.5 * (1.0 + cfac * cfac)
298
-
299
- htilde = taylorf2_htilde(
300
- f, mass1, mass2, chi1, chi2, distance, phic, f_ref
301
- )
163
+ # Phase coeffeciencts from https://git.ligo.org/lscsoft/lalsuite/-/blob/master/lalsimulation/lib/LALSimInspiralPNCoefficients.c # noqa E501
164
+ pfaN = 3.0 / (128.0 * eta)
165
+ pfa_v0 = 1.0
166
+ pfa_v1 = 0.0
167
+ pfa_v2 = 5.0 * (74.3 / 8.4 + 11.0 * eta) / 9.0
168
+ pfa_v3 = -16.0 * PI
169
+ # SO contributions at 1.5 PN
170
+ pfa_v3 += (
171
+ m1byM * (25.0 + 38.0 / 3.0 * m1byM) * chi1
172
+ + m2byM * (25.0 + 38.0 / 3.0 * m2byM) * chi2
173
+ )
174
+ pfa_v4 = (
175
+ 5.0
176
+ * (3058.673 / 7.056 + 5429.0 / 7.0 * eta + 617.0 * eta * eta)
177
+ / 72.0
178
+ )
179
+ # SO, SS, S1,2-squared contributions
180
+ pfa_v4 += (
181
+ 247.0 / 4.8 * eta * chi1 * chi2
182
+ + -721.0 / 4.8 * eta * chi1 * chi2
183
+ + (-720.0 / 9.6 * m1byM * m1byM + 1.0 / 9.6 * m1byM * m1byM)
184
+ * chi1sq
185
+ + (-720.0 / 9.6 * m2byM * m2byM + 1.0 / 9.6 * m2byM * m2byM)
186
+ * chi2sq
187
+ + (240.0 / 9.6 * m1byM * m1byM + -7.0 / 9.6 * m1byM * m1byM)
188
+ * chi1sq
189
+ + (240.0 / 9.6 * m2byM * m2byM + -7.0 / 9.6 * m2byM * m2byM)
190
+ * chi2sq
191
+ )
192
+ pfa_v5logv = 5.0 / 3.0 * (772.9 / 8.4 - 13.0 * eta) * PI
193
+ pfa_v5 = 5.0 / 9.0 * (772.9 / 8.4 - 13.0 * eta) * PI
194
+ # SO coefficient for 2.5 PN
195
+ pfa_v5logv += 3.0 * (
196
+ -m1byM
197
+ * (
198
+ 1391.5 / 8.4
199
+ - 10.0 / 3.0 * m1byM * (1.0 - m1byM)
200
+ + m1byM * (1276.0 / 8.1 + 170.0 / 9.0 * m1byM * (1.0 - m1byM))
201
+ )
202
+ * chi1
203
+ - m2byM
204
+ * (
205
+ 1391.5 / 8.4
206
+ - 10.0 / 3.0 * m2byM * (1.0 - m2byM)
207
+ + m2byM * (1276.0 / 8.1 + 170.0 / 9.0 * m2byM * (1.0 - m2byM))
208
+ )
209
+ * chi2
210
+ )
211
+ pfa_v5 += (
212
+ -m1byM
213
+ * (
214
+ 1391.5 / 8.4
215
+ - 10.0 / 3.0 * m1byM * (1.0 - m1byM)
216
+ + m1byM * (1276.0 / 8.1 + 170.0 / 9.0 * m1byM * (1.0 - m1byM))
217
+ )
218
+ * chi1
219
+ + -m2byM
220
+ * (
221
+ 1391.5 / 8.4
222
+ - 10.0 / 3.0 * m2byM * (1.0 - m2byM)
223
+ + m2byM * (1276.0 / 8.1 + 170.0 / 9.0 * m2byM * (1.0 - m2byM))
224
+ )
225
+ * chi2
226
+ )
227
+ pfa_v6logv = -684.8 / 2.1
228
+ pfa_v6 = (
229
+ 11583.231236531 / 4.694215680
230
+ - 640.0 / 3.0 * PI * PI
231
+ - 684.8 / 2.1 * GAMMA
232
+ + eta * (-15737.765635 / 3.048192 + 225.5 / 1.2 * PI * PI)
233
+ + eta * eta * 76.055 / 1.728
234
+ - eta * eta * eta * 127.825 / 1.296
235
+ + pfa_v6logv * torch.log(torch.tensor(4.0))
236
+ )
237
+ # SO + S1-S2 + S-squared contribution at 3 PN
238
+ pfa_v6 += (
239
+ PI * m1byM * (1490.0 / 3.0 + m1byM * 260.0) * chi1
240
+ + PI * m2byM * (1490.0 / 3.0 + m2byM * 260.0) * chi2
241
+ + (326.75 / 1.12 + 557.5 / 1.8 * eta) * eta * chi1 * chi2
242
+ + (
243
+ (4703.5 / 8.4 + 2935.0 / 6.0 * m1byM - 120.0 * m1byM * m1byM)
244
+ * m1byM
245
+ * m1byM
246
+ + (
247
+ -4108.25 / 6.72
248
+ - 108.5 / 1.2 * m1byM
249
+ + 125.5 / 3.6 * m1byM * m1byM
250
+ )
251
+ * m1byM
252
+ * m1byM
253
+ )
254
+ * chi1sq
255
+ + (
256
+ (4703.5 / 8.4 + 2935.0 / 6.0 * m2byM - 120.0 * m2byM * m2byM)
257
+ * m2byM
258
+ * m2byM
259
+ + (
260
+ -4108.25 / 6.72
261
+ - 108.5 / 1.2 * m2byM
262
+ + 125.5 / 3.6 * m2byM * m2byM
263
+ )
264
+ * m2byM
265
+ * m2byM
266
+ )
267
+ * chi2sq
268
+ )
269
+ pfa_v7 = PI * (
270
+ 770.96675 / 2.54016
271
+ + 378.515 / 1.512 * eta
272
+ - 740.45 / 7.56 * eta * eta
273
+ )
274
+ # SO contribution at 3.5 PN
275
+ pfa_v7 += (
276
+ m1byM
277
+ * (
278
+ -17097.8035 / 4.8384
279
+ + eta * 28764.25 / 6.72
280
+ + eta * eta * 47.35 / 1.44
281
+ + m1byM
282
+ * (
283
+ -7189.233785 / 1.524096
284
+ + eta * 458.555 / 3.024
285
+ - eta * eta * 534.5 / 7.2
286
+ )
287
+ )
288
+ ) * chi1 + (
289
+ m2byM
290
+ * (
291
+ -17097.8035 / 4.8384
292
+ + eta * 28764.25 / 6.72
293
+ + eta * eta * 47.35 / 1.44
294
+ + m2byM
295
+ * (
296
+ -7189.233785 / 1.524096
297
+ + eta * 458.555 / 3.024
298
+ - eta * eta * 534.5 / 7.2
299
+ )
300
+ )
301
+ ) * chi2
302
+ # construct power series
303
+ phasing = (v7.mT * pfa_v7).mT
304
+ phasing += (v6.mT * pfa_v6 + v6_logv.mT * pfa_v6logv).mT
305
+ phasing += (v5.mT * pfa_v5 + v5_logv.mT * pfa_v5logv).mT
306
+ phasing += (v4.mT * pfa_v4).mT
307
+ phasing += (v3.mT * pfa_v3).mT
308
+ phasing += (v2.mT * pfa_v2).mT
309
+ phasing += (v1.mT * pfa_v1).mT
310
+ phasing += (v0.mT * pfa_v0).mT
311
+ # Divide by 0PN v-dependence
312
+ phasing /= v5
313
+ # Multiply by 0PN coefficient
314
+ phasing = (phasing.mT * pfaN).mT
302
315
 
303
- hp = (htilde.T * pfac).T
304
- hc = -1j * (htilde.T * cfac).T
316
+ # Derivative of phase w.r.t Mf
317
+ # dPhi/dMf = dPhi/dv dv/dMf
318
+ Dphasing = (2.0 * v7.mT * pfa_v7).mT
319
+ Dphasing += (v6.mT * (pfa_v6 + pfa_v6logv)).mT
320
+ Dphasing += (v6_logv.mT * pfa_v6logv).mT
321
+ Dphasing += (v5.mT * pfa_v5logv).mT
322
+ Dphasing += (-1.0 * v4.mT * pfa_v4).mT
323
+ Dphasing += (-2.0 * v3.mT * pfa_v3).mT
324
+ Dphasing += (-3.0 * v2.mT * pfa_v2).mT
325
+ Dphasing += (-4.0 * v1.mT * pfa_v1).mT
326
+ Dphasing += -5.0 * v0
327
+ Dphasing /= 3.0 * v1 * v7
328
+ Dphasing *= PI
329
+ Dphasing = (Dphasing.mT * pfaN).mT
305
330
 
306
- return hp, hc
331
+ return phasing, Dphasing
@@ -1,18 +1,20 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ml4gw
3
- Version: 0.4.2
3
+ Version: 0.5.1
4
4
  Summary: Tools for training torch models on gravitational wave data
5
5
  Author: Alec Gunny
6
6
  Author-email: alec.gunny@ligo.org
7
- Requires-Python: >=3.8,<3.12
7
+ Requires-Python: >=3.8,<3.13
8
8
  Classifier: Programming Language :: Python :: 3
9
9
  Classifier: Programming Language :: Python :: 3.8
10
10
  Classifier: Programming Language :: Python :: 3.9
11
11
  Classifier: Programming Language :: Python :: 3.10
12
12
  Classifier: Programming Language :: Python :: 3.11
13
+ Classifier: Programming Language :: Python :: 3.12
14
+ Requires-Dist: jaxtyping (>=0.2,<0.3)
15
+ Requires-Dist: numpy (<2.0.0)
13
16
  Requires-Dist: torch (>=2.0,<3.0)
14
17
  Requires-Dist: torchaudio (>=2.0,<3.0)
15
- Requires-Dist: torchtyping (>=0.1,<0.2)
16
18
  Description-Content-Type: text/markdown
17
19
 
18
20
  # ML4GW
@@ -0,0 +1,47 @@
1
+ ml4gw/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
+ ml4gw/augmentations.py,sha256=pZH9tjEpXV0AIqvHHDkpUE-BorG02beOz2pmSipw2EY,1232
3
+ ml4gw/constants.py,sha256=W9beA9RDRdIug1I2H7VLPEPv_DFsQWWoYRmzxv7FWgM,891
4
+ ml4gw/dataloading/__init__.py,sha256=EHBBqU7y2-Np5iQ_xyufxamUEM1pPEquqFo7oaJnaJE,149
5
+ ml4gw/dataloading/chunked_dataset.py,sha256=FpDc4gFxt-PMyXs5qSWLuTGXMTuS1B-hH8gUOCOGxZk,5260
6
+ ml4gw/dataloading/hdf5_dataset.py,sha256=UB1Eog8l7m4M78Owst7oYQZICb0DRJer9WVLVn4hl_I,6645
7
+ ml4gw/dataloading/in_memory_dataset.py,sha256=kleMA9ABUKA6J0tCdz78tbX9lM6uxVSLhqgHbSa1iWY,9550
8
+ ml4gw/distributions.py,sha256=tUuaOiX5enjKLYWD7uiN8rdRVQcrIKps64xBkTl8fMs,4991
9
+ ml4gw/gw.py,sha256=To_hQz9tUp02ADllGLxFCPsNcfbb-kbvfgGpooxcOII,17693
10
+ ml4gw/nn/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
11
+ ml4gw/nn/autoencoder/__init__.py,sha256=ZaT1XhJTHpMuPQqu5E__Jezeh9uwtjcXlT7IZ18byq4,161
12
+ ml4gw/nn/autoencoder/base.py,sha256=4d5Ej30IUzZh3XbldzWlCpp3p0_91YUvKeRID8ZEZGA,3225
13
+ ml4gw/nn/autoencoder/convolutional.py,sha256=2BXDuPWYC-151RO_FL0ogdrqSVTfo4YNrY80lPwrmFA,5419
14
+ ml4gw/nn/autoencoder/skip_connection.py,sha256=fpXxxIIl0CXY4mAfUZQuvI542pEBSwpg90TNG2rbZY8,1411
15
+ ml4gw/nn/autoencoder/utils.py,sha256=m_ivYGNwdrhA7cFxJVD4gqM8AHiWIGmlQI3pFNRklXQ,355
16
+ ml4gw/nn/norm.py,sha256=JIOMXQbUtoWlrhncGsqW6f1-DiGDx9zQH2O3CvQml3U,3594
17
+ ml4gw/nn/resnet/__init__.py,sha256=vBI0IftVP_EYAeDlqomtkGqUYE-RE_S4WNioUhniw9s,64
18
+ ml4gw/nn/resnet/resnet_1d.py,sha256=IQ-EIIzAXd-NWuLwt7JTXLWg5bO3FGJpuFAZwZ78jaI,13218
19
+ ml4gw/nn/resnet/resnet_2d.py,sha256=aK4I0FOZk62JxnYFz0t1O0s5s7J7yRNYSM1flRypvVc,13301
20
+ ml4gw/nn/streaming/__init__.py,sha256=zgjGR2L8t0txXLnil9ceZT0tM8Y2FC8yPxqIKYH0o1A,80
21
+ ml4gw/nn/streaming/online_average.py,sha256=aI8hkT7I3thXkda9tsXxYrzump9swelSXPdSTwPlJWY,4719
22
+ ml4gw/nn/streaming/snapshotter.py,sha256=B9qtbHxnPszAHQ5WQppWJLRuMnnYIxGk7MRUlgja7Is,4476
23
+ ml4gw/spectral.py,sha256=Mt3-yz4a83z0X7M1sVp00_vB947w-9OjU0iNdEkbQcU,19145
24
+ ml4gw/transforms/__init__.py,sha256=24pdP_hIg1wfrtZxxRBPhcEXsCbvVKtNKp7JL8SEogE,362
25
+ ml4gw/transforms/pearson.py,sha256=Ep3mMsY15AF55taRaWNjpHRTvtr1StShUDfqk0dN-qo,3235
26
+ ml4gw/transforms/qtransform.py,sha256=umBSpykfmPftjfyMqbniiP2mTh62q4hoYPA55qneJ4o,17702
27
+ ml4gw/transforms/scaler.py,sha256=fLZo-m6_yFY3UDoLEaS_YgCnYggxlcKstXcM7749TiU,2433
28
+ ml4gw/transforms/snr_rescaler.py,sha256=3XXCTaXc2dzzpXRZx7iqRwImvYtRSJLM5fHdBGfpoUs,2351
29
+ ml4gw/transforms/spectral.py,sha256=gTHUeC0gGYbzgBZHb_FxC_4zdhl5H-XCiLg1hrvKB70,4393
30
+ ml4gw/transforms/spectrogram.py,sha256=HS3Rf5iB7JjhlSESRDdFGUwCtIBdvUaJUDulkB4Lmos,6162
31
+ ml4gw/transforms/transform.py,sha256=BuzTbPFxp18OEGP9Tu9jBGtvqy3len1cqvqg5X37DiY,2512
32
+ ml4gw/transforms/waveforms.py,sha256=LkYCvxPqYhHa2yYZTvPE6j0E4HFy16b5ndCRQb7WfcA,3196
33
+ ml4gw/transforms/whitening.py,sha256=Aw_ogq93CYCATiHWBqSZ-qsUtaHAMA3k009ZRtQTtHA,9596
34
+ ml4gw/types.py,sha256=CcctqDcNajR7khGT6BD-WYsfRKpiP0udoSAB0k1qcFw,863
35
+ ml4gw/utils/interferometer.py,sha256=lRS0N3SwUTknhYXX57VACJ99jK1P9M19oUWN_i_nQN0,1814
36
+ ml4gw/utils/slicing.py,sha256=ilRz_5sJzwmd5VyBlrj81tvyC3uCnXYjd0TO2fzFMr8,13563
37
+ ml4gw/waveforms/__init__.py,sha256=dnxfRGX_B3zQPB3_3srLyjZXRxTn4miZqYIRe7PYyrU,170
38
+ ml4gw/waveforms/generator.py,sha256=dO6RQ96EC87p2q0tEkxA62XkkJc1xARFO1SKcGvyDhM,1272
39
+ ml4gw/waveforms/phenom_d.py,sha256=vA60SjOvWSIcsU83-KEw2hnU3ATo4eW8A2mMmuMXo7Y,46941
40
+ ml4gw/waveforms/phenom_d_data.py,sha256=WA1FBxUp9fo1IQaV_OLJ_5g5gI166mY1FtG9n25he9U,53447
41
+ ml4gw/waveforms/phenom_p.py,sha256=VybpPlc2_yMGywnPz5B79QAygAj-WAeHZTPiZHets28,26951
42
+ ml4gw/waveforms/ringdown.py,sha256=m8IBQTxKBBGFqBtWGEO4KG3DEYR8TTnNyGVdVLaMKa8,3316
43
+ ml4gw/waveforms/sine_gaussian.py,sha256=-MtrI7ydwBTk4K0O4tdkC8-w5OifQszdnWN9__I4XzY,3569
44
+ ml4gw/waveforms/taylorf2.py,sha256=ySYLGTT_c3k4NzPDsQ9v822kzvU6TwYpELJEWlCDGQE,10428
45
+ ml4gw-0.5.1.dist-info/METADATA,sha256=P2uoQtMX_K5SSwAzTY5tyNvWYszxaDADTS54iDOQYKw,5785
46
+ ml4gw-0.5.1.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
47
+ ml4gw-0.5.1.dist-info/RECORD,,