2012-04-12 80 views
4

我已经与ROOT广泛合作,它有自己的数据文件格式,但由于各种原因,我们希望切换到HDF5文件。不幸的是,我们仍然需要一些在格式之间翻译文件的方法。有没有人知道任何现有的图书馆这样做?HDF5与ROOT框架的集成

回答

4

你可能会检查出rootpy,这对于通过PyTables转换ROOT文件到HDF5设施:如果这个问题仍然是你的兴趣http://www.rootpy.org/commands/root2hdf5.html

+0

也发现这个独立(这是我找到的)。 – Shep 2012-05-19 05:57:26

+0

现在还有其他一些: - https://github.com/havoc-io/root2hdf5 - https://github.com/diana-hep/rootconverter/blob/master/root2hdf5/src/root2hdf5.cpp – DragonTux 2016-04-20 07:55:49

2

,最近也出现了较大的改进rootpyroot2hdf5脚本和root_numpy包(其中root2hdf5用来TTrees转换为NumPy的结构数组):

root2hdf5 -h 
usage: root2hdf5 [-h] [-n ENTRIES] [-f] [--ext EXT] [-c {0,1,2,3,4,5,6,7,8,9}] 
       [-l {zlib,lzo,bzip2,blosc}] [--script SCRIPT] [-q] 
       files [files ...] 

positional arguments: 
    files 

optional arguments: 
    -h, --help   show this help message and exit 
    -n ENTRIES, --entries ENTRIES 
         number of entries to read at once (default: 100000.0) 
    -f, --force   overwrite existing output files (default: False) 
    --ext EXT    output file extension (default: h5) 
    -c {0,1,2,3,4,5,6,7,8,9}, --complevel {0,1,2,3,4,5,6,7,8,9} 
         compression level (default: 5) 
    -l {zlib,lzo,bzip2,blosc}, --complib {zlib,lzo,bzip2,blosc} 
         compression algorithm (default: zlib) 
    --script SCRIPT  Python script containing a function with the same name 
         that will be called on each tree and must return a tree or 
         list of trees that will be converted instead of the 
         original tree (default: None) 
    -q, --quiet   suppress all warnings (default: False) 
0

,当我最后一次检查的(几个月前)root2hdf5有一个限制,即它无法处理它是阵列TBranches。出于这个原因,我写了一个bash脚本:root2hdf(对于非创意名称感到抱歉)。

它将ROOT文件和文件中TTree的路径作为输入参数并生成源代码&编译为可在ROOT文件上运行的可执行文件,将它们转换为HDF5数据集。

它也有一个限制,它不能处理化合物TBranch类型,但我不知道root2hdf5也没有。

+0

我被你的TH3Danim分心了。这很酷,但[它泄漏内存](https://github.com/ghollisjr/TH3Danim/blob/master/TH3Danim.hh#L62)。 – Shep 2014-02-10 12:53:27

+0

啊是的TH3Danim有点灰尘;我真的只在ROOT会话中使用它,所以它没有抱怨在第一次使用时试图释放内存。我会修补它。 – ghollisjr 2014-02-11 20:24:44

+0

很确定,仍然没有这样做:你在一个指针数组上调用数组析构函数,它只会删除指向这些对象的所有指针,而不会触及这些对象。 – Shep 2014-02-12 23:10:50