示例#1
0
    def __init__(self,
                 t=0.0,
                 phi=0.0,
                 temp=300.0,
                 tol=1e-7,
                 rxs=None,
                 log=None,
                 *args,
                 **kwargs):
        """Parameters
        ----------
        t : float
            Transmutations time [sec].
        phi : float or array of floats
            Neutron flux vector [n/cm^2/sec].  Currently this must either be 
            a scalar or match the group structure of EAF.
        temp : float, optional
            Temperature [K] of material, defaults to 300.0.
        tol : float
            Tolerance level for chain truncation.
        rxs : set of ints or strs
            Reaction ids or names to use in transmutation which produce well-defined 
            children.  This set should thus not include fission.  If None, then the 
            reactions from EAF are used.
        log : file-like or None
            The log file object should be written. A None imples the log is 
            not desired.
        args : tuple, optional
            Other arguments ignored for compatibility with other Transmuters.
        kwargs : dict, optional
            Other keyword arguments ignored for compatibility with other Transmuters.
        """
        eafds = EAFDataSource()
        eafds.load(temp=temp)
        gs = np.array([eafds.src_group_struct[0], eafds.src_group_struct[-1]])
        eafds.dst_group_struct = gs
        self.xscache = XSCache(group_struct=gs,
                               data_source_classes=(NullDataSource, ))
        self.xscache.data_sources.insert(0, eafds)

        self.t = t
        self._phi = None
        self.phi = phi
        self.temp = temp
        self.log = log
        self.tol = tol
        if rxs is None:
            rxs = [
                'gamma', 'gamma_1', 'gamma_2', 'p', 'p_1', 'p_2', 'd', 'd_1',
                'd_2', 't', 't_1', 't_2', 'He3', 'He3_1', 'He3_2', 'a', 'a_1',
                'a_2', 'z_2a', 'z_2p', 'z_2p_1', 'z_2p_2', 'z_2n', 'z_2n_1',
                'z_2n_2', 'z_3n', 'z_3n_1', 'z_3n_2', 'na', 'na_1', 'na_2',
                'z_2na', 'np', 'np_1', 'np_2', 'n2a', 'nd', 'nd_1', 'nd_2',
                'nt', 'nt_1', 'nt_2', 'nHe3', 'nHe3_1', 'nHe3_2', 'z_4n',
                'z_4n_1', 'n', 'n_1', 'n_2', 'z_3np'
            ]
        rxs = set([rxname.id(rx) for rx in rxs])
        rxs.discard(rxname.id('fission'))
        self.rxs = rxs
示例#2
0
    def __init__(self, t=0.0, phi=0.0, temp=300.0, tol=1e-7, cwd='',
                 base_tape9=origen22.BASE_TAPE9, xscache=None, 
                 o2exe='o2_therm_linux.exe', *args, **kwargs):
        """Parameters
        ----------
        t : float
            Transmutations time [sec].
        phi : float or array of floats
            Neutron flux vector [n/cm^2/sec].  Currently this must either be 
            a scalar or match the group structure of EAF.
        temp : float, optional
            Temperature [K] of material, defaults to 300.0.
        tol : float
            Tolerance level for chain truncation.
        cwd : str, optional
            Current working directory for origen runs. Defaults to this dir.
        base_tape9 : str or dict, optional
            A base TAPE9.INP file.  If this is a str it is interpreted as a path 
            to a file, which is then read in and parsed.  If this is a dict, it is
            assumed to be in the format described in the main origen22 module.
        xscache : XSCache, optional
            A cross section cache to generate cross sections with.
        o2exe : str, optional
            Name or path to ORIGEN 2.2 executable.
        args : tuple, optional
            Other arguments ignored for compatibility with other Transmuters.
        kwargs : dict, optional
            Other keyword arguments ignored for compatibility with other Transmuters.
        """
        if not isinstance(base_tape9, Mapping):
            base_tape9 = origen22.parse_tape9(tape9=base_tape9)
        self.base_tape9 = base_tape9

        if xscache is None:
            eafds = EAFDataSource()
            eafds.load(temp=temp)
            gs = np.array([eafds.src_group_struct[0], eafds.src_group_struct[-1]])
            eafds.dst_group_struct = gs
            xscache = XSCache(group_struct=gs, data_source_classes=[SimpleDataSource, 
                                                                    NullDataSource])
            xscache.load(temp=temp)
            xscache.data_sources.insert(0, eafds)
        self.xscache = xscache

        self.t = t
        self._phi = None
        self.phi = phi
        self.temp = temp
        self.tol = tol
        self.cwd = os.path.abspath(cwd)
        self.o2exe = o2exe
示例#3
0
def test_xslibs():
    exp = {
        42: {
            "_type": "xsfpy",
            "_subtype": "activation_products",
            "title": "PyNE Cross Section Data for Activation Products",
        },
        43: {
            "_type": "xsfpy",
            "_subtype": "actinides",
            "title": "PyNE Cross Section Data for Actinides & Daughters",
        },
        44: {
            "_type": "xsfpy",
            "_subtype": "fission_products",
            "title": "PyNE Cross Section Data for Fission Products",
        },
    }
    xsc = XSCache(data_sources=[NullDataSource])
    nucs = [922350000, 10010000, 461080000]
    obs = origen22.xslibs(nucs=nucs, xscache=xsc, nlb=(42, 43, 44))
    obs_meta = {}
    for n in exp:
        obs_meta[n] = {}
        for field in ["_type", "_subtype", "title"]:
            obs_meta[n][field] = obs[n][field]
    assert_equal(exp, obs_meta)
    for n in exp:
        for field in obs[n]:
            if not field.startswith("sigma_"):
                continue
            assert_true(all([v == 0.0 for v in obs[n][field].values()]))
    assert_true(
        set(obs[42].keys())
        >= set(origen22.ACTIVATION_PRODUCT_FIELDS + origen22.XSFPY_FIELDS)
    )
    assert_true(
        set(obs[43].keys()) >= set(origen22.ACTINIDE_FIELDS + origen22.XSFPY_FIELDS)
    )
    assert_true(
        set(obs[44].keys())
        >= set(origen22.FISSION_PRODUCT_FIELDS + origen22.XSFPY_FIELDS)
    )
示例#4
0
def main_gen(ns):
    """Generates an open TAPE9.INP file. by default this only uses completely open 
    data.
    """
    files = glob(os.path.join(ns.build_dir, 'ENSDF', 'ensdf.*'))
    if len(files) == 0:
        grab_ensdf_decay(ns.build_dir)
        files = glob(os.path.join(ns.build_dir, 'ENSDF', 'ensdf.*'))
    print("parsing ENSDF decay data")
    decays, branches = parse_ensdf(files)
    print("creating ORIGEN decay libraries")
    t9decay = gendecay(decays,
                       branches,
                       metastable_cutoff=ns.metastable_cutoff)
    print("creating ORIGEN cross section libraries")
    xsc = XSCache(
        data_source_classes=[EAFDataSource, SimpleDataSource, NullDataSource])
    xsc.load()
    t9xsfpy = origen22.xslibs(xscache=xsc, verbose=True)
    t9 = origen22.merge_tape9([t9decay, t9xsfpy])
    origen22.write_tape9(t9, outfile=ns.filename)