`catch_waveform_error` not working with `IMRPhenomTPHM`
Recently I found that the catch_waveform_error
kwarg was not catching the following error "Error: Root finder unable to solve reference time. Reference frequency may be too high for these parameters. Try reducing fRef below the peak frequency: YYY Hz", which is raised when IMRPhenomTPHM
is being called with a very high mass point in the parameter space. I believe this is because the RuntimeError
is "Internal function call failed" and not "Internal function call failed: Input domain error" which is being caught here. I propose modifying bilby/gw/source#L614 to be:
EDOM = ('Internal function call failed' in e.args[0]) or ('Input domain error' in e.args[0])
I have tested this and it does indeed catch the error. I have added an MR here: !1311 (closed).
Reproduce this error
You can reproduce this error with the following script:import bilby
generator = bilby.gw.WaveformGenerator(
duration=8., sampling_frequency=1024,
frequency_domain_source_model=bilby.gw.source.lal_binary_black_hole,
waveform_arguments={
"waveform_approximant": "IMRPhenomTPHM",
"reference_frequency": 20.,
"minimum_frequency": 10.,
"maximum_frequency": 448.,
"catch_waveform_errors": True
}
)
# choose really high mass case
params = {
"mass_1": 600,
"mass_2": 550,
"a_1": 0.5,
"a_2": 0.5,
"tilt_1": 0.,
"tilt_2": 0.,
"phi_12": 0.,
"phi_jl": 0.,
"theta_jn": 0.5,
"luminosity_distance": 100,
"geocent_time": 0.,
"ra": 0.5,
"dec": 0.5,
"psi": 0.5,
"phase": 0.5
}
generator.frequency_domain_strain(parameters=params)
Edited by Charlie Hoy