Skip to content

Commit

Permalink
Merge pull request #19 from fusion-energy/develop
Browse files Browse the repository at this point in the history
moving to new openmc_tally_unit_convertor package
  • Loading branch information
shimwell authored Nov 15, 2021
2 parents 82c51be + aba94ea commit 42f835a
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 11 deletions.
4 changes: 2 additions & 2 deletions examples/plot_regular_mesh_dose_tally.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@
filename="plot_regular_mesh_dose_tally.png", # the filename of the picture file saved
scale=None, # LogNorm(),
vmin=None,
label="",
x_label="X [cm]",
y_label="Y [cm]",
rotate_plot=0,
required_units="picosievert cm **2 / simulated_particle",
required_units="picosievert / simulated_particle",
source_strength=None,
label="Effective dose [picosievert / simulated_particle]",
)

# displays the plot
Expand Down
6 changes: 3 additions & 3 deletions examples/plot_regular_mesh_dose_tally_with_geometry.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@
filename="plot_regular_mesh_dose_tally_with_geometry.png",
scale=None, # LogNorm(),
vmin=None,
label="",
label="Effective dose [picosievert / second]",
x_label="X [cm]",
y_label="Y [cm]",
plane_origin=None, # this could be skipped as it defaults to None, which uses the center of the mesh
plane_normal=[0, 0, 1],
rotate_mesh=0,
rotate_geometry=0,
required_units="picosievert cm **2 / simulated_particle",
source_strength=None,
required_units="picosievert / second",
source_strength=1e20,
)

my_plot.show()
8 changes: 4 additions & 4 deletions regular_mesh_plotter/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import dagmc_geometry_slice_plotter as dgsp
import matplotlib.pyplot as plt
import numpy as np
import openmc_post_processor as opp
import openmc_tally_unit_converter as otuc
from matplotlib import transforms

from .utils import (
Expand Down Expand Up @@ -114,7 +114,7 @@ def plot_regular_mesh_tally_with_geometry(
):

if required_units is not None:
values = opp.process_tally(
values = otuc.process_tally(
tally=tally, required_units=required_units, source_strength=source_strength
)
else:
Expand Down Expand Up @@ -163,7 +163,7 @@ def plot_regular_mesh_tally(
):

if required_units is not None:
values = opp.process_tally(
values = otuc.process_tally(
tally=tally, required_units=required_units, source_strength=source_strength
)
else:
Expand Down Expand Up @@ -207,7 +207,7 @@ def plot_regular_mesh_dose_tally(
):

if required_units is not None:
values = opp.process_dose_tally(
values = otuc.process_dose_tally(
tally=tally, required_units=required_units, source_strength=source_strength
)
else:
Expand Down
11 changes: 10 additions & 1 deletion regular_mesh_plotter/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import matplotlib.pyplot as plt
import numpy as np
import openmc
import pandas as pd


def reshape_values_to_mesh_shape(tally, values):
Expand Down Expand Up @@ -55,13 +56,21 @@ def get_values_from_tally(tally):
dateframe) is also returned"""

data_frame = tally.get_pandas_dataframe()
if "std. dev." in data_frame.columns.to_list():
if "std. dev." in get_data_frame_columns(data_frame):
values = (np.array(data_frame["mean"]), np.array(data_frame["std. dev."]))
else:
values = np.array(data_frame["mean"])
return values


def get_data_frame_columns(data_frame):
if isinstance(data_frame.columns, pd.MultiIndex):
data_frame_columns = data_frame.columns.get_level_values(0).to_list()
else:
data_frame_columns = data_frame.columns.to_list()
return data_frame_columns


def get_std_dev_or_value_from_tally(tally, values, std_dev_or_tally_value):

if std_dev_or_tally_value == "std_dev":
Expand Down
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@
"trimesh",
"shapely",
"scipy",
"pandas",
"dagmc_geometry_slice_plotter",
"openmc_post_processor",
"openmc_tally_unit_converter",
],
)

0 comments on commit 42f835a

Please sign in to comment.