1
1
"""
2
- This module processes gravitational wave data from numerical relativity simulations.
2
+ Process gravitational wave data from numerical relativity simulations.
3
+
3
4
It provides functions to read waveform data files, compute derivatives, process wave data,
4
5
perform complex Fast Fourier Transforms (FFT), and fit data to a quadratic function.
5
6
The main functionality involves reading gravitational wave data, extracting relevant
@@ -118,8 +119,7 @@ def compute_second_derivative_in_time(
118
119
time : NDArray [np .float64 ], data : NDArray [np .float64 ]
119
120
) -> NDArray [np .float64 ]:
120
121
"""
121
- Compute the second time derivative of the input data using the second-order finite difference method,
122
- with upwind/downwind stencils for the endpoints.
122
+ Compute the second time derivative of the input data using the second-order finite difference method, with upwind/downwind stencils for the endpoints.
123
123
124
124
:param time: A numpy array containing time values.
125
125
:param data: A numpy array containing data for which the second time derivative is to be calculated.
@@ -154,7 +154,7 @@ def compute_psi4_wave_phase_and_amplitude(
154
154
NDArray [np .float64 ], NDArray [np .float64 ], NDArray [np .float64 ], NDArray [np .float64 ]
155
155
]:
156
156
"""
157
- Calculates the cumulative phase and amplitude of a gravitational wave signal.
157
+ Calculate the cumulative phase and amplitude of a gravitational wave signal.
158
158
159
159
:param time: A numpy array containing time values.
160
160
:param real: A numpy array containing the real part of the signal.
@@ -164,7 +164,6 @@ def compute_psi4_wave_phase_and_amplitude(
164
164
165
165
:raises ValueError: If the lengths of time, real, and imag arrays are not equal.
166
166
"""
167
-
168
167
if not len (time ) == len (real ) == len (imag ):
169
168
raise ValueError ("The lengths of time, real, and imag arrays must be equal." )
170
169
@@ -212,6 +211,7 @@ def fit_quadratic_to_omega_and_find_minimum(
212
211
"""
213
212
Fits a quadratic curve to the filtered omega data within a specified time range and outputs the minimum omega value.
214
213
214
+ :param r_over_M: Dimensionless extraction radius r/M.
215
215
:param time: A numpy array containing time values.
216
216
:param omega: A numpy array containing omega values corresponding to the time values.
217
217
@@ -224,7 +224,7 @@ def fit_quadratic_to_omega_and_find_minimum(
224
224
225
225
def quadratic (x : float , a : float , b : float , c : float ) -> float :
226
226
"""
227
- Represents a quadratic function.
227
+ Represent a quadratic function.
228
228
229
229
:param x: The independent variable.
230
230
:param a: The coefficient of the x^2 term.
@@ -262,7 +262,7 @@ def perform_complex_fft(
262
262
time : NDArray [np .float64 ], real : NDArray [np .float64 ], imag : NDArray [np .float64 ]
263
263
) -> Tuple [NDArray [np .float64 ], NDArray [np .complex128 ]]:
264
264
"""
265
- Performs a complex Fast Fourier Transform (FFT) on the input time, real, and imaginary data.
265
+ Perform a complex Fast Fourier Transform (FFT) on the input time, real, and imaginary data.
266
266
267
267
:param time: A numpy array containing time values.
268
268
:param real: A numpy array containing the real part of the signal.
@@ -272,7 +272,6 @@ def perform_complex_fft(
272
272
273
273
:raises ValueError: If the lengths of time, real, and imag arrays are not equal.
274
274
"""
275
-
276
275
if not len (time ) == len (real ) == len (imag ):
277
276
raise ValueError ("The lengths of time, real, and imag arrays must be equal." )
278
277
@@ -296,7 +295,7 @@ def extract_min_omega_ell2_m2(
296
295
mode_data : Dict [Tuple [int , int ], Tuple [NDArray [np .float64 ], NDArray [np .float64 ]]],
297
296
) -> float :
298
297
"""
299
- Extracts and saves the phase, amplitude, and omega data for l=m=2 mode from psi4 wave.
298
+ Extract the phase, amplitude, and omega data for l=m=2 mode from psi4 wave.
300
299
Also fits a quadratic to omega and finds its minimum.
301
300
302
301
:param extraction_radius: The extraction radius.
@@ -334,11 +333,7 @@ def extract_min_omega_ell2_m2(
334
333
335
334
336
335
def main () -> None :
337
- """
338
- Main function that reads the gravitational wave data file and the dimensionless
339
- radius r/M, processes the data, and saves the output to a file. The input filename
340
- and r/M value are provided via the command line.
341
- """
336
+ """Read the gravitational wave data file and the dimensionless radius r/M, processes the data, and saves the output to a file. The input filename and r/M value are provided via the command line."""
342
337
if len (sys .argv ) != 2 :
343
338
print (
344
339
"Usage: python3 BHaH_psi4_to_phase_amp_omega_FFI_strain_psi4check.py <extraction radius (r/M)>"
0 commit comments