My team and I (especially @Arqu1100) have been working on energy-dependent convolutions for a nuclear physics application: GitHub - det-lab/energyDependentColvolve: Code that allows users to convolve signals with kernels that change with energy.
We’re looking to release this code either as a standalone library or incorporate it into an existing library because we ran into quite a few issues when writing the code and would like to help out other groups who need to do this “simple” calculation. The original use case was beam physics but after some discussion over at AstroPy it turns out there is application for exactly this kind of convolution for matching spectra resolutions.
This code is definitely not ready for a pull request, but if there’s any interest in this feature we’re happy to create one. @Arqu1100 has worked particularly hard on creating test cases.
There are some existing libraries that do a “varying kernel convoluation.” One is varconvolve, which we haven’t been able to verify against our test cases (quite possibly our issue, not theirs!). Discussion at AstroPy turned up another implementation of the code in the ppfx library (ppxf · PyPI), in the varsmooth
function. Thanks to Kyle Westfall for this information. Other examples of code that does a similar job are referenced on Stack Overflow as being deeply embedded into ldscat (https://stackoverflow.com/questions/18624005/how-do-i-perform-a-convolution-in-python-with-a-variable-width-gaussian).
All of this is to say that there are multiple use cases for a varying-kernel convolution and while there is code out there that does this (ppfx primarily), I had a really hard time finding it as someone in the nuclear physics community. I would have loved to see this function in SciPy and I think I would have found it easily if it were there. Is this a feature that would potentially be of interest to the community if we were to create a pull request?
If there’s a better place to ask the question, please let me know. Thanks all!