ACE Reader

Download the full notebook.


ACE Module

This notebook demonstrates basic usage of the pyne.ace module.

In [1]:
import os
import matplotlib.pyplot as plt
import pyne.ace
if not os.path.isfile("W180.ace"):
    from urllib import urlretrieve
    urlretrieve("", "W180.ace")
-c:3: QAWarning: pyne.nucname is not yet QA compliant.
-c:3: QAWarning: pyne.rxname is not yet QA compliant.
-c:3: QAWarning: pyne.ace is not yet QA compliant.

The main class in pyne.ace is called Library. It is instantiated using the name of an ACE file, in this case one distributed with MCNP.

In [2]:
lib = pyne.ace.Library('W180.ace')

One can choose to read all tables in the file or selectively read a subset by specifying an argument to the read method.

In [3]:'74180.21c')

After the call to read(), the Library instance will have a dictionary called tables.

In [4]:
{'74180.21c': <ACE Continuous-E Neutron Table: 74180.21c>}
In [5]:
w180 = lib.tables['74180.21c']

Once a table is selected, we can inspect, e.g., the energy grid and the total cross section.

In [6]:
array([  1.00000000e-11,   1.03125000e-11,   1.06250000e-11, ...,
         5.00000000e+01,   5.50000000e+01,   6.00000000e+01])
In [7]:
array([ 1544.50481   ,  1520.95229   ,  1498.44763   , ...,     4.17220824,
           4.26476628,     4.3440783 ])

To get data on a reaction, such as fission or $(n,2n)$, there is an attribute called reactions.

In [8]:
OrderedDict([(2, <ACE Reaction: MT=2 (z,elastic)>), (5, <ACE Reaction: MT=5 (misc)>), (16, <ACE Reaction: MT=16 (z,2n)>), (17, <ACE Reaction: MT=17 (z,3n)>), (22, <ACE Reaction: MT=22 (z,n+a)>), (24, <ACE Reaction: MT=24 (z,2n+a)>), (28, <ACE Reaction: MT=28 (z,n+p)>), (41, <ACE Reaction: MT=41 (z,2n+p)>), (51, <ACE Reaction: MT=51 (z,n1)>), (52, <ACE Reaction: MT=52 (z,n2)>), (53, <ACE Reaction: MT=53 (z,n3)>), (54, <ACE Reaction: MT=54 (z,n4)>), (55, <ACE Reaction: MT=55 (z,n5)>), (56, <ACE Reaction: MT=56 (z,n6)>), (57, <ACE Reaction: MT=57 (z,n7)>), (58, <ACE Reaction: MT=58 (z,n8)>), (59, <ACE Reaction: MT=59 (z,n9)>), (60, <ACE Reaction: MT=60 (z,n10)>), (61, <ACE Reaction: MT=61 (z,n11)>), (62, <ACE Reaction: MT=62 (z,n12)>), (63, <ACE Reaction: MT=63 (z,n13)>), (91, <ACE Reaction: MT=91 (z,nc)>), (102, <ACE Reaction: MT=102 (z,gamma)>), (103, <ACE Reaction: MT=103 (z,p)>), (107, <ACE Reaction: MT=107 (z,a)>), (203, <ACE Reaction: MT=203 (z,Xp)>), (207, <ACE Reaction: MT=207 (z,Xa)>), (444, <ACE Reaction: MT=444 (damage)>), (600, <ACE Reaction: MT=600 (z,p0)>), (601, <ACE Reaction: MT=601 (z,p1)>), (602, <ACE Reaction: MT=602 (z,p2)>), (603, <ACE Reaction: MT=603 (z,p3)>), (604, <ACE Reaction: MT=604 (z,p4)>), (605, <ACE Reaction: MT=605 (z,p5)>), (606, <ACE Reaction: MT=606 (z,p6)>), (607, <ACE Reaction: MT=607 (z,p7)>), (608, <ACE Reaction: MT=608 (z,p8)>), (609, <ACE Reaction: MT=609 (z,p9)>), (610, <ACE Reaction: MT=610 (z,p10)>), (611, <ACE Reaction: MT=611 (z,p11)>), (612, <ACE Reaction: MT=612 (z,p12)>), (613, <ACE Reaction: MT=613 (z,p13)>), (614, <ACE Reaction: MT=614 (z,p14)>), (615, <ACE Reaction: MT=615 (z,p15)>), (616, <ACE Reaction: MT=616 (z,p16)>), (617, <ACE Reaction: MT=617 (z,p17)>), (618, <ACE Reaction: MT=618 (z,p18)>), (619, <ACE Reaction: MT=619 (z,p19)>), (620, <ACE Reaction: MT=620 (z,p20)>), (621, <ACE Reaction: MT=621 (z,p21)>), (622, <ACE Reaction: MT=622 (z,p22)>), (623, <ACE Reaction: MT=623 (z,p23)>), (624, <ACE Reaction: MT=624 (z,p24)>), (649, <ACE Reaction: MT=649 (z,pc)>), (800, <ACE Reaction: MT=800 (z,a0)>), (801, <ACE Reaction: MT=801 (z,a1)>), (802, <ACE Reaction: MT=802 (z,a2)>), (803, <ACE Reaction: MT=803 (z,a3)>), (804, <ACE Reaction: MT=804 (z,a4)>), (805, <ACE Reaction: MT=805 (z,a5)>), (806, <ACE Reaction: MT=806 (z,a6)>), (807, <ACE Reaction: MT=807 (z,a7)>), (808, <ACE Reaction: MT=808 (z,a8)>), (809, <ACE Reaction: MT=809 (z,a9)>), (810, <ACE Reaction: MT=810 (z,a10)>), (811, <ACE Reaction: MT=811 (z,a11)>), (812, <ACE Reaction: MT=812 (z,a12)>), (813, <ACE Reaction: MT=813 (z,a13)>), (814, <ACE Reaction: MT=814 (z,a14)>), (815, <ACE Reaction: MT=815 (z,a15)>), (816, <ACE Reaction: MT=816 (z,a16)>), (817, <ACE Reaction: MT=817 (z,a17)>), (818, <ACE Reaction: MT=818 (z,a18)>), (819, <ACE Reaction: MT=819 (z,a19)>), (820, <ACE Reaction: MT=820 (z,a20)>), (821, <ACE Reaction: MT=821 (z,a21)>), (822, <ACE Reaction: MT=822 (z,a22)>), (823, <ACE Reaction: MT=823 (z,a23)>), (824, <ACE Reaction: MT=824 (z,a24)>), (825, <ACE Reaction: MT=825 (z,a25)>), (826, <ACE Reaction: MT=826 (z,a26)>), (827, <ACE Reaction: MT=827 (z,a27)>), (828, <ACE Reaction: MT=828 (z,a28)>), (829, <ACE Reaction: MT=829 (z,a29)>), (830, <ACE Reaction: MT=830 (z,a30)>), (831, <ACE Reaction: MT=831 (z,a31)>), (832, <ACE Reaction: MT=832 (z,a32)>), (833, <ACE Reaction: MT=833 (z,a33)>), (834, <ACE Reaction: MT=834 (z,a34)>), (849, <ACE Reaction: MT=849 (z,ac)>)])
In [9]:
elastic = w180.reactions[2]

An instance of a Reaction contains the reaction cross section and any angular or energy distributions that may be present.

In [10]:
array([ 43.83981,  43.20029,  42.58963, ...,   1.9508 ,   2.0991 ,   2.2343 ])

With the energy grid (stored on the table), and the cross section (stored on the reaction), one can generate plots of the cross section.

In [11]:
plt.loglog(, elastic.sigma)
[<matplotlib.lines.Line2D at 0x3954690>]