summaryrefslogtreecommitdiff
path: root/stats.py
diff options
context:
space:
mode:
authorFlorian Jung <flo@windfisch.org>2015-08-30 18:08:04 +0200
committerFlorian Jung <flo@windfisch.org>2015-08-30 18:08:04 +0200
commit4c1be522f6eddf7b36600119cfddf1c75b995864 (patch)
treef43a323546726d3cb82ff477d1292aacfde35068 /stats.py
parentf88995ed18fa57ddb7ce7b00003e025f67d0db11 (diff)
moved stuff around, no changes
Diffstat (limited to 'stats.py')
-rw-r--r--stats.py56
1 files changed, 28 insertions, 28 deletions
diff --git a/stats.py b/stats.py
index 9bf834a..a10ea1d 100644
--- a/stats.py
+++ b/stats.py
@@ -105,6 +105,34 @@ class Stats:
else:
self.data = data
+ def save(self,filename):
+ pickle.dump(self.data, open(filename,"wb"))
+
+ def load(filename):
+ return Stats(None, pickle.load(open(filename,"rb")))
+
+ def merge(self, filename):
+ data2 = pickle.load(open(filename,"rb"))
+ self.data.min_mass = min(self.data.min_mass, data2.min_mass)
+ self.data.max_mass = max(self.data.max_mass, data2.max_mass)
+
+ for i in data2.size_vs_visible_window:
+ for j in data2.size_vs_visible_window[i]:
+ self.data.size_vs_visible_window[i][j] += data2.size_vs_visible_window[i][j]
+ for i in data2.mass_vs_visible_window:
+ for j in data2.mass_vs_visible_window[i]:
+ self.data.mass_vs_visible_window[i][j] += data2.mass_vs_visible_window[i][j]
+
+ for i in data2.size_vs_speed:
+ for j in data2.size_vs_speed[i]:
+ self.data.size_vs_speed[i][j] += data2.size_vs_speed[i][j]
+
+ for i in data2.eject_deviations:
+ self.data.eject_deviations[i] += data2.eject_deviations[i]
+
+ for i in data2.eject_distlogs:
+ self.data.eject_distlogs[i] += data2.eject_distlogs[i]
+
def log_mass(self, mass):
self.data.mass_history.append((time.time(), mass))
self.data.current_mass = mass
@@ -255,34 +283,6 @@ class Stats:
else:
print(celltype+" did NOT fly in a straight line, ignoring...")
- def save(self,filename):
- pickle.dump(self.data, open(filename,"wb"))
-
- def load(filename):
- return Stats(None, pickle.load(open(filename,"rb")))
-
- def merge(self, filename):
- data2 = pickle.load(open(filename,"rb"))
- self.data.min_mass = min(self.data.min_mass, data2.min_mass)
- self.data.max_mass = max(self.data.max_mass, data2.max_mass)
-
- for i in data2.size_vs_visible_window:
- for j in data2.size_vs_visible_window[i]:
- self.data.size_vs_visible_window[i][j] += data2.size_vs_visible_window[i][j]
- for i in data2.mass_vs_visible_window:
- for j in data2.mass_vs_visible_window[i]:
- self.data.mass_vs_visible_window[i][j] += data2.mass_vs_visible_window[i][j]
-
- for i in data2.size_vs_speed:
- for j in data2.size_vs_speed[i]:
- self.data.size_vs_speed[i][j] += data2.size_vs_speed[i][j]
-
- for i in data2.eject_deviations:
- self.data.eject_deviations[i] += data2.eject_deviations[i]
-
- for i in data2.eject_distlogs:
- self.data.eject_distlogs[i] += data2.eject_distlogs[i]
-
def analyze_speed(self):