From 1b08c003883a43d1f05e17e8e35db3169051fd36 Mon Sep 17 00:00:00 2001 From: Prayush Kumar Date: Tue, 25 Jun 2024 21:54:36 +0530 Subject: [PATCH] Add debugging prints; use SEOBNRv4PHM as backup MR approximant for ESIGMA --- pycbc/waveform/waveform.py | 50 ++++++++++++++++++++++++++++++-------- 1 file changed, 40 insertions(+), 10 deletions(-) diff --git a/pycbc/waveform/waveform.py b/pycbc/waveform/waveform.py index d41d9aa07d5..69849e4bdd1 100644 --- a/pycbc/waveform/waveform.py +++ b/pycbc/waveform/waveform.py @@ -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"]), @@ -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: