112#define GENERALMETRICTESTC_EMEM 1
113#define GENERALMETRICTESTC_ESUB 2
114#define GENERALMETRICTESTC_ESYS 3
115#define GENERALMETRICTESTC_EMET 4
117#define GENERALMETRICTESTC_MSGEMEM "memory (de)allocation error"
118#define GENERALMETRICTESTC_MSGESUB "subroutine failed"
119#define GENERALMETRICTESTC_MSGESYS "system call failed"
120#define GENERALMETRICTESTC_MSGEMET "determinant of projected metric negative"
128#include <sys/types.h>
130#include <lal/AVFactories.h>
131#include <lal/LALgetopt.h>
132#include <lal/LALMalloc.h>
133#include <lal/LALStdlib.h>
134#include <lal/PtoleMetric.h>
135#include <lal/LALBarycenter.h>
136#include <lal/LALInitBarycenter.h>
140#define DEFAULT_DURATION 39600
145int main(
int argc,
char *argv[] )
157 FILE *fnongrace = NULL;
160 float a, b,
c,
d,
e,
f;
162 int dec_min, dec_max;
186 while ( ( opt =
LALgetopt( argc, argv,
"a:b:c:d:ef:l:m:n:pt:s:x" ) ) != -1 ) {
192 if ( sscanf(
LALoptarg,
"%f:%f:%f:%f:%f:%f", &
a, &b, &
c, &
d, &
e, &
f ) != 6 ) {
193 fprintf( stderr,
"coordinates should be hh:mm:ss:dd:mm:ss\n" );
203 &ra_min, &ra_max, &dec_min, &dec_max ) != 4 ) {
204 fprintf( stderr,
"coordinates should be ra_min, ra_max, dec_min, dec_max all in degrees" );
227 if (
status.statusCode ) {
228 printf(
"%s line %d: %s\n", __FILE__, __LINE__,
239 if ( numSpindown > 0 ) {
241 if (
status.statusCode ) {
242 printf(
"%s line %d: %s\n", __FILE__, __LINE__,
246 for (
i = 0;
i < numSpindown;
i++ ) {
256 if (
status.statusCode ) {
257 printf(
"%s line %d: %s\n", __FILE__, __LINE__,
263 printf(
"\nmetric (f0, alpha, delta, ...) at the requested point\n" );
264 for (
j = 0;
j <= 2 + numSpindown;
j++ ) {
265 for (
k = 0;
k <=
j;
k++ ) {
266 printf(
" %+.4e",
metric->data[
k +
j * (
j + 1 ) / 2] );
273 printf(
"\nSky-determinant %e\n", determinant );
274 if ( numSpindown == 1 ) {
281 printf(
"S&S determinant %e\n", determinant );
286 if (
status.statusCode ) {
287 printf(
"%s line %d: %s\n", __FILE__, __LINE__,
293 printf(
"\nf-projected metric (alpha, delta, ...) at the requested point\n" );
294 for (
j = 1;
j <= 2 + numSpindown;
j++ ) {
295 for (
k = 1;
k <=
j;
k++ ) {
296 printf(
" %+.4e",
metric->data[
k +
j * (
j + 1 ) / 2] );
303 printf(
"\nSky-determinant %e\n", determinant );
304 if ( numSpindown == 1 ) {
311 printf(
"S&S determinant %e\n", determinant );
316 if ( grace || nongrace ) {
320 pvc = popen(
"xmgrace -pipe",
"w" );
322 printf(
"%s line %d: %s\n", __FILE__, __LINE__,
326 fprintf( pvc,
"@xaxis label \"Right ascension (degrees)\"\n" );
327 fprintf( pvc,
"@yaxis label \"Declination (degrees)\"\n" );
330 fnongrace = fopen(
"nongrace.data",
"w" );
332 printf(
"%s line %d: %s\n", __FILE__, __LINE__,
340 for ( dec = dec_max; dec >= dec_min; dec -= 10 ) {
341 for ( ra = ra_min; ra <= ra_max; ra += 15 ) {
342 REAL8 gaa, gad, gdd, angle, smaj, smin;
350 if (
status.statusCode ) {
351 printf(
"%s line %d: %s\n", __FILE__, __LINE__,
358 if (
status.statusCode ) {
359 printf(
"%s line %d: %s\n", __FILE__, __LINE__,
364 if ( determinant < 0.0 ) {
365 printf(
"%s line %d: %s\n", __FILE__, __LINE__,
379 smin = gaa + gdd + sqrt( pow( gaa - gdd, 2 ) + pow( 2 * gad, 2 ) );
382 smaj = gaa + gdd - sqrt( pow( gaa - gdd, 2 ) + pow( 2 * gad, 2 ) );
386 angle = atan2( gad,
mismatch / smaj / smaj - gdd );
396 fprintf( pvc,
"@s%d color (0,0,0)\n",
j );
397 fprintf( pvc,
"@target G0.S%d\n@type xy\n",
j++ );
399 fprintf( pvc,
"%16.8g %16.8g\n", (
float )ra, (
float )dec );
404 fprintf( fnongrace,
"%16.8g %16.8g\n", (
float )ra, (
float )dec );
409 r_ellipse = MAGNIFY *
LAL_180_PI * smaj * smin /
410 sqrt( pow( smaj * sin( c_ellipse ), 2 ) + pow( smin * cos( c_ellipse ), 2 ) );
412 fprintf( pvc,
"%e %e\n", ra + r_ellipse * cos( angle - c_ellipse ),
413 dec + r_ellipse * sin( angle - c_ellipse ) );
415 fprintf( fnongrace,
"%e %e\n", ra + r_ellipse * cos( angle - c_ellipse ),
416 dec + r_ellipse * sin( angle - c_ellipse ) );
430 printf(
"\nCleaning up and leaving...\n" );
433 if (
status.statusCode ) {
434 printf(
"%s line %d: %s\n", __FILE__, __LINE__,
442 if (
status.statusCode ) {
443 printf(
"%s line %d: %s\n", __FILE__, __LINE__,
LALDetectorIndexGEO600DIFF
#define GENERALMETRICTESTC_MSGEMEM
#define GENERALMETRICTESTC_EMET
#define GENERALMETRICTESTC_MSGESUB
#define GENERALMETRICTESTC_MSGEMET
#define GENERALMETRICTESTC_EMEM
#define GENERALMETRICTESTC_ESUB
#define GENERALMETRICTESTC_MSGESYS
#define GENERALMETRICTESTC_ESYS
void LALCheckMemoryLeaks(void)
int LALgetopt(int argc, char *const *argv, const char *optstring)
int main(int argc, char **argv)
const LALDetector lalCachedDetectors[LAL_NUM_DETECTORS]
void LALPtoleMetric(LALStatus *status, REAL8Vector *metric, PtoleMetricIn *input)
Computes metric components for a pulsar search in the `‘Ptolemaic’' approximation; both the Earth's s...
void LALProjectMetric(LALStatus *stat, REAL8Vector *metric, BOOLEAN errors)
Project out the zeroth dimension of a metric.
COORDINATESYSTEM_EQUATORIAL
void LALDestroyVector(LALStatus *, REAL4Vector **)
void LALDCreateVector(LALStatus *, REAL8Vector **, UINT4)
void LALDDestroyVector(LALStatus *, REAL8Vector **)
void LALCreateVector(LALStatus *, REAL4Vector **, UINT4)
This structure will likely be changed to match up better with those under StackMetric....
SkyPosition position
The equatorial coordinates at which the metric components are evaluated.
REAL4Vector * spindown
The (dimensionless) spindown parameters for which the metric components are evaluated.
REAL4 maxFreq
The maximum frequency to be searched, in Hz.
const LALDetector * site
The detector site, used only for its latitude and longitude.
REAL4 duration
Duration of integration, in seconds.
LIGOTimeGPS epoch
When the coherent integration begins.