OpenMC/docs/source/pythonapi/examples/pandas-dataframes.ipynb

2416 lines
153 KiB
Text
Raw Normal View History

{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"This notebook demonstrates how systematic analysis of tally scores is possible using Pandas dataframes. A dataframe can be automatically generated using the `Tally.get_pandas_dataframe(...)` method. Furthermore, by linking the tally data in a statepoint file with geometry and material information from a summary file, the dataframe can be shown with user-supplied labels.\n",
"\n",
"**Note:** that this Notebook was created using the latest Pandas v0.16.1. Everything in the Notebook will wun with older versions of Pandas, but the multi-indexing option in >v0.15.0 makes the tables look prettier."
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"import glob\n",
"from IPython.display import Image\n",
"import matplotlib.pylab as pylab\n",
"import scipy.stats\n",
"import numpy as np\n",
"\n",
"import openmc\n",
"from openmc.statepoint import StatePoint\n",
"from openmc.summary import Summary\n",
"\n",
"%matplotlib inline"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Generate Input Files"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"First we need to define materials that will be used in the problem. Before defining a material, we must create nuclides that are used in the material."
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"# Instantiate some Nuclides\n",
"h1 = openmc.Nuclide('H-1')\n",
"b10 = openmc.Nuclide('B-10')\n",
"o16 = openmc.Nuclide('O-16')\n",
"u235 = openmc.Nuclide('U-235')\n",
"u238 = openmc.Nuclide('U-238')\n",
"zr90 = openmc.Nuclide('Zr-90')"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"With the nuclides we defined, we will now create three materials for the fuel, water, and cladding of the fuel pin."
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"# 1.6 enriched fuel\n",
"fuel = openmc.Material(name='1.6% Fuel')\n",
"fuel.set_density('g/cm3', 10.31341)\n",
"fuel.add_nuclide(u235, 3.7503e-4)\n",
"fuel.add_nuclide(u238, 2.2625e-2)\n",
"fuel.add_nuclide(o16, 4.6007e-2)\n",
"\n",
"# borated water\n",
"water = openmc.Material(name='Borated Water')\n",
"water.set_density('g/cm3', 0.740582)\n",
"water.add_nuclide(h1, 4.9457e-2)\n",
"water.add_nuclide(o16, 2.4732e-2)\n",
"water.add_nuclide(b10, 8.0042e-6)\n",
"\n",
"# zircaloy\n",
"zircaloy = openmc.Material(name='Zircaloy')\n",
"zircaloy.set_density('g/cm3', 6.55)\n",
"zircaloy.add_nuclide(zr90, 7.2758e-3)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"With our three materials, we can now create a materials file object that can be exported to an actual XML file."
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"# Instantiate a MaterialsFile, add Materials\n",
"materials_file = openmc.MaterialsFile()\n",
"materials_file.add_material(fuel)\n",
"materials_file.add_material(water)\n",
"materials_file.add_material(zircaloy)\n",
"materials_file.default_xs = '71c'\n",
"\n",
"# Export to \"materials.xml\"\n",
"materials_file.export_to_xml()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Now let's move on to the geometry. This problem will be a square array of fuel pins, which we can use OpenMC's lattice/universe feature for. The basic universe will have three regions for the fuel, the clad, and the surrounding coolant. The first step is to create the bounding surfaces for fuel and clad, as well as the outer bounding surfaces of the problem."
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"# Create cylinders for the fuel and clad\n",
"fuel_outer_radius = openmc.ZCylinder(x0=0.0, y0=0.0, R=0.39218)\n",
"clad_outer_radius = openmc.ZCylinder(x0=0.0, y0=0.0, R=0.45720)\n",
"\n",
"# Create boundary planes to surround the geometry\n",
"# Use both reflective and vacuum boundaries to make life interesting\n",
"min_x = openmc.XPlane(x0=-10.71, boundary_type='reflective')\n",
"max_x = openmc.XPlane(x0=+10.71, boundary_type='vacuum')\n",
"min_y = openmc.YPlane(y0=-10.71, boundary_type='vacuum')\n",
"max_y = openmc.YPlane(y0=+10.71, boundary_type='reflective')\n",
"min_z = openmc.ZPlane(z0=-10.71, boundary_type='reflective')\n",
"max_z = openmc.ZPlane(z0=+10.71, boundary_type='reflective')"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"With the surfaces defined, we can now create cells that are defined by intersections of half-spaces created by the surfaces."
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"# Create a Universe to encapsulate a fuel pin\n",
"pin_cell_universe = openmc.Universe(name='1.6% Fuel Pin')\n",
"\n",
"# Create fuel Cell\n",
"fuel_cell = openmc.Cell(name='1.6% Fuel')\n",
"fuel_cell.fill = fuel\n",
"fuel_cell.add_surface(fuel_outer_radius, halfspace=-1)\n",
"pin_cell_universe.add_cell(fuel_cell)\n",
"\n",
"# Create a clad Cell\n",
"clad_cell = openmc.Cell(name='1.6% Clad')\n",
"clad_cell.fill = zircaloy\n",
"clad_cell.add_surface(fuel_outer_radius, halfspace=+1)\n",
"clad_cell.add_surface(clad_outer_radius, halfspace=-1)\n",
"pin_cell_universe.add_cell(clad_cell)\n",
"\n",
"# Create a moderator Cell\n",
"moderator_cell = openmc.Cell(name='1.6% Moderator')\n",
"moderator_cell.fill = water\n",
"moderator_cell.add_surface(clad_outer_radius, halfspace=+1)\n",
"pin_cell_universe.add_cell(moderator_cell)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Using the pin cell universe, we can construct a 17x17 rectangular lattice with a 1.26cm pitch."
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"# Create fuel assembly Lattice\n",
"assembly = openmc.RectLattice(name='1.6% Fuel - 0BA')\n",
"assembly.dimension = (17, 17)\n",
"assembly.pitch = (1.26, 1.26)\n",
"assembly.lower_left = [-1.26 * 17. / 2.0] * 2\n",
"assembly.universes = [[pin_cell_universe] * 17] * 17"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"OpenMC requires that there is a \"root\" universe. Let us create a root cell that is filled by the pin cell universe and then assign it to the root universe."
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"# Create root Cell\n",
"root_cell = openmc.Cell(name='root cell')\n",
"root_cell.fill = assembly\n",
"\n",
"# Add boundary planes\n",
"root_cell.add_surface(min_x, halfspace=+1)\n",
"root_cell.add_surface(max_x, halfspace=-1)\n",
"root_cell.add_surface(min_y, halfspace=+1)\n",
"root_cell.add_surface(max_y, halfspace=-1)\n",
"root_cell.add_surface(min_z, halfspace=+1)\n",
"root_cell.add_surface(max_z, halfspace=-1)\n",
"\n",
"# Create root Universe\n",
"root_universe = openmc.Universe(universe_id=0, name='root universe')\n",
"root_universe.add_cell(root_cell)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"We now must create a geometry that is assigned a root universe, put the geometry into a geometry file, and export it to XML."
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"# Create Geometry and set root Universe\n",
"geometry = openmc.Geometry()\n",
"geometry.root_universe = root_universe"
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"# Instantiate a GeometryFile\n",
"geometry_file = openmc.GeometryFile()\n",
"geometry_file.geometry = geometry\n",
"\n",
"# Export to \"geometry.xml\"\n",
"geometry_file.export_to_xml()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"With the geometry and materials finished, we now just need to define simulation parameters. In this case, we will use 5 inactive batches and 15 minimum active batches each with 2500 particles. We also tell OpenMC to turn tally triggers on, which means it will keep running until some criterion on the uncertainty of tallies is reached."
]
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"# OpenMC simulation parameters\n",
"min_batches = 20\n",
"max_batches = 200\n",
"inactive = 5\n",
"particles = 2500\n",
"\n",
"# Instantiate a SettingsFile\n",
"settings_file = openmc.SettingsFile()\n",
"settings_file.batches = min_batches\n",
"settings_file.inactive = inactive\n",
"settings_file.particles = particles\n",
"settings_file.output = {'tallies': False, 'summary': True}\n",
"settings_file.trigger_active = True\n",
"settings_file.trigger_max_batches = max_batches\n",
"source_bounds = [-10.71, -10.71, -10, 10.71, 10.71, 10.]\n",
"settings_file.set_source_space('box', source_bounds)\n",
"\n",
"# Export to \"settings.xml\"\n",
"settings_file.export_to_xml()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Let us also create a plot file that we can use to verify that our pin cell geometry was created successfully."
]
},
{
"cell_type": "code",
"execution_count": 12,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"# Instantiate a Plot\n",
"plot = openmc.Plot(plot_id=1)\n",
"plot.filename = 'materials-xy'\n",
"plot.origin = [0, 0, 0]\n",
"plot.width = [21.5, 21.5]\n",
"plot.pixels = [250, 250]\n",
"plot.color = 'mat'\n",
"\n",
"# Instantiate a PlotsFile, add Plot, and export to \"plots.xml\"\n",
"plot_file = openmc.PlotsFile()\n",
"plot_file.add_plot(plot)\n",
"plot_file.export_to_xml()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"With the plots.xml file, we can now generate and view the plot. OpenMC outputs plots in .ppm format, which can be converted into a compressed format like .png with the convert utility."
]
},
{
"cell_type": "code",
"execution_count": 13,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"0"
]
},
"execution_count": 13,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# Run openmc in plotting mode\n",
"executor = openmc.Executor()\n",
"executor.plot_geometry(output=False)"
]
},
{
"cell_type": "code",
"execution_count": 14,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAPoAAAD6AgMAAAD1grKuAAAABGdBTUEAALGPC/xhBQAAAAFzUkdC\nAK7OHOkAAAAgY0hSTQAAeiYAAICE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LHS4cTg/utTsV7/net/Afzz4f0XGX84/2j9xZ4/sePR/of2X7D/o+vPo/sv\n6h9B/Bfxr9j1Hz2eN/hO8/wfff4A848+f/1A/530/I0+/8PvH9D3H9HnT+R49P0b+v4PfP/4E/wX\nfP8Mvf9G37/D/ovuP8SeP7Hj0f0vdP8tqP9O339cyv7p3P1fdP8Z3v9G999j13/seMax8x/o+ZN7\n+O+E8zdP/8XOf8Hnz9Dzb7HnT+x49PxlCp7/BM+fOv13wvnXBfivt2lMvD8TyH/Hnb+Gz3+j589j\nz5/Y8ej9h4D+W7qQmf57efqv239n3T+C7z+h969i13/seMax+3/o/cMcu/8Y2H9n3p+J6r98pv8m\n4fwXuH+M3n+OO3++AX9clR+4PhbRAAAAJXRFWHRkYXRlOmNyZWF0ZQAyMDE1LTEwLTAzVDAwOjQ2\nOjE5LTA0OjAwwJEVeQAAACV0RVh0ZGF0ZTptb2RpZnkAMjAxNS0xMC0wM1QwMDo0NjoxOS0wNDow\nMLHMrcUAAAAASUVORK5CYII=\n",
"text/plain": [
"<IPython.core.display.Image object>"
]
},
"execution_count": 14,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# Convert OpenMC's funky ppm to png\n",
"!convert materials-xy.ppm materials-xy.png\n",
"\n",
"# Display the materials plot inline\n",
"Image(filename='materials-xy.png')"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"As we can see from the plot, we have a nice array of pin cells with fuel, cladding, and water! Before we run our simulation, we need to tell the code what we want to tally. The following code shows how to create a variety of tallies."
]
},
{
"cell_type": "code",
"execution_count": 15,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"# Instantiate an empty TalliesFile\n",
"tallies_file = openmc.TalliesFile()\n",
"tallies_file._tallies = []"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Instantiate a fission rate mesh Tally"
]
},
{
"cell_type": "code",
"execution_count": 16,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"# Instantiate a tally Mesh\n",
"mesh = openmc.Mesh(mesh_id=1)\n",
"mesh.type = 'regular'\n",
"mesh.dimension = [17, 17]\n",
"mesh.lower_left = [-10.71, -10.71]\n",
"mesh.width = [1.26, 1.26]\n",
"\n",
"# Instantiate tally Filter\n",
"mesh_filter = openmc.Filter()\n",
"mesh_filter.mesh = mesh\n",
"\n",
"# Instantiate energy Filter\n",
"energy_filter = openmc.Filter()\n",
"energy_filter.type = 'energy'\n",
"energy_filter.bins = np.array([0, 0.625e-6, 20.])\n",
"\n",
"# Instantiate the Tally\n",
"tally = openmc.Tally(name='mesh tally')\n",
"tally.add_filter(mesh_filter)\n",
"tally.add_filter(energy_filter)\n",
"tally.add_score('fission')\n",
"tally.add_score('nu-fission')\n",
"\n",
"# Add mesh and Tally to TalliesFile\n",
"tallies_file.add_mesh(mesh)\n",
"tallies_file.add_tally(tally)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Instantiate a cell Tally with nuclides"
]
},
{
"cell_type": "code",
"execution_count": 17,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"# Instantiate tally Filter\n",
"cell_filter = openmc.Filter(type='cell', bins=[fuel_cell.id])\n",
"\n",
"# Instantiate the tally\n",
"tally = openmc.Tally(name='cell tally')\n",
"tally.add_filter(cell_filter)\n",
"tally.add_score('scatter-y2')\n",
"tally.add_nuclide(u235)\n",
"tally.add_nuclide(u238)\n",
"\n",
"# Add mesh and tally to TalliesFile\n",
"tallies_file.add_tally(tally)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Create a \"distribcell\" Tally. The distribcell filter allows us to tally multiple repeated instances of the same cell throughout the geometry."
]
},
{
"cell_type": "code",
"execution_count": 18,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"# Instantiate tally Filter\n",
"distribcell_filter = openmc.Filter(type='distribcell', bins=[moderator_cell.id])\n",
"\n",
"# Instantiate tally Trigger for kicks\n",
"trigger = openmc.Trigger(trigger_type='std_dev', threshold=5e-5)\n",
"trigger.add_score('absorption')\n",
"\n",
"# Instantiate the Tally\n",
"tally = openmc.Tally(name='distribcell tally')\n",
"tally.add_filter(distribcell_filter)\n",
"tally.add_score('absorption')\n",
"tally.add_score('scatter')\n",
"tally.add_trigger(trigger)\n",
"\n",
"# Add mesh and tally to TalliesFile\n",
"tallies_file.add_tally(tally)"
]
},
{
"cell_type": "code",
"execution_count": 19,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"# Export to \"tallies.xml\"\n",
"tallies_file.export_to_xml()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Now we a have a complete set of inputs, so we can go ahead and run our simulation."
]
},
{
"cell_type": "code",
"execution_count": 20,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\n",
" .d88888b. 888b d888 .d8888b.\n",
" d88P\" \"Y88b 8888b d8888 d88P Y88b\n",
" 888 888 88888b.d88888 888 888\n",
" 888 888 88888b. .d88b. 88888b. 888Y88888P888 888 \n",
" 888 888 888 \"88b d8P Y8b 888 \"88b 888 Y888P 888 888 \n",
" 888 888 888 888 88888888 888 888 888 Y8P 888 888 888\n",
" Y88b. .d88P 888 d88P Y8b. 888 888 888 \" 888 Y88b d88P\n",
" \"Y88888P\" 88888P\" \"Y8888 888 888 888 888 \"Y8888P\"\n",
"__________________888______________________________________________________\n",
" 888\n",
" 888\n",
"\n",
" Copyright: 2011-2015 Massachusetts Institute of Technology\n",
" License: http://mit-crpg.github.io/openmc/license.html\n",
" Version: 0.7.0\n",
" Git SHA1: e0c2aace2e73367536fa03e153b67a2d038cd2b3\n",
" Date/Time: 2015-10-03 00:46:19\n",
" MPI Processes: 1\n",
"\n",
" ===========================================================================\n",
" ========================> INITIALIZATION <=========================\n",
" ===========================================================================\n",
"\n",
" Reading settings XML file...\n",
" Reading cross sections XML file...\n",
" Reading geometry XML file...\n",
" Reading materials XML file...\n",
" Reading tallies XML file...\n",
" Building neighboring cells lists for each surface...\n",
" Loading ACE cross section table: 92238.71c\n",
" Loading ACE cross section table: 8016.71c\n",
" Loading ACE cross section table: 92235.71c\n",
" Loading ACE cross section table: 5010.71c\n",
" Loading ACE cross section table: 1001.71c\n",
" Loading ACE cross section table: 40090.71c\n",
" Initializing source particles...\n",
"\n",
" ===========================================================================\n",
" ====================> K EIGENVALUE SIMULATION <====================\n",
" ===========================================================================\n",
"\n",
" Bat./Gen. k Average k \n",
" ========= ======== ==================== \n",
" 1/1 0.59998 \n",
" 2/1 0.65473 \n",
" 3/1 0.67452 \n",
" 4/1 0.66458 \n",
" 5/1 0.70093 \n",
" 6/1 0.70726 \n",
" 7/1 0.65977 0.68351 +/- 0.02375\n",
" 8/1 0.68457 0.68387 +/- 0.01372\n",
" 9/1 0.70024 0.68796 +/- 0.01053\n",
" 10/1 0.64895 0.68016 +/- 0.01128\n",
" 11/1 0.68744 0.68137 +/- 0.00929\n",
" 12/1 0.68037 0.68123 +/- 0.00786\n",
" 13/1 0.64865 0.67715 +/- 0.00793\n",
" 14/1 0.71415 0.68127 +/- 0.00811\n",
" 15/1 0.65717 0.67886 +/- 0.00764\n",
" 16/1 0.71598 0.68223 +/- 0.00769\n",
" 17/1 0.67285 0.68145 +/- 0.00707\n",
" 18/1 0.69329 0.68236 +/- 0.00656\n",
" 19/1 0.65696 0.68055 +/- 0.00634\n",
" 20/1 0.65500 0.67884 +/- 0.00615\n",
" Triggers unsatisfied, max unc./thresh. is 1.21110 for absorption in tally 10002\n",
" The estimated number of batches is 28\n",
" Creating state point statepoint.020.h5...\n",
" 21/1 0.67090 0.67835 +/- 0.00577\n",
" 22/1 0.69025 0.67905 +/- 0.00546\n",
" 23/1 0.66113 0.67805 +/- 0.00525\n",
" 24/1 0.67934 0.67812 +/- 0.00496\n",
" 25/1 0.67203 0.67781 +/- 0.00472\n",
" 26/1 0.66928 0.67741 +/- 0.00451\n",
" 27/1 0.70271 0.67856 +/- 0.00445\n",
" 28/1 0.70233 0.67959 +/- 0.00437\n",
" Triggers satisfied for batch 28\n",
" Creating state point statepoint.028.h5...\n",
"\n",
" ===========================================================================\n",
" ======================> SIMULATION FINISHED <======================\n",
" ===========================================================================\n",
"\n",
"\n",
" =======================> TIMING STATISTICS <=======================\n",
"\n",
" Total time for initialization = 3.9600E-01 seconds\n",
" Reading cross sections = 9.0000E-02 seconds\n",
" Total time in simulation = 1.2458E+01 seconds\n",
" Time in transport only = 1.2445E+01 seconds\n",
" Time in inactive batches = 1.2760E+00 seconds\n",
" Time in active batches = 1.1182E+01 seconds\n",
" Time synchronizing fission bank = 1.0000E-03 seconds\n",
" Sampling source sites = 1.0000E-03 seconds\n",
" SEND/RECV source sites = 0.0000E+00 seconds\n",
" Time accumulating tallies = 1.0000E-03 seconds\n",
2015-09-21 10:29:36 +07:00
" Total time for finalization = 0.0000E+00 seconds\n",
" Total time elapsed = 1.2865E+01 seconds\n",
" Calculation Rate (inactive) = 9796.24 neutrons/second\n",
" Calculation Rate (active) = 3353.60 neutrons/second\n",
"\n",
" ============================> RESULTS <============================\n",
"\n",
" k-effective (Collision) = 0.68196 +/- 0.00427\n",
" k-effective (Track-length) = 0.67959 +/- 0.00437\n",
" k-effective (Absorption) = 0.67957 +/- 0.00402\n",
" Combined k-effective = 0.67943 +/- 0.00295\n",
" Leakage Fraction = 0.34370 +/- 0.00201\n",
"\n"
]
},
{
"data": {
"text/plain": [
"0"
]
},
"execution_count": 20,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# Remove old HDF5 (summary, statepoint) files\n",
"!rm statepoint.*\n",
"\n",
"# Run OpenMC with MPI!\n",
"executor.run_simulation()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Tally Data Processing"
]
},
{
"cell_type": "code",
"execution_count": 21,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"# We do not know how many batches were needed to satisfy the \n",
"# tally trigger(s), so find the statepoint file(s)\n",
"statepoints = glob.glob('statepoint.*.h5')\n",
"\n",
"# Load the last statepoint file\n",
"sp = StatePoint(statepoints[-1])"
]
},
{
"cell_type": "code",
"execution_count": 22,
"metadata": {
"collapsed": false,
"scrolled": true
},
"outputs": [],
"source": [
"# Load the summary file and link with statepoint\n",
"su = Summary('summary.h5')\n",
"sp.link_with_summary(su)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"**Analyze the mesh fission rate tally**"
]
},
{
"cell_type": "code",
"execution_count": 23,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Tally\n",
"\tID =\t10000\n",
"\tName =\tmesh tally\n",
"\tFilters =\t\n",
" \t\tmesh\t[1]\n",
" \t\tenergy\t[ 0.00000000e+00 6.25000000e-07 2.00000000e+01]\n",
"\tNuclides =\ttotal \n",
"\tScores =\t[u'fission', u'nu-fission']\n",
"\tEstimator =\ttracklength\n",
"\n"
]
}
],
"source": [
"# Find the mesh tally with the StatePoint API\n",
"tally = sp.get_tally(name='mesh tally')\n",
"\n",
"# Print a little info about the mesh tally to the screen\n",
"print(tally)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Use the new Tally data retrieval API with pure NumPy"
]
},
{
"cell_type": "code",
"execution_count": 24,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[[[ 0.1127471 ]]\n",
"\n",
" [[ 0.06599162]]\n",
"\n",
" [[ 0.25310075]]\n",
"\n",
" [[ 0.10150973]]]\n"
]
}
],
"source": [
"# Get the relative error for the thermal fission reaction \n",
"# rates in the four corner pins \n",
"data = tally.get_values(scores=['fission'], filters=['mesh', 'energy'], \\\n",
" filter_bins=[((1,1),(1,17), (17,1), (17,17)), \\\n",
" ((0., 0.625e-6),)], value='rel_err')\n",
"print(data)"
]
},
{
"cell_type": "code",
"execution_count": 25,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/html": [
"<div style=\"max-height:1000px;max-width:1500px;overflow:auto;\">\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr>\n",
" <th></th>\n",
" <th colspan=\"3\" halign=\"left\">mesh 1</th>\n",
" <th>energy [MeV]</th>\n",
" <th>score</th>\n",
" <th>mean</th>\n",
" <th>std. dev.</th>\n",
" </tr>\n",
" <tr>\n",
" <th></th>\n",
" <th>x</th>\n",
" <th>y</th>\n",
" <th>z</th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>1</td>\n",
" <td>1</td>\n",
" <td>1</td>\n",
" <td>(0.0e+00 - 6.3e-07)</td>\n",
" <td>fission</td>\n",
" <td>0.000224</td>\n",
" <td>0.000025</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>1</td>\n",
" <td>1</td>\n",
" <td>1</td>\n",
" <td>(0.0e+00 - 6.3e-07)</td>\n",
" <td>nu-fission</td>\n",
" <td>0.000546</td>\n",
" <td>0.000062</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>1</td>\n",
" <td>1</td>\n",
" <td>1</td>\n",
" <td>(6.3e-07 - 2.0e+01)</td>\n",
" <td>fission</td>\n",
" <td>0.000071</td>\n",
" <td>0.000004</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>1</td>\n",
" <td>1</td>\n",
" <td>1</td>\n",
" <td>(6.3e-07 - 2.0e+01)</td>\n",
" <td>nu-fission</td>\n",
" <td>0.000187</td>\n",
" <td>0.000010</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>1</td>\n",
" <td>2</td>\n",
" <td>1</td>\n",
" <td>(0.0e+00 - 6.3e-07)</td>\n",
" <td>fission</td>\n",
" <td>0.000392</td>\n",
" <td>0.000045</td>\n",
" </tr>\n",
" <tr>\n",
" <th>5</th>\n",
" <td>1</td>\n",
" <td>2</td>\n",
" <td>1</td>\n",
" <td>(0.0e+00 - 6.3e-07)</td>\n",
" <td>nu-fission</td>\n",
" <td>0.000955</td>\n",
" <td>0.000110</td>\n",
" </tr>\n",
" <tr>\n",
" <th>6</th>\n",
" <td>1</td>\n",
" <td>2</td>\n",
" <td>1</td>\n",
" <td>(6.3e-07 - 2.0e+01)</td>\n",
" <td>fission</td>\n",
" <td>0.000096</td>\n",
" <td>0.000005</td>\n",
" </tr>\n",
" <tr>\n",
" <th>7</th>\n",
" <td>1</td>\n",
" <td>2</td>\n",
" <td>1</td>\n",
" <td>(6.3e-07 - 2.0e+01)</td>\n",
" <td>nu-fission</td>\n",
" <td>0.000252</td>\n",
" <td>0.000014</td>\n",
" </tr>\n",
" <tr>\n",
" <th>8</th>\n",
" <td>1</td>\n",
" <td>3</td>\n",
" <td>1</td>\n",
" <td>(0.0e+00 - 6.3e-07)</td>\n",
" <td>fission</td>\n",
" <td>0.000551</td>\n",
" <td>0.000053</td>\n",
" </tr>\n",
" <tr>\n",
" <th>9</th>\n",
" <td>1</td>\n",
" <td>3</td>\n",
" <td>1</td>\n",
" <td>(0.0e+00 - 6.3e-07)</td>\n",
" <td>nu-fission</td>\n",
" <td>0.001343</td>\n",
" <td>0.000130</td>\n",
" </tr>\n",
" <tr>\n",
" <th>10</th>\n",
" <td>1</td>\n",
" <td>3</td>\n",
" <td>1</td>\n",
" <td>(6.3e-07 - 2.0e+01)</td>\n",
" <td>fission</td>\n",
" <td>0.000131</td>\n",
" <td>0.000008</td>\n",
" </tr>\n",
" <tr>\n",
" <th>11</th>\n",
" <td>1</td>\n",
" <td>3</td>\n",
" <td>1</td>\n",
" <td>(6.3e-07 - 2.0e+01)</td>\n",
" <td>nu-fission</td>\n",
" <td>0.000343</td>\n",
" <td>0.000019</td>\n",
" </tr>\n",
" <tr>\n",
" <th>12</th>\n",
" <td>1</td>\n",
" <td>4</td>\n",
" <td>1</td>\n",
" <td>(0.0e+00 - 6.3e-07)</td>\n",
" <td>fission</td>\n",
" <td>0.000688</td>\n",
" <td>0.000063</td>\n",
" </tr>\n",
" <tr>\n",
" <th>13</th>\n",
" <td>1</td>\n",
" <td>4</td>\n",
" <td>1</td>\n",
" <td>(0.0e+00 - 6.3e-07)</td>\n",
" <td>nu-fission</td>\n",
" <td>0.001676</td>\n",
" <td>0.000153</td>\n",
" </tr>\n",
" <tr>\n",
" <th>14</th>\n",
" <td>1</td>\n",
" <td>4</td>\n",
" <td>1</td>\n",
" <td>(6.3e-07 - 2.0e+01)</td>\n",
" <td>fission</td>\n",
" <td>0.000151</td>\n",
" <td>0.000007</td>\n",
" </tr>\n",
" <tr>\n",
" <th>15</th>\n",
" <td>1</td>\n",
" <td>4</td>\n",
" <td>1</td>\n",
" <td>(6.3e-07 - 2.0e+01)</td>\n",
" <td>nu-fission</td>\n",
" <td>0.000395</td>\n",
" <td>0.000019</td>\n",
" </tr>\n",
" <tr>\n",
" <th>16</th>\n",
" <td>1</td>\n",
" <td>5</td>\n",
" <td>1</td>\n",
" <td>(0.0e+00 - 6.3e-07)</td>\n",
" <td>fission</td>\n",
" <td>0.000785</td>\n",
" <td>0.000065</td>\n",
" </tr>\n",
" <tr>\n",
" <th>17</th>\n",
" <td>1</td>\n",
" <td>5</td>\n",
" <td>1</td>\n",
" <td>(0.0e+00 - 6.3e-07)</td>\n",
" <td>nu-fission</td>\n",
" <td>0.001914</td>\n",
" <td>0.000158</td>\n",
" </tr>\n",
" <tr>\n",
" <th>18</th>\n",
" <td>1</td>\n",
" <td>5</td>\n",
" <td>1</td>\n",
" <td>(6.3e-07 - 2.0e+01)</td>\n",
" <td>fission</td>\n",
" <td>0.000187</td>\n",
" <td>0.000008</td>\n",
" </tr>\n",
" <tr>\n",
" <th>19</th>\n",
" <td>1</td>\n",
" <td>5</td>\n",
" <td>1</td>\n",
" <td>(6.3e-07 - 2.0e+01)</td>\n",
" <td>nu-fission</td>\n",
" <td>0.000487</td>\n",
" <td>0.000019</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" mesh 1 energy [MeV] score mean std. dev.\n",
" x y z \n",
"0 1 1 1 (0.0e+00 - 6.3e-07) fission 0.000224 0.000025\n",
"1 1 1 1 (0.0e+00 - 6.3e-07) nu-fission 0.000546 0.000062\n",
"2 1 1 1 (6.3e-07 - 2.0e+01) fission 0.000071 0.000004\n",
"3 1 1 1 (6.3e-07 - 2.0e+01) nu-fission 0.000187 0.000010\n",
"4 1 2 1 (0.0e+00 - 6.3e-07) fission 0.000392 0.000045\n",
"5 1 2 1 (0.0e+00 - 6.3e-07) nu-fission 0.000955 0.000110\n",
"6 1 2 1 (6.3e-07 - 2.0e+01) fission 0.000096 0.000005\n",
"7 1 2 1 (6.3e-07 - 2.0e+01) nu-fission 0.000252 0.000014\n",
"8 1 3 1 (0.0e+00 - 6.3e-07) fission 0.000551 0.000053\n",
"9 1 3 1 (0.0e+00 - 6.3e-07) nu-fission 0.001343 0.000130\n",
"10 1 3 1 (6.3e-07 - 2.0e+01) fission 0.000131 0.000008\n",
"11 1 3 1 (6.3e-07 - 2.0e+01) nu-fission 0.000343 0.000019\n",
"12 1 4 1 (0.0e+00 - 6.3e-07) fission 0.000688 0.000063\n",
"13 1 4 1 (0.0e+00 - 6.3e-07) nu-fission 0.001676 0.000153\n",
"14 1 4 1 (6.3e-07 - 2.0e+01) fission 0.000151 0.000007\n",
"15 1 4 1 (6.3e-07 - 2.0e+01) nu-fission 0.000395 0.000019\n",
"16 1 5 1 (0.0e+00 - 6.3e-07) fission 0.000785 0.000065\n",
"17 1 5 1 (0.0e+00 - 6.3e-07) nu-fission 0.001914 0.000158\n",
"18 1 5 1 (6.3e-07 - 2.0e+01) fission 0.000187 0.000008\n",
"19 1 5 1 (6.3e-07 - 2.0e+01) nu-fission 0.000487 0.000019"
]
},
"execution_count": 25,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# Get a pandas dataframe for the mesh tally data\n",
"df = tally.get_pandas_dataframe(nuclides=False)\n",
"\n",
"# Print the first twenty rows in the dataframe\n",
"df.head(20)"
]
},
{
"cell_type": "code",
"execution_count": 26,
"metadata": {
"collapsed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isZb3BcD6gnkXAr8KfD9zbBFwTnpeBqwrUEZJ\nUovkdU+dCqwkLuAAl6XnqzJpPgfcBfxV2t9BTDt5XE7eLwAfA74M/DLwONHKeA74RErzdWAVtXXH\nK+yekkRfH2zb1u5STE/j7Z6aD+zO7O9Jx4qkmTdG3hVp/76695qXjo/1eZKkNsmrNIr+nG8moP4C\n4MNEK6RIfpsULWJMQ93m8MPL7S7CjJO3nsZeIvZQsZDhLYFGaRakNHNGyXsCUCKC5pX09wKvH+W9\n9jYq2MDAAKVSCYDe3l76+vqqU3tXLn7uN7df0Snlcd/9Rvtr1pTZti2mRf/Od2BgIF4fGOinv7/9\n5evW/cr2YM5wtLwWwmzgQeAMYB+wmQhoP5BJsxy4KD0vBdak5yJ5AR6hFtNYBNwALCG6pe4gguz1\nrQ1jGpKMaUyh0WIaeS2NQ0SFsJEYDXUtcdG/ML1+DXArUWHsBA4C5+fkrZe9+n8PuDk9HwLeh91T\nkjKyN/dt315buc+b+1rDm/tUVXaNcHWZ+fPL7N3b3+5iTEvjbWlIUkfJtjT27bOl0Wq2NCR1rWOO\ncdLCqWJLQ9K0kG1p7N9vS6PVnKJDVdmhd1J3KLe7ADOO3VOqMhCubjN3bpnHH+9vdzGmJadGlzQt\nuJ5Ga1hpSJp2vLlv6hgIVy67p9QNht/cV2bVqn7Alkar2NJQlZWGOlX61dvApdRWUhjJ68T42T0l\nadqJCQrbXYrpaSLLvUpSR6rco6HWsdJQlfdpqPuU212AGcdKQ5JUmDENSdIIxjQkSRNWpNJYBuwA\nHibGtzWyNr2+HVhcIO/
"text/plain": [
"<matplotlib.figure.Figure at 0x7fd85c776b10>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"# Create a boxplot to view the distribution of\n",
"# fission and nu-fission rates in the pins\n",
"bp = df.boxplot(column='mean', by='score')"
]
},
{
"cell_type": "code",
"execution_count": 27,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"<matplotlib.colorbar.Colorbar instance at 0x7fd85c414cf8>"
]
},
"execution_count": 27,
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAU0AAAEZCAYAAAAT73clAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAHuZJREFUeJzt3X+UVdV99/E3DgP+rASmggPTDAhRQKtYgySaOI8xKZIE\nkqdJiauNP9JVaVPSpyu/1NpVIT7VaJ4kPsRKWRETEh9hmVrtpNXgj3aMaSJKBNQIEdSpAjKKgiLI\njxnm+eO7B85c7rn37H3PnXPvmc9rrbO499z9vWefcfzOPvvsszeIiIiIiIiIiIiIiIiIiIiIiIjI\nIHYqsBZ4G/gSsBj4uwq+7xrg+ynUS0SkJi0Fvp11JaqkE7gw60rI4HZU1hWQ1L0XeC7rSgRoSFCm\nFxhS7YqIyODxH0A38C52eT4J+CFwvfu8Cfg3YAfwBvDzSOxVwGYXt4HDLboFwI8j5WYDv3Hf8Z/A\naZHPOoGvAOuAncAKYHhMXS8H/gv4DrAd+AYwwZ3DduB14E7gRFf+x0APsAfYBXzV7Z8B/NLVZy1w\nQczxRESK+k/gC5H3P8ASEsCNWB9ng9vOc/tPBV4Gxrj3v4clMIDrOJw03we8A3zExX8N2AgMdZ+/\nBDzuvuc9WIt3Xkw9LwcOAH+FXfEcDZzivrsRS/CPAt+NxLxE/8vzsViCneneX+TeN8UcU6RiujzP\np7hL2P3AyUAr1mr7L7e/B2sRTsUS1svAi0W+ay7WUn3Exfwf4Bjgg5Eyi4BtWMvvp8BZJeq5FfhH\n4CCwF3jBffcBLPl9l9Itxz8F7gd+5t4/DKwGZpWIEamIkmY+9Ra870t83wI2AQ9iCeoqt38T8DfY\npXgXsBxLroWasYQaPc4rWIuvz7bI63eB40vU85WC96OxS/rNwFtYC3dUifj3Ap/FEnTfdh6HW8wi\nqVPSHFzewfoCT8H6Jr/M4cvd5cCHsETUC9xUJH6L+7zPEKDF7S+mMHmX+/wGrAV7Ot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1HSFJH0xaxn1DbBtj4L1xxRZAuHb9LgXm8u\nU2acK9OYIBbgLmztdID9bgN4CngB6yt9qvgZ6PJcRKoh/PJ8NZa0WoFhwFygvaBMO3Cpez0D2Al0\nlYmdFImfg12OAzRFajLBlXux1KmppSki6QvPLN3AfGAllsyWAuuBee7zJVgrcRZ202c3dpldKhbg\nRuBUoAdrTf6l2/9h4BvYjaOD7jg7q3NqIiJxKsssD7gtaknB+/kesQCfiSn/L25LTElTRNKnqeFE\nRDzkOLPk+NREJDM5ziw1fGqew7A6q1KJI+x959iguF8P/QPvmFOP+613TAM93jGf4l7/43QHTLwB\nvDh+jHfMhOXb/A90oX/IEb1mSWwNiDkrIAbs2RdPQy73DLjB/xhFaZYjEREPOc4sOT41EclMjjNL\njk9NRDKju+ciIh5ynFlyfGoikpkcZ5Ycn5qIZEaX5yIiHmJmOcoDJU0RSV+OM0uOT01EMqPLcxER\nDznOLDk+NRHJTI4zS45PTUQyo8vzLBzwLN/of4iS8zPH2B52W3DU2E7vmC5O8o7Zg/+EIifR5R3z\n+8c94x0D0B3yf9NxARN2bPAP4aaAmOUBMevLFynqvICYrP4Pz/Hdc60RJCLpC18jCGAm9mdvI3BV\nTJlF7vN1wLQEsde7smuBR+i/ANs1rvwG4GPlTi2rpNkJPI0tbvRERnUQkWoZmnA7UgNwK5b8pgCX\nAJMLyswCJmKLoF0JLE4QezNwJjYx333AdW7/FGwBtiku7jbK5MWsGu+9QBvwZkbHF5FqCs8s07EF\n0zrd+xXY6pHRTo3ZwDL3ehUwAhgDjC8RG13H/Hhgu3s9B+tkOeDiNrk6PB5XwSz7NEMWexeRehCe\nWcYCr0TebwbOTVBmLNB
"text/plain": [
"<matplotlib.figure.Figure at 0x7fd85c579390>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"# Extract thermal nu-fission rates from pandas\n",
"fiss = df[df['score'] == 'nu-fission']\n",
"fiss = fiss[fiss['energy [MeV]'] == '(0.0e+00 - 6.3e-07)']\n",
"\n",
"# Extract mean and reshape as 2D NumPy arrays\n",
"mean = fiss['mean'].reshape((17,17))\n",
"\n",
"pylab.imshow(mean, interpolation='nearest')\n",
"pylab.title('fission rate')\n",
"pylab.xlabel('x')\n",
"pylab.ylabel('y')\n",
"pylab.colorbar()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"**Analyze the cell+nuclides scatter-y2 rate tally**"
]
},
{
"cell_type": "code",
"execution_count": 28,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Tally\n",
"\tID =\t10001\n",
"\tName =\tcell tally\n",
"\tFilters =\t\n",
" \t\tcell\t[10000]\n",
2015-09-21 10:29:36 +07:00
"\tNuclides =\tU-235 U-238 \n",
"\tScores =\t[u'scatter-Y0,0', u'scatter-Y1,-1', u'scatter-Y1,0', u'scatter-Y1,1', u'scatter-Y2,-2', u'scatter-Y2,-1', u'scatter-Y2,0', u'scatter-Y2,1', u'scatter-Y2,2']\n",
"\tEstimator =\tanalog\n",
"\n"
]
}
],
"source": [
"# Find the cell Tally with the StatePoint API\n",
"tally = sp.get_tally(name='cell tally')\n",
"\n",
"# Print a little info about the cell tally to the screen\n",
"print(tally)"
]
},
{
"cell_type": "code",
"execution_count": 29,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/html": [
"<div style=\"max-height:1000px;max-width:1500px;overflow:auto;\">\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>cell</th>\n",
" <th>nuclide</th>\n",
" <th>score</th>\n",
" <th>mean</th>\n",
" <th>std. dev.</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>10000</td>\n",
2015-09-21 10:29:36 +07:00
" <td>U-235</td>\n",
" <td>scatter-Y0,0</td>\n",
" <td>0.038330</td>\n",
" <td>0.001119</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>10000</td>\n",
2015-09-21 10:29:36 +07:00
" <td>U-235</td>\n",
" <td>scatter-Y1,-1</td>\n",
" <td>0.000008</td>\n",
" <td>0.000341</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>10000</td>\n",
2015-09-21 10:29:36 +07:00
" <td>U-235</td>\n",
" <td>scatter-Y1,0</td>\n",
" <td>-0.000342</td>\n",
" <td>0.000342</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>10000</td>\n",
2015-09-21 10:29:36 +07:00
" <td>U-235</td>\n",
" <td>scatter-Y1,1</td>\n",
" <td>0.000201</td>\n",
" <td>0.000262</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>10000</td>\n",
2015-09-21 10:29:36 +07:00
" <td>U-235</td>\n",
" <td>scatter-Y2,-2</td>\n",
" <td>0.000136</td>\n",
" <td>0.000152</td>\n",
" </tr>\n",
" <tr>\n",
" <th>5</th>\n",
" <td>10000</td>\n",
2015-09-21 10:29:36 +07:00
" <td>U-235</td>\n",
" <td>scatter-Y2,-1</td>\n",
" <td>0.000042</td>\n",
" <td>0.000131</td>\n",
" </tr>\n",
" <tr>\n",
" <th>6</th>\n",
" <td>10000</td>\n",
2015-09-21 10:29:36 +07:00
" <td>U-235</td>\n",
" <td>scatter-Y2,0</td>\n",
" <td>0.000303</td>\n",
" <td>0.000185</td>\n",
" </tr>\n",
" <tr>\n",
" <th>7</th>\n",
" <td>10000</td>\n",
2015-09-21 10:29:36 +07:00
" <td>U-235</td>\n",
" <td>scatter-Y2,1</td>\n",
" <td>-0.000407</td>\n",
" <td>0.000184</td>\n",
" </tr>\n",
" <tr>\n",
" <th>8</th>\n",
" <td>10000</td>\n",
2015-09-21 10:29:36 +07:00
" <td>U-235</td>\n",
" <td>scatter-Y2,2</td>\n",
" <td>-0.000145</td>\n",
" <td>0.000120</td>\n",
" </tr>\n",
" <tr>\n",
" <th>9</th>\n",
" <td>10000</td>\n",
2015-09-21 10:29:36 +07:00
" <td>U-238</td>\n",
" <td>scatter-Y0,0</td>\n",
" <td>2.319322</td>\n",
" <td>0.006166</td>\n",
" </tr>\n",
" <tr>\n",
" <th>10</th>\n",
" <td>10000</td>\n",
2015-09-21 10:29:36 +07:00
" <td>U-238</td>\n",
" <td>scatter-Y1,-1</td>\n",
" <td>-0.023638</td>\n",
" <td>0.001940</td>\n",
" </tr>\n",
" <tr>\n",
" <th>11</th>\n",
" <td>10000</td>\n",
2015-09-21 10:29:36 +07:00
" <td>U-238</td>\n",
" <td>scatter-Y1,0</td>\n",
" <td>-0.003463</td>\n",
" <td>0.001892</td>\n",
" </tr>\n",
" <tr>\n",
" <th>12</th>\n",
" <td>10000</td>\n",
2015-09-21 10:29:36 +07:00
" <td>U-238</td>\n",
" <td>scatter-Y1,1</td>\n",
" <td>0.025099</td>\n",
" <td>0.002270</td>\n",
" </tr>\n",
" <tr>\n",
" <th>13</th>\n",
" <td>10000</td>\n",
2015-09-21 10:29:36 +07:00
" <td>U-238</td>\n",
" <td>scatter-Y2,-2</td>\n",
" <td>-0.000617</td>\n",
" <td>0.001197</td>\n",
" </tr>\n",
" <tr>\n",
" <th>14</th>\n",
" <td>10000</td>\n",
2015-09-21 10:29:36 +07:00
" <td>U-238</td>\n",
" <td>scatter-Y2,-1</td>\n",
" <td>0.002549</td>\n",
" <td>0.001187</td>\n",
" </tr>\n",
" <tr>\n",
" <th>15</th>\n",
" <td>10000</td>\n",
2015-09-21 10:29:36 +07:00
" <td>U-238</td>\n",
" <td>scatter-Y2,0</td>\n",
" <td>0.007121</td>\n",
" <td>0.001646</td>\n",
" </tr>\n",
" <tr>\n",
" <th>16</th>\n",
" <td>10000</td>\n",
2015-09-21 10:29:36 +07:00
" <td>U-238</td>\n",
" <td>scatter-Y2,1</td>\n",
" <td>-0.000058</td>\n",
" <td>0.001323</td>\n",
" </tr>\n",
" <tr>\n",
" <th>17</th>\n",
" <td>10000</td>\n",
2015-09-21 10:29:36 +07:00
" <td>U-238</td>\n",
" <td>scatter-Y2,2</td>\n",
" <td>-0.002235</td>\n",
" <td>0.000867</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" cell nuclide score mean std. dev.\n",
"0 10000 U-235 scatter-Y0,0 0.038330 0.001119\n",
"1 10000 U-235 scatter-Y1,-1 0.000008 0.000341\n",
"2 10000 U-235 scatter-Y1,0 -0.000342 0.000342\n",
"3 10000 U-235 scatter-Y1,1 0.000201 0.000262\n",
"4 10000 U-235 scatter-Y2,-2 0.000136 0.000152\n",
"5 10000 U-235 scatter-Y2,-1 0.000042 0.000131\n",
"6 10000 U-235 scatter-Y2,0 0.000303 0.000185\n",
"7 10000 U-235 scatter-Y2,1 -0.000407 0.000184\n",
"8 10000 U-235 scatter-Y2,2 -0.000145 0.000120\n",
"9 10000 U-238 scatter-Y0,0 2.319322 0.006166\n",
"10 10000 U-238 scatter-Y1,-1 -0.023638 0.001940\n",
"11 10000 U-238 scatter-Y1,0 -0.003463 0.001892\n",
"12 10000 U-238 scatter-Y1,1 0.025099 0.002270\n",
"13 10000 U-238 scatter-Y2,-2 -0.000617 0.001197\n",
"14 10000 U-238 scatter-Y2,-1 0.002549 0.001187\n",
"15 10000 U-238 scatter-Y2,0 0.007121 0.001646\n",
"16 10000 U-238 scatter-Y2,1 -0.000058 0.001323\n",
"17 10000 U-238 scatter-Y2,2 -0.002235 0.000867"
]
},
"execution_count": 29,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# Get a pandas dataframe for the cell tally data\n",
"df = tally.get_pandas_dataframe()\n",
"\n",
"# Print the first twenty rows in the dataframe\n",
"df.head(100)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Use the new Tally data retrieval API with pure NumPy"
]
},
{
"cell_type": "code",
"execution_count": 30,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[[[ 0.00086668 0.0061658 ]\n",
" [ 0.00011981 0.00111862]]]\n"
]
}
],
"source": [
"# Get the standard deviations for two of the spherical harmonic\n",
"# scattering reaction rates \n",
"data = tally.get_values(scores=['scatter-Y2,2', 'scatter-Y0,0'], \n",
2015-09-21 10:29:36 +07:00
" nuclides=['U-238', 'U-235'], value='std_dev')\n",
"print(data)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"**Analyze the distribcell tally**"
]
},
{
"cell_type": "code",
"execution_count": 31,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Tally\n",
"\tID =\t10002\n",
"\tName =\tdistribcell tally\n",
"\tFilters =\t\n",
" \t\tdistribcell\t[10002]\n",
"\tNuclides =\ttotal \n",
"\tScores =\t[u'absorption', u'scatter']\n",
"\tEstimator =\ttracklength\n",
"\n"
]
}
],
"source": [
"# Find the distribcell Tally with the StatePoint API\n",
"tally = sp.get_tally(name='distribcell tally')\n",
"\n",
"# Print a little info about the distribcell tally to the screen\n",
"print(tally)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Use the new Tally data retrieval API with pure NumPy"
]
},
{
"cell_type": "code",
"execution_count": 32,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[[[ 0.03658762]]]\n"
]
}
],
"source": [
"# Get the relative error for the scattering reaction rates in\n",
"# the first 30 distribcell instances \n",
"data = tally.get_values(scores=['scatter'], filters=['distribcell'],\n",
" filter_bins=[(i,) for i in range(10)], value='rel_err')\n",
"print(data)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Print the distribcell tally dataframe **without** OpenCG info"
]
},
{
"cell_type": "code",
"execution_count": 33,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/html": [
"<div style=\"max-height:1000px;max-width:1500px;overflow:auto;\">\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>distribcell</th>\n",
" <th>score</th>\n",
" <th>mean</th>\n",
" <th>std. dev.</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>558</th>\n",
" <td>279</td>\n",
" <td>absorption</td>\n",
" <td>0.000081</td>\n",
" <td>0.000008</td>\n",
" </tr>\n",
" <tr>\n",
" <th>559</th>\n",
" <td>279</td>\n",
" <td>scatter</td>\n",
" <td>0.013109</td>\n",
" <td>0.000358</td>\n",
" </tr>\n",
" <tr>\n",
" <th>560</th>\n",
" <td>280</td>\n",
" <td>absorption</td>\n",
" <td>0.000088</td>\n",
" <td>0.000010</td>\n",
" </tr>\n",
" <tr>\n",
" <th>561</th>\n",
" <td>280</td>\n",
" <td>scatter</td>\n",
" <td>0.014395</td>\n",
" <td>0.000586</td>\n",
" </tr>\n",
" <tr>\n",
" <th>562</th>\n",
" <td>281</td>\n",
" <td>absorption</td>\n",
" <td>0.000097</td>\n",
" <td>0.000010</td>\n",
" </tr>\n",
" <tr>\n",
" <th>563</th>\n",
" <td>281</td>\n",
" <td>scatter</td>\n",
" <td>0.014637</td>\n",
" <td>0.000427</td>\n",
" </tr>\n",
" <tr>\n",
" <th>564</th>\n",
" <td>282</td>\n",
" <td>absorption</td>\n",
" <td>0.000107</td>\n",
" <td>0.000009</td>\n",
" </tr>\n",
" <tr>\n",
" <th>565</th>\n",
" <td>282</td>\n",
" <td>scatter</td>\n",
" <td>0.015683</td>\n",
" <td>0.000552</td>\n",
" </tr>\n",
" <tr>\n",
" <th>566</th>\n",
" <td>283</td>\n",
" <td>absorption</td>\n",
" <td>0.000110</td>\n",
" <td>0.000009</td>\n",
" </tr>\n",
" <tr>\n",
" <th>567</th>\n",
" <td>283</td>\n",
" <td>scatter</td>\n",
" <td>0.016293</td>\n",
" <td>0.000627</td>\n",
" </tr>\n",
" <tr>\n",
" <th>568</th>\n",
" <td>284</td>\n",
" <td>absorption</td>\n",
" <td>0.000111</td>\n",
" <td>0.000007</td>\n",
" </tr>\n",
" <tr>\n",
" <th>569</th>\n",
" <td>284</td>\n",
" <td>scatter</td>\n",
" <td>0.017032</td>\n",
" <td>0.000445</td>\n",
" </tr>\n",
" <tr>\n",
" <th>570</th>\n",
" <td>285</td>\n",
" <td>absorption</td>\n",
" <td>0.000112</td>\n",
" <td>0.000006</td>\n",
" </tr>\n",
" <tr>\n",
" <th>571</th>\n",
" <td>285</td>\n",
" <td>scatter</td>\n",
" <td>0.017666</td>\n",
" <td>0.000425</td>\n",
" </tr>\n",
" <tr>\n",
" <th>572</th>\n",
" <td>286</td>\n",
" <td>absorption</td>\n",
" <td>0.000123</td>\n",
" <td>0.000011</td>\n",
" </tr>\n",
" <tr>\n",
" <th>573</th>\n",
" <td>286</td>\n",
" <td>scatter</td>\n",
" <td>0.017706</td>\n",
" <td>0.000597</td>\n",
" </tr>\n",
" <tr>\n",
" <th>574</th>\n",
" <td>287</td>\n",
" <td>absorption</td>\n",
" <td>0.000108</td>\n",
" <td>0.000011</td>\n",
" </tr>\n",
" <tr>\n",
" <th>575</th>\n",
" <td>287</td>\n",
" <td>scatter</td>\n",
" <td>0.017339</td>\n",
" <td>0.000664</td>\n",
" </tr>\n",
" <tr>\n",
" <th>576</th>\n",
" <td>288</td>\n",
" <td>absorption</td>\n",
" <td>0.000129</td>\n",
" <td>0.000011</td>\n",
" </tr>\n",
" <tr>\n",
" <th>577</th>\n",
" <td>288</td>\n",
" <td>scatter</td>\n",
" <td>0.018452</td>\n",
" <td>0.000523</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" distribcell score mean std. dev.\n",
"558 279 absorption 0.000081 0.000008\n",
"559 279 scatter 0.013109 0.000358\n",
"560 280 absorption 0.000088 0.000010\n",
"561 280 scatter 0.014395 0.000586\n",
"562 281 absorption 0.000097 0.000010\n",
"563 281 scatter 0.014637 0.000427\n",
"564 282 absorption 0.000107 0.000009\n",
"565 282 scatter 0.015683 0.000552\n",
"566 283 absorption 0.000110 0.000009\n",
"567 283 scatter 0.016293 0.000627\n",
"568 284 absorption 0.000111 0.000007\n",
"569 284 scatter 0.017032 0.000445\n",
"570 285 absorption 0.000112 0.000006\n",
"571 285 scatter 0.017666 0.000425\n",
"572 286 absorption 0.000123 0.000011\n",
"573 286 scatter 0.017706 0.000597\n",
"574 287 absorption 0.000108 0.000011\n",
"575 287 scatter 0.017339 0.000664\n",
"576 288 absorption 0.000129 0.000011\n",
"577 288 scatter 0.018452 0.000523"
]
},
"execution_count": 33,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# Get a pandas dataframe for the distribcell tally data\n",
"df = tally.get_pandas_dataframe(nuclides=False)\n",
"\n",
"# Print the last twenty rows in the dataframe\n",
"df.tail(20)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Print the distribcell tally dataframe **with** OpenCG info"
]
},
{
"cell_type": "code",
"execution_count": 34,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/html": [
"<div style=\"max-height:1000px;max-width:1500px;overflow:auto;\">\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr>\n",
" <th></th>\n",
" <th colspan=\"2\" halign=\"left\">level 1</th>\n",
" <th colspan=\"4\" halign=\"left\">level 2</th>\n",
" <th colspan=\"2\" halign=\"left\">level 3</th>\n",
" <th>distribcell</th>\n",
" <th>score</th>\n",
" <th>mean</th>\n",
" <th>std. dev.</th>\n",
" </tr>\n",
" <tr>\n",
" <th></th>\n",
" <th>cell</th>\n",
" <th>univ</th>\n",
" <th colspan=\"4\" halign=\"left\">lat</th>\n",
" <th>cell</th>\n",
" <th>univ</th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" </tr>\n",
" <tr>\n",
" <th></th>\n",
" <th>id</th>\n",
" <th>id</th>\n",
" <th>id</th>\n",
" <th>x</th>\n",
" <th>y</th>\n",
" <th>z</th>\n",
" <th>id</th>\n",
" <th>id</th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>10003</td>\n",
" <td>0</td>\n",
" <td>10001</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>10002</td>\n",
" <td>10000</td>\n",
" <td>0</td>\n",
" <td>absorption</td>\n",
" <td>0.000131</td>\n",
" <td>0.000014</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>10003</td>\n",
" <td>0</td>\n",
" <td>10001</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>10002</td>\n",
" <td>10000</td>\n",
" <td>0</td>\n",
" <td>scatter</td>\n",
" <td>0.018582</td>\n",
" <td>0.000680</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>10003</td>\n",
" <td>0</td>\n",
" <td>10001</td>\n",
" <td>1</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>10002</td>\n",
" <td>10000</td>\n",
" <td>1</td>\n",
" <td>absorption</td>\n",
" <td>0.000220</td>\n",
" <td>0.000023</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>10003</td>\n",
" <td>0</td>\n",
" <td>10001</td>\n",
" <td>1</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>10002</td>\n",
" <td>10000</td>\n",
" <td>1</td>\n",
" <td>scatter</td>\n",
" <td>0.028711</td>\n",
" <td>0.001186</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>10003</td>\n",
" <td>0</td>\n",
" <td>10001</td>\n",
" <td>2</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>10002</td>\n",
" <td>10000</td>\n",
" <td>2</td>\n",
" <td>absorption</td>\n",
" <td>0.000295</td>\n",
" <td>0.000022</td>\n",
" </tr>\n",
" <tr>\n",
" <th>5</th>\n",
" <td>10003</td>\n",
" <td>0</td>\n",
" <td>10001</td>\n",
" <td>2</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>10002</td>\n",
" <td>10000</td>\n",
" <td>2</td>\n",
" <td>scatter</td>\n",
" <td>0.038782</td>\n",
" <td>0.001084</td>\n",
" </tr>\n",
" <tr>\n",
" <th>6</th>\n",
" <td>10003</td>\n",
" <td>0</td>\n",
" <td>10001</td>\n",
" <td>3</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>10002</td>\n",
" <td>10000</td>\n",
" <td>3</td>\n",
" <td>absorption</td>\n",
" <td>0.000331</td>\n",
" <td>0.000022</td>\n",
" </tr>\n",
" <tr>\n",
" <th>7</th>\n",
" <td>10003</td>\n",
" <td>0</td>\n",
" <td>10001</td>\n",
" <td>3</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>10002</td>\n",
" <td>10000</td>\n",
" <td>3</td>\n",
" <td>scatter</td>\n",
" <td>0.045772</td>\n",
" <td>0.001084</td>\n",
" </tr>\n",
" <tr>\n",
" <th>8</th>\n",
" <td>10003</td>\n",
" <td>0</td>\n",
" <td>10001</td>\n",
" <td>4</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>10002</td>\n",
" <td>10000</td>\n",
" <td>4</td>\n",
" <td>absorption</td>\n",
" <td>0.000419</td>\n",
" <td>0.000026</td>\n",
" </tr>\n",
" <tr>\n",
" <th>9</th>\n",
" <td>10003</td>\n",
" <td>0</td>\n",
" <td>10001</td>\n",
" <td>4</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>10002</td>\n",
" <td>10000</td>\n",
" <td>4</td>\n",
" <td>scatter</td>\n",
" <td>0.055975</td>\n",
" <td>0.001344</td>\n",
" </tr>\n",
" <tr>\n",
" <th>10</th>\n",
" <td>10003</td>\n",
" <td>0</td>\n",
" <td>10001</td>\n",
" <td>5</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>10002</td>\n",
" <td>10000</td>\n",
" <td>5</td>\n",
" <td>absorption</td>\n",
" <td>0.000514</td>\n",
" <td>0.000024</td>\n",
" </tr>\n",
" <tr>\n",
" <th>11</th>\n",
" <td>10003</td>\n",
" <td>0</td>\n",
" <td>10001</td>\n",
" <td>5</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>10002</td>\n",
" <td>10000</td>\n",
" <td>5</td>\n",
" <td>scatter</td>\n",
" <td>0.063289</td>\n",
" <td>0.001605</td>\n",
" </tr>\n",
" <tr>\n",
" <th>12</th>\n",
" <td>10003</td>\n",
" <td>0</td>\n",
" <td>10001</td>\n",
" <td>6</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>10002</td>\n",
" <td>10000</td>\n",
" <td>6</td>\n",
" <td>absorption</td>\n",
" <td>0.000591</td>\n",
" <td>0.000027</td>\n",
" </tr>\n",
" <tr>\n",
" <th>13</th>\n",
" <td>10003</td>\n",
" <td>0</td>\n",
" <td>10001</td>\n",
" <td>6</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>10002</td>\n",
" <td>10000</td>\n",
" <td>6</td>\n",
" <td>scatter</td>\n",
" <td>0.071011</td>\n",
" <td>0.002058</td>\n",
" </tr>\n",
" <tr>\n",
" <th>14</th>\n",
" <td>10003</td>\n",
" <td>0</td>\n",
" <td>10001</td>\n",
" <td>7</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>10002</td>\n",
" <td>10000</td>\n",
" <td>7</td>\n",
" <td>absorption</td>\n",
" <td>0.000671</td>\n",
" <td>0.000036</td>\n",
" </tr>\n",
" <tr>\n",
" <th>15</th>\n",
" <td>10003</td>\n",
" <td>0</td>\n",
" <td>10001</td>\n",
" <td>7</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>10002</td>\n",
" <td>10000</td>\n",
" <td>7</td>\n",
" <td>scatter</td>\n",
" <td>0.077891</td>\n",
" <td>0.001952</td>\n",
" </tr>\n",
" <tr>\n",
" <th>16</th>\n",
" <td>10003</td>\n",
" <td>0</td>\n",
" <td>10001</td>\n",
" <td>8</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>10002</td>\n",
" <td>10000</td>\n",
" <td>8</td>\n",
" <td>absorption</td>\n",
" <td>0.000721</td>\n",
" <td>0.000031</td>\n",
" </tr>\n",
" <tr>\n",
" <th>17</th>\n",
" <td>10003</td>\n",
" <td>0</td>\n",
" <td>10001</td>\n",
" <td>8</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>10002</td>\n",
" <td>10000</td>\n",
" <td>8</td>\n",
" <td>scatter</td>\n",
" <td>0.086393</td>\n",
" <td>0.001722</td>\n",
" </tr>\n",
" <tr>\n",
" <th>18</th>\n",
" <td>10003</td>\n",
" <td>0</td>\n",
" <td>10001</td>\n",
" <td>9</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>10002</td>\n",
" <td>10000</td>\n",
" <td>9</td>\n",
" <td>absorption</td>\n",
" <td>0.000748</td>\n",
" <td>0.000033</td>\n",
" </tr>\n",
" <tr>\n",
" <th>19</th>\n",
" <td>10003</td>\n",
" <td>0</td>\n",
" <td>10001</td>\n",
" <td>9</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>10002</td>\n",
" <td>10000</td>\n",
" <td>9</td>\n",
" <td>scatter</td>\n",
" <td>0.090861</td>\n",
" <td>0.001669</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" level 1 level 2 level 3 distribcell score \\\n",
" cell univ lat cell univ \n",
" id id id x y z id id \n",
"0 10003 0 10001 0 0 0 10002 10000 0 absorption \n",
"1 10003 0 10001 0 0 0 10002 10000 0 scatter \n",
"2 10003 0 10001 1 0 0 10002 10000 1 absorption \n",
"3 10003 0 10001 1 0 0 10002 10000 1 scatter \n",
"4 10003 0 10001 2 0 0 10002 10000 2 absorption \n",
"5 10003 0 10001 2 0 0 10002 10000 2 scatter \n",
"6 10003 0 10001 3 0 0 10002 10000 3 absorption \n",
"7 10003 0 10001 3 0 0 10002 10000 3 scatter \n",
"8 10003 0 10001 4 0 0 10002 10000 4 absorption \n",
"9 10003 0 10001 4 0 0 10002 10000 4 scatter \n",
"10 10003 0 10001 5 0 0 10002 10000 5 absorption \n",
"11 10003 0 10001 5 0 0 10002 10000 5 scatter \n",
"12 10003 0 10001 6 0 0 10002 10000 6 absorption \n",
"13 10003 0 10001 6 0 0 10002 10000 6 scatter \n",
"14 10003 0 10001 7 0 0 10002 10000 7 absorption \n",
"15 10003 0 10001 7 0 0 10002 10000 7 scatter \n",
"16 10003 0 10001 8 0 0 10002 10000 8 absorption \n",
"17 10003 0 10001 8 0 0 10002 10000 8 scatter \n",
"18 10003 0 10001 9 0 0 10002 10000 9 absorption \n",
"19 10003 0 10001 9 0 0 10002 10000 9 scatter \n",
"\n",
" mean std. dev. \n",
" \n",
" \n",
"0 0.000131 0.000014 \n",
"1 0.018582 0.000680 \n",
"2 0.000220 0.000023 \n",
"3 0.028711 0.001186 \n",
"4 0.000295 0.000022 \n",
"5 0.038782 0.001084 \n",
"6 0.000331 0.000022 \n",
"7 0.045772 0.001084 \n",
"8 0.000419 0.000026 \n",
"9 0.055975 0.001344 \n",
"10 0.000514 0.000024 \n",
"11 0.063289 0.001605 \n",
"12 0.000591 0.000027 \n",
"13 0.071011 0.002058 \n",
"14 0.000671 0.000036 \n",
"15 0.077891 0.001952 \n",
"16 0.000721 0.000031 \n",
"17 0.086393 0.001722 \n",
"18 0.000748 0.000033 \n",
"19 0.090861 0.001669 "
]
},
"execution_count": 34,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# Get a pandas dataframe for the distribcell tally data\n",
"df = tally.get_pandas_dataframe(summary=su, nuclides=False)\n",
"\n",
"# Print the last twenty rows in the dataframe\n",
"df.head(20)"
]
},
{
"cell_type": "code",
"execution_count": 35,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/html": [
"<div style=\"max-height:1000px;max-width:1500px;overflow:auto;\">\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr>\n",
" <th></th>\n",
" <th>mean</th>\n",
" <th>std. dev.</th>\n",
" </tr>\n",
" <tr>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" </tr>\n",
" <tr>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>count</th>\n",
" <td>289.000000</td>\n",
" <td>289.000000</td>\n",
" </tr>\n",
" <tr>\n",
" <th>mean</th>\n",
" <td>0.000417</td>\n",
" <td>0.000020</td>\n",
" </tr>\n",
" <tr>\n",
" <th>std</th>\n",
" <td>0.000238</td>\n",
" <td>0.000008</td>\n",
" </tr>\n",
" <tr>\n",
" <th>min</th>\n",
" <td>0.000020</td>\n",
" <td>0.000003</td>\n",
" </tr>\n",
" <tr>\n",
" <th>25%</th>\n",
" <td>0.000214</td>\n",
" <td>0.000014</td>\n",
" </tr>\n",
" <tr>\n",
" <th>50%</th>\n",
" <td>0.000394</td>\n",
" <td>0.000019</td>\n",
" </tr>\n",
" <tr>\n",
" <th>75%</th>\n",
" <td>0.000627</td>\n",
" <td>0.000025</td>\n",
" </tr>\n",
" <tr>\n",
" <th>max</th>\n",
" <td>0.000915</td>\n",
" <td>0.000049</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" mean std. dev.\n",
" \n",
" \n",
"count 289.000000 289.000000\n",
"mean 0.000417 0.000020\n",
"std 0.000238 0.000008\n",
"min 0.000020 0.000003\n",
"25% 0.000214 0.000014\n",
"50% 0.000394 0.000019\n",
"75% 0.000627 0.000025\n",
"max 0.000915 0.000049"
]
},
"execution_count": 35,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# Show summary statistics for absorption distribcell tally data\n",
"absorption = df[df['score'] == 'absorption']\n",
"absorption[['mean', 'std. dev.']].dropna().describe()\n",
"\n",
"# Note that the maximum standard deviation does indeed\n",
"# meet the 5e-4 threshold set by the tally trigger"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Perform a statistical test comparing the tally sample distributions for two categories of fuel pins."
]
},
{
"cell_type": "code",
"execution_count": 36,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Mann-Whitney Test p-value: 0.498462484897\n"
]
}
],
"source": [
"# Extract tally data from pins in the pins divided along y=x diagonal \n",
"multi_index = ('level 2', 'lat',)\n",
"lower = df[df[multi_index + ('x',)] + df[multi_index + ('y',)] < 16]\n",
"upper = df[df[multi_index + ('x',)] + df[multi_index + ('y',)] > 16]\n",
"lower = lower[lower['score'] == 'absorption']\n",
"upper = upper[upper['score'] == 'absorption']\n",
"\n",
"# Perform non-parametric Mann-Whitney U Test to see if the \n",
"# absorption rates (may) come from same sampling distribution\n",
"u, p = scipy.stats.mannwhitneyu(lower['mean'], upper['mean'])\n",
"print('Mann-Whitney Test p-value: {0}'.format(p))"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Note that the symmetry implied by the y=x diagonal ensures that the two sampling distributions are identical. Indeed, as illustrated by the test above, for any reasonable significance level (*e.g.*, $\\alpha$=0.05) one would **not reject** the null hypothesis that the two sampling distributions are identical.\n",
"\n",
"Next, perform the same test but with two groupings of pins which are not symmetrically identical to one another."
]
},
{
"cell_type": "code",
"execution_count": 37,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Mann-Whitney Test p-value: 1.61253828675e-41\n"
]
}
],
"source": [
"# Extract tally data from pins in the pins divided along y=-x diagonal\n",
"multi_index = ('level 2', 'lat',)\n",
"lower = df[df[multi_index + ('x',)] > df[multi_index + ('y',)]]\n",
"upper = df[df[multi_index + ('x',)] < df[multi_index + ('y',)]]\n",
"lower = lower[lower['score'] == 'absorption']\n",
"upper = upper[upper['score'] == 'absorption']\n",
"\n",
"# Perform non-parametric Mann-Whitney U Test to see if the \n",
"# absorption rates (may) come from same sampling distribution\n",
"u, p = scipy.stats.mannwhitneyu(lower['mean'], upper['mean'])\n",
"print('Mann-Whitney Test p-value: {0}'.format(p))"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Note that the asymmetry implied by the y=-x diagonal ensures that the two sampling distributions are *not* identical. Indeed, as illustrated by the test above, for any reasonable significance level (*e.g.*, $\\alpha$=0.05) one would **reject** the null hypothesis that the two sampling distributions are identical."
]
},
{
"cell_type": "code",
"execution_count": 38,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"/usr/local/lib/python2.7/dist-packages/IPython/kernel/__main__.py:4: SettingWithCopyWarning: \n",
"A value is trying to be set on a copy of a slice from a DataFrame.\n",
"Try using .loc[row_indexer,col_indexer] = value instead\n",
"\n",
"See the the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy\n"
]
},
{
"data": {
"text/plain": [
"<matplotlib.axes.AxesSubplot at 0x7fd85c753650>"
]
},
"execution_count": 38,
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAY8AAAEZCAYAAABvpam5AAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzsnXd4FNXbhu/dTXazu2lAIEAoEaRXK03pKhYUsSBiARQV\nxYKigKjwiQU7KhZQBHsBlR9WpIiIIogURaRK7ygtkL7P98dMwgYCJJBks3Lu69qLzMw5Z56ZXead\n877nvAcMBoPBYDAYDAaDwWAwGAwGg8FgMBgMBoPBYDAYDAaDwWAwGAwGg8FgKJUMBt4ItQiDwWAw\nwDnAz8Bu4B9gNnDmCbbZE/jxkH3jgeEn2G5xEgBSgH3AJuAlIKKAdYcB7xaPLMPJTkF/hAZDSRIL\nfAncCnwCeIBzgfRQijoCLiC7mM/RGPgbqAn8ACwDXi3mcxoMBkPYcSaw6xhl+gBLgb3An8Bp9v5B\nwKqg/V3s/fWAVCAL6y1+l91GBpZR2gf8zy5bGfgU2I710L4z6LzDgIlYb/R7gJvI+4afjNVb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Bb\n8XhqkZq618Q9DAZDoTExj5MEh8OB0+kK2vPfN5gGg6F0Y4xHCCmo3/Syyy4jKmomTudwYBI+X1du\nvbVvyHsd4e73NfpDRzhrh/DXXxSYlQTDgMTERH77bTaDBj3Kli3z6Nz5au677+5QyzIYDCcx4e4w\nPyliHgaDwVCUmJiHwWAwGEKCMR4hJNz9pkZ/aAln/eGsHcJff1FgjIfBYDAYCo2JeRgMBsNJhol5\nGAwGgyEkGOMRQsLdb2r0h5Zw1h/O2iH89RcFxngYDAaDodCYmIfBYDCcZJiYh8FgMBhCgjEeISTc\n/aZGf2gJZ/3hrB3CX39
"text/plain": [
"<matplotlib.figure.Figure at 0x7fd85c3c2090>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"# Extract the scatter tally data from pandas\n",
"scatter = df[df['score'] == 'scatter']\n",
"\n",
"scatter['rel. err.'] = scatter['std. dev.'] / scatter['mean']\n",
"\n",
"# Show a scatter plot of the mean vs. the std. dev.\n",
"scatter.plot(kind='scatter', x='mean', y='rel. err.', title='Scattering Rates')"
]
},
{
"cell_type": "code",
"execution_count": 39,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"<matplotlib.legend.Legend at 0x7fd85c163f90>"
]
},
"execution_count": 39,
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAYUAAAEZCAYAAAB4hzlwAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzt3Xl8U1X+//FXSgEptLRsLYu0ogLKIqCCyCgdHRkZFTec\nARQFHXdlRkRx+wpuP5fRcVy+4HwVBRfAfUdlM4iIgEpZZaeylLIJpWWn5PfHSZu2pG3a3pt7k7yf\nj0cezb259+aT0ySf3PO591wQEREREREREREREREREREREREREREREZvcD7zqdBAiItHsD8APwG5g\nJ/A9cEYNtzkEmF1m3njgsRpu105HgQIgH9gMvAjEh7juaOAte8KSWBfqm1D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DChAl4vV7WrVtHQUEBd9xxBwDLly/n9ttvZ9KkSWzZsoW8vDxycnJKPe9nn33GVVddRV5eHoMG\nDaJWrVq88MIL7Ny5k7lz5zJjxgzGjBlTap2pU6eycOFCfvzxR55++mluvPFGJk2axIYNG1iyZAmT\nJk2ypL2qQklBRCKKz+fjsssuIyUlpfh2++23B+1SqlOnDqtXr2bHjh0kJCTQo0eP4m2U9c4773D3\n3XeTkZFB/fr1efLJJ5k8eTKFhYV88MEH9OvXj7PPPpvatWvz6KOPHvN8Z599Nv369QPguOOOo1u3\nbnTv3p24uDjS09O56aabmDVrVql17r33Xho0aMCpp55Kp06d6Nu3LxkZGSQlJdG3b18WLlxoVbOF\nTEnB5dSPHqC2CIjltii
"text/plain": [
"<matplotlib.figure.Figure at 0x7fd85c378c10>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"# Plot a histogram and kernel density estimate for the scattering rates\n",
"scatter['mean'].plot(kind='hist', bins=25)\n",
"scatter['mean'].plot(kind='kde')\n",
"pylab.title('Scattering Rates')\n",
"pylab.xlabel('Mean')\n",
"pylab.legend(['KDE', 'Histogram'])"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 2",
"language": "python",
"name": "python2"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 2
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython2",
"version": "2.7.6"
}
},
"nbformat": 4,
"nbformat_minor": 0
}