コード例 #1
0
    def _decay_abundances(self):
        """Determines the decay of all radioactive isotopes. Afterwards their
        mass fractions are added to the stable elements.

        Notes
        -----
        Must be called after _remap_abundances.

        Raises
        ------
        AttributeError if called before _remap_abundances
        """
        try:
            self.radio_abundances_interp
        except AttributeError:
            logger.critical("Abundances must be remapped before decay is"
                            " handled")
            raise AttributeError("no radio_abundances_interp; call "
                                 "_remap_abundances first")

        for i in xrange(self.N_interp):
            comp = {}
            mass = 0
            for ident in self.radio_abundances_interp.keys():
                Xi = self.radio_abundances_interp[ident][i]
                mass += Xi
                comp[nucname.id(ident)] = Xi
            inp = material.Material(comp, mass=mass)
            res = inp.decay(
                (self.t - self.orig.t).to("s").value).mult_by_mass()

            for item in res.items():
                z = nucname.znum(item[0])
                self.abundances_interp[z][i] = \
                    self.abundances_interp[z][i] + item[1]
コード例 #2
0
def test_fluka_7():
    # material doesn't exist in the the fluka materials list but  it exsits in
    # the predefined fluka materials list
    bismuth = material.Material({832090000: 1.0}, 1.0, 9.747, -1.0,
                                {"name": "Bismuth"})
    flukamat_list = []
    mat = gtag.fluka_material_naming(bismuth, flukamat_list)
    original_name = mat.metadata['name']
    name = mat.metadata['fluka_name']
    assert_equal(name, 'BISMUTH1')
    assert_equal(original_name, 'Bismuth')
コード例 #3
0
def test_fluka_6():
    # material exists in the the fluka materials list
    bismuth = material.Material({832090000: 1.0}, 1.0, 9.747, -1.0,
                                {"name": "Bismuth"})
    flukamat_list = [
        'BISMUTH1', 'BISMUTH2', 'BISMUTH3', 'BISMUTH4', 'BISMUTH5', 'BISMUTH6',
        'BISMUTH7', 'BISMUTH8', 'BISMUTH9'
    ]
    mat = gtag.fluka_material_naming(bismuth, flukamat_list)
    original_name = mat.metadata['name']
    name = mat.metadata['fluka_name']
    assert_equal(name, 'BISMUT10')
    assert_equal(original_name, 'Bismuth')
コード例 #4
0
def test_match_1():
    air_1 = material.Material(
        {
            60120000: 0.24732500000000002,
            60130000: 0.0026750000000000003,
            70140000: 0.24909,
            70150000: 0.00091,
            80160000: 0.24939250000000002,
            80170000: 9.5e-05,
            80180000: 0.0005124999999999999,
            180360000: 0.000834,
            180380000: 0.00015725,
            180400000: 0.24900875
        }, 1.0, 0.001205, -1.0, {"name": "Air (dry, near sea level)"})
    air_2 = material.Material(
        {
            10010000: 0.19997700000000002,
            10020000: 2.3e-05,
            60120000: 0.19786,
            60130000: 0.0021400000000000004,
            80160000: 0.19951400000000002,
            80170000: 7.6e-05,
            80180000: 0.00040999999999999994,
            90190000: 0.2,
            140280000: 0.184446,
            140290000: 0.00937,
            140300000: 0.006184
        }, 1.0, 1.76, -1.0, {"name": "C-552 Air-Equivalent Plastic"})
    list_of_matches = [
        'C-552 Air-Equivalent Plastic', 'Air (dry, near sea level)'
    ]
    material_library = MaterialLibrary()
    material_library[air_1.metadata['name']] = air_1
    material_library[air_2.metadata['name']] = air_2
    assert_equal(gtag.print_near_match('air', material_library),
                 list_of_matches)
コード例 #5
0
def test_fluka_3():
    # material exists twice in the the fluka materials list
    nitrogen = material.Material({
        70140000: 0.99636,
        70150000: 0.00364
    }, 1.0, 0.001165, -1.0, {
        "mat_number": "1",
        "name": "Nitrogen"
    })
    flukamat_list = ['NITROGEN', 'LEAD', 'NITROGE1']
    mat = gtag.fluka_material_naming(nitrogen, flukamat_list)
    original_name = mat.metadata['name']
    name = mat.metadata['fluka_name']
    assert_equal(name, 'NITROGE2')
    assert_equal(original_name, 'Nitrogen')
コード例 #6
0
ファイル: decay.py プロジェクト: yuyizheng1112/tardis
    def to_materials(self):
        """
        Convert DataFrame to a list of materials interpreting the MultiIndex as
        atomic_number and mass_number

        Returns
        -------
        list
            list of pyne Materials
        """

        comp_dicts = [dict() for i in range(len(self.columns))]
        for (atomic_number, mass_number), abundances in self.iterrows():
            nuclear_symbol = f"{nucname.name(atomic_number):s}{mass_number:d}"
            for i in range(len(self.columns)):
                comp_dicts[i][nuclear_symbol] = abundances[i]
        return [material.Material(comp_dict) for comp_dict in comp_dicts]
コード例 #7
0
def test_fluka_4():
    # material exists in the the fluka materials list
    lead = material.Material(
        {
            822040000: 0.013999999999999999,
            822060000: 0.24100000000000002,
            822070000: 0.22100000000000003,
            822080000: 0.524
        }, 1.0, -100.0, -1.0, {
            "mat_number": "3",
            "name": "Lead"
        })
    flukamat_list = ['LEAD1', 'LEAD2']
    mat = gtag.fluka_material_naming(lead, flukamat_list)
    original_name = mat.metadata['name']
    name = mat.metadata['fluka_name']
    assert_equal(name, 'LEAD3')
    assert_equal(original_name, 'Lead')
コード例 #8
0
def test_fluka_1():
    # material doesn't exist before in the fluka materials list
    steel = material.Material(
        {
            60120000: 0.10992222222222224,
            60130000: 0.0011888888888888893,
            140280000: 0.10247000000000002,
            140290000: 0.005205555555555556,
            140300000: 0.0034355555555555563,
            150310000: 0.11111111111111112,
            160320000: 0.10554444444444445,
            160330000: 0.0008333333333333334,
            160340000: 0.004722222222222223,
            160360000: 1.1111111111111113e-05,
            220460000: 0.009166666666666668,
            220470000: 0.008266666666666669,
            220480000: 0.08191111111111112,
            220490000: 0.006011111111111112,
            220500000: 0.005755555555555556,
            240500000: 0.004827777777777778,
            240520000: 0.09309888888888891,
            240530000: 0.010556666666666667,
            240540000: 0.002627777777777779,
            250550000: 0.11111111111111112,
            260540000: 0.006494444444444446,
            260560000: 0.10194888888888891,
            260570000: 0.0023544444444444455,
            260580000: 0.0003133333333333333,
            280580000: 0.07564111111111112,
            280600000: 0.029136666666666672,
            280610000: 0.0012665555555555557,
            280620000: 0.004038444444444445,
            280640000: 0.0010283333333333336
        }, 1.0, -7.0, -1.0, {
            "mat_number": "4",
            "name": "Steel, Stainless 321"
        })
    flukamat_list = ['NITROGEN', 'LEAD']
    mat = gtag.fluka_material_naming(steel, flukamat_list)
    original_name = mat.metadata['name']
    name = mat.metadata['fluka_name']
    assert_equal(name, 'STEELSTA')
    assert_equal(original_name, 'Steel, Stainless 321')
コード例 #9
0
#  Created By : unoebauer
#
# _._._._._._._._._._._._._._._._._._._._._.
"""A simple tool to map the output of SN explosion calculations or any ejecta
model into Tardis, using its capability to work with specific density and
abundance files.
"""
import numpy as np
import logging
import astropy.units as units
from pyne import nucname, material

logger = logging.getLogger(__name__)

try:
    material.Material().decay
except AttributeError:
    logger.critical("PyNe module outdated: version >= 0.5 is required")
    raise ImportError("No recent PyNe module found")

# maximum atomic number
zmax = 30


class original_model(object):
    """Simple model interface. It and its derived classes should provide a
    common interface for all possible explosion model formats.

    This class only requires a minimal set of information, from which all the
    remaining quantities are constructed (under the assumption of homologous
    expansion). For each radial shell, the inner and the outer shell radius