From 60d2ac45164f153f95092382865d2dcbfe3a3724 Mon Sep 17 00:00:00 2001
From: Holden Rohrer
Date: Sat, 11 Jan 2020 23:14:01 -0500
Subject: updated data.py to make graphs and csv table
---
data.py | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/data.py b/data.py
index 2018cd4..f746d05 100644
--- a/data.py
+++ b/data.py
@@ -43,7 +43,7 @@ class Trial:
vor = Voronoi([pit.loc for pit in self.pits])
voronoi_plot_2d(vor)
for pit in self.pits:
- plt.text(pit[0], pit[1], pit.disp(), ha='center', va='bottom')
+ plt.text(pit[0], pit[1], pit.disp(), ha='center', va='bottom', size='xx-small')
plt.xlabel('%s (dimension %dx%dcm)' % (str(self.date), self.size[0], self.size[1]))
if save:
plt.savefig(str(self.date)+'.svg')
@@ -56,7 +56,7 @@ class Trial:
return [dists[1] for dists in tree.query(self.pitlocs,2)[0]]
trials = [
- Trial(Date(2019, 10, 16), 31, 6, [31,32], [
+ Trial(Date(2019, 10, 16), 31, 6, [33,32], [
Pit([4,25],1.3,4.2),
Pit([3,13],1.4,3.7),
Pit([10,25],1.1,3.0),
@@ -76,7 +76,7 @@ trials = [
Pit([20,11],1.0,3.0),
Pit([19,2],1.5,4.0),
]),
- Trial(Date(2019, 12, 3), 19, 3, [16, 16], [
+ Trial(Date(2019, 12, 3), 19, 3, [17, 16], [
Pit([14,5],1.3,4.1),
Pit([12,2],1.2,3.8),
Pit([5,1],0.9,3.2),
@@ -85,7 +85,7 @@ trials = [
Pit([7,17],2.0,5.0),
Pit([1,17],1.8,3.6),
]),
- Trial(Date(2019, 12, 5), 10, 0, [16, 16], [
+ Trial(Date(2019, 12, 5), 10, 0, [17, 16], [
Pit([17,4],1.3,3.1),
Pit([10,4],1.5,3.1),
Pit([18,9],1.4,2.9),
@@ -144,3 +144,11 @@ elif arg == 'depwid':
plt.xlabel('Square root of Trial Area (cm)')
plt.ylabel('Depth/Width of Antlion Pits (cm)')
plt.show()
+if arg == 'table':
+ print('Dimensions (in)\tPit Depth (cm)\tPit Width (cm)\tNearest Neighbor (cm)')
+ for trial in trials:
+ size = trial.size
+ nei = trial.nearest_neighbor()
+ for pitind in range(len(trial.pits)):
+ pit = trial.pits[pitind]
+ print('\t'.join(['x'.join([str(el) for el in size]), str(pit.depth), str(pit.diam), str(nei[pitind])]))
--
cgit