Skip to content

Commit

Permalink
improve error msg formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
prayush committed Nov 21, 2024
1 parent b28c51c commit c26fab9
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions pycbc/waveform/waveform.py
Original file line number Diff line number Diff line change
Expand Up @@ -658,12 +658,12 @@ def get_td_waveform(template=None, **kwargs):
modes_to_use=input_params.get("modes_to_use", [])
)
if len(esigma_params["modes_to_use"]) == 0:
if esigma_params["merger_ringdown_approximant"] == "SEOBNRv4PHM":
if not input_params["approximant"].endswith("HM"):
esigma_params["modes_to_use"] = [(2, 2)]
elif esigma_params["merger_ringdown_approximant"] == "SEOBNRv4PHM":
esigma_params["modes_to_use"] = [(2, 2), (2, 1), (3, 3), (4, 4)]
elif esigma_params["merger_ringdown_approximant"] == "NRSur7dq4":
esigma_params["modes_to_use"] = [(2, 2), (2, 1), (3, 3), (3, 2), (4, 4), (4, 3)]
if not input_params["approximant"].endswith("HM"):
esigma_params["modes_to_use"] = [(2, 2)]

try:
if "IMRESIGMA" in input_params["approximant"]:
Expand All @@ -672,12 +672,14 @@ def get_td_waveform(template=None, **kwargs):
hp, hc = esigma_utils.get_inspiral_esigma_waveform(**esigma_params)
if hp is None or hc is None:
raise IOError(
f"Approximant {input_params['approximant']} not supported"
f"""Approximant {input_params['approximant']} not supported.
Parameters: {esigma_params}"""
)
return hp, hc
except Exception as exc:
try:
print(f"Going to generate ESIGMA with SEOBNRv4PHM, Modes used: (2,2), (2,1), (3,3), (4,4)")
print(f"""Going to generate ESIGMA with SEOBNRv4PHM,
Modes used: (2,2), (2,1), (3,3), (4,4)""")
esigma_params["merger_ringdown_approximant"] = "SEOBNRv4PHM"
if input_params["approximant"] == "IMRESIGMAHM":
esigma_params["modes_to_use"] = [(2, 2), (2, 1), (3, 3), (4, 4)]
Expand Down

0 comments on commit c26fab9

Please sign in to comment.