ml4gw 0.4.1__py3-none-any.whl → 0.5.0__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,325 @@
1
1
  import torch
2
2
  from torchtyping import TensorType
3
3
 
4
- GAMMA = 0.577215664901532860606512090082402431
5
- """Euler-Mascheroni constant. Same as lal.GAMMA"""
4
+ from ..constants import MPC_SEC, MTSUN_SI, PI
5
+ from ..constants import EulerGamma as GAMMA
6
6
 
7
- MSUN_SI = 1.988409870698050731911960804878414216e30
8
- """Solar mass in kg. Same as lal.MSUN_SI"""
9
7
 
10
- MTSUN_SI = 4.925490947641266978197229498498379006e-6
11
- """1 solar mass in seconds. Same value as lal.MTSUN_SI"""
8
+ class TaylorF2(torch.nn.Module):
9
+ def __init__(self):
10
+ super().__init__()
12
11
 
13
- PI = 3.141592653589793238462643383279502884
14
- """Archimedes constant. Same as lal.PI"""
15
-
16
- MPC_SEC = 1.02927125e14
17
- """
18
- 1 Mpc in seconds.
19
- """
12
+ def forward(
13
+ self,
14
+ f: TensorType,
15
+ chirp_mass: TensorType,
16
+ mass_ratio: TensorType,
17
+ chi1: TensorType,
18
+ chi2: TensorType,
19
+ distance: TensorType,
20
+ phic: TensorType,
21
+ inclination: TensorType,
22
+ f_ref: float,
23
+ ):
24
+ """
25
+ TaylorF2 up to 3.5 PN in phase. Newtonian SPA amplitude.
20
26
 
27
+ Args:
28
+ f:
29
+ Frequency series in Hz.
30
+ chirp_mass:
31
+ Chirp mass in solar masses
32
+ mass_ratio:
33
+ Mass ratio m1/m2
34
+ chi1:
35
+ Spin of m1
36
+ chi2:
37
+ Spin of m2
38
+ distance:
39
+ Luminosity distance
40
+ phic:
41
+ Phase at coalescence
42
+ inclination:
43
+ Inclination angle
44
+ f_ref:
45
+ Reference frequency
21
46
 
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
47
+ Returns:
48
+ hc, hp: Tuple[torch.Tensor, torch.Tensor]
49
+ Cross and plus polarizations
50
+ """
38
51
 
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
52
+ # shape assumed (n_batch, params)
53
+ if (
54
+ chirp_mass.shape[0] != mass_ratio.shape[0]
55
+ or chirp_mass.shape[0] != chi1.shape[0]
56
+ or chi1.shape[0] != chi2.shape[0]
57
+ or chi2.shape[0] != distance.shape[0]
58
+ or distance.shape[0] != phic.shape[0]
59
+ or phic.shape[0] != inclination.shape[0]
60
+ ):
61
+ raise RuntimeError("Tensors should have same batch size")
62
+ mass2 = chirp_mass * (1.0 + mass_ratio) ** 0.2 / mass_ratio**0.6
63
+ mass1 = mass_ratio * mass2
64
+ cfac = torch.cos(inclination)
65
+ pfac = 0.5 * (1.0 + cfac * cfac)
50
66
 
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
67
+ htilde = self.taylorf2_htilde(
68
+ f, mass1, mass2, chi1, chi2, distance, phic, f_ref
150
69
  )
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
70
 
213
- return phasing, Dphasing
71
+ hp = (htilde.mT * pfac).mT
72
+ hc = -1j * (htilde.mT * cfac).mT
214
73
 
74
+ return hc, hp
215
75
 
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
223
-
224
- # Flux and energy coefficient at newtonian
225
- FTaN = 32.0 * eta * eta / 5.0
226
- dETaN = 2 * (-eta / 2.0)
76
+ def taylorf2_htilde(
77
+ self,
78
+ f: TensorType,
79
+ mass1: TensorType,
80
+ mass2: TensorType,
81
+ chi1: TensorType,
82
+ chi2: TensorType,
83
+ distance: TensorType,
84
+ phic: TensorType,
85
+ f_ref: float,
86
+ ):
87
+ mass1_s = mass1 * MTSUN_SI
88
+ mass2_s = mass2 * MTSUN_SI
89
+ M_s = mass1_s + mass2_s
90
+ eta = mass1_s * mass2_s / M_s / M_s
227
91
 
228
- amp0 = -4.0 * mass1_s * mass2_s * (PI / 12.0) ** 0.5
92
+ Mf = torch.outer(M_s, f)
93
+ Mf_ref = torch.outer(M_s, f_ref * torch.ones_like(f))
229
94
 
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
95
+ Psi, _ = self.taylorf2_phase(Mf, mass1, mass2, chi1, chi2)
96
+ Psi_ref, _ = self.taylorf2_phase(Mf_ref, mass1, mass2, chi1, chi2)
235
97
 
236
- return amp
98
+ Psi = (Psi.mT - 2 * phic).mT
99
+ Psi -= Psi_ref
237
100
 
101
+ amp0 = self.taylorf2_amplitude(Mf, mass1, mass2, eta, distance)
102
+ h0 = amp0 * torch.exp(-1j * (Psi - PI / 4))
103
+ return h0
238
104
 
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
105
+ def taylorf2_amplitude(
106
+ self, Mf: TensorType, mass1, mass2, eta, distance
107
+ ) -> TensorType:
108
+ mass1_s = mass1 * MTSUN_SI
109
+ mass2_s = mass2 * MTSUN_SI
110
+ v = (PI * Mf) ** (1.0 / 3.0)
111
+ v10 = v**10
253
112
 
254
- Mf = torch.outer(M_s, f)
255
- Mf_ref = torch.outer(M_s, f_ref * torch.ones_like(f))
113
+ # Flux and energy coefficient at newtonian
114
+ FTaN = 32.0 * eta * eta / 5.0
115
+ dETaN = 2 * (-eta / 2.0)
256
116
 
257
- Psi, _ = taylorf2_phase(Mf, mass1, mass2, chi1, chi2)
258
- Psi_ref, _ = taylorf2_phase(Mf_ref, mass1, mass2, chi1, chi2)
117
+ amp0 = -4.0 * mass1_s * mass2_s * (PI / 12.0) ** 0.5
259
118
 
260
- Psi = (Psi.T - 2 * phic).T
261
- Psi -= Psi_ref
119
+ amp0 /= distance * MPC_SEC
120
+ flux = (v10.mT * FTaN).mT
121
+ dEnergy = (v.mT * dETaN).mT
122
+ amp = torch.sqrt(-dEnergy / flux) * v
123
+ amp = (amp.mT * amp0).mT
262
124
 
263
- amp0 = taylorf2_amplitude(Mf, mass1, mass2, eta, distance)
264
- h0 = amp0 * torch.exp(-1j * (Psi - PI / 4))
265
- return h0
125
+ return amp
266
126
 
127
+ def taylorf2_phase(
128
+ self,
129
+ Mf: TensorType,
130
+ mass1: TensorType,
131
+ mass2: TensorType,
132
+ chi1: TensorType,
133
+ chi2: TensorType,
134
+ ) -> TensorType:
135
+ """
136
+ Calculate the inspiral phase for the TaylorF2.
137
+ """
138
+ M = mass1 + mass2
139
+ eta = mass1 * mass2 / M / M
140
+ m1byM = mass1 / M
141
+ m2byM = mass2 / M
142
+ chi1sq = chi1 * chi1
143
+ chi2sq = chi2 * chi2
267
144
 
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.
145
+ v0 = torch.ones_like(Mf)
146
+ v1 = (PI * Mf) ** (1.0 / 3.0)
147
+ v2 = v1 * v1
148
+ v3 = v2 * v1
149
+ v4 = v3 * v1
150
+ v5 = v4 * v1
151
+ v6 = v5 * v1
152
+ v7 = v6 * v1
153
+ logv = torch.log(v1)
154
+ v5_logv = v5 * logv
155
+ v6_logv = v6 * logv
281
156
 
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
- )
157
+ # Phase coeffeciencts from https://git.ligo.org/lscsoft/lalsuite/-/blob/master/lalsimulation/lib/LALSimInspiralPNCoefficients.c # noqa E501
158
+ pfaN = 3.0 / (128.0 * eta)
159
+ pfa_v0 = 1.0
160
+ pfa_v1 = 0.0
161
+ pfa_v2 = 5.0 * (74.3 / 8.4 + 11.0 * eta) / 9.0
162
+ pfa_v3 = -16.0 * PI
163
+ # SO contributions at 1.5 PN
164
+ pfa_v3 += (
165
+ m1byM * (25.0 + 38.0 / 3.0 * m1byM) * chi1
166
+ + m2byM * (25.0 + 38.0 / 3.0 * m2byM) * chi2
167
+ )
168
+ pfa_v4 = (
169
+ 5.0
170
+ * (3058.673 / 7.056 + 5429.0 / 7.0 * eta + 617.0 * eta * eta)
171
+ / 72.0
172
+ )
173
+ # SO, SS, S1,2-squared contributions
174
+ pfa_v4 += (
175
+ 247.0 / 4.8 * eta * chi1 * chi2
176
+ + -721.0 / 4.8 * eta * chi1 * chi2
177
+ + (-720.0 / 9.6 * m1byM * m1byM + 1.0 / 9.6 * m1byM * m1byM)
178
+ * chi1sq
179
+ + (-720.0 / 9.6 * m2byM * m2byM + 1.0 / 9.6 * m2byM * m2byM)
180
+ * chi2sq
181
+ + (240.0 / 9.6 * m1byM * m1byM + -7.0 / 9.6 * m1byM * m1byM)
182
+ * chi1sq
183
+ + (240.0 / 9.6 * m2byM * m2byM + -7.0 / 9.6 * m2byM * m2byM)
184
+ * chi2sq
185
+ )
186
+ pfa_v5logv = 5.0 / 3.0 * (772.9 / 8.4 - 13.0 * eta) * PI
187
+ pfa_v5 = 5.0 / 9.0 * (772.9 / 8.4 - 13.0 * eta) * PI
188
+ # SO coefficient for 2.5 PN
189
+ pfa_v5logv += 3.0 * (
190
+ -m1byM
191
+ * (
192
+ 1391.5 / 8.4
193
+ - 10.0 / 3.0 * m1byM * (1.0 - m1byM)
194
+ + m1byM * (1276.0 / 8.1 + 170.0 / 9.0 * m1byM * (1.0 - m1byM))
195
+ )
196
+ * chi1
197
+ - m2byM
198
+ * (
199
+ 1391.5 / 8.4
200
+ - 10.0 / 3.0 * m2byM * (1.0 - m2byM)
201
+ + m2byM * (1276.0 / 8.1 + 170.0 / 9.0 * m2byM * (1.0 - m2byM))
202
+ )
203
+ * chi2
204
+ )
205
+ pfa_v5 += (
206
+ -m1byM
207
+ * (
208
+ 1391.5 / 8.4
209
+ - 10.0 / 3.0 * m1byM * (1.0 - m1byM)
210
+ + m1byM * (1276.0 / 8.1 + 170.0 / 9.0 * m1byM * (1.0 - m1byM))
211
+ )
212
+ * chi1
213
+ + -m2byM
214
+ * (
215
+ 1391.5 / 8.4
216
+ - 10.0 / 3.0 * m2byM * (1.0 - m2byM)
217
+ + m2byM * (1276.0 / 8.1 + 170.0 / 9.0 * m2byM * (1.0 - m2byM))
218
+ )
219
+ * chi2
220
+ )
221
+ pfa_v6logv = -684.8 / 2.1
222
+ pfa_v6 = (
223
+ 11583.231236531 / 4.694215680
224
+ - 640.0 / 3.0 * PI * PI
225
+ - 684.8 / 2.1 * GAMMA
226
+ + eta * (-15737.765635 / 3.048192 + 225.5 / 1.2 * PI * PI)
227
+ + eta * eta * 76.055 / 1.728
228
+ - eta * eta * eta * 127.825 / 1.296
229
+ + pfa_v6logv * torch.log(torch.tensor(4.0))
230
+ )
231
+ # SO + S1-S2 + S-squared contribution at 3 PN
232
+ pfa_v6 += (
233
+ PI * m1byM * (1490.0 / 3.0 + m1byM * 260.0) * chi1
234
+ + PI * m2byM * (1490.0 / 3.0 + m2byM * 260.0) * chi2
235
+ + (326.75 / 1.12 + 557.5 / 1.8 * eta) * eta * chi1 * chi2
236
+ + (
237
+ (4703.5 / 8.4 + 2935.0 / 6.0 * m1byM - 120.0 * m1byM * m1byM)
238
+ * m1byM
239
+ * m1byM
240
+ + (
241
+ -4108.25 / 6.72
242
+ - 108.5 / 1.2 * m1byM
243
+ + 125.5 / 3.6 * m1byM * m1byM
244
+ )
245
+ * m1byM
246
+ * m1byM
247
+ )
248
+ * chi1sq
249
+ + (
250
+ (4703.5 / 8.4 + 2935.0 / 6.0 * m2byM - 120.0 * m2byM * m2byM)
251
+ * m2byM
252
+ * m2byM
253
+ + (
254
+ -4108.25 / 6.72
255
+ - 108.5 / 1.2 * m2byM
256
+ + 125.5 / 3.6 * m2byM * m2byM
257
+ )
258
+ * m2byM
259
+ * m2byM
260
+ )
261
+ * chi2sq
262
+ )
263
+ pfa_v7 = PI * (
264
+ 770.96675 / 2.54016
265
+ + 378.515 / 1.512 * eta
266
+ - 740.45 / 7.56 * eta * eta
267
+ )
268
+ # SO contribution at 3.5 PN
269
+ pfa_v7 += (
270
+ m1byM
271
+ * (
272
+ -17097.8035 / 4.8384
273
+ + eta * 28764.25 / 6.72
274
+ + eta * eta * 47.35 / 1.44
275
+ + m1byM
276
+ * (
277
+ -7189.233785 / 1.524096
278
+ + eta * 458.555 / 3.024
279
+ - eta * eta * 534.5 / 7.2
280
+ )
281
+ )
282
+ ) * chi1 + (
283
+ m2byM
284
+ * (
285
+ -17097.8035 / 4.8384
286
+ + eta * 28764.25 / 6.72
287
+ + eta * eta * 47.35 / 1.44
288
+ + m2byM
289
+ * (
290
+ -7189.233785 / 1.524096
291
+ + eta * 458.555 / 3.024
292
+ - eta * eta * 534.5 / 7.2
293
+ )
294
+ )
295
+ ) * chi2
296
+ # construct power series
297
+ phasing = (v7.mT * pfa_v7).mT
298
+ phasing += (v6.mT * pfa_v6 + v6_logv.mT * pfa_v6logv).mT
299
+ phasing += (v5.mT * pfa_v5 + v5_logv.mT * pfa_v5logv).mT
300
+ phasing += (v4.mT * pfa_v4).mT
301
+ phasing += (v3.mT * pfa_v3).mT
302
+ phasing += (v2.mT * pfa_v2).mT
303
+ phasing += (v1.mT * pfa_v1).mT
304
+ phasing += (v0.mT * pfa_v0).mT
305
+ # Divide by 0PN v-dependence
306
+ phasing /= v5
307
+ # Multiply by 0PN coefficient
308
+ phasing = (phasing.mT * pfaN).mT
302
309
 
303
- hp = (htilde.T * pfac).T
304
- hc = -1j * (htilde.T * cfac).T
310
+ # Derivative of phase w.r.t Mf
311
+ # dPhi/dMf = dPhi/dv dv/dMf
312
+ Dphasing = (2.0 * v7.mT * pfa_v7).mT
313
+ Dphasing += (v6.mT * (pfa_v6 + pfa_v6logv)).mT
314
+ Dphasing += (v6_logv.mT * pfa_v6logv).mT
315
+ Dphasing += (v5.mT * pfa_v5logv).mT
316
+ Dphasing += (-1.0 * v4.mT * pfa_v4).mT
317
+ Dphasing += (-2.0 * v3.mT * pfa_v3).mT
318
+ Dphasing += (-3.0 * v2.mT * pfa_v2).mT
319
+ Dphasing += (-4.0 * v1.mT * pfa_v1).mT
320
+ Dphasing += -5.0 * v0
321
+ Dphasing /= 3.0 * v1 * v7
322
+ Dphasing *= PI
323
+ Dphasing = (Dphasing.mT * pfaN).mT
305
324
 
306
- return hp, hc
325
+ return phasing, Dphasing
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ml4gw
3
- Version: 0.4.1
3
+ Version: 0.5.0
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
@@ -10,6 +10,7 @@ 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
+ Requires-Dist: numpy (<2.0.0)
13
14
  Requires-Dist: torch (>=2.0,<3.0)
14
15
  Requires-Dist: torchaudio (>=2.0,<3.0)
15
16
  Requires-Dist: torchtyping (>=0.1,<0.2)