%\documentclass[panstarrs,psreport,12pt]{panstarrs}
\documentclass[panstarrs]{panstarrs}

% basic document variables
\title{Pan-STARRS 1 Moving Object Processing System}
\subtitle{Trailed Object Fitting}
\author{Joseph Masiero, Eugene Magnier, Paul Price, Robert Jedicke}
\shorttitle{Trailed Objects}
\group{Pan-STARRS MOPS development group}
\project{PS1 MOPS}
\organization{Institute for Astronomy}
% \distribution{}
\version{02}
\docnumber{PSDC-xxx-xxx}
% note the use of the docnumber & version number:
% the complete PSDC document number is given by
% \thedocnumber-\theversion

\begin{document}
\maketitle

% -- Revision History --
\RevisionsStart
% version   Date         Description
01        & 2006.10.04 & First draft \\
02        & 2006.10.12 & Added initial comments from RJ \\
02        & 2006.10.18 & edits for clarity \\
\RevisionsEnd

% -- TBD / TBR Listing --
%\TBDsStart
% section % page Date        Description
%1.2.3.4   & 2    & xxx-xxx & missing a dingle on a dangle \\
%\TBDsEnd

\pagebreak
\tableofcontents

\pagebreak
\listoffigures

\pagebreak 
\pagenumbering{arabic}
\section{Overview}

Many of the Near-Earth Objects (NEOs) that will be imaged by Pan-STARRS will
have significant ($>1~$pixel, $>0.26''$) apparent motions over the
$30~$second exposure time of each image.  These objects, instead of being
point sources, will be imaged as trails moving across the CCD.  While these
trails provide information about the rate of motion of the object, they also
present a problem in extracting that information in an automated manner using
the PSF-fitting code that is being developed by the Pan-STARRS Image
Processing Pipeline (IPP).  In order to accurately determine the orbit of a
NEO that is trailed, we need to determine the trail's center, length (and
thereby rate of motion), angle (and thereby direction of motion), and
brightness (and thereby magnitude and, assuming an albedo and calculating an
orbit, size).  To do this, we have developed an analytical description of a
trailed asteroid, which the IPP's {\tt psphot} code (PSDC-430-021-00, Magnier
et al.) will use as its model for fitting non-point sources in the Pan-STARRS
difference images.  Because these images will have had the static sky
removed, the only sources remaining will be point-source transients,
non-point source transients, cosmic rays, and other noise.  Once cosmic ray
removal routines have been run (or once transients not seen in multiple
images removed, in the case of PS4), and Point Spread Function (PSF) fitters
applied to the images, only trailed asteroids and comets will remain.  Comet
fitting routines are discussed in PSDC-5xx-xxx (Kleyna, et al), and so we
shall only concern ourselves with trailed asteroids.

In order to test the effectiveness and efficiency of our trailed object
fitting routine, we have developed a synthetic trail generator, which can
create artificial trails at a variety of magnitudes, lengths, angles, and
positions.  We then applied our fitting model to these synthetic trails.
Results of these tests are described, as well as problems with the model they
have illuminated that need to be addressed.


\section{Synthetic Trail Generation}
The Pan-STARRS Moving Object Processing System (MOPS) will have a
self-testing procedure involving the creation and subsequent blind analysis
of synthetic detections, as described in PSDC-5xx-xxx (Jedicke, et al).
Because MOPS will not access the images directly, but rather only the
detection lists provided by the IPP, it is important to know the detection
efficiency for trailed objects, as well as the typical errors on derived
quantities such as flux, length, angle of motion, and center position.  In
order to determine these errors and efficiencies for our analytical model, a
set of images of trailed objects with known exact parameters is required.  In
order to better simulate real trails in Pan-STARRS images, the synthetic
trails were inserted into test images from the Canada-France-Hawaii Telescope
(CFHT)/MegaCam.  These images were taken to approximate the pixel size,
exposure time and filter of what is expected for PS1 images.  In addition,
MegaCam's Elixir image processing system (Magnier \& Cuillandre, 2004) is
similar to the preliminary steps of PS1's IPP, meaning that MegaCam images
are at a similar stage in processing as PS1 images will be just before the
IPP PSF fitter is applied.

We generated our synthetic trailed objects by inserting a large number of
individual ``sub-PSFs'' along the line of motion at $0.2~$pixel ($0.74''$)
spacing to build up a trail.  The ``sub-PSFs'' spacing size was chosen to
ensure a smooth final trail without bogging down the generation code due to
excessive numbers of iterations.  In principle, anything with motions greater
than $\sim0.5~$pixels per image ($\sim22~$arcsec/hr or $\sim0.15~$deg/day)
should be detectable however in practice it is difficult to distinguish
between motions of this magnitude and slight variations in object PSF.

Each ``sub-PSF'' is a Gaussian ellipsoid, where the major axis was matched to
the assumed-circular PSF measured for stars in the field, and the minor axis
had a value of $90\%$ that of the major axis.  This was done to model real
sources which may not necessarily have perfectly circular PSFs.  The
``sub-PSFs'' were then co-added to create a smooth trail.  Poissonian noise
was added to the counts on each pixel, and the trail was inserted into the
data image at a random location.  Each trail was given a randomly
distributed:

\begin{itemize}
\item location of trail center
\item 'stationary' $g'$ magnitude between $13$ and $20$~mag
\item angle of motion (from the pixel x-axis)
\item rate of motion between ($0~-~10$~deg/day)
\end{itemize}

Trail positions were generated without regard to chip gaps, bad columns,
stars, or other image features.  Fig~\ref{fig.strail} shows an example
of one of our synthetic trails near the edge of a chip.

\section{Analytical Model}

We developed an analytical model to fit both synthetic and real trailed
objects with an line minimization (LM) $\chi^2$ minimizer (PSDC 430-012,
Price \& Magnier, based on Press et al., 2002).  Although the most
appropriate model is a convolution of the fitted PSF with a line of the
desired length and orientation, this method is incredibly computationally
intensive making the run-time prohibitive, and finding analytical
derivatives of such a function that are easily implemented in a program
quickly exceeds the scope of this project.

We have chosen instead to represent our trailed objects with a piecewise
function consisting of $3^{rd}$ order approximations of Gaussians, creating a
one-dimensional ``pipe'' with two-dimensional ``endcaps'', as illustrated by
a wire diagram in Fig~\ref{fig.wire}.  First we define a new coordinate
system $\left(x',~y'\right)$, where the $x'$ axis runs along the trailed
object's line of motion, and $y'$ runs perpendicular to the line of motion,
and the location $\left(x',~y'\right)=\left(0,~0\right)$ is the derived
center of the trail $\left(x,~y\right)=\left(x_0,y_0\right)$.  Beyond a
half-length in both the $+x'$ and $-x'$ directions, we follow the derived
stellar PSF exactly.  Between these two points we use a constant brightness
line along the $x'$ axis with $3^{rd}$ order Gaussian falloff along the $y'$
axis, matching the FWHM of the derived stellar PSF at that orientation.

The flux $F$ at any given pixel $(x_1,y_1)$, defined below, will just be the
local sky background ($F_{sky}$) plus the contribution from the trail which
is just the peak flux of the trail ($F_{peak}$) times the third-order
Gaussian falloff.  This falloff will depend on the sigma-weighted distance
$z$.

The derived parameters of the equations are: $F_{peak}$, the pixel-coordinate
location of the trail center $\left(x,~y\right)=\left(x_0,~y_0\right)$, the
length of the trail $l$, and the angle with respect to the pixel x-axis
$\theta$.

The equations used for this model are:

\begin{eqnarray}
      F_{(x_1,y_1)} & = & F_{peak}~\left(1+z+\frac{z^2}{2}+\frac{z^3}{6}\right)^{-1} + F_{sky}\\
      z & = & \frac{x_1^2}{2~\sigma_x^2} + \frac{y_1^2}{2~\sigma_y^2} + \sigma_{xy}~x_1~y_1
\end{eqnarray}

where $\sigma_x$, $\sigma_y$, and $\sigma_{xy}$ as the ellipsoid PSF shape
parameters in the unrotated frame.  

We use $x_1$ and $y_1$ as the pixel locations with respect to a ``reference
point'' $\left(x'_r,~y'_r\right)$ to determine the Gaussian falloff.  For the
central ``pipe'' region of the trail, the ``reference point'' is the nearest
point on the line of motion ($x'_r=x'$, $y'_r=0$), and thus the falloff only
depends on the distance in the $y'$ direction.  For the endcap regions, the
``reference point'' is the end of the line of motion ($x'_r=\pm~l/2$,
$y'_r=0$), creating a two-dimensional third-order Gaussian falloff beyond the
limits of the object's motion.  When using $l$ as the derived length of the
trail and $\theta$ is the derived angle with respect to the pixel x-axis, we
can write the equations for $x_1$ and $y_1$ as:

\begin{itemize}
\item for $x' > \frac{l}{2}$:
\begin{eqnarray}
      x_1 & = & \left(x'-\frac{l}{2}\right)~\cos\theta - y'~\sin\theta\\
      y_1 & = & \left(x'-\frac{l}{2}\right)~\sin\theta + y'~\cos\theta
\end{eqnarray}
\item for $x' < -\frac{l}{2}$:
\begin{eqnarray}
      x_1 & = & \left(x'+\frac{l}{2}\right)~\cos\theta - y'~\sin\theta\\
      y_1 & = & \left(x'+\frac{l}{2}\right)~\sin\theta + y'~\cos\theta
\end{eqnarray}
\item for $\frac{l}{2} \ge x' \ge  -\frac{l}{2}$:
\begin{eqnarray}
      x_1 & = & -y'~\sin\theta\\
      y_1 & = & y'~\cos\theta
\end{eqnarray}
\end{itemize}

The LM minimizer also requires the derivative of the model with respect to
all variables.  The derivatives are:

\begin{eqnarray}
	\frac{dF}{dF_{sky}} & = & 1\\
        \frac{dF}{dF_{peak}} & = & \left(1+z+\frac{z^2}{2}+\frac{z^3}{6}\right)^{-1}
\end{eqnarray}

and letting $q =
F_{peak}~\left(1+z+\frac{z^2}{2}+\frac{z^3}{6}\right)^{-2}~\left(1+z+\frac{z^2}{2}\right)$,
and defining $S_x = \frac{1}{\sigma_x}$, $S_y = \frac{1}{\sigma_y}$, and
$S_{xy} = \sigma_{xy}$:

\begin{itemize}
\item for $x' > \frac{l}{2}$:
\begin{eqnarray}
	  \frac{dF}{dx_0} & = & q~\left(S_x^2~x_1 + S_{xy}~y_1\right)\\
	  \frac{dF}{dy_0} & = & q~\left(S_y^2~y_1 + S_{xy}~x_1\right)\\
	  \frac{dF}{dS_x} & = & -q~S_x~x_1^2\\
	  \frac{dF}{dS_y} & = & -q~S_y~y_1^2\\
	  \frac{dF}{dS_{xy}} & = & -q~x_1~y_1\\
	  \frac{dF}{dl} & = & q~\left(S_x^2~x_1~\frac{\cos\theta}{2} + S_y^2~y_1~\frac{\sin\theta}{2} + S_{xy}~x_1~\frac{\sin\theta}{.}+ S_{xy}~y_1~\frac{\cos\theta}{2}\right)\\
	  \frac{dF}{d\theta} & = & -q~\left(S_x^2~x_1~\frac{l}{2}~\sin\theta - S_y^2~y_1~\frac{l}{2}~\cos\theta - S_{xy}~x_1~\frac{l}{2}~\cos\theta + S_{xy}~y_1~\frac{l}{2}~\sin\theta\right)
\end{eqnarray}
\item for $x' < -\frac{l}{2}$:
\begin{eqnarray}
	  \frac{dF}{dx_0} & = & q~\left(S_x^2~x_1 + S_{xy}~y_1\right)\\
	  \frac{dF}{dy_0} & = & q~\left(S_y^2~y_1 + S_{xy}~x_1\right)\\
	  \frac{dF}{dS_x} & = & -q~S_x~x_1^2\\
	  \frac{dF}{dS_y} & = & -q~S_y~y_1^2\\
	  \frac{dF}{dS_{xy}} & = & -q~x_1~y_1\\
	  \frac{dF}{dl} & = & -q~\left(S_x^2~x_1~\frac{\cos\theta}{2} + S_y^2~y_1~\frac{\sin\theta}{2} + S_{xy}~x_1~\frac{\sin\theta}{2} + S_{xy}~y_1~\frac{\cos\theta}{2}\right)\\
	  \frac{dF}{d\theta} & = & -q~\left(-S_x^2~x_1~\frac{l}{2}~\sin\theta + S_y^2~y_1~\frac{l}{2}~\cos\theta + S_{xy}~x_1~\frac{l}{2}~\cos\theta - S_{xy}~y_1~\frac{l}{2}~\sin\theta\right)
\end{eqnarray}
\item for $\frac{l}{2} \ge x' \ge  -\frac{l}{2}$:
\begin{eqnarray}
	  \frac{dF}{dx_0} & = & q~\sin\theta~\left(S_x^2~\sin\theta~x_1 - S_y^2~y_1~\cos\theta - S_{xy}~x_1~\cos\theta + S_{xy}~y_1~\sin\theta\right)\\
	  \frac{dF}{dy_0} & = & q~\cos\theta~\left(-S_x^2~x_1~\sin\theta + S_y^2~\cos\theta~y_1 + S_{xy}~x_1~\cos\theta - S_{xy}~y_1~\sin\theta\right)\\
	  \frac{dF}{dS_x} & = & -q~S_x~x_1^2\\
	  \frac{dF}{dS_y} & = & -q~S_y~y_1^2\\
	  \frac{dF}{dS_{xy}} & = & -q~x_1~y_1\\
	  \frac{dF}{dl} & = & 0\\
	  \frac{dF}{d\theta} & = & -q~(S_x^2~x_1~\left(x'~\sin\theta - y'~\cos\theta\right) + S_y^2~y_1~\left(x'~\cos\theta - y'~\sin\theta\right) + \nonumber \\
	& & S_{xy}~x_1~\left(x'~\cos\theta - y'~\sin\theta\right) + S_{xy}~y_1~\left(x'~\sin\theta - y'~\cos\theta\right))
\end{eqnarray}
\end{itemize}

The $S_x = \frac{1}{\sigma_x}$, $S_y = \frac{1}{\sigma_y}$, and $S_{xy} =
\sigma_{xy}$ values will be fitted by the earlier, PSF-fitting stage of the
image processing and passed to our code.  The IPP finds median values for the
PSF parameters from all the stellar-like objects in the image, and allows
these values to vary as a function of position in the field.  $F_{sky}$ is
likewise calculated during an earlier stage of image processing.

We have also developed a model that will simultaneously fit the circular PSF
parameters of a trail in addition to the parameters mentioned above.  This
method is convenient for testing this section of code independent of the rest
of the source fitting process.  When trying to fit both the trail parameters
and the ellipsoid PSF parameters, however, we find that the number of
variables causes a steep degradation in fit quality.  Thus, it is not
recommended to attempt to fit the trail and two-dimensional PSF parameters in
a single stage, but rather first fit the PSF parameters to the stars alone,
and then fit the trail parameters knowing the PSF parameters.  This is only
possible when the model is fully integrated in the fitting routine.

\section{Trail Identification Efficiency and Fitting Accuracy}
To test the efficiency of our trail-fitting routines, we first inserted our
synthetic trails randomly into CFHT/MegaCam images.  These images were taken
with the $g'$ filter, with $40$ second exposures, and binned $2\times2$ to
give the pixels $0.37''$ sizes.  This was all done to mimic as closely as
possible the proposed PS4 Solar System images.  Originally, these data were
acquired to measure the sky-plane density of asteroids in the Main Belt that
could be observed with Pan-STARRS during opposition and in the sweet spot.
However, because of the similarities in the both the method of taking the
data and the basic processing, these images can act as good
stand-ins for actual PS1/PS4 data.

After object insertion, we then ran the IPP source determination routine {\tt
psphot} on the images, first fitting all PSF-like objects with a
2-dimensional third-order approximation to a Gaussian.  All non-PSF objects
in the field were assumed to be trails and the above model was fitted to
them.  Because there were galaxies in our image, not everything that was
passed to our routine was a trail, and derived center pixels were compared to
generated center pixels to recover trails from the data.  Any derived trail
that had a center within $10$ pixels ($3.7~$arcsec) on both axes of a
generated trail's center was considered a match.  An arbitrary cut of $2$
pixels ($0.74~$arcsec) was applied to attempt to filter out more likely
matches, but this method was not rigorous.  Objects within $10$ pixels are
marked in the following plots with red points, while those with $2$ pixels are
marked in black.  Both types of point will be referred to by their color in
the rest of this section.

Because there is no way to confirm if a match is true, besides going through
each trail manually, there is the possibility that non-trail objects are
entering our results.  The effect of this would be an artificial increase in
reported efficiency.  However, these false detections would be expected to
have random derived lengths and angles, and so should also increase the RMS
of the fit quality of those values.  It may be possible to do a
multi-dimensional cut of the false detections based on length, angle and
magnitude, but as we will see below each of these parameters has its own
problems associated with determining it correctly.  Figure~\ref{fig.xyhist}
shows that even without more stringent cutoffs, most of the trails are within
$0.1~$pixels ($0.037~$arcsec), and so the biasing of efficiency or RMS values
can be ignored.

We began our analysis by looking at the number of generated synthetic trails
that were derived as either red or black points by our algorithm.  We find
that our model is applied to only $\sim50\%$ of the generated trails down to
a 'stationary' magnitude of $g'=17$, with a significant decrease at larger
magnitudes, as seen in Figs~\ref{fig.maghist}\&\ref{fig.mageff}.  We traced
the source of this low efficiency to the section of the {\tt psphot} code
that determines which model should be used to fit each object.  When {\tt
psphot} is run on an image, it first finds all groups of pixels that are
collectively above the background noise by at least $3\sigma$.  It then tries
to determine whether the source is a point, an extended source, or a ``bad''
source (e.g. cosmic ray, hot pixel, diffraction spike).  The code then runs
the PSF fitting routine on the point sources, next applies the extended
source model to all the extended sources, and finally files the ``bad''
sources away in a separate output file.  However, some trails present
problems for the code's initial type determination, which results in the
source being fit neither as a PSF nor an extended source, and not being put
into the ``bad'' list either.  The majority of our trails that were lost fall
into this category, while a smaller fraction of the total number (though a
larger relative fraction of the slow moving trails) are fit as PSFs instead
of extended sources.  This is because their slow motions make them
indistinguishable from point sources.

For those trails that were black points, we determine the RMS of the scatter
in pixel location to be $0.20~$pixels ($0.074''$) from the center of the
generated trail to the center of the derived trail.  A scatter plot of the
difference in location centers is shown in Fig~\ref{fig.xy}, with the dotted
line describing the cut between the black points and the red points.

Looking at the comparison between generated and derived trail length in
Fig~\ref{fig.length}, there are two features that are cause for concern.  The
first is the $\sim3.9~$pixel offset between the dotted line marking a
one-to-one relation and the linear trend of the data points.  The second is
the distinction between red and black points, especially at longer trail
lengths, with the red points being far more poorly fit than the black.  The
distance of the pixel offset shows a relation with the assumed PSF of the
generated trails, where a smaller generated PSF causes a smaller offset
between the two lines.  Ideally this can be modeled out, and a process to do
this is being investigated.  After artificially removing the offset in the
generated-to-derived comparison we find an RMS scatter of $1.9~$pixels
($0.70~$arcsec) in the black points.  The distinction between the red and
black points is caused by trails that are only partially fit, e.g. those
broken by stars, bad columns, or noise.  This will show offsets in length and
pixel center, but should show the correct derived angle, as described below.
This problem is much more difficult to deal with, as it involves developing a
smarter initial object identifier.

Looking at the relation between the derived and generated angles of motion,
we see a much tighter correlation, as shown in Fig~\ref{fig.theta}.  There
are some points randomly scattered, but this is unrelated to whether the
derived trails were labeled by black or red points, and in fact many of the
red points have reasonably accurate angular fits, as predicted above.  Much
of the scatter seen can be explained by trails with very short lengths, and
thus very ambiguous angles.  As trails become longer, angle fitting accuracy
improves, though some scatter does still remain.  We find an RMS scatter in
angle of motion of $6.8^\circ$ for the black points when looking across all
trail lengths.  For trails with motions $5\le~v~\le10~$deg/day, c.f.
Fig~\ref{fig.thetalong}, we find an RMS scatter of $1.4^\circ$ for the same
points.  There are a few points with very large errors ($\sim180^\circ$) near
the $-90^\circ$ and $+90^\circ$ extrema, but this is to be expected as fits
near these values are nearly identical.  The difference in the absolute value
of the derived and generated angles for these points was used in the above
RMS calculation, to prevent the small number of large-error points from
dominating the calculated value.  There also appears to be an increase in the
angular RMS near generated angles of $0^\circ$ and $90^\circ$.  This effect
is currently unexplained, but may be a result of the trigonometric functions
used in the angle determination, and is currently being investigated.
Fig~\ref{fig.tloff} shows the difference between generated and fitted angles
as a function of generated trail length.  As trails get shorter, the error in
the angle fitting increases, as is expected.

When comparing derived magnitude to the generated magnitude, we first needed
to shift the derived magnitude by the $26.28~$mag zero-point, as given in the
image header.  This value was calculated during the image processing step by
the MegaCam Elixir system (Magnier \& Cuillandre, 2004).  A comparison of
these two values can be seen in Fig~\ref{fig.mag}.  There is significant
scatter, but no seeming pattern, other than that the red points show much
dimmer derived magnitudes than the black ones, as would be expected if they
were only partial fits of the trail length.  However, when we compare the
difference in generated and derived magnitudes as a function of length, as
seen in Fig~\ref{fig.mloff}, we see an interesting, and worrying, trend.  As
the generated trail length gets longer, the fitter calculates bigger (dimmer)
magnitudes for the objects than are actually generated.  Additionally, as the
trail length goes to zero, the derived magnitudes are actually brighter than
the generated ones.  The latter problem may be due to incorrect trail
generation techniques, or could be due to the same effect that is causing the
underestimation at longer trail lengths, which is currently unexplained and
being investigated.

\section{Summary}

We have developed an analytical model of a trailed asteroid, to be
incorporated into the Pan-STARRS IPP.  This model will be fit to trailed
objects in the Pan-STARRS images to extract information about the position
and motion of nearby objects, which will aid in the orbit identification and
recovery of the object.  Application of our analytical trailed asteroid model
to synthetic trails has illuminated areas of that need to be improved, but
has shown indications that we are using the correct methods.

In particular, before this fitting algorithm can be released into the main
pipeline, a few issues need to be resolved, including:
\begin{itemize}
\item The PSF dependent offset between the generated and derived lengths
\item The increase in error of the determined angle near $0^\circ$ and $90^\circ$
\item The difference between generated and derived magnitudes, especially as a function of length
\item The passing of only $\sim50\%$ of the observed trailed objects to the fitting routine
\item The fitting of parts of trails instead of the full trail
\end{itemize}

The first three issues are errors related to the way the trails are modeled,
and thus can be fixed with appropriate consideration during model
determination.  The latter two problems are more difficult to fix, as they
are problems inherent to the way that the core {\tt psphot} code operates.
Still, as {\tt psphot} is undergoing continuous upgrades by the IPP, these
issues may be solved by future releases.

Despite the areas that require investigation, the accuracy of the trailed
objects that are fit indicates that our model and this method of fitting will
be effective for determining the location and motion of NEOs and other
swiftly moving objects.

\bibliographystyle{plain}
\begin{center}
{\bf Bibliography}
\end{center}
%Bertin, E. \& Arnouts, S., 1996, A\&AS, 117, 393.

Jedicke, R., et al., 2006, MOPS Testing procedure, PSDC-5xx-xxx

Kleyna, J.~T., et al., 2006, MOPS Comet Fitting, PSDC-5xx-xxx

Magnier, E.~A. \& Cuillandre, J.~C., 2004, PASP, 116, 449.

Magnier, E.~A., Price, P.~A., Lupton, R.~H. \& Hoblitt, J., 2006, Pan-STARRS PS-1 IPP Library Supplementary Design Requirements Specification, PSDC-430-007

Magnier, E.~A., et al., 2006, Pan-STARRS PS1 IPP PSPhot Software Design Description, PSDC-430-021

Press, W.~H., Teukolsky, S.~A., Vetterling, W.~T. \& Flannery, B.~P., 2002, Numerical Recipes, Cambridge University Press.

Price, P.~A. \& Magnier, E.~A., 2006, Pan-STARRS PS1 IPP Modules Supplementary Design Requirements Specification, PSDC-430-012

%\bibitem [Masiero et~al.(2006)]{SPD} 
%Masiero, J.~R., Jedicke, R., Price, P.~A., Kubica, J., \& Heasley, J.~N., 2006, in prep.


%\bibliography{panstarrs}


\newpage
\begin{figure}
\begin{center}
\includegraphics[scale=0.5]{trail.jpg} 
\end{center}
\protect\caption{An example of a synthetic trail generated by our code.  The green axes show the directions defined as ``x'' and ``y'', and the red arrows indicate the synthetic trail, which has a 'stationary' $g'$ magnitude of $18.96~$mag, angle of motion of $29.62^\circ$ counter-clockwise from the x-axis, and rate of motion of $6.04~$deg/day.
}
\label{fig.strail}
\end{figure}
\clearpage

\newpage
\begin{figure}
\begin{center}
\includegraphics[scale=1]{wirestrail.jpg}  
\end{center}
\protect\caption{A wire diagram of the analytical model used to fit trailed objects.  The x and y axes (denoted in Fig~1) are indicated, as are the $x'$ and $y'$ axes, which are rotated by angle $\theta$ to line up with the trail's direction of motion.
}
\label{fig.wire}
\end{figure}
\clearpage

\newpage
\begin{figure}
\begin{center}
\includegraphics[scale=0.4]{strailHistxy.jpg}  
\end{center}
\protect\caption{Histogram of RMS on derived center point for generated synthetic trails.
}
\label{fig.xyhist}
\end{figure}

\begin{figure}
\begin{center}
\includegraphics[scale=0.4]{strailHistmag.jpg}  
\end{center}
\protect\caption{Histogram of magnitudes of trails generated (dashed) and found (solid) for all trail lengths.
}
\label{fig.maghist}
\end{figure}
\clearpage


\newpage
\begin{figure}
\begin{center}
\includegraphics[scale=0.4]{strailHistmageff.jpg}  
\end{center}
\protect\caption{Trail fitting efficiency (derived/generated) vs magnitude.
}
\label{fig.mageff}
\end{figure}

\begin{figure}
\begin{center}
\includegraphics[scale=0.4]{strailCompxy.jpg}  
\end{center}
\protect\caption{Differences in x and y positions between the generated and derived synthetic trails.  The black points are defined as derived trails that were less than $2$ pixels ($0.74~$arcsec) in x or y away from the generated trail center (inside the dotted-line box) while the red points are defined as derived trails between $2$ and $10$ pixels  ($0.74$ and $3.7~$arcsec) in x or y away from the generated trail center.
}
\label{fig.xy}
\end{figure}
\clearpage


\newpage
\begin{figure}
\begin{center}
\includegraphics[scale=0.4]{strailComplength.jpg}  
\end{center}
\protect\caption{Generated trail length compared to derived length.  The red points indicate trails with large RMS in derived center position.
}
\label{fig.length}
\end{figure}

\begin{figure}
\begin{center}
\includegraphics[scale=0.4]{strailComptheta.jpg}  
\end{center}
\protect\caption{Generated angle (with respect to the pixel x axis) compared to derived angle.  
}
\label{fig.theta}
\end{figure}
\clearpage

\newpage
\begin{figure}
\begin{center}
\includegraphics[scale=0.4]{strailLongtheta.jpg}  
\end{center}
\protect\caption{Generated angle (with respect to the pixel x axis) compared to derived angle for trails with lengths between $5$ and $10$ degrees per day.
}
\label{fig.thetalong}
\end{figure}

\begin{figure}
\begin{center}
\includegraphics[scale=0.4]{strailComptloff.jpg}  
\end{center}
\protect\caption{The scatter in derived angle compared to the generated length of the trail.  Red points are those that show significant differences in derived center points.
}
\label{fig.tloff}
\end{figure}
\clearpage

\newpage
\begin{figure}
\begin{center}
\includegraphics[scale=0.4]{strailCompmag.jpg}  
\end{center}
\protect\caption{Generated magnitude compared to derived magnitude.  The derived magnitude has been shifted by $28.26$ magnitudes, corresponding to the Elixir-calculated zero-point of the images used.
}
\label{fig.mag}
\end{figure}

\begin{figure}
\begin{center}
\includegraphics[scale=0.4]{strailCompmloff.jpg}  
\end{center}
\protect\caption{The scatter in derived magnitude compared to the generated length of the trail.  A negative value on the y-axis implies an object fitted to a fainter flux level than was generated.
}
\label{fig.mloff}
\end{figure}
\clearpage


\end{document}

