Skip to content

Commit

Permalink
[skip ci] Apply formatting changes
Browse files Browse the repository at this point in the history
  • Loading branch information
shimwell authored and actions-user committed Jan 26, 2022
1 parent 0ac7c72 commit b4f7f1e
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 20 deletions.
1 change: 0 additions & 1 deletion examples/example_plot_plasma_source_position.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

import openmc_source_plotter as osp
from openmc_plasma_source import TokamakSource

Expand Down
1 change: 0 additions & 1 deletion examples/example_plot_source_direction.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

import openmc_source_plotter as osp
import openmc

Expand Down
1 change: 0 additions & 1 deletion examples/example_plot_source_energy.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

import openmc_source_plotter as osp
import openmc
import numpy as np
Expand Down
4 changes: 1 addition & 3 deletions examples/example_plot_source_position.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

import openmc_source_plotter as osp
import openmc

Expand All @@ -21,8 +20,7 @@

# plots the particle energy distribution
plot = osp.plot_source_position(
source = my_source,
openmc_exec="/home/jshim/miniconda3/envs/openmc_0_11_0/bin/openmc"
source=my_source, openmc_exec="/home/jshim/miniconda3/envs/openmc_0_11_0/bin/openmc"
)

plot.show()
1 change: 0 additions & 1 deletion examples/example_plot_two_source_energies.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

import openmc_source_plotter as osp
import openmc
import numpy as np
Expand Down
1 change: 0 additions & 1 deletion openmc_source_plotter/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,3 @@
from .core import plot_source_direction
from .core import plot_source_energy
from .core import plot_source_position

18 changes: 9 additions & 9 deletions openmc_source_plotter/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def plot_source_energy(
energy_bins: np.array = np.linspace(0, 20e6, 50),
):
"""makes a plot of the energy distribution OpenMC source(s)
Args:
source: The openmc.Source object or list of openmc.Source objects to plot.
number_of_particles: The number of source samples to obtain, more will
Expand All @@ -36,10 +36,10 @@ def plot_source_energy(
for single_source in source:
tmp_filename = tempfile.mkstemp(suffix=".h5", prefix=f"openmc_source_")[1]
create_initial_particles(
source= single_source,
source=single_source,
number_of_particles=number_of_particles,
openmc_exec=openmc_exec,
output_source_filename=tmp_filename
output_source_filename=tmp_filename,
)

print("getting particle data", tmp_filename)
Expand Down Expand Up @@ -77,7 +77,7 @@ def plot_source_position(
openmc_exec="openmc",
):
"""makes a plot of the initial creation postions of an OpenMC source(s)
Args:
source: The openmc.Source object or list of openmc.Source objects to plot.
number_of_particles: The number of source samples to obtain.
Expand All @@ -92,10 +92,10 @@ def plot_source_position(
for single_source in source:
tmp_filename = tempfile.mkstemp(suffix=".h5", prefix=f"openmc_source_")[1]
create_initial_particles(
source= single_source,
source=single_source,
number_of_particles=number_of_particles,
openmc_exec=openmc_exec,
output_source_filename=tmp_filename
output_source_filename=tmp_filename,
)

data = get_particle_data(tmp_filename)
Expand Down Expand Up @@ -128,7 +128,7 @@ def plot_source_direction(
openmc_exec="openmc",
):
"""makes a plot of the initial creation directions of the particle source
Args:
source: The openmc.Source object or list of openmc.Source objects to plot.
number_of_particles: The number of source samples to obtain.
Expand All @@ -142,10 +142,10 @@ def plot_source_direction(
for single_source in source:
tmp_filename = tempfile.mkstemp(suffix=".h5", prefix=f"openmc_source_")[1]
create_initial_particles(
source= single_source,
source=single_source,
number_of_particles=number_of_particles,
openmc_exec=openmc_exec,
output_source_filename=tmp_filename
output_source_filename=tmp_filename,
)
data = get_particle_data(tmp_filename)

Expand Down
7 changes: 4 additions & 3 deletions tests/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import numpy as np
import plotly.graph_objects as go


class TestUtils(unittest.TestCase):
def setUp(self):

Expand Down Expand Up @@ -50,15 +51,15 @@ def test_energy_plot(self):
def test_position_plot(self):

plot = osp.plot_source_position(
source = self.my_source,
openmc_exec=self.openmc_exec_dict[self.current_computer]
source=self.my_source,
openmc_exec=self.openmc_exec_dict[self.current_computer],
)
assert isinstance(plot, go.Figure)

def test_direction_plot(self):
plot = osp.plot_source_direction(
source=self.my_source,
number_of_particles=100,
openmc_exec=self.openmc_exec_dict['laptop'],
openmc_exec=self.openmc_exec_dict["laptop"],
)
assert isinstance(plot, go.Figure)

0 comments on commit b4f7f1e

Please sign in to comment.