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
LALHough.h
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#ifndef _LALHOUGH_H
20#define _LALHOUGH_H
21#ifdef __cplusplus
22extern "C" {
23#endif
24
25/**
26 * \defgroup LALHough_h Header LALHough.h
27 * \ingroup lalpulsar_hough
28 * \author Alicia Sintes, Badri Krishnan
29 *
30 * \brief Routines for building and updating the space of partial
31 * Hough map derivatives and related functions needed for the construction
32 * of total Hough maps at different frequencies and
33 * possible residual spin down parameters.
34 *
35 * ### Synopsis ###
36 *
37 * \code
38 * #include <lal/LALHough.h>
39 * \endcode
40 *
41 * As we mention before,
42 * the issue is to build histograms, the Hough map (HM), in the
43 * parameter space: for each intrinsic frequency \f$ f_0 \f$ , each residual
44 * spin-down parameter, and each refined sky location inside the patch.
45 * Notice, from the master equation, that the effect of the residual
46 * spin-down parameter is just a change in \f$ F_0 \f$ , and, at any given
47 * time, \f$ F_0 \f$ can be considered constant.
48 * Also, the Hough map is a histogram, thus additive. It can be seen as
49 * the sum of several partial Hough maps constructed using just one periodogram.
50 *
51 * Therefore, we can construct the HM for any \f$ f_0 \f$ and spin-down
52 * value by adding together, at different times, partial Hough maps (PHM)
53 * corresponding to different \f$ F_0 \f$ values (or equivalently, adding their
54 * derivatives and then integrating the result).
55 *
56 * In practice this means that in order to obtain the HM for a given
57 * frequency and all possible residual spin-down parameters, we have to construct
58 * a CYLINDER of around the frequency \f$ f_0 \f$ . All of the \e phmd coming
59 * from data demodulated with the same parameters.
60 * The coordinates of the \e phmd locate the position of the source in
61 * the sky, and by summing along different directions inside the cylinder we refine
62 * the spin-down value.
63 * To analyze another frequency, for all possible spin-down parameters,
64 * we just need to add a new line to the cylinder (and remove another one, in a
65 * circular buffer)
66 * and then proceed making all the possible sums again.
67 *
68 * For the case of only 1 spin-down parameter we have to sum
69 * following straight lines whose slope is related to the grid in the
70 * residual spin-down parameter. We can distinguish (at most) as
71 * many lines as the number of the different periodograms used.
72 */
73/** @{ */
74
75
76/*
77 * 5. Includes. This header may include others; if so, they go immediately
78 * after include-loop protection. Includes should appear in the following
79 * order:
80 * a. Standard library includes
81 * b. LDAS includes
82 * c. LAL includes
83 */
84
85#include <stdlib.h>
86#include <math.h>
87#include <stdio.h>
88#include <stdlib.h>
89#include <string.h>
90#include <lal/LALStdlib.h>
91#include <lal/LALConstants.h>
92#include <lal/AVFactories.h>
93#include <lal/SeqFactories.h>
94#include <lal/LALComputeAM.h>
95#include <lal/ComputeSky.h>
96#include <lal/SFTfileIO.h>
97#include <lal/LUT.h>
98#include <lal/PHMD.h>
99#include <lal/HoughMap.h>
100#include <lal/PulsarDataTypes.h>
101#include <lal/NormalizeSFTRngMed.h>
102
103/*
104 * 7. Error codes and messages. This must be auto-extracted for
105 * inclusion in the documentation.
106 */
107
108/**\name Error Codes */
109/** @{ */
110#define LALHOUGHH_ENULL 1
111#define LALHOUGHH_ESIZE 2
112#define LALHOUGHH_ESZMM 4
113#define LALHOUGHH_EINT 6
114#define LALHOUGHH_ESAME 8
115#define LALHOUGHH_EFREQ 10
116#define LALHOUGHH_EVAL 12
117#define LALHOUGHH_EMEM 32
118
119#define LALHOUGHH_MSGENULL "Null pointer"
120#define LALHOUGHH_MSGESIZE "Invalid input size"
121#define LALHOUGHH_MSGESZMM "Size mismatch"
122#define LALHOUGHH_MSGEINT "Invalid interval"
123#define LALHOUGHH_MSGESAME "Input/Output pointers are the same"
124#define LALHOUGHH_MSGEFREQ "Invalid frequency"
125#define LALHOUGHH_MSGEVAL "Invalid value"
126#define LALHOUGHH_MSGEMEM "malloc() failed / Out of memory"
127/** @} */
128
129
130/* ******************************************************
131 * 8. Macros. But, note that macros are deprecated.
132 * They could be moved to the modules where are needed
133 */
134
135
136/* *******************************************************
137 * 9. Constant Declarations. (discouraged)
138 */
139
140/* **************************************************************
141 * 10. Structure, enum, union, etc., typdefs.
142 */
143
144/**
145 * This structure stores the frequency indexes of the partial-Hough map
146 * derivatives at different time stamps that have to be combined to form a Hough map
147 * for a given (null or) residual spin-down parameters
148 */
149typedef struct tagUINT8FrequencyIndexVector{
150 UINT4 length; /**< number of elements */
151 REAL8 deltaF; /**< frequency resolution */
152 UINT8 *data; /**< the frequency indexes */
154
155/**
156 * This structure stores a set of frequency-index vectors. Every set
157 * corresponds to a different spin-down residual value; there will thus be as many
158 * sets as many spin-down residuals one wants to search over with the hough stage.
159 */
160typedef struct tagUINT8FrequencyIndexVectorSequence{
161 UINT4 length; /**< number of elements */
162 UINT4 vectorLength; /**< frequency resolution */
163 UINT8FrequencyIndexVector *freqIndV; /**< the frequency indexes */
165
166/** This structure contains a vector of peak-grams (for the different time stamps) */
167typedef struct tagHOUGHPeakGramVector{
168 UINT4 length; /**< number of elements */
169 HOUGHPeakGram *pg; /**< the Peakgrams */
171
172/** This structure contains a vector of partial look up tables (for the different time stamps) */
173typedef struct tagHOUGHptfLUTVector{
174 UINT4 length; /**< number of elements */
175 HOUGHptfLUT *lut; /**< the partial Look Up Tables */
177
178/** This structure contains a vector of Hough maps */
179typedef struct tagHOUGHMapTotalVector{
180 UINT4 length; /**< number of elements */
181 HOUGHMapTotal *ht; /**< the Hough maps */
183
184/**
185 * This structure contains a vector sequence of partial-Hough maps
186 * derivatives (for different time stamps and different frequencies) representing
187 * a circular buffer for the frequency indexes
188 */
189typedef struct tagPHMDVectorSequence{
190 UINT4 nfSize; /**< number of different frequencies */
191 UINT4 length; /**< number of elements for each frequency */
192 UINT8 fBinMin; /**< frequency index of smallest intrinsic frequency in circular buffer */
193 REAL8 deltaF; /**< frequency resolution */
194 UINT4 breakLine; /**< Mark \f$ \in \f$ [0, \c nfSize) (of the circular buffer) pointing to the starting of the \c fBinMin line */
195 HOUGHphmd *phmd; /**< the partial Hough map derivatives */
197
198/** This structure stores the residual spin-down parameters at a given time */
199typedef struct tagHOUGHResidualSpinPar{
200 REAL8 deltaF; /**< Frequency resolution; df=1/TCOH */
201 REAL8 timeDiff; /**< \f$ T_{\hat N}(t)-T_{\hat N}(\hat t_0) \f$ : time difference */
202 REAL8Vector spinRes; /**< length: Maximum order of spdwn parameter *data: pointer to residual Spin parameter set fk */
204
205/*
206 * 11. Extern Global variables. (discouraged)
207 */
208
209
210/*
211 * 12. Functions Declarations (i.e., prototypes).
212 */
214 PHMDVectorSequence *phmdVS,
217 );
218
220 PHMDVectorSequence *phmdVS,
223 );
224
226 PHMDVectorSequence *phmdVS,
229 );
230
232 HOUGHMapTotal *ht,
234 PHMDVectorSequence *phmdVS
235 );
236
238 UINT8 *fBinMap,
239 UINT8 *f0Bin,
241 );
242
244 HOUGHMapTotal *ht,
246 PHMDVectorSequence *phmdVS
247 );
248
250 PHMDVectorSequence *phmdVS,
251 REAL8Vector *weightV
252 );
253
255 REAL8Vector *weightV
256 );
257
259 REAL8Vector *weightV
260 );
261
263 REAL8Vector *weightV,
264 LIGOTimeGPSVector *timeV,
267 REAL8 alpha,
268 REAL8 delta
269 );
270
272 REAL8Vector *weightV,
273 SFTCatalog *catalog,
275 REAL8 alpha,
276 REAL8 delta
277 );
278
279
280/** @} */
281
282#ifdef __cplusplus
283} /* Close C++ protection */
284#endif
285
286#endif /* Close double-include protection _LALHOUGH_H */
uint64_t UINT8
double REAL8
uint32_t UINT4
void LALHOUGHConstructHMT_W(LALStatus *status, HOUGHMapTotal *ht, UINT8FrequencyIndexVector *freqInd, PHMDVectorSequence *phmdVS)
Calculates the total hough map for a given trajectory in the time-frequency plane and a set of partia...
Definition: DriveHough.c:474
void LALHOUGHConstructSpacePHMD(LALStatus *status, PHMDVectorSequence *phmdVS, HOUGHPeakGramVector *pgV, HOUGHptfLUTVector *lutV)
constructs the space of phmd PHMDVectorSequence *phmdVS, given a HOUGHPeakGramVector *pgV and HOUGHpt...
Definition: DriveHough.c:54
void LALHOUGHupdateSpacePHMDdn(LALStatus *status, PHMDVectorSequence *phmdVS, HOUGHPeakGramVector *pgV, HOUGHptfLUTVector *lutV)
Function for shifting the cylindrical buffer of PHMDs down by one frequency bin – the highest frequen...
Definition: DriveHough.c:215
void LALHOUGHNormalizeWeights(LALStatus *status, REAL8Vector *weightV)
Normalizes weight factors so that their sum is N.
Definition: DriveHough.c:668
void LALHOUGHComputeFBinMap(LALStatus *status, UINT8 *fBinMap, UINT8 *f0Bin, HOUGHResidualSpinPar *rs)
This function computes the corresponding frequency bin of a phmd UINT8 *fBinMap for a given intrinsic...
Definition: DriveHough.c:408
void LALHOUGHComputeAMWeights(LALStatus *status, REAL8Vector *weightV, LIGOTimeGPSVector *timeV, LALDetector *detector, EphemerisData *edat, REAL8 alpha, REAL8 delta)
Computes weight factors arising from amplitude modulation – it multiplies an existing weight vector.
Definition: DriveHough.c:712
void LALHOUGHWeighSpacePHMD(LALStatus *status, PHMDVectorSequence *phmdVS, REAL8Vector *weightV)
Adds weight factors for set of partial hough map derivatives – the weights must be calculated outside...
Definition: DriveHough.c:580
void LALHOUGHInitializeWeights(LALStatus *status, REAL8Vector *weightV)
Initializes weight factors to unity.
Definition: DriveHough.c:633
void LALHOUGHupdateSpacePHMDup(LALStatus *status, PHMDVectorSequence *phmdVS, HOUGHPeakGramVector *pgV, HOUGHptfLUTVector *lutV)
This function updates the space of phmd increasing the frequency phmdVS->fBinMin by one.
Definition: DriveHough.c:130
void LALHOUGHConstructHMT(LALStatus *status, HOUGHMapTotal *ht, UINT8FrequencyIndexVector *freqInd, PHMDVectorSequence *phmdVS)
Given PHMDVectorSequence *phmdVS, the space of phmd, and UINT8FrequencyIndexVector *freqInd,...
Definition: DriveHough.c:301
void LALHOUGHComputeMultiIFOAMWeights(LALStatus *status, REAL8Vector *weightV, SFTCatalog *catalog, EphemerisData *edat, REAL8 alpha, REAL8 delta)
This structure contains all information about the center-of-mass positions of the Earth and Sun,...
This structure stores the Hough map.
Definition: HoughMap.h:130
This structure contains a vector of Hough maps.
Definition: LALHough.h:179
HOUGHMapTotal * ht
the Hough maps
Definition: LALHough.h:181
UINT4 length
number of elements
Definition: LALHough.h:180
This structure stores the `‘peak-gram’'.
Definition: PHMD.h:129
This structure contains a vector of peak-grams (for the different time stamps)
Definition: LALHough.h:167
UINT4 length
number of elements
Definition: LALHough.h:168
HOUGHPeakGram * pg
the Peakgrams
Definition: LALHough.h:169
This structure stores the residual spin-down parameters at a given time.
Definition: LALHough.h:199
REAL8 deltaF
Frequency resolution; df=1/TCOH.
Definition: LALHough.h:200
REAL8Vector spinRes
length: Maximum order of spdwn parameter *data: pointer to residual Spin parameter set fk
Definition: LALHough.h:202
REAL8 timeDiff
: time difference
Definition: LALHough.h:201
This structure stores a partial Hough map derivative.
Definition: PHMD.h:141
This structure stores the patch-time-frequency look up table.
Definition: LUT.h:246
This structure contains a vector of partial look up tables (for the different time stamps)
Definition: LALHough.h:173
HOUGHptfLUT * lut
the partial Look Up Tables
Definition: LALHough.h:175
UINT4 length
number of elements
Definition: LALHough.h:174
A vector of 'timestamps' of type LIGOTimeGPS.
Definition: SFTfileIO.h:188
This structure contains a vector sequence of partial-Hough maps derivatives (for different time stamp...
Definition: LALHough.h:189
UINT8 fBinMin
frequency index of smallest intrinsic frequency in circular buffer
Definition: LALHough.h:192
UINT4 breakLine
Mark [0, nfSize) (of the circular buffer) pointing to the starting of the fBinMin line.
Definition: LALHough.h:194
UINT4 nfSize
number of different frequencies
Definition: LALHough.h:190
REAL8 deltaF
frequency resolution
Definition: LALHough.h:193
HOUGHphmd * phmd
the partial Hough map derivatives
Definition: LALHough.h:195
UINT4 length
number of elements for each frequency
Definition: LALHough.h:191
An "SFT-catalogue": a vector of SFTdescriptors, as returned by XLALSFTdataFind()
Definition: SFTfileIO.h:238
This structure stores the frequency indexes of the partial-Hough map derivatives at different time st...
Definition: LALHough.h:149
UINT8 * data
the frequency indexes
Definition: LALHough.h:152
REAL8 deltaF
frequency resolution
Definition: LALHough.h:151
UINT4 length
number of elements
Definition: LALHough.h:150
This structure stores a set of frequency-index vectors.
Definition: LALHough.h:160
UINT4 length
number of elements
Definition: LALHough.h:161
UINT8FrequencyIndexVector * freqIndV
the frequency indexes
Definition: LALHough.h:163
UINT4 vectorLength
frequency resolution
Definition: LALHough.h:162