% Standalone source for Figure 2 (experimental workflow).
% Compile: pdflatex fig2_workflow.tex  ->  fig2_workflow.pdf
\documentclass[border=4pt]{standalone}
\usepackage{amsmath,amssymb}
\usepackage{tikz}
\usepackage{pgfplots}
\pgfplotsset{compat=1.16}
\usetikzlibrary{calc}
\begin{document}
\begin{tikzpicture}[
  font=\footnotesize,
  block/.style={draw=black, rounded corners=2pt, align=center,
                minimum width=2.7cm, minimum height=0.9cm,
                fill=gray!8},
  readout/.style={draw=blue!60!black, rounded corners=2pt,
                  align=center, minimum width=2.7cm,
                  minimum height=0.9cm, fill=blue!6},
  detect/.style={draw=black, rounded corners=2pt, align=center,
                 minimum width=2.7cm, minimum height=0.9cm,
                 fill=green!8},
  arrow/.style={->, line width=0.7pt}
]
\node[block] (input) at (0,0) {single photon\\in mode $0$};
\node[block] (prep) at (3.2,0) {software-defined\\preparation $U_{\rm prep}$};
\node[block] (core) at (6.4,0) {optional core\\$R_{\mathcal{N}}^d$};
\node[readout] (balance) at (9.8,0.8) {BALANCE readout\\DC dump port};
\node[readout] (parity) at (9.8,-0.8) {parity separator\\DC + face syndromes};
\node[detect] (ports) at (13.1,0) {postselected\\single-photon ports};

\draw[arrow] (input) -- (prep);
\draw[arrow] (prep) -- (core);
\draw[arrow] (core.east) -- ++(0.55,0) |- (balance.west);
\draw[arrow] (core.east) -- ++(0.55,0) |- (parity.west);
\draw[arrow] (balance.east) -- ++(0.45,0) |- (ports.west);
\draw[arrow] (parity.east) -- ++(0.45,0) |- (ports.west);

\node[align=center, font=\scriptsize] at (6.4,-1.45)
{depth $d=0,1,2,3$ in Experiment~4;\\omitted for direct separator tests};
\node[align=center, font=\scriptsize] at (10.4,1.55)
{Experiments~1--4, 6};
\node[align=center, font=\scriptsize] at (10.4,-1.65)
{Experiment~5};
\end{tikzpicture}
\end{document}
