From a397704baca9c18aed7575006703e9880b9e27e0 Mon Sep 17 00:00:00 2001 From: Holden Rohrer Date: Sun, 5 Jul 2020 22:39:41 -0400 Subject: cleanup, extension, and table improvements --- py/deathtable.py | 3 --- py/table.py | 19 +++++++++---------- 2 files changed, 9 insertions(+), 13 deletions(-) (limited to 'py') diff --git a/py/deathtable.py b/py/deathtable.py index f393cc8..45e4f08 100644 --- a/py/deathtable.py +++ b/py/deathtable.py @@ -1,7 +1,4 @@ from data import trials -print('\\table{') -print('Trial Size& Date& Introduced& Deaths& Pits formed\\cr\\noalign{\\hrule}') for trial in trials: print('& '.join(['$\\times$'.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('}', end='') diff --git a/py/table.py b/py/table.py index 1d11779..8b6b38a 100644 --- a/py/table.py +++ b/py/table.py @@ -1,15 +1,14 @@ from data import trials -print('\\vtable{') -table = ['Dimensions (in)', 'Pit Depth (cm)', 'Pit Width (cm)', 'Nearest Neighbor (cm)','']; -lastsize = 0; for trial in trials: - size = trial.size - table[0] += '&\\multispan{' + str(len(trial.pits)) + '}\\vfil\\line{\\hfil' + '$\\times$'.join([str(el) for el in size]) + '\\hfil}\\vfil\\hrule' + print('\\multirow{' + str(len(trial.pits)) + '}{' + + '$\\times$'.join([str(el) for el in trial.size]) + '}') nei = trial.nearest_neighbor() - for pitind in range(len(trial.pits)): + pitcnt = len(trial.pits) + for pitind in range(pitcnt): pit = trial.pits[pitind] - table[1] += '&' + '%.1f' % pit.depth - table[2] += '&' + '%.1f' % pit.diam - table[3] += '&' + '%.2f' % nei[pitind] -print('\\cr\\noalign{\\vrule}\n'.join(table) + '}', end=''); + print('& %.1f& %.1f& %.2f\\cr' % (pit.depth, pit.diam, nei[pitind])) + if pitind+1 == pitcnt: + break + print('\\cline'); + print('\\multispan{4}\\leaders\\hrule\\hfil\\cr') -- cgit