diff --git a/README.md b/README.md index 9271b7c..7db130c 100644 --- a/README.md +++ b/README.md @@ -31,127 +31,35 @@ Below are some basic examples, for more examples see the [examples folder](https ## Plot of energy distribution of the source -```python -import openmc -import openmc_source_plotter # extends openmc.IndependentSource with plotting functions - -# initialises a new source object -my_source = openmc.IndependentSource() - -# sets the energy distribution to a muir distribution neutrons for DT fusion neutrons -my_source.energy = openmc.stats.muir(e0=14080000.0, m_rat=5.0, kt=20000.0) - -# plots the particle energy distribution -plot = my_source.plot_source_energy(n_samples=2000) - -plot.show() -``` +:link:[Link](https://github.com/fusion-energy/openmc_source_plotter/blob/main/examples/example_plot_source_energy.py) to example script. ![openmc particle source energy plot](https://user-images.githubusercontent.com/8583900/143615694-a3578115-f8a2-4971-bf26-458177b4f113.png) ## Plot of energy distribution of two sources -```python -import openmc -import openmc_source_plotter # extends openmc.IndependentSource with plotting functions - -# initialises a new source object -my_dt_source = openmc.IndependentSource() - -# sets the energy distribution to a muir distribution DT neutrons -my_dt_source.energy = openmc.stats.muir(e0=14080000.0, m_rat=5.0, kt=20000.0) - -# initialises a new source object -my_dd_source = openmc.IndependentSource() -# sets the energy distribution to a muir distribution DD neutrons -my_dd_source.energy = openmc.stats.muir(e0=2080000.0, m_rat=2.0, kt=20000.0) - -# plots the particle energy distribution by building on the first plot -figure1 = my_dd_source.plot_source_energy(n_samples=10000) -figure2 = my_dt_source.plot_source_energy(figure=figure1, n_samples=10000) - -figure2.show() -``` +:link:[Link](https://github.com/fusion-energy/openmc_source_plotter/blob/main/examples/example_plot_two_source_energies.py) to example script. ![openmc particle source energy plot](https://user-images.githubusercontent.com/8583900/151376414-fb1555eb-61d1-4c82-bc4d-a05f62819c5d.png) ## Plot direction of particles -```python -import openmc -import openmc_source_plotter # extends openmc.IndependentSource with plotting functions - -# initializes a new source object -my_source = openmc.IndependentSource() - -# sets the direction to isotropic -my_source.angle = openmc.stats.Isotropic() - -# plots the particle energy distribution -plot = my_source.plot_source_direction(n_samples=200) - -plot.show() -``` +:link:[Link](https://github.com/fusion-energy/openmc_source_plotter/blob/main/examples/example_plot_source_direction.py) to example script. ![openmc particle source direction plot](https://user-images.githubusercontent.com/8583900/143615706-3b3a8467-0233-42d6-a66c-d536c80a01d8.png) - - ## Plot position of particles -```python -import openmc -import openmc_source_plotter # extends openmc.IndependentSource with plotting functions - -# initialises a new source object -my_source = openmc.IndependentSource() - -# the distribution of radius is just a single value -radius = openmc.stats.Discrete([10], [1]) +:link:[Link](https://github.com/fusion-energy/openmc_source_plotter/blob/main/examples/example_plot_source_position.py) to example script. -# the distribution of source z values is just a single value -z_values = openmc.stats.Discrete([0], [1]) -# the distribution of source azimuthal angles -# values is a uniform distribution between 0 and 2 Pi -angle = openmc.stats.Uniform(a=0.0, b=2 * 3.14159265359) - -# this makes the ring source using the three distributions and a radius -my_source.space = openmc.stats.CylindricalIndependent( - r=radius, phi=angle, z=z_values, origin=(0.0, 0.0, 0.0) -) +![openmc particle source position plot](https://user-images.githubusercontent.com/8583900/179424915-bee56a87-6214-46ef-8625-92b8f4cbd1b3.png) -# plots the particle energy distribution -plot = my_source.plot_source_position() +## Plot labeled gamma lines from material -plot.show() -``` +:link:[Link](https://github.com/fusion-energy/openmc_source_plotter/blob/main/examples/example_gamma_spec_plot.py) to example script. - -![openmc particle source position plot](https://user-images.githubusercontent.com/8583900/179424915-bee56a87-6214-46ef-8625-92b8f4cbd1b3.png) +![gamma spec with labels](examples/gamma_spec.png) ## Extract particle objects diff --git a/examples/example_gamma_spec_plot.py b/examples/example_gamma_spec_plot.py index 1fdcaf2..f87ea70 100644 --- a/examples/example_gamma_spec_plot.py +++ b/examples/example_gamma_spec_plot.py @@ -1,8 +1,8 @@ import openmc import openmc_source_plotter # adds plot_gamma_emission plot to materials - -openmc.config["chain_file"] = "chain-endf.xml" +# this path will need changing to point to your chain file +# openmc.config["chain_file"] = "chain-endf.xml" my_material = openmc.Material() my_material.add_nuclide("Xe135", 1e-12) diff --git a/examples/gamma_spec.png b/examples/gamma_spec.png new file mode 100644 index 0000000..94d00ce Binary files /dev/null and b/examples/gamma_spec.png differ