Data Sources

Download the full notebook.

data_sources

Data Sources

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

In [1]:
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)
/home/scopatz/.local/lib/python2.7/site-packages/pyne/xs/data_source.py:20: QAWarning: pyne.nucname is not yet QA compliant.
  from .. import nucname
/home/scopatz/.local/lib/python2.7/site-packages/pyne/xs/data_source.py:21: QAWarning: pyne.rxname is not yet QA compliant.
  from .. import rxname
/home/scopatz/.local/lib/python2.7/site-packages/pyne/rxdata.py:5: QAWarning: pyne.rxdata is not yet QA compliant.
  warn(__name__ + " is not yet QA compliant.", QAWarning)
/home/scopatz/.local/lib/python2.7/site-packages/pyne/xs/data_source.py:22: QAWarning: pyne.endf is not yet QA compliant.
  from ..endf import Library
/home/scopatz/.local/lib/python2.7/site-packages/pyne/xs/data_source.py:23: QAWarning: pyne.xs.models is not yet QA compliant.
  from .models import partial_energy_matrix, group_collapse
/home/scopatz/.local/lib/python2.7/site-packages/pyne/xs/data_source.py:25: QAWarning: pyne.xs.data_source is not yet QA compliant.
  warn(__name__ + " is not yet QA compliant.", QAWarning)
/home/scopatz/.local/lib/python2.7/site-packages/pyne/bins.py:8: QAWarning: pyne.bins is not yet QA compliant.
  warn(__name__ + " is not yet QA compliant.", QAWarning)

EAF Data Source

In [2]:
eds = EAFDataSource()
rx = eds.reaction('U235', 'gamma')
rx
Out[2]:
array([  3.40601000e-04,   4.13527000e-04,   4.52339000e-04,
         5.35260000e-04,   7.79656000e-04,   9.12824000e-04,
         1.05027000e-03,   1.20057000e-03,   1.33202000e-03,
         1.46200000e-03,   1.60595000e-03,   1.67206000e-03,
         1.76457000e-03,   1.90211000e-03,   2.03703000e-03,
         2.12614000e-03,   2.15500000e-03,   2.15923000e-03,
         2.17015000e-03,   2.19708000e-03,   2.24992000e-03,
         2.34009000e-03,   2.47761000e-03,   2.65621000e-03,
         2.80624000e-03,   2.93429000e-03,   3.18937000e-03,
         3.54963000e-03,   3.99022000e-03,   4.53866000e-03,
         5.21324000e-03,   6.05776000e-03,   7.06523000e-03,
         9.26177000e-03,   1.27481000e-02,   1.75162000e-02,
         2.23344000e-02,   2.54474000e-02,   2.88533000e-02,
         3.21686000e-02,   3.59024000e-02,   4.03127000e-02,
         4.31805000e-02,   4.57085000e-02,   4.57084000e-02,
         4.57112000e-02,   4.87787000e-02,   5.18315000e-02,
         5.62859000e-02,   6.08943000e-02,   6.55405000e-02,
         7.01358000e-02,   7.41851000e-02,   7.78783000e-02,
         8.13216000e-02,   8.57563000e-02,   8.88694000e-02,
         9.13386000e-02,   9.53971000e-02,   9.82263000e-02,
         1.00158000e-01,   1.04962000e-01,   1.08964000e-01,
         1.11877000e-01,   1.14201000e-01,   1.16384000e-01,
         1.19622000e-01,   1.23457000e-01,   1.27270000e-01,
         1.31726000e-01,   1.35999000e-01,   1.40273000e-01,
         1.44433000e-01,   1.49346000e-01,   1.55223000e-01,
         1.60902000e-01,   1.69406000e-01,   1.83582000e-01,
         1.92772000e-01,   1.99107000e-01,   2.07917000e-01,
         2.18980000e-01,   2.24834000e-01,   2.28807000e-01,
         2.28834000e-01,   2.28851000e-01,   2.32272000e-01,
         2.47665000e-01,   2.60721000e-01,   2.69491000e-01,
         2.77787000e-01,   2.86525000e-01,   2.95251000e-01,
         3.03786000e-01,   3.12412000e-01,   3.20788000e-01,
         3.28606000e-01,   3.35689000e-01,   3.45583000e-01,
         3.55016000e-01,   3.64635000e-01,   3.74740000e-01,
         3.83871000e-01,   3.96374000e-01,   4.20446000e-01,
         4.36756000e-01,   4.49877000e-01,   4.66706000e-01,
         4.97313000e-01,   5.05926000e-01,   5.32346000e-01,
         5.64841000e-01,   5.50892000e-01,   5.98351000e-01,
         6.17782000e-01,   6.72248000e-01,   6.96237000e-01,
         6.99460000e-01,   7.01140000e-01,   7.19296000e-01,
         7.33180000e-01,   7.24884000e-01,   7.69404000e-01,
         7.77250000e-01,   8.32799000e-01,   9.33925000e-01,
         1.01020000e+00,   1.07310000e+00,   1.21651000e+00,
         1.27445000e+00,   1.30837000e+00,   1.52976000e+00,
         1.62957000e+00,   1.69051000e+00,   1.74094000e+00,
         1.83856000e+00,   1.95794000e+00,   1.97871000e+00,
         2.60955000e+00,   2.70133000e+00,   2.82330000e+00,
         3.85308000e+00,   4.03064000e+00,   3.91338000e+00,
         4.59505000e+00,   4.20223000e+00,   5.61362000e+00,
         7.39548000e+00,   8.33983000e+00,   1.02707000e+01,
         1.11389000e+01,   1.29232000e+01,   8.42540000e+00,
         2.31086000e+01,   1.80067000e+01,   3.46571000e+01,
         1.94390000e+01,   4.63772000e+01,   1.76541000e+01,
         6.54149000e+01,   3.43397000e+01,   2.86602000e+01,
         2.89308000e+01,   1.97519000e+01,   1.58082000e+01,
         3.79141000e+00,   1.33372000e+01,   3.45039000e+00,
         1.42551000e+01,   1.37460000e+01,   7.05691000e+00,
         8.53781000e+00,   1.27605000e+01,   3.89028000e+01,
         9.05356000e+01])
In [3]:
eds.dst_group_struct = dst_e_g
rxc = eds.discretize('U235', 'gamma')
In [4]:
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]')
Out[4]:
<matplotlib.text.Text at 0x3b5d810>

Simple Data Source

In [5]:
sds = SimpleDataSource(dst_group_struct=dst_e_g)
print sds.exists
rx = sds.reaction('U233', 'absorption')
rxc = sds.discretize('U233', 'absorption')
True
In [6]:
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]')
Out[6]:
<matplotlib.text.Text at 0x4132910>

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

In [7]:
%time sds.reaction('U238', 'fiss')
print
%time sds.reaction('U238', 'fission')
print
%time sds.reaction('U238', 'fiss')
print
CPU times: user 23.2 ms, sys: 163 µs, total: 23.3 ms
Wall time: 21.7 ms

CPU times: user 40 µs, sys: 2 µs, total: 42 µs
Wall time: 46 µs

CPU times: user 0 ns, sys: 0 ns, total: 0 ns
Wall time: 30 µs

In [7]: