<jupyter_start><jupyter_text>Parameter Distributions Gamma Distribution: DD1Histology studies show that axons do not have only one fixed diameter throughout the brain, but follow an axon diameter distribution *(Aboitiz et al. 1992)*.In Microstructure Imaging, the true axon diameter distribution is usually modeled as a Gamma distribution $\Gamma(R;\alpha,\beta)$ with $R$ the axon radius as half its diameter and $\alpha$ and $\beta$ its scale and rate parameters *(Assaf et al. 2008)*.The probability density of a Gamma distribution is given as\begin{equation} \Gamma(R;\alpha,\beta)=\frac{\beta^\alpha R^{\alpha-1}e^{-R\beta}}{\Gamma(\alpha)}\end{equation}with $\Gamma(\alpha)$ a Gamma function.However, we must take the cross-sectional area of these cylinders into account to relate this Gamma distribution of cylinder radii to the signal attenuation of this distribution of cylinders.The reason for this is that it is not the cylinders themselves, but the (simulated) particles diffusing inside these cylinders that are contributing to the signal attenuation.The final perpendicular, intra-cylindrical signal attenuation for a Gamma-distributed cylinder ensemble, using any of the previously describe cylinder representations, is then given as\begin{equation}E^{\Gamma}_\perp(q,\Delta,\delta;\alpha,\beta)=\frac{\int_{\mathbb{R}^+}\overbrace{\Gamma(R;\alpha,\beta)}^{\textrm{Gamma Distribution}}\times\overbrace{E_\perp(q,\Delta,\delta,R)}^{\textrm{Cylinder Signal Attenuation}}\times \overbrace{\pi R^2}^{\textrm{Surface Correction}} dR}{\underbrace{\int_{\mathbb{R}^+}\Gamma(R;\alpha,\beta)\times \textrm{N}(R) dR}_{\textrm{Normalization}}}.\end{equation}When modeling cylinders, $\textrm{N}(R)$ is the surface function $\textrm{N}(R)=\pi R^2$. But, if we were to model a Gamma distribution of spheres, then it is the volume function $\textrm{N}(R)=(4/3)\pi R^3$. In fact, Dmipy internally checks what model parameter it is distributing, and normalizes the Gamma distribution accordingly.<jupyter_code>from dmipy.distributions import distributions
gamma_standard = distributions.DD1Gamma(normalization='standard')
gamma_plane = distributions.DD1Gamma(normalization='plane')
gamma_cylinder = distributions.DD1Gamma(normalization='cylinder')
gamma_sphere = distributions.DD1Gamma(normalization='sphere')

radii_std, Pstd = gamma_standard(alpha=2., beta=1e-6)
radii_pln, Pstd = gamma_plane(alpha=2., beta=1e-6)
radii_cyl, Pcyl = gamma_cylinder(alpha=2., beta=1e-6)
radii_sph, Psph = gamma_sphere(alpha=2., beta=1e-6)

import matplotlib.pyplot as plt
%matplotlib inline
plt.plot(radii_std, Pstd, label='Gamma Standard')
plt.plot(radii_pln, Pstd, label='Gamma Plane')
plt.plot(radii_cyl, Pcyl, label='Gamma Cylinder')
plt.plot(radii_sph, Psph, label='Gamma Sphere')
plt.legend()
plt.xlabel('Radius [m]')
plt.ylabel('Probability Density [-]');<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1266527487821851, 'fraction_numerical': 0.010786360473208072, 'mean_word_length': 6.68716577540107, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '203655', 'license': 'MIT', 'n_tokens_mistral': 894, 'n_tokens_neox': 812, 'n_words': 266, 'path': 'examples/example_diameter_distributions.ipynb', 'repo_name': 'tomdelahaije/dmipy', 'size': '2874'}