-
Notifications
You must be signed in to change notification settings - Fork 144
FEAT: add precessing spin transformation #1104
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
Open
ColmTalbot
wants to merge
12
commits into
bilby-dev:main
Choose a base branch
from
ColmTalbot:precessing-spin-transform
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
3b514e0
FEAT: add precessing spin transformation
ColmTalbot 6cb6b8a
FMT: fix precommits
ColmTalbot a42957d
TYPO: fix relative import
ColmTalbot 224f281
TEST: Refactor transform_precessing_spins tests
ColmTalbot 13cd092
MAINT: add xp_wrap to transform_precessing_spins
ColmTalbot 8dac35c
TEST: fix precessing spin tests
ColmTalbot 0c10f26
TEST: unpack transformed values for backend test
ColmTalbot 37a14a7
TEST: Adjust tolerance in geometry tests
ColmTalbot d43f8c1
TEST: switch test to absolute tolerance
ColmTalbot f6f5d84
Fix mass units in conversion function
ColmTalbot e8dab28
Implement error handling for spin calculations
ColmTalbot 618281f
OPT: optimize transform precessing spins
ColmTalbot File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -143,10 +143,16 @@ def gwsignal_binary_black_hole(frequency_array, mass_1, mass_2, luminosity_dista | |
| frequency_bounds = ((frequency_array >= minimum_frequency) * | ||
| (frequency_array <= maximum_frequency)) | ||
|
|
||
| iota, spin_1x, spin_1y, spin_1z, spin_2x, spin_2y, spin_2z = bilby_to_lalsimulation_spins( | ||
| theta_jn=theta_jn, phi_jl=phi_jl, tilt_1=tilt_1, tilt_2=tilt_2, | ||
| phi_12=phi_12, a_1=a_1, a_2=a_2, mass_1=mass_1 * utils.solar_mass, mass_2=mass_2 * utils.solar_mass, | ||
| reference_frequency=reference_frequency, phase=phase) | ||
| try: | ||
| iota, spin_1x, spin_1y, spin_1z, spin_2x, spin_2y, spin_2z = bilby_to_lalsimulation_spins( | ||
| theta_jn=theta_jn, phi_jl=phi_jl, tilt_1=tilt_1, tilt_2=tilt_2, | ||
| phi_12=phi_12, a_1=a_1, a_2=a_2, mass_1=mass_1, mass_2=mass_2, | ||
| reference_frequency=reference_frequency, phase=phase) | ||
| except ZeroDivisionError: | ||
| if catch_waveform_errors: | ||
| return None | ||
| else: | ||
| raise | ||
|
Comment on lines
+146
to
+155
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would it be possible to abstract this out to a separate function? It is repeated three times in the same file. |
||
|
|
||
| eccentricity = 0.0 | ||
| longitude_ascending_nodes = 0.0 | ||
|
|
@@ -619,14 +625,21 @@ def _base_lal_cbc_fd_waveform( | |
| (frequency_array <= maximum_frequency)) | ||
|
|
||
| luminosity_distance = luminosity_distance * 1e6 * utils.parsec | ||
|
|
||
| try: | ||
| iota, spin_1x, spin_1y, spin_1z, spin_2x, spin_2y, spin_2z = bilby_to_lalsimulation_spins( | ||
| theta_jn=theta_jn, phi_jl=phi_jl, tilt_1=tilt_1, tilt_2=tilt_2, | ||
| phi_12=phi_12, a_1=a_1, a_2=a_2, mass_1=mass_1, mass_2=mass_2, | ||
| reference_frequency=reference_frequency, phase=phase) | ||
| except ZeroDivisionError: | ||
| if catch_waveform_errors: | ||
| return None | ||
| else: | ||
| raise | ||
|
|
||
| mass_1 = mass_1 * utils.solar_mass | ||
| mass_2 = mass_2 * utils.solar_mass | ||
|
|
||
| iota, spin_1x, spin_1y, spin_1z, spin_2x, spin_2y, spin_2z = bilby_to_lalsimulation_spins( | ||
| theta_jn=theta_jn, phi_jl=phi_jl, tilt_1=tilt_1, tilt_2=tilt_2, | ||
| phi_12=phi_12, a_1=a_1, a_2=a_2, mass_1=mass_1, mass_2=mass_2, | ||
| reference_frequency=reference_frequency, phase=phase) | ||
|
|
||
| longitude_ascending_nodes = 0.0 | ||
| mean_per_ano = 0.0 | ||
|
|
||
|
|
@@ -1113,14 +1126,21 @@ def _base_waveform_frequency_sequence( | |
| approximant = lalsim_GetApproximantFromString(approximant) | ||
|
|
||
| luminosity_distance = luminosity_distance * 1e6 * utils.parsec | ||
|
|
||
| try: | ||
| iota, spin_1x, spin_1y, spin_1z, spin_2x, spin_2y, spin_2z = bilby_to_lalsimulation_spins( | ||
| theta_jn=theta_jn, phi_jl=phi_jl, tilt_1=tilt_1, tilt_2=tilt_2, | ||
| phi_12=phi_12, a_1=a_1, a_2=a_2, mass_1=mass_1, mass_2=mass_2, | ||
| reference_frequency=reference_frequency, phase=phase) | ||
| except ZeroDivisionError: | ||
| if catch_waveform_errors: | ||
| return None | ||
| else: | ||
| raise | ||
|
|
||
| mass_1 = mass_1 * utils.solar_mass | ||
| mass_2 = mass_2 * utils.solar_mass | ||
|
|
||
| iota, spin_1x, spin_1y, spin_1z, spin_2x, spin_2y, spin_2z = bilby_to_lalsimulation_spins( | ||
| theta_jn=theta_jn, phi_jl=phi_jl, tilt_1=tilt_1, tilt_2=tilt_2, | ||
| phi_12=phi_12, a_1=a_1, a_2=a_2, mass_1=mass_1, mass_2=mass_2, | ||
| reference_frequency=reference_frequency, phase=phase) | ||
|
|
||
| try: | ||
| h_plus, h_cross = lalsim_SimInspiralChooseFDWaveformSequence( | ||
| phase, mass_1, mass_2, spin_1x, spin_1y, spin_1z, spin_2x, spin_2y, | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.