From 6bb64b0303a157b928b88171a83deac5efe26268 Mon Sep 17 00:00:00 2001 From: Jonathan Shimwell Date: Tue, 28 Mar 2023 16:05:20 +0100 Subject: [PATCH] updated readme with gammas spec image --- .flake8 | 3 --- .gitignore | 1 + README.md | 27 +++++++++++++++++++++++++++ examples/example_gamma_spec_plot.py | 4 ++-- src/openmc_source_plotter/_version.py | 4 ---- 5 files changed, 30 insertions(+), 9 deletions(-) delete mode 100644 .flake8 delete mode 100644 src/openmc_source_plotter/_version.py diff --git a/.flake8 b/.flake8 deleted file mode 100644 index ebc6dca..0000000 --- a/.flake8 +++ /dev/null @@ -1,3 +0,0 @@ -[flake8] -per-file-ignores = - */__init__.py: F401 diff --git a/.gitignore b/.gitignore index 841e024..dd2e09f 100644 --- a/.gitignore +++ b/.gitignore @@ -137,3 +137,4 @@ openmc_source_plotter/_version.py # plots *.png +src/openmc_source_plotter/_version.py diff --git a/README.md b/README.md index 06e7ec5..27ff524 100644 --- a/README.md +++ b/README.md @@ -91,6 +91,31 @@ plot.show() ![openmc particle source direction plot](https://user-images.githubusercontent.com/8583900/143615706-3b3a8467-0233-42d6-a66c-d536c80a01d8.png) + +## Plot gamma spectrum of particles + +```python +import openmc +import openmc_source_plotter # adds plot_gamma_emission plot to materials + + +openmc.config["chain_file"] = "chain-endf.xml" + +my_material = openmc.Material() +my_material.add_nuclide("Xe135", 1e-12) +my_material.add_nuclide("U235", 1) +my_material.add_nuclide("U238", 1) +my_material.add_nuclide("Co60", 1e-9) +my_material.volume = 1 # must be set so number of atoms can be found + +# adds labels to the most active 3 gamma energies +plt = my_material.plot_gamma_emission(label_top=3) +plt.xscale("log") # modify axis from default settings +plt.savefig("gamma_spec.png") +``` + +![openmc gamma spectrum](https://user-images.githubusercontent.com/8583900/228280129-b8160e18-9ca9-4b20-a4e1-d2948908daf6.png) + ## Plot position of particles ```python @@ -121,7 +146,9 @@ plot = my_source.plot_source_position() plot.show() ``` + ![openmc particle source position plot](https://user-images.githubusercontent.com/8583900/179424915-bee56a87-6214-46ef-8625-92b8f4cbd1b3.png) Tokamak sources can also be plotted using the [openmc-plasma-source](https://github.com/fusion-energy/openmc-plasma-source) package + ![openmc_source_plotter_openmc-plasma-source_tokamak](https://user-images.githubusercontent.com/8583900/187487894-ba0bd025-46f2-4c7d-8b15-3d260aed47a0.png) diff --git a/examples/example_gamma_spec_plot.py b/examples/example_gamma_spec_plot.py index 17bb3a7..1fdcaf2 100644 --- a/examples/example_gamma_spec_plot.py +++ b/examples/example_gamma_spec_plot.py @@ -1,5 +1,4 @@ import openmc -import openmc.deplete import openmc_source_plotter # adds plot_gamma_emission plot to materials @@ -10,8 +9,9 @@ my_material.add_nuclide("U235", 1) my_material.add_nuclide("U238", 1) my_material.add_nuclide("Co60", 1e-9) -my_material.volume = 1 +my_material.volume = 1 # must be set so number of atoms can be found +# adds labels to the most active 3 gamma energies plt = my_material.plot_gamma_emission(label_top=3) plt.xscale("log") # modify axis from default settings plt.savefig("gamma_spec.png") diff --git a/src/openmc_source_plotter/_version.py b/src/openmc_source_plotter/_version.py deleted file mode 100644 index e84868b..0000000 --- a/src/openmc_source_plotter/_version.py +++ /dev/null @@ -1,4 +0,0 @@ -# file generated by setuptools_scm -# don't change, don't track in version control -__version__ = version = '0.6.3.dev13+ga984b5e' -__version_tuple__ = version_tuple = (0, 6, 3, 'dev13', 'ga984b5e')