Skip to content

Commit

Permalink
improve documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
md-arif-shaikh committed Jun 7, 2024
1 parent c7cc404 commit fd1a05f
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 18 deletions.
30 changes: 18 additions & 12 deletions gw_eccentricity/eccDefinition.py
Original file line number Diff line number Diff line change
Expand Up @@ -546,8 +546,14 @@ def process_data_dict(self,
`amplitude_using_all_modes`. This is computed before the
truncation.
amp_gw_merger : float
Amplitude of the (2, 2) mode at t_merger. This is computed before
the truncation.
Value of amp_gw at the merger. For nonprecessing systems, amp_gw is
the amplitude of the (2, 2) mode. For precessing systems, amp_gw is
obtained using a symmetric combination of the amplitude of (2, 2)
and (2, -2) mode in the coprecessing frame. See `get_amp_phase_omega_gw`
for more details.
This needs to be computed before the modes are truncated.
# TODO: Maybe we should use the ampitude from al modes and use the
# it's max value.
min_width_for_extrema : float
Minimum width for the `find_peaks` function. This is computed
before the truncation.
Expand Down Expand Up @@ -603,9 +609,16 @@ def process_data_dict(self,
newDataDict["t"],
amplitude_using_all_modes(newDataDict["amplm"], "amplm"))[0]
merger_idx = np.argmin(np.abs(newDataDict["t"] - t_merger))
amp_gw_merger = newDataDict["amplm"][(2, 2)][merger_idx]
phase_gw = newDataDict["phaselm"][(2, 2)]
phase_gw_merger = phase_gw[merger_idx]
if not self.precessing:
amp_gw_merger = newDataDict["amplm"][(2, 2)][merger_idx]
phase_gw = newDataDict["phaselm"][(2, 2)]
phase_gw_merger = phase_gw[merger_idx]
# TODO: we may need to change this in the future.
# For example, omega_gw could be the invariant angular velocity even
# for nonprecessing case.
omega_gw_merger = newDataDict["omegalm"][(2, 2)][merger_idx]
else:
raise NotImplementedError("Precessing system is not supported yet.")
# check if phase_gw is increasing. phase_gw at merger should be greater
# than the phase_gw at the start of the waveform
if phase_gw_merger < phase_gw[0]:
Expand All @@ -618,13 +631,6 @@ def process_data_dict(self,
"This might be fixed by changing the overall sign of "
"phase in the input `dataDict`")
# check that omega_gw is positive by checking its value at the merger
if not self.precessing:
# TODO: we may need to change this in the future.
# For example, omega_gw could be the invariant angular velocity even
# for nonprecessing case.
omega_gw_merger = newDataDict["omegalm"][(2, 2)][merger_idx]
else:
raise Exception("Precessing system is not supported yet!")
if omega_gw_merger < 0:
raise Exception(f"omega_gw at merger is {omega_gw_merger} < 0. "
"omega_gw must be positive.")
Expand Down
5 changes: 3 additions & 2 deletions gw_eccentricity/eccDefinitionUsingAmplitude.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@
Part of Eccentricity Definition project.
Md Arif Shaikh, Mar 28, 2022
"""
from .eccDefinition import eccDefinition
from scipy.signal import find_peaks
from .eccDefinition import eccDefinition
from .plot_settings import labelsDict


class eccDefinitionUsingAmplitude(eccDefinition):
Expand All @@ -20,7 +21,7 @@ def __init__(self, *args, **kwargs):
"""
super().__init__(*args, **kwargs)
self.data_for_finding_extrema = self.get_data_for_finding_extrema()
self.label_for_data_for_finding_extrema = r"$A_{\mathrm{gw}}$"
self.label_for_data_for_finding_extrema = labelsDict["amp_gw"]
self.method = "Amplitude"

def get_data_for_finding_extrema(self):
Expand Down
3 changes: 2 additions & 1 deletion gw_eccentricity/eccDefinitionUsingFrequency.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Md Arif Shaikh, Mar 28, 2022
"""
from .eccDefinitionUsingAmplitude import eccDefinitionUsingAmplitude
from .plot_settings import labelsDict


class eccDefinitionUsingFrequency(eccDefinitionUsingAmplitude):
Expand All @@ -18,7 +19,7 @@ def __init__(self, *args, **kwargs):
dataDict: Dictionary containing the waveform data.
"""
super().__init__(*args, **kwargs)
self.label_for_data_for_finding_extrema = r"$\omega_{\mathrm{gw}}$"
self.label_for_data_for_finding_extrema = labelsDict["omega_gw"]
self.method = "Frequency"

def get_data_for_finding_extrema(self):
Expand Down
3 changes: 2 additions & 1 deletion gw_eccentricity/eccDefinitionUsingResidualAmplitude.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Md Arif Shaikh, Mar 29, 2022
"""
from .eccDefinitionUsingAmplitude import eccDefinitionUsingAmplitude
from .plot_settings import labelsDict


class eccDefinitionUsingResidualAmplitude(eccDefinitionUsingAmplitude):
Expand All @@ -25,7 +26,7 @@ def __init__(self, *args, **kwargs):
"""
super().__init__(*args, **kwargs)
self.method = "ResidualAmplitude"
self.label_for_data_for_finding_extrema = r"$\Delta A_{\mathrm{gw}}$"
self.label_for_data_for_finding_extrema = labelsDict["res_amp_gw"]

def check_and_raise_zeroecc_data_not_found(self, method):
"""Raise exception if zeroecc data not found for Residual method.
Expand Down
4 changes: 2 additions & 2 deletions gw_eccentricity/eccDefinitionUsingResidualFrequency.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
Md Arif Shaikh, May 14, 2022
"""
from .eccDefinitionUsingResidualAmplitude import eccDefinitionUsingResidualAmplitude

from .plot_settings import labelsDict

class eccDefinitionUsingResidualFrequency(eccDefinitionUsingResidualAmplitude):
"""Measure eccentricity by finding extrema from residual frequency."""
Expand All @@ -25,7 +25,7 @@ def __init__(self, *args, **kwargs):
"""
super().__init__(*args, **kwargs)
self.method = "ResidualFrequency"
self.label_for_data_for_finding_extrema = r"$\Delta\omega_{\mathrm{gw}}$"
self.label_for_data_for_finding_extrema = labelsDict["res_omega_gw"]

def get_data_for_finding_extrema(self):
"""Get the data for extrema finding."""
Expand Down

0 comments on commit fd1a05f

Please sign in to comment.