From b1d309faaa92e416c3df41cab5fed0dbfc7600de Mon Sep 17 00:00:00 2001 From: Cyrus Wyett <34195737+cjwyett@users.noreply.github.com> Date: Wed, 26 Aug 2020 05:16:47 +0100 Subject: [PATCH] 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. --- examples/jupyter/candu.ipynb | 22 +++++++++++----------- examples/jupyter/triso.ipynb | 26 +++++++++++++------------- 2 files changed, 24 insertions(+), 24 deletions(-) diff --git a/examples/jupyter/candu.ipynb b/examples/jupyter/candu.ipynb index 672d56f89..b078d8ac6 100644 --- a/examples/jupyter/candu.ipynb +++ b/examples/jupyter/candu.ipynb @@ -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, diff --git a/examples/jupyter/triso.ipynb b/examples/jupyter/triso.ipynb index 1934433e9..882463efc 100644 --- a/examples/jupyter/triso.ipynb +++ b/examples/jupyter/triso.ipynb @@ -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,