Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Eccentricity and mean anomaly support in bilby #861

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

raffienficiaud
Copy link

The PR adds support for the parameters eccentricity and mean_per_ano anomaly.

The changes have been tested for supporting the model SEOBNRv5EHM which review has recently been completed.
As this is my first contribution, let me know if you need more unit tests (I cannot run them all locally or in this fork).

@raffienficiaud raffienficiaud changed the title Eccentricy and mean anomaly support in bilby Eccentricity and mean anomaly support in bilby Nov 20, 2024
@@ -259,7 +259,7 @@ def convert_to_lal_binary_black_hole_parameters(parameters):
)
converted_parameters[f"cos_tilt_{idx}"] = 1.0

for key in ["phi_jl", "phi_12"]:
for key in ["phi_jl", "phi_12", "eccentricity", "mean_per_ano"]:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this PR! My personal preference would be to not have the eccentricity and mean_per_ano fields in quasicircular PE files, so I would vote for not including these here at all. But I'd also like to hear opinions from others.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Naively, I would have thought that eccentric PE with gwsignal_binary_black_hole would work even without changes to this line. Am I missing something?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I introduced eccentricity and mean anomaly here because with the addition of eccentricity and mean_per_ano in the arguments of the gwsignal_binary_black_hole function in source.py, when one tries to run a quasicircular approximant (which does not specify eccentricity and mean_per_ano) Bilby would crash. Adding them here is a possible fix, but if you have other suggestions we are happy to modify the code

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for explaining. I still think there are other, better ways of dealing with this. Here are some in decreasing order of preference:

  1. Refactor the current code by adding a _base_gwsignal_cbc_fd_waveform function similar to _base_lal_cbc_fd_waveform, and make gwsignal_binary_black_hole call this function similar to how lal_binary_black_hole called _base_lal_cbc_fd_waveform. Write another function gwsignal_eccentric_binary_black_hole which also calls _base_gwsignal_cbc_fd_waveform. This change will also make things easier if e.g. you want to add e.g. tides to one of the waveforms.

  2. If for some reason 1 isn't preferred, I think the easiest way to not make bilby crash is to fix eccentricity and mean_per_ano to zero in your prior.

  3. You could also set a default value of eccentricity and mean_per_ano in the function definition.

I think 1 is by far the most robust option. Tagging @asb5468 @ColmTalbot @mj-will for opinions.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @adivijaykumar for the suggestions: is this addressing it? If yes, I'll continue from there and revert the other changes and tests.

Concerning 2/ and 3/, I would like to avoid default parameters as they may lead to silent mistakes.

Copy link
Collaborator

@adivijaykumar adivijaykumar Dec 10, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@raffienficiaud Yes I think that addresses it for the most part! You might want to take out the default waveform_kwargs from inside the _base_* function and put it into the individual gwsignal_* functions.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Previously (#793) we had discussed not making further modifications to this function and any new desired functionality should be leveraged by directly using the new waveform generator as a subclass of bilby.gw.waveform_generator.WaveformGenerator as it will lead to much less of the spaghetti we currently have to deal with different specific cases.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I reverted the changes in this file and the related unit test.

requirements.txt Outdated Show resolved Hide resolved
test/gw/conversion_test.py Outdated Show resolved Hide resolved
Copy link
Collaborator

@ColmTalbot ColmTalbot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm generally against this change as I think it encourages us to continue kicking the can down the road on using the flexibility intended in gwsignal.

requirements.txt Outdated Show resolved Hide resolved
@@ -259,7 +259,7 @@ def convert_to_lal_binary_black_hole_parameters(parameters):
)
converted_parameters[f"cos_tilt_{idx}"] = 1.0

for key in ["phi_jl", "phi_12"]:
for key in ["phi_jl", "phi_12", "eccentricity", "mean_per_ano"]:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Previously (#793) we had discussed not making further modifications to this function and any new desired functionality should be leveraged by directly using the new waveform generator as a subclass of bilby.gw.waveform_generator.WaveformGenerator as it will lead to much less of the spaghetti we currently have to deal with different specific cases.

* add the new parameters
* set new parameters to zero if not specified
* unit tests
@raffienficiaud
Copy link
Author

I'm generally against this change as I think it encourages us to continue kicking the can down the road on using the flexibility intended in gwsignal.

I am not sure to understand this statement @ColmTalbot : are you suggesting that this change is not required as gwsignal is supposed to handle it? There is a plugin infra coming into gwsignal but it will take some time to get it released.

@mj-will
Copy link
Collaborator

mj-will commented Dec 10, 2024

I'm generally against this change as I think it encourages us to continue kicking the can down the road on using the flexibility intended in gwsignal.

I am not sure to understand this statement @ColmTalbot : are you suggesting that this change is not required as gwsignal is supposed to handle it? There is a plugin infra coming into gwsignal but it will take some time to get it released.

There is some more context in this issue: #793.

FWIW, I agree with Colm. I really think we should avoid adding more waveforms via this approach if possible.

@raffienficiaud
Copy link
Author

@mj-will @ColmTalbot thank you for your comments. I know the work that has been done on gwsignal to make the waveform generator interface more flexible (and I extended it recently). However, this may take some amount of time to get into the main branch (there are discussions to get the review started in the coming weeks).

The same issue as the one raised here affects LALSuite BTW, and we have to make intermediate steps until gwsignal branch is properly merged, so that we are on tracks to get the waveform model on prod next year.

Until gwsignal changes are merged, what do we do?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants