hepgo-hep.org/x/hep/cmd/npy2root

npy2root command

Command npy2root converts the content of a NumPy data file to a ROOT file and tree.

Usage: npy2root [OPTIONS] input.npy

The NumPy data file format is described here:

https://numpy.org/neps/nep-0001-npy-format.html

Example:

$> npyio-ls input.npy
================================================================================
file: input.npy
npy-header: Header{Major:1, Minor:0, Descr:{Type:<f8, Fortran:false, Shape:[2 3]}}
data = [0 1 2 3 4 5]

$> npy2root -o output.root -t mytree ./input.npy
$> root-ls -t ./output.root
=== [./output.root] ===
version: 61804
  TTree   mytree       mytree  (entries=2)
    numpy "numpy[3]/D" TBranch

$> root-dump ./output.root
>>> file[./output.root]
key[000]: mytree;1 "mytree" (TTree)
[000][numpy]: [0 1 2]
[001][numpy]: [3 4 5]

Options:

-o string
  	path to output ROOT file (default "output.root")
-t string
  	name of the output ROOT tree (default "tree")
Version
v0.36.0 (latest)
Published
Nov 15, 2024
Platform
linux/amd64
Imports
10 packages
Last checked
1 day ago

Tools for package owners.