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 simple Monte Carlo simulation using Python and matplotlib library

Monte Carlo python simulation Install linux dependencies sudo apt update sudo apt install build-essential \ software-properties-commo

Samuel Terra 2 Dec 13, 2021
The windML framework provides an easy-to-use access to wind data sources within the Python world, building upon numpy, scipy, sklearn, and matplotlib. Renewable Wind Energy, Forecasting, Prediction

windml Build status : The importance of wind in smart grids with a large number of renewable energy resources is increasing. With the growing infrastr

Computational Intelligence Group 125 Dec 24, 2022
trade bot connected to binance API/ websocket.,, include dashboard in plotly dash to visualize trades and balances

Crypto trade bot 1. What it is Trading bot connected to Binance API. This project made for fun. So ... Do not use to trade live before you have backte

G 3 Oct 07, 2022
Open-source demos hosted on Dash Gallery

Dash Sample Apps This repository hosts the code for over 100 open-source Dash apps written in Python or R. They can serve as a starting point for your

Plotly 2.7k Jan 07, 2023
OpenStats is a library built on top of streamlit that extracts data from the Github API and shows the main KPIs

Open Stats Discover and share the KPIs of your OpenSource project. OpenStats is a library built on top of streamlit that extracts data from the Github

Pere Miquel Brull 4 Apr 03, 2022
AB-test-analyzer - Python class to perform AB test analysis

AB-test-analyzer Python class to perform AB test analysis Overview This repo con

13 Jul 16, 2022
An easy to use burndown chart generator for GitHub Project Boards.

Burndown Chart for GitHub Projects An easy to use burndown chart generator for GitHub Project Boards. Table of Contents Features Installation Assumpti

Joseph Hale 15 Dec 28, 2022
Create 3d loss surface visualizations, with optimizer path. Issues welcome!

MLVTK A loss surface visualization tool Simple feed-forward network trained on chess data, using elu activation and Adam optimizer Simple feed-forward

7 Dec 21, 2022
Productivity Tools for Plotly + Pandas

Cufflinks This library binds the power of plotly with the flexibility of pandas for easy plotting. This library is available on https://github.com/san

Jorge Santos 2.7k Dec 30, 2022
Histogramming for analysis powered by boost-histogram

Hist Hist is an analyst-friendly front-end for boost-histogram, designed for Python 3.7+ (3.6 users get version 2.4). See what's new. Installation You

Scikit-HEP Project 97 Dec 25, 2022
🐍PyNode Next allows you to easily create beautiful graph visualisations and animations

PyNode Next A complete rewrite of PyNode for the modern era. Up to five times faster than the original PyNode. PyNode Next allows you to easily create

ehne 3 Feb 12, 2022
ipyvizzu - Jupyter notebook integration of Vizzu

ipyvizzu - Jupyter notebook integration of Vizzu. Tutorial · Examples · Repository About The Project ipyvizzu is the Jupyter Notebook integration of V

Vizzu 729 Jan 08, 2023
A python wrapper for creating and viewing effects for Matt Parker's christmas tree.

Christmas Tree Visualizer A python wrapper for creating and viewing effects for Matt Parker's christmas tree. Displays py or csv effect files and allo

4 Nov 22, 2022
Mattia Ficarelli 2 Mar 29, 2022
Open-questions - Open questions for Bellingcat technical contributors

Open questions for Bellingcat technical contributors These are difficult, long-term projects that would contribute to open source investigations at Be

Bellingcat 234 Dec 31, 2022
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 04, 2022
:art: Diagram as Code for prototyping cloud system architectures

Diagrams Diagram as Code. Diagrams lets you draw the cloud system architecture in Python code. It was born for prototyping a new system architecture d

MinJae Kwon 27.5k Dec 30, 2022
Design your own matplotlib stylefile interactively

Tired of playing with font sizes and other matplotlib parameters every time you start a new project or write a new plotting function? Want all you plots have the same style? Use matplotlib configurat

yobi byte 207 Dec 08, 2022
Graphical display tools, to help students debug their class implementations in the Carcassonne family of projects

carcassonne_tools Graphical display tools, to help students debug their class implementations in the Carcassonne family of projects NOTE NOTE NOTE The

1 Nov 08, 2021
Visualizations of some specific solutions of different differential equations.

Diff_sims Visualizations of some specific solutions of different differential equations. Heat Equation in 1 Dimension (A very beautiful and elegant ex

2 Jan 13, 2022