Added docstring for Tally.swap_filter(...) routine

This commit is contained in:
Will Boyd 2015-10-03 01:04:42 -04:00
parent 9c9eb446a1
commit 0eee99ee20
9 changed files with 230 additions and 651 deletions

View file

@ -0,0 +1,38 @@
<?xml version='1.0' encoding='utf-8'?>
<geometry>
<cell id="10000" material="10000" name="1.6% Fuel" surfaces="-10000" universe="10000" />
<cell id="10001" material="10002" name="1.6% Clad" surfaces="10000 -10001" universe="10000" />
<cell id="10002" material="10001" name="1.6% Moderator" surfaces="10001" universe="10000" />
<cell fill="10001" id="10003" name="root cell" surfaces="10002 -10003 10004 -10005 10006 -10007" universe="0" />
<lattice id="10001" name="1.6% Fuel - 0BA">
<pitch>1.26 1.26</pitch>
<dimension>17 17</dimension>
<lower_left>-10.71 -10.71</lower_left>
<universes>
10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000
10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000
10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000
10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000
10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000
10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000
10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000
10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000
10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000
10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000
10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000
10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000
10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000
10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000
10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000
10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000
10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 </universes>
</lattice>
<surface boundary="transmission" coeffs="0.0 0.0 0.39218" id="10000" type="z-cylinder" />
<surface boundary="transmission" coeffs="0.0 0.0 0.4572" id="10001" type="z-cylinder" />
<surface boundary="reflective" coeffs="-10.71" id="10002" type="x-plane" />
<surface boundary="vacuum" coeffs="10.71" id="10003" type="x-plane" />
<surface boundary="vacuum" coeffs="-10.71" id="10004" type="y-plane" />
<surface boundary="reflective" coeffs="10.71" id="10005" type="y-plane" />
<surface boundary="reflective" coeffs="-10.71" id="10006" type="z-plane" />
<surface boundary="reflective" coeffs="10.71" id="10007" type="z-plane" />
</geometry>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

View file

@ -0,0 +1,20 @@
<?xml version='1.0' encoding='utf-8'?>
<materials>
<default_xs>71c</default_xs>
<material id="10000" name="1.6% Fuel">
<density units="g/cm3" value="10.31341" />
<nuclide ao="0.022625" name="U-238" />
<nuclide ao="0.046007" name="O-16" />
<nuclide ao="0.00037503" name="U-235" />
</material>
<material id="10001" name="Borated Water">
<density units="g/cm3" value="0.740582" />
<nuclide ao="0.024732" name="O-16" />
<nuclide ao="8.0042e-06" name="B-10" />
<nuclide ao="0.049457" name="H-1" />
</material>
<material id="10002" name="Zircaloy">
<density units="g/cm3" value="6.55" />
<nuclide ao="0.0072758" name="Zr-90" />
</material>
</materials>

View file

@ -0,0 +1,8 @@
<?xml version='1.0' encoding='utf-8'?>
<plots>
<plot basis="xy" color="mat" filename="materials-xy" id="1" type="slice">
<origin>0 0 0</origin>
<width>21.5 21.5</width>
<pixels>250 250</pixels>
</plot>
</plots>

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,21 @@
<?xml version='1.0' encoding='utf-8'?>
<settings>
<eigenvalue>
<particles>2500</particles>
<batches>20</batches>
<inactive>5</inactive>
</eigenvalue>
<source>
<space type="box">
<parameters>-10.71 -10.71 -10 10.71 10.71 10.0</parameters>
</space>
</source>
<output>
<tallies>false</tallies>
<summary>true</summary>
</output>
<trigger>
<active>true</active>
<max_batches>200</max_batches>
</trigger>
</settings>

View file

@ -0,0 +1,23 @@
<?xml version='1.0' encoding='utf-8'?>
<tallies>
<mesh id="1" type="regular">
<dimension>17 17</dimension>
<lower_left>-10.71 -10.71</lower_left>
<width>1.26 1.26</width>
</mesh>
<tally id="10000" name="mesh tally">
<filter bins="1" type="mesh" />
<filter bins="0.0 6.25e-07 20.0" type="energy" />
<scores>fission nu-fission</scores>
</tally>
<tally id="10001" name="cell tally">
<filter bins="10000" type="cell" />
<nuclides>U-235 U-238</nuclides>
<scores>scatter-y2</scores>
</tally>
<tally id="10002" name="distribcell tally">
<filter bins="10002" type="distribcell" />
<scores>absorption scatter</scores>
<trigger scores="absorption" threshold="5e-05" type="std_dev" />
</tally>
</tallies>

View file

@ -369,7 +369,7 @@
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAPoAAAD6AgMAAAD1grKuAAAABGdBTUEAALGPC/xhBQAAAAFzUkdC\nAK7OHOkAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAAxQTFRF\n////chIS6YCRTb/E6kGE+wAAAAFiS0dEAIgFHUgAAAAJcEhZcwAAAEgAAABIAEbJaz4AAALKSURB\nVGje7dpLcqQwDAbgHHE2YeEj+D4cwQucBUfo+3CEXoSp8OhuhF70T4qpKXmdr21LogK2Pj7A8QmN\nP+HDhw8fPnz48Kf6VH9G+66vy+je8k19jnf8C5dXIPv86ms56lPdjvaYb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v4P4/tP8Q7n9E+y/h/k+0/xTu\nf4X7b+H+X7T/+BPuf3aM8OHDhw8fPnz4w/4vzcvgeY10sY0AAAAldEVYdGRhdGU6Y3JlYXRlADIw\nMTUtMTAtMDNUMDE6MDM6MjktMDQ6MDDFeHPZAAAAJXRFWHRkYXRlOm1vZGlmeQAyMDE1LTEwLTAz\nVDAxOjAzOjI5LTA0OjAwtCXLZQAAAABJRU5ErkJggg==\n",
"text/plain": [
"<IPython.core.display.Image object>"
]
@ -580,7 +580,7 @@
" 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:24:54\n",
" Date/Time: 2015-10-03 01:03:29\n",
" MPI Processes: 1\n",
"\n",
" ===========================================================================\n",
@ -636,20 +636,20 @@
"\n",
" =======================> TIMING STATISTICS <=======================\n",
"\n",
" Total time for initialization = 7.0100E-01 seconds\n",
" Reading cross sections = 1.5800E-01 seconds\n",
" Total time in simulation = 2.0485E+01 seconds\n",
" Time in transport only = 2.0465E+01 seconds\n",
" Time in inactive batches = 3.0920E+00 seconds\n",
" Time in active batches = 1.7393E+01 seconds\n",
" Time synchronizing fission bank = 5.0000E-03 seconds\n",
" Sampling source sites = 4.0000E-03 seconds\n",
" Total time for initialization = 4.1300E-01 seconds\n",
" Reading cross sections = 9.0000E-02 seconds\n",
" Total time in simulation = 2.1398E+01 seconds\n",
" Time in transport only = 2.1378E+01 seconds\n",
" Time in inactive batches = 2.0260E+00 seconds\n",
" Time in active batches = 1.9372E+01 seconds\n",
" Time synchronizing fission bank = 2.0000E-03 seconds\n",
" Sampling source sites = 0.0000E+00 seconds\n",
" SEND/RECV source sites = 1.0000E-03 seconds\n",
" Time accumulating tallies = 0.0000E+00 seconds\n",
" Total time for finalization = 1.0000E-03 seconds\n",
" Total time elapsed = 2.1200E+01 seconds\n",
" Calculation Rate (inactive) = 4042.69 neutrons/second\n",
" Calculation Rate (active) = 2156.04 neutrons/second\n",
" Time accumulating tallies = 1.0000E-03 seconds\n",
" Total time for finalization = 3.0000E-03 seconds\n",
" Total time elapsed = 2.1823E+01 seconds\n",
" Calculation Rate (inactive) = 6169.79 neutrons/second\n",
" Calculation Rate (active) = 1935.78 neutrons/second\n",
"\n",
" ============================> RESULTS <============================\n",
"\n",
@ -721,7 +721,20 @@
"collapsed": false,
"scrolled": true
},
"outputs": [],
"outputs": [
{
"ename": "KeyError",
"evalue": "10003",
"output_type": "error",
"traceback": [
"\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[1;31mKeyError\u001b[0m Traceback (most recent call last)",
"\u001b[1;32m<ipython-input-25-3cd87b8121ef>\u001b[0m in \u001b[0;36m<module>\u001b[1;34m()\u001b[0m\n\u001b[0;32m 1\u001b[0m \u001b[1;31m# Load the summary file and link with statepoint\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 2\u001b[0m \u001b[0msu\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mSummary\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m'summary.h5'\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m----> 3\u001b[1;33m \u001b[0msp\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mlink_with_summary\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0msu\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m",
"\u001b[1;32m/usr/local/lib/python2.7/dist-packages/openmc-0.7.0-py2.7.egg/openmc/statepoint.pyc\u001b[0m in \u001b[0;36mlink_with_summary\u001b[1;34m(self, summary)\u001b[0m\n\u001b[0;32m 610\u001b[0m \u001b[1;32mfor\u001b[0m \u001b[0mtally_id\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mtally\u001b[0m \u001b[1;32min\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mtallies\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mitems\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 611\u001b[0m \u001b[1;31m# Get the Tally name from the summary file\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 612\u001b[1;33m \u001b[0mtally\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mname\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0msummary\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mtallies\u001b[0m\u001b[1;33m[\u001b[0m\u001b[0mtally_id\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mname\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 613\u001b[0m \u001b[0mtally\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mwith_summary\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mTrue\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 614\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n",
"\u001b[1;31mKeyError\u001b[0m: 10003"
]
}
],
"source": [
"# Load the summary file and link with statepoint\n",
"su = Summary('summary.h5')\n",
@ -739,47 +752,11 @@
},
{
"cell_type": "code",
"execution_count": 26,
"execution_count": null,
"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>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>total</td>\n",
" <td>(nu-fission / absorption)</td>\n",
" <td>1.046353</td>\n",
" <td>0.00935</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" nuclide score mean std. dev.\n",
"0 total (nu-fission / absorption) 1.046353 0.00935"
]
},
"execution_count": 26,
"metadata": {},
"output_type": "execute_result"
}
],
"outputs": [],
"source": [
"# Compute k-infinity using tally arithmetic\n",
"fiss_rate = sp.get_tally(name='fiss. rate')\n",
@ -799,49 +776,11 @@
},
{
"cell_type": "code",
"execution_count": 27,
"execution_count": null,
"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>energy [MeV]</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>(0.0e+00 - 6.2e-01)</td>\n",
" <td>total</td>\n",
" <td>absorption</td>\n",
" <td>0.95873</td>\n",
" <td>0.00774</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" energy [MeV] nuclide score mean std. dev.\n",
"0 (0.0e+00 - 6.2e-01) total absorption 0.95873 0.00774"
]
},
"execution_count": 27,
"metadata": {},
"output_type": "execute_result"
}
],
"outputs": [],
"source": [
"# Compute resonance escape probability using tally arithmetic\n",
"therm_abs_rate = sp.get_tally(name='therm. abs. rate')\n",
@ -859,47 +798,11 @@
},
{
"cell_type": "code",
"execution_count": 28,
"execution_count": null,
"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>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>total</td>\n",
" <td>nu-fission</td>\n",
" <td>1.091622</td>\n",
" <td>0.011163</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" nuclide score mean std. dev.\n",
"0 total nu-fission 1.091622 0.011163"
]
},
"execution_count": 28,
"metadata": {},
"output_type": "execute_result"
}
],
"outputs": [],
"source": [
"# Compute fast fission factor factor using tally arithmetic\n",
"therm_fiss_rate = sp.get_tally(name='therm. fiss. rate')\n",
@ -918,51 +821,11 @@
},
{
"cell_type": "code",
"execution_count": 29,
"execution_count": null,
"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>energy [MeV]</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>(0.0e+00 - 6.2e-01)</td>\n",
" <td>10000</td>\n",
" <td>total</td>\n",
" <td>absorption</td>\n",
" <td>0.802012</td>\n",
" <td>0.006609</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" energy [MeV] cell nuclide score mean std. dev.\n",
"0 (0.0e+00 - 6.2e-01) 10000 total absorption 0.802012 0.006609"
]
},
"execution_count": 29,
"metadata": {},
"output_type": "execute_result"
}
],
"outputs": [],
"source": [
"# Compute thermal flux utilization factor using tally arithmetic\n",
"fuel_therm_abs_rate = sp.get_tally(name='fuel therm. abs. rate')\n",
@ -979,49 +842,11 @@
},
{
"cell_type": "code",
"execution_count": 30,
"execution_count": null,
"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>energy [MeV]</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>(0.0e+00 - 6.2e-01)</td>\n",
" <td>total</td>\n",
" <td>(nu-fission / absorption)</td>\n",
" <td>1.246604</td>\n",
" <td>0.011825</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" energy [MeV] nuclide score mean std. dev.\n",
"0 (0.0e+00 - 6.2e-01) total (nu-fission / absorption) 1.246604 0.011825"
]
},
"execution_count": 30,
"metadata": {},
"output_type": "execute_result"
}
],
"outputs": [],
"source": [
"# Compute neutrons produced per absorption (eta) using tally arithmetic\n",
"eta = therm_fiss_rate / fuel_therm_abs_rate\n",
@ -1037,52 +862,11 @@
},
{
"cell_type": "code",
"execution_count": 31,
"execution_count": null,
"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>energy [MeV]</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>(0.0e+00 - 6.2e-01)</td>\n",
" <td>total</td>\n",
" <td>(((absorption * nu-fission) * absorption) * (n...</td>\n",
" <td>1.046353</td>\n",
" <td>0.01894</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" energy [MeV] nuclide \\\n",
"0 (0.0e+00 - 6.2e-01) total \n",
"\n",
" score mean std. dev. \n",
"0 (((absorption * nu-fission) * absorption) * (n... 1.046353 0.01894 "
]
},
"execution_count": 31,
"metadata": {},
"output_type": "execute_result"
}
],
"outputs": [],
"source": [
"keff = res_esc * fast_fiss * therm_util * eta\n",
"keff.get_pandas_dataframe()"
@ -1099,7 +883,7 @@
},
{
"cell_type": "code",
"execution_count": 32,
"execution_count": null,
"metadata": {
"collapsed": false,
"scrolled": true
@ -1115,131 +899,11 @@
},
{
"cell_type": "code",
"execution_count": 33,
"execution_count": null,
"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>energy [MeV]</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",
" <td>(0.0e+00 - 6.3e-07)</td>\n",
" <td>(U-238 / total)</td>\n",
" <td>(nu-fission / flux)</td>\n",
" <td>6.641746e-07</td>\n",
" <td>6.859257e-09</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>10000</td>\n",
" <td>(0.0e+00 - 6.3e-07)</td>\n",
" <td>(U-238 / total)</td>\n",
" <td>(scatter / flux)</td>\n",
" <td>2.099861e-01</td>\n",
" <td>1.966887e-03</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>10000</td>\n",
" <td>(0.0e+00 - 6.3e-07)</td>\n",
" <td>(U-235 / total)</td>\n",
" <td>(nu-fission / flux)</td>\n",
" <td>3.556665e-01</td>\n",
" <td>3.717881e-03</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>10000</td>\n",
" <td>(0.0e+00 - 6.3e-07)</td>\n",
" <td>(U-235 / total)</td>\n",
" <td>(scatter / flux)</td>\n",
" <td>5.554650e-03</td>\n",
" <td>5.218094e-05</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>10000</td>\n",
" <td>(6.3e-07 - 2.0e+01)</td>\n",
" <td>(U-238 / total)</td>\n",
" <td>(nu-fission / flux)</td>\n",
" <td>7.165057e-03</td>\n",
" <td>5.625590e-05</td>\n",
" </tr>\n",
" <tr>\n",
" <th>5</th>\n",
" <td>10000</td>\n",
" <td>(6.3e-07 - 2.0e+01)</td>\n",
" <td>(U-238 / total)</td>\n",
" <td>(scatter / flux)</td>\n",
" <td>2.276535e-01</td>\n",
" <td>8.544314e-04</td>\n",
" </tr>\n",
" <tr>\n",
" <th>6</th>\n",
" <td>10000</td>\n",
" <td>(6.3e-07 - 2.0e+01)</td>\n",
" <td>(U-235 / total)</td>\n",
" <td>(nu-fission / flux)</td>\n",
" <td>8.089493e-03</td>\n",
" <td>5.080374e-05</td>\n",
" </tr>\n",
" <tr>\n",
" <th>7</th>\n",
" <td>10000</td>\n",
" <td>(6.3e-07 - 2.0e+01)</td>\n",
" <td>(U-235 / total)</td>\n",
" <td>(scatter / flux)</td>\n",
" <td>3.370111e-03</td>\n",
" <td>1.361116e-05</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" cell energy [MeV] nuclide score \\\n",
"0 10000 (0.0e+00 - 6.3e-07) (U-238 / total) (nu-fission / flux) \n",
"1 10000 (0.0e+00 - 6.3e-07) (U-238 / total) (scatter / flux) \n",
"2 10000 (0.0e+00 - 6.3e-07) (U-235 / total) (nu-fission / flux) \n",
"3 10000 (0.0e+00 - 6.3e-07) (U-235 / total) (scatter / flux) \n",
"4 10000 (6.3e-07 - 2.0e+01) (U-238 / total) (nu-fission / flux) \n",
"5 10000 (6.3e-07 - 2.0e+01) (U-238 / total) (scatter / flux) \n",
"6 10000 (6.3e-07 - 2.0e+01) (U-235 / total) (nu-fission / flux) \n",
"7 10000 (6.3e-07 - 2.0e+01) (U-235 / total) (scatter / flux) \n",
"\n",
" mean std. dev. \n",
"0 6.641746e-07 6.859257e-09 \n",
"1 2.099861e-01 1.966887e-03 \n",
"2 3.556665e-01 3.717881e-03 \n",
"3 5.554650e-03 5.218094e-05 \n",
"4 7.165057e-03 5.625590e-05 \n",
"5 2.276535e-01 8.544314e-04 \n",
"6 8.089493e-03 5.080374e-05 \n",
"7 3.370111e-03 1.361116e-05 "
]
},
"execution_count": 33,
"metadata": {},
"output_type": "execute_result"
}
],
"outputs": [],
"source": [
"fuel_xs = fuel_rxn_rates / flux\n",
"fuel_xs.get_pandas_dataframe()"
@ -1254,23 +918,11 @@
},
{
"cell_type": "code",
"execution_count": 34,
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[[[ 6.64174599e-07]\n",
" [ 3.55666541e-01]]\n",
"\n",
" [[ 7.16505734e-03]\n",
" [ 8.08949336e-03]]]\n"
]
}
],
"outputs": [],
"source": [
"# Show how to use Tally.get_values(...) with a CrossScore\n",
"nu_fiss_xs = fuel_xs.get_values(scores=['(nu-fission / flux)'])\n",
@ -1286,21 +938,11 @@
},
{
"cell_type": "code",
"execution_count": 35,
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[[[ 0.00555465]]\n",
"\n",
" [[ 0.00337011]]]\n"
]
}
],
"outputs": [],
"source": [
"# Show how to use Tally.get_values(...) with a CrossScore and CrossNuclide\n",
"u235_scatter_xs = fuel_xs.get_values(nuclides=['(U-235 / total)'], \n",
@ -1310,20 +952,11 @@
},
{
"cell_type": "code",
"execution_count": 36,
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[[[ 0.22765348]\n",
" [ 0.00337011]]]\n"
]
}
],
"outputs": [],
"source": [
"# Show how to use Tally.get_values(...) with a CrossFilter and CrossScore\n",
"fast_scatter_xs = fuel_xs.get_values(filters=['energy'], \n",
@ -1341,81 +974,11 @@
},
{
"cell_type": "code",
"execution_count": 37,
"execution_count": null,
"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>energy [MeV]</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",
" <td>(0.0e+00 - 6.3e-07)</td>\n",
" <td>U-238</td>\n",
" <td>nu-fission</td>\n",
" <td>0.000002</td>\n",
" <td>1.284890e-08</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>10000</td>\n",
" <td>(0.0e+00 - 6.3e-07)</td>\n",
" <td>U-235</td>\n",
" <td>nu-fission</td>\n",
" <td>0.867982</td>\n",
" <td>7.022256e-03</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>10000</td>\n",
" <td>(6.3e-07 - 2.0e+01)</td>\n",
" <td>U-238</td>\n",
" <td>nu-fission</td>\n",
" <td>0.082801</td>\n",
" <td>6.087096e-04</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>10000</td>\n",
" <td>(6.3e-07 - 2.0e+01)</td>\n",
" <td>U-235</td>\n",
" <td>nu-fission</td>\n",
" <td>0.093484</td>\n",
" <td>5.275039e-04</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" cell energy [MeV] nuclide score mean std. dev.\n",
"0 10000 (0.0e+00 - 6.3e-07) U-238 nu-fission 0.000002 1.284890e-08\n",
"1 10000 (0.0e+00 - 6.3e-07) U-235 nu-fission 0.867982 7.022256e-03\n",
"2 10000 (6.3e-07 - 2.0e+01) U-238 nu-fission 0.082801 6.087096e-04\n",
"3 10000 (6.3e-07 - 2.0e+01) U-235 nu-fission 0.093484 5.275039e-04"
]
},
"execution_count": 37,
"metadata": {},
"output_type": "execute_result"
}
],
"outputs": [],
"source": [
"# \"Slice\" the nu-fission data into a new derived Tally\n",
"nu_fission_rates = fuel_rxn_rates.get_slice(scores=['nu-fission'])\n",
@ -1424,131 +987,11 @@
},
{
"cell_type": "code",
"execution_count": 38,
"execution_count": null,
"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>energy [MeV]</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>10002</td>\n",
" <td>(1.0e-08 - 1.1e-07)</td>\n",
" <td>H-1</td>\n",
" <td>scatter</td>\n",
" <td>4.620525</td>\n",
" <td>0.038249</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>10002</td>\n",
" <td>(1.1e-07 - 1.2e-06)</td>\n",
" <td>H-1</td>\n",
" <td>scatter</td>\n",
" <td>2.036841</td>\n",
" <td>0.013203</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>10002</td>\n",
" <td>(1.2e-06 - 1.3e-05)</td>\n",
" <td>H-1</td>\n",
" <td>scatter</td>\n",
" <td>1.659916</td>\n",
" <td>0.010107</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>10002</td>\n",
" <td>(1.3e-05 - 1.4e-04)</td>\n",
" <td>H-1</td>\n",
" <td>scatter</td>\n",
" <td>1.861546</td>\n",
" <td>0.013328</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>10002</td>\n",
" <td>(1.4e-04 - 1.5e-03)</td>\n",
" <td>H-1</td>\n",
" <td>scatter</td>\n",
" <td>2.049664</td>\n",
" <td>0.008215</td>\n",
" </tr>\n",
" <tr>\n",
" <th>5</th>\n",
" <td>10002</td>\n",
" <td>(1.5e-03 - 1.6e-02)</td>\n",
" <td>H-1</td>\n",
" <td>scatter</td>\n",
" <td>2.162157</td>\n",
" <td>0.010245</td>\n",
" </tr>\n",
" <tr>\n",
" <th>6</th>\n",
" <td>10002</td>\n",
" <td>(1.6e-02 - 1.7e-01)</td>\n",
" <td>H-1</td>\n",
" <td>scatter</td>\n",
" <td>2.224496</td>\n",
" <td>0.013796</td>\n",
" </tr>\n",
" <tr>\n",
" <th>7</th>\n",
" <td>10002</td>\n",
" <td>(1.7e-01 - 1.9e+00)</td>\n",
" <td>H-1</td>\n",
" <td>scatter</td>\n",
" <td>1.997585</td>\n",
" <td>0.009161</td>\n",
" </tr>\n",
" <tr>\n",
" <th>8</th>\n",
" <td>10002</td>\n",
" <td>(1.9e+00 - 2.0e+01)</td>\n",
" <td>H-1</td>\n",
" <td>scatter</td>\n",
" <td>0.373472</td>\n",
" <td>0.003922</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" cell energy [MeV] nuclide score mean std. dev.\n",
"0 10002 (1.0e-08 - 1.1e-07) H-1 scatter 4.620525 0.038249\n",
"1 10002 (1.1e-07 - 1.2e-06) H-1 scatter 2.036841 0.013203\n",
"2 10002 (1.2e-06 - 1.3e-05) H-1 scatter 1.659916 0.010107\n",
"3 10002 (1.3e-05 - 1.4e-04) H-1 scatter 1.861546 0.013328\n",
"4 10002 (1.4e-04 - 1.5e-03) H-1 scatter 2.049664 0.008215\n",
"5 10002 (1.5e-03 - 1.6e-02) H-1 scatter 2.162157 0.010245\n",
"6 10002 (1.6e-02 - 1.7e-01) H-1 scatter 2.224496 0.013796\n",
"7 10002 (1.7e-01 - 1.9e+00) H-1 scatter 1.997585 0.009161\n",
"8 10002 (1.9e+00 - 2.0e+01) H-1 scatter 0.373472 0.003922"
]
},
"execution_count": 38,
"metadata": {},
"output_type": "execute_result"
}
],
"outputs": [],
"source": [
"# \"Slice\" the H-1 scatter data in the moderator Cell into a new derived Tally\n",
"need_to_slice = sp.get_tally(name='need-to-slice')\n",

View file

@ -1612,26 +1612,23 @@ class Tally(object):
if self.filters != other.filters:
self_shape = list(self.mean.shape)
other_shape = list(other.mean.shape)
# FIXME:
# Determine the number of paired combinations of filter bins
# between the two tallies and repeat arrays along filter axes
diff1 = list(set(self.filters).difference(set(other.filters)))
diff2 = list(set(other.filters).difference(set(self.filters)))
#
# Determine the factors by which each tally operands' data arrays
# must be tiled or repeated for the tally outer product
other_tile_factor = 1
self_repeat_factor = 1
#
for filter in diff1:
other_tile_factor *= filter.num_bins
for filter in diff2:
self_repeat_factor *= filter.num_bins
# Replicate the data
# Tile / repeat the tally data for the tally outer product
self_shape = list(self.mean.shape)
other_shape = list(other.mean.shape)
self_shape[0] *= self_repeat_factor
self_mean = np.repeat(self_mean, self_repeat_factor)
self_std_dev = np.repeat(self_std_dev, self_repeat_factor)
@ -1644,6 +1641,8 @@ class Tally(object):
other_mean = np.tile(other_mean, (other_tile_factor, 1, 1))
other_std_dev = np.tile(other_std_dev, (other_tile_factor, 1, 1))
# NumPy repeat and tile routines return 1D flattened arrays
# Reshape arrays as 3D with filters, nuclides and scores axes
self_mean.shape = tuple(self_shape)
self_std_dev.shape = tuple(self_shape)
other_mean.shape = tuple(other_shape)
@ -1656,14 +1655,15 @@ class Tally(object):
self_repeat_factor = other.num_nuclides
other_tile_factor = self.num_nuclides
self_shape = list(self.mean.shape)
# Replicate the data
self_mean = np.repeat(self_mean, self_repeat_factor, axis=1)
other_mean = np.tile(other_mean, (1, other_tile_factor, 1))
self_std_dev = np.repeat(self_std_dev, self_repeat_factor, axis=1)
other_std_dev = np.tile(other_std_dev, (1, other_tile_factor, 1))
# NumPy repeat and tile routines return 1D flattened arrays
# Reshape arrays as 3D with filters, nuclides and scores axes
self_shape = list(self.mean.shape)
self_shape[1] *= self_repeat_factor
self_mean.shape = tuple(self_shape)
self_std_dev.shape = tuple(self_shape)
@ -1675,14 +1675,15 @@ class Tally(object):
self_repeat_factor = other.num_score_bins
other_tile_factor = self.num_score_bins
self_shape = list(self.mean.shape)
# Replicate the data
self_mean = np.repeat(self_mean, self_repeat_factor, axis=2)
other_mean = np.tile(other_mean, (1, 1, other_tile_factor))
self_std_dev = np.repeat(self_std_dev, self_repeat_factor, axis=2)
other_std_dev = np.tile(other_std_dev, (1, 1, other_tile_factor))
# NumPy repeat and tile routines return 1D flattened arrays
# Reshape arrays as 3D with filters, nuclides and scores axes
self_shape = list(self.mean.shape)
self_shape[2] *= self_repeat_factor
self_mean.shape = tuple(self_shape)
self_std_dev.shape = tuple(self_shape)
@ -1697,11 +1698,31 @@ class Tally(object):
return data
def swap_filters(self, filter1, filter2):
"""
"""Reverse the ordering of two filters in this tally
This is a helper routine for tally arithmetic which helps align the data
in two tallies with shared filters. This routine copies this tally and
reverses the order of the two filters.
Parameters
----------
filter1 : Filter
The filter to swap with filter2
filter2 : Filter
The filter to swap with filter1
Returns
-------
swap_tally
A copy of this tally with the filters swapped
Raises
------
ValueError
If this is a derived tally or this method is called before the tally
is populated with data by the StatePoint.read_results() method.
:param filter1:
:param filter2:
:return:
"""
# Check that results have been read
@ -1739,6 +1760,7 @@ class Tally(object):
filter.stride = stride
stride *= filter.num_bins
# Construct lists of tuples for the bins in each of the two filters
filters = [filter1.type, filter2.type]
if filter1.type == 'distribcell':
filter1_bins = np.arange(filter.num_bins)
@ -1750,6 +1772,7 @@ class Tally(object):
else:
filter2_bins = [filter2.get_bin(i) for i in range(filter2.num_bins)]
# Adjust the sum data array to relect the new filter order
if self.sum is not None:
for bin1, bin2 in itertools.product(filter1_bins, filter2_bins):
filter_bins = [(bin1,), (bin2,)]
@ -1758,6 +1781,7 @@ class Tally(object):
indices = swap_tally.get_filter_indices(filters, filter_bins)
swap_tally.sum[indices, :, :] = data
# Adjust the sum_sq data array to relect the new filter order
if self.sum_sq is not None:
for bin1, bin2 in itertools.product(filter1_bins, filter2_bins):
filter_bins = [(bin1,), (bin2,)]
@ -1766,7 +1790,8 @@ class Tally(object):
indices = swap_tally.get_filter_indices(filters, filter_bins)
swap_tally.sum_sq[indices, :, :] = data
if self.sum is not None:
# Adjust the mean data array to relect the new filter order
if self.mean is not None:
for bin1, bin2 in itertools.product(filter1_bins, filter2_bins):
filter_bins = [(bin1,), (bin2,)]
data = self.get_values(filters=filters,
@ -1774,7 +1799,8 @@ class Tally(object):
indices = swap_tally.get_filter_indices(filters, filter_bins)
swap_tally._mean[indices, :, :] = data
if self.sum is not None:
# Adjust the std_dev data array to relect the new filter order
if self.std_dev is not None:
for bin1, bin2 in itertools.product(filter1_bins, filter2_bins):
filter_bins = [(bin1,), (bin2,)]
data = self.get_values(filters=filters,