Skip to content

Commit

Permalink
Merge pull request #26 from fusion-energy/m_patch
Browse files Browse the repository at this point in the history
adds hidden point to correct aspect ratio
  • Loading branch information
shimwell authored Nov 24, 2022
2 parents 4bac736 + 57774ee commit e999ea2
Showing 1 changed file with 22 additions and 2 deletions.
24 changes: 22 additions & 2 deletions openmc_source_plotter/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def plot_source_position(
n_samples: int = 2000,
prn_seed: int = 1,
):
"""makes a plot of the initial creation postions of an OpenMC source(s)
"""makes a plot of the initial creation positions of an OpenMC source(s)
Args:
figure: Optional base plotly figure to use for the plot. Passing in
Expand Down Expand Up @@ -148,7 +148,7 @@ def plot_source_direction(
n_samples: int = 2000,
prn_seed: int = 1,
):
"""makes a plot of the initial creation postions of an OpenMC source(s)
"""makes a plot of the initial creation positions of an OpenMC source(s)
Args:
figure: Optional base plotly figure to use for the plot. Passing in
Expand All @@ -166,6 +166,26 @@ def plot_source_direction(

data = self.sample_initial_particles(n_samples, prn_seed)

biggest_coord = max(
max([particle.r[0] for particle in data]),
max([particle.r[1] for particle in data]),
max([particle.r[2] for particle in data]),
)
smallest_coord = min(
min([particle.r[0] for particle in data]),
min([particle.r[1] for particle in data]),
min([particle.r[2] for particle in data]),
)

figure.add_trace(
{
"type": "scatter3d",
"marker": {"color": "rgba(255,255,255,0)"},
"x": [biggest_coord, smallest_coord],
"y": [biggest_coord, smallest_coord],
"z": [biggest_coord, smallest_coord],
}
)
figure.add_trace(
{
"type": "cone",
Expand Down

0 comments on commit e999ea2

Please sign in to comment.