Data Sources

Download the full notebook.


Data Sources

Below are examples of how to grab cross sections from the EAF and simple data sources and re-discretize them.

In [15]:
from pyne.xs.data_source import *
from pyne.bins import stair_step
import matplotlib.pyplot as plt
import matplotlib
matplotlib.rc('font', family='serif', size=14)
import numpy as np
dst_e_g = np.logspace(1, -7, 11)

EAF Data Source

In [16]:
eds = EAFDataSource()
rx = eds.reaction('U235', 'gamma')
array([3.40601e-04, 4.13527e-04, 4.52339e-04, 5.35260e-04, 7.79656e-04,
       9.12824e-04, 1.05027e-03, 1.20057e-03, 1.33202e-03, 1.46200e-03,
       1.60595e-03, 1.67206e-03, 1.76457e-03, 1.90211e-03, 2.03703e-03,
       2.12614e-03, 2.15500e-03, 2.15923e-03, 2.17015e-03, 2.19708e-03,
       2.24992e-03, 2.34009e-03, 2.47761e-03, 2.65621e-03, 2.80624e-03,
       2.93429e-03, 3.18937e-03, 3.54963e-03, 3.99022e-03, 4.53866e-03,
       5.21324e-03, 6.05776e-03, 7.06523e-03, 9.26177e-03, 1.27481e-02,
       1.75162e-02, 2.23344e-02, 2.54474e-02, 2.88533e-02, 3.21686e-02,
       3.59024e-02, 4.03127e-02, 4.31805e-02, 4.57085e-02, 4.57084e-02,
       4.57112e-02, 4.87787e-02, 5.18315e-02, 5.62859e-02, 6.08943e-02,
       6.55405e-02, 7.01358e-02, 7.41851e-02, 7.78783e-02, 8.13216e-02,
       8.57563e-02, 8.88694e-02, 9.13386e-02, 9.53971e-02, 9.82263e-02,
       1.00158e-01, 1.04962e-01, 1.08964e-01, 1.11877e-01, 1.14201e-01,
       1.16384e-01, 1.19622e-01, 1.23457e-01, 1.27270e-01, 1.31726e-01,
       1.35999e-01, 1.40273e-01, 1.44433e-01, 1.49346e-01, 1.55223e-01,
       1.60902e-01, 1.69406e-01, 1.83582e-01, 1.92772e-01, 1.99107e-01,
       2.07917e-01, 2.18980e-01, 2.24834e-01, 2.28807e-01, 2.28834e-01,
       2.28851e-01, 2.32272e-01, 2.47665e-01, 2.60721e-01, 2.69491e-01,
       2.77787e-01, 2.86525e-01, 2.95251e-01, 3.03786e-01, 3.12412e-01,
       3.20788e-01, 3.28606e-01, 3.35689e-01, 3.45583e-01, 3.55016e-01,
       3.64635e-01, 3.74740e-01, 3.83871e-01, 3.96374e-01, 4.20446e-01,
       4.36756e-01, 4.49877e-01, 4.66706e-01, 4.97313e-01, 5.05926e-01,
       5.32346e-01, 5.64841e-01, 5.50892e-01, 5.98351e-01, 6.17782e-01,
       6.72248e-01, 6.96237e-01, 6.99460e-01, 7.01140e-01, 7.19296e-01,
       7.33180e-01, 7.24884e-01, 7.69404e-01, 7.77250e-01, 8.32799e-01,
       9.33925e-01, 1.01020e+00, 1.07310e+00, 1.21651e+00, 1.27445e+00,
       1.30837e+00, 1.52976e+00, 1.62957e+00, 1.69051e+00, 1.74094e+00,
       1.83856e+00, 1.95794e+00, 1.97871e+00, 2.60955e+00, 2.70133e+00,
       2.82330e+00, 3.85308e+00, 4.03064e+00, 3.91338e+00, 4.59505e+00,
       4.20223e+00, 5.61362e+00, 7.39548e+00, 8.33983e+00, 1.02707e+01,
       1.11389e+01, 1.29232e+01, 8.42540e+00, 2.31086e+01, 1.80067e+01,
       3.46571e+01, 1.94390e+01, 4.63772e+01, 1.76541e+01, 6.54149e+01,
       3.43397e+01, 2.86602e+01, 2.89308e+01, 1.97519e+01, 1.58082e+01,
       3.79141e+00, 1.33372e+01, 3.45039e+00, 1.42551e+01, 1.37460e+01,
       7.05691e+00, 8.53781e+00, 1.27605e+01, 3.89028e+01, 9.05356e+01])
In [17]:
eds.dst_group_struct = dst_e_g
rxc = eds.discretize('U235', 'gamma')
In [18]:
fig = plt.figure(figsize=(7,7))
plt.loglog(*stair_step(eds.src_group_struct, rx), figure=fig)
plt.loglog(*stair_step(eds.dst_group_struct, rxc), figure=fig)
plt.xlabel('E [MeV]')
plt.ylabel('Cross Section [barns]')
Text(0, 0.5, 'Cross Section [barns]')

Simple Data Source

In [19]:
sds = SimpleDataSource(dst_group_struct=dst_e_g)
rx = sds.reaction('U233', 'absorption')
rxc = sds.discretize('U233', 'absorption')
In [20]:
fig = plt.figure(figsize=(7,7))
plt.loglog(sds.src_group_struct[:-1], rx, figure=fig)
plt.loglog(sds.dst_group_struct[:-1], rxc, figure=fig)
plt.xlabel('E [MeV]')
plt.ylabel('Cross Section [barns]')
Text(0, 0.5, 'Cross Section [barns]')

The data sources are caches, which means that subsequent requests for the same data are very fast!

In [21]:
%time sds.reaction('U238', 'fiss')
%time sds.reaction('U238', 'fission')
%time sds.reaction('U238', 'fiss')
CPU times: user 32 ms, sys: 0 ns, total: 32 ms
Wall time: 33 ms

CPU times: user 46 µs, sys: 4 µs, total: 50 µs
Wall time: 55.3 µs

CPU times: user 43 µs, sys: 4 µs, total: 47 µs
Wall time: 53.4 µs

In [ ]: