forked from IPKM/nmreval
doc added; reading of isochronal bds
This commit is contained in:
6
doc/examples/distribution/README.rst
Normal file
6
doc/examples/distribution/README.rst
Normal file
@ -0,0 +1,6 @@
|
||||
.. _distribution_examples:
|
||||
|
||||
.. _distribution-examples-index:
|
||||
|
||||
Distribution of correlation times
|
||||
=================================
|
50
doc/examples/distribution/plot_ColeCole.py
Normal file
50
doc/examples/distribution/plot_ColeCole.py
Normal file
@ -0,0 +1,50 @@
|
||||
"""
|
||||
=========
|
||||
Cole-Cole
|
||||
=========
|
||||
|
||||
Example for Cole-Cole distributions
|
||||
"""
|
||||
import matplotlib.pyplot as plt
|
||||
import numpy as np
|
||||
|
||||
from nmreval.distributions import ColeCole
|
||||
|
||||
x = np.logspace(-5, 5, num=101)
|
||||
|
||||
cc = ColeCole
|
||||
|
||||
alpha_CC = [0.3, 0.5, 0.7]
|
||||
|
||||
fig, axes = plt.subplots(2, 3, constrained_layout=True)
|
||||
|
||||
lines = []
|
||||
for a in alpha_CC:
|
||||
axes[0, 0].plot(np.log10(x), cc.correlation(x, 1, a))
|
||||
axes[1, 0].plot(np.log10(x), np.log10(cc.specdens(x, 1, a)))
|
||||
axes[0, 1].plot(np.log10(x), np.log10(cc.susceptibility(x, 1, a).real))
|
||||
axes[1, 1].plot(np.log10(x), np.log10(cc.susceptibility(x, 1, a).imag))
|
||||
l, = axes[0, 2].plot(np.log10(x), cc.distribution(x, 1, a),
|
||||
label=rf'$\alpha={a}$')
|
||||
lines.append(l)
|
||||
|
||||
fig_titles = ('Correlation function', 'Susceptibility (real)', 'Distribution',
|
||||
'Spectral density', 'Susceptibility (imag)')
|
||||
fig_xlabel = (r'$\log(t/\tau_\mathrm{HN})$', r'$\log(\omega\tau_\mathrm{HN})$',
|
||||
r'$\log(\tau/\tau_\mathrm{HN})$', r'$\log(\omega\tau_\mathrm{HN})$',
|
||||
r'$\log(\omega\tau_\mathrm{HN})$')
|
||||
fig_ylabel = (r'$C(t)$', r"$\log(\chi'(\omega))$", r'$G(\ln\tau)$',
|
||||
r'$\log(J(\omega))$', r"$\log(\chi''(\omega))$")
|
||||
|
||||
for title, xlabel, ylabel, ax in zip(fig_titles, fig_xlabel, fig_ylabel, axes.ravel()):
|
||||
ax.set_title(title)
|
||||
ax.set_xlabel(xlabel)
|
||||
ax.set_ylabel(ylabel)
|
||||
|
||||
labels = [l.get_label() for l in lines]
|
||||
leg = fig.legend(lines, labels, loc='center left', bbox_to_anchor=(1.05, 0.50),
|
||||
bbox_transform=axes[1, 1].transAxes)
|
||||
|
||||
fig.delaxes(axes[1, 2])
|
||||
|
||||
plt.show()
|
50
doc/examples/distribution/plot_ColeDavidson.py
Normal file
50
doc/examples/distribution/plot_ColeDavidson.py
Normal file
@ -0,0 +1,50 @@
|
||||
"""
|
||||
=============
|
||||
Cole-Davidson
|
||||
=============
|
||||
|
||||
Example for Cole-Davidson distributions
|
||||
"""
|
||||
import matplotlib.pyplot as plt
|
||||
import numpy as np
|
||||
|
||||
from nmreval.distributions import ColeDavidson
|
||||
|
||||
x = np.logspace(-5, 5, num=101)
|
||||
|
||||
cd = ColeDavidson
|
||||
|
||||
gamma_CD = [0.3, 0.5, 0.7]
|
||||
|
||||
fig, axes = plt.subplots(2, 3, constrained_layout=True)
|
||||
|
||||
lines = []
|
||||
for g in gamma_CD:
|
||||
axes[0, 0].plot(np.log10(x), cd.correlation(x, 1, g))
|
||||
axes[1, 0].plot(np.log10(x), np.log10(cd.specdens(x, 1, g)))
|
||||
axes[0, 1].plot(np.log10(x), np.log10(cd.susceptibility(x, 1, g).real))
|
||||
axes[1, 1].plot(np.log10(x), np.log10(cd.susceptibility(x, 1, g).imag))
|
||||
l, = axes[0, 2].plot(np.log10(x), cd.distribution(x, 1, g),
|
||||
label=rf'$\gamma={g}$')
|
||||
lines.append(l)
|
||||
|
||||
fig_titles = ('Correlation function', 'Susceptibility (real)', 'Distribution',
|
||||
'Spectral density', 'Susceptibility (imag)')
|
||||
fig_xlabel = (r'$\log(t/\tau_\mathrm{CD})$', r'$\log(\omega\tau_\mathrm{CD})$',
|
||||
r'$\log(\tau/\tau_\mathrm{CD})$', r'$\log(\omega\tau_\mathrm{CD})$',
|
||||
r'$\log(\omega\tau_\mathrm{CD})$')
|
||||
fig_ylabel = (r'$C(t)$', r"$\log(\chi'(\omega))$", r'$G(\ln\tau)$',
|
||||
r'$\log(J(\omega))$', r"$\log(\chi''(\omega))$")
|
||||
|
||||
for title, xlabel, ylabel, ax in zip(fig_titles, fig_xlabel, fig_ylabel, axes.ravel()):
|
||||
ax.set_title(title)
|
||||
ax.set_xlabel(xlabel)
|
||||
ax.set_ylabel(ylabel)
|
||||
|
||||
labels = [l.get_label() for l in lines]
|
||||
leg = fig.legend(lines, labels, loc='center left', bbox_to_anchor=(1.05, 0.50),
|
||||
bbox_transform=axes[1, 1].transAxes)
|
||||
|
||||
fig.delaxes(axes[1, 2])
|
||||
|
||||
plt.show()
|
53
doc/examples/distribution/plot_HavriliakNegami.py
Normal file
53
doc/examples/distribution/plot_HavriliakNegami.py
Normal file
@ -0,0 +1,53 @@
|
||||
"""
|
||||
================
|
||||
Havriliak-Negami
|
||||
================
|
||||
|
||||
Example for Havriliak-Negami distributions
|
||||
"""
|
||||
from itertools import product
|
||||
|
||||
import matplotlib.pyplot as plt
|
||||
import numpy as np
|
||||
|
||||
from nmreval.distributions import HavriliakNegami
|
||||
|
||||
x = np.logspace(-5, 5, num=101)
|
||||
|
||||
hn = HavriliakNegami
|
||||
|
||||
alpha_CC = [0.4, 0.8]
|
||||
gamma_CD = [0.3, 0.7]
|
||||
|
||||
fig, axes = plt.subplots(2, 3, constrained_layout=True)
|
||||
|
||||
lines = []
|
||||
for a, g in product(alpha_CC, gamma_CD):
|
||||
axes[0, 0].plot(np.log10(x), hn.correlation(x, 1, a, g))
|
||||
axes[1, 0].plot(np.log10(x), np.log10(hn.specdens(x, 1, a, g)))
|
||||
axes[0, 1].plot(np.log10(x), np.log10(hn.susceptibility(x, 1, a, g).real))
|
||||
axes[1, 1].plot(np.log10(x), np.log10(hn.susceptibility(x, 1, a, g).imag))
|
||||
l, = axes[0, 2].plot(np.log10(x), hn.distribution(x, 1, a, g),
|
||||
label=rf'$\alpha={a}, \gamma={g}$')
|
||||
lines.append(l)
|
||||
|
||||
fig_titles = ('Correlation function', 'Susceptibility (real)', 'Distribution',
|
||||
'Spectral density', 'Susceptibility (imag)')
|
||||
fig_xlabel = (r'$\log(t/\tau_\mathrm{HN})$', r'$\log(\omega\tau_\mathrm{HN})$',
|
||||
r'$\log(\tau/\tau_\mathrm{HN})$', r'$\log(\omega\tau_\mathrm{HN})$',
|
||||
r'$\log(\omega\tau_\mathrm{HN})$')
|
||||
fig_ylabel = (r'$C(t)$', r"$\log(\chi'(\omega))$", r'$G(\ln\tau)$',
|
||||
r'$\log(J(\omega))$', r"$\log(\chi''(\omega))$")
|
||||
|
||||
for title, xlabel, ylabel, ax in zip(fig_titles, fig_xlabel, fig_ylabel, axes.ravel()):
|
||||
ax.set_title(title)
|
||||
ax.set_xlabel(xlabel)
|
||||
ax.set_ylabel(ylabel)
|
||||
|
||||
labels = [l.get_label() for l in lines]
|
||||
leg = fig.legend(lines, labels, loc='center left', bbox_to_anchor=(1.05, 0.50),
|
||||
bbox_transform=axes[1, 1].transAxes)
|
||||
|
||||
fig.delaxes(axes[1, 2])
|
||||
|
||||
plt.show()
|
50
doc/examples/distribution/plot_KWW.py
Normal file
50
doc/examples/distribution/plot_KWW.py
Normal file
@ -0,0 +1,50 @@
|
||||
"""
|
||||
=========================
|
||||
Kohlrausch-Williams-Watts
|
||||
=========================
|
||||
|
||||
Example for KWW distributions
|
||||
"""
|
||||
import matplotlib.pyplot as plt
|
||||
import numpy as np
|
||||
|
||||
from nmreval.distributions import KWW
|
||||
|
||||
x = np.logspace(-5, 5, num=101)
|
||||
|
||||
kww = KWW
|
||||
|
||||
beta_KWW = [0.3, 0.5, 0.7]
|
||||
|
||||
fig, axes = plt.subplots(2, 3, constrained_layout=True)
|
||||
|
||||
lines = []
|
||||
for b in beta_KWW:
|
||||
axes[0, 0].plot(np.log10(x), kww.correlation(x, 1, b))
|
||||
axes[1, 0].plot(np.log10(x), np.log10(kww.specdens(x, 1, b)))
|
||||
axes[0, 1].plot(np.log10(x), np.log10(kww.susceptibility(x, 1, b).real))
|
||||
axes[1, 1].plot(np.log10(x), np.log10(kww.susceptibility(x, 1, b).imag))
|
||||
l, = axes[0, 2].plot(np.log10(x), kww.distribution(x, 1, b),
|
||||
label=rf'$\beta={b}$')
|
||||
lines.append(l)
|
||||
|
||||
fig_titles = ('Correlation function', 'Susceptibility (real)', 'Distribution',
|
||||
'Spectral density', 'Susceptibility (imag)')
|
||||
fig_xlabel = (r'$\log(t/\tau_\mathrm{KWW})$', r'$\log(\omega\tau_\mathrm{KWW})$',
|
||||
r'$\log(\tau/\tau_\mathrm{KWW})$', r'$\log(\omega\tau_\mathrm{KWW})$',
|
||||
r'$\log(\omega\tau_\mathrm{KWW})$')
|
||||
fig_ylabel = (r'$C(t)$', r"$\log(\chi'(\omega))$", r'$G(\ln\tau)$',
|
||||
r'$\log(J(\omega))$', r"$\log(\chi''(\omega))$")
|
||||
|
||||
for title, xlabel, ylabel, ax in zip(fig_titles, fig_xlabel, fig_ylabel, axes.ravel()):
|
||||
ax.set_title(title)
|
||||
ax.set_xlabel(xlabel)
|
||||
ax.set_ylabel(ylabel)
|
||||
|
||||
labels = [l.get_label() for l in lines]
|
||||
leg = fig.legend(lines, labels, loc='center left', bbox_to_anchor=(1.05, 0.50),
|
||||
bbox_transform=axes[1, 1].transAxes)
|
||||
|
||||
fig.delaxes(axes[1, 2])
|
||||
|
||||
plt.show()
|
50
doc/examples/distribution/plot_LogGaussian.py
Normal file
50
doc/examples/distribution/plot_LogGaussian.py
Normal file
@ -0,0 +1,50 @@
|
||||
"""
|
||||
============
|
||||
Log-Gaussian
|
||||
============
|
||||
|
||||
Example for Log-Gaussian distributions
|
||||
"""
|
||||
import matplotlib.pyplot as plt
|
||||
import numpy as np
|
||||
|
||||
from nmreval.distributions import LogGaussian
|
||||
|
||||
x = np.logspace(-5, 5, num=101)
|
||||
|
||||
lg = LogGaussian
|
||||
|
||||
sigma_lg = [1, 3, 5]
|
||||
|
||||
fig, axes = plt.subplots(2, 3, constrained_layout=True)
|
||||
|
||||
lines = []
|
||||
for s in sigma_lg:
|
||||
axes[0, 0].plot(np.log10(x), lg.correlation(x, 1, s))
|
||||
axes[1, 0].plot(np.log10(x), np.log10(lg.specdens(x, 1, s)))
|
||||
axes[0, 1].plot(np.log10(x), np.log10(lg.susceptibility(x, 1, s).real))
|
||||
axes[1, 1].plot(np.log10(x), np.log10(lg.susceptibility(x, 1, s).imag))
|
||||
l, = axes[0, 2].plot(np.log10(x), lg.distribution(x, 1, s),
|
||||
label=rf'$\sigma={s}$')
|
||||
lines.append(l)
|
||||
|
||||
fig_titles = ('Correlation function', 'Susceptibility (real)', 'Distribution',
|
||||
'Spectral density', 'Susceptibility (imag)')
|
||||
fig_xlabel = (r'$\log(t/\tau_\mathrm{LG})$', r'$\log(\omega\tau_\mathrm{LG})$',
|
||||
r'$\log(\tau/\tau_\mathrm{LG})$', r'$\log(\omega\tau_\mathrm{LG})$',
|
||||
r'$\log(\omega\tau_\mathrm{LG})$')
|
||||
fig_ylabel = (r'$C(t)$', r"$\log(\chi'(\omega))$", r'$G(\ln\tau)$',
|
||||
r'$\log(J(\omega))$', r"$\log(\chi''(\omega))$")
|
||||
|
||||
for title, xlabel, ylabel, ax in zip(fig_titles, fig_xlabel, fig_ylabel, axes.ravel()):
|
||||
ax.set_title(title)
|
||||
ax.set_xlabel(xlabel)
|
||||
ax.set_ylabel(ylabel)
|
||||
|
||||
labels = [l.get_label() for l in lines]
|
||||
leg = fig.legend(lines, labels, loc='center left', bbox_to_anchor=(1.05, 0.50),
|
||||
bbox_transform=axes[1, 1].transAxes)
|
||||
|
||||
fig.delaxes(axes[1, 2])
|
||||
|
||||
plt.show()
|
Reference in New Issue
Block a user