00001 /* 00002 * Copyright (C) 2005 Badri Krishnan, Alicia Sintes 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 * \author Alicia Sintes, Badri Krishnan 00022 * \ingroup pulsarHough 00023 * \file NDParamPlut.c 00024 * \brief Routines for creating the parameters required to build the 00025 Hough Look-Up-Tables for non-demodulated (SFT) data 00026 */ 00027 00028 /*----------------------------------------------------------------------- 00029 * 00030 * File Name: NDParamPLUT.c 00031 * 00032 * Authors: Sintes, A.M., Krishnan, B., 00033 * 00034 * Revision: $Id: NDParamPLUT.c,v 1.3 2006/02/11 09:45:11 badri Exp $ 00035 * 00036 * History: Created by Sintes May 15, 2001 00037 * Modified by Badri Krishnan Feb 2003 00038 * 00039 *----------------------------------------------------------------------- 00040 * 00041 * NAME 00042 * NDParamPLUT.c 00043 * 00044 * SYNOPSIS 00045 * 00046 * DESCRIPTION 00047 * 00048 * DIAGNOSTICS 00049 * 00050 *----------------------------------------------------------------------- 00051 */ 00052 00053 /************************************ <lalVerbatim file="NDParamPLUTCV"> 00054 Author: Sintes, A. M. and Krishnan, B. 00055 $Id: NDParamPLUT.c,v 1.3 2006/02/11 09:45:11 badri Exp $ 00056 ************************************* </lalVerbatim> */ 00057 00058 00059 /* <lalLaTeX> 00060 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 00061 \subsection{Module \texttt{NDParamPLUT.c}} 00062 \label{ss:NDParamPLUT.c} 00063 Function that calculates the parameters needed for generating the look-up-table. 00064 00065 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 00066 \subsubsection*{Prototypes} 00067 \vspace{0.1in} 00068 \input{NDParamPLUTD} 00069 \index{\verb&LALNDHOUGHParamPLUT()&} 00070 00071 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 00072 \subsubsection*{Description} 00073 This routine calculates the parameters needed for generating the look-up-table. 00074 It is valid for all cases in which the Hough transform 00075 master equation is of the form: 00076 $f(t)$-\verb@f0@ = $\vec\xi \cdot \hat n$, or 00077 equivalently, 00078 $\cos(\phi)$ = ($f(t)-$\verb@f0@)/$\vert\vec\xi\vert$. 00079 $\vec\xi$, hereafter \verb@xi@, is calculated according to the demodulation procedure used in a 00080 first stage.\\ 00081 00082 00083 00084 The inputs are: 00085 \begin{description} 00086 \item[\texttt{INT8 f0Bin}]: The frequency bin to construct the {\sc lut}. 00087 \item[\texttt{HOUGHDemodPar *par}]: The demodulation parameters: 00088 \begin{description} 00089 \item[\texttt{par->deltaF }]: Frequency resolution: \texttt{df=1/TCOH}. 00090 \item[\texttt{par->skyPatch }]: $N_{center}$ (alpha, delta): 00091 position of the center of the patch. 00092 \item[\texttt{par->patchSizeX }]: Size of sky patch along x-axis measured in radians. 00093 \item[\texttt{par->patchSizeY }]: Size of sky patch along y-axis measured in radians. 00094 \item[\texttt{par->veloC }]: $v(t)/c$ (x,y,z): relative detector 00095 velocity. 00096 \item[\texttt{par->positC }]: $(\vec x(t)-\vec x(\hat t_0))/c$ (x,y,z). Position 00097 of the detector. 00098 \item[\texttt{par->timeDiff }]: $T_{\hat N}(t)-T_{\hat N}(\hat t_0)$: Time difference. 00099 \item[\texttt{par->spin }]: \texttt{length}: Maximum order of 00100 spin-down parameter. 00101 \texttt{*data}: Pointer to spin-down parameter set $F_k$. 00102 \end{description} 00103 \end{description} 00104 00105 The output \verb@*out@ of type \verb@NDHOUGHParamPLUT@ contains 00106 all the parameters needed to build the look-up-table for constructing 00107 the partial Hough maps. Those are: 00108 \begin{description} 00109 \item[\texttt{out->f0Bin }]: Frequency bin for which it has been constructed. 00110 \item[\texttt{out->deltaF }]: Frequency resolution: \texttt{df=1/TCOH}. 00111 \item[\texttt{out->xi }]: Center of the circle on the celestial 00112 sphere, xi(alpha,delta) in the rotated coordinates. 00113 \item[\texttt{out->cosDelta }]: $\Delta \cos(\phi)$ corresponding to 00114 one annulus: \verb@deltaF/|xi|@. 00115 \item[\texttt{out->offset}]: Frequency bin corresponding to center of patch 00116 (it is zero in the demodulated case). 00117 \item[\texttt{out->nFreqValid}]: Number offrequency bins for which LUT is valid. 00118 \item[\texttt{out->cosPhiMax0 }]: $\max(\cos(\phi))$ of the 00119 \texttt{f0Bin} : \verb@(xi*N +deltaF/2)/|xi|@. 00120 \item[\texttt{out->cosPhiMin0 }]: $\min(\cos(\phi))$ of the 00121 \texttt{f0Bin} : \verb@cosPhiMax0-cosDelta@. 00122 \item[\texttt{out->epsilon }]: Maximum angle (distance in radians) from the pole 00123 to consider a circle as a line in the projected plane: 00124 \verb@8.* LINERR * f0Bin* VEPI * VEPI / VTOT@. For explanations see Sintes' 00125 notes. 00126 \end{description} 00127 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 00128 \subsubsection*{Uses} 00129 \begin{verbatim} 00130 LALRotatePolarU() 00131 \end{verbatim} 00132 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 00133 \subsubsection*{Notes} 00134 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 00135 \vfill{\footnotesize\input{NDParamPLUTCV}} 00136 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 00137 </lalLaTeX> */ 00138 00139 00140 #include <lal/LUT.h> 00141 00142 00143 NRCSID (NDPARAMPLUTC, "$Id: NDParamPLUT.c,v 1.3 2006/02/11 09:45:11 badri Exp $"); 00144 00145 /* <lalVerbatim file="NDParamPLUTD"> */ 00146 void LALNDHOUGHParamPLUT (LALStatus *status, 00147 HOUGHParamPLUT *out, /* parameters needed build LUT*/ 00148 HOUGHSizePar *size, 00149 HOUGHDemodPar *par) /* demodulation parameters */ 00150 { /* </lalVerbatim> */ 00151 00152 /* --------------------------------------------- */ 00153 00154 REAL8 f0; /* frequency corresponding to f0Bin */ 00155 INT8 f0Bin; 00156 REAL8 deltaF; /* df=1/TCOH */ 00157 REAL8 delta; 00158 REAL8 vFactor; 00159 REAL8 xiX, xiY, xiZ; 00160 REAL8 modXi,invModXi; 00161 REAL8UnitPolarCoor xiInit; 00162 UINT4 spinOrder, i; 00163 REAL8 *spinF; 00164 REAL8 timeDiff; /* T(t)-T(t0) */ 00165 REAL8 timeDiffProd; 00166 REAL8 freqOffset; 00167 INT4 offset; 00168 /* --------------------------------------------- */ 00169 00170 INITSTATUS (status, "LALNDHOUGHParamPLUT", NDPARAMPLUTC); 00171 ATTATCHSTATUSPTR (status); 00172 00173 /* Make sure the arguments are not NULL: */ 00174 ASSERT (out, status, LUTH_ENULL, LUTH_MSGENULL); 00175 ASSERT (par, status, LUTH_ENULL, LUTH_MSGENULL); 00176 ASSERT (size, status, LUTH_ENULL, LUTH_MSGENULL); 00177 00178 /* Make sure f0Bin is not zero: */ 00179 f0Bin = size->f0Bin; 00180 ASSERT (f0Bin, status, LUTH_EFREQ, LUTH_MSGEFREQ); 00181 00182 out->f0Bin = f0Bin; 00183 deltaF = out->deltaF = size->deltaF; 00184 00185 f0 = f0Bin * deltaF; 00186 00187 out->epsilon = size->epsilon; 00188 out->nFreqValid = size->nFreqValid; 00189 /* ------------------------------------------- */ 00190 00191 00192 /* ------------------------------------------- */ 00193 /* *********** xi calculation ***************** */ 00194 00195 vFactor = f0; 00196 00197 spinOrder = par->spin.length; 00198 00199 if(spinOrder){ 00200 ASSERT (par->spin.data , status, LUTH_ENULL, LUTH_MSGENULL); 00201 timeDiff = par->timeDiff; 00202 timeDiffProd = 1.0; 00203 spinF = par->spin.data; 00204 00205 for (i=0; i<spinOrder; ++i ){ 00206 timeDiffProd *= timeDiff; 00207 vFactor += spinF[i] * timeDiffProd; 00208 } 00209 } 00210 00211 xiX = vFactor * (par->veloC.x); 00212 xiY = vFactor * (par->veloC.y); 00213 xiZ = vFactor * (par->veloC.z); 00214 00215 /* ------------------------------------------- */ 00216 /* ***** convert xi into Polar coordinates ***** */ 00217 00218 modXi = sqrt(xiX*xiX + xiY*xiY + xiZ*xiZ); 00219 /* for testing we used: modXi = F0* 1.06e-4; */ 00220 invModXi = 1./modXi; 00221 00222 xiInit.delta = asin( xiZ*invModXi); 00223 /* the arc sine is in the interval [-pi/2,pi/2] */ 00224 00225 if( xiX || xiY ){ 00226 xiInit.alpha = atan2(xiY, xiX); 00227 }else{ 00228 xiInit.alpha = 0.0; 00229 } 00230 00231 /* if( (xiX == 0.0 ) && (xiY == 0.0 ) ){ */ 00232 /* xiInit.alpha = 0.0; */ 00233 /* }else{ xiInit.alpha = atan2(xiY, xiX); } */ 00234 00235 /* ------------------------------------------- */ 00236 /* **** Rotate Patch, so that its center becomes */ 00237 /* **** the south pole {x,y,z} = {0,0,-1} ***** */ 00238 /* Calculate xi in the new coordinate system. */ 00239 00240 TRY(LALRotatePolarU(status->statusPtr, 00241 &(*out).xi ,&xiInit, &(*par).skyPatch), status); 00242 00243 /* ------------------------------------------- */ 00244 delta = out->xi.delta; 00245 out->cosDelta = deltaF*invModXi; 00246 00247 00248 freqOffset = -modXi * sin(delta); 00249 offset = out->offset = floor( 0.5 + freqOffset/deltaF ); 00250 out->cosPhiMax0 = invModXi * (offset + 0.5) * deltaF; 00251 out->cosPhiMin0 = invModXi * (offset - 0.5) * deltaF; 00252 00253 00254 /* ------------------------------------------- */ 00255 00256 DETATCHSTATUSPTR (status); 00257 00258 /* normal exit */ 00259 RETURN (status); 00260 } 00261 00262 00263 00264 00265 00266 00267 00268 00269 00270 00271 00272 00273 00274 00275
1.5.2