Skip to content

newcleo-dev-team/nchainplotter

Repository files navigation

nchainplotter

newcleo logo

Authors:Lorenzo Canzian, Davide Manzione, Daniele Tomatis
Date:January 13, 2026

Introduction

nchainplotter is a Python module designed to plot decay/transmutation chains, given the selected nuclides and the desired threshold in terms of probability.

Project structure

The project is organized according to the following folder structure:

<nchainplotter folder>
    ├── docs/
    ├── examples/
    ├── nchainplotter/
    ├── resources/
    ├── README.rst
    └── setup.py
  • "docs/": folder containing the documentation for the plotter;
  • "examples/": folder containing a functioning example of the plotter, together with the outptu produced;
  • "nchainplotter/": folder containing the main package code;
  • "resources/": folder containing additional resources such as xml schemas
  • "README.rst": the present file;
  • "setup.py": the script for installing the package.

Dependencies

To run the code, the following dependencies must be satisfied:

  • Python >= 3.11+
  • typing-extensions >= 4.12.2
  • h5py == 3.14.0
  • lxml == 6.0.0
  • numpy == 2.4.0
  • pandas == 2.3.3
  • PyYAML == 6.0.2
  • tikz_python == 0.0.6
  • xmlschema == 4.1.0

Installation

To install nchainplotter, from the terminal clone the repository in the local folder:

git clone https://github.com/newcleo-dev-team/nchainplotter.git

Then, install the package using pip, running from the root directory of nchainplotter:

python -m pip install .

After that, it will be possible to create a 'Chain' object directly from a YAML configuration file by providing the path to the depletion chain file in either OpenMC XML or HDF5 format:

from nchainplotter.build_chain import build_hdf5_from_config

To enable the plotter it would be sufficient to import the module in the Python script of interest:

from nchainplotter.plotter import plot_depletion_chain

Finally, a Chain object can be simplified using

chain.simplify_chain()

Example file

One example file is provided in the examples/ folder:

  • An example file (generate_plot_from_XML.py) demonstrates how to build the chain from the configuration file, simplify it and finally produce a plot.

It is necessary to provide the input yaml file containing the following information:

  • XML chain file path
  • HDF5 chain file path, if any
  • the nuclides to be considered as starting point into the "nucs" array
  • set, at "rel_degree", depths of the chain i.e. the number of iterations to be considered away from starting nuclide
  • set, at "direction", how the chain will be parsed. "m_to_d", mothers to daughters, indicates that for each nuclides its daughters will be found. On the opposite, "d_to_m" gather the mothers of all the nuclides

Once the information has been stored, the existence of an HDF file will be verified. If so, the file will be validated. If no HDF5 file is found, the XML file is validated and converted to HDF5 format.

Here, there is an example of a Sr90 chains in the mother-to-daughter representation:

docs/source/images/test_chain.png

This chain can be simplified retaining this result:

docs/source/images/simplified_test_chain.png

About

Plotter of nuclide chains

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages