pycbc icon indicating copy to clipboard operation
pycbc copied to clipboard

Add any provided key to `lal_pars` for waveform generation

Open hoyc1 opened this issue 1 year ago • 7 comments

The purpose of this PR is to pass any non default flags provided to pycbc's waveform generation to the relevant lalsimulation functions by adding them to lal_pars. The code first checks to see if the provided key can be added, and then it tries a camelcase version. The keys are added via the lalsimulation.SimInspiralWaveformParamsInsert{key} function. This code was inspired from bilby: https://git.ligo.org/lscsoft/bilby/-/blob/master/bilby/gw/source.py?ref_type=heads#L583-586.

I opted to try both e.g. modes_choice and ModesChoice as the prior is more convenient to add to configs/HDF. This change is particularly useful for modifying the default behaviour of waveform models (for example turning off multi-banding in IMRPhenomXPHM). This change will affect all pipelines that provide additional flags to the waveform generator.

  • [x] The author of this pull request confirms they will adhere to the code of conduct

hoyc1 avatar May 01 '24 08:05 hoyc1

cc @spxiwh.

hoyc1 avatar May 01 '24 08:05 hoyc1

@hoyc1 Looks like there are some genuine test failures here! @ahnitz Any thoughts about this? The idea is to avoid having to maintain a long list of possible lal_dict arguments to LALSim (similar to how Bilby does it).

spxiwh avatar May 01 '24 08:05 spxiwh

@spxiwh, I think I have fixed the test failures by only adding non-default flags to the lal_pars. I think the issue was that there exists functions such as lalsimulation.SimInspiralWaveformParamsInsertMass1, and mass1 is included in the provided dictionary. I am happy to hear other suggestions though!

hoyc1 avatar May 01 '24 08:05 hoyc1

Wait, what!? Why is there a lalsimulation.SimInspiralWaveformParamsInsertMass1 if mass1 has to be provided explicitly to the waveform generator anyway?

spxiwh avatar May 01 '24 09:05 spxiwh

FWIW, the redundant looking InsertMass1 (etc) functions are part of the 'New Waveform Interface', see here https://git.ligo.org/lscsoft/lalsuite/-/commit/5dec1651a0f28879ba5a2f7015744300935f3839?page=2

tdent avatar May 16 '24 11:05 tdent

So the 'key' here is actually the last part of the SimInspiralInsert function name, rather than the LALDict key name itself, if I've understood correctly. I guess this is an inevitable consequence of the lalsim code not having a predictable mapping from the key name to the function name ...

tdent avatar May 16 '24 11:05 tdent