From aaaf823c107bbaedb7aafa9f0ec52effeea6e4d5 Mon Sep 17 00:00:00 2001
From: Nikolai Hartmann <Nikolai.Hartmann@physik.uni-muenchen.de>
Date: Tue, 28 Aug 2018 17:21:40 +0200
Subject: [PATCH] don't dump DataFrame in ClassificationProjectDataFrame
 initialisation

---
 toolkit.py | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/toolkit.py b/toolkit.py
index bb47fb2..fb0a382 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,
-- 
GitLab