Skip to main content

Tools to simplify the use of URANIE with python

Project description

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

Installation

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

from uratools import converter

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

Example

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.

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

uratools-1.0.1.tar.gz (17.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

uratools-1.0.1-py3-none-any.whl (21.6 kB view details)

Uploaded Python 3

File details

Details for the file uratools-1.0.1.tar.gz.

File metadata

  • Download URL: uratools-1.0.1.tar.gz
  • Upload date:
  • Size: 17.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.25

File hashes

Hashes for uratools-1.0.1.tar.gz
Algorithm Hash digest
SHA256 172e244fc161d30223c3e28bd9f63d2183baeef1c39c7432e660ddb5300142bc
MD5 b5216e770336fa89138e2c69fb46660d
BLAKE2b-256 2404a5a577c949fe193aea9559cdf14f45f8cf94dfd012c6f3ffaca955b52b1d

See more details on using hashes here.

File details

Details for the file uratools-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: uratools-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 21.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.25

File hashes

Hashes for uratools-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 40f613209a04dd7048a4ed12401defa7e5d6899a7b578acfdd606980afc63a3a
MD5 f2f599f532e49e8af868c3e2be9282d6
BLAKE2b-256 436752ea074db3608ae6e22d335c79e7f3174fae288eb94b41f8e00fd1f8163d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page