Stretched exponential - #245
henrikjacobsenfys wants to merge 4 commits into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #245 +/- ##
==========================================
+ Coverage 98.47% 98.52% +0.04%
==========================================
Files 57 58 +1
Lines 5512 5676 +164
Branches 952 963 +11
==========================================
+ Hits 5428 5592 +164
Misses 42 42
Partials 42 42
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
| r""" | ||
| The stretched exponential (Kohlrausch-Williams-Watts) relaxation, Fourier transformed to energy. | ||
|
|
||
| The model is defined in time, as $I(t) = A e^{-(|t| / \tau)^\beta}$. To evalaute the Fourier |
| ``scipy.stats.levy_stable`` is mathematically the same function, but it is 70-100x slower and not | ||
| accurate for $\alpha$ close to 1. | ||
|
|
||
| Instad, the integral is evaluated in the complex plane described in :func:`_kww_shape`. |
|
|
||
| @property | ||
| def width(self) -> DescriptorNumber: | ||
| r""" |
There was a problem hiding this comment.
width returns a DescriptorNumber, whereas every other component's width is a Parameter.
Anything that does comp.width.fixed, comp.width.make_dependent_on(...) or puts it in a FitBinding will fail.
There was a problem hiding this comment.
That was because width in this case is derived from beta and tau. I thought it was just hbar/tau, in which case width should be a Dependent Parameter. But that expression is only true for beta=1 as Fable pointed out. For other values of beta there is no closed expression and width has to be found numerically. Claude found a nice way to do it by interpolation, so width is now a Dependent Parameter (with a somewhat opaque dependency expression)
|
I ran Fable on this PR and it found an issue I can't comment on, since I don't know science well enough. =====================================================================
So a component with
At Note this is not a bug in Suggested fix (pick one):
Either way, add a test that a narrow small-$\beta$ component on a coarse |
Very good find, it led into a small rabbit hole. I've escaped it with the help of Opus |
Implementing the Fourier transform of a stretched exponential. It's not trivial to make it fast and correct at the same time. Claude did that for me. I have updated the text and read through the whole thing.