Skip to content

Commit 04bc6b2

Browse files
committed
BHaH_psi4_to_phase_amp_omega_FFI_strain_psi4check.py: fix some linter issues
1 parent 6fba0af commit 04bc6b2

File tree

1 file changed

+9
-14
lines changed

1 file changed

+9
-14
lines changed

BHaH_psi4_to_phase_amp_omega_FFI_strain_psi4check.py

+9-14
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
"""
2-
This module processes gravitational wave data from numerical relativity simulations.
2+
Process gravitational wave data from numerical relativity simulations.
3+
34
It provides functions to read waveform data files, compute derivatives, process wave data,
45
perform complex Fast Fourier Transforms (FFT), and fit data to a quadratic function.
56
The main functionality involves reading gravitational wave data, extracting relevant
@@ -118,8 +119,7 @@ def compute_second_derivative_in_time(
118119
time: NDArray[np.float64], data: NDArray[np.float64]
119120
) -> NDArray[np.float64]:
120121
"""
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.
123123
124124
:param time: A numpy array containing time values.
125125
: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(
154154
NDArray[np.float64], NDArray[np.float64], NDArray[np.float64], NDArray[np.float64]
155155
]:
156156
"""
157-
Calculates the cumulative phase and amplitude of a gravitational wave signal.
157+
Calculate the cumulative phase and amplitude of a gravitational wave signal.
158158
159159
:param time: A numpy array containing time values.
160160
:param real: A numpy array containing the real part of the signal.
@@ -164,7 +164,6 @@ def compute_psi4_wave_phase_and_amplitude(
164164
165165
:raises ValueError: If the lengths of time, real, and imag arrays are not equal.
166166
"""
167-
168167
if not len(time) == len(real) == len(imag):
169168
raise ValueError("The lengths of time, real, and imag arrays must be equal.")
170169

@@ -212,6 +211,7 @@ def fit_quadratic_to_omega_and_find_minimum(
212211
"""
213212
Fits a quadratic curve to the filtered omega data within a specified time range and outputs the minimum omega value.
214213
214+
:param r_over_M: Dimensionless extraction radius r/M.
215215
:param time: A numpy array containing time values.
216216
:param omega: A numpy array containing omega values corresponding to the time values.
217217
@@ -224,7 +224,7 @@ def fit_quadratic_to_omega_and_find_minimum(
224224

225225
def quadratic(x: float, a: float, b: float, c: float) -> float:
226226
"""
227-
Represents a quadratic function.
227+
Represent a quadratic function.
228228
229229
:param x: The independent variable.
230230
:param a: The coefficient of the x^2 term.
@@ -262,7 +262,7 @@ def perform_complex_fft(
262262
time: NDArray[np.float64], real: NDArray[np.float64], imag: NDArray[np.float64]
263263
) -> Tuple[NDArray[np.float64], NDArray[np.complex128]]:
264264
"""
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.
266266
267267
:param time: A numpy array containing time values.
268268
:param real: A numpy array containing the real part of the signal.
@@ -272,7 +272,6 @@ def perform_complex_fft(
272272
273273
:raises ValueError: If the lengths of time, real, and imag arrays are not equal.
274274
"""
275-
276275
if not len(time) == len(real) == len(imag):
277276
raise ValueError("The lengths of time, real, and imag arrays must be equal.")
278277

@@ -296,7 +295,7 @@ def extract_min_omega_ell2_m2(
296295
mode_data: Dict[Tuple[int, int], Tuple[NDArray[np.float64], NDArray[np.float64]]],
297296
) -> float:
298297
"""
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.
300299
Also fits a quadratic to omega and finds its minimum.
301300
302301
:param extraction_radius: The extraction radius.
@@ -334,11 +333,7 @@ def extract_min_omega_ell2_m2(
334333

335334

336335
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."""
342337
if len(sys.argv) != 2:
343338
print(
344339
"Usage: python3 BHaH_psi4_to_phase_amp_omega_FFI_strain_psi4check.py <extraction radius (r/M)>"

0 commit comments

Comments
 (0)