-
Notifications
You must be signed in to change notification settings - Fork 16
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
SciPy filters #189
SciPy filters #189
Conversation
This is great, thanks Ravi. Could you add a few tests agains the scipy implementation? I know you said edges are slightly off, but we can just test the middle of the waveform. |
Maybe we start a |
Coverage reportClick to see where and how coverage changed
This report was generated by python-coverage-comment-action |
Yeah Ravi and I were also not exactly sure what to do about this. I do like the idea of a @ravioli1369 one addition that would be great is to add a |
I'll agree with holding off. I think "rule of three" - if there's a third function similar to these, we can group them all together. It wouldn't surprise me to end up with a |
ml4gw/butterworth.py
Outdated
z = torch.tensor([]) | ||
m = torch.arange(-N + 1, N, 2) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will default to the CPU. We may have to take the approach of using nn.Module
instances like we do for the waveforms.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah thats right. I think we can keep the functions (any created tensors should by default be made on data.device
) and then also have a torch.nn.Module
wrapper like we do for the other transforms that builds the necessary coefficients and saves them as buffers
so they get sent to device
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@deepchatterjeeligo @EthanMarx could you guys take a look at the current implementation to see if it solves this?
@ravioli1369 I would keep a Then, also add a |
Thanks for this Ravi looks good. I think this will work fine. In most cases users will be building filter coefficients on CPU to later be used on GPU which is exactly what the Also thanks for fixing those relative imports. Won't make you do this here but down the line I think we as a group should be a bit better about splitting out PRs into individual tasks for better repo management. |
81ce394
to
e73565a
Compare
@EthanMarx yea I realized there were too many changes with the current PR and was working on putting the relative imports in another PR anyways. |
0862ec7
to
86235b0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great, Ravi, I'm just requesting two minor changes
a244853
to
f8e0770
Compare
@wbenoit26 @EthanMarx looks like the |
@ravioli1369 Would rather wait on this PR til I test it out with my PR comparing against lalsimulation waveform conditioning. |
After this and the |
The forward call of this module accepts a batch tensor of shape | ||
(n_waveforms, n_samples) and returns the filtered waveforms. | ||
|
||
Args: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ravioli1369 no point in repeating verbatim the scipy documentation.
I would just point users to their documentation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would be still good to add the documentation so that it at least appears on hover? Anyways it's mentioned that it's a wrapper for scipy
@ravioli1369 Was able to test this out and get good agreement with the filtering done by lalsimulation. So, if you can rebase onto main and address the comments I left we can get this in |
cb14798
to
80c19ff
Compare
@ravioli1369 any idea why these tests are failing? |
One of the failures is from |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm happy with how all of this looks now. @EthanMarx, are you good as well?
Yes looks good. Thanks a ton Ravi |
Adds scipy filters