Skip to content

Commit

Permalink
added warning for outline usage
Browse files Browse the repository at this point in the history
  • Loading branch information
shimwell committed May 9, 2024
1 parent ee29b49 commit 74d7cf4
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 16 deletions.
2 changes: 1 addition & 1 deletion examples/plot_minimal_2d_example.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import openmc
from matplotlib.colors import LogNorm
from openmc_regular_mesh_plotter import plot_mesh_tally

from openmc_regular_mesh_plotter import plot_mesh_tally

# MATERIALS
mat_1 = openmc.Material()
Expand Down
2 changes: 1 addition & 1 deletion examples/plot_minimal_example.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import openmc
from matplotlib.colors import LogNorm
from openmc_regular_mesh_plotter import plot_mesh_tally

from openmc_regular_mesh_plotter import plot_mesh_tally

# MATERIALS
mat_1 = openmc.Material()
Expand Down
7 changes: 4 additions & 3 deletions examples/plot_sweep_through_slice_indexes.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@
# It is also set up to accept any geometry and the mesh tally will adapt to the geometry dimensions


import openmc
import matplotlib
import numpy as np
import openmc
from matplotlib import cm
from matplotlib.colors import LogNorm

from openmc_regular_mesh_plotter import plot_mesh_tally
from matplotlib import cm
import matplotlib

# sets the font for the axis
matplotlib.rc("font", **{"family": "normal", "size": 22})
Expand Down
2 changes: 1 addition & 1 deletion examples/plot_two_tallies_combined.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import openmc
from matplotlib.colors import LogNorm
from openmc_regular_mesh_plotter import plot_mesh_tally

from openmc_regular_mesh_plotter import plot_mesh_tally

# MATERIALS
mat_1 = openmc.Material()
Expand Down
6 changes: 3 additions & 3 deletions examples/plot_with_custom_color_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
# It is also set up to accept any geometry and the mesh tally will adapt to the geometry dimensions


import matplotlib.pyplot as plt
import openmc
from matplotlib.colors import LogNorm
from openmc_regular_mesh_plotter import plot_mesh_tally
from matplotlib import cm
import matplotlib.pyplot as plt
from matplotlib.colors import LogNorm

from openmc_regular_mesh_plotter import plot_mesh_tally

# materials
mat_concrete = openmc.Material()
Expand Down
4 changes: 2 additions & 2 deletions src/openmc_regular_mesh_plotter/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
try:
from importlib.metadata import version, PackageNotFoundError
from importlib.metadata import PackageNotFoundError, version
except (ModuleNotFoundError, ImportError):
from importlib_metadata import version, PackageNotFoundError
from importlib_metadata import PackageNotFoundError, version
try:
__version__ = version("openmc_regular_mesh_plotter")
except PackageNotFoundError:
Expand Down
10 changes: 6 additions & 4 deletions src/openmc_regular_mesh_plotter/core.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import math
import typing
import warnings
from pathlib import Path
from tempfile import TemporaryDirectory
import typing
import openmc

import matplotlib.pyplot as plt
import numpy as np
import openmc
import openmc.checkvalue as cv
import matplotlib.pyplot as plt

from packaging import version

if version.parse(openmc.__version__) < version.parse("0.13.3"):
Expand Down Expand Up @@ -182,6 +182,8 @@ def plot_mesh_tally(
if colorbar:
fig.colorbar(im, **colorbar_kwargs)

if outline and geometry is None:
warnings.warn('output has been set to True but the geometry has not been set. When setting outline to True please also provide the geometry. Plotting without the outline.')
if outline and geometry is not None:
import matplotlib.image as mpimg

Expand Down
3 changes: 2 additions & 1 deletion tests/test_units.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import openmc
import pytest
from matplotlib.colors import LogNorm

from openmc_regular_mesh_plotter import plot_mesh_tally
import pytest


@pytest.fixture()
Expand Down

0 comments on commit 74d7cf4

Please sign in to comment.