Clearer naming in candu and triso

There is a loop in candu that isn't incredibly readable, although I'm not quite sure how/if it can be improved:
`for i, (r, n, a) in enumerate(zip(ring_radii, num_pins, angles)):
    for j in range(n):`
Also de-abbreviated some of triso, e.g:
`trisos = [openmc.model.TRISO(outer_radius, triso_univ, c) for c in centers]`
Became:
`trisos = [openmc.model.TRISO(outer_radius, triso_univ, center) for center in centers]`

Let me know if you don't like it and it'll be changed.
This commit is contained in:
Cyrus Wyett 2020-08-26 05:16:47 +01:00 committed by GitHub
parent 148ca44c45
commit b1d309faaa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 24 additions and 24 deletions

View file

@ -304,11 +304,11 @@
"metadata": {},
"outputs": [],
"source": [
"geom = openmc.Geometry(root_universe)\n",
"geom.export_to_xml()\n",
"geometry = openmc.Geometry(root_universe)\n",
"geometry.export_to_xml()\n",
"\n",
"mats = openmc.Materials(geom.get_all_materials().values())\n",
"mats.export_to_xml()"
"materials = openmc.Materials(geometry.get_all_materials().values())\n",
"materials.export_to_xml()"
]
},
{
@ -329,14 +329,14 @@
}
],
"source": [
"p = openmc.Plot.from_geometry(geom)\n",
"p.color_by = 'material'\n",
"p.colors = {\n",
"plot = openmc.Plot.from_geometry(geometry)\n",
"plot.color_by = 'material'\n",
"plot.colors = {\n",
" fuel: 'black',\n",
" clad: 'silver',\n",
" heavy_water: 'blue'\n",
"}\n",
"p.to_ipython_image()"
"plot.to_ipython_image()"
]
},
{
@ -1078,8 +1078,8 @@
}
],
"source": [
"t = sp.get_tally()\n",
"t.get_pandas_dataframe()"
"output_tally = sp.get_tally()\n",
"output_tally.get_pandas_dataframe()"
]
},
{
@ -1107,7 +1107,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.0"
"version": "3.8.5"
}
},
"nbformat": 4,

View file

@ -143,7 +143,7 @@
"metadata": {},
"outputs": [],
"source": [
"trisos = [openmc.model.TRISO(outer_radius, triso_univ, c) for c in centers]"
"trisos = [openmc.model.TRISO(outer_radius, triso_univ, center) for center in centers]"
]
},
{
@ -199,7 +199,7 @@
}
],
"source": [
"centers = np.vstack([t.center for t in trisos])\n",
"centers = np.vstack([triso.center for triso in trisos])\n",
"print(centers.min(axis=0))\n",
"print(centers.max(axis=0))"
]
@ -293,20 +293,20 @@
}
],
"source": [
"univ = openmc.Universe(cells=[box])\n",
"universe = openmc.Universe(cells=[box])\n",
"\n",
"geom = openmc.Geometry(univ)\n",
"geom.export_to_xml()\n",
"geometry = openmc.Geometry(universe)\n",
"geometry.export_to_xml()\n",
"\n",
"mats = list(geom.get_all_materials().values())\n",
"openmc.Materials(mats).export_to_xml()\n",
"materials = list(geometry.get_all_materials().values())\n",
"openmc.Materials(materials).export_to_xml()\n",
"\n",
"settings = openmc.Settings()\n",
"settings.run_mode = 'plot'\n",
"settings.export_to_xml()\n",
"\n",
"p = openmc.Plot.from_geometry(geom)\n",
"p.to_ipython_image()"
"plot = openmc.Plot.from_geometry(geometry)\n",
"plot.to_ipython_image()"
]
},
{
@ -334,9 +334,9 @@
}
],
"source": [
"p.color_by = 'material'\n",
"p.colors = {graphite: 'gray'}\n",
"p.to_ipython_image()"
"plot.color_by = 'material'\n",
"plot.colors = {graphite: 'gray'}\n",
"plot.to_ipython_image()"
]
}
],
@ -357,7 +357,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.0"
"version": "3.8.5"
}
},
"nbformat": 4,