LALPulsar  6.1.0.1-89842e6
PtoleMetric.h
Go to the documentation of this file.
1 /*
2 * Copyright (C) 2007 Thomas Essinger-Hileman, Jolien Creighton, Ian Jones, Benjamin Owen, Reinhard Prix, Karl Wette
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 #ifndef _PTOLEMETRIC_H
21 #define _PTOLEMETRIC_H
22 
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26 
27 #include <gsl/gsl_matrix.h>
28 #include <lal/DetectorSite.h>
29 #include <lal/LALConstants.h>
30 #include <lal/LALStdlib.h>
31 #include <lal/SkyCoordinates.h>
32 #include <lal/LALBarycenter.h>
33 
34 /**
35  * \defgroup PtoleMetric_h Header PtoleMetric.h
36  * \author Jones, D. I. Owen, B. J.
37  * \date 2001 -- 2006
38  * \ingroup lalpulsar_metric
39  * \brief Provides routines to compute pulsar parameter-space metrics using the
40  * ``Ptolemaic'' approximation.
41  *
42  * ### Synopsis ###
43  *
44  * \code
45  * #include <lal/PtoleMetric.h>
46  * \endcode
47  *
48  * This module covers routines for using a ``Ptolemaic'' (epicyclic)
49  * approximation to the detector motion to compute the parameter-space metric
50  * for a pulsar search. (At the moment, the search is assumed to be a single
51  * coherent integration.) The results should be very similar to those under
52  * StackMetric.h, and reading that documention is a good
53  * background for this documentation.
54  *
55  * Why this extra module? Two words: simplicity and speed. The metric
56  * components can be expressed analytically in terms of trig functions,
57  * allowing one to get a feel for what the parameter space will look like
58  * before using a single CPU cycle. In addition, CPU usage is much reduced
59  * (compared to the routines in StackMetric.h) in numerical
60  * explorations such as testing the suitability of various tiling codes. Thus,
61  * the functions in this header can be very useful in the current stage of
62  * exploring parameter space and wondering how we can practically take
63  * advantage of correlations. It's also good at catching bugs and errors in the
64  * numerical routines under StackMetric.h. The effectiveness of the
65  * tiling at catching signals should be very little reduced by the
66  * approximation. Jones, Owen, and Whitbeck will write a short paper on this
67  * and other details.
68  *
69  */
70 /** @{ */
71 
72 #define PMETRIC_MIN(x,y) ((x) < (y) ? (x) : (y))
73 #define PMETRIC_MAX(x,y) ((x) > (y) ? (x) : (y))
74 
75 /** Translate metrix matrix-indices (a,b) into vector-index l */
76 #define PMETRIC_INDEX(a,b) (PMETRIC_MIN((a),(b))+PMETRIC_MAX((a),(b))*(PMETRIC_MAX((a),(b)) + 1 ) / 2 )
77 
78 /** \name Error conditions */
79 /** @{ */
80 #define PTOLEMETRICH_ENULL 1
81 #define PTOLEMETRICH_EPARM 2
82 #define PTOLEMETRICH_EDIM 3
83 #define PTOLEMETRICH_ENONULL 4
84 #define PTOLEMETRICH_EMETRIC 5
85 
86 #define PTOLEMETRICH_MSGENULL "unexpected null pointer"
87 #define PTOLEMETRICH_MSGEPARM "bad parameter value"
88 #define PTOLEMETRICH_MSGEDIM "bad array length"
89 #define PTOLEMETRICH_MSGENONULL "unexpected non-null pointer"
90 #define PTOLEMETRICH_MSGEMETRIC "unknown metric type"
91 /** @} */
92 
93 
94 /** Constants defining different types of pulsar-metrics. */
95 typedef enum tagLALPulsarMetricType {
100 
101 
102 /**
103  * This structure will likely be changed to match up better with
104  * those under StackMetric.h; it contains the bare
105  * necessities, not needing function pointers etc.
106  */
107 #ifdef SWIG /* SWIG interface directives */
108 SWIGLAL( IMMUTABLE_MEMBERS( tagPtoleMetricIn, site, ephemeris ) );
109 #endif /* SWIG */
110 typedef struct tagPtoleMetricIn {
111  SkyPosition position; /**< The equatorial coordinates at which the metric components are evaluated. */
112  REAL4Vector *spindown; /**< The (dimensionless) spindown parameters for which the metric components are evaluated. */
113  LIGOTimeGPS epoch; /**< When the coherent integration begins */
114  REAL4 duration; /**< Duration of integration, in seconds. */
115  REAL4 maxFreq; /**< The maximum frequency to be searched, in Hz. */
116  const LALDetector *site; /**< The detector site, used only for its latitude and longitude. */
117  const EphemerisData *ephemeris; /**< Not used for the Ptolemaic approximation, this is for compatibility with other metrics. */
118  LALPulsarMetricType metricType; /**< The type of metric to use: analytic, Ptolemaic or fully ephemeris-based. */
119 } PtoleMetricIn;
120 
121 /* ----- prototypes ----- */
122 void
124  REAL8Vector *metric,
125  PtoleMetricIn *input );
126 
127 void
129  REAL8Vector **metric,
130  PtoleMetricIn *input );
131 
132 void
133 LALProjectMetric( LALStatus *, REAL8Vector *metric, BOOLEAN errors );
134 
135 int XLALFindMetricDim( const REAL8Vector *metric );
136 
138  gsl_matrix *metric,
139  double Tspan
140 );
141 
142 /** @} */
143 
144 #ifdef __cplusplus
145 }
146 #endif
147 
148 #endif
unsigned char BOOLEAN
float REAL4
void LALPtoleMetric(LALStatus *status, REAL8Vector *metric, PtoleMetricIn *input)
Computes metric components for a pulsar search in the `‘Ptolemaic’' approximation; both the Earth's s...
Definition: PtoleMetric.c:91
void LALProjectMetric(LALStatus *, REAL8Vector *metric, BOOLEAN errors)
Project out the zeroth dimension of a metric.
Definition: PtoleMetric.c:732
LALPulsarMetricType
Constants defining different types of pulsar-metrics.
Definition: PtoleMetric.h:95
int XLALSpindownMetric(gsl_matrix *metric, double Tspan)
Frequency and frequency derivative components of the metric, suitable for a directed search with only...
Definition: PtoleMetric.c:828
void LALPulsarMetric(LALStatus *status, REAL8Vector **metric, PtoleMetricIn *input)
Unified "wrapper" to provide a uniform interface to LALPtoleMetric() and LALCoherentMetric().
Definition: PtoleMetric.c:625
int XLALFindMetricDim(const REAL8Vector *metric)
Figure out dimension of a REAL8Vector -encoded metric (see PMETRIC_INDEX() ).
Definition: PtoleMetric.c:793
@ LAL_PMETRIC_COH_PTOLE_ANALYTIC
Definition: PtoleMetric.h:97
@ LAL_PMETRIC_NONE
Definition: PtoleMetric.h:96
@ LAL_PMETRIC_LAST
Definition: PtoleMetric.h:98
This structure contains all information about the center-of-mass positions of the Earth and Sun,...
This structure will likely be changed to match up better with those under StackMetric....
Definition: PtoleMetric.h:110
SkyPosition position
The equatorial coordinates at which the metric components are evaluated.
Definition: PtoleMetric.h:111
REAL4Vector * spindown
The (dimensionless) spindown parameters for which the metric components are evaluated.
Definition: PtoleMetric.h:112
REAL4 maxFreq
The maximum frequency to be searched, in Hz.
Definition: PtoleMetric.h:115
LALPulsarMetricType metricType
The type of metric to use: analytic, Ptolemaic or fully ephemeris-based.
Definition: PtoleMetric.h:118
const LALDetector * site
The detector site, used only for its latitude and longitude.
Definition: PtoleMetric.h:116
REAL4 duration
Duration of integration, in seconds.
Definition: PtoleMetric.h:114
const EphemerisData * ephemeris
Not used for the Ptolemaic approximation, this is for compatibility with other metrics.
Definition: PtoleMetric.h:117
LIGOTimeGPS epoch
When the coherent integration begins.
Definition: PtoleMetric.h:113