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
DopplerScan.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2007, 2008 Karl Wette
3 * Copyright (C) 2004, 2005, 2006 Reinhard Prix
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with with program; see the file COPYING. If not, write to the
17 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
18 * MA 02110-1301 USA
19 */
20
21/**
22 * \author Reinhard Prix, Karl Wette
23 * \date 2004, 2005, 2006, 2007, 2008
24 * \file
25 * \brief Header file defining the API for DopplerScan.
26 *
27 */
28
29#ifndef _DOPPLERSCAN_H /* Double-include protection. */
30#define _DOPPLERSCAN_H
31
32/* C++ protection. */
33#ifdef __cplusplus
34extern "C" {
35#endif
36
37/*---------- INCLUDES ----------*/
38#include <lal/LALDatatypes.h>
39#include <lal/SkyCoordinates.h>
40#include <lal/PtoleMetric.h>
41#include <lal/LALBarycenter.h>
42#include <lal/PulsarDataTypes.h>
43#include <lal/ComputeFstat.h>
44
45/*---------- DEFINES ----------*/
46
47#define DOPPLERSCANH_ENULL 1
48#define DOPPLERSCANH_ENOTREADY 2
49#define DOPPLERSCANH_ESYS 3
50#define DOPPLERSCANH_E2DSKY 4
51#define DOPPLERSCANH_E2DSTEP 5
52#define DOPPLERSCANH_EGRIDCRPT 6
53#define DOPPLERSCANH_ESKYPARAM 7
54#define DOPPLERSCANH_EMETRICTYPE 8
55#define DOPPLERSCANH_ENONULL 9
56#define DOPPLERSCANH_EMEM 10
57#define DOPPLERSCANH_ESKYREGION 11
58#define DOPPLERSCANH_EINPUT 12
59#define DOPPLERSCANH_ENEGMETRIC 13
60#define DOPPLERSCANH_EXLAL 14
61
62
63#define DOPPLERSCANH_MSGENULL "Arguments contained an unexpected null pointer"
64#define DOPPLERSCANH_MSGENOTREADY "Doppler scan is uninitialized or has finished"
65#define DOPPLERSCANH_MSGESYS "System call failed (probably file IO)"
66#define DOPPLERSCANH_MSGE2DSKY "Either need one sky-point or a polygon. (2 sky-points where given)"
67#define DOPPLERSCANH_MSGE2DSTEP "If not using the metric, you need to specify _both_ dDelta and dAlpha"
68#define DOPPLERSCANH_MSGEGRIDCRPT "Unexpected NULL in grid-list. This points to a bug in the code... "
69#define DOPPLERSCANH_MSGESKYPARAM "Invalid sky region! We need 0<= alpha < 2Pi and -Pi/2 <= delta <= PI/2"
70#define DOPPLERSCANH_MSGEMETRICTYPE "Unknown type of metric specified."
71#define DOPPLERSCANH_MSGENONULL "Output pointer is not NULL"
72#define DOPPLERSCANH_MSGEMEM "Out of memory"
73#define DOPPLERSCANH_MSGESKYREGION "Could not parse sky-region correctly"
74#define DOPPLERSCANH_MSGEINPUT "Invald input parameter"
75#define DOPPLERSCANH_MSGENEGMETRIC "Negative metric encountered"
76#define DOPPLERSCANH_MSGEXLAL "XLAL call failed"
77
78/*---------- external types ----------*/
79
80/** Different 'states' a Doppler-scan can be in */
81typedef enum tagscan_state_t {
82 STATE_IDLE = 0, /**< not initialized yet */
83 STATE_READY, /**< initialized and ready */
84 STATE_FINISHED, /**< all templates have been read */
87
88/** different types of grids: */
89typedef enum tagDopplerGridType {
90 /* ----- factored grid-types: sky x f0dot x f1dot x f2dot x f3dot */
91 GRID_FLAT = 0, /**< "flat" sky-grid: fixed step-size (dAlpha,dDelta) */
92 GRID_ISOTROPIC = 1, /**< approximately isotropic sky-grid */
93 GRID_METRIC = 2, /**< generate grid using a 2D sky-metric */
94 GRID_FILE_SKYGRID = 3, /**< read skygrid from a file */
95 GRID_METRIC_SKYFILE = 4, /**< 'hybrid' grid-construction: use skygrid from file, metric for others */
96 GRID_SKY_LAST, /**< end-marker for factored grid types */
97 /* ----- full multi-dim grid-types ----- */
98 GRID_FILE_FULLGRID = 6, /**< load the full D-dim grid from a file */
99 /* GRID_METRIC_LATTICE= 7: 'optimal' covering using An*-lattice and flat metric */
100 GRID_SPINDOWN_SQUARE = 8, /**< spindown tiling for a single sky position and square parameter space */
101 GRID_SPINDOWN_AGEBRK = 9, /**< spindown tiling for a single sky position and non-square parameter space
102 defined by spindown age and braking indices */
103 /* ----- end-marker ----- */
106
107/** structure describing a polygon-region in the sky */
108typedef struct tagSkyRegion {
109 UINT4 numVertices; /**< number of polygon-vertices */
110 SkyPosition *vertices; /**< array of vertices */
111 SkyPosition lowerLeft; /**< lower-left point of bounding square */
112 SkyPosition upperRight; /**< upper-right point of bounding square */
113} SkyRegion;
114
115typedef struct tagDopplerRegion {
116 CHAR *skyRegionString; /**< sky-region string '(a1,d1), (a2,d2), ..' */
117 LIGOTimeGPS refTime; /** reference time of definition of Doppler parameters */
118 PulsarSpins fkdot; /**< first points of spin-intervals */
119 PulsarSpins fkdotBand; /**< spin-intervals */
121
122/* ==================== SKYGRID-ONLY types ==================== */
123/** sky grid */
124typedef struct tagDopplerSkyGrid {
127 struct tagDopplerSkyGrid *next;
129
130/** initialization-structure passed to InitDopplerSkyScan() */
131#ifdef SWIG /* SWIG interface directives */
132SWIGLAL( IMMUTABLE_MEMBERS( tagDopplerSkyScanInit, Detector, ephemeris, skyGridFile ) );
133#endif /* SWIG */
134typedef struct tagDopplerSkyScanInit {
135 CHAR *skyRegionString; /**< sky-region to search: format polygon '(a1,d1), (a2,d2), ..' */
136 REAL8 Freq; /**< Frequency for which to build the skyGrid */
137 DopplerGridType gridType; /**< which type of skygrid to generate */
138 LALPulsarMetricType metricType; /**< which metric to use if GRID_METRIC */
139 REAL8 dAlpha, dDelta; /**< sky step-sizes for GRID_FLAT and GRID_ISOTROPIC */
140 REAL8 metricMismatch; /**< for GRID_METRIC */
141 LIGOTimeGPS obsBegin; /**< GPS start-time of time-series */
142 REAL8 obsDuration; /**< length of time-series in seconds */
143 BOOLEAN projectMetric; /**< project the metric orthogonal to Freq? */
144 const LALDetector *Detector; /**< Current detector */
145 const EphemerisData *ephemeris;/**< ephemeris-data for "exact" metric */
146 const CHAR *skyGridFile; /**< file containing a sky-grid (list of points) if GRID_FILE */
147 UINT4 numSkyPartitions; /**< number of (roughly) equal partitions to split sky-grid into */
148 UINT4 partitionIndex; /**< index of requested sky-grid partition: in [0, numPartitions - 1] */
150
151/** this structure reflects the current state of a DopplerSkyScan */
152typedef struct tagDopplerSkyScanState {
153 scan_state_t state; /**< idle, ready or finished */
154 SkyRegion skyRegion; /**< polygon (and bounding square) defining sky-region */
155 UINT4 numSkyGridPoints; /**< how many skygrid-points */
156 PulsarSpins dfkdot; /**< fixed-size steps in spins */
157 DopplerSkyGrid *skyGrid; /**< head of linked list of skygrid nodes */
158 DopplerSkyGrid *skyNode; /**< pointer to current grid-node in skygrid */
160
161/** a "sky-ellipse", described by the two major axes and it's angle wrt x-axis */
162typedef struct tagMetricEllipse {
167
168/*---------- external prototypes [API] ----------*/
169
170/* ------ functions to handle factored grids: 'sky x freq x f1dot...' covering ----- */
173
175
176void writeSkyGridFile( LALStatus *, const DopplerSkyGrid *grid, const CHAR *fname );
177
178/* ----- various utility functions ----- */
179CHAR *XLALSkySquare2String( REAL8 Alpha, REAL8 Delta, REAL8 AlphaBand, REAL8 DeltaBand );
180
181int XLALParseSkyRegionString( SkyRegion *region, const CHAR *input );
183
185
186DopplerSkyGrid *XLALEquiPartitionSkygrid( const DopplerSkyGrid *skygrid, UINT4 jPart, UINT4 numPartitions );
187
188
189// ---------- deprecated LAL functions ----------
192
193#ifdef __cplusplus
194}
195#endif
196/* C++ protection. */
197
198#endif /* Double-include protection. */
int fprintfDopplerParams(FILE *fp, const PulsarDopplerParams *params)
Debug-output of PulsarDopplerParams struct.
Definition: DopplerScan.c:1484
void writeSkyGridFile(LALStatus *, const DopplerSkyGrid *grid, const CHAR *fname)
Write the given sky-grid to a file.
Definition: DopplerScan.c:1023
int XLALParseSkyRegionString(SkyRegion *region, const CHAR *input)
parse a skyRegion-string into a SkyRegion structure: the expected string-format is " (longitude1,...
Definition: DopplerScan.c:1203
CHAR * XLALSkySquare2String(REAL8 Alpha, REAL8 Delta, REAL8 AlphaBand, REAL8 DeltaBand)
parse a 'classical' sky-square (Alpha, Delta, AlphaBand, DeltaBand) into a "SkyRegion"-string of the ...
Definition: DopplerScan.c:1295
int XLALInitDopplerSkyScan(DopplerSkyScanState *skyScan, const DopplerSkyScanInit *init)
Initialize the Doppler sky-scanner.
Definition: DopplerScan.c:170
void getMetricEllipse(LALStatus *, MetricEllipse *ellipse, REAL8 mismatch, const REAL8Vector *metric, UINT4 dim0)
get "metric-ellipse" for given metric.
Definition: DopplerScan.c:1434
int XLALNextDopplerSkyPos(PulsarDopplerParams *pos, DopplerSkyScanState *skyScan)
NextDopplerSkyPos(): step through sky-grid return 0 = OK, -1 = ERROR.
Definition: DopplerScan.c:127
scan_state_t
Different 'states' a Doppler-scan can be in.
Definition: DopplerScan.h:81
@ STATE_READY
initialized and ready
Definition: DopplerScan.h:83
@ STATE_FINISHED
all templates have been read
Definition: DopplerScan.h:84
@ STATE_IDLE
not initialized yet
Definition: DopplerScan.h:82
@ STATE_LAST
Definition: DopplerScan.h:85
DopplerSkyGrid * XLALEquiPartitionSkygrid(const DopplerSkyGrid *skygrid, UINT4 jPart, UINT4 numPartitions)
Equi-partition (approximately) a given skygrid into numPartitions, and return partition 0<= partition...
Definition: DopplerScan.c:1508
void FreeDopplerSkyScan(LALStatus *, DopplerSkyScanState *skyScan)
Definition: DopplerScan.c:324
void InitDopplerSkyScan(LALStatus *, DopplerSkyScanState *skyScan, const DopplerSkyScanInit *init)
Definition: DopplerScan.c:273
void XLALDestroyDopplerSkyScan(DopplerSkyScanState *skyScan)
Destroy the DopplerSkyScanState structure.
Definition: DopplerScan.c:294
DopplerGridType
different types of grids:
Definition: DopplerScan.h:89
@ GRID_METRIC
generate grid using a 2D sky-metric
Definition: DopplerScan.h:93
@ GRID_SPINDOWN_SQUARE
spindown tiling for a single sky position and square parameter space
Definition: DopplerScan.h:100
@ GRID_FLAT
"flat" sky-grid: fixed step-size (dAlpha,dDelta)
Definition: DopplerScan.h:91
@ GRID_LAST
Definition: DopplerScan.h:104
@ GRID_FILE_SKYGRID
read skygrid from a file
Definition: DopplerScan.h:94
@ GRID_FILE_FULLGRID
load the full D-dim grid from a file
Definition: DopplerScan.h:98
@ GRID_METRIC_SKYFILE
'hybrid' grid-construction: use skygrid from file, metric for others
Definition: DopplerScan.h:95
@ GRID_SKY_LAST
end-marker for factored grid types
Definition: DopplerScan.h:96
@ GRID_ISOTROPIC
approximately isotropic sky-grid
Definition: DopplerScan.h:92
@ GRID_SPINDOWN_AGEBRK
spindown tiling for a single sky position and non-square parameter space defined by spindown age and ...
Definition: DopplerScan.h:101
unsigned char BOOLEAN
double REAL8
char CHAR
uint32_t UINT4
LALPulsarMetricType
Constants defining different types of pulsar-metrics.
Definition: PtoleMetric.h:95
REAL8 PulsarSpins[PULSAR_MAX_SPINS]
Typedef for fixed-size array holding GW frequency and derivatives fk = d^k Freq/dt^k|(tau_ref)
PulsarSpins fkdotBand
spin-intervals
Definition: DopplerScan.h:119
CHAR * skyRegionString
sky-region string '(a1,d1), (a2,d2), ..'
Definition: DopplerScan.h:116
LIGOTimeGPS refTime
Definition: DopplerScan.h:117
PulsarSpins fkdot
reference time of definition of Doppler parameters
Definition: DopplerScan.h:118
struct tagDopplerSkyGrid * next
Definition: DopplerScan.h:127
initialization-structure passed to InitDopplerSkyScan()
Definition: DopplerScan.h:134
const EphemerisData * ephemeris
ephemeris-data for "exact" metric
Definition: DopplerScan.h:145
BOOLEAN projectMetric
project the metric orthogonal to Freq?
Definition: DopplerScan.h:143
UINT4 numSkyPartitions
number of (roughly) equal partitions to split sky-grid into
Definition: DopplerScan.h:147
UINT4 partitionIndex
index of requested sky-grid partition: in [0, numPartitions - 1]
Definition: DopplerScan.h:148
const CHAR * skyGridFile
file containing a sky-grid (list of points) if GRID_FILE
Definition: DopplerScan.h:146
LIGOTimeGPS obsBegin
GPS start-time of time-series.
Definition: DopplerScan.h:141
REAL8 Freq
Frequency for which to build the skyGrid.
Definition: DopplerScan.h:136
DopplerGridType gridType
which type of skygrid to generate
Definition: DopplerScan.h:137
REAL8 obsDuration
length of time-series in seconds
Definition: DopplerScan.h:142
REAL8 metricMismatch
for GRID_METRIC
Definition: DopplerScan.h:140
LALPulsarMetricType metricType
which metric to use if GRID_METRIC
Definition: DopplerScan.h:138
CHAR * skyRegionString
sky-region to search: format polygon '(a1,d1), (a2,d2), ..'
Definition: DopplerScan.h:135
const LALDetector * Detector
Current detector.
Definition: DopplerScan.h:144
this structure reflects the current state of a DopplerSkyScan
Definition: DopplerScan.h:152
UINT4 numSkyGridPoints
how many skygrid-points
Definition: DopplerScan.h:155
PulsarSpins dfkdot
fixed-size steps in spins
Definition: DopplerScan.h:156
DopplerSkyGrid * skyNode
pointer to current grid-node in skygrid
Definition: DopplerScan.h:158
scan_state_t state
idle, ready or finished
Definition: DopplerScan.h:153
DopplerSkyGrid * skyGrid
head of linked list of skygrid nodes
Definition: DopplerScan.h:157
SkyRegion skyRegion
polygon (and bounding square) defining sky-region
Definition: DopplerScan.h:154
This structure contains all information about the center-of-mass positions of the Earth and Sun,...
a "sky-ellipse", described by the two major axes and it's angle wrt x-axis
Definition: DopplerScan.h:162
Type containing the 'Doppler-parameters' affecting the time-evolution of the phase.
structure describing a polygon-region in the sky
Definition: DopplerScan.h:108
UINT4 numVertices
number of polygon-vertices
Definition: DopplerScan.h:109
SkyPosition lowerLeft
lower-left point of bounding square
Definition: DopplerScan.h:111
SkyPosition * vertices
array of vertices
Definition: DopplerScan.h:110
SkyPosition upperRight
upper-right point of bounding square
Definition: DopplerScan.h:112