Skip to content

Commit

Permalink
Merge pull request #15 from fusion-energy/adding_badge_to_readme
Browse files Browse the repository at this point in the history
added three badges
  • Loading branch information
shimwell authored Jul 29, 2022
2 parents 9b75d82 + 1dc4411 commit 4acefa1
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 14 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
[![CI with install](https://github.com/fusion-energy/openmc_source_plotter/actions/workflows/ci_with_install.yml/badge.svg)](https://github.com/fusion-energy/openmc_source_plotter/actions/workflows/ci_with_install.yml)

[![Python Flake8 Lint](https://github.com/fusion-energy/openmc_source_plotter/actions/workflows/lint.yaml/badge.svg)](https://github.com/fusion-energy/openmc_source_plotter/actions/workflows/lint.yaml)

[![Upload Python Package](https://github.com/fusion-energy/openmc_source_plotter/actions/workflows/python-publish.yml/badge.svg)](https://github.com/fusion-energy/openmc_source_plotter/actions/workflows/python-publish.yml)

A Python package for plotting the locations, directions or energy distributions of OpenMC sources.

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,6 +1,5 @@
import openmc_source_plotter as osp
import openmc
import numpy as np

# initialises a new source object
my_source = openmc.Source()
Expand Down
3 changes: 2 additions & 1 deletion examples/example_plot_source_position.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
# the distribution of source z values is just a single value
z_values = openmc.stats.Discrete([0], [1])

# the distribution of source azimuthal angles values is a uniform distribution between 0 and 2 Pi
# the distribution of source azimuthal angles
# values is a uniform distribution between 0 and 2 Pi
angle = openmc.stats.Uniform(a=0.0, b=2 * 3.14159265359)

# this makes the ring source using the three distributions and a radius
Expand Down
1 change: 0 additions & 1 deletion examples/example_plot_two_source_energies.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import openmc_source_plotter as osp
import openmc
import numpy as np

# initialises a new source object
my_dt_source = openmc.Source()
Expand Down
20 changes: 11 additions & 9 deletions openmc_source_plotter/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

"""Provides functions for plotting source information"""

import tempfile
from typing import List, Union

import numpy as np
Expand Down Expand Up @@ -47,12 +46,13 @@ def plot_source_energy(
"""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.
source: The openmc.Source object or list of openmc.Source objects to
plot.
n_samples: The number of source samples to obtain.
prn_seed: The pseudorandom number seed
energy_bins: Defaults to 'auto' which uses inbuilt auto binning in Numpy
bins can also be manually set by passing in a numpy array of bin
edges.
energy_bins: Defaults to 'auto' which uses inbuilt auto binning in
Numpy bins can also be manually set by passing in a numpy array of
bin edges.
"""

figure = go.Figure()
Expand Down Expand Up @@ -97,7 +97,8 @@ def plot_source_position(
"""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.
source: The openmc.Source object or list of openmc.Source objects to
plot.
n_samples: The number of source samples to obtain.
prn_seed: The pseudorandom number seed
"""
Expand Down Expand Up @@ -127,8 +128,8 @@ def plot_source_position(
},
)
)

figure.update_layout(title="Particle production coordinates - coloured by energy")
title = "Particle production coordinates coloured by energy"
figure.update_layout(title=title)

return figure

Expand All @@ -141,7 +142,8 @@ def plot_source_direction(
"""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.
source: The openmc.Source object or list of openmc.Source objects to
plot.
n_samples: The number of source samples to obtain.
prn_seed: The pseudorandom number seed
"""
Expand Down
2 changes: 0 additions & 2 deletions tests/test_core.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
from numpy import isin
import openmc_source_plotter as osp
import openmc
import unittest
from pathlib import Path
import numpy as np
import plotly.graph_objects as go

Expand Down

0 comments on commit 4acefa1

Please sign in to comment.