Add utility to redshift waveforms#5307
Conversation
There was a problem hiding this comment.
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_waveformtopycbc/waveform/utils.pyto apply redshift (time stretch + amplitude scaling) and preserve a reference time location. - Extend
test/test_waveform_utils.pywith 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.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
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. |
There was a problem hiding this comment.
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.
|
@ahnitz This is ready for review when you get a chance. |
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:
Same thing for IMRPhenomXP:
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.