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
---
Makefile | 9 +++++----
fmt/com.h | 5 +++++
fmt/doc.h | 17 ++++-------------
fmt/font.h | 16 +++++++++-------
poster.tex | 6 ++----
py/deathtable.py | 3 ---
py/table.py | 19 +++++++++----------
report/tables.i | 12 +++++-------
src/results.i | 34 ++++++++++++++++++----------------
src/vars.i | 2 +-
tables.orig.tex | 30 +++++++++++++++++++++++++++---
11 files changed, 85 insertions(+), 68 deletions(-)
diff --git a/Makefile b/Makefile
index 7f8db77..956baf2 100644
--- a/Makefile
+++ b/Makefile
@@ -20,9 +20,9 @@ qr:
report.pdf: report.tex src/abstract.i src/intro.i src/research.i \
src/proc.i src/mats.i src/analysis.i src/conc.i report/graphs.i \
-report/tables.i report/pics.i src/biblio.i fmt/doc.h
+report/tables.i report/pics.i src/biblio.i
-poster.pdf: poster.tex qr fmt/multicol.h fmt/font.h \
+poster.pdf: poster.tex qr fmt/multicol.h \
src/hypo.i src/abstr.i src/research.i src/mats.i src/methods.i \
poster/voronoi.i src/results.i src/vars.i src/notes.i src/analysis.i \
poster/img1.i poster/img2.i poster/img3.i poster/img4.i poster/img5.i \
@@ -39,9 +39,10 @@ report.pdf logbook.pdf: img/2019-10-18-1.jpg img/2019-10-18-2.jpg \
img/2019-10-30-1.jpg img/2019-11-21-1.jpg img/2019-11-21-2.jpg \
img/2019-11-21-3.jpg img/2019-11-21-4.jpg img/2019-12-02-1.jpg \
img/2019-12-02-2.jpg img/2019-12-13-1.jpg img/2019-12-13-2.jpg \
-img/2019-12-13-3.rot.jpg
+img/2019-12-13-3.rot.jpg fmt/doc.h
-report.pdf poster.pdf logbook.pdf: fmt/com.h imgs graph/made gen/tables.i
+report.pdf poster.pdf logbook.pdf: fmt/com.h imgs graph/made \
+gen/tables.i fmt/font.h
imgs: py/data.py py/img.py
mkdir -p imgs
diff --git a/fmt/com.h b/fmt/com.h
index adcbcf8..e8388ae 100644
--- a/fmt/com.h
+++ b/fmt/com.h
@@ -22,3 +22,8 @@
\def\imgskip{\vskip\imgskipamount}
\imgskipamount=0pt plus 48pt
\def\image #1 {\imgskip\input #1\imgskip}
+
+\newcount\pics
+\def\caption#1{\def\a{#1}\ifx\a\empty\else\global\advance\pics by
+1\smallskip\line{\vbox{\leftskip=0pt plus 1fill\rightskip=0pt plus
+1fill\parindent=0pt\relax Fig \number\pics: #1}}\smallskip\fi}
diff --git a/fmt/doc.h b/fmt/doc.h
index 85cb134..3f011bc 100644
--- a/fmt/doc.h
+++ b/fmt/doc.h
@@ -16,22 +16,13 @@
\def\section#1{\vskip .3\hsize\goodbreak\vskip -.3\hsize\bigskip\noindent{\fourteenrm #1:}\par}
%% Table
+\def\make#1{\hskip3pt\hfil #1\hfil\hskip3pt\vrule height 12pt depth 2pt\relax}
\def\table#1{
- \medskip\vbox{\vbox{\halign{&\vrule\vphantom{\vrule height 12pt depth 2pt width 2pt}\hskip3pt\hfil ##\hfil\hskip3pt\vrule\cr\noalign{\hrule}
+ \halign{\vrule\make{##}&&\make{##}\cr\noalign{\hrule}
#1
- }}}\medskip
-}
-\def\vtable#1{
- \medskip\line{\hfil
- \vbox{\line{\hfil{\hsize=1.5in\valign{&\hrule\vfil\vskip2pt\noindent \line{\hfil##\hfil}\par\vfil\vskip2pt\hrule\cr\noalign{\vrule}
- #1
- }}\hfil}}
}
}
-
%% Pictures
-\newcount\pics
\def\pic#1#2{\pdfximage width #1{#2}\pdfrefximage\pdflastximage}
-\def\caption#1{\def\a{#1}\ifx\a\empty\else\line{\vbox{\smallskip\leftskip=0pt plus 1fill\rightskip=0pt plus 1fill\parindent=0pt\relax Fig \number\pics: #1\bigskip}}\fi}
-\def\picture#1#2{\def\a{#2}\ifx\a\empty\else\advance\pics by 1\fi\vbox{\centerline{\pic{5in}{#1}}\caption{#2}}}
-\def\twopicture#1#2#3{\def\a{#3}\ifx\a\empty\else\advance\pics by 1\fi\vbox{\line{\pic{3in}{#1}\hfil\pic{3in}{#2}}\caption{#3}}}
+\def\picture#1#2{\def\a{#2}\ifx\a\empty\fi\vbox{\centerline{\pic{5in}{#1}}\caption{#2}}}
+\def\twopicture#1#2#3{\def\a{#3}\ifx\a\empty\fi\vbox{\line{\pic{3in}{#1}\hfil\pic{3in}{#2}}\caption{#3}}}
diff --git a/fmt/font.h b/fmt/font.h
index 54d4b54..e4d6189 100644
--- a/fmt/font.h
+++ b/fmt/font.h
@@ -8,7 +8,8 @@
\expandafter\getfontsizE\fontname##2#1\relax{##1}%
}%
\def\getfontsizE##1#1##2\relax##3{%
- \ifx*##2*% Loaded at designsize
+ {\def\tmp{##2}\expandafter}%
+ \ifx\tmp\empty % empty #2 = Loaded at designsize
\begingroup
\font\tmpfont"##1" scaled 2000
\getfontsize\dimen0=\tmpfont
@@ -21,8 +22,8 @@
\fi
}%
\def\getfontsiZE##1##2#1{##1=##2}% Strip " at "
- \def\getfontsiZe##1\relax##2{##2=##1}
- }
+ \def\getfontsiZe##1\relax##2{##2=##1}%
+ }%
\expandafter\expandafter\expandafter
\endgroup
\expandafter\x\specialAt % From StackOverflow
@@ -31,8 +32,7 @@
\global\let\f@nt\font
-\gdef\spacing{
- \afterassignment\adjs \thespacing}
+\gdef\spacing{\afterassignment\adjs \thespacing}
\gdef\adjs{%adjust spacing
\baselineskip=\size \multiply\baselineskip by \thespacing
\divide\baselineskip by 100\relax}
@@ -44,7 +44,9 @@
}
\gdef\xfont{
\expandafter\getfontsize\expandafter\dimen0\expandafter=\realname
- \expandafter\expandafter\expandafter\def
- \expandafter\orig\expandafter{\realname\size\dimen0\adjs}
+ \setbox0=\hbox{\vphantom(}%
+ \dimen1=\ht0\advance\dimen1 by 1.5pt%
+ \expandafter\edef\orig{\realname\size\the\dimen0\setbox\strutbox=\hbox{\vrule
+ height \the\dimen1 depth \the\dp0 width 0pt}\adjs}
}
}
diff --git a/poster.tex b/poster.tex
index 9ddb28a..762e336 100644
--- a/poster.tex
+++ b/poster.tex
@@ -19,9 +19,7 @@
%% pictures
-\newcount\pics
\def\pic#1#2{\pdfximage width #1{#2}\pdfrefximage\pdflastximage}
-\def\caption#1{\def\a{#1}\ifx\a\empty\else\global\advance\pics by 1\line{\vbox{\baselineskip=18pt\smallskip\leftskip=0pt plus 1fill\rightskip=0pt plus 1fill\parindent=0pt\relax Fig \number\pics: #1\bigskip}}\fi}
\def\picture#1#2#3{\vbox{\pic{#3}{#1}\hsize=#3\caption{#2}}}
\def\picturetop#1#2#3{\vtop{\pic{#3}{#1}\hsize=#3\caption{#2}}}
@@ -33,8 +31,8 @@
\vskip10pt%
}%
}%
- \bigbreak
-}\noindent}
+ \par
+}\noindent}%\bigbreak
\def\incl#1#2{\penalty-500\section{#1}\input #2\bigbreak}
\catcode`\@13
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')
diff --git a/report/tables.i b/report/tables.i
index 78280ce..2042d34 100644
--- a/report/tables.i
+++ b/report/tables.i
@@ -1,11 +1,9 @@
\input gen/tables.i
-{\baselineskip=13pt
-\deaths
-\global\advance\pics by 1\relax
-\nobreak\centerline{Figure \number\pics: Number of Deaths and Pits Successfully Formed in Each Trial/Subtrial}
+{%\baselineskip=13pt
+\centerline{\deaths}
+%\global\advance\pics by 1\relax
+%\nobreak\centerline{Figure \number\pics: Number of Deaths and Pits Successfully Formed in Each Trial/Subtrial}
-\territory
-\global\advance\pics by 1\relax
-\nobreak\centerline{Figure \number\pics: The Pit Depths, Widths, and ``Territory,'' Observed in Each Trial}
+\centerline{\territory}
\vfil\eject
}
diff --git a/src/results.i b/src/results.i
index da4d84c..f1a5bd5 100644
--- a/src/results.i
+++ b/src/results.i
@@ -1,21 +1,23 @@
\input gen/tables.i
\font\tablefont=cmr10 at 11pt
-\def\table#1#2{
- \vbox{\setbox0=\vbox{\halign{&\vrule\strut\hskip3pt\hfil {\tablefont ##}\hfil\hskip3pt\vrule\cr\noalign{\hrule}
- #1
- }}\hsize=\wd0\box0\caption{#2}}
+{\offinterlineskip\par}
+\kern -19pt%very hacky, but I don't exactly understand the glue
+\line{%
+ \picturetop{graph/depth_width.png}{Antlions' pits' depths and widths
+ correlate strongly with square root of trial area, meaning that
+ antlions are aware of how to optimally obtain ants for the group.
+ Bigger dots mean more pits of that size in that trial
+ area}{6in}\hfil
+ \picturetop{img/pcr.jpg}{DNA Ladder and PCR tests were used to detect
+ Cytochrome-B gene appearance in a primed DNA mixture from crushed
+ antlions.}{4in}%
}
-\def\vtable#1#2{
- \vbox{\line{\hfil{\hsize=2in\valign{&\hrule\vfil\vskip2pt\tablefont\noindent ##\par\vfil\vskip2pt\hrule\cr\noalign{\vrule}
- #1
- }}\hfil}\caption{#2}}
-}
-\par\line{\picturetop{graph/depth_width.png}{Antlions' pits' depths and widths correlate strongly with square root of trial area, meaning that antlions are aware of how to optimally obtain ants for the group. Bigger dots mean more pits of that size in that trial area}{6in}\hfil
- \picturetop{img/pcr.jpg}{DNA Ladder and PCR tests were used to detect Cytochrome-B gene appearance in a primed DNA mixture from crushed antlions.}{4in}
-}
-\kern-1.3in\hbox{
- \picture{graph/nearest_neighbor.png}{The geometric average of trial edge length correlates closely with nearest neighbor distance, demonstrating consistent spacing by antlions.}{6in}
- \deaths{Number of Deaths and Pits Successfully Formed in Each Trial/Subtrial}
+\kern-1.3in\line{%
+ \picture{graph/nearest_neighbor.png}{The geometric average of trial
+ edge length correlates closely with nearest neighbor distance,
+ demonstrating consistent spacing by antlions.}{6in}%
+ \hfil
+ {\tablefont\vbox{\deaths\vskip1in}}\hfil%
}
-\territory{The Pit Depths, Widths, and ``Territory,'' Observed in Each Trial}
+\centerline{\territory}
diff --git a/src/vars.i b/src/vars.i
index 256c3e4..38e0b70 100644
--- a/src/vars.i
+++ b/src/vars.i
@@ -1,3 +1,3 @@
- Throughout the experiment the independent variable was the size of the container, which changed from trial to trial, but did not change due to any other variable.
+Throughout the experiment the independent variable was the size of the container, which changed from trial to trial, but did not change due to any other variable.
Furthermore, the dependent variable throughout the experiment was the settlement patterns and behaviors of the antlions (myrmeleon immaculatus), which was quantified through the nearest neighbor calculation, pit depth and width, and the number of cannibalized antlions.
The control trial of the experiment was the 32x32 trial, as it shows the spatial patterns and behaviors of the antlions with the most available space, limiting the effect of competition on settlement patterns, which qualifies it to be a good control group.
diff --git a/tables.orig.tex b/tables.orig.tex
index 3e2de5f..e3b643e 100644
--- a/tables.orig.tex
+++ b/tables.orig.tex
@@ -1,6 +1,30 @@
+\setbox0=\vbox{\strut\hrule}\dimen0=.5\ht0
+\edef\rowht{\the\dimen0}
+\def\multirow#1#2{{\count0=#1\advance\count0 by -1%
+ \dimen0=\rowht\multiply\dimen0 by \count0\smash{\lower\dimen0\hbox{\hss#2\hss}}}}
+\def\cline{\omit\vrule\hfil\vrule&\multispan{3}{\leaders\hrule\hfil}\cr}
+\newskip\tableskipamount\tableskipamount=2pt plus 1fill
+\def\tableskip{\hskip\tableskipamount}
+\def\cell#1{\tableskip\strut\ignorespaces #1\unskip\tableskip\vrule}
\def\deaths{%
- %%DEATHTABLE%%{Number of Deaths and Pits Successfully Formed in Each Trial/Subtrial}
+\setbox0=\vbox{\offinterlineskip
+\halign{\vrule\cell{##}&&\cell{##}\cr\noalign{\hrule}
+Trial Size& Date& Introduced& Deaths& Pits formed\cr\noalign{\hrule}
+%%DEATHTABLE%%
+}}%
+\dimen0\wd0
+\vbox{\box0{\hsize\dimen0\caption{Number of Deaths and Pits Successfully
+Formed in Each Trial/Subtrial}}}%
}
\def\territory{%
- %%MAINTABLE%%{The Pit Depths, Widths, and ``Territory,'' Observed in Each Trial}
-}
+\setbox0=\vbox{\offinterlineskip
+\halign to
+\hsize{\vrule\cell{##}&&\cell{##}\cr\multispan{4}\leaders\hrule\hfil\cr
+Dimensions (in)& Pit Depth (cm)& Pit Width (cm)& Nearest Neighbor
+(cm)\cr\multispan{4}\leaders\hrule\hfil\cr
+%%MAINTABLE%%
+}}%
+\dimen0\wd0
+\vbox{\box0{\hsize\dimen0\caption{The Pit Depths, Widths, and
+``Territory,'' Observed in Each Trial}}%
+}}
--
cgit