LALPulsar  6.1.0.1-89842e6
HoughMap.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 _HOUGHMAP_H
20 #define _HOUGHMAP_H
21 
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
25 
26 /* * History: Created by Sintes June 22, 2001
27  * Modified August 6, 2001
28  */
29 
30 /**
31  * \defgroup HoughMap_h Header HoughMap.h
32  * \ingroup lalpulsar_hough
33  * \author Alicia M. Sintes and Badri Krishnan
34  *
35  * \brief Provides subroutines for initialization and construction of Hough-map derivatives and total Hough-maps.
36  *
37  * ### Synopsis ###
38  *
39  * \code
40  * #include <lal/HoughMap.h>
41  * \endcode
42  *
43  */
44 /** @{ */
45 
46 /*
47  * 5. Includes. This header may include others; if so, they go immediately
48  * after include-loop protection. Includes should appear in the following
49  * order:
50  * a. Standard library includes
51  * b. LDAS includes
52  * c. LAL includes
53  */
54 #include <stdlib.h>
55 #include <math.h>
56 #include <stdio.h>
57 # include <stdlib.h>
58 # include <string.h>
59 #include <lal/LALStdlib.h>
60 #include <lal/LALConstants.h>
61 #include <lal/AVFactories.h>
62 #include <lal/SeqFactories.h>
63 
64 # include <lal/LUT.h>
65 # include <lal/PHMD.h>
66 
67 
68 /*
69  * 7. Error codes and messages. This must be auto-extracted for
70  * inclusion in the documentation.
71  */
72 
73 /**\name Error Codes */
74 /** @{ */
75 #define HOUGHMAPH_ENULL 1
76 #define HOUGHMAPH_ESIZE 2
77 #define HOUGHMAPH_ESZMM 4
78 #define HOUGHMAPH_EINT 6
79 #define HOUGHMAPH_ESAME 8
80 #define HOUGHMAPH_EFREQ 10
81 #define HOUGHMAPH_EVAL 12
82 
83 #define HOUGHMAPH_MSGENULL "Null pointer"
84 #define HOUGHMAPH_MSGESIZE "Invalid input size"
85 #define HOUGHMAPH_MSGESZMM "Size mismatch"
86 #define HOUGHMAPH_MSGEINT "Invalid interval"
87 #define HOUGHMAPH_MSGESAME "Input/Output data vectors are the same"
88 #define HOUGHMAPH_MSGEFREQ "Invalid frequency"
89 #define HOUGHMAPH_MSGEVAL "Invalid value"
90 /** @} */
91 
92 
93 /* ******************************************************
94  * 8. Macros. But, note that macros are deprecated.
95  * They could be moved to the modules where are needed
96  */
97 
98 
99 /* *******************************************************
100  * 9. Constant Declarations. (discouraged)
101  */
102 
103 
104 /* **************************************************************
105  * 10. Structure, enum, union, etc., typdefs.
106  */
107 
108 /**
109  * Total Hough Map pixel type.
110  * Depending of the number of maps to accumulate
111  * change both types \c HoughDT and \c HoughTT to \c INT2 or \c UINT2 respectively.
112  */
113  typedef REAL8 HoughTT; /* for weighted hough maps only */
114  /* Depending of the number of maps to accumulate, */
115  /* if needed change both types to INT2 or UINT2 */
116 /* typedef UCHAR HoughTT; */
117 /*typedef UINT2 HoughTT; */
118 
119 
120 /** This structure stores the Hough map derivative */
121 typedef struct tagHOUGHMapDeriv{
122  UINT2 xSide; /**< number of physical pixels in the x direction */
123  UINT2 ySide; /**< number of physical pixels in the y direction */
124  HoughDT *map ; /**< the pixel count derivatives;
125  * the number of elements to allocate is ySide*(xSide+1)* */
126 } HOUGHMapDeriv;
127 
128 
129 /** This structure stores the Hough map */
130 typedef struct tagHOUGHMapTotal{
131  INT8 f0Bin; /**< frequency bin for which it has been constructed */
132  REAL8 deltaF; /**< frequency resolution */
133  UINT4 mObsCoh; /**< ratio of observation time and coherent timescale */
134  UINT4 nPG; /**< number of peakgrams used <tt><= mObsCoh</tt>; there could be gaps during the observation time */
135  REAL8 patchSizeX; /**< x size of patch */
136  REAL8 patchSizeY; /**< y size of patch */
137  REAL8UnitPolarCoor skyPatch; /**< Coordinates of the versor \f$ \hat N_{center} \f$ (alpha, delta) pointing to the center of the sky patch */
138  REAL8Vector spinDem; /**< Spin parameters used in the demodulation stage */
139  REAL8Vector spinRes; /**< Refined spin parameters used in the Hough transform */
140  REAL8Vector dFdot; /**< resolution in spindown parameters */
141  UINT2 xSide; /**< number of physical pixels in the x direction */
142  UINT2 ySide; /**< number of physical pixels in the y direction */
143  HoughTT *map; /**< the pixel counts; the number of elements to allocate is ySide*xSide */
144 } HOUGHMapTotal;
145 
146 /*
147  * 11. Extern Global variables. (discouraged)
148  */
149 
150 /*
151  * 12. Functions Declarations (i.e., prototypes).
152  */
153 
155  HOUGHMapDeriv *hd /* the Hough map derivative */
156  );
157 
159  HOUGHMapDeriv *hd, /* the Hough map derivative */
160  HOUGHphmd *phmd /* info from a partial map */
161  );
162 
164  HOUGHMapDeriv *hd, /* the Hough map derivative */
165  HOUGHphmd *phmd /* info from a partial map */
166  );
167 
169  HOUGHMapTotal *ht, /* the total Hough map */
170  HOUGHMapDeriv *hd /* the Hough map derivative */
171  );
172 
174  HOUGHMapTotal *ht, /* the total Hough map */
175  HOUGHPatchGrid *patch /* patch information */
176  );
177 
179  REAL8UnitPolarCoor *sourceLocation, /* output*/
180  UINT2 xPos,
181  UINT2 yPos,
182  HOUGHPatchGrid *patch,
183  HOUGHDemodPar *parDem);
184 
185 /** @} */
186 
187 #ifdef __cplusplus
188 } /* Close C++ protection */
189 #endif
190 
191 #endif /* Close double-include protection _HOUGHMAP_H */
void LALHOUGHAddPHMD2HD_W(LALStatus *status, HOUGHMapDeriv *hd, HOUGHphmd *phmd)
Adds a hough map derivative into a total hough map derivative taking into account the weight of the p...
Definition: HoughMap.c:231
void LALStereo2SkyLocation(LALStatus *status, REAL8UnitPolarCoor *sourceLocation, UINT2 xPos, UINT2 yPos, HOUGHPatchGrid *patch, HOUGHDemodPar *parDem)
Find source sky location given stereographic coordinates indexes.
Definition: HoughMap.c:405
void LALHOUGHInitializeHD(LALStatus *status, HOUGHMapDeriv *hd)
This function initializes the Hough map derivative space HOUGHMapDeriv *hd to zero.
Definition: HoughMap.c:31
REAL8 HoughTT
Total Hough Map pixel type.
Definition: HoughMap.h:113
void LALHOUGHAddPHMD2HD(LALStatus *status, HOUGHMapDeriv *hd, HOUGHphmd *phmd)
Given an initial Hough map derivative HOUGHMapDeriv *hd and a representation of a phmd HOUGHphmd *phm...
Definition: HoughMap.c:123
void LALHOUGHIntegrHD2HT(LALStatus *status, HOUGHMapTotal *ht, HOUGHMapDeriv *hd)
This function constructs a total Hough map HOUGHMapTotal *ht from its derivative HOUGHMapDeriv *hd by...
Definition: HoughMap.c:353
void LALHOUGHInitializeHT(LALStatus *status, HOUGHMapTotal *ht, HOUGHPatchGrid *patch)
This function initializes the total Hough map HOUGHMapTotal *ht to zero and checks consistency betwee...
Definition: HoughMap.c:74
double REAL8
int64_t INT8
uint16_t UINT2
uint32_t UINT4
REAL8 HoughDT
Hough Map derivative pixel type.
Definition: PHMD.h:121
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 derivative.
Definition: HoughMap.h:121
UINT2 ySide
number of physical pixels in the y direction
Definition: HoughMap.h:123
UINT2 xSide
number of physical pixels in the x direction
Definition: HoughMap.h:122
HoughDT * map
the pixel count derivatives; the number of elements to allocate is ySide*(xSide+1)*
Definition: HoughMap.h:124
This structure stores the Hough map.
Definition: HoughMap.h:130
UINT2 ySide
number of physical pixels in the y direction
Definition: HoughMap.h:142
UINT2 xSide
number of physical pixels in the x direction
Definition: HoughMap.h:141
HoughTT * map
the pixel counts; the number of elements to allocate is ySide*xSide
Definition: HoughMap.h:143
REAL8Vector dFdot
resolution in spindown parameters
Definition: HoughMap.h:140
REAL8Vector spinRes
Refined spin parameters used in the Hough transform.
Definition: HoughMap.h:139
REAL8UnitPolarCoor skyPatch
Coordinates of the versor (alpha, delta) pointing to the center of the sky patch.
Definition: HoughMap.h:137
INT8 f0Bin
frequency bin for which it has been constructed
Definition: HoughMap.h:131
UINT4 mObsCoh
ratio of observation time and coherent timescale
Definition: HoughMap.h:133
REAL8 patchSizeX
x size of patch
Definition: HoughMap.h:135
UINT4 nPG
number of peakgrams used <= mObsCoh; there could be gaps during the observation time
Definition: HoughMap.h:134
REAL8 deltaF
frequency resolution
Definition: HoughMap.h:132
REAL8 patchSizeY
y size of patch
Definition: HoughMap.h:136
REAL8Vector spinDem
Spin parameters used in the demodulation stage.
Definition: HoughMap.h:138
This structure stores patch-frequency grid information.
Definition: LUT.h:264
This structure stores a partial Hough map derivative.
Definition: PHMD.h:141
Polar coordinates of a unitary vector on the sphere.
Definition: LUT.h:327