Skip to content

Commit

Permalink
Merge pull request #30 from fusion-energy/adding_gamma_to_readme
Browse files Browse the repository at this point in the history
updated readme with gammas spec image
  • Loading branch information
shimwell authored Mar 28, 2023
2 parents bb9ae3e + ed7401f commit 58e8159
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 9 deletions.
3 changes: 0 additions & 3 deletions .flake8

This file was deleted.

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -137,3 +137,4 @@ openmc_source_plotter/_version.py

# plots
*.png
src/openmc_source_plotter/_version.py
27 changes: 27 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
4 changes: 2 additions & 2 deletions examples/example_gamma_spec_plot.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import openmc
import openmc.deplete
import openmc_source_plotter # adds plot_gamma_emission plot to materials


Expand All @@ -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")
4 changes: 0 additions & 4 deletions src/openmc_source_plotter/_version.py

This file was deleted.

0 comments on commit 58e8159

Please sign in to comment.