Metadata-Version: 2.4
Name: m6sourceview
Version: 1.0.1
Summary: Python package for MORET6 fission source visualization in criticality mode
Author: Wilfried Monange
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: numpy>=1.19.0
Requires-Dist: matplotlib>=3.0.0
Provides-Extra: dev
Requires-Dist: pytest; extra == "dev"
Requires-Dist: black; extra == "dev"
Requires-Dist: flake8; extra == "dev"
Dynamic: license-file

# M6SourceView

Python package helping to visualize fission sites in a **MORET6** calculation.

Monte Carlo criticality calculations are performed by a series of cycles, each cycle simulating the life of a set of neutrons. When the calculation has converged correctly, the position of the neutron birth sites (which correspond to the fission sites) indicates the most reactive space in the fissile material. It may then be useful to visualize these fission sites to determine the most reactive part of the nuclear system.

This package allows you to:

- calculate the center of mass of the neutrons from the last cycle (presumably the one with the best convergence)
- perform a graphical cut in three dimensions at this center of mass
- display the position of the neutrons on the graphical slices.


⚠️ **Warning**: This package only works on Linux **not** Windows.

Example of output:

![Example output showing fission sites visualization](example/CPX_CONT_0001.m6.fission_sites.png)


# Installation

As is usual practice in the Python world, it is best to install **m6sourceview** in a venv:

```bash
python3 -m venv
source venv/bin/active
pip3 install m6sourceveiw
```


# Usage

In order to use **m6sourceview**, you must activate the outputs for the positions of neutron birth and death sites in the **MORET6** input file. This is done by adding the keywords `POST STAR ENDP` to the output block, as in the following example:


```
OUTP
	POST
		STAR
	ENDP
ENDO
```

Once installed you can use it as:

### As a Python module

```bash
python3 -m m6sourceview input_file.m6
```

### As a command-line tool

```bash
m6sourceview input_file.m6
```

### Options

- `--nb_max_pixel INT`: Maximum number of pixels for the plot (default: 500)
- `--no-show`: Save plot without displaying
- `--max_bank_size`: Maximum number of birth site to load (default: 10k)
- `--output`: Output file path of the plot.

### Examples

```bash
python3 -m m6sourceview example/CPX_CONT_0001.m6
python3 -m m6sourceview example/CPX_CONT_0001.m6 --nb_max_pixel 1000
python3 -m m6sourceview example/CPX_CONT_0001.m6 --no-show
```
