Skip to content

Commit

Permalink
Add debugging prints; use SEOBNRv4PHM as backup MR approximant for ES…
Browse files Browse the repository at this point in the history
…IGMA
  • Loading branch information
prayush committed Jun 25, 2024
1 parent 05541b8 commit 1b08c00
Showing 1 changed file with 40 additions and 10 deletions.
50 changes: 40 additions & 10 deletions pycbc/waveform/waveform.py
Original file line number Diff line number Diff line change
Expand Up @@ -593,16 +593,31 @@ def get_td_waveform(template=None, **kwargs):
os.environ["ModePNOrder"] = "8"
os.environ["InspiralEndRadius"] = "4.0"

if "eccentricity" in input_params:
eccentricity = float(input_params.get("eccentricity", 0))
else:
verbose = input_params.get("verbose", False)
if verbose: print(f"Assigning eccentricity a value now")
if 'alpha' in input_params:
eccentricity = float(input_params.get("alpha", 0))
if "mean_anomaly" in input_params:
if verbose:
print(f"Using eccentricity from `alpha` column, value = {eccentricity}")
elif "eccentricity" in input_params:
eccentricity = float(input_params.get("eccentricity", 0))
if verbose:
print(f"Using eccentricity from `eccentricity` column, value = {eccentricity}")

if verbose: print(f"Assigning mean_anomaly a value now")
if 'alpha1' in input_params:
mean_anomaly = float(input_params.get("alpha1", 0))
if verbose:
print(f"Using mean_anomaly from `alpha1` column, value = {mean_anomaly}")
elif "mean_anomaly" in input_params:
mean_anomaly = float(input_params.get("mean_anomaly", 0))
if verbose:
print(f"Using mean_anomaly from `mean_anomaly` column, value = {mean_anomaly}")
elif "mean_per_ano" in input_params:
mean_anomaly = float(input_params.get("mean_per_ano", 0))
else:
mean_anomaly = float(input_params.get("alpha1", 0))
if verbose:
print(f"Using mean_anomaly from `mean_per_ano` column, value = {mean_anomaly}")

esigma_params = dict(
mass1=float(input_params["mass1"]),
mass2=float(input_params["mass2"]),
Expand Down Expand Up @@ -666,10 +681,25 @@ def get_td_waveform(template=None, **kwargs):
)
return hp, hc
except Exception as exc:
print(f"""Failed to generate waveform with input_params={input_params},
with error: {exc}
""")
return None, None
try:
esigma_params["merger_ringdown_approximant"] = "SEOBNRv4PHM"
if input_params["approximant"] == "IMRESIGMAHM":
hp, hc = esigma_utils.get_imr_esigma_waveform(
**esigma_params, modes_to_use=[(2, 2), (2, 1), (3, 3), (3, 2), (4, 4), (4, 3)]
)
elif input_params["approximant"] == "IMRESIGMA":
hp, hc = esigma_utils.get_imr_esigma_waveform(
**esigma_params, modes_to_use=[(2, 2)]
)
else:
print(f"""Failed to generate waveform with input_params={input_params},
with errors: {exc}""")
return None, None
except Exception as exc2:
print(f"""Failed to generate waveform with input_params={input_params},
with errors: {exc}
and: {exc2}""")
return None, None
else:
wav_gen = td_wav[type(_scheme.mgr.state)]
if input_params['approximant'] not in wav_gen:
Expand Down

0 comments on commit 1b08c00

Please sign in to comment.