forked from IPKM/nmreval
51 lines
1.6 KiB
Python
51 lines
1.6 KiB
Python
|
"""
|
||
|
=============
|
||
|
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()
|