77def amplitude_phase_modification_fd (** kwds ):
88 """
99 This function applies the Amplitude-Phase modification, described in
10- Kumar, Melching, Ohme (2025), to the base waveform approximant in
10+ Kumar, Melching, Ohme (2025), to the base waveform approximant in
1111 frequency domain.
1212
1313 Input in kwds:
1414 error_in_phase: 'relative' or 'absolute'
1515 This argument specify the type of errors to be
1616 applied.
17- baseline_approximant: FD approximant of the reference waveform model to
17+ baseline_approximant: FD approximant of the reference waveform model to
1818 modified.
1919 modification_type: 'cubic_spline', 'cubic_spline_nodes', or 'constant_shift'
20- 'cubic_spline': If this option is passed, the dictionary should
20+ 'cubic_spline': If this option is passed, the dictionary should
2121 includes array of delta_amplitude, delta_phase, and nodal_points
2222 'cubic_spline_nodes': When we specify this modification_type, the lower
2323 and upper limits of the frequency should be given along with number
@@ -97,9 +97,9 @@ def amplitude_phase_modification_fd(**kwds):
9797 + delta_phase
9898 )
9999 elif dict_waveform_modification ['modification_type' ] == 'cubic_spline_nodes' :
100- f_lower = ( dict_waveform_modification .get ('f_lower_wferror' ,
101- default = dict_waveform_modification ['f_lower' ])
102- )
100+ f_lower = dict_waveform_modification .get (
101+ 'f_lower_wferror' , default = dict_waveform_modification ['f_lower' ]
102+ )
103103 f_high_wferror = dict_waveform_modification ['f_high_wferror' ]
104104 n_nodes_wferror = int (dict_waveform_modification ['n_nodes_wferror' ])
105105 wf_nodal_points = numpy .logspace (
@@ -158,6 +158,7 @@ def amplitude_phase_modification_fd(**kwds):
158158
159159 return hp , hc
160160
161+
161162def amplitude_phase_modification_both_polarization_fd (** kwds ):
162163 """Modify amplitude and phase of waveform polarizations in frequency domain."""
163164
@@ -178,18 +179,14 @@ def amplitude_phase_modification_both_polarization_fd(**kwds):
178179 delta_amplitude_plus_interp = CubicSpline (
179180 wf_nodal_points , delta_amplitude_plus_arr
180181 )
181- delta_phase_plus_interp = CubicSpline (
182- wf_nodal_points , delta_phase_plus_arr
183- )
182+ delta_phase_plus_interp = CubicSpline (wf_nodal_points , delta_phase_plus_arr )
184183
185184 delta_amplitude_cross_arr = dict_waveform_modification ['delta_amplitude_cross' ]
186185 delta_phase_cross_arr = dict_waveform_modification ['delta_phase_cross' ]
187186 delta_amplitude_cross_interp = CubicSpline (
188187 wf_nodal_points , delta_amplitude_cross_arr
189188 )
190- delta_phase_cross_interp = CubicSpline (
191- wf_nodal_points , delta_phase_cross_arr
192- )
189+ delta_phase_cross_interp = CubicSpline (wf_nodal_points , delta_phase_cross_arr )
193190
194191 # Modify amplitude and phase for Plus and Cross polarization
195192 Am_plus = waveform .amplitude_from_frequencyseries (hp ) * (
@@ -222,8 +219,12 @@ def amplitude_phase_modification_both_polarization_fd(**kwds):
222219 delta_phase_cross = dict_waveform_modification ['delta_phase_cross' ]
223220
224221 # Modify amplitude and phase for Plus and Cross polarization
225- Am_plus = waveform .amplitude_from_frequencyseries (hp ) * (1 + delta_amplitude_plus )
226- Am_cross = waveform .amplitude_from_frequencyseries (hc ) * (1 + delta_amplitude_cross )
222+ Am_plus = waveform .amplitude_from_frequencyseries (hp ) * (
223+ 1 + delta_amplitude_plus
224+ )
225+ Am_cross = waveform .amplitude_from_frequencyseries (hc ) * (
226+ 1 + delta_amplitude_cross
227+ )
227228
228229 if dict_waveform_modification ['error_in_phase' ] == 'relative' :
229230 Ph_plus = waveform .phase_from_frequencyseries (
@@ -233,40 +234,50 @@ def amplitude_phase_modification_both_polarization_fd(**kwds):
233234 hc , remove_start_phase = False
234235 ) * (1 + delta_phase_cross )
235236 elif dict_waveform_modification ['error_in_phase' ] == 'absolute' :
236- Ph_plus = waveform .phase_from_frequencyseries (
237- hp , remove_start_phase = False
238- ) + delta_phase_plus
239- Ph_cross = waveform .phase_from_frequencyseries (
240- hc , remove_start_phase = False
241- ) + delta_phase_cross
237+ Ph_plus = (
238+ waveform .phase_from_frequencyseries (hp , remove_start_phase = False )
239+ + delta_phase_plus
240+ )
241+ Ph_cross = (
242+ waveform .phase_from_frequencyseries (hc , remove_start_phase = False )
243+ + delta_phase_cross
244+ )
242245
243246 elif modification_type == 'cubic_spline_nodes' :
244- f_lower = ( dict_waveform_modification .get ('f_lower_wferror' ,
245- default = dict_waveform_modification ['f_lower' ])
246- )
247+ f_lower = dict_waveform_modification .get (
248+ 'f_lower_wferror' , default = dict_waveform_modification ['f_lower' ]
249+ )
247250 f_high_wferror = dict_waveform_modification ['f_high_wferror' ]
248251 n_nodes_wferror = int (dict_waveform_modification ['n_nodes_wferror' ])
249252
250253 wf_nodal_points = numpy .logspace (
251254 numpy .log10 (f_lower ), numpy .log10 (f_high_wferror ), n_nodes_wferror
252255 )
253256
254- delta_amplitude_plus_arr = numpy .hstack ([
255- dict_waveform_modification [f'wferror_amplitude_plus_{ i } ' ]
256- for i in range (len (wf_nodal_points ))
257- ])
258- delta_phase_plus_arr = numpy .hstack ([
259- dict_waveform_modification [f'wferror_phase_plus_{ i } ' ]
260- for i in range (len (wf_nodal_points ))
261- ])
262- delta_amplitude_cross_arr = numpy .hstack ([
263- dict_waveform_modification [f'wferror_amplitude_cross_{ i } ' ]
264- for i in range (len (wf_nodal_points ))
265- ])
266- delta_phase_cross_arr = numpy .hstack ([
267- dict_waveform_modification [f'wferror_phase_cross_{ i } ' ]
268- for i in range (len (wf_nodal_points ))
269- ])
257+ delta_amplitude_plus_arr = numpy .hstack (
258+ [
259+ dict_waveform_modification [f'wferror_amplitude_plus_{ i } ' ]
260+ for i in range (len (wf_nodal_points ))
261+ ]
262+ )
263+ delta_phase_plus_arr = numpy .hstack (
264+ [
265+ dict_waveform_modification [f'wferror_phase_plus_{ i } ' ]
266+ for i in range (len (wf_nodal_points ))
267+ ]
268+ )
269+ delta_amplitude_cross_arr = numpy .hstack (
270+ [
271+ dict_waveform_modification [f'wferror_amplitude_cross_{ i } ' ]
272+ for i in range (len (wf_nodal_points ))
273+ ]
274+ )
275+ delta_phase_cross_arr = numpy .hstack (
276+ [
277+ dict_waveform_modification [f'wferror_phase_cross_{ i } ' ]
278+ for i in range (len (wf_nodal_points ))
279+ ]
280+ )
270281
271282 delta_amplitude_plus_interp = CubicSpline (
272283 wf_nodal_points , delta_amplitude_plus_arr
@@ -275,9 +286,7 @@ def amplitude_phase_modification_both_polarization_fd(**kwds):
275286 delta_amplitude_cross_interp = CubicSpline (
276287 wf_nodal_points , delta_amplitude_cross_arr
277288 )
278- delta_phase_cross_interp = CubicSpline (
279- wf_nodal_points , delta_phase_cross_arr
280- )
289+ delta_phase_cross_interp = CubicSpline (wf_nodal_points , delta_phase_cross_arr )
281290
282291 # Modify amplitude and phase for Plus and Cross polarization
283292 Am_plus = waveform .amplitude_from_frequencyseries (hp ) * (
@@ -306,10 +315,11 @@ def amplitude_phase_modification_both_polarization_fd(**kwds):
306315 raise TypeError ("Currently, no other modification are supported" )
307316
308317 # Apply the correction to the base model
309- hp .data = numpy .vectorize (complex )(Am_plus * numpy .cos (Ph_plus ),
310- Am_plus * numpy .sin (Ph_plus ))
311- hc .data = numpy .vectorize (complex )(Am_cross * numpy .cos (Ph_cross ),
312- Am_cross * numpy .sin (Ph_cross ))
318+ hp .data = numpy .vectorize (complex )(
319+ Am_plus * numpy .cos (Ph_plus ), Am_plus * numpy .sin (Ph_plus )
320+ )
321+ hc .data = numpy .vectorize (complex )(
322+ Am_cross * numpy .cos (Ph_cross ), Am_cross * numpy .sin (Ph_cross )
323+ )
313324
314325 return hp , hc
315-
0 commit comments