Skip to content

Add utility to redshift waveforms#5307

Merged
cdcapano merged 13 commits intogwastro:masterfrom
cdcapano:redshift_waveforms
Apr 2, 2026
Merged

Add utility to redshift waveforms#5307
cdcapano merged 13 commits intogwastro:masterfrom
cdcapano:redshift_waveforms

Conversation

@cdcapano
Copy link
Copy Markdown
Contributor

@cdcapano cdcapano commented Mar 21, 2026

Adds a function to waveform/utils.py that will redshift source-frame waveforms.

Standard information about the request

This adds a function to redshift waveforms to the detector frame. For BBH waveforms, the same thing can be (and is currently) accomplished by just generating the waveform with redshifted masses. However, it is sometimes necessary to generate signals involving a neutron star in the source-frame to ensure that matter affects are accounted for correctly. This function can then be used to redshift such signals into the detector frame.

The function ensures that the redshifted waveform is time-shifted so that the peak time in the waveform (t=0 for time-domain waveforms; the end of the segment for frequency domain) occurs at the same point as in the source frame waveform.

Here is the results of testing this on a source-frame m1=3.6, m2=1.4 solar mass binary using IMRPhenomTPHM:

td_comparison_test td_comparison_test-fd

Same thing for IMRPhenomXP:

fd_comparison_test-td fd_comparison_tst-fd

I have added a unit test that basically does the same thing as those plots: it generates a BBH in the source frame then redshifts it using the new function, and checks that you get the same result.

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

Copilot AI review requested due to automatic review settings March 21, 2026 04:33
@cdcapano cdcapano requested a review from ahnitz March 21, 2026 04:33
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a new waveform utility to redshift source-frame waveforms into the detector frame (supporting both time-domain and frequency-domain series), along with unit tests intended to validate equivalence against detector-frame generation using redshifted masses.

Changes:

  • Add redshift_waveform to pycbc/waveform/utils.py to apply redshift (time stretch + amplitude scaling) and preserve a reference time location.
  • Extend test/test_waveform_utils.py with TD/FD unit tests comparing redshifted source-frame waveforms to detector-frame waveforms generated with redshifted masses.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.

File Description
pycbc/waveform/utils.py Introduces redshift_waveform utility for TD/FD waveform redshifting and alignment.
test/test_waveform_utils.py Adds tests intended to validate redshift_waveform against direct detector-frame waveform generation.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread pycbc/waveform/utils.py Outdated
Comment thread test/test_waveform_utils.py Outdated
Comment thread pycbc/waveform/utils.py Outdated
Comment thread pycbc/waveform/utils.py Outdated
Comment thread test/test_waveform_utils.py Outdated
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@cdcapano cdcapano marked this pull request as draft March 21, 2026 15:16
@cdcapano
Copy link
Copy Markdown
Contributor Author

Based on the co-pilot suggestions I looked more carefully at the time shifting. Turns out I was over complicating things. All I had to do was just the epoch of the time series after applying the redshift. I get nearly the same results now; the comparison plots have been updated above to show that. I've also changed the unittest to compare the relative L2 error between the detector-frame reference BBH waveform and the redshifted source-frame waveform.

@cdcapano cdcapano marked this pull request as ready for review March 26, 2026 03:02
@cdcapano cdcapano requested a review from Copilot March 26, 2026 03:02
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread test/test_waveform_utils.py
Comment thread pycbc/waveform/utils.py
Comment thread pycbc/waveform/utils.py
@cdcapano
Copy link
Copy Markdown
Contributor Author

@ahnitz This is ready for review when you get a chance.

@cdcapano cdcapano enabled auto-merge (squash) April 2, 2026 03:20
@cdcapano cdcapano merged commit 05f9eca into gwastro:master Apr 2, 2026
25 of 39 checks passed
@cdcapano cdcapano deleted the redshift_waveforms branch April 2, 2026 13:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants