aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHolden Rohrer <hr@hrhr.dev>2020-01-12 11:49:52 -0500
committerHolden Rohrer <hr@hrhr.dev>2020-01-13 12:45:32 -0500
commit49924026044ed926d1eeb7d86294a0ea6226d22b (patch)
treeb773cd28c83c8da807b1b3cace8ece6ca59e4040
parent99ef8c18c435e5efed5912543fb2c1def6f91ee7 (diff)
data.py creates TeX tables now
-rw-r--r--data.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/data.py b/data.py
index 3363dbd..ad06b92 100644
--- a/data.py
+++ b/data.py
@@ -154,10 +154,18 @@ elif arg == 'depwid':
plt.text(10, 7, 'R^2 = %.3f\np=%.3f' % (pearsonr(sizes,depths)[0], pearsonr(sizes,depths)[1]), ha='center', va='center')
plt.savefig('depth_width.png', bbox_inches='tight')
if arg == 'table':
- print('Dimensions (in)\tPit Depth (cm)\tPit Width (cm)\tNearest Neighbor (cm)')
+ print('\\table{')
+ print('Dimensions (in)& Pit Depth (cm)& Pit Width (cm)& Nearest 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])]))
+ print('& '.join(['x'.join([str(el) for el in size]), '%.1f' % pit.depth, '%.1f' % pit.diam, '%.2f' % nei[pitind]])+'\\cr\\noalign{\\hrule}')
+ print('}')
+if arg == 'deathtable':
+ print('\\table{')
+ print('Trial Size& Date& Introduced& Deaths& Pits formed\\cr\\noalign{\\hrule}')
+ for trial in trials:
+ print('& '.join(['x'.join([str(el) for el in trial.size]), str(trial.date), str(trial.intro), str(trial.dead), str(len(trial.pits))])+'\\cr\\noalign{\\hrule}')
+ print('}')