00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 #ifndef _DOPPLERSCAN_H
00031 #define _DOPPLERSCAN_H
00032
00033
00034 #ifdef __cplusplus
00035 extern "C" {
00036 #endif
00037
00038
00039 #include <lal/LALDatatypes.h>
00040 #include <lal/SkyCoordinates.h>
00041 #include <lal/PtoleMetric.h>
00042 #include <lal/StackMetric.h>
00043 #include <lal/LALBarycenter.h>
00044 #include <lal/PulsarDataTypes.h>
00045 #include <lal/ComputeFstat.h>
00046
00047 NRCSID( DOPPLERSCANH, "$Id: DopplerScan.h,v 1.4 2008/07/30 10:24:10 kwwette Exp $" );
00048
00049
00050
00051 #define DOPPLERSCANH_ENULL 1
00052 #define DOPPLERSCANH_ENOTREADY 2
00053 #define DOPPLERSCANH_ESYS 3
00054 #define DOPPLERSCANH_E2DSKY 4
00055 #define DOPPLERSCANH_E2DSTEP 5
00056 #define DOPPLERSCANH_EGRIDCRPT 6
00057 #define DOPPLERSCANH_ESKYPARAM 7
00058 #define DOPPLERSCANH_EMETRICTYPE 8
00059 #define DOPPLERSCANH_ENONULL 9
00060 #define DOPPLERSCANH_EMEM 10
00061 #define DOPPLERSCANH_ESKYREGION 11
00062 #define DOPPLERSCANH_EINPUT 12
00063 #define DOPPLERSCANH_ENEGMETRIC 13
00064 #define DOPPLERSCANH_EXLAL 14
00065
00066
00067 #define DOPPLERSCANH_MSGENULL "Arguments contained an unexpected null pointer"
00068 #define DOPPLERSCANH_MSGENOTREADY "Doppler scan is uninitialized or has finished"
00069 #define DOPPLERSCANH_MSGESYS "System call failed (probably file IO)"
00070 #define DOPPLERSCANH_MSGE2DSKY "Either need one sky-point or a polygon. (2 sky-points where given)"
00071 #define DOPPLERSCANH_MSGE2DSTEP "If not using the metric, you need to specify _both_ dDelta and dAlpha"
00072 #define DOPPLERSCANH_MSGEGRIDCRPT "Unexpected NULL in grid-list. This points to a bug in the code... "
00073 #define DOPPLERSCANH_MSGESKYPARAM "Invalid sky region! We need 0<= alpha < 2Pi and -Pi/2 <= delta <= PI/2"
00074 #define DOPPLERSCANH_MSGEMETRICTYPE "Unknown type of metric specified."
00075 #define DOPPLERSCANH_MSGENONULL "Output pointer is not NULL"
00076 #define DOPPLERSCANH_MSGEMEM "Out of memory"
00077 #define DOPPLERSCANH_MSGESKYREGION "Could not parse sky-region correctly"
00078 #define DOPPLERSCANH_MSGEINPUT "Invald input parameter"
00079 #define DOPPLERSCANH_MSGENEGMETRIC "Negative metric encountered"
00080 #define DOPPLERSCANH_MSGEXLAL "XLAL call failed"
00081
00082
00083
00084
00085 typedef enum {
00086 STATE_IDLE = 0,
00087 STATE_READY,
00088 STATE_FINISHED,
00089 STATE_LAST
00090 } scan_state_t;
00091
00092
00093 typedef enum
00094 {
00095
00096 GRID_FLAT = 0,
00097 GRID_ISOTROPIC = 1,
00098 GRID_METRIC = 2,
00099 GRID_FILE_SKYGRID = 3,
00100 GRID_METRIC_SKYFILE = 4,
00101 GRID_SKY_LAST,
00102
00103 GRID_FILE_FULLGRID = 6,
00104 GRID_METRIC_LATTICE = 7,
00105 GRID_SPINDOWN_SQUARE = 8,
00106 GRID_SPINDOWN_AGEBRK = 9,
00107
00108
00109 GRID_LAST
00110 } DopplerGridType;
00111
00112
00113 typedef struct {
00114 UINT4 numVertices;
00115 SkyPosition *vertices;
00116 SkyPosition lowerLeft;
00117 SkyPosition upperRight;
00118 } SkyRegion;
00119
00120 typedef struct {
00121 CHAR *skyRegionString;
00122 LIGOTimeGPS refTime;
00123 PulsarSpins fkdot;
00124 PulsarSpins fkdotBand;
00125 } DopplerRegion;
00126
00127
00128
00129 typedef struct tagDopplerSkyGrid {
00130 REAL8 Alpha;
00131 REAL8 Delta;
00132 struct tagDopplerSkyGrid *next;
00133 } DopplerSkyGrid;
00134
00135
00136 typedef struct {
00137 CHAR *skyRegionString;
00138 REAL8 Freq;
00139 DopplerGridType gridType;
00140 LALPulsarMetricType metricType;
00141 REAL8 dAlpha, dDelta;
00142 REAL8 metricMismatch;
00143 LIGOTimeGPS obsBegin;
00144 REAL8 obsDuration;
00145 BOOLEAN projectMetric;
00146 const LALDetector *Detector;
00147 const EphemerisData *ephemeris;
00148 const CHAR *skyGridFile;
00149 UINT4 numSkyPartitions;
00150 UINT4 partitionIndex;
00151 } DopplerSkyScanInit;
00152
00153
00154 typedef struct {
00155 scan_state_t state;
00156 SkyRegion skyRegion;
00157 UINT4 numSkyGridPoints;
00158 PulsarSpins dfkdot;
00159 DopplerSkyGrid *skyGrid;
00160 DopplerSkyGrid *skyNode;
00161 } DopplerSkyScanState;
00162
00163
00164 typedef struct {
00165 REAL8 smajor;
00166 REAL8 sminor;
00167 REAL8 angle;
00168 } MetricEllipse;
00169
00170
00171
00172 extern const DopplerSkyGrid empty_DopplerSkyGrid;
00173 extern const DopplerSkyScanState empty_DopplerSkyScanState;
00174 extern const DopplerSkyScanInit empty_DopplerSkyScanInit;
00175 extern const PulsarDopplerParams empty_PulsarDopplerParams;
00176 extern const DopplerRegion empty_DopplerRegion;
00177 extern const SkyRegion empty_SkyRegion;
00178
00179
00180
00181
00182 void InitDopplerSkyScan(LALStatus *, DopplerSkyScanState *skyScan, const DopplerSkyScanInit *init);
00183 int XLALNextDopplerSkyPos( PulsarDopplerParams *pos, DopplerSkyScanState *skyScan);
00184 void FreeDopplerSkyScan(LALStatus *, DopplerSkyScanState *skyScan);
00185 int XLALFreeDopplerSkyScan (DopplerSkyScanState *skyScan);
00186
00187 void writeSkyGridFile(LALStatus *, const DopplerSkyGrid *grid, const CHAR *fname );
00188
00189
00190 void ParseSkyRegionString (LALStatus *, SkyRegion *region, const CHAR *input);
00191 void SkySquare2String (LALStatus *, CHAR **string, REAL8 Alpha, REAL8 Delta, REAL8 AlphaBand, REAL8 DeltaBand);
00192
00193 void getMCDopplerCube (LALStatus *, DopplerRegion *cube, PulsarDopplerParams signal, UINT4 PointsPerDim, const DopplerSkyScanInit *params);
00194 void getMetricEllipse(LALStatus *, MetricEllipse *ellipse, REAL8 mismatch, const REAL8Vector *metric, UINT4 dim0);
00195
00196 int fprintfDopplerParams ( FILE *fp, const PulsarDopplerParams *params );
00197
00198 DopplerSkyGrid *XLALEquiPartitionSkygrid ( const DopplerSkyGrid *skygrid, UINT4 jPart, UINT4 numPartitions );
00199
00200 #ifdef __cplusplus
00201 }
00202 #endif
00203
00204
00205 #endif