LALPulsar  6.1.0.1-89842e6
DopplerScan.c File Reference

Functions for generating search-grids for CFS. More...

Prototypes

void getRange (LALStatus *, meshREAL y[2], meshREAL x, void *params)
 
void getMetric (LALStatus *, meshREAL g[3], meshREAL skypos[2], void *params)
 
REAL8 getDopplermax (EphemerisData *edat)
 some temp test-code outputting the maximal possible dopper-shift |vE| + |vS| over the ephemeris More...
 
DopplerSkyGridConvertTwoDMesh2SkyGrid (const meshNODE *mesh2d, const SkyRegion *region)
 
BOOLEAN pointInPolygon (const SkyPosition *point, const SkyRegion *polygon)
 Function for checking if a given point lies inside or outside a given polygon, which is specified by a list of points in a SkyPositionVector. More...
 
void gridFlipOrder (meshNODE *grid)
 
DopplerSkyGridbuildFlatSkyGrid (const SkyRegion *region, REAL8 dAlpha, REAL8 dDelta)
 
DopplerSkyGridbuildIsotropicSkyGrid (const SkyRegion *skyRegion, REAL8 dAlpha, REAL8 dDelta)
 
DopplerSkyGridbuildMetricSkyGrid (SkyRegion *skyRegion, const DopplerSkyScanInit *init)
 Build the skygrid using a specified metric. More...
 
DopplerSkyGridloadSkyGridFile (const CHAR *fname)
 Load skygrid from file, clipped to searchRegion. More...
 
void plotSkyGrid (LALStatus *, DopplerSkyGrid *skygrid, const SkyRegion *region, const DopplerSkyScanInit *init)
 
void freeSkyGrid (DopplerSkyGrid *skygrid)
 
int getGridSpacings (PulsarDopplerParams *spacings, PulsarDopplerParams gridpoint, const DopplerSkyScanInit *params)
 determine the 'canonical' stepsizes in all parameter-space directions, either from the metric (if –gridType==GRID_METRIC) or using {dAlpha,dDelta} and rough guesses dfkdot=1/T^{k+1} otherwise More...
 
void printFrequencyShifts (LALStatus *, const DopplerSkyScanState *skyScan, const DopplerSkyScanInit *init)
 
const charva (const char *format,...)
 
int XLALNextDopplerSkyPos (PulsarDopplerParams *pos, DopplerSkyScanState *skyScan)
 NextDopplerSkyPos(): step through sky-grid return 0 = OK, -1 = ERROR. More...
 
int XLALInitDopplerSkyScan (DopplerSkyScanState *skyScan, const DopplerSkyScanInit *init)
 Initialize the Doppler sky-scanner. More...
 
void InitDopplerSkyScan (LALStatus *status, DopplerSkyScanState *skyScan, const DopplerSkyScanInit *init)
 
void XLALDestroyDopplerSkyScan (DopplerSkyScanState *skyScan)
 Destroy the DopplerSkyScanState structure. More...
 
void FreeDopplerSkyScan (LALStatus *status, DopplerSkyScanState *skyScan)
 
void getRange (LALStatus *status, meshREAL y[2], meshREAL UNUSED x, void *params)
 This is the parameter range function as required by TwoDMesh(). More...
 
void writeSkyGridFile (LALStatus *status, const DopplerSkyGrid *skyGrid, const CHAR *fname)
 Write the given sky-grid to a file. More...
 
int XLALParseSkyRegionString (SkyRegion *region, const CHAR *input)
 parse a skyRegion-string into a SkyRegion structure: the expected string-format is " (longitude1, latitude1), (longitude2, latitude2), (longitude3, latitude3), ... " More...
 
CHARXLALSkySquare2String (REAL8 Alpha, REAL8 Delta, REAL8 AlphaBand, REAL8 DeltaBand)
 parse a 'classical' sky-square (Alpha, Delta, AlphaBand, DeltaBand) into a "SkyRegion"-string of the form '(a1,d1), (a2,d2),...' More...
 
void getMetricEllipse (LALStatus *status, MetricEllipse *ellipse, REAL8 mismatch, const REAL8Vector *metric, UINT4 dim0)
 get "metric-ellipse" for given metric. More...
 
int fprintfDopplerParams (FILE *fp, const PulsarDopplerParams *params)
 Debug-output of PulsarDopplerParams struct. More...
 
DopplerSkyGridXLALEquiPartitionSkygrid (const DopplerSkyGrid *skygrid, UINT4 partitionIndex, UINT4 numPartitions)
 Equi-partition (approximately) a given skygrid into numPartitions, and return partition 0<= partitionIndex < numPartitions. More...
 

Detailed Description

Functions for generating search-grids for CFS.

Author
Reinhard Prix
Date
2004, 2005, 2006

Definition in file DopplerScan.c.

Go to the source code of this file.

Macros

#define INDEX_f0_f0   PMETRIC_INDEX(0,0)
 
#define INDEX_f0_A   PMETRIC_INDEX(0,1)
 
#define INDEX_f0_D   PMETRIC_INDEX(0,2)
 
#define INDEX_f0_f1   PMETRIC_INDEX(0,3)
 
#define INDEX_A_A   PMETRIC_INDEX(1,1)
 
#define INDEX_D_D   PMETRIC_INDEX(2,2)
 
#define INDEX_A_D   PMETRIC_INDEX(1,2)
 
#define INDEX_A_f1   PMETRIC_INDEX(1,3)
 
#define INDEX_D_f1   PMETRIC_INDEX(2,3)
 
#define INDEX_f1_f1   PMETRIC_INDEX(3,3)
 
#define DELTA_0   "-1.570796"
 
#define DELTA_1   "1.570796"
 
#define ALPHA_0   "1e-6"
 
#define ALPHA_1   "6.283185"
 
#define SKYREGION_ALLSKY   "(" ALPHA_0 ", " DELTA_0 "),(" ALPHA_1 ", " DELTA_0 "),(" ALPHA_1 ", " DELTA_1 "),(" ALPHA_0 ", " DELTA_1 ")"
 
#define EPS4   1e-6
 
#define SPOKES   60 /* spokes for ellipse-plots */
 
#define NUM_SPINDOWN   0 /* Number of spindown parameters */
 
#define mymax(a, b)   ((a) > (b) ? (a) : (b))
 

Typedefs

typedef REAL4 meshREAL
 
typedef TwoDMeshNode meshNODE
 
typedef TwoDMeshParamStruc meshPARAMS
 

Enumerations

enum  { ORDER_ALPHA_DELTA , ORDER_DELTA_ALPHA }
 TwoDMesh() can have either of two preferred directions of meshing: More...
 

Variables

static int meshOrder = ORDER_DELTA_ALPHA
 

Macro Definition Documentation

◆ INDEX_f0_f0

#define INDEX_f0_f0   PMETRIC_INDEX(0,0)

Definition at line 56 of file DopplerScan.c.

◆ INDEX_f0_A

#define INDEX_f0_A   PMETRIC_INDEX(0,1)

Definition at line 57 of file DopplerScan.c.

◆ INDEX_f0_D

#define INDEX_f0_D   PMETRIC_INDEX(0,2)

Definition at line 58 of file DopplerScan.c.

◆ INDEX_f0_f1

#define INDEX_f0_f1   PMETRIC_INDEX(0,3)

Definition at line 59 of file DopplerScan.c.

◆ INDEX_A_A

#define INDEX_A_A   PMETRIC_INDEX(1,1)

Definition at line 61 of file DopplerScan.c.

◆ INDEX_D_D

#define INDEX_D_D   PMETRIC_INDEX(2,2)

Definition at line 62 of file DopplerScan.c.

◆ INDEX_A_D

#define INDEX_A_D   PMETRIC_INDEX(1,2)

Definition at line 63 of file DopplerScan.c.

◆ INDEX_A_f1

#define INDEX_A_f1   PMETRIC_INDEX(1,3)

Definition at line 64 of file DopplerScan.c.

◆ INDEX_D_f1

#define INDEX_D_f1   PMETRIC_INDEX(2,3)

Definition at line 66 of file DopplerScan.c.

◆ INDEX_f1_f1

#define INDEX_f1_f1   PMETRIC_INDEX(3,3)

Definition at line 68 of file DopplerScan.c.

◆ DELTA_0

#define DELTA_0   "-1.570796"

Definition at line 71 of file DopplerScan.c.

◆ DELTA_1

#define DELTA_1   "1.570796"

Definition at line 72 of file DopplerScan.c.

◆ ALPHA_0

#define ALPHA_0   "1e-6"

Definition at line 73 of file DopplerScan.c.

◆ ALPHA_1

#define ALPHA_1   "6.283185"

Definition at line 74 of file DopplerScan.c.

◆ SKYREGION_ALLSKY

#define SKYREGION_ALLSKY   "(" ALPHA_0 ", " DELTA_0 "),(" ALPHA_1 ", " DELTA_0 "),(" ALPHA_1 ", " DELTA_1 "),(" ALPHA_0 ", " DELTA_1 ")"

Definition at line 76 of file DopplerScan.c.

◆ EPS4

#define EPS4   1e-6

Definition at line 81 of file DopplerScan.c.

◆ SPOKES

#define SPOKES   60 /* spokes for ellipse-plots */

Definition at line 503 of file DopplerScan.c.

◆ NUM_SPINDOWN

#define NUM_SPINDOWN   0 /* Number of spindown parameters */

Definition at line 504 of file DopplerScan.c.

◆ mymax

#define mymax (   a,
 
)    ((a) > (b) ? (a) : (b))

Typedef Documentation

◆ meshREAL

typedef REAL4 meshREAL

Definition at line 92 of file DopplerScan.c.

◆ meshNODE

Definition at line 93 of file DopplerScan.c.

◆ meshPARAMS

Definition at line 94 of file DopplerScan.c.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum

TwoDMesh() can have either of two preferred directions of meshing:

Enumerator
ORDER_ALPHA_DELTA 
ORDER_DELTA_ALPHA 

Definition at line 85 of file DopplerScan.c.

Function Documentation

◆ getRange() [1/2]

void getRange ( LALStatus ,
meshREAL  y[2],
meshREAL  x,
void *  params 
)

◆ getMetric()

void getMetric ( LALStatus status,
meshREAL  g[3],
meshREAL  skypos[2],
void *  params 
)

Definition at line 414 of file DopplerScan.c.

◆ getDopplermax()

REAL8 getDopplermax ( EphemerisData edat)

some temp test-code outputting the maximal possible dopper-shift |vE| + |vS| over the ephemeris

Definition at line 1167 of file DopplerScan.c.

◆ ConvertTwoDMesh2SkyGrid()

DopplerSkyGrid * ConvertTwoDMesh2SkyGrid ( const meshNODE mesh2d,
const SkyRegion region 
)

Definition at line 736 of file DopplerScan.c.

◆ pointInPolygon()

BOOLEAN pointInPolygon ( const SkyPosition point,
const SkyRegion polygon 
)

Function for checking if a given point lies inside or outside a given polygon, which is specified by a list of points in a SkyPositionVector.

Note1:

The list of polygon-points must not close on itself, the last point is automatically assumed to be connected to the first

Algorithm:

Count the number of intersections of rays emanating to the right from the point with the lines of the polygon: even => outside, odd => inside

Note2:

we try to get this algorith to count all boundary-points as 'inside' we do this by counting intersection to the left AND to the right and consider the point inside if either of those says its inside...

Returns
TRUE or FALSE

Definition at line 680 of file DopplerScan.c.

◆ gridFlipOrder()

void gridFlipOrder ( meshNODE grid)

◆ buildFlatSkyGrid()

DopplerSkyGrid * buildFlatSkyGrid ( const SkyRegion region,
REAL8  dAlpha,
REAL8  dDelta 
)

Definition at line 789 of file DopplerScan.c.

◆ buildIsotropicSkyGrid()

DopplerSkyGrid * buildIsotropicSkyGrid ( const SkyRegion skyRegion,
REAL8  dAlpha,
REAL8  dDelta 
)

Definition at line 841 of file DopplerScan.c.

◆ buildMetricSkyGrid()

DopplerSkyGrid * buildMetricSkyGrid ( SkyRegion skyRegion,
const DopplerSkyScanInit init 
)

Build the skygrid using a specified metric.

Note
: first we cover the enclosing rectange of the skyRegion using the metric-covering code, then we clip out the actual polygon-skyRegion using pointInPolygon().

In order for this not to clip boundary-points only due to numerical fluctuations, we push the enclosing rectangle boundaries inside by about EPS~1e-6 [as REAL4-arithmetic is used in TwoDMesh()].

Definition at line 905 of file DopplerScan.c.

◆ loadSkyGridFile()

DopplerSkyGrid * loadSkyGridFile ( const CHAR fname)

Load skygrid from file, clipped to searchRegion.

Definition at line 979 of file DopplerScan.c.

◆ plotSkyGrid()

void plotSkyGrid ( LALStatus status,
DopplerSkyGrid skygrid,
const SkyRegion region,
const DopplerSkyScanInit init 
)

Definition at line 507 of file DopplerScan.c.

◆ freeSkyGrid()

void freeSkyGrid ( DopplerSkyGrid skygrid)

Definition at line 340 of file DopplerScan.c.

◆ getGridSpacings()

int getGridSpacings ( PulsarDopplerParams spacings,
PulsarDopplerParams  gridpoint,
const DopplerSkyScanInit params 
)

determine the 'canonical' stepsizes in all parameter-space directions, either from the metric (if –gridType==GRID_METRIC) or using {dAlpha,dDelta} and rough guesses dfkdot=1/T^{k+1} otherwise

In the metric case, the metric is evaluated at the given gridpoint.

NOTE: currently only 1 spindown is supported!

Parameters
spacingsOUT: grid-spacings in gridpoint
gridpointIN: gridpoint to get spacings for
paramsIN: Doppler-scan parameters

Definition at line 1343 of file DopplerScan.c.

◆ printFrequencyShifts()

void printFrequencyShifts ( LALStatus status,
const DopplerSkyScanState skyScan,
const DopplerSkyScanInit init 
)

Definition at line 1060 of file DopplerScan.c.

◆ va()

const char* va ( const char format,
  ... 
)

◆ XLALNextDopplerSkyPos()

int XLALNextDopplerSkyPos ( PulsarDopplerParams pos,
DopplerSkyScanState skyScan 
)

NextDopplerSkyPos(): step through sky-grid return 0 = OK, -1 = ERROR.

Definition at line 127 of file DopplerScan.c.

◆ XLALInitDopplerSkyScan()

int XLALInitDopplerSkyScan ( DopplerSkyScanState skyScan,
const DopplerSkyScanInit init 
)

Initialize the Doppler sky-scanner.

Parameters
[out]skyScanthe initialized scan-structure
[in]initinit-params

Definition at line 170 of file DopplerScan.c.

◆ InitDopplerSkyScan()

void InitDopplerSkyScan ( LALStatus status,
DopplerSkyScanState skyScan,
const DopplerSkyScanInit init 
)
Deprecated:
Use XLALInitDopplerSkyScan() instead.
Parameters
statuspointer to LALStatus structure
[out]skyScanthe initialized scan-structure
[in]initinit-params

Definition at line 273 of file DopplerScan.c.

◆ XLALDestroyDopplerSkyScan()

void XLALDestroyDopplerSkyScan ( DopplerSkyScanState skyScan)

Destroy the DopplerSkyScanState structure.

Definition at line 294 of file DopplerScan.c.

◆ FreeDopplerSkyScan()

void FreeDopplerSkyScan ( LALStatus status,
DopplerSkyScanState skyScan 
)
Deprecated:
Use XLALDestroyDopplerSkyScan() instead.

Definition at line 324 of file DopplerScan.c.

◆ getRange() [2/2]

void getRange ( LALStatus status,
meshREAL  y[2],
meshREAL UNUSED  x,
void *  params 
)

This is the parameter range function as required by TwoDMesh().

NOTE: for the moment we only provide a trival range as defined by the rectangular parameter-area [ a1, a2 ] x [ d1, d2 ]

In order to avoid later cliping of boundary-points only due to numerical fluctuations, we push the enclosing rectangle boundaries inside by about EPS~1e-6 [as REAL4-arithmetic is used in TwoDMesh()].

Definition at line 379 of file DopplerScan.c.

◆ writeSkyGridFile()

void writeSkyGridFile ( LALStatus status,
const DopplerSkyGrid skyGrid,
const CHAR fname 
)

Write the given sky-grid to a file.

Possibly including some comments containing the parameters of the grid (?).

Definition at line 1023 of file DopplerScan.c.

◆ XLALParseSkyRegionString()

int XLALParseSkyRegionString ( SkyRegion region,
const CHAR input 
)

parse a skyRegion-string into a SkyRegion structure: the expected string-format is " (longitude1, latitude1), (longitude2, latitude2), (longitude3, latitude3), ... "

If input == NULL or input == "allsky":==> sky-region covering the whole sky.

Definition at line 1203 of file DopplerScan.c.

◆ XLALSkySquare2String()

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 form '(a1,d1), (a2,d2),...'

Parameters
[in]Alphalongitude of first point
[in]Deltalatitude of first point
[in]AlphaBandlongitude-interval
[in]DeltaBandlatitude-interval

Definition at line 1295 of file DopplerScan.c.

◆ getMetricEllipse()

void getMetricEllipse ( LALStatus status,
MetricEllipse ellipse,
REAL8  mismatch,
const REAL8Vector metric,
UINT4  dim0 
)

get "metric-ellipse" for given metric.

Note
This function uses only 2 dimensions starting from dim0 of the given metric!

Definition at line 1434 of file DopplerScan.c.

◆ fprintfDopplerParams()

int fprintfDopplerParams ( FILE *  fp,
const PulsarDopplerParams params 
)

Debug-output of PulsarDopplerParams struct.

Definition at line 1484 of file DopplerScan.c.

◆ XLALEquiPartitionSkygrid()

DopplerSkyGrid* XLALEquiPartitionSkygrid ( const DopplerSkyGrid skygrid,
UINT4  partitionIndex,
UINT4  numPartitions 
)

Equi-partition (approximately) a given skygrid into numPartitions, and return partition 0<= partitionIndex < numPartitions.

Definition at line 1508 of file DopplerScan.c.

Variable Documentation

◆ meshOrder

int meshOrder = ORDER_DELTA_ALPHA
static

Definition at line 90 of file DopplerScan.c.