From 8d7b6b99904d722510b6cfe9eed8f072d11d8907 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Wed, 15 May 2013 16:27:38 -0400 Subject: [PATCH] local_cmmds.tex: Factor out TikZ stack figure into \tikzstack Keeping changes syncronized by hand is madness :p. I also added arrows (after suggestions from both Mom and Prof. Cruz) showing data flow to/from the physical nodes to their associated software package. There's also a new dashed separator between the software packages and the physical nodes. --- src/calibcant/procedure.tex | 59 +------------------------- src/local_cmmds.tex | 83 +++++++++++++++++++++++++++++++++++++ src/packages.tex | 1 + src/pyafm/stack.tex | 59 +------------------------- 4 files changed, 86 insertions(+), 116 deletions(-) diff --git a/src/calibcant/procedure.tex b/src/calibcant/procedure.tex index 79fa069..cfbc6af 100644 --- a/src/calibcant/procedure.tex +++ b/src/calibcant/procedure.tex @@ -10,64 +10,7 @@ parameters $G_{1f}$, $f_0$, and $\beta_f$. I've written the on packages in the \pyafm\ stack (\cref{fig:calibcant:stack}). \begin{figure} - \begin{tikzpicture}[decoration={ - markings,% switch on markings - mark=% add a mark for screw threading - between positions 0 and 1 step 1pt - with - { - \draw (0, 2pt) -- (1pt, -2pt); - } - } - ] - \tikzstyle{every node}=[text depth=0pt, rounded rectangle, - draw=blue!50, very thick, minimum height=1.7em] - \node[shape=rectangle,draw=none,inner sep=0] - (image) at (0,0) { - \asyinclude{figures/schematic/afm}}; - \node[shape=rectangle,draw=black, semithick] - (daq) at ($(image.south west) + (-0.5, -1)$) {DAQ card}; - \node[shape=rectangle,draw=black, semithick] - (motor) at ($(image.south) + (0, -1)$) {motor}; - %\draw[ - \coordinate (thermocouple) at ($(image.west) + (1, -4pt)$); - \node (pycomedi) at ($(daq) + (-5,0)$) {pycomedi}; - \node (pypiezo) at ($(pycomedi) + (0,1)$) {pypiezo}; - \node (pyafm) at ($(pypiezo) + (0,1)$) {pyafm}; - \node[black!20] (unfold-protein) at ($(pyafm) + (0,1)$) {unfold-protein}; - \node (stepper) at ($(pycomedi) + (2,1)$) {stepper}; - \node (pypid) at ($(stepper) + (2,0)$) {pypid}; - \node (h5config) at ($(pycomedi) + (-3,0)$) {h5config}; - \node (calibcant) at ($(unfold-protein) + (-3,0)$) {calibcant}; - \draw (pypiezo) -- (pyafm); - \draw (stepper) -- (pyafm); - \draw (pypid) -- (pyafm); - \draw[black!20] (pyafm) -- (unfold-protein); - \draw (h5config) -- (pypiezo); - \draw (h5config) -- (pyafm); - \draw[black!20] (h5config) -- (unfold-protein); - \draw (pyafm) -- (calibcant); - \draw (h5config) -- (calibcant); - \draw[purple] (pypid) -- (thermocouple); - % begin thermometer symbol - \draw[blue!20, line width=4pt, cap=round] - (thermocouple) -- ($(thermocouple) + (0,12pt)$); - \fill[blue!20] (thermocouple) circle (5pt); - \draw[red, line width=2pt, cap=butt] - (thermocouple) -- ($(thermocouple) + (0,8pt)$); - \fill[red] (thermocouple) circle (4pt); - % end thermometer symbol - % begin motor screw - \draw[black!20, line width=4pt] - (motor) -- (image.south); % shaft with decoration threads - \draw[black, decorate, ultra thin] - (motor) -- (image.south); % shaft with decoration threads - % end motor screw - \draw[red] - (pypiezo) -- (pycomedi) -- (daq) -- ($(image.south) + (-6pt, 0)$); - \draw[red, line width=2pt] (pycomedi) -- (daq); - \draw[blue] (stepper) -- (pycomedi) -- (daq) -- (motor); - \end{tikzpicture} + \tikzstack{black!20}{} \caption{Dependency graph for \calibcant, which shares the \pyafm\ stack with \unfoldprotein. Only the ``brain'' module changed with respect to diff --git a/src/local_cmmds.tex b/src/local_cmmds.tex index 30a85b0..d7c9fc4 100644 --- a/src/local_cmmds.tex +++ b/src/local_cmmds.tex @@ -194,3 +194,86 @@ \newcommand{\sawsim}{\citetalias{king10}} \newcommand{\stepper}{\citetalias{stepper}} \newcommand{\unfoldprotein}{\citetalias{unfold-protein}} + +% draw a thermometer in TikZ +% usage: \thermometer{bulb-location} +\newcommand{\thermometer}[1]{ + \draw[blue!20, line width=4pt, cap=round] #1 -- +(0, 12pt); + \fill[blue!20] #1 circle (5pt); + \draw[red, line width=2pt, cap=butt] #1 -- +(0, 8pt); + \fill[red] #1 circle (4pt); +} + +% shared figure between pyafm and calibcant +% usage: \tikzstack{unfold-protein-color}{calibcant-color} +\newcommand{\tikzstack}[2]{% + \begin{tikzpicture}[decoration={ + markings,% switch on markings + mark=% add a mark for screw threading + between positions 0 and 1 step 1pt + with + { + \draw (0, 2pt) -- (1pt, -2pt); + } + } + ] + \tikzstyle{every node}=[text depth=0pt, rounded rectangle, + draw=blue!50, very thick, minimum height=1.7em] + % hardware nodes and coordinates + \node[shape=rectangle,draw=none,inner sep=0] + (image) at (0,0) { + \asyinclude{figures/schematic/afm}}; + \node[shape=rectangle,draw=black, semithick] + (daq) at ($(image.south west) + (-0.25, -1)$) {DAQ card}; + \node[shape=rectangle,draw=black, semithick] + (motor) at ($(image.south) + (0, -1)$) {motor}; + \coordinate (thermocouple) at ($(image.west) + (1.4, -4pt)$); + \thermometer{(thermocouple)} + \coordinate (photodiode) at ($(image.west) + (1, 26pt)$); + \coordinate (piezo) at ($(image.south) + (-6pt, 0)$); + \draw[black!20,dashed] ($(daq.south west) + (-10pt, 0)$) -- +(0, 4); + % software nodes + \node (pycomedi) at ($(daq) + (-6,0)$) {pycomedi}; + \node (pypiezo) at ($(pycomedi) + (0,1)$) {pypiezo}; + \node (pyafm) at ($(pypiezo) + (0,1)$) {pyafm}; + \node[#1] (unfold-protein) at ($(pyafm) + (0,1)$) {unfold-protein}; + \node (stepper) at ($(pycomedi) + (2,1)$) {stepper}; + \node (pypid) at ($(stepper) + (2,0)$) {pypid}; + \node (h5config) at ($(pycomedi) + (-3,0)$) {h5config}; + \node[#2] (calibcant) at ($(unfold-protein) + (-3,0)$) {calibcant}; + % software connections + \draw (pypiezo) -- (pyafm); + \draw (stepper) -- (pyafm); + \draw (pypid) -- (pyafm); + \draw[#1] (pyafm) -- (unfold-protein); + \draw (h5config) -- (pypiezo); + \draw (h5config) -- (pyafm); + \ifthenelse{\equal{#1}{}}{% draw unfold-protein in black (the default) + \draw[#2] (pyafm) -- (calibcant); + \draw[#1] (h5config) -- (unfold-protein);% default path on top + }{% + \draw[#1] (h5config) -- (unfold-protein); + \draw[#2] (pyafm) -- (calibcant);% default path on top + } + \draw[#2] (h5config) -- (calibcant); + % hardware connections + \begin{pgfonlayer}{background} + \draw[purple, ->] (thermocouple) -- (pypid); + \end{pgfonlayer} + % begin motor screw + \draw[black!20, line width=4pt] + (motor) -- (image.south); % shaft with decoration threads + \draw[black, decorate, ultra thin] + (motor) -- (image.south); % shaft with decoration threads + % end motor screw + \draw[red, <->] (pypiezo) -- (pycomedi); + \draw[red, <->, line width=2pt] (pycomedi) -- (daq); + \draw[red, ->] (daq) -- (piezo); + \begin{pgfonlayer}{background} + \draw[red, ->, out=180, in=90] (photodiode) to (daq.north); + \end{pgfonlayer} + \draw[blue, ->] (stepper) -- (pycomedi); + \draw[blue, ->] (pycomedi) -- (daq); + \draw[blue, ->] (daq) -- (motor); + \end{tikzpicture} +} diff --git a/src/packages.tex b/src/packages.tex index 7b31473..596e996 100644 --- a/src/packages.tex +++ b/src/packages.tex @@ -83,6 +83,7 @@ \usepackage{pgf} % fancy graphics \usepackage{tikz} % a nice, inline PGF frontend \usetikzlibrary{automata} % graph-theory library +\usetikzlibrary{backgrounds} % background layers \usetikzlibrary{calc} % coordinate-calculation library \usetikzlibrary{decorations.markings} % custom marks \usetikzlibrary{decorations.pathreplacing} % braces and other fancy paths diff --git a/src/pyafm/stack.tex b/src/pyafm/stack.tex index 2b2c454..69d2f75 100644 --- a/src/pyafm/stack.tex +++ b/src/pyafm/stack.tex @@ -13,64 +13,7 @@ experiment logic to \pyafm\ to carry out velocity-clamp force spectroscopy (\cref{fig:pyafm:stack}). \begin{figure} - \begin{tikzpicture}[decoration={ - markings,% switch on markings - mark=% add a mark for screw threading - between positions 0 and 1 step 1pt - with - { - \draw (0, 2pt) -- (1pt, -2pt); - } - } - ] - \tikzstyle{every node}=[text depth=0pt, rounded rectangle, - draw=blue!50, very thick, minimum height=1.7em] - \node[shape=rectangle,draw=none,inner sep=0] - (image) at (0,0) { - \asyinclude{figures/schematic/afm}}; - \node[shape=rectangle,draw=black, semithick] - (daq) at ($(image.south west) + (-0.5, -1)$) {DAQ card}; - \node[shape=rectangle,draw=black, semithick] - (motor) at ($(image.south) + (0, -1)$) {motor}; - %\draw[ - \coordinate (thermocouple) at ($(image.west) + (1, -4pt)$); - \node (pycomedi) at ($(daq) + (-5,0)$) {pycomedi}; - \node (pypiezo) at ($(pycomedi) + (0,1)$) {pypiezo}; - \node (pyafm) at ($(pypiezo) + (0,1)$) {pyafm}; - \node (unfold-protein) at ($(pyafm) + (0,1)$) {unfold-protein}; - \node (stepper) at ($(pycomedi) + (2,1)$) {stepper}; - \node (pypid) at ($(stepper) + (2,0)$) {pypid}; - \node (h5config) at ($(pycomedi) + (-3,0)$) {h5config}; - \node[black!20] (calibcant) at ($(unfold-protein) + (-3,0)$) {calibcant}; - \draw (pypiezo) -- (pyafm); - \draw (stepper) -- (pyafm); - \draw (pypid) -- (pyafm); - \draw (pyafm) -- (unfold-protein); - \draw[black!20] (pyafm) -- (calibcant); - \draw (h5config) -- (pypiezo); - \draw (h5config) -- (pyafm); - \draw (h5config) -- (unfold-protein); - \draw[black!20] (h5config) -- (calibcant); - \draw[purple] (pypid) -- (thermocouple); - % begin thermometer symbol - \draw[blue!20, line width=4pt, cap=round] - (thermocouple) -- ($(thermocouple) + (0,12pt)$); - \fill[blue!20] (thermocouple) circle (5pt); - \draw[red, line width=2pt, cap=butt] - (thermocouple) -- ($(thermocouple) + (0,8pt)$); - \fill[red] (thermocouple) circle (4pt); - % end thermometer symbol - % begin motor screw - \draw[black!20, line width=4pt] - (motor) -- (image.south); % shaft with decoration threads - \draw[black, decorate, ultra thin] - (motor) -- (image.south); % shaft with decoration threads - % end motor screw - \draw[red] - (pypiezo) -- (pycomedi) -- (daq) -- ($(image.south) + (-6pt, 0)$); - \draw[red, line width=2pt] (pycomedi) -- (daq); - \draw[blue] (stepper) -- (pycomedi) -- (daq) -- (motor); - \end{tikzpicture} + \tikzstack{}{black!20} \caption{Dependency graph for my modular experiment control stack.\label{fig:pyafm:stack}} \end{figure} -- 2.26.2