-
Notifications
You must be signed in to change notification settings - Fork 125
BUG: generate_all_bbh_parameters using defaults instead of user provided values #1056
Description
Describe the bug
When performing a simple parameter conversion using generate_all_bbh_parameters, the reference_frequency and minimum_frequency returned in the dictionary appear to be the default values coded into the function rather than the values provided by the user. I'm worried that spin conversions aren't occurring at the desired reference frequency. Since this function is used in several other codes and packages in GW, especially to generate all BBH parameters, it would be good to fix it even if downstream parameter estimation in bilby is not affected by the current state of the function.
To Reproduce
from bilby.gw.conversion import generate_all_bbh_parameters
import numpy as np
common_params = {'theta_jn':0.0,
'geocent_time':0.0,
'phase':0.0,
'ra':np.pi/3,
'dec':np.pi/3,
'psi':np.pi/3,
'reference_frequency':5.0,
'minimum_frequency':5.0}
bbh_params = {'mass_1_source': 40,
'mass_2_source': 35,
'luminosity_distance': 400,
'a_1':0.3,
'a_2':0.2,
'tilt_1':np.pi/4,
'tilt_2':np.pi/3}
bbh_params.update(common_params)
bbh_params = generate_all_bbh_parameters(bbh_params)
print(bbh_params)
Expected behavior
The dictionary returned by the function should contain the user-provided values of reference_frequency and minimum_frequency if these were provided in the input.
Suggested solution (optional)
This additional snippet can be added to the existing function
waveform_defaults = {
'reference_frequency': 50.0, 'waveform_approximant': 'IMRPhenomPv2',
'minimum_frequency': 20.0}
for key in waveform_defaults.keys():
if key in samples.keys():
if isinstance(samples[key], float):
waveform_defaults[key] = samples[key]
else:
waveform_defaults[key] = float(np.array(samples[key])[0])
Environment:
- Bilby version: 2.2.2.1
- Installation method [e.g. conda, pip, source]: igwn-py11 package
Additional context
Add any other context about the problem here.