diff --git a/toolkit.py b/toolkit.py index bb47fb29baf02c8339d4f93a9f34e0c45e12afae..fb0a382341040d08e1de9d58c8882943ee2dd145 100755 --- a/toolkit.py +++ b/toolkit.py @@ -1508,6 +1508,22 @@ class ClassificationProjectDataFrame(ClassificationProject): A little hack to initialize a ClassificationProject from a pandas DataFrame instead of ROOT TTrees """ + def __init__(self, name, *args, **kwargs): + if len(args) < 1 and len(kwargs) < 1: + # if no further arguments given, interpret as directory name + self._init_from_dir(name) + else: + # otherwise initialise new project + self._init_from_args(name, *args, **kwargs) + with open(os.path.join(self.project_dir, "options.pickle"), "wb") as of: + # don't put the dataframe into options.pickle! + if len(args) > 1: + args = args[1:] + else: + args = [] + pickle.dump(dict(args=args, kwargs=kwargs), of) + + def _init_from_args(self, name, df,