Skip to content
/ osiris Public

Optical model ScatterIng & ReactIon Software (OSIRIS)

License

Notifications You must be signed in to change notification settings

beykyle/osiris

Repository files navigation

CMake Python package

OSIRIS (/oʊˈsaɪərɨs/)

Optical model Scattering & Reaction Software

A fast, modern nuclear reaction code with a python interface using xtensor-python, built for uncertainty quantificaiton and model order reduction of parametric nucleon-nuclear interactions. Contains two main components; a c++ library osiris_lib containing the core solvers and physics functionality, and a python front end; osiris.

Python Installation

osiris is available at pypi.org/project/osiris-py:

  • pip install osiris-py

Example use

import osiris

For more in-depth examples and tutorials, see examples/

CMake integration

osiris supports CMake integration using FetchContent. Add the following to your CMakeLists.txt:

FetchContent_Declare(
  osiris 
  GIT_REPOSITORY https://github.com/beykyle/osiris.git
  GIT_TAG "origin/main"
  )
FetchContent_MakeAvailable(osiris)

Now you can #include files like "potential/params.hpp" into your project, as long as you link osiris_lib to the relevant target in your CMakeLists.txt, e.g.

target_link_libraries(<MY_TARGET> osiris_lib)

Standalone executable

osiris can also be used as a standalone application, with an example main function living inexec/osiris_example_app.cpp. To build:

git clone git@github.com:beykyle/osiris.git
cd osiris
mkdir build
cd build 
cmake -DCMAKE_BUILD_TYPE=Release .. 
make 
make test
make docs

Building the documentation

python documentation

From the docs/ directory:

make html

c++ documentation

Following a build, run:

make docs

from the build/ directory.

Running the tests

osiris (python) unit tests

Running the tests requires pytest.

py.test .

osiris_lib (c++) unit tests

Following a build, run:

make test

from the build/ directory.

osiris_lib dependencies

  • CMake >= 3.18
  • a modern c++ compiler and tool chain. This was tested and built primarily with the following compilers, running on Ubuntu, using a dependency stack from conda-forge:
clang version 15.0.7 (https://github.com/conda-forge/clangdev-feedstock fc523913ae327dfa0a91bb2b45a36c810e0f55d0)
Target: x86_64-unknown-linux-gnu
Thread model: posix

and

g++ (conda-forge gcc 10.4.0-19) 10.4.0

handled by CMake (you don't have to do anything):

osiris dependencies for python bindings

If you only want to use osiris_lib as a library for your project, these are the only dependencies. To use the python bindings, you will also need:

handled by CMake (you don't have to do anything):

install yourself

install yourself, optional:

  • pytest to run the python unit tests

It is recomended to use use a package, dependency and environment manager like mamba or conda. Then, setting up an environment to run osiris with python is as easy as (e.g. using mamba), from pypi:

mamba create -n osirenv python cmake compilers numpy pytest
mamba activate osirenv
pip install osiris

Alternatively, to install for development purposes, clone the repository and create an editable install:

mamba create -n osirenv python cmake compilers pybind11 numpy xtensor-python
mamba activate osirenv
git clone git@github.com:beykyle/osiris.git
cd osiris
py setup.py build -j{nproc}
pip install -e .

Parallel execution with MPI

import osiris
import mpi4py

Using ipyparallel, notebooks can be run with a parallel backend.

Windows runtime requirements

On Windows, the Visual c++ 2015 redistributable packages are a runtime requirement for this project. It can be found here.

If you use the Anaconda python distribution, you may require the Visual Studio runtime as a platform-dependent runtime requirement for you package:

requirements:
  build:
    - python
    - setuptools
    - pybind11

  run:
   - python
   - vs2015_runtime  # [win]

Citation

@software{Beyer_OSIRIS,
author = {Beyer, Kyle},
license = {BSD-3-Clause},
title = {{OSIRIS}},
url = {https://github.com/beykyle/osiris},
version = {0.1}
}

About

Optical model ScatterIng & ReactIon Software (OSIRIS)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published