Skip to content

Adding scipy.signal.convolve and correlate functions - #3748

Merged
mergify[bot] merged 8 commits into
cupy:masterfrom
coderforlife:signaltools
Aug 20, 2020
Merged

mergify[bot] merged 8 commits into
cupy:masterfrom
coderforlife:signaltools

Conversation

@coderforlife

Copy link
Copy Markdown
Contributor

This adds multidimensional cupyx.scipy.signal.convolve() and correlate() functions. These simply map to the ndimage functions (which were recently prepared for this with added support for the full and valid modes natively without doing any extra padding).

For the moment these functions aren't very useful since by default method='auto' and choose_conv_method() always returns 'fft' which isn't in this PR. However, method='direct' is fully supported (including complex types even though #3705 isn't resolved since it doesn't use _run_1d_correlates()).

I also have the code ready to submit for fftconvolve() and choose_conv_method() which I will create a PR for after this one is accepted (they are a bit intertwined, easier to separate this one out than that one). After that, I have convolve2, correlate2, oaconvolve all ready to go as well.

This will need some minor rebasing after #3743 is merged. Additionally, I will update this PR in the next day or two with tests (have done informal tests and they all worked).

@coderforlife

Copy link
Copy Markdown
Contributor Author

I decided to add convolve2d and correlate2d as well since the add very little code above what convolve and correlate add.

@coderforlife

Copy link
Copy Markdown
Contributor Author

I have written most of the tests and in doing so found a bug in scipy: scipy/scipy#12686. I will avoid testing against that situation for now.

@coderforlife

coderforlife commented Aug 9, 2020 •

Copy link
Copy Markdown
Contributor Author

This PR would end up closing #1639 (which asks for the 4 functions this PR adds).

@coderforlife

Copy link
Copy Markdown
Contributor Author

Not that complex types apparently aren't working as well as I thought. Simple cases with complex do work, but any random matrix doesn't. Working on that issue now.

@takagi takagi added the cat:feature New features/APIs label Aug 11, 2020
This was referenced Aug 12, 2020
@takagi

takagi commented Aug 13, 2020

Copy link
Copy Markdown
Contributor

pfnCI, test this please.

@chainer-ci

Copy link
Copy Markdown
Member

Jenkins CI test (for commit ccc00ca, target branch master) succeeded!

@takagi

takagi commented Aug 17, 2020

Copy link
Copy Markdown
Contributor

Would you add the reference entries in cupy/docs/source/reference/signal.rst?

@takagi takagi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks! Would you check some comments?

Comment thread cupyx/scipy/signal/signaltools.py Resolved
}
boundary = _boundaries.get(boundary)
if boundary is None:
raise ValueError("Acceptable boundary flags are 'fill' (or 'pad'), "

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why not fill, wrap and symm only here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This mimics the scipy error message which includes the un-documented acceptable boundary flags.

Comment thread cupyx/scipy/signal/signaltools.py Resolved
Comment thread cupyx/scipy/signal/_signaltools_core.py Resolved
@takagi

takagi commented Aug 20, 2020

Copy link
Copy Markdown
Contributor

pfnCI, test this please.

@takagi takagi added the st:test-and-merge (deprecated) Ready to merge after test pass. label Aug 20, 2020
@takagi takagi added this to the v8.0.0rc1 milestone Aug 20, 2020
@chainer-ci

Copy link
Copy Markdown
Member

Jenkins CI test (for commit 0e12feb, target branch master) succeeded!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cat:feature New features/APIs st:test-and-merge (deprecated) Ready to merge after test pass.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants