dagmc_geometry_slice_plotter

A minimal Python package that produces slice plots through h5m DAGMC geometry files

https://github.com/fusion-energy/dagmc_geometry_slice_plotter

Science Score: 44.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (11.0%) to scientific vocabulary

Keywords from Contributors

neutronics photon dagmc fispact mcnp openmc serpent conversion convert normalization
Last synced: 8 months ago · JSON representation ·

Repository

A minimal Python package that produces slice plots through h5m DAGMC geometry files

Basic Info
  • Host: GitHub
  • Owner: fusion-energy
  • License: mit
  • Language: Python
  • Default Branch: main
  • Size: 1.07 MB
Statistics
  • Stars: 4
  • Watchers: 1
  • Forks: 1
  • Open Issues: 3
  • Releases: 8
Created over 4 years ago · Last pushed about 3 years ago
Metadata Files
Readme License Citation

README.md

N|Python

CI with install

PyPI

codecov

A minimal Python package that produces slice plots through h5m DAGMC geometry files

Installation

bash pip install dagmc_geometry_slice_plotter

Graphical User Interface Usage

Once installed you will be able to launch a browser based GUI from the terminal with the command ...

bash dagmc_geometry_slice_plotter

Python API Usage

These examples assume you have a h5m file called dagmc.h5m in the same folder that the Python script is being run from.

The plot_axis_slice method allows simple axis aligned plots to be made with minimal user effort.

Create a plot of a slice through the geometry perpendicular to the Z axis and default settings elsewhere. This will slice through the the center of the geometry as plane_origin has not been specified in this example.

```python from dagmcgeometrysliceplotter import plotaxis_slice

plot = plotaxisslice( dagmcfileortrimeshobject='dagmc.h5m', view_direction='z', )

plot.show() ``` dagmc slice plot

Create a plot of a slice through the geometry perpendicular to the Z axis, offset by 200cm and with default settings elsewhere. ```python from dagmcgeometrysliceplotter import plotaxis_slice

plot = plotaxisslice( dagmcfileortrimeshobject='dagmc.h5m', planeorigin=[0, 0, 200], viewdirection='z' )

plot.show() ``` dagmc slice plot

The plot_slice function allows more control over the plot as it allows arbitrary plane normals so that off axis slices can be made and allows the plot to be rotated.

Create a plot of a slice through the geometry perpendicular to the Y axis, with a rotation of 45 degrees and with default settings elsewhere. Also saves the plot with a high resolution (DPI) ```python from dagmcgeometrysliceplotter import plotslice

plot = plotslice( dagmcfileortrimeshobject='dagmc.h5m', planenormal=[0, 1, 0], rotate_plot=45, )

plot.savefig('example3slice.png', dpi=600) ``` dagmc slice plot

Saves a png image of a plot of a slice through the geometry perpendicular to the X axis and and with an offset in the x axis. ```python from dagmcgeometrysliceplotter import plotslice

plot = plotslice( dagmcfileortrimeshobject='dagmc.h5m', planenormal = [1, 0, 0], planeorigin=[10, 0, 0], rotateplot=270, )

plot.savefig('example4slice.png') ``` dagmc slice plot

DAGMC files can also be made using packages like cadtodagmc or stltoh5m. This example uses CadQuery to make an STL file then converts the STL file to a DAGMC h5m file and plots a slice through the geometry

Custom plots

You can also use the package to access the the coordinates and lines that make up the outline and then plot these lines with your own MatplotLib script or other plotting package.

This example makes use of low level functionality in the package to extract the coordinates and lines then plot them in MatPlotLib. This offers users full customization of how the plots appear and also allows the plots to be combined with other types of plots such as

```python from dagmcgeometrysliceplotter import getslice_coordinates import matplotlib.pyplot as plt

data = getslicecoordinates( dagmcfileortrimeshobject="dagmc.h5m", planeorigin=[0, 0, 200], planenormal=[0, 0, 1], )

plt.axes().set_aspect("equal") # scales the x y axis 1:1

for xy in data: plt.plot(*xy, color="black", linewidth=1)

plt.savefig("example7slice.png") ```

Related packages

  • This package is used by the openmc_plot Python package which has a web deployed version at xsplot.com

  • This package can also be used together with the openmcgeometryplot Python package to combine outline slice plots of DAGMC geometry with colored areas for materials or cells

  • This package can also be used together with the regularmeshplotter Python package to combine outline slice plots with regular mesh tally results and produce images like below.

paramak plot openmc regular mesh tally

paramak plot openmc regular mesh tally

Owner

  • Name: Fusion Energy
  • Login: fusion-energy
  • Kind: organization

A collection of software projects related to fusion energy

Citation (CITATION.cff)

cff-version: 1.2.0
message: "If you use this software, please cite it as below."
authors:
- family-names: "Shimwell"
  given-names: "Jonathan"
  orcid: "https://orcid.org/0000-0001-6909-0946"
title: "dagmc-geometry-slice-plotter. A minimal Python package that produces slice plots through h5m DAGMC geometry files"
version: 0.0.3
date-released: 2021-10-22
url: "https://github.com/fusion-energy/dagmc_geometry_slice_plotter"

GitHub Events

Total
Last Year

Committers

Last synced: about 3 years ago

All Time
  • Total Commits: 66
  • Total Committers: 3
  • Avg Commits per committer: 22.0
  • Development Distribution Score (DDS): 0.167
Top Committers
Name Email Commits
Jonathan Shimwell m****l@j****m 55
shimwell s****l@u****m 10
Jonathan Shimwell d****l@g****m 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 9 months ago

All Time
  • Total issues: 7
  • Total pull requests: 28
  • Average time to close issues: 3 months
  • Average time to close pull requests: about 1 hour
  • Total issue authors: 3
  • Total pull request authors: 1
  • Average comments per issue: 0.57
  • Average comments per pull request: 0.54
  • Merged pull requests: 28
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • shimwell (5)
  • makeclean (1)
  • RemDelaporteMathurin (1)
Pull Request Authors
  • shimwell (28)
Top Labels
Issue Labels
Pull Request Labels

Dependencies

.github/workflows/black.yml actions
  • actions/checkout v2 composite
  • actions/setup-python v2 composite
  • stefanzweifel/git-auto-commit-action v4 composite
.github/workflows/ci_with_install.yml actions
  • actions/checkout v2 composite
  • actions/setup-python v1 composite
  • codecov/codecov-action v2 composite
.github/workflows/python-publish.yml actions
  • actions/checkout v2 composite
  • actions/setup-python v2 composite
pyproject.toml pypi
  • h5py *
  • matplotlib *
  • meshio *
  • scipy *
  • shapely *
  • streamlit *
  • trimesh *