\include{preface}
\standalonefalse
\renewcommand{\okinfinal}[1]{{#1}}
% Version 2.0: The BGPS Outer Galaxy extension
\title{The Bolocam Galactic Plane Survey VIII: Data Release 2 and Outer Galaxy Extension}
\include{authors}
\keywords{ISM: all of it ---
stars: formation}
\include{abstract}
\include{introduction}
% move to top?
\include{calibration} % v2 calibration + v1 error description [nothing to be added]
\include{expansion}
\include{reduction} % only delta-v1 or things left out
\include{pointing} % done [reviewed by group]
\include{stf} % done [reviewed by group]
\include{source_extraction} %
\include{conclusion}
% \include{appendix}
% Begin appendices (only for thesis?)
% \include{simulations} % move before stf... or just cut it out (describe simulations in STF section)
% % only include relevant parts for source extraction / stf sections
% \include{reduction_part2}
% \include{cal_appendix}
%\clearpage
\bibliographystyle{apj_w_etal}
\bibliography{v2}
\end{document}

\input{preface}
\section{The Angular Transfer Function of the BGPS}
\subsection{Atmosphere Tests}
\label{sec:atmotests}
In order to determine the angular response of the Bolocam array and BGPS
pipeline in realistic observing conditions, we performed simulations of a
plausible synthetic astrophysical sky with synthetic atmospheric signal added
to the timestream.
To generate the simulated atmosphere, we fit a piecewise power law to a power
spectrum of a raw observed timestream. The power spectrum varies in amplitude significantly
depending on weather conditions and observation length, but the shape is
generally well-represented by $P\propto \nu^{-2}$ for $\nu < 2 $ Hz and $P \propto \nu^{-1} $
for $\nu \geq 2$ Hz where $\nu$ is the frequency.
We show a fitted timestream power spectrum in Figure \verb|\ref{fig:powerspecfit}|.
%\optional{
%At low frequencies, the power spectrum turns over because of the AC sampler
%(offset from the DC value, not the total power, is the measured value).
%Despite the break, we use the low-frequency power fit to represent the AC
%sampling.
%}
\Figure{{figures/050706_o53_raw_ds2.nc_indiv13pca_PowerSpectrumFit}.png}
{Fit to the power spectrum of a $\sim30$ minute observation. Three independent power
laws are fit to the data, with a fixed break at 0.02 Hz (below which the AC sampler
removes signal) and a fitted break at
higher frequency, near 2 Hz, where the power spectrum flattens towards white noise.
%The Y-axis indicates the spectral power in units of Jy$^2$ for a single beam; the
%power spectra were taken on the calibrated data
}
{fig:powerspecfit}{0.5}{0}
%Variations
%upon these atmospheric parameters were not investigated in detail, but in the
%limit that the atmosphere is perfectly correlated across the array, the details
%of the atmospheric behavior should not affect the pipeline's performance.
The Fourier transform of the atmosphere timestream is generated by applying noise
to the fitted power spectrum. The power at each frequency is multiplied by a
random number sampled from a gaussian distribution with width 1.2, determined
to be a reasonable match to the data, and mean 1.0.
The resulting Fourier-transformed timestream is $FT(ts) = (r_{\nu1} P_f)^{1/2} + i
(r_{\nu2} P_f)^{1/2}$, where $r_1$ and $r_2$ are the normally distributed random
variables and $P_f$ is the fitted power-law power spectrum.
The atmosphere timestream is then created by inverse Fourier transforming
this signal.
% I don't know why this is right, but I think it is: see
% PowerSpectrumStuff.ipynb
Gaussian noise is added to the atmospheric timestream of each bolometer
independently, which renders the correlation between timestreams imperfect.
The noise level set in the individual timestreams sets the noise level in the
output map.
\subsubsection{Simulated Map Parameters}
We simulated the astrophysical sky by
randomly sampling signal from a circularly symmetric 2D power-law distribution in Fourier space. We
modeled this signal using power spectrum power-law indices ranging from -3 to
+0.5; in the HiGal $\ell=30$ SDP field, the power-law index measured from the
500 \um\ map is $\alpha\sim-2$ (see Section \verb|\ref{sec:otherdata}|).
The data were smoothed with a model of the instrument PSF to simulate the
telescope's aperture and illumination pattern.
For each power-law index, four realizations of the map using different random seeds
were created.
The signal map was then sampled into timestreams with the Bolocam array using
a standard pair of perpendicular boustrophedonic scan patterns.
Examples of one of these realizations with identical random numbers and
different power laws are shown in Figure \verb|\ref{fig:exp10gridin}|.
\FigureTwo{figures/exp10_input_grid}{figures/exp10_recovered_grid}
{Examples of input (left) and output (right) maps for different power law $\alpha$ values.
For very steep power laws, most of the power is on the largest scales.
$\alpha=0$ is white noise. The axis scales are in pixels, where each pixel
is 7.2\arcsec, so each field is approximately 1\arcdeg\ on a side. The Bolocam
footprint is plotted in the lower-right panel of the left figure as an
indication of the largest possible recovered angular scales. The input images are
normalized to have the same \emph{peak} flux density.
The pipeline recovers no emission from the simulation with $\alpha=3$, but this
value of $\alpha$ is not representative of the real astrophysical sky -
Herschel sees structure with $\alpha\lesssim2$, and the BGPS detected a great
deal of astrophysical signal (see Section \verb|\ref{sec:otherdata}| and Figure
\verb|\ref{fig:higalpowerlaw}|).
}
{fig:exp10gridin}{1}
% We found that all power-law indices returned broadly consistent results, but
% the steeper indices had no signal recovery at small spatial scales because of
% low signal-to-noise ratio (i.e., the selected normalization put all recoverable
% structure below the observational noise level). Example recovered images as a function of $\alpha$
% are shown in figure \verb|\ref{fig:exp10gridout}|. We therefore only used the
% simulations with moderate power-law indices ($-2 < \alpha < -1$) for
% quantitative analysis.
% \Figure{figures/exp10_recovered_grid}
% {Examples of the recovered maps for different power law $\alpha$ values.
% For the steepest power-law, most of the flux above the noise level is lost. }
% {fig:exp10gridout}{0.5}{0}
%If the
%data are downsampled, a filter of the form $f(\nu) = 2/ (1+(\nu/\nu_0)^3)$ is
%applied (multiplied by $FT(ts)$) at this point. If it is applied, it is
%deconvolved after downsampling.
% Not needed to understand section, therefore excluded
% Because the bolometers have different gains, the atmosphere timestream is
% multiplicatively scaled by a random value sampled from a normal distribution
% with mean 1 and width 0.4 (which approximately matches the true gain
% distribution). This step is included to test the gain correction performed
% (non-iteratively) in the pipeline. The gain correction is performed
% independently for each observation.
% Removed because I think this is effectively included already. Also, I think
% the 'gains' are applied AFTER that atmosphere is added (wouldn't really make sense otherwise)
%After the relative scales are applied, the atmosphere timestream for all
%bolometers is scaled by a specified amplitude to make the atmosphere amplitude
%greater than or comparable to the astrophysical signal amplitude.
% This noise should
% represent a combination of uncorrelated electronic noise and optical noise from
% the observed light. It is responsible for setting the final noise level in the
% output map.
% \Figure{figures/airy_test_ds2_reconv_arrang45_atmotest_varyrelscale_amp1.0E+01_pointcompare.png}%exp2_varyrelscale_amp1E+01_map20_ds2inputcompare_point}
% {Example point source (Airy function) simulation with atmosphere. The top panel shows radial
% profiles of the input and pipeline-reduced (ds2 indicating downsampling by a factor of 2)
% maps. The bottom panels show the maps as labeled. The black circle is the
% fitted circular Gaussian FWHM . This simulation uses atmospheric noise with an
% amplitude $10\times$ the peak amplitude of the input source, typical of a calibrator
% observation. \todo{Remove extraneous text. Remove titles}
% %The gaussian
% %noise added has an RMS equal to the peak amplitude of the input source. The
% %flux recovery fraction (within the first Airy null) is 92.7\%.
% %For both the
% %input map and the pipeline-recovered map, the gaussian fit overpredicts both
% %the peak of the Airy and the wings and underpredicts the intermediate region.
% }
% {fig:pointatmosim2}{0.5}{0}
% \todo{Experiments:}
% - nu^-1.5, nu^-2 power spectra inputs - examine how sensitive pipeline is to input power
% - vary as a function of astrophysical:atmospheric power
% - Determine relative power: measure l=30, l=1 astro/atmo ratio
% - run simulations on that basis
% - then run simulations based on l=65
% - 3-5 realizations for each
\subsection{The Angular Transfer Function}
\label{sec:STF}
% We measure the spatial transfer function of Bolocam and the BGPS pipeline using
% a series of simulations. We generated artifical sky maps assuming a power-law
% distribution in the angular azimuthally averaged power spectrum.
% We created a
% power-spectral-density map for a small range of assumed power-law $\alpha = -1,
% -1.5, $ and $-2$ and took the inverse fourier transform of its square root to
% generate the artifical sky map.
% %We
% %then multiplied the resulting map by a Gaussian $\sigma=0.25 \degree$ in the Y-direction to
% %impose Galactic-plane-like structure onto the map.
% Realistic atmospheric noise was added to the maps as described in \todo{Section
% \verb|\ref{sec:atmotests}|}, and the data were reduced in the same process as the real
% data.
We used a subset of these power-law simulations to measure the amount of recovered signal at each
angular (spatial) scale.
For each power-law in the range $2