summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Jung <flo@windfisch.org>2015-08-28 18:57:00 +0200
committerFlorian Jung <flo@windfisch.org>2015-08-28 18:57:00 +0200
commitfd66690aa9c2dc429325891c906b97d5184bc5e0 (patch)
treec5b2b6ab9f4e85a062ff6730061c6060b148d99c
parente4b732abd4ea034f75645d333ff5b357d1b612e7 (diff)
analyzing functions
-rw-r--r--analyze.py5
-rw-r--r--stats.py19
-rw-r--r--strategy.py2
3 files changed, 21 insertions, 5 deletions
diff --git a/analyze.py b/analyze.py
index 1720719..520b3b0 100644
--- a/analyze.py
+++ b/analyze.py
@@ -14,4 +14,7 @@ for f in files[1:]:
s.analyze_speed()
print("\n" + "-"*40 + "\n")
s.analyze_visible_window(True)
-
+for i in ["split cell", "ejected mass", "virus"]:
+ s.analyze_deviations(i)
+for i in ["split cell", "ejected mass", "virus"]:
+ s.analyze_distances(i)
diff --git a/stats.py b/stats.py
index a136ca9..b567800 100644
--- a/stats.py
+++ b/stats.py
@@ -297,7 +297,20 @@ class Stats:
def analyze_deviations(self, celltype):
ds = self.data.eject_deviations[celltype]
- if len(ds) == 0: return
- mean, stddev = fit_gaussian(ds)
- print(celltype+" eject/split direction deviations: mean = "+str(mean)+", stddev="+str(stddev))
+ try:
+ mean, stddev = fit_gaussian(ds)
+ except:
+ mean, stddev = "???", "???"
+
+ print(celltype+" eject/split direction deviations: mean = "+str(mean)+", stddev="+str(stddev)+", ndata="+str(len(ds)))
+
+ def analyze_distances(self, celltype):
+ ds = [v[0] for v in self.data.eject_distlogs[celltype]]
+
+ try:
+ mean, stddev = fit_gaussian(ds)
+ except:
+ mean, stddev = "???", "???"
+
+ print(celltype+" eject/split distances: mean = "+str(mean)+", stddev="+str(stddev)+", ndata="+str(len(ds)))
diff --git a/strategy.py b/strategy.py
index 1be22cf..21a06cf 100644
--- a/strategy.py
+++ b/strategy.py
@@ -164,7 +164,7 @@ class Strategy:
except AttributeError:
print("cannot calculate shoot angle, too few backlog")
continue
- # check if ejecting mass would feed one friend
+ # check if ejecting mass would feed a friend
possibly_feedable_cells = list(filter(lambda c : can_feed(my_cell, c), self.c.world.cells.values()))
possibly_feedable_cells.sort(key = lambda c : (my_cell.pos - c.pos).len())