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

Adds TimeDomainCBCWaveformGenerator #188

Merged
merged 23 commits into from
Feb 6, 2025
Merged

Adds TimeDomainCBCWaveformGenerator #188

merged 23 commits into from
Feb 6, 2025

Conversation

EthanMarx
Copy link
Collaborator

Moves the WaveformGenerator from amplfi, and adds conditioning of waveform before transforming into the time domain. The conditioning mimics that done in lalsimulation: https://git.ligo.org/lscsoft/lalsuite/-/blob/master/lalsimulation/python/lalsimulation/gwsignal/core/waveform_conditioning.py?ref_type=heads#L248

One thing we are still missing that lalsimulation does is a butterworth highpass. I haven't seen a straightforward torch api for this so we may have to implement it ourselves. I've compared our outputs using a scipy butterworth and they are very close to identical.

I will also test out how the highpass that occurs during our whitening step compares between the ml4gw waveforms and lalsimulation.

@EthanMarx
Copy link
Collaborator Author

@deepchatterjeeligo will write some tests where I compare against lalsimulation.SimInspiralTD. The only caveat is I'll have to use scipy.butterworth to filter our waveforms in the tests since we don't yet have a torch based highpass.

@EthanMarx EthanMarx force-pushed the waveform-conditioning branch from ff05830 to 9ff7480 Compare January 31, 2025 18:45
@EthanMarx
Copy link
Collaborator Author

@deepchatterjeeligo @wbenoit26 could you take a look at this?

I'll post some plots comparing conditioned vs unconditioned waveforms

@EthanMarx
Copy link
Collaborator Author

Also, tested out Ravis highpass filter and was able to match scipys. So, will directly incorporate that into the Generator once it gets merged in

@EthanMarx EthanMarx force-pushed the waveform-conditioning branch from c75cb7b to 991db23 Compare February 4, 2025 20:38
@EthanMarx
Copy link
Collaborator Author

@wbenoit26 @deepchatterjeeligo this should be ready to go.

I did some minor refactoring and added some documentation so might be worth looking over again.

One thing to note is that there is an off by one error when trying to align the ml4gw waveforms with the gwsignal waveforms that is parameter dependent. I have a quirky work around in the tests that compares the waveforms unshifted, and shifted by one, and asserts True if either is within tolerance.

This obviously should be ironed out down the line, but I don't think this is a huge problem.

Copy link
Contributor

@wbenoit26 wbenoit26 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 a couple minor nitpicks

Copy link

github-actions bot commented Feb 5, 2025

Coverage report

Click to see where and how coverage changed

FileStatementsMissingCoverageCoverage
(new stmts)
Lines missing
  ml4gw
  __init__.py
  distributions.py
  ml4gw/dataloading
  hdf5_dataset.py
  ml4gw/transforms
  __init__.py
  ml4gw/waveforms
  generator.py 77, 86, 90
  ml4gw/waveforms/cbc
  coefficients.py
  utils.py
Project Total  

This report was generated by python-coverage-comment-action

@EthanMarx EthanMarx merged commit 16b0248 into main Feb 6, 2025
5 of 6 checks passed
@EthanMarx EthanMarx deleted the waveform-conditioning branch February 6, 2025 15:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants