Name | openmc-source-plotter JSON |
Version |
0.7.1
JSON |
| download |
home_page | None |
Summary | A Python package for extracting and plotting the locations, directions, energy distributions of OpenMC source particles. |
upload_time | 2024-05-10 21:37:05 |
maintainer | None |
docs_url | None |
author | None |
requires_python | >=3.8 |
license | MIT License Copyright (c) 2021 Fusion Energy Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
keywords |
energy
plot
source
particle
coordinates
direction
openmc
gamma
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
[![CI with install](https://github.com/fusion-energy/openmc_source_plotter/actions/workflows/ci_with_install.yml/badge.svg?branch=main)](https://github.com/fusion-energy/openmc_source_plotter/actions/workflows/ci_with_install.yml)
[![Upload Python Package](https://github.com/fusion-energy/openmc_source_plotter/actions/workflows/python-publish.yml/badge.svg)](https://github.com/fusion-energy/openmc_source_plotter/actions/workflows/python-publish.yml)
A Python package for plotting the positions, directions or energy distributions of OpenMC sources.
# Installation
You will need to have OpenMC version 0.14.0 or newer installed first.
```bash
pip install openmc_source_plotter
```
# Features
The package provides three plotting functions that can plot source data from openmc objects.
- ```plot_source_energy```
- ```plot_source_position```
- ```plot_source_direction```
- ```plot_gamma_emission```
Additionally the package provides a convienient method of sampling particles
- ```sample_initial_particles```
# Example plots
Below are some basic examples, for more examples see the [examples folder](https://github.com/fusion-energy/openmc_source_plotter/tree/main/examples) for example usage scripts.
## Plot of energy distribution of the source
: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
: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
: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
:link:[Link](https://github.com/fusion-energy/openmc_source_plotter/blob/main/examples/example_plot_source_position.py) to example script.
![openmc particle source position plot](https://user-images.githubusercontent.com/8583900/179424915-bee56a87-6214-46ef-8625-92b8f4cbd1b3.png)
## Plot labeled gamma lines from material
:link:[Link](https://github.com/fusion-energy/openmc_source_plotter/blob/main/examples/example_gamma_spec_plot.py) to example script.
![gamma spec with labels](examples/gamma_spec.png)
## Extract particle objects
A list of ```openmc.Particle``` objects can be obtained using ```model.sample_initial_particles()``` or ```openmc.SourceBase.sample_initial_particles()```
```python
import openmc
from openmc_source_plotter import sample_initial_particles
settings = openmc.Settings()
settings.particles = 1
settings.batches = 1
my_source = openmc.IndependentSource()
my_source.energy = openmc.stats.muir(e0=14080000.0, m_rat=5.0, kt=20000.0)
settings.source = my_source
materials = openmc.Materials()
sph = openmc.Sphere(r=100, boundary_type="vacuum")
cell = openmc.Cell(region=-sph)
geometry = openmc.Geometry([cell])
model = openmc.Model(geometry, materials, settings)
particles = sample_initial_particles(this=model, n_samples=10)
print(particles)
>>>[<SourceParticle: neutron at E=1.440285e+07 eV>, <SourceParticle: neutron at E=1.397691e+07 eV>, <SourceParticle: neutron at E=1.393681e+07 eV>, <SourceParticle: neutron at E=1.470896e+07 eV>, <SourceParticle: neutron at E=1.460563e+07 eV>, <SourceParticle: neutron at E=1.420684e+07 eV>, <SourceParticle: neutron at E=1.413932e+07 eV>, <SourceParticle: neutron at E=1.412428e+07 eV>, <SourceParticle: neutron at E=1.464779e+07 eV>, <SourceParticle: neutron at E=1.391648e+07 eV>]
print(particles[0].E)
>>>1.440285e+07
```
## Related packages
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)
Raw data
{
"_id": null,
"home_page": null,
"name": "openmc-source-plotter",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": "energy, plot, source, particle, coordinates, direction, openmc, gamma",
"author": null,
"author_email": "Jonathan Shimwell <mail@jshimwell.com>",
"download_url": "https://files.pythonhosted.org/packages/44/a3/1ddd44ea7720a14fbeb6b467885dee890ef5cf6e7061b8f51f46067b3f47/openmc_source_plotter-0.7.1.tar.gz",
"platform": null,
"description": "[![CI with install](https://github.com/fusion-energy/openmc_source_plotter/actions/workflows/ci_with_install.yml/badge.svg?branch=main)](https://github.com/fusion-energy/openmc_source_plotter/actions/workflows/ci_with_install.yml)\n\n[![Upload Python Package](https://github.com/fusion-energy/openmc_source_plotter/actions/workflows/python-publish.yml/badge.svg)](https://github.com/fusion-energy/openmc_source_plotter/actions/workflows/python-publish.yml)\n\nA Python package for plotting the positions, directions or energy distributions of OpenMC sources.\n\n# Installation\n\nYou will need to have OpenMC version 0.14.0 or newer installed first.\n\n```bash\npip install openmc_source_plotter\n```\n\n# Features\n\nThe package provides three plotting functions that can plot source data from openmc objects.\n- ```plot_source_energy```\n- ```plot_source_position```\n- ```plot_source_direction```\n- ```plot_gamma_emission```\n \nAdditionally the package provides a convienient method of sampling particles\n- ```sample_initial_particles```\n\n\n# Example plots\n\nBelow are some basic examples, for more examples see the [examples folder](https://github.com/fusion-energy/openmc_source_plotter/tree/main/examples) for example usage scripts.\n\n\n## Plot of energy distribution of the source\n\n:link:[Link](https://github.com/fusion-energy/openmc_source_plotter/blob/main/examples/example_plot_source_energy.py) to example script.\n\n![openmc particle source energy plot](https://user-images.githubusercontent.com/8583900/143615694-a3578115-f8a2-4971-bf26-458177b4f113.png)\n\n## Plot of energy distribution of two sources\n\n:link:[Link](https://github.com/fusion-energy/openmc_source_plotter/blob/main/examples/example_plot_two_source_energies.py) to example script.\n\n![openmc particle source energy plot](https://user-images.githubusercontent.com/8583900/151376414-fb1555eb-61d1-4c82-bc4d-a05f62819c5d.png)\n\n## Plot direction of particles\n\n:link:[Link](https://github.com/fusion-energy/openmc_source_plotter/blob/main/examples/example_plot_source_direction.py) to example script.\n\n![openmc particle source direction plot](https://user-images.githubusercontent.com/8583900/143615706-3b3a8467-0233-42d6-a66c-d536c80a01d8.png)\n\n\n## Plot position of particles\n\n:link:[Link](https://github.com/fusion-energy/openmc_source_plotter/blob/main/examples/example_plot_source_position.py) to example script.\n\n\n![openmc particle source position plot](https://user-images.githubusercontent.com/8583900/179424915-bee56a87-6214-46ef-8625-92b8f4cbd1b3.png)\n\n## Plot labeled gamma lines from material\n\n:link:[Link](https://github.com/fusion-energy/openmc_source_plotter/blob/main/examples/example_gamma_spec_plot.py) to example script.\n\n![gamma spec with labels](examples/gamma_spec.png)\n\n\n## Extract particle objects\n\nA list of ```openmc.Particle``` objects can be obtained using ```model.sample_initial_particles()``` or ```openmc.SourceBase.sample_initial_particles()```\n\n```python\nimport openmc\nfrom openmc_source_plotter import sample_initial_particles\n\nsettings = openmc.Settings()\nsettings.particles = 1\nsettings.batches = 1\nmy_source = openmc.IndependentSource()\nmy_source.energy = openmc.stats.muir(e0=14080000.0, m_rat=5.0, kt=20000.0)\nsettings.source = my_source\nmaterials = openmc.Materials()\nsph = openmc.Sphere(r=100, boundary_type=\"vacuum\")\ncell = openmc.Cell(region=-sph)\ngeometry = openmc.Geometry([cell])\n\nmodel = openmc.Model(geometry, materials, settings)\n\nparticles = sample_initial_particles(this=model, n_samples=10)\n\nprint(particles)\n>>>[<SourceParticle: neutron at E=1.440285e+07 eV>, <SourceParticle: neutron at E=1.397691e+07 eV>, <SourceParticle: neutron at E=1.393681e+07 eV>, <SourceParticle: neutron at E=1.470896e+07 eV>, <SourceParticle: neutron at E=1.460563e+07 eV>, <SourceParticle: neutron at E=1.420684e+07 eV>, <SourceParticle: neutron at E=1.413932e+07 eV>, <SourceParticle: neutron at E=1.412428e+07 eV>, <SourceParticle: neutron at E=1.464779e+07 eV>, <SourceParticle: neutron at E=1.391648e+07 eV>]\n\nprint(particles[0].E)\n>>>1.440285e+07\n```\n\n## Related packages\n\nTokamak sources can also be plotted using the [openmc-plasma-source](https://github.com/fusion-energy/openmc-plasma-source) package\n\n![openmc_source_plotter_openmc-plasma-source_tokamak](https://user-images.githubusercontent.com/8583900/187487894-ba0bd025-46f2-4c7d-8b15-3d260aed47a0.png)\n",
"bugtrack_url": null,
"license": "MIT License Copyright (c) 2021 Fusion Energy Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ",
"summary": "A Python package for extracting and plotting the locations, directions, energy distributions of OpenMC source particles.",
"version": "0.7.1",
"project_urls": {
"Bug Tracker": "https://github.com/fusion-energy/openmc_source_plotter/issues",
"Homepage": "https://github.com/fusion-energy/openmc_source_plotter"
},
"split_keywords": [
"energy",
" plot",
" source",
" particle",
" coordinates",
" direction",
" openmc",
" gamma"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "034fa98767c90e9307b69a584685ce507860ede7ec181fd8656fea478d5b02c7",
"md5": "9b2b7f3852a0120b9ee97142c104e76a",
"sha256": "bcdb5b3b1bb0f8d18797a0ee7a15f91e302e46a15f7c327f6fcea9a741ce98b9"
},
"downloads": -1,
"filename": "openmc_source_plotter-0.7.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "9b2b7f3852a0120b9ee97142c104e76a",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 8839,
"upload_time": "2024-05-10T21:37:01",
"upload_time_iso_8601": "2024-05-10T21:37:01.201990Z",
"url": "https://files.pythonhosted.org/packages/03/4f/a98767c90e9307b69a584685ce507860ede7ec181fd8656fea478d5b02c7/openmc_source_plotter-0.7.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "44a31ddd44ea7720a14fbeb6b467885dee890ef5cf6e7061b8f51f46067b3f47",
"md5": "8ea8a7b8384343caf2f2dabb4b05595c",
"sha256": "3328e447943f0b5353bf732df43ce72fddbe1dd62cc77f26c5c9024ed69c8a4d"
},
"downloads": -1,
"filename": "openmc_source_plotter-0.7.1.tar.gz",
"has_sig": false,
"md5_digest": "8ea8a7b8384343caf2f2dabb4b05595c",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 38261,
"upload_time": "2024-05-10T21:37:05",
"upload_time_iso_8601": "2024-05-10T21:37:05.498118Z",
"url": "https://files.pythonhosted.org/packages/44/a3/1ddd44ea7720a14fbeb6b467885dee890ef5cf6e7061b8f51f46067b3f47/openmc_source_plotter-0.7.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-05-10 21:37:05",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "fusion-energy",
"github_project": "openmc_source_plotter",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "openmc-source-plotter"
}