%\input /pros/doc/scidoc/skeleton.tex
\def\version{\it Version 1.1 --- 3/31/86}
\def\chapter{\it Timing Analysis: Period searching via truncated
Fourier series}
%\chapterhead{Science Specifications for the PROS}
%\chapterhead{Timing Analysis: Period searching via truncated
%Fourier series}
\chapterhead{V.~Period searching via truncated Fourier series}

\@{Overview}

\noindent
{\it Science Contact}:  J. McClintock

\noindent
{\it Function Purpose}: 
The purpose of this algorithm is to carry out a $\chi^2$ search for
periodicities by fitting time series data to a truncated Fourier
series for a user-specified range of trial periods ($P$).  Gaps in the
data are not an explicit problem for the user of this algorithm;
consequently, this period search technique complements the standard Fourier
analysis, which is sensitive to how data gaps are treated (see
memo by R.~Kelley).

\@{Input Data}

\vskip 12pt

\halign{\indent\qquad\qquad#&#\hfil\quad\quad&#\hfil \cr
&$T_S$, $T_E$ & Overall start and end times. \cr
\noalign{\vskip 6pt}
&$m$ & Total number of time bins (excluding data gaps).\cr
\noalign{\vskip 6pt}
&$n$ & Number of sine/cosine terms ($2n+1$ coefficients \cr
&&  in all).  Note:  $2n+1$ cannot exceed $m$. \cr
&& Typically $n \sim 1-10$ and  $2n+1 << m$. \cr
\noalign{\vskip 6pt}
&$P_{min}, P_{max}$ & Range of periods to be searched. \cr
&& Note:  $P_{max}$ cannot be greater than $T_E -T_S$, \cr
&& and $P_{min}$ cannot be  less than the Nyquist limit \cr
&& (twice the binning interval). \cr
\noalign{\vskip 6pt}
&$\Delta P$ & Period step [default value = $P^2 /(T_E -T_S)$; see below]. \cr
\noalign{\vskip 6pt}
&FLAG =& $\lbrace S$:  time in seconds \cr
&& $\lbrace D$:  time in days \cr }

\vskip 12pt

It is assumed that the count-rate data have been extracted and binned
as described in the ``Light Curve'' memo by J.~McClintock and have the
following form:

\vskip 12pt

\halign{\indent\qquad\qquad#&\hfil#\hfil\quad&\hfil#\hfil\quad&\hfil#\hfil\quad&\hfil#\hfil\quad&\hfil#\hfil\quad&\hfil#\hfil\quad&\hfil#\hfil\quad
\cr
&$T_1$&$T_2$&$T_3$&...&$T_i$&...&$T_m$ \cr\noalign{\vskip 12pt}

&$X_1$&$X_2$&$X_3$&...&$X_i$&...&$X_m$\cr\noalign{\vskip 12pt}
&$E_1$&$E_2$&$E_3$&...&$E_i$&...&$E_m$ \cr }

\vskip 12pt

\halign{\qquad\qquad\qquad\hfil#\hfil\quad&#\hfil \cr
where&$T_i\equiv$ start time of a bin \cr\noalign{\vskip 12pt}
&$X_i\equiv$ count rate (counts/sec). \cr\noalign{\vskip 12pt}
&$E_i\equiv$ Statistical error in $X_i$. \cr }

\vskip 12pt

The model to be compared to the data is a truncated Fourier series
of the following form:
$$\eqalign{X(T_{i})&= c_{o} + a_{1} \sin {2\pi\over P} T_{i} + a_{2} \sin {4\pi\over P} T_{i} + ... a_{n} \sin {2n\pi\over P} T_{i} \cr 
&+ b_{1} \cos{2\pi\over P} T_{i} + b_{2} \cos {4\pi\over P} T_{i} + ... b_{n} \cos {2n\pi\over P} T_{i} \cr }$$

\vskip 12pt

\item{}Note:  For short trial periods, $P\leq 8$ times the binning interval, each
term above is replaced by an integral which can be approximated by a
4-term sum: 

$$\left({\it e.g.},\qquad  a_{1} \sin {2\pi\over P}\ T_i\rightarrow {A_i\over
T_{i+1}-T_i}  \int_{T_{i}}^{T_{i+1}}\ \sin {2\pi t\over P}\ dt \right).$$

There are two steps to the analysis:  (1) For each value of the trial 
period $P$ in the
range $P_1$ to $P_2$, compute the $2n+1$ coefficients using the REGRES 
subroutine given by Bevington (1969).  The function (FCTN), which is
called by REGRES, is the expression $X(T_i)$ given above.  (2)  Using the
coefficients returned by REGRES, compute the reduced $\chi^2$ as a function
of the trial period $P$:

$$\chi^{2}_{\nu} (P) = {1\over m-(2n+1)} \sum^{m}_{i=1} {1\over
E^2_i} [X_i - X(T_i)]^2$$

\@{Output Data}

\vskip 12pt

\halign{\indent\qquad\qquad#&#\hfil\quad&#\hfil \cr
&Header:&$T_S$, $T_E$ \cr
&& \cr
&&$n$ \cr
&& \cr
&&$m$ \cr
&& \cr
&&$T_{live}$:  total time on source \cr
&& \cr
&&$T_{gap}$:   total time lost to gaps \cr
&& \cr
&&$T_{live}/(T_{live} T + T_{gap})$:  fraction of on-source time \cr
&& \cr
&& \cr
&Listing:&For each tried period $P$, list the following: \cr
&& \cr
&&$P$(seconds or days) \cr
&& \cr
&&$f$(cycles/s or cycles/d) $\equiv {1\over P}$:  frequency \cr
&& \cr
&&$\chi^2_{\nu}$ \cr
&& \cr
&& \cr
&Optional listing:&If the user requests it, also supply the $2n+1$ \cr
&&coefficients for each value of $P$. \cr
&& \cr
&Plot:&$\chi^2_{\nu}$ versus $f$ \cr }


\@{Choice of period/frequency steps.}

The user's choice of the minimum period sets the scale for the \underbar{coarsest}
steps that can be used that will search the entire frequency space:

$$\mid\Delta f\mid_{max} = 1/(T_{E}-T_{S}).$$

This step size corresponds to inserting one full cycle at the
fundamental frequency over the time interval spanned by the data set.
Since $P = 1/f$, the corresponding period step size is:

$$\mid\Delta P\mid_{max} = P^{2}/(T_{E}-T_{S}).$$

In general, if the computer power is available, the steps in $P$ or $f$
should be several times smaller than the values given above in order
to resolve a dip in the $\chi^{2}$ versus $f$ plot.

\@{References}

\refindent
P.R. Bevington, {\it Data Reduction and Error Analysis for the
Physical Sciences}, McGraw-Hill, New York, 1969, p.172 ff.

\vfill\eject

