Repository navigation
Conversation
PicoCentauri
left a comment
There was a problem hiding this comment.
This is an amazing and very good test! Thanks @hejamu and @Quewakira !
| The test suite checks the spectrum routes against a dipole whose susceptibility is known | ||
| exactly. This example walks through that test, ``TestDebyeRelaxation`` in |
There was a problem hiding this comment.
I wouldn't mention the testsuite. As a user I don't care what you do in the tests and I also don't look at them.
| # \qquad \langle \xi_\alpha(t) \xi_\beta(t') \rangle | ||
| # = \delta_{\alpha \beta} \, \delta(t - t'). | ||
| # | ||
| # The equation is linear and the noise is uncorrelated with the past, so multiplying by |
There was a problem hiding this comment.
| # The equation is linear and the noise is uncorrelated with the past, so multiplying by | |
| # The equation is linear and the noise is uncorrelated with the past (no memory), so multiplying by |
| # \chi''(\omega) = \chi_0 \, \frac{\omega \tau}{1 + \omega^2 \tau^2}, \qquad | ||
| # \chi_0 = \frac{\langle \boldsymbol{M}^2 \rangle}{3 V \varepsilon_0 k_B T}, | ||
| # | ||
| # with the loss peak at :math:`\omega \tau = 1`. |
There was a problem hiding this comment.
Maybe add a connecting sentence for the next paragraph. Something like we will use this simple system to validate.
| acf = np.array( | ||
| [np.mean(np.sum(dipole[: n_frames - k] * dipole[k:], axis=1)) for k in lags] | ||
| ) |
There was a problem hiding this comment.
I thought we want an acf function for this?
There was a problem hiding this comment.
Out of scope for this PR :)
There was a problem hiding this comment.
fine for me. Maybe branch the comment our in an issue.
| # :func:`~spectrumkit.dielectricspectrum.calculate_spectrum_from_dipole` works on the | ||
| # dipole, :func:`~spectrumkit.dielectricspectrum.calculate_spectrum_from_current` on the | ||
| # current :math:`\boldsymbol{J} = \dot{\boldsymbol{M}}`, here a finite difference. Both | ||
| # average the periodogram over 100 segments of 20 ps. |
There was a problem hiding this comment.
Basically what we do to get nicer spectra by averaging. The german Wikipedia article is quite nice https://de.wikipedia.org/wiki/Periodogramm.
We can change the wording. I think it is something only people in signal processing are familiar with.
There was a problem hiding this comment.
Oh, actually what we do would be called Bartletts method, "method of averaged periodograms" https://en.wikipedia.org/wiki/Bartlett%27s_method. Lets just call it averaged power spectrum.
There was a problem hiding this comment.
Yes I think for us stupid people averaged power spectrum is nice. we can link the exact method or name maybe both.
| # current :math:`\boldsymbol{J} = \dot{\boldsymbol{M}}`, here a finite difference. Both | ||
| # average the periodogram over 100 segments of 20 ps. | ||
|
|
||
| dipole_route = calculate_spectrum_from_dipole(dipole, dt, volume, temperature, segs=100) |
There was a problem hiding this comment.
Should we import the functions in the example not in the local namespace but keep them in the spectrumkit to be better visible that these are our functions?
| dipole_route = calculate_spectrum_from_dipole(dipole, dt, volume, temperature, segs=100) | |
| dipole_route = spectrumkit.calculate_spectrum_from_dipole(dipole, dt, volume, temperature, segs=100) |
|
|
||
|
|
||
| def debye(nu): | ||
| """Debye susceptibility at the frequency ``nu`` in THz.""" |
There was a problem hiding this comment.
Strictly speaking this function doesn't care about the units it is only Thz since our time units are ps
PicoCentauri
left a comment
There was a problem hiding this comment.
Nice. I have two minor things you might ignore. Again very cool eample.
|
|
||
| import spectrumkit | ||
|
|
||
| BLUE, ORANGE, INK, SHADE = "#2a78d6", "#eb6834", "#0b0b0b", "#e1e0d9" |
There was a problem hiding this comment.
I thought this is not aligned with pep8?
| BLUE, ORANGE, INK, SHADE = "#2a78d6", "#eb6834", "#0b0b0b", "#e1e0d9" | |
| BLUE = "#2a78d6" | |
| ORANGE = "#eb6834" | |
| INK = "#0b0b0b" | |
| SHADE = "#e1e0d9" |
also what is the reason against just using tab10 defaults?
| sigma: float = 1.0, | ||
| seed: int = 0, | ||
| ) -> np.ndarray: | ||
| r"""Ornstein-Uhlenbeck process, e.g. a dipole with Debye relaxation. |
There was a problem hiding this comment.
Not sure if we need such an extensive docstring in a test function. We might just refer to the example for the discussion of the motivation.
Fixes #11
Changes made in this Pull Request:
PR Checklist
📚 Documentation preview 📚: https://spectrumkit--24.org.readthedocs.build/en/24/