fusion-energy / openmc_regular_mesh_plotter

A Python package for plotting OpenMC regular mesh tally results with underlying geometry from neutronics simulations.
MIT License
9 stars 1 forks source link

Remove base plot #38

Closed RemDelaporteMathurin closed 2 years ago

RemDelaporteMathurin commented 2 years ago

Fixes #34

Currently, the functions return a module, which is kinda weird... and a new figure is created at each call, making it impossible to make subplots.

Instead, the functions shouldn't return anything (or maybe the current figure via plt.gcf()?).

The workflow would then be:

import regular_mesh_plotter as rmp
import matplotlib.pyplot as plt

rmp.plot_regular_mesh_tally(
    tally=my_tally,
    std_dev_or_tally_value="tally_value",
)
plt.ylabel("my custom Y label")
plt.plot([1, 2, 3], [1, 2, 3])  # add another plot on top of it
plt.savefig('openmc_mesh_tally_plot.png')

A subplot could be created by:

import regular_mesh_plotter as rmp
import matplotlib.pyplot as plt

fig, axs = plt.subplots(nrows=2, ncols=1)

plt.sca(axs[0])  # set first axis active
rmp.plot_regular_mesh_tally(
    tally=my_tally,
    std_dev_or_tally_value="tally_value",
)

plt.sca(axs[1])  # set second axis active
rmp.plot_regular_mesh_tally(
    tally=my_other_tally,
    std_dev_or_tally_value="tally_value",
)

plt.savefig('openmc_mesh_tally_plot.png')

This workflow is more standard

shimwell commented 2 years ago

@RemDelaporteMathurin this failing CI is due to a conda bug that has been reported elsewhere. We could fix the CI by using mamba install. I can do this on a new PR

shimwell commented 2 years ago

Any chance we could branch from develop and merge to develop

codecov[bot] commented 2 years ago

Codecov Report

Merging #38 (3b27fbe) into develop (c5293d7) will not change coverage. The diff coverage is 0.00%.

@@           Coverage Diff           @@
##           develop     #38   +/-   ##
=======================================
  Coverage     0.00%   0.00%           
=======================================
  Files            3       3           
  Lines          136     126   -10     
=======================================
+ Misses         136     126   -10     
Impacted Files Coverage Δ
regular_mesh_plotter/core.py 0.00% <0.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 4a452ef...3b27fbe. Read the comment docs.