Loading [MathJax]/extensions/TeX/AMSsymbols.js
LALPulsar 7.1.1.1-5e288d3
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
ParamPLUT.c
Go to the documentation of this file.
1/*
2 * Copyright (C) 2005 Badri Krishnan, Alicia Sintes
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with with program; see the file COPYING. If not, write to the
16 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
17 * MA 02110-1301 USA
18 */
19
20/*-----------------------------------------------------------------------
21 *
22 * File Name: ParamPLUT.c
23 *
24 * Authors: Sintes, A.M., Krishnan, B.,
25 *
26 *
27 * History: Created by Sintes May 15, 2001
28 * Modified by Badri Krishnan Feb 2003
29 *
30 *-----------------------------------------------------------------------
31 *
32 * NAME
33 * ParamPLUT.c
34 *
35 * SYNOPSIS
36 *
37 * DESCRIPTION
38 *
39 * DIAGNOSTICS
40 *
41 *-----------------------------------------------------------------------
42 */
43
44/**
45 * \author Sintes, A. M., Krishnan, B.
46 * \file
47 * \ingroup LUT_h
48 * \brief Function that calculates the parameters needed for generating the look-up-table.
49 *
50 * ### Description ###
51 *
52 * This routine calculates the parameters needed for generating the look-up-table.
53 * It is valid for all cases in which the Hough transform
54 * master equation is of the form:
55 * \f$ f(t) \f$ -\c f0 = \f$ \vec\xi \cdot (\hat n-\hat N) \f$ , or
56 * equivalently,
57 * \f$ \cos(\phi) \f$ = ( \f$ f(t)- \f$ \c f0 + \f$ \vec\xi \cdot\hat N \f$ )/ \f$ \vert\vec\xi\vert \f$ .
58 * \f$ \vec\xi \f$ , hereafter \c xi, is calculated according to the demodulation procedure used in a
59 * first stage.\\
60 *
61 * ### Uses ###
62 *
63 * \code
64 * LALRotatePolarU()
65 * \endcode
66 *
67 */
68
69#include <lal/LUT.h>
70
72 HOUGHParamPLUT *out, /* parameters needed build LUT*/
73 HOUGHSizePar *size,
74 HOUGHDemodPar *par ) /* demodulation parameters */
75{
76
77 /* --------------------------------------------- */
78
79 REAL8 f0; /* frequency corresponding to f0Bin */
80 INT8 f0Bin;
81 REAL8 deltaF; /* df=1/TCOH */
83 REAL8 vFactor, xFactor;
84 REAL8 xiX, xiY, xiZ;
85 REAL8 modXi, invModXi;
86 REAL8UnitPolarCoor xiInit;
87 UINT4 spinOrder, i;
88 REAL8 *spinF;
89 REAL8 timeDiff; /* T(t)-T(t0) */
90 REAL8 timeDiffProd;
91 /* --------------------------------------------- */
92
95
96 /* Make sure the arguments are not NULL: */
100
101 /* Make sure f0Bin is not zero: */
102 f0Bin = size->f0Bin;
104
105 out->f0Bin = f0Bin;
106 deltaF = out->deltaF = size->deltaF;
107
108 f0 = f0Bin * deltaF;
109
110 out->epsilon = size->epsilon;
111 out->nFreqValid = size->nFreqValid;
112 /* ------------------------------------------- */
113
114
115 /* ------------------------------------------- */
116 /* *********** xi calculation ***************** */
117
118 vFactor = f0;
119 xFactor = 0.0;
120
121 spinOrder = par->spin.length;
122
123 if ( spinOrder ) {
124 ASSERT( par->spin.data, status, LUTH_ENULL, LUTH_MSGENULL );
125 timeDiff = par->timeDiff;
126 timeDiffProd = 1.0;
127 spinF = par->spin.data;
128
129 for ( i = 0; i < spinOrder; ++i ) {
130 xFactor += spinF[i] * timeDiffProd * ( i + 1.0 );
131 timeDiffProd *= timeDiff;
132 vFactor += spinF[i] * timeDiffProd;
133 }
134 }
135
136 xiX = vFactor * ( par->veloC.x ) + xFactor * ( par->positC.x );
137 xiY = vFactor * ( par->veloC.y ) + xFactor * ( par->positC.y );
138 xiZ = vFactor * ( par->veloC.z ) + xFactor * ( par->positC.z );
139
140 /* ------------------------------------------- */
141 /* ***** convert xi into Polar coordinates ***** */
142
143 modXi = sqrt( xiX * xiX + xiY * xiY + xiZ * xiZ );
144 /* for testing we used: modXi = F0* 1.06e-4; */
145 invModXi = 1. / modXi;
146
147 xiInit.delta = asin( xiZ * invModXi );
148 /* the arc sine is in the interval [-pi/2,pi/2] */
149
150 if ( xiX || xiY ) {
151 xiInit.alpha = atan2( xiY, xiX );
152 } else {
153 xiInit.alpha = 0.0;
154 }
155
156 /* if( (xiX == 0.0 ) && (xiY == 0.0 ) ){ */
157 /* xiInit.alpha = 0.0; */
158 /* }else{ xiInit.alpha = atan2(xiY, xiX); } */
159
160 /* ------------------------------------------- */
161 /* **** Rotate Patch, so that its center becomes */
162 /* **** the south pole {x,y,z} = {0,0,-1} ***** */
163 /* Calculate xi in the new coordinate system. */
164
165 TRY( LALRotatePolarU( status->statusPtr,
166 &( *out ).xi, &xiInit, &( *par ).skyPatch ), status );
167
168 /* ------------------------------------------- */
169 delta = out->xi.delta;
170
171 out->cosDelta = deltaF * invModXi;
172 out->cosPhiMax0 = deltaF * 0.5 * invModXi - sin( delta );
173 out->cosPhiMin0 = ( out->cosPhiMax0 ) - ( out->cosDelta );
174 out->offset = 0;
175
176 /* ------------------------------------------- */
177
179
180 /* normal exit */
181 RETURN( status );
182}
static double double delta
#define TRY(func, statusptr)
#define ATTATCHSTATUSPTR(statusptr)
#define ASSERT(assertion, statusptr, code, mesg)
#define DETATCHSTATUSPTR(statusptr)
#define INITSTATUS(statusptr)
#define RETURN(statusptr)
double REAL8
int64_t INT8
uint32_t UINT4
void LALRotatePolarU(LALStatus *status, REAL8UnitPolarCoor *out, REAL8UnitPolarCoor *in, REAL8UnitPolarCoor *par)
Definition: Stereographic.c:97
#define LUTH_MSGENULL
Definition: LUT.h:157
#define LUTH_EFREQ
Definition: LUT.h:154
#define LUTH_ENULL
Definition: LUT.h:149
void LALHOUGHCalcParamPLUT(LALStatus *status, HOUGHParamPLUT *out, HOUGHSizePar *size, HOUGHDemodPar *par)
Definition: ParamPLUT.c:71
#define LUTH_MSGEFREQ
Definition: LUT.h:162
size
out
int deltaF
Demodulation parameters needed for the Hough transform; all coordinates are assumed to be with respec...
Definition: LUT.h:353
Parameters needed to construct the partial look up table.
Definition: LUT.h:333
required for constructing patch
Definition: LUT.h:294
Polar coordinates of a unitary vector on the sphere.
Definition: LUT.h:327
REAL8 alpha
any value
Definition: LUT.h:328
REAL8 delta
In the interval [ ].
Definition: LUT.h:329