conflux.ConversionEngine

Classes

BetaData

A class to save the beta spectrum data to be converted in the computer memory.

VirtualBranch

A class that creates virtual branch with customized end-point energy and virtual nuclide summarized from nuclides with the similar end-point energy based on nuclear data, and fit the virtual branch against a reference beta spectrum.

ConversionEngine

Class that search for best fit vertual branch and sum the converted total neutrino flux.

Functions

HuberZavg(x, c0, c1, c2)

rebin(data, bins)

Module Contents

class conflux.ConversionEngine.BetaData(inputDB, rel_err=True)

Bases: conflux.Basic.Spectrum

A class to save the beta spectrum data to be converted in the computer memory.

Attributes

xlist

A list of the x-axis bins

ylist

A list of the y-axis values (bin content)

yerrlist

A list of the errors on the y-axis (bin error)

inputDBstr

The filename where the spectrum data is saved

spectrumnumpy.array

An array to store the full beta spectrum

uncertaintynumpy.array

An array to store the full beta spectrum uncertainty

Methods

LoadConversionDB(self, inputDB, rel_err=True):

Load the beta spectrum data

x = []
y = []
yerr = []
inputDB
LoadConversionDB(inputDB, rel_err=True)

Load the beta spectrum data.

Parameters:
  • inputDB (str) – The file name of the beta spectrum data to fit against.

  • rel_err (bool, optional) – Indicate whether the uncertainty of the data is relative (True) or absolute (False), defaults to True

class conflux.ConversionEngine.VirtualBranch(fisIstp, Zlist={}, Alist={}, fblist={}, wmlist={})

Bases: conflux.Basic.Spectrum

A class that creates virtual branch with customized end-point energy and virtual nuclide summarized from nuclides with the similar end-point energy based on nuclear data, and fit the virtual branch against a reference beta spectrum.

Attributes

fisIstpconflux.FPYEngine.FissionIstp

The corresponding fission isotope to fit against. This isotope provides nuclear data to generate a virtual nuclide for the virtual branch.

FPYlistdict

A dictionary of fission product yields of the input fission isotope

contributelist

Best fit contributions of vitual branches

E0list

Best fit end-point energies of virtual branches

slicesizefloat

The size the energy slices for virtual branch fitting

Zlistdict

A dictionary of Z numbers of the virtual nuclide calculated for each virtual branch of corresponding energy slice (end-point energy)

Alistdict

A dictionary of A numbers of the virtual nuclide calculated for each virtual branch of corresponding energy slice (end-point energy)

fblistdict

A dictionary of forbidden transition fractions of each virtual branch of corresponding energy slice (end-point energy)

wmlistdict

A dictionary of weak magnetism correction factor of each virtual branch of corresponding energy slice (end-point energy)

Methods

LoadFPYList(self):

Load the fission products of the input fission isotope

CalcZAavg(self, Elow, Ehigh, missing=False):

fisIstp
Zavg = 47
Aavg = 117
Zlist
Alist
fblist
wmlist
_Zlist_cp
_Alist_cp
_fblist_cp
_wmlist_cp
FPYlist
istplist
LoadFPYList()

Load the fission product yield of the fissile isotope. This is to calculate the average atom numbers of the energy slices.

CalcZAavg(Elow, Ehigh, missing=False)

Calculate the average Z and A number of the slice of the virtual beta spectrum.

Parameters:
  • Elow (float) – lower bondary of the spectrum energy slice

  • Ehigh (float) – igher bondary of the spectrum energy slice

  • missing (bool, optional) – whether to count missing contributions in the beta DB, defaults to False

BetaSpectrum(x, E0, contribute, Zavg=None, Aavg=None, nu_spectrum=False, forbiddenness=0, bAc=4.7, norm=True)

Calculate the theoretical beta/neutrino spectrum shape.

Parameters:
  • x (float) – Energy of the beta/neutrino (x values)

  • E0 (float) – End-point energy of the spectrum

  • contribute (float) – The normalization or contribution of this spectrum to the summed entire beta spectrum

  • Zavg (int, optional) – The Z number of the vitual nuclide for a virtual branch beta spectrum calculation, defaults to None

  • Aavg (int, optional) – The Z number of the vitual nuclide for a virtual branch beta spectrum calculation, defaults to None

  • nu_spectrum (bool, optional) – whether to calculate neutrino (True) or beta (False) spectrum, defaults to False

  • forbiddenness (int, optional) – type of forbidden/allowed transitions , defaults to 0

  • bAc (float, optional) – Weak magnetism correction factor, defaults to 4.7

  • norm (bool, optional) – Whether to normalize the beta spectrum integral to 1, defaults to True

FitData(betadata, slicesize=0.5)

Fits the reference beta spectrum with virtual brances data.

The virtual branches are defined as single beta decay spectra. The virtual branches are fitted to slices of the reference data spectra in a short range from the highest energy to the lowest, each bestfit virtual branch spectrum is subtracted from the reference data to let the next virtual branch to fit the updated spectrum in the consequential energy slice.

Parameters:
  • betadata (conflux.ConversionEngine.BetaData) – The input BetaData object that provides the reference beta spectrum to fit.

  • slicesize (float) – The size of the energy range, should be greater than 0.2 (MeV) and smaller than 2 (MeV), defaults to 0.5

FitDataNNLS(betadata, slicesize, seeds=2000)

Fit virtual beta branches to the input beta data using the scipy.optimize.nnls() method (maybe obsolete).

Parameters:
  • betadata (conflux.ConversionEngine.BetaData) – The input BetaData object that provides the reference beta spectrum to fit.

  • slicesize (float) – The size of the energy range, should be greater than 0.2 (MeV) and smaller than 2 (MeV), defaults to 0.5

  • seeds (int, optional) – number of MC samples for this calculation, defaults to 2000

SumBranches(x, thresh=0, nu_spectrum=False)

Sum the best fit vitual branch spectra to form the best fit beta/neutrino model spectrum.

Parameters:
  • x (ndarray) – energy of the particle (the x value of spectrum)

  • thresh (float, optional) – Overrides the threshold. If threhold > 0, only add branch whose energy range is above the threshold, defaults to 0

  • nu_spectrum (bool, optional) – whether to calculate neutrino (True) or beta (False) spectrum, defaults to False

Returns:

summed spectrum

Return type:

ndarray

Covariance(betadata, x, samples=50, thresh=0, nu_spectrum=True)

Calculate the covariance of the conversion/fitting result by creating MC samples of beta data with varied bin content from the original spectrum within its uncertainty.

Parameters:
  • betadata (conflux.ConversionEngine.BetaData) – The input BetaData object that provides the reference beta spectrum to fit.

  • x (ndarray) – energy of the particle (the x value of spectrum)

  • samples (int, optional) – the amount of MC samples, defaults to 50

  • thresh (float, optional) – Overrides the threshold. If threhold > 0, only add branch whose energy range is above the threshold, defaults to 0

  • nu_spectrum (bool, optional) – whether to calculate neutrino (True) or beta (False) spectrum, defaults to True

Returns:

the covariance matrix of the virtual branch fitting or conversion result

Return type:

ndarray

class conflux.ConversionEngine.ConversionEngine

Bases: conflux.Basic.Spectrum

Class that search for best fit vertual branch and sum the converted total neutrino flux.

Attributes

betadatadict

A dictionary of beta spectra of fission isotopes

fission_fracdict

A dictionary of the fission isotope fractions

fission_dfracdict

A dictionary of the fission isotope fraction uncertainties

fisIstpdict

A dictionary of the fission isotope in the conversion model

vblist: dict

A dictionary of the virtual branches

spectrumnumpy.array

An array to store the full beta spectrum

uncertaintynumpy.array

An array to store the full beta spectrum uncertainty

covariancenumpy.array

The covariance matrix of the best fit spectrum or converted spectrum

Methods

AddBetaData(self, betadata, fisIstp, name, frac, dfrac=0):

Add beta spectrum data as fitting reference into the dictionaries

VBfitbeta(self, istp, slicesize = 0.5, Ei = 0, Zlist={}, Alist={}):

Let vitual branches to fit against beta data with user chosen slice size.

SummedSpectrum(self, x, nu_spectrum=True, cov_samp=20):

Function to sum all best fit spectra calculated in the conversion engine.

betadata
fission_count
fission_dcount
fisIstp
vblist
AddBetaData(betadata, fisIstp, name, count, d_count=0)

Add beta spectrum data as fitting reference into the dictionaries.

Parameters:
  • betadata (conflux.ConversionEngine.BetaData) – The input BetaData object that provides the reference beta spectrum to fit.

  • istp (str) – The corresponding fission isotope to fit against. This isotope provides nuclear data to generate a virtual nuclide for the virtual branch.

  • istp – The unique name of the fission isotope and spectrum that will be fitted.

  • count (float) – The fraction of the fission isotope in the conversion model

  • d_count (float) – The fraction uncertainty of the fission isotope in the conversion model

VBfitbeta(istp, slicesize=0.5, Zlist={}, Alist={})

Let vitual branches to fit against beta data with user chosen slice size.

Parameters:
  • istp (conflux.FPYEngine.FissionIstp) – The corresponding fission isotope to fit against. This isotope provides nuclear data to generate a virtual nuclide for the virtual branch.

  • slicesize (float) – The size of the energy range, should be greater than 0.2 (MeV) and smaller than 2 (MeV), defaults to 0.5

  • Zlist (dict, optional) – The mapping between the beta energy and input average Z number, defaults to {}

  • Alist (dict, optional) – The mapping between the beta energy and input average A number, defaults to {}

SummedSpectrum(x, nu_spectrum=True, cov_samp=50)

Sum all best fit or converted spectra calculated in the conversion engine based on the fractions and uncertainties.

Parameters:
  • x (ndarray) – Particle energy (x values of the specrrum)

  • nu_spectrum (bool, optional) – whether to calculate beta (False) or netutrino (True) spectrum, defaults to True

  • cov_samp (int, optional) – the amount of MC samples for covariance matrix calculation, defaults to 50

Returns

spectrum: ndarray

The summed spectrum in the form of ndarray

uncertainty: ndarray

The uncertainty array of the summed spectrum

covariance: ndarray

The covariance matrix of the of the spectrum on given energy bin

conflux.ConversionEngine.HuberZavg(x, c0, c1, c2)
conflux.ConversionEngine.rebin(data, bins)