Playground.c

Go to the documentation of this file.
00001 /*
00002 *  Copyright (C) 2007 Duncan Brown, Jolien Creighton, Stephen Fairhurst
00003 *
00004 *  This program is free software; you can redistribute it and/or modify
00005 *  it under the terms of the GNU General Public License as published by
00006 *  the Free Software Foundation; either version 2 of the License, or
00007 *  (at your option) any later version.
00008 *
00009 *  This program is distributed in the hope that it will be useful,
00010 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012 *  GNU General Public License for more details.
00013 *
00014 *  You should have received a copy of the GNU General Public License
00015 *  along with with program; see the file COPYING. If not, write to the
00016 *  Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
00017 *  MA  02111-1307  USA
00018 */
00019 
00020 /*----------------------------------------------------------------------- 
00021  * 
00022  * File Name: Playground.c
00023  *
00024  * Author: Brown, D. A.
00025  * 
00026  * Revision: $Id: Playground.c,v 1.7 2008/04/29 20:22:00 kipp Exp $
00027  * 
00028  *-----------------------------------------------------------------------
00029  */
00030 
00031 #if 0
00032 <lalVerbatim file="PlaygroundCV">
00033 Author: Brown D. A.
00034 $Id: Playground.c,v 1.7 2008/04/29 20:22:00 kipp Exp $
00035 </lalVerbatim>
00036 
00037 <lalLaTeX>
00038 \subsection{Module \texttt{Playground.c}}
00039 \label{ss:Playground.c}
00040 
00041 Determines if a given time (or segment) is playground data.
00042 
00043 \subsection*{Prototypes}
00044 \vspace{0.1in}
00045 \input{PlaygroundCP}
00046 \idx{LALINT8NanoSecIsPlayground()}
00047 \idx{XLALINT8NanoSecIsPlayground()}
00048 \idx{LALGPSIsPlayground()}
00049 
00050 \subsubsection*{Description}
00051 
00052 This module contains two routines to determine if a given time is in the data 
00053 designated as playground or not. The first routines takes input as
00054 \texttt{INT8} nanoseconds and the second as a \texttt{LIGOTimeGPS} structure.
00055 The third routine decides if some or all of a given time interval is
00056 playground or not.
00057 
00058 \subsubsection*{Algorithm}
00059 
00060 The playground algorithm is given in LIGO techincal document T030020-01.
00061 Briefly, $t$ is playground if 
00062 \begin{equation}
00063 t - 729273613 \% 6370 < 600.
00064 \end{equation}
00065 
00066 \subsubsection*{Uses}
00067 
00068 \subsubsection*{Notes}
00069 
00070 \vfill{\footnotesize\input{PlaygroundCV}}
00071 </lalLaTeX>
00072 #endif
00073 
00074 #include <lal/LALStdlib.h>
00075 #include <lal/Date.h>
00076 #include <lal/XLALError.h>
00077 
00078 NRCSID( PLAYGROUNDC, "$Id: Playground.c,v 1.7 2008/04/29 20:22:00 kipp Exp $" );
00079 
00080 /* <lalVerbatim file="PlaygroundCP"> */
00081 int
00082 XLALINT8NanoSecIsPlayground (
00083     const INT8         *ns
00084     )
00085 /* </lalVerbatim> */
00086 {
00087   const INT8 start = 729273613 * LAL_INT8_C(1000000000);
00088   const INT8 interval = 6370 * LAL_INT8_C(1000000000);
00089   const INT8 length = 600 * LAL_INT8_C(1000000000);
00090   int playground;
00091 
00092   if ( (*ns - start) % interval < length )
00093   {
00094     playground = 1;
00095   }
00096   else
00097   {
00098     playground = 0;
00099   }
00100 
00101   return( playground );
00102 }
00103 
00104 
00105 /* <lalVerbatim file="PlaygroundCP"> */
00106 void
00107 LALINT8NanoSecIsPlayground (
00108     LALStatus          *status,
00109     INT4               *playground,
00110     INT8               *ns
00111     )
00112 /* </lalVerbatim> */
00113 {
00114   INITSTATUS( status, "LALINT8NanoSecIsPlayground", PLAYGROUNDC );
00115 
00116   XLALPrintDeprecationWarning("LALINT8NanoSecIsPlayground", "XLALINT8NanoSecIsPlayground");
00117   *playground = XLALINT8NanoSecIsPlayground ( ns );
00118   
00119   RETURN( status );
00120 }
00121 
00122 /* <lalVerbatim file="PlaygroundCP"> */
00123 void
00124 LALGPSIsPlayground (
00125     LALStatus          *status,
00126     INT4               *playground,
00127     LIGOTimeGPS        *gpstime
00128     )
00129 /* </lalVerbatim> */
00130 {
00131   INT8  ns;
00132 
00133   INITSTATUS( status, "LALINT8NanoSecIsPlayground", PLAYGROUNDC );
00134   ATTATCHSTATUSPTR( status );
00135 
00136   ns = XLALGPSToINT8NS(gpstime);
00137   *playground = XLALINT8NanoSecIsPlayground(&ns);
00138 
00139   DETATCHSTATUSPTR( status );
00140   RETURN( status );
00141 }

Generated on Tue Oct 14 02:32:12 2008 for LAL by  doxygen 1.5.2