conflux.BetaEngine ================== .. py:module:: conflux.BetaEngine .. autoapi-nested-parse:: Public modules. Attributes ---------- .. autoapisummary:: conflux.BetaEngine.libBSG Classes ------- .. autoapisummary:: conflux.BetaEngine.BetaBranch conflux.BetaEngine.BetaIstp conflux.BetaEngine.BetaEngine Functions --------- .. autoapisummary:: conflux.BetaEngine.init_libBSG conflux.BetaEngine.decay_rhs conflux.BetaEngine._e_nu_spectrum conflux.BetaEngine.electron conflux.BetaEngine.neutrino Module Contents --------------- .. py:data:: libBSG :value: None .. py:function:: init_libBSG(libname='libBSG.so') .. py:function:: decay_rhs(t, N, lambdas) Bateman ODEs for a linear chain. .. py:function:: _e_nu_spectrum(p, isNu, numass=0) Calculate the electron or beta spectrum from theory as a function of energy. :param W: electron total energy in electron mass units, (m_e + KE)/m_e :type W: float :param p: A dictionary containing parameters to be used in the calculation of the beta spectrum from theory. Parameters: { 'We': electron total energy in electron mass units, (m_e + KE)/m_e 'Z': Z, 'A': A, 'W0': Spectrum endpoint W 'R': nuclear radius, 'L': forbiddenness transition, 'c': 1.0, 'b': bAc*A, 'd': 0.0, 'Lambda': 0.0, 'l': screening_potential(Z) } :type p: dictionary :param isNu: spectrum corrections for neutrino or electron? :type isNu: bool :param numass: Neutrino mass parameter, defaults to 0 :type numass: float, optional :return: beta spectrum amplitude at given beta energy :rtype: float .. py:function:: electron(ebeta, p, numass=0) Calculate the beta spectrum from theory as a function of energy. :param ebeta: The energy of the beta. Unit: MeV :type ebeta: float :param p: A dictionary containing parameters to be used in the calculation of the beta spectrum from theory. Parameters: { 'Z': Z, 'A': A, 'W0': Spectrum endpoint electron total energy (m_e + KE)/m_e 'R': nuclear radius, 'L': forbiddenness transition, 'c': 1.0, 'b': bAc*A, 'd': 0.0, 'Lambda': 0.0, 'l': screening_potential(Z) } :type p: dictionary :param numass: Neutrino mass parameter, defaults to 0 :type numass: float, optional :return: beta spectrum amplitude at given beta energy :rtype: float .. py:function:: neutrino(enu, p, numass=0) Calculate the neutrino spectrum from theory as a function of energy. :param enu: The energy of the electron antineutrino. Unit: MeV :type ebeta: float :param p: A dictionary containing parameters to be used in the calculation of the beta spectrum from theory. Parameters: { 'Z': Z, 'A': A, 'W0': Spectrum endpoint electron total energy (m_e + KE)/m_e 'R': nuclear radius, 'L': forbiddenness transition, 'c': 1.0, 'b': bAc*A, 'd': 0.0, 'Lambda': 0.0, 'l': screening_potential(Z) } :type p: dictionary :param numass: Neutrino mass parameter, defaults to 0 :type numass: float, optional :return: beta spectrum amplitude at given beta energy :rtype: float .. py:class:: BetaBranch(Z, A, I, Q, E0, sigma_E0, frac, sigma_frac, forbiddenness=0, bAc=4.7, xbins=np.arange(0, 20, 0.1), numass=0, mixing=0, custom_func=None) Bases: :py:obj:`conflux.Basic.Spectrum` Beta decay branch with spectrum .. py:attribute:: Z :type: int The Atomic number of the mother isotope .. py:attribute:: A :type: int The Atomic mass of the mother isotope .. py:attribute:: I :type: int The isomeric state this decay mode .. py:attribute:: Q :type: float Q value of the decay (MeV) .. py:attribute:: ZAI :type: int The unique identity of the isotope (ZAI = Z*1e4+A*10+I) .. py:attribute:: E0 :type: float End-point energy of this branch, unique for each individual beta-unstable isotope .. py:attribute:: sigma_E0 :type: float Uncertainty of the end-point energy .. py:attribute:: frac :type: float The fraction of this branch to the entire decay. .. py:attribute:: sigma_frac :type: float The uncertainty of the branching fraction. .. py:attribute:: forbiddenness :type: int Type of forbiddeness .. py:attribute:: numass :type: float neutrno mass (MeV), by default 0 .. py:attribute:: mixing :type: float mixing of nonzero neutrino mass, by default 0 .. py:attribute:: Parameters :type: dict Beta decay function parameters .. py:attribute:: corr :type: dict Correlation vector of this beta decay branch to other branches of the same isotope .. py:attribute:: cov :type: dict Covariance vector of this beta decay branch with other branches of the same isotope .. py:attribute:: bAc :value: 4.7 .. py:attribute:: custom_func :value: None .. py:method:: Display() Display vital branch info. .. py:method:: UpdateParams() .. py:method:: SetCovariance(otherBranch, correlation) Calculate the correlation and covariances between this branch and the other branch. :param otherBranch: The other beta branch whose correlation and covariance you want to calculate :type otherBranch: :class:`conflux.BetaEngine.BetaBranch` :param correlation: The correlation between the two branches :type correlation: float .. py:method:: BetaSpectrum(e, nu_spectrum=False) Calculate the unnormalized beta/neutrino spectral shape as a function of energy. :param e: the kinetic energy of beta/neutrino (MeV) :type e: float :param nu_spectrum: Determine whether to calculate neutrino spectrum, defaults to False :type nu_spectrum: bool, optional :param numass: neutrino mass, defaults to 0 :type numass: float, optional :return: the spectrum amplitude at specific energy :rtype: float .. py:method:: SpectEndpointUncertMC(e, nu_spectrum=False, samples=30) Calculate the beta/neutrino spectral shape uncertainty due to enpoint energy uncertainty sigma_E0 as a function of energy using Monte Carlo sampling. :param e: The energy of beta/neutrino (MeV). :type e: float :param nu_spectrum: Determine whether to calculate neutrino spectrum, defaults to False :type nu_spectrum: bool, optional :param samples: Set the size of MC samples, defaults to 30 :type samples: int, optional :return: The uncertainty of spectrum amplitude at the input energy :rtype: float .. py:method:: CalcNormalizedSpectrum(nu_spectrum=False) Calculated unit-normalized beta/neutrino spectrum shape (at `xbins` coordinates) :param nu_spectrum: Determine whether to calculate neutrino spectrum, defaults to False :type nu_spectrum: bool, optional .. py:class:: BetaIstp(Z, A, I, Q, HL, name, xbins=np.arange(0, 20, 0.1), numass=0, mixing=0) Bases: :py:obj:`conflux.Basic.Spectrum` Collection of all beta decay branches from one isotope .. py:attribute:: ZAI :type: int Top-of-chain isotope (ZAI = Z*1e4+A*10+I) .. py:attribute:: Z :type: int The Atomic number of the mother isotope .. py:attribute:: A :type: int The Atomic mass of the mother isotope .. py:attribute:: I :type: int The isomeric state this decay mode .. py:attribute:: HL :type: float Half life of this isotope (s) .. py:attribute:: Q :type: float Q value of the decay (MeV) .. py:attribute:: name :type: str Name of the isotope .. py:attribute:: missing :type: bool :value: False Uncertainty of the end-point energy .. py:attribute:: branches :type: dict Dictionary of decay brances, keys (float) are endpoint energies, values are :class:`conflux.BetaEngine.BetaBranch` .. py:attribute:: numass :type: float neutrno mass (MeV), by default 0 .. py:attribute:: mixing :type: float mixing of nonzero neutrino mass, by default 0 .. py:attribute:: MaxBranch :type: BetaEngine.BetaBranch The beta decay branch with the largest fraction .. py:method:: AddBranch(branch) Add beta branch with a new endpoint energy to this isotope. :param branch: the branch to be added :type branch: :class: `conflux.BetaEngine.BetaBranch` .. py:method:: EditBranch(defaultE0, **kwargs) Add or edit branches to the isotope with analyzer's assumptions. :param defaultE0: Existing end point energy of the missing branch :type defaultE0: float :param **kwargs: AAdditional keyword arguments. Keyword Args: sigma_E0 (float): The uncertainty of the end-point energy. fraction (float): The fraction that this branch contributes to the total isotopic spectrum. sigma_frac (float): The uncertainty of fraction. forbiddenness (int): The type of forbidden/allowed transition. bAc (float): weak magnetism correcion. custom_func (method): customized beta function, needs to be structued similarly as :meth:`neutrino` or :meth:`electron`, defaults to None. .. py:method:: CalcCovariance(GSF=True) Calculate the covaraince matrix for all the beta branches of this isotope. :param GSF: Determine whether to consider the anti-correlation between the Ground-State-decay branching Fraction (GSF) and other branches, defaults to True :type GSF: bool, optional .. py:method:: SumSpectra(nu_spectrum=True, branchErange=[0, 20.0]) Sum the beta/antineutrino spectra of all branches of this isotope. :param nu_spectrum: Determine whether to calculate neutrino spectrum, defaults to True :type nu_spectrum: bool, optional :param branchErange: set the lower and upper limit of the endpoint energy of branches to be summed, defaults to [0, 20.] :type branchErange: two-element list, optional .. py:method:: Display() Display vital isotope property and branch information. .. py:method:: decay_time_adjust(begin, end) Calculate the percentage of isotope decayed in the given time window. :param begin: the begining of the window (s) :type begin: float :param end: the end of the window (s) :type end: float :return: The fraction of isotope decayed (from 0 to 1) :rtype: float .. py:method:: daughterZAI(gen) ZAI identifier for decay daughter at generation `gen`. :param gen: daughter generation :type gen: int :return: The ZAI of the decay daughter :rtype: int .. py:method:: decay_fraction(t, HLs) Calculate the fraction of decays completed at a generation in a decay chain. The list HLs contains all half lives of the this isotope and all its antecedents. :param t: time for which to calculate decay fraction (in same units as HLs) :type t: float :param HLs: half-lives of all decays in chain (in same units as t) :type HLs: list(int) :return: fraction of decays completed at time t (0 for t=0; 1 as t -> infinity) :rtype: float .. py:method:: CalcDecayChain(betaSpectraDB, time) Calculate the total spectrum of a beta-decay chain in a selected window. Assumes beta decays are 100% of allowed decays in chain. :param betaSpectraDB: the spectrum database that saves all relavant spectra :type betaSpectraDB: :class:`conflux.BetaEngine.BetaEngine` :param time: the time stamp :type time: float :return: summed, decay rate adjusted spectrum and uncertainty in the calculated window :rtype: :class:`numpy.array` .. py:class:: BetaEngine(inputlist=None, targetDB=CONFLUX_DB + '/betaDB/ENSDFbetaDB_250804.xml', xbins=np.arange(0, 20, 0.1), custom_func=None, numass=0, mixing=0) BetaEngine tallys beta branches in the betaDB and calculate theoretical beta spectra of all tallied branches. .. py:attribute:: inputlist :type: list[int] :value: None A list of isotopes. If the inputlist is not given, load the entire betaDB from the default betaDB. .. py:attribute:: istplist :type: dict A dictionary of isotopes. istplist contain keys as the ZAI number of the isotope and values being :class:`conflux.BetaEngine.BetaIstp` .. py:attribute:: targetDB :type: str The file name of beta decay data base, defaults to CONFLUX_DB+`/betaDB/ENSDFbetaDB_250804.xml' .. py:attribute:: xbins :type: numpy.ndarray The spectrum range and binning, defaults to np.arange(0, 20, 0.1) (MeV) .. py:attribute:: custom_func :type: callable :value: None Customized beta function, needs to be structued similarly as :meth:`conflux.BetaEngine.neutrino` or :meth:`conflux.BetaEngine.electron`, defaults to None .. py:attribute:: numass :type: float :value: 0 To calculate the spectrum with non-zero neutrino mass, give the neutrino mass in the MeV unit. .. py:attribute:: mixing :type: float :value: 0 To calcualte spectrum with non-zero neutrino mass, provide the mixing (0-1) of the neutrino mass state. .. py:method:: LoadBetaDB(targetDB=CONFLUX_DB + '/betaDB/ENSDFbetaDB_250804.xml', missingBranch=3) Load default or input betaDB to obtain beta decay informtion. A customed DB must follow the same format as the default DB. :param targetDB: The file name of beta decay data base, defaults to CONFLUX_DB+"/betaDB/ENSDFbetaDB2.xml" :type targetDB: str, optional :param missingBranch: Determine how many branches there are in a missing isotope, defaults to 3 :type missingBranch: int, optional .. py:method:: GetBetaIstp(Z, A, I=0) Get the BetaIstp object by giving the ZAI number :param Z: Proton number of the isotope :type Z: int :param A: Atomic mass number of the isotope :type A: int :param I: the Ith isomeric state, defaults to 0 :type I: int, optional :return: the specified beta isotope object :rtype: :class:`conflux.BetaEngine.BetaIstp` .. py:method:: CalcBetaSpectra(nu_spectrum=True, branchErange=[0.0, 20.0], GSF=False, silent=False) Calculates beta or neutrino spectra of listed/default beta decaying isotopes. :param nu_spectrum: Determine whether to calculate neutrino spectrum, defaults to True :type nu_spectrum: bool, optional :param branchErange: set the lower and upper limit of the endpoint energy of branches to be summed, defaults to [0, 20.] :type branchErange: two-element list, optional :param GSF: Determine whether to consider the anti-correlation between the Ground-State-decay branching Fraction (GSF) and other branches, defaults to True :type GSF: bool, optional :param silent: whether to disable the tqdm output, defaults to False :type silent: bool, optional .. py:method:: SaveToFile(filename) .. py:method:: LoadFile(filename)