Add convoluted Gaussian and Exponential Component#228
Add convoluted Gaussian and Exponential Component#228jlaehne wants to merge 5 commits intoLumiSpy:mainfrom
Conversation
|
@aidanc151 example of adding a component to lumispy :-) |
c1675b7 to
3237cfb
Compare
ericpre
left a comment
There was a problem hiding this comment.
It should be good to add this component to the document - I was looking for it to check for the rendering of the analytical expression!
| np.testing.assert_allclose(g.function(35), 1.3874364) | ||
|
|
||
|
|
||
| class TestConvGaussExp: |
There was a problem hiding this comment.
Add a test that check that there is no normalisation issue: for example by making a dataset where the Gaussian convolution is negligible and checking that the fitting parameter are very close for the ConvGaussExp and Exponential components.
| ): | ||
| super().__init__( | ||
| expression="1/2*height*exp(-((x-t0) - sigma**2/(2*tau))/tau)*\ | ||
| (1 + erf(((x-t0) - sigma**2/tau)/(sqrt(2)*sigma)))", |
There was a problem hiding this comment.
I didn't check the math but from a quick look (based on https://math.stackexchange.com/questions/685041/convolute-exponential-with-a-gaussian/872561#872561), it seems that it should be a "-"?
| (1 + erf(((x-t0) - sigma**2/tau)/(sqrt(2)*sigma)))", | |
| (1 - erf(((x-t0) - sigma**2/tau)/(sqrt(2)*sigma)))", |
Could it be replaced by the erfc function?
|
|
||
| .. math:: | ||
|
|
||
| f(x) = \frac{h}{2} \cdot \exp\left[(x - t_0 - \frac{\sigma^2}{2\tau})\tau^{-1}\right] |
There was a problem hiding this comment.
Add a reference where the math comes from?
For example, https://math.stackexchange.com/questions/685041/convolute-exponential-with-a-gaussian/872561#872561 has good pointers?
There was a problem hiding this comment.
So far, it is based on https://zenodo.org/records/6384277 - but we are checking the math again with mathematica. As perspective we will at least add a component with double exponential as well.
There was a problem hiding this comment.
Out of curiosity, are you using mathematica because sympy can't do it or just haven't tried with sympy?
There was a problem hiding this comment.
A student already did the calculations in mathematica and I did not have the time yet to copy that in sympy :-)
Description of the change
Add a component that contains the convolution of an exponential decay with a Gaussian instrument response function.
Progress of the PR
upcoming_changesfolder (seeupcoming_changes/README.rst),docs/readthedocs.org:lumispybuild of this PR (link in github checks),Minimal example of the bug fix or the new feature