sandy.decay module
This module contains all classes and functions dedicated to the processing and analysis of a decay data.
- class sandy.decay.BranchingRatio(df)
Bases:
_DecayBase
Extension of sandy._DecayBase. Container of best estimates and uncertainties of branching ratios.
Methods
Normalize branching ratios.
to_decaydata
(rdd)Update branching ratios in DecayData instance with those available in a BranchingRatio instance.
- normalize()
Normalize branching ratios.
- Returns:
- sandy.BranchingRatio
BranchingRatio object with normalized branching ratio values, thus respecting the constraint of their sum equal to one.
Examples
>>> endf6 = sandy.get_endf6_file("jeff_33", "decay", [942410, 922350]) >>> rdd = sandy.DecayData.from_endf6(endf6) >>> br = rdd.get_branching_ratio() >>> br_norm = br.normalize() >>> assert br_norm.data.query("ZAM == 922350").BR.sum() == 1
>>> br = rdd.get_branching_ratio(with_uncertainty=False) >>> br_norm = br.normalize() >>> assert br_norm.data.query("ZAM == 922350").sum().values == 1
>>> endf6 = sandy.get_endf6_file("jeff_33", "decay", 942390) >>> rdd = sandy.DecayData.from_endf6(endf6) >>> br = rdd.get_branching_ratio() >>> br_norm = br.normalize() >>> assert br_norm.data.query("ZAM == 942390").BR.sum() == 1
Stable nuclide: >>> endf6 = sandy.get_endf6_file(“jeff_33”, “decay”, 260560) >>> rdd = sandy.DecayData.from_endf6(endf6) >>> br = rdd.get_branching_ratio() >>> br.normalize() Empty DataFrame Columns: [BR, DBR] Index: []
- to_decaydata(rdd)
Update branching ratios in DecayData instance with those available in a BranchingRatio instance.
- Parameters:
- `rdd`sandy.DecayData
DecayData instance
- Returns:
- sandy.DecayData
DecayData instance with updated branching ratios.
Examples
>>> endf6 = sandy.get_endf6_file("jeff_33", "decay", 922350) >>> rdd = sandy.DecayData.from_endf6(endf6) >>> br = rdd.get_branching_ratio(with_uncertainty=False) >>> pert = pd.DataFrame([{"ZAM": 922350, "RTYP": 4, "RFS": 0, "PERT": 1.05}]).set_index(["ZAM", "RTYP", "RFS"]) >>> br_new = br.custom_perturbation(pert) >>> rdd_updated = br_new.to_decaydata(rdd) >>> assert rdd_updated.data[922350]['decay_modes'][(4, 0)]['branching_ratio'] == br_new.data.query("ZAM==922350 & RTYP==4 & RFS==0").BR.values
>>> br = rdd.get_branching_ratio() >>> br_new = br.custom_perturbation(pert) >>> rdd_updated = br_new.to_decaydata(rdd) >>> assert rdd_updated.data[922350]['decay_modes'][(4, 0)]['branching_ratio'] == br_new.data.query("ZAM==922350 & RTYP==4 & RFS==0").BR.values
Perturbing only one branching ratio of one nuclide in DecayData instance: >>> endf6 = sandy.get_endf6_file(“jeff_33”, “decay”, [922350, 942410]) >>> rdd = sandy.DecayData.from_endf6(endf6) >>> br = rdd.get_branching_ratio(with_uncertainty=False) >>> br_new = br.custom_perturbation(pert) >>> rdd_updated = br_new.to_decaydata(rdd) >>> assert rdd_updated.data[922350][‘decay_modes’][(4, 0)][‘branching_ratio’] == br_new.data.query(“ZAM==922350 & RTYP==4 & RFS==0”).BR.values >>> assert rdd_updated.data[942410][‘decay_modes’][(4, 0)][‘branching_ratio’] == br_new.data.query(“ZAM==942410 & RTYP==4 & RFS==0”).BR.values
Perturbing only one branching ratio of each nuclide in DecayData instance: >>> endf6 = sandy.get_endf6_file(“jeff_33”, “decay”, [922350, 942410]) >>> rdd = sandy.DecayData.from_endf6(endf6) >>> br = rdd.get_branching_ratio(with_uncertainty=False) >>> pert = pd.DataFrame([{“ZAM”: 922350, “RTYP”: 4, “RFS”: 0, “PERT”: 1.05}, {“ZAM”: 942410, “RTYP”: 4, “RFS”: 0, “PERT”: 1.02}]).set_index([“ZAM”,”RTYP”, “RFS”]) >>> br_new = br.custom_perturbation(pert) >>> rdd_updated =br_new.to_decaydata(rdd) >>> assert rdd_updated.data[922350][‘decay_modes’][(4, 0)][‘branching_ratio’] == br_new.data.query(“ZAM==922350 & RTYP==4 & RFS==0”).BR.values >>> assert rdd_updated.data[942410][‘decay_modes’][(4, 0)][‘branching_ratio’] == br_new.data.query(“ZAM==942410 & RTYP==4 & RFS==0”).BR.values
Perturbing all branching ratios of each nuclide in DecayData instance: >>> endf6 = sandy.get_endf6_file(“jeff_33”, “decay”, [922350, 942410]) >>> rdd = sandy.DecayData.from_endf6(endf6) >>> br = rdd.get_branching_ratio(with_uncertainty=False) >>> pert = pd.DataFrame([{“ZAM”: 922350, “RTYP”: 4, “RFS”: 0, “PERT”: 1.05}, {“ZAM”: 922350, “RTYP”: 6, “RFS”: 0, “PERT”: 0.95}, {“ZAM”: 942410, “RTYP”: 4, “RFS”: 0, “PERT”: 1.02}, {“ZAM”: 942410, “RTYP”: 1, “RFS”: 0, “PERT”: 0.99}]).set_index([“ZAM”, “RTYP”, “RFS”]) >>> br_new = br.custom_perturbation(pert) >>> rdd_updated = br_new.to_decaydata(rdd) >>> assert rdd_updated.data[922350][‘decay_modes’][(4, 0)][‘branching_ratio’] == br_new.data.query(“ZAM==922350 & RTYP==4 & RFS==0”).BR.values >>> assert rdd_updated.data[922350][‘decay_modes’][(6, 0)][‘branching_ratio’] == br_new.data.query(“ZAM==922350 & RTYP==6 & RFS==0”).BR.values >>> assert rdd_updated.data[942410][‘decay_modes’][(4, 0)][‘branching_ratio’] == br_new.data.query(“ZAM==942410 & RTYP==4 & RFS==0”).BR.values >>> assert rdd_updated.data[942410][‘decay_modes’][(1, 0)][‘branching_ratio’] == br_new.data.query(“ZAM==942410 & RTYP==1 & RFS==0”).BR.values
- class sandy.decay.DecayData(dct)
Bases:
object
Container of radioactive nuclide data for several isotopes.
- Attributes:
data
dictDictionary of RDD content.
Methods
from_endf6
(endf6[, verbose])Extract hierarchical structure of decay data from sandy.Endf6 instance.
get_bmatrix
(**kwargs)Extract B-matrix into dataframe.
get_decay_chains
([skip_parents, cut_hl])Extract decay chains into dataframe.
get_qmatrix
([keep_neutrons, threshold])Extract Q-matrix dataframe.
Extract transition matrix into dataframe.
from_hdf5
extract decay data from hdf5 file
to_hdf5
write decay data to hdf5 file
- property data
Dictionary of RDD content.
- Returns:
- dict
hierarchical RDD content
- classmethod from_endf6(endf6, verbose=False)
Extract hierarchical structure of decay data from sandy.Endf6 instance.
- Parameters:
- tapesandy.Endf6
instance containing decay data
- verbosebool, optional, default is False
flag to print information when reading ENDF-6 file
- Returns:
- dict
structured container with RDD.
- Raises:
- sandy.Error
if no decay data is found
Examples
Load test ENDF-6 file with data for H1 and Co60. >>> endf6 = sandy.get_endf6_file(“jeff_33”, ‘decay’, [10010, 270600, 280600]) >>> rdd = sandy.DecayData.from_endf6(endf6) >>> import yaml >>> print(yaml.dump(rdd)) !!python/object:sandy.decay.DecayData _data:
- 10010:
decay_constant: 0 decay_constant_uncertainty: 0 decay_energy:
alpha: 0.0 beta: 0.0 gamma: 0.0
- decay_energy_uncertainties:
alpha: 0.0 beta: 0.0 gamma: 0.0
half_life: 0.0 half_life_uncertainty: 0.0 parity: 1.0 spin: 0.5 stable: true
- 270600:
decay_constant: 4.167050502344267e-09 decay_constant_uncertainty: 6.324352137605637e-13 decay_energy:
alpha: 0.0 beta: 96522.0 gamma: 2503840.0
- decay_energy_uncertainties:
alpha: 0.0 beta: 202.529 gamma: 352.186
- decay_modes:
? !!python/tuple - 1 - 0 : branching_ratio: 1.0
branching_ratio_uncertainty: 0.0 decay_products:
280600: 1.0
half_life: 166340000.0 half_life_uncertainty: 25245.5 parity: 1.0 spin: 5.0 stable: false
- 280600:
decay_constant: 0 decay_constant_uncertainty: 0 decay_energy:
alpha: 0.0 beta: 0.0 gamma: 0.0
- decay_energy_uncertainties:
alpha: 0.0 beta: 0.0 gamma: 0.0
half_life: 0.0 half_life_uncertainty: 0.0 parity: 1.0 spin: 0.0 stable: true
<BLANKLINE>
- get_bmatrix(**kwargs)
Extract B-matrix into dataframe.
- Parameters:
- kwargsdict
keyword arguments for method get_decay_chains
- Returns:
- pandas.DataFrame
B-matrix associated to the given decay chains
Examples
>>> endf6 = sandy.get_endf6_file("jeff_33", 'decay', [10010, 270600, 280600]) >>> rdd = sandy.DecayData.from_endf6(endf6) >>> rdd.get_bmatrix() PARENT 10010 270600 280600 DAUGHTER 10010 0.00000e+00 0.00000e+00 0.00000e+00 270600 0.00000e+00 0.00000e+00 0.00000e+00 280600 0.00000e+00 1.00000e+00 0.00000e+00
>>> tape = sandy.endf6.get_endf6_file("endfb_71", 'decay', 571480) >>> decay_data = sandy.DecayData.from_endf6(tape) >>> decay_data.get_bmatrix() PARENT 10 571480 581470 581480 DAUGHTER 10 0.00000e+00 1.50000e-03 0.00000e+00 0.00000e+00 571480 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 581470 0.00000e+00 1.50000e-03 0.00000e+00 0.00000e+00 581480 0.00000e+00 9.98500e-01 0.00000e+00 0.00000e+00
>>> h1 = sandy.endf6.get_endf6_file("endfb_71", "decay", 551480) >>> h2 = sandy.endf6.get_endf6_file("endfb_71", "decay", 551490) >>> h3 = h1.merge(h2) >>> rdd = sandy.DecayData.from_endf6(h3) >>> rdd.get_bmatrix() PARENT 10 551480 551490 561460 561470 561480 561490 DAUGHTER 10 0.00000e+00 2.18793e-01 6.88450e-01 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 551480 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 551490 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 561460 0.00000e+00 1.72560e-04 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 561470 0.00000e+00 2.18447e-01 4.09780e-07 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 561480 0.00000e+00 7.81380e-01 6.88450e-01 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 561490 0.00000e+00 0.00000e+00 3.11550e-01 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00
- get_branching_ratio(with_uncertainty=True)
Extract branching ratios and their uncertainties.
- Parameters:
- with_uncertaintybool, optional, default is ‘True’
makes the method return branching ratios and uncertainties if set equal True, or else return only the branching ratios
- Returns:
- sandy.BranchingRatio
object containing branching ratios and associated uncertainties or only branching ratios if with_uncertainty=False
Examples
>>> endf6 = sandy.get_endf6_file("jeff_33", "decay", [942410, 922350]) >>> rdd = sandy.DecayData.from_endf6(endf6) >>> rdd.get_branching_ratio() BR DBR ZAM RTYP RFS 922350 4 0 1.00000e+00 1.00000e-04 6 0 7.20000e-11 2.10000e-11 942410 4 0 2.44000e-05 0.00000e+00 1 0 9.99976e-01 0.00000e+00
>>> rdd.get_branching_ratio(with_uncertainty=False) BR ZAM RTYP RFS 922350 4 0 1.00000e+00 6 0 7.20000e-11 942410 4 0 2.44000e-05 1 0 9.99976e-01
>>> endf6 = sandy.get_endf6_file("jeff_33", "decay", [942410, 10010, 922350]) >>> rdd = sandy.DecayData.from_endf6(endf6) >>> rdd.get_branching_ratio(with_uncertainty=False) BR ZAM RTYP RFS 922350 4 0 1.00000e+00 6 0 7.20000e-11 942410 4 0 2.44000e-05 1 0 9.99976e-01
Decay at first isomeric state: >>> endf6 = sandy.get_endf6_file(“jeff_33”, “decay”, 942390) >>> rdd = sandy.DecayData.from_endf6(endf6) >>> rdd.get_branching_ratio(with_uncertainty=False)
BR
ZAM RTYP RFS 942390 4 0 6.00000e-04
1 9.99400e-01
6 0 3.10000e-12
Stable nuclide: >>> endf6 = sandy.get_endf6_file(“jeff_33”, “decay”, 260560) >>> rdd = sandy.DecayData.from_endf6(endf6) >>> rdd.get_branching_ratio() Empty DataFrame Columns: [BR, DBR] Index: []
- get_chain_yield_sensitivity(**kwargs)
Extract chain fission yield sensitivity matrix. - Columns: nucleus represented by the ZAP (Z*1000 + A*10 + M). - Index: Mass number(A) - values: 1 (in the row (A) of that nucleus if it is stable or in the mass number of the products in which it decays) or a fraction (if that nucleus has more than one path to decay, the fraction represent the probability of decaying along that path. As in the previous case, the fraction is located in the mass number of the final nucleus).
- Parameters:
- kwargsdict
keyword arguments for method get_decay_chains
- Returns:
- pandas.DataFrame
associated to the given decay chains
Examples
>>> zam = [10010, 10020, 10030, 10040, 10050, 10060, 922350] >>> tape = sandy.get_endf6_file("jeff_33",'decay', zam) >>> decay_data = DecayData.from_endf6(tape) >>> decay_data.get_chain_yield_sensitivity() ZAP 10010 10020 10030 10040 10050 10060 922350 A 1 1.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 2 0.00000e+00 1.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 3 0.00000e+00 0.00000e+00 1.00000e+00 1.00000e+00 1.00000e+00 5.00000e-01 0.00000e+00 4 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 1.00000e+00 5 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 5.00000e-01 0.00000e+00 231 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 1.00000e+00
- get_decay_chains(skip_parents=False, cut_hl=False, **kwargs)
Extract decay chains into dataframe.
- Parameters:
- skip_parentsbool, optional, default is False
flag to skip the parent information
- cut_hl: `bool`, optional, default is `False`
cut all the dacay modes of the nuclides with an half life larger than 100 years
- Returns:
- pandas.DataFrame
decay chains dataframe
Examples
>>> endf6 = sandy.get_endf6_file("jeff_33", 'decay', [10010, 270600, 280600]) >>> rdd = sandy.DecayData.from_endf6(endf6) >>> rdd.get_decay_chains() PARENT DAUGHTER YIELD LAMBDA 0 10010 10010 0.00000e+00 0.00000e+00 1 270600 270600 -1.00000e+00 4.16705e-09 2 270600 280600 1.00000e+00 4.16705e-09 3 280600 280600 0.00000e+00 0.00000e+00
>>> rdd.get_decay_chains(skip_parents=True) PARENT DAUGHTER YIELD LAMBDA 0 270600 280600 1.00000e+00 4.16705e-09
Cut the dacay modes of the nuclides with an half life larger than 100 years: >>> tape = sandy.get_endf6_file(“jeff_33”, “decay”, 601440) >>> rdd = sandy.DecayData.from_endf6(tape) >>> rdd.get_decay_chains(cut_hl=False)
PARENT DAUGHTER YIELD LAMBDA
0 601440 20040 1.00000e+00 9.59169e-24 1 601440 581400 1.00000e+00 9.59169e-24 2 601440 601440 -1.00000e+00 9.59169e-24
>>> rdd.get_decay_chains(cut_hl=True) PARENT DAUGHTER YIELD LAMBDA 0 601440 20040 0.00000e+00 9.59169e-24 1 601440 581400 0.00000e+00 9.59169e-24 2 601440 601440 -1.00000e+00 9.59169e-24
- get_decay_energy(with_uncertainty=True)
Extract decay energy and its uncertainty.
- Parameters:
- with_uncertaintybool, optional, default is ‘True’
makes the method return decay energies and uncertainties if set equal True, or else return only the decay energies
- Returns:
- sandy.DecayEnergy
object containing decay energy and associated uncertainty or only decay energy if with_uncertainty=False
Examples
>>> endf6 = sandy.get_endf6_file("jeff_33", "decay", [942400, 922350]) >>> rdd = sandy.DecayData.from_endf6(endf6) >>> rdd.get_decay_energy() E DE ZAM TYPE 922350 alpha 4.46460e+06 1.63255e+05 beta 5.06717e+04 4.29163e+03 gamma 1.63616e+05 1.70801e+03 942400 alpha 5.24303e+06 3.63881e+04 beta 1.11164e+04 9.02572e+02 gamma 1.36292e+03 1.33403e+02
>>> rdd.get_decay_energy(with_uncertainty=False) E ZAM TYPE 922350 alpha 4.46460e+06 beta 5.06717e+04 gamma 1.63616e+05 942400 alpha 5.24303e+06 beta 1.11164e+04 gamma 1.36292e+03
Stable nuclide: >>> endf6 = sandy.get_endf6_file(“jeff_33”, “decay”, 260560) >>> rdd = sandy.DecayData.from_endf6(endf6) >>> rdd.get_decay_energy(with_uncertainty=False)
E
ZAM TYPE 260560 alpha 0.00000e+00
beta 0.00000e+00 gamma 0.00000e+00
- get_half_life(with_uncertainty=True)
Extract half life and its uncertainty.
- Parameters:
- with_uncertaintybool, optional, default is ‘True’
makes the method return half lives and uncertainties if set equal True, or else return only the half lives
- Returns:
- sandy.HalfLife
object containing half life and associated uncertainty or only half life if with_uncertainty=False
Notes
Note
if a nuclide is stable, half-life of zero will be assigned, according with the value stored in the ENDF6 format.
Examples
>>> endf6 = sandy.get_endf6_file("jeff_33", "decay", [942400, 922350]) >>> rdd = sandy.DecayData.from_endf6(endf6) >>> rdd.get_half_life() HL DHL ZAM 922350 2.22102e+16 1.57788e+13 942400 2.07108e+11 1.57785e+08
>>> rdd.get_half_life(with_uncertainty=False) HL ZAM 922350 2.22102e+16 942400 2.07108e+11
Stable nuclide: >>> endf6 = sandy.get_endf6_file(“jeff_33”, “decay”, 260560) >>> rdd = sandy.DecayData.from_endf6(endf6) >>> rdd.get_half_life(with_uncertainty=False)
HL
ZAM 260560 0.00000e+00
- get_nuclides()
- get_pn()
Extract probability of neutron emission.
- Returns:
- pandas.Series
panda series with ZAM index and probability of neutrom emission
Examples
>>> endf6 = sandy.get_endf6_file("jeff_33", "decay", 391000) >>> rdd = sandy.DecayData.from_endf6(endf6) >>> rdd.get_pn() ZAM 391000 1.00000e+00 Name: PN, dtype: float64
- get_qmatrix(keep_neutrons=False, threshold=None, **kwargs)
Extract Q-matrix dataframe.
Optional argument
- kwargsdict
keyword arguments for method get_decay_chains
- thereshold: int, optional, default is None
argument to avoid numerical fluctuations or values so small that they do not have to be taken into account
- keep_neutronsbool, optional, default is False
flag to skip the column with neutron data
- Returns:
- pandas.DataFrame
Q-matrix associated to the given decay chains
Examples
>>> endf6 = sandy.get_endf6_file("jeff_33", 'decay', [10010, 270600, 280600]) >>> rdd = sandy.DecayData.from_endf6(endf6) >>> out = rdd.get_qmatrix() >>> comp = pd.DataFrame([[1, 0, 0], ... [0, 1, 0], ... [0, 1, 1]], ... dtype=float, ... index=[10010, 270600, 280600], ... columns=[10010, 270600, 280600]) >>> comp.index.name = "DAUGHTER" >>> comp.columns.name = "PARENT" >>> pd.testing.assert_frame_equal(comp, out)
>>> h1 = sandy.get_endf6_file("endfb_71", "decay", 551480) >>> h2 = sandy.get_endf6_file("endfb_71", "decay", 551490) >>> h3 = h1.merge(h2) >>> rdd = sandy.DecayData.from_endf6(h3) >>> rdd.get_qmatrix() PARENT 551480 551490 561460 561470 561480 561490 DAUGHTER 551480 1.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 551490 0.00000e+00 1.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 561460 1.72560e-04 0.00000e+00 1.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 561470 2.18447e-01 4.09780e-07 0.00000e+00 1.00000e+00 0.00000e+00 0.00000e+00 561480 7.81380e-01 6.88450e-01 0.00000e+00 0.00000e+00 1.00000e+00 0.00000e+00 561490 0.00000e+00 3.11550e-01 0.00000e+00 0.00000e+00 0.00000e+00 1.00000e+00
Cut the dacay modes of the nuclides with an half life larger than 100 years: >>> tape = sandy.get_endf6_file(“jeff_33”, “decay”, 601440) >>> rdd = sandy.DecayData.from_endf6(tape) >>> rdd.get_qmatrix(cut_hl=False) PARENT 20040 581400 601440 DAUGHTER 20040 1.00000e+00 0.00000e+00 1.00000e+00 581400 0.00000e+00 1.00000e+00 1.00000e+00 601440 0.00000e+00 0.00000e+00 1.00000e+00
>>> rdd.get_qmatrix(cut_hl=True) PARENT 20040 581400 601440 DAUGHTER 20040 1.00000e+00 0.00000e+00 0.00000e+00 581400 0.00000e+00 1.00000e+00 0.00000e+00 601440 0.00000e+00 0.00000e+00 1.00000e+00
Skip column with neutron information: >>> tape = sandy.endf6.get_endf6_file(“endfb_71”, ‘decay’, 571480) >>> rdd = sandy.DecayData.from_endf6(tape) >>> rdd.get_qmatrix(keep_neutrons=False) PARENT 571480 581470 581480 DAUGHTER 571480 1.00000e+00 0.00000e+00 0.00000e+00 581470 1.50000e-03 1.00000e+00 0.00000e+00 581480 9.98500e-01 0.00000e+00 1.00000e+00
>>> rdd.get_qmatrix(keep_neutrons=True) PARENT 10 571480 581470 581480 DAUGHTER 10 1.00000e+00 1.50000e-03 0.00000e+00 0.00000e+00 571480 0.00000e+00 1.00000e+00 0.00000e+00 0.00000e+00 581470 0.00000e+00 1.50000e-03 1.00000e+00 0.00000e+00 581480 0.00000e+00 9.98500e-01 0.00000e+00 1.00000e+00
- get_transition_matrix()
Extract transition matrix into dataframe.
- Returns:
- pandas.DataFrame
transition matrix associated to the given decay chains
Examples
>>> endf6 = sandy.get_endf6_file("jeff_33", 'decay', [10010, 270600, 280600]) >>> rdd = sandy.DecayData.from_endf6(endf6) >>> rdd.get_transition_matrix() PARENT 10010 270600 280600 DAUGHTER 10010 0.00000e+00 0.00000e+00 0.00000e+00 270600 0.00000e+00 -4.16705e-09 0.00000e+00 280600 0.00000e+00 4.16705e-09 0.00000e+00
- to_endf6(endf6)
Update decay data in Endf6 instance with those available in a DecayData instance.
- Parameters:
- `endf6`sandy.Endf6
Endf6 instance
- Returns:
- sandy.Endf6
Endf6 instance with updated decay data
Examples
>>> tape = sandy.get_endf6_file("jeff_33", "decay", 922350) >>> rdd = sandy.DecayData.from_endf6(tape) >>> new_tape = rdd.to_endf6(tape) >>> new_tape MAT MF MT 3542 1 451 9.223500+4 2.330250+2 -1 1 ... 452 9.223500+4 2.330250+2 0 1 ... 8 457 92235.0000 233.025000 0 0 ... dtype: object
- class sandy.decay.DecayEnergy(df)
Bases:
_DecayBase
Extension of sandy._DecayBase. Container of best estimates and uncertainties of decay energies.
Methods
to_decaydata
(rdd)Update decay energies in DecayData instance with those available in a DecayEnergy instance.
- to_decaydata(rdd)
Update decay energies in DecayData instance with those available in a DecayEnergy instance.
- Parameters:
- `rdd`sandy.DecayData
DecayData instance
- Returns
- ——-
- `sandy.DecayData`
DecayData instance with updated decay energies.
Examples
>>> endf6 = sandy.get_endf6_file("jeff_33", "decay", 922350) >>> rdd = sandy.DecayData.from_endf6(endf6) >>> e = rdd.get_decay_energy(with_uncertainty=False) >>> pert = pd.DataFrame([{"ZAM": 922350, "TYPE": "alpha", "PERT": 1.05}]).set_index(["ZAM", "TYPE"]) >>> e_new = e.custom_perturbation(pert) >>> rdd_updated = e_new.to_decaydata(rdd) >>> assert rdd_updated.data[922350]['decay_energy']['alpha'] == e_new.data.E[922350]['alpha']
>>> e = rdd.get_decay_energy() >>> e_new = e.custom_perturbation(pert) >>> rdd_updated = e_new.to_decaydata(rdd) >>> assert rdd_updated.data[922350]['decay_energy']['alpha'] == e_new.data.E[922350]['alpha']
Perturbing only one decay energy of one nuclide in DecayData instance: >>> endf6 = sandy.get_endf6_file(“jeff_33”, “decay”, [922350, 942410]) >>> rdd = sandy.DecayData.from_endf6(endf6) >>> e = rdd.get_decay_energy(with_uncertainty=False) >>> e_new = e.custom_perturbation(pert) >>> rdd_updated =e_new.to_decaydata(rdd) >>> assert rdd_updated.data[922350][‘decay_energy’][‘alpha’] == e_new.data.E[922350][‘alpha’] >>> assert rdd_updated.data[942410][‘decay_energy’][‘alpha’] == e_new.data.E[942410][‘alpha’]
Perturbing one decay energy of each nuclide in DecayData instance: >>> pert = pd.DataFrame([{“ZAM”: 922350, “TYPE”: “alpha”, “PERT”: 1.05}, {“ZAM”: 942410, “TYPE”: “alpha”, “PERT”: 1.05}]).set_index([“ZAM”, “TYPE”]) >>> e_new = e.custom_perturbation(pert) >>> rdd_updated =e_new.to_decaydata(rdd) >>> assert rdd_updated.data[922350][‘decay_energy’][‘alpha’] == e_new.data.E[922350][‘alpha’] >>> assert rdd_updated.data[942410][‘decay_energy’][‘alpha’] == e_new.data.E[942410][‘alpha’]
Perturbing all decay energies of each nuclide in DecayData instance: >>> pert = pd.DataFrame([{“ZAM”: 922350, “TYPE”: “alpha”, “PERT”: 1.05}, {“ZAM”: 922350, “TYPE”: “beta”, “PERT”: 1.01}, {“ZAM”: 922350, “TYPE”: “gamma”, “PERT”: 0.97}, {“ZAM”: 942410, “TYPE”: “alpha”, “PERT”: 1.05}, {“ZAM”: 942410, “TYPE”: “beta”, “PERT”: 0.98}, {“ZAM”: 942410, “TYPE”: “gamma”, “PERT”: 1.02}]).set_index([“ZAM”, “TYPE”]) >>> e_new = e.custom_perturbation(pert) >>> rdd_updated =e_new.to_decaydata(rdd) >>> assert rdd_updated.data[922350][‘decay_energy’][‘alpha’] == e_new.data.E[922350][‘alpha’] >>> assert rdd_updated.data[922350][‘decay_energy’][‘beta’] == e_new.data.E[922350][‘beta’] >>> assert rdd_updated.data[922350][‘decay_energy’][‘gamma’] == e_new.data.E[922350][‘gamma’] >>> assert rdd_updated.data[942410][‘decay_energy’][‘alpha’] == e_new.data.E[942410][‘alpha’] >>> assert rdd_updated.data[942410][‘decay_energy’][‘beta’] == e_new.data.E[942410][‘beta’] >>> assert rdd_updated.data[942410][‘decay_energy’][‘gamma’] == e_new.data.E[942410][‘gamma’]
- class sandy.decay.HalfLife(df)
Bases:
_DecayBase
Extension of sandy._DecayBase. Container of best estimates and uncertainties of half lives.
Methods
to_decaydata
(rdd)Update half lives in DecayData instance with those available in a HalfLife instance.
- to_decaydata(rdd)
Update half lives in DecayData instance with those available in a HalfLife instance.
- Parameters:
- `rdd`sandy.DecayData
DecayData instance
- Returns:
- sandy.DecayData
DecayData instance with updated half lives.
Examples
>>> endf6 = sandy.get_endf6_file("jeff_33", "decay", 922350) >>> rdd = sandy.DecayData.from_endf6(endf6) >>> hl = rdd.get_half_life(with_uncertainty=False) >>> pert = pd.DataFrame([{"ZAM": 922350, "PERT": 1.05}]).set_index(["ZAM"]) >>> hl_new = hl.custom_perturbation(pert) >>> rdd_updated = hl_new.to_decaydata(rdd) >>> assert rdd_updated.data[922350]['half_life'] == hl_new.data.values
>>> hl = rdd.get_half_life() >>> hl_new = hl.custom_perturbation(pert) >>> rdd_updated = hl_new.to_decaydata(rdd) >>> assert rdd_updated.data[922350]['half_life'] == hl_new.data.HL.values
Perturbing only half life of one nuclide in DecayData instance: >>> endf6 = sandy.get_endf6_file(“jeff_33”, “decay”, [922350, 942410]) >>> rdd = sandy.DecayData.from_endf6(endf6) >>> hl = rdd.get_half_life(with_uncertainty=False) >>> pert = pd.DataFrame([{“ZAM”: 922350, “PERT”: 1.05}]).set_index([“ZAM”]) >>> hl_new = hl.custom_perturbation(pert) >>> rdd_updated = hl_new.to_decaydata(rdd) >>> assert rdd_updated.data[922350][‘half_life’] == hl_new.data.query(‘ZAM==922350’).HL.values >>> assert rdd_updated.data[942410][‘half_life’] == hl_new.data.query(‘ZAM==942410’).HL.values
Perturbing half life of each nuclide in DecayData instance: >>> pert = pd.DataFrame([{“ZAM”: 922350,”PERT”: 1.05}, {“ZAM”: 942410,”PERT”: 1.02}]).set_index([“ZAM”]) >>> hl_new = hl.custom_perturbation(pert) >>> rdd_updated = hl_new.to_decaydata(rdd) >>> assert rdd_updated.data[922350][‘half_life’] == hl_new.data.query(‘ZAM==922350’).HL.values >>> assert rdd_updated.data[942410][‘half_life’] == hl_new.data.query(‘ZAM==942410’).HL.values