Files
beta_shape_pnpi/notebooks/testing.ipynb
T

162 KiB

In [1]:
import numpy as np
import matplotlib.pyplot as plt

from beta_spectrum.components.fermi import FermiFunction
from beta_spectrum.components.phase_space import PhaseSpace
from beta_spectrum.components.finite_size import FiniteSizeL0
from beta_spectrum.components.finite_size import ChargeDistributionU
from beta_spectrum.components.screening import ScreeningCorrection
from beta_spectrum.components.exchange import ExchangeCorrection
from beta_spectrum.components.radiative import RadiativeCorrection

from beta_spectrum.constants import ME_MEV, ALPHA, HBAR_C_MEV_FM

from beta_spectrum.utils import W_to_T, T_to_W
In [2]:
endpoint_MeV = 0.2953
e_step_MeV = 0.001
Z_d = 44
Z_p = 43
A = 99

W0 = T_to_W(endpoint_MeV)
E = np.arange(e_step_MeV, endpoint_MeV, e_step_MeV)
W = T_to_W(E)
tr_type = "F2"

F = FermiFunction(Z_d, A)
Ph = PhaseSpace(W0=W0, transition_type=tr_type, m_e=1, m_nu=0)

L0 = FiniteSizeL0(Z_d, A)
U = ChargeDistributionU(Z_d, A)

S = ScreeningCorrection(FermiFunction(Z_p, A))
X = ExchangeCorrection(Z_p)

R_resum = RadiativeCorrection(W0, use_endpoint_resummation=True)
R_no_resum = RadiativeCorrection(W0, use_endpoint_resummation=False)
In [3]:
plt.plot(W, F(W))
plt.plot(W, Ph(W))
plt.yscale("log")
plt.show()
In [4]:
plt.plot(W, L0(W))
Out [4]:
[<matplotlib.lines.Line2D at 0x7f9dcddc5940>]
In [5]:
plt.plot(W, U(W) - 1)
Out [5]:
[<matplotlib.lines.Line2D at 0x7f9dcde3eba0>]
In [6]:
plt.plot(W, S(W))
plt.plot(W, X(W))
Out [6]:
[<matplotlib.lines.Line2D at 0x7f9dcdcdbe00>]
In [7]:
plt.plot(W, R_resum(W))
plt.plot(W, R_no_resum(W)- 0.001)
Out [7]:
[<matplotlib.lines.Line2D at 0x7f9dcdb95940>]
In [9]:
plt.plot(W, Ph(W)*F(W)*L0(W)*U(W)*S(W)*X(W)*R_resum(W))
# plt.plot(W, Ph(W)*F(W)*L0(W)*U(W)*S(W)*X(W)*R_no_resum(W))
# plt.plot(W, Ph(W)*F(W))

YSCALE = "lin"
plt.yscale(YSCALE)
if YSCALE == "linear":
    plt.ylim(0,)

plt.xlim(1.0005, W0)
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
Cell In[9], line 6
      2 # plt.plot(W, Ph(W)*F(W)*L0(W)*U(W)*S(W)*X(W)*R_no_resum(W))
      3 # plt.plot(W, Ph(W)*F(W))
      4 
      5 YSCALE = "lin"
----> 6 plt.yscale(YSCALE)
      7 if YSCALE == "linear":
      8     plt.ylim(0,)
      9 

File ~/.pyenv/sci/lib/python3.14/site-packages/matplotlib/pyplot.py:4435, in yscale(value, **kwargs)
   4433 @_copy_docstring_and_deprecators(Axes.set_yscale)
   4434 def yscale(value: str | ScaleBase, **kwargs) -> None:
-> 4435     gca().set_yscale(value, **kwargs)

File ~/.pyenv/sci/lib/python3.14/site-packages/matplotlib/axes/_base.py:74, in _axis_method_wrapper.__set_name__.<locals>.wrapper(self, *args, **kwargs)
     73 def wrapper(self, *args, **kwargs):
---> 74     return get_method(self)(*args, **kwargs)

File ~/.pyenv/sci/lib/python3.14/site-packages/matplotlib/axis.py:794, in Axis._set_axes_scale(self, value, **kwargs)
    791 old_default_lims = (self.get_major_locator()
    792                     .nonsingular(-np.inf, np.inf))
    793 for ax in self._get_shared_axes():
--> 794     ax._axis_map[name]._set_scale(value, **kwargs)
    795     ax._update_transScale()
    796     ax.stale = True

File ~/.pyenv/sci/lib/python3.14/site-packages/matplotlib/axis.py:763, in Axis._set_scale(self, value, **kwargs)
    761 def _set_scale(self, value, **kwargs):
    762     if not isinstance(value, mscale.ScaleBase):
--> 763         self._scale = mscale.scale_factory(value, self, **kwargs)
    764     else:
    765         self._scale = value

File ~/.pyenv/sci/lib/python3.14/site-packages/matplotlib/scale.py:727, in scale_factory(scale, axis, **kwargs)
    718 def scale_factory(scale, axis, **kwargs):
    719     """
    720     Return a scale class by name.
    721 
   (...)    725     axis : `~matplotlib.axis.Axis`
    726     """
--> 727     scale_cls = _api.check_getitem(_scale_mapping, scale=scale)
    728     return scale_cls(axis, **kwargs)

File ~/.pyenv/sci/lib/python3.14/site-packages/matplotlib/_api/__init__.py:198, in check_getitem(mapping, **kwargs)
    196     return mapping[v]
    197 except KeyError:
--> 198     raise ValueError(
    199         f"{v!r} is not a valid value for {k}; supported values are "
    200         f"{', '.join(map(repr, mapping))}") from None

ValueError: 'lin' is not a valid value for scale; supported values are 'linear', 'log', 'symlog', 'asinh', 'logit', 'function', 'functionlog'
In [ ]: