threeML / hawc_hal

HAWC Accelerated Likelihood - python-only framework for HAWC data analysis
BSD 3-Clause "New" or "Revised" License
11 stars 22 forks source link

ROOT file interface #45

Closed henrikef closed 3 years ago

henrikef commented 3 years ago

See #43 and #44 : Lots of errors like

tests/test_root_to_hdf.py:72: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
tests/test_root_to_hdf.py:50: in do_one_test_maptree
    m = map_tree_factory(geminga_maptree, roi_)
hawc_hal/maptree/map_tree.py:27: in map_tree_factory
    return MapTree.from_root_file(map_tree_file, roi, n_transits)
hawc_hal/maptree/map_tree.py:58: in from_root_file
    data_analysis_bins = from_root_file(map_tree_file, roi, n_transits)
hawc_hal/maptree/from_root_file.py:73: in from_root_file
    with open_ROOT_file(map_tree_file) as f:
../../../miniconda/envs/test-environment/lib/python3.7/contextlib.py:112: in __enter__
    return next(self.gen)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
filename = PosixPath('/home/travis/build/threeML/hawc_hal/tests/data/geminga_maptree.root')
    @contextlib.contextmanager
    def open_ROOT_file(filename):
        """
        Open a ROOT file in a context. Will close it no matter what, even if there are exceptions

        :param filename:
        :return:
        """

>       f = ROOT.TFile(filename)
E       TypeError: none of the 2 overloaded methods succeeded. Full details:
E         TFile::TFile() =>
E           TypeError: takes at most 0 arguments (1 given)
E         TFile::TFile(const char* fname, const char* option = "", const char* ftitle = "", int compress = ROOT::RCompressionSetting::EDefaults::kUseCompiledDefault) =>
E           TypeError: could not convert argument 1 (bad argument type for built-in operation)

../../../miniconda/envs/test-environment/lib/python3.7/site-packages/threeML/io/cern_root_utils/io_utils.py:28: TypeError
henrikef commented 3 years ago

Fixed in #48