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

Overview

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

Installation

pip install 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.

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.

from dagmc_geometry_slice_plotter import plot_slice_of_dagmc_geometry

plot = plot_slice_of_dagmc_geometry(
    dagmc_file_or_trimesh_object='dagmc.h5m',
    plane_normal=[0, 0, 1],
)

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.

from dagmc_geometry_slice_plotter import plot_slice_of_dagmc_geometry

plot = plot_slice_of_dagmc_geometry(
    dagmc_file_or_trimesh_object='dagmc.h5m',
    plane_origin=[0, 0, 200],
    plane_normal=[0, 0, 1],
)

plot.show()

dagmc slice plot

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)

from dagmc_geometry_slice_plotter import plot_slice_of_dagmc_geometry

plot = plot_slice_of_dagmc_geometry(
    dagmc_file_or_trimesh_object='dagmc.h5m',
    plane_normal=[0, 1, 0],
    rotate_plot=45,
)

plot.savefig('my_plot3.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 with default settings elsewhere.

from dagmc_geometry_slice_plotter import plot_slice_of_dagmc_geometry

plot_slice_of_dagmc_geometry(
    dagmc_file_or_trimesh_object='dagmc.h5m',
    plane_normal = [1, 0, 0],
    rotate_plot=270,
    output_filename='my_plot4.png'
)

dagmc slice plot

Related packages

This package is used by the regular_mesh_plotter Python package to combine slice plots with regular mesh tally results and produce images like below.

paramak plot openmc regular mesh tally

paramak plot openmc regular mesh tally

Comments
  • Some funky PyQT errors?

    Some funky PyQT errors?

    Pip installed and got the following error;

    ~/.local/lib/python3.10/site-packages/IPython/external/qt_loaders.py in load_qt(api_options)
        370         return result
        371     else:
    --> 372         raise ImportError("""
        373     Could not load requested Qt binding. Please ensure that
        374     PyQt4 >= 4.7, PyQt5, PySide >= 1.0.3 or PySide2 is available,
    
    ImportError: 
        Could not load requested Qt binding. Please ensure that
        PyQt4 >= 4.7, PyQt5, PySide >= 1.0.3 or PySide2 is available,
        and only one is imported per session.
    
        Currently-imported Qt library:                              'pyqt5'
        PyQt4 available (requires QtCore, QtGui, QtSvg):            False
        PyQt5 available (requires QtCore, QtGui, QtSvg, QtWidgets): False
        PySide >= 1.0.3 installed:                                  False
        PySide2 installed:                                          True
        Tried to load:                
    

    But, I do have pyqt5 & PySide2 installed

    opened by makeclean 1
  • added single function that works for file or object

    added single function that works for file or object

    Adds a function called plot_slice_of_dagmc_geometry that can accept either a dagmc file name or a trimesh object and then produce a plot.

    This provides a single entry function for users

    opened by shimwell 1
  • adopted latest py packaging approach

    adopted latest py packaging approach

    A while back I updated this package from a setup.py to use a setup.cfg and a pyproject.toml.

    It is now possible to do everything in the pyproject.toml so this PR updates the packages

    opened by shimwell 0
  • remove internal plotting methods

    remove internal plotting methods

    returning the mplt object and then using the mplt savefig() method offers more flexibility then the built in function offers.

    We can remove the internal function and reduce the code base a bit while maintaining the same functionalilty

    opened by shimwell 0
  • adding ability to make animation

    adding ability to make animation

    It would be handy if the slicer can make an animation

    Perhaps it could accept a tuple for some of these inputs of plane_origin, plane_normal, rotate_plot and then make an animation that sweeps between the inputs.

    A nice tutorial on mpl animations can be found here https://brushingupscience.com/2016/06/21/matplotlib-animations-the-easy-way/

    opened by shimwell 0
  • setuptools_scm is required in setup.cfg

    setuptools_scm is required in setup.cfg

    I might have done something incorrect with the setup.cfg / pyprogject.toml as it appears necessary to add setuptools_scm to the setup.cfg file.

    Without this package the CI fails https://github.com/fusion-energy/dagmc_geometry_slice_plotter/runs/5336107961?check_suite_focus=true

    With the package the CI passes https://github.com/fusion-energy/dagmc_geometry_slice_plotter/runs/5336124187?check_suite_focus=true

    I tested the removal of this package in this PR https://github.com/fusion-energy/dagmc_geometry_slice_plotter/pull/14

    I'm just not sure why it setuptools_scm is needed as this is not the case for other packages I've translated to setup.cfg

    opened by shimwell 0
Releases(0.2.1)
  • 0.2.1(Dec 13, 2022)

    What's Changed

    • added axis labels by @shimwell in https://github.com/fusion-energy/dagmc_geometry_slice_plotter/pull/28

    Full Changelog: https://github.com/fusion-energy/dagmc_geometry_slice_plotter/compare/0.2.0...0.2.1

    Source code(tar.gz)
    Source code(zip)
  • 0.2.0(Dec 2, 2022)

    What's Changed

    • removed unused script by @shimwell in https://github.com/fusion-energy/dagmc_geometry_slice_plotter/pull/25
    • moved to src project layout by @shimwell in https://github.com/fusion-energy/dagmc_geometry_slice_plotter/pull/26
    • refactoring to allow axis aligned plots by @shimwell in https://github.com/fusion-energy/dagmc_geometry_slice_plotter/pull/27

    Full Changelog: https://github.com/fusion-energy/dagmc_geometry_slice_plotter/compare/0.1.3...0.2.0

    Source code(tar.gz)
    Source code(zip)
  • 0.1.3(Sep 29, 2022)

    What's Changed

    • removed packages that are installed by pyproject by @shimwell in https://github.com/fusion-energy/dagmc_geometry_slice_plotter/pull/22
    • added build back by @shimwell in https://github.com/fusion-energy/dagmc_geometry_slice_plotter/pull/23
    • added missing run cmd by @shimwell in https://github.com/fusion-energy/dagmc_geometry_slice_plotter/pull/24

    Full Changelog: https://github.com/fusion-energy/dagmc_geometry_slice_plotter/compare/0.1.2...0.1.3

    Source code(tar.gz)
    Source code(zip)
  • 0.1.2(Sep 29, 2022)

    What's Changed

    • adopted latest py packaging approach by @shimwell in https://github.com/fusion-energy/dagmc_geometry_slice_plotter/pull/20
    • updating package production by @shimwell in https://github.com/fusion-energy/dagmc_geometry_slice_plotter/pull/21

    Full Changelog: https://github.com/fusion-energy/dagmc_geometry_slice_plotter/compare/0.1.1...0.1.2

    Source code(tar.gz)
    Source code(zip)
  • 0.1.1(Mar 7, 2022)

    What's Changed

    • fixed typo in package name by @shimwell in https://github.com/fusion-energy/dagmc_geometry_slice_plotter/pull/19

    Full Changelog: https://github.com/fusion-energy/dagmc_geometry_slice_plotter/compare/0.1.0...0.1.1

    Source code(tar.gz)
    Source code(zip)
  • 0.1.0(Feb 25, 2022)

    What's Changed

    • updated to setup.cfg by @shimwell in https://github.com/fusion-energy/dagmc_geometry_slice_plotter/pull/13
    • Added more python versions to the testing by @shimwell in https://github.com/fusion-energy/dagmc_geometry_slice_plotter/pull/14
    • removed output filename option by @shimwell in https://github.com/fusion-energy/dagmc_geometry_slice_plotter/pull/18

    Full Changelog: https://github.com/fusion-energy/dagmc_geometry_slice_plotter/compare/v0.0.5...0.1.0

    Source code(tar.gz)
    Source code(zip)
Owner
Fusion Energy
A collection of software projects related to fusion energy
Fusion Energy
A python package for animating plots build on matplotlib.

animatplot A python package for making interactive as well as animated plots with matplotlib. Requires Python >= 3.5 Matplotlib >= 2.2 (because slider

Tyler Makaro 394 Dec 18, 2022
A python package for animating plots build on matplotlib.

animatplot A python package for making interactive as well as animated plots with matplotlib. Requires Python >= 3.5 Matplotlib >= 2.2 (because slider

Tyler Makaro 356 Feb 16, 2021
This package creates clean and beautiful matplotlib plots that work on light and dark backgrounds

This package creates clean and beautiful matplotlib plots that work on light and dark backgrounds. Inspired by the work of Edward Tufte.

Nico Schlömer 205 Jan 7, 2023
The plottify package is makes matplotlib plots more legible

plottify The plottify package is makes matplotlib plots more legible. It's a thin wrapper around matplotlib that automatically adjusts font sizes, sca

Andy Jones 97 Nov 4, 2022
Easily convert matplotlib plots from Python into interactive Leaflet web maps.

mplleaflet mplleaflet is a Python library that converts a matplotlib plot into a webpage containing a pannable, zoomable Leaflet map. It can also embe

Jacob Wasserman 502 Dec 28, 2022
Python scripts to manage Chia plots and drive space, providing full reports. Also monitors the number of chia coins you have.

Chia Plot, Drive Manager & Coin Monitor (V0.5 - April 20th, 2021) Multi Server Chia Plot and Drive Management Solution Be sure to ⭐ my repo so you can

null 338 Nov 25, 2022
MPL Plotter is a Matplotlib based Python plotting library built with the goal of delivering publication-quality plots concisely.

MPL Plotter is a Matplotlib based Python plotting library built with the goal of delivering publication-quality plots concisely.

Antonio López Rivera 162 Nov 11, 2022
A Python function that makes flower plots.

Flower plot A Python 3.9+ function that makes flower plots. Installation This package requires at least Python 3.9. pip install

Thomas Roder 4 Jun 12, 2022
Standardized plots and visualizations in Python

Standardized plots and visualizations in Python pltviz is a Python package for standardized visualization. Routine and novel plotting approaches are f

Andrew Tavis McAllister 0 Jul 9, 2022
Painlessly create beautiful matplotlib plots.

Announcement Thank you to everyone who has used prettyplotlib and made it what it is today! Unfortunately, I no longer have the bandwidth to maintain

Olga Botvinnik 1.6k Jan 6, 2023
Make sankey, alluvial and sankey bump plots in ggplot

The goal of ggsankey is to make beautiful sankey, alluvial and sankey bump plots in ggplot2

David Sjoberg 156 Jan 3, 2023
Plot, scatter plots and histograms in the terminal using braille dots

Plot, scatter plots and histograms in the terminal using braille dots, with (almost) no dependancies. Plot with color or make complex figures - similar to a very small sibling to matplotlib. Or use the canvas to plot dots and lines yourself.

Tammo Ippen 207 Dec 30, 2022
Example scripts for generating plots of Bohemian matrices

Bohemian Eigenvalue Plotting Examples This repository contains examples of generating plots of Bohemian eigenvalues. The examples in this repository a

Bohemian Matrices 5 Nov 12, 2022
Moscow DEG 2021 elections plots

Построение графиков на основе публичных данных о ДЭГ в Москве в 2021г. Описание Скрипты в данном репозитории позволяют собственноручно построить графи

null 9 Jul 15, 2022
This plugin plots the time you spent on a tag as a histogram.

This plugin plots the time you spent on a tag as a histogram.

Tom Dörr 7 Sep 9, 2022
Generate "Jupiter" plots for circular genomes

jupiter Generate "Jupiter" plots for circular genomes Description Python scripts to generate plots from ViennaRNA output. Written in "pidgin" python w

Robert Edgar 2 Nov 29, 2021
YOPO is an interactive dashboard which generates various standard plots.

YOPO is an interactive dashboard which generates various standard plots.you can create various graphs and charts with a click of a button. This tool uses Dash and Flask in backend.

ADARSH C 38 Dec 20, 2022
This component provides a wrapper to display SHAP plots in Streamlit.

streamlit-shap This component provides a wrapper to display SHAP plots in Streamlit.

Snehan Kekre 30 Dec 10, 2022
Shaded 😎 quantile plots

shadyquant ?? This python package allows you to quantile and plot lines where you have multiple samples, typically for visualizing uncertainty. Your d

Mehrad Ansari 13 Sep 29, 2022