aboutsummaryrefslogtreecommitdiff
path: root/py
diff options
context:
space:
mode:
authorHolden Rohrer <hr@hrhr.dev>2020-07-05 22:39:41 -0400
committerHolden Rohrer <hr@hrhr.dev>2020-07-06 18:42:06 -0400
commita397704baca9c18aed7575006703e9880b9e27e0 (patch)
treee9fa1068628978d92058cdb793cb6d44ecd0f747 /py
parent7fb897a5dce7c3c3af4b432366967132e7c5a06c (diff)
cleanup, extension, and table improvements
Diffstat (limited to 'py')
-rw-r--r--py/deathtable.py3
-rw-r--r--py/table.py19
2 files changed, 9 insertions, 13 deletions
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')