Skip to content

Commit

Permalink
Merge pull request #35 from fusion-energy/adding_version_check
Browse files Browse the repository at this point in the history
added check for openmc version
  • Loading branch information
shimwell authored Feb 21, 2024
2 parents d58556a + f0c92ab commit 68f6c97
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ A Python package for plotting the positions, directions or energy distributions

# Installation

You will need to have OpenMC version 0.14.0 or newer installed first.

```bash
pip install openmc_source_plotter
```
Expand Down
12 changes: 12 additions & 0 deletions src/openmc_source_plotter/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,18 @@
import openmc.lib
import plotly.graph_objects

import pkg_resources

system_openmc_version = pkg_resources.parse_version(openmc.__version__)
min_openmc_version = pkg_resources.parse_version("0.14.0")
if system_openmc_version < min_openmc_version:
msg = (
"openmc_source_plotter requires openmc version 0.14.0 or above. "
f"You have openmc version {system_openmc_version} installed. "
"Please update the version of openmc installed"
)
raise ImportError(msg)


def sample_initial_particles(self, n_samples: int = 1000, prn_seed: int = None):

Expand Down

0 comments on commit 68f6c97

Please sign in to comment.