From 49924026044ed926d1eeb7d86294a0ea6226d22b Mon Sep 17 00:00:00 2001 From: Holden Rohrer Date: Sun, 12 Jan 2020 11:49:52 -0500 Subject: data.py creates TeX tables now --- data.py | 12 ++++++++++-- 1 file 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('}') -- cgit