Skip to content

Commit

Permalink
Merge pull request #212 from vijayvarma392/warn_negative_phase
Browse files Browse the repository at this point in the history
check phase22 sign convention
  • Loading branch information
vijayvarma392 authored Mar 20, 2024
2 parents 7f6d9eb + 6cdb029 commit 6899901
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 5 deletions.
16 changes: 16 additions & 0 deletions gw_eccentricity/eccDefinition.py
Original file line number Diff line number Diff line change
Expand Up @@ -584,6 +584,22 @@ def process_data_dict(self,
amp22_merger = newDataDict["amplm"][(2, 2)][merger_idx]
phase22 = newDataDict["phaselm"][(2, 2)]
phase22_merger = phase22[merger_idx]
# check if phase22 is increasing. phase22 at merger should be greater
# than the phase22 at the start of the waveform
if phase22_merger < phase22[0]:
raise Exception(
f"phase22 = {phase22_merger} at the merger is < "
f"phase22 = {phase22[0]} at the start. The "
"phaselm should be related to hlm as "
"hlm = amplm * exp(- i phaselm) ensuring that "
"the phaselm is monotonically increasing for m > 0 modes."
"This might be fixed by changing the overall sign of "
"phase in the input `dataDict`")
# check that omega22 is positive by checking its value at the merger
omega22_merger = newDataDict["omegalm"][(2, 2)][merger_idx]
if omega22_merger < 0:
raise Exception(f"omega22 at merger is {omega22_merger} < 0. "
"omega22 must be positive.")
# Minimum width for peak finding function
min_width_for_extrema = self.get_width_for_peak_finder_from_phase22(
newDataDict["t"],
Expand Down
15 changes: 10 additions & 5 deletions test/test_dataDict.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,10 @@ def test_dataDict():
# To avoid exception for residual method since the data does
# not contain zeroecc data
continue
second_data_dict = copy.deepcopy(dataDict2)
# use data_w_hlm as dataDict1
compare_eccentricity_measurement(dataDict1=dataDict1_w_hlm,
dataDict2=dataDict2,
dataDict2=second_data_dict,
method=method)
# Now we repeat the same as above but adding hlm_zeroecc to both the data
# dict.
Expand Down Expand Up @@ -162,13 +163,15 @@ def test_dataDict():
{"omegalm_zeroecc": omegalm_zeroecc})
# Loop over the different methods
for method in available_methods:
second_data_dict = copy.deepcopy(dataDict2_w_hlm_zeroecc)
compare_eccentricity_measurement(
dataDict1=dataDict1_w_hlm_zeroecc,
dataDict2=dataDict2_w_hlm_zeroecc,
dataDict2=second_data_dict,
method=method)
second_data_dict = copy.deepcopy(dataDict2_w_hlm_zeroecc_and_omegalm_zeroecc)
compare_eccentricity_measurement(
dataDict1=dataDict1_w_hlm_zeroecc,
dataDict2=dataDict2_w_hlm_zeroecc_and_omegalm_zeroecc,
dataDict2=second_data_dict,
method=method)
# This time instead of adding hlm_zeroecc, we add amplm_zeroecc and
# phaselm_zeroecc to dataDict2, dataDict1 is the same as above.
Expand All @@ -193,11 +196,13 @@ def test_dataDict():
{"omegalm_zeroecc": omegalm_zeroecc})
# Loop over the different methods
for method in available_methods:
second_data_dict = copy.deepcopy(dataDict2_w_amplm_and_phaselm_zeroecc)
compare_eccentricity_measurement(
dataDict1=dataDict1_w_hlm_zeroecc,
dataDict2=dataDict2_w_amplm_and_phaselm_zeroecc,
dataDict2=second_data_dict,
method=method)
second_data_dict = copy.deepcopy(dataDict2_w_amplm_and_phaselm_and_omegalm_zeroecc)
compare_eccentricity_measurement(
dataDict1=dataDict1_w_hlm_zeroecc,
dataDict2=dataDict2_w_amplm_and_phaselm_and_omegalm_zeroecc,
dataDict2=second_data_dict,
method=method)

0 comments on commit 6899901

Please sign in to comment.