Metadata-Version: 2.4
Name: uratools
Version: 1.0.1
Summary: Tools to simplify the use of URANIE with python
License: LGPL
License-File: LICENSE
Author: Uranie Team
Author-email: rudy.chocat@cea.fr
Requires-Python: >=3.11
Classifier: Environment :: Console
Classifier: Intended Audience :: Science/Research
Classifier: Intended Audience :: Developers
Classifier: Natural Language :: English
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Software Development
Classifier: Topic :: Scientific/Engineering
Provides-Extra: all
Provides-Extra: sklearn
Provides-Extra: tensorflow
Provides-Extra: test
Provides-Extra: torch
Requires-Dist: numpy
Requires-Dist: pytest ; extra == "test"
Requires-Dist: scikit-learn ; extra == "all"
Requires-Dist: scikit-learn ; extra == "sklearn"
Requires-Dist: scikit-learn ; extra == "test"
Requires-Dist: scipy
Requires-Dist: scipy ; extra == "test"
Requires-Dist: tensorflow ; extra == "all"
Requires-Dist: tensorflow ; extra == "tensorflow"
Requires-Dist: torch ; extra == "all"
Requires-Dist: torch ; extra == "torch"
Project-URL: Homepage, https://gitlab.com/uranie-cea/uratools/
Description-Content-Type: text/markdown

# uratools

This Python module provides tools to simplify the use of URANIE with Python

`uratools` aims to provide a multitude of utilities designed to enhance the user experience, particularly by facilitating ports to NumPy, interfacing Uranie with Python machine learning libraries (PyTorch, TensorFlow, and scikit-learn), and providing tools for fitting empirical distributions and generating plots easily. It will be updated regularly.



## URANIE

 - Website: https://uranie.cea.fr/
 - Python documentation: https://uranie.cea.fr/documentation/userManual_Py/index 
 - Installation: https://gitlab.com/uranie-cea/publication/-/wikis/home
 - Uratools documentation https://uranie-cea.gitlab.io/uratools/documentation/index.html
 

## Installation

```bash
pip install uratools
```

## How to use it

Before using the package, ensure that URANIE is installed and properly sourced.

The python command to use the package is the following

```python
from uratools import converter
```

Documentation is available on this page
https://uratools-508bc1.gitlab.io/

## Example

```python
import numpy as np
import ROOT
from ROOT.URANIE import DataServer, Sampler
from uratools import converter

## == np.array to DataServer
mA = np.random.randn(10,2)
tds = converter.np2ds(mA, "x1:x2") ## a DataServer.TDataServer is created from np.array

## == DataServer to np.array 
tds = DataServer.TDataServer()
tds.addAttribute(DataServer.TUniformDistribution("x1",0.0, 5.0))
tds.addAttribute(DataServer.TNormalDistribution("x2",-2.0, 0.5))
sam = Sampler.TSampling(tds,"lhs",20)
sam.generateSample()

npA = converter.ds2np(tds) ## a np.array is created from a DataServer.TDataServer
```

## Cobweb plots

The `uraplot` module helps drawing cobweb (parallel coordinates) plots and
applying selection ranges on one or several variables in a single call.

```python
from uratools import uraplot

## Single selection: keep 10 <= var1 <= 20, drawn in red
uraplot.drawCobwebWithSelection(tds, "var1:var2", "var1", 10, 20, "red")

## Several selections at once (selection variables and colours accept
## colon-separated strings or lists)
uraplot.drawCobwebWithSelection(tds, "var1:var2:var3",
                                "var1:var2", [5, 5], [10, 15], "red:blue")
```

Colours can be given as ROOT colour codes (ints) or readable names
("red", "blue", "green", ...).

## Support

support-uranie@cea.fr


