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

[BUG] Fix passing mode_array in injection-waveform-arguments #820

Merged
merged 9 commits into from
Jan 27, 2025

Conversation

lorenzopompili00
Copy link
Contributor

When doing injections with bilby_pipe, passing a mode_array for the injected waveform via injection-waveform-arguments does not currently work, because of a missing conversion from string to int. See issue for details. Doing this conversion in bilby_pipe breaks some unit tests (see MR), so I have implemented the conversion in bilby only when mode_array is called.

Note that pyseobnr currently wants mode_array to be a list of tuples, but I don't think a standard convention has been decided for future models in gwsignal.

I have tested this by adding

injection-waveform-arguments={'mode_array':[[2,2],[2,-2]]}

to the example bbh_injection.ini, as well as for

injection-waveform-arguments={'mode_array':[[2,2],[2,1]]}
injection-waveform-approximant="SEOBNRv5PHM"
injection-frequency-domain-source-model=gwsignal_binary_black_hole

(I also had to include the fix for #41).

@mj-will mj-will added the bug Something isn't working label Oct 7, 2024
@@ -174,6 +174,7 @@ def gwsignal_binary_black_hole(frequency_array, mass_1, mass_2, luminosity_dista
}

if mode_array is not None:
mode_array = [tuple(map(int, mode)) for mode in mode_array]
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think we should wrap these changes in a try/except like here so that we get an informative error if/when this fails for any reason. We can also have a more specific message here as it is a more specific case.

@mj-will mj-will added this to the 2.5.0 milestone Nov 14, 2024
Copy link
Collaborator

@mj-will mj-will left a comment

Choose a reason for hiding this comment

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

Looks good to me, just had one comment about making the error message more informative.

bilby/gw/source.py Outdated Show resolved Hide resolved
Copy link
Collaborator

@mj-will mj-will left a comment

Choose a reason for hiding this comment

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

LGTM, assuming the CI passes.

bilby/gw/source.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 happy with this as is.

bilby/gw/source.py Outdated Show resolved Hide resolved
@mj-will mj-will requested a review from ColmTalbot January 27, 2025 08:35
@mj-will
Copy link
Collaborator

mj-will commented Jan 27, 2025

@ColmTalbot I think it's worth having a second look at this following the change Lorenzo made based on the discussion above.

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.

This looks pretty slick now, thanks @lorenzopompili00!

@ColmTalbot
Copy link
Collaborator

It looks like there is a conflict that stops me from rebasing, can you update Lorenzo? and then we'll merge.

@lorenzopompili00
Copy link
Contributor Author

Just updated @ColmTalbot !

@mj-will mj-will merged commit 0ebf360 into bilby-dev:main Jan 27, 2025
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants