LALPulsar 7.1.1.1-eeff03c
HierarchicalSearch.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2005-2008 Badri Krishnan, Alicia Sintes, Bernd Machenschalk
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
23/**
24 * \file
25 * \ingroup lalpulsar_bin_HoughFstat
26 * \brief Header file for DriveHoughFstat.c
27 * \author Badri Krishnan, Alicia Sintes
28 *
29 */
30
31
32#ifndef _DRIVEHOUGHCOLOR_H
33#define _DRIVEHOUGHCOLOR_H
34
35#include "config.h"
36
37/* standard includes */
38#include <sys/types.h>
39#include <fcntl.h>
40#include <string.h>
41#include <stdio.h>
42#include <stdlib.h>
43#include <math.h>
44#include <time.h>
45#include <errno.h>
46
47#include <lal/UserInput.h>
48#include <lal/LALStdlib.h>
49#include <lal/PulsarDataTypes.h>
50#include <lal/SFTfileIO.h>
51#include <lal/AVFactories.h>
52#include <lal/RngMedBias.h>
53#include <lal/LALComputeAM.h>
54#include <lal/ComputeSky.h>
55#include <lal/LALInitBarycenter.h>
56#include <lal/Velocity.h>
57#include <lal/ExtrapolatePulsarSpins.h>
58#include <lal/Date.h>
59#include <lal/LALHough.h>
60#include <lal/NormalizeSFTRngMed.h>
61#include <lal/ComputeFstat.h>
62#include <lal/Statistics.h>
63#include <lal/GeneratePulsarSignal.h>
64#include <lal/LogPrintf.h>
65#include <lal/DopplerScan.h>
66#include <lal/LALPulsarVCSInfo.h>
67
68/* more efficient toplist using heaps */
69#include "HoughFstatToplist.h"
70
71/******************************************************
72 * Protection against C++ name mangling
73 */
74
75#ifdef __cplusplus
76extern "C" {
77#endif
78
79
80/******************************************************
81 * Error codes and messages.
82 */
83
84#define HIERARCHICALSEARCH_ENORM 0
85#define HIERARCHICALSEARCH_ESUB 1
86#define HIERARCHICALSEARCH_EARG 2
87#define HIERARCHICALSEARCH_EBAD 3
88#define HIERARCHICALSEARCH_EFILE 4
89#define HIERARCHICALSEARCH_ENULL 5
90#define HIERARCHICALSEARCH_EVAL 6
91#define HIERARCHICALSEARCH_ENONULL 7
92#define HIERARCHICALSEARCH_EDLOPEN 8
93#define HIERARCHICALSEARCH_EWORKER 9
94#define HIERARCHICALSEARCH_ECHECKPT 10
95#define HIERARCHICALSEARCH_EMEM 11
96#define HIERARCHICALSEARCH_ESFT 12
97#define HIERARCHICALSEARCH_EXLAL 13
98
99
100#define HIERARCHICALSEARCH_MSGENORM "Normal exit"
101#define HIERARCHICALSEARCH_MSGESUB "Subroutine failed"
102#define HIERARCHICALSEARCH_MSGEARG "Error parsing arguments"
103#define HIERARCHICALSEARCH_MSGEBAD "Bad argument values"
104#define HIERARCHICALSEARCH_MSGEFILE "Could not create output file"
105#define HIERARCHICALSEARCH_MSGENULL "Null pointer"
106#define HIERARCHICALSEARCH_MSGEVAL "Invalid value"
107#define HIERARCHICALSEARCH_MSGENONULL "Pointer not null"
108#define HIERARCHICALSEARCH_MSGECHECKPT "Could not resume from checkpoint"
109#define HIERARCHICALSEARCH_MSGEMEM "Out of memory"
110#define HIERARCHICALSEARCH_MSGESFT "SFT validity check failed"
111#define HIERARCHICALSEARCH_MSGEXLAL "XLAL function call failed"
112
113
114/* ******************************************************************
115 * Structure, enum, union, etc., typdefs.
116 */
117
118
119 /** sequence of SFT catalogs -- for each segment */
120 typedef struct tagSFTCatalogSequence {
121 UINT4 length; /**< the number of segments */
122 SFTCatalog *data; /**< the catalogs */
124
125
126
127 /** parameters for the semicoherent stage -- hough or stackslide */
128 typedef struct tagSemiCoherentParams {
129 LIGOTimeGPSVector *tsMid; /**< timestamps of mid points of stacks */
130 LIGOTimeGPS refTime; /**< reference time for f, fdot definition */
131 REAL8VectorSequence *vel; /**< detector velocity for each stack */
132 REAL8VectorSequence *pos; /**< detector position for each stack */
133 REAL8 alpha; /**< right ascension of demodulation point */
134 REAL8 delta; /**< declination of demodulation point*/
135 REAL8 pixelFactor; /**< Resolution of semicoherent sky-grid */
136 REAL8 patchSizeX; /**< Size of semicoherent sky-patch */
137 REAL8 patchSizeY; /**< Size of semicoherent sky-patch */
138 REAL8 fdot; /**< spindown value of demodulation point */
139 UINT4 nfdot; /**< number of fdot values to search over */
140 REAL8 dfdot; /**< resolution in residual spindowns */
141 CHAR *outBaseName; /**< file for writing output -- if chosen */
142 BOOLEAN useToplist; /**< Use a toplist for producing candidates? */
143 REAL8 threshold; /**< Threshold for candidate selection */
144 REAL8Vector *weightsV; /**< Vector of weights for each stack */
145 UINT4 extraBinsFstat; /**< Extra bins required for Fstat calculation */
147
148 /** one hough or stackslide candidate */
149 typedef struct tagSemiCohCandidate {
150 REAL8 freq; /**< frequency */
151 REAL8 alpha; /**< right ascension */
152 REAL8 delta; /**< declination */
153 REAL8 fdot; /**< spindown */
154 REAL8 dFreq; /**< frequency error */
155 REAL8 dAlpha; /**< alpha error */
156 REAL8 dDelta ; /**< delta error */
157 REAL8 dFdot; /**< fdot error */
158 REAL8 significance;/**< significance */
159 REAL8 alphaBest; /**< alpha for best candidate in hough map */
160 REAL8 deltaBest; /**< delta for best candidate in hough map */
161 REAL8 meanSig; /**< mean of significance values in hough map */
162 REAL8 varianceSig; /**< variance of significance values in Hough map */
164
165 /** structure for storing candidates produced by Hough search */
166 typedef struct tagSemiCohCandidateList {
167 LIGOTimeGPS refTime; /**< reference time for candidates */
168 INT4 length; /**< maximum allowed length of vectors */
169 INT4 nCandidates; /**< number of candidates -- must be less than length */
170 SemiCohCandidate *list; /**> list of candidates */
172
173
174
175 /* function prototypes */
176
181
186
190 REAL4 thr);
191
194 REAL8 tStack,
195 SFTCatalog *in,
196 UINT4 nStacks);
197
199 HOUGHMapTotal *ht,
200 CHAR *fnameOut,
201 INT4 iHmap);
202
203 extern
206 HOUGHMapTotal *ht,
207 HOUGHPatchGrid *patch,
208 HOUGHDemodPar *parDem,
209 REAL8 threshold);
210
211 extern
213 toplist_t *list,
214 HOUGHMapTotal *ht,
215 HOUGHPatchGrid *patch,
216 HOUGHDemodPar *parDem);
217
219 toplist_t *list,
220 REAL8FrequencySeries *FstatVec,
221 REAL8 alpha,
222 REAL8 delta,
223 REAL8 fdot);
224
226 INT4 *loopindex,
227 const CHAR *fnameChkPoint);
228
229
230
231#ifdef __cplusplus
232} /* Close C++ protection */
233#endif
234
235
236#endif /* Close double-include protection _HIERARCHICALSEARCH_H */
void FstatVectToPeakGram(LALStatus *status, HOUGHPeakGramVector *pgV, REAL4FrequencySeriesVector *FstatVect, REAL4 thr)
Function for selecting frequency bins from a set of Fstatistic vectors.
void GetChkPointIndex(LALStatus *status, INT4 *loopindex, const CHAR *fnameChkPoint)
Read checkpointing file This does not (yet) check any consistency of the existing results file.
void LocalComputeFstatHoughMap(LALStatus *status, SemiCohCandidateList *out, HOUGHPeakGramVector *pgV, SemiCoherentParams *params)
void PrintHmap2file(LALStatus *status, HOUGHMapTotal *ht, CHAR *fnameOut, INT4 iHmap)
Print single Hough map to a specified output file.
void GetHoughCandidates_toplist(LALStatus *status, toplist_t *list, HOUGHMapTotal *ht, HOUGHPatchGrid *patch, HOUGHDemodPar *parDem)
Get Hough candidates as a toplist.
void GetFstatCandidates_toplist(LALStatus *status, toplist_t *list, REAL8FrequencySeries *FstatVec, REAL8 alpha, REAL8 delta, REAL8 fdot)
void ComputeFstatHoughMap(LALStatus *status, SemiCohCandidateList *out, HOUGHPeakGramVector *pgV, SemiCoherentParams *params)
Function for calculating Hough Maps and candidates.
void SetUpStacks(LALStatus *status, SFTCatalogSequence *out, REAL8 tStack, SFTCatalog *in, UINT4 nStacks)
Breaks up input sft catalog into specified number of stacks Loops over elements of the catalog,...
void GetHoughCandidates_threshold(LALStatus *status, SemiCohCandidateList *out, HOUGHMapTotal *ht, HOUGHPatchGrid *patch, HOUGHDemodPar *parDem, REAL8 threshold)
Get Hough candidates as a toplist using a fixed threshold.
unsigned char BOOLEAN
double REAL8
char CHAR
uint32_t UINT4
int32_t INT4
float REAL4
float data[BLOCKSIZE]
Definition: hwinject.c:360
pos
Demodulation parameters needed for the Hough transform; all coordinates are assumed to be with respec...
Definition: LUT.h:353
This structure stores the Hough map.
Definition: HoughMap.h:130
This structure stores patch-frequency grid information.
Definition: LUT.h:264
This structure contains a vector of peak-grams (for the different time stamps)
Definition: LALHough.h:167
A vector of 'timestamps' of type LIGOTimeGPS.
Definition: SFTfileIO.h:188
A vector of REAL4FrequencySeries.
An "SFT-catalogue": a vector of SFTdescriptors, as returned by XLALSFTdataFind()
Definition: SFTfileIO.h:238
sequence of SFT catalogs – for each segment
one hough or stackslide candidate
REAL8 varianceSig
variance of significance values in Hough map
REAL8 dDelta
delta error
REAL8 deltaBest
delta for best candidate in hough map
REAL8 dFdot
fdot error
REAL8 dAlpha
alpha error
REAL8 meanSig
mean of significance values in hough map
REAL8 alpha
right ascension
REAL8 freq
frequency
REAL8 dFreq
frequency error
REAL8 alphaBest
alpha for best candidate in hough map
REAL8 significance
significance
REAL8 delta
declination
structure for storing candidates produced by Hough search
SemiCohCandidate * list
LIGOTimeGPS refTime
reference time for candidates
INT4 length
maximum allowed length of vectors
INT4 nCandidates
number of candidates – must be less than length
parameters for the semicoherent stage
REAL8 patchSizeX
Size of semicoherent sky-patch.
REAL8 patchSizeY
Size of semicoherent sky-patch.
REAL8 alpha
right ascension of demodulation point
REAL8 dfdot
resolution in residual spindowns
REAL8 fdot
spindown value of demodulation point
BOOLEAN useToplist
Use a toplist for producing candidates?
REAL8 pixelFactor
Resolution of semicoherent sky-grid.
REAL8 delta
declination of demodulation point
REAL8Vector * weightsV
Vector of weights for each stack.
UINT4 nfdot
number of fdot values to search over