Skip to content

FEAT: add precessing spin transformation#1104

Open
ColmTalbot wants to merge 11 commits into
bilby-dev:mainfrom
ColmTalbot:precessing-spin-transform
Open

FEAT: add precessing spin transformation#1104
ColmTalbot wants to merge 11 commits into
bilby-dev:mainfrom
ColmTalbot:precessing-spin-transform

Conversation

@ColmTalbot

Copy link
Copy Markdown
Collaborator

This is a replacement for #1044 that includes the backend changes rather than attempting to rebase.

@ColmTalbot ColmTalbot requested a review from a team June 26, 2026 16:04
@ColmTalbot ColmTalbot added enhancement New feature or request >100 lines labels Jun 26, 2026

@GregoryAshton GregoryAshton left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Broadly looks good to me - albeit the checks are failing

Comment thread bilby/gw/geometry.py
return theta, phi


def transform_precessing_spins(

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This is overwriting an existing function with a properly vectorised version if I have understood correctly. Typically, I'd think it would be better to use a new name. However, I can see there are tests to ensure the two agree.. so I'm inclined to say this seems like a good idea.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

The previous version was wrapped with np.vectorize, so the signature hasn't changed. Both the old and new ones accept vector inputs, the only difference is that these will now be faster because it uses array broadcasting instead of numpy.vectorize, which is just a for loop.

Comment thread bilby/gw/geometry.py Outdated
- spin_2x, spin_2y, spin_2z: Components of spin 2
"""

xp = array_module(theta_jn)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Does array_module here just take theta_jn to figure out the array type?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

This was using an outdated version. I updated it to use the xp_wrap decorator, which will look at all of the input arguments.

@ColmTalbot ColmTalbot force-pushed the precessing-spin-transform branch from c7918c2 to da1d46f Compare July 1, 2026 14:03
@ColmTalbot ColmTalbot force-pushed the precessing-spin-transform branch from 7a82a82 to 6b7f838 Compare July 6, 2026 17:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request >100 lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants