100#define PTOLEMETRICTESTC_EMEM 1
101#define PTOLEMETRICTESTC_ESUB 2
102#define PTOLEMETRICTESTC_ESYS 3
104#define PTOLEMETRICTESTC_MSGEMEM "memory (de)allocation error"
105#define PTOLEMETRICTESTC_MSGESUB "subroutine failed"
106#define PTOLEMETRICTESTC_MSGESYS "system call failed"
113#include <sys/types.h>
115#include <lal/AVFactories.h>
116#include <lal/LALgetopt.h>
117#include <lal/LALMalloc.h>
118#include <lal/LALStdlib.h>
119#include <lal/PtoleMetric.h>
123#define DEFAULT_DURATION 1e5
124#define NUM_SPINDOWN 0
129int main(
int argc,
char *argv[] )
143 FILE *fnongrace = NULL;
154 while ( ( opt =
LALgetopt( argc, argv,
"b:em:pt:x" ) ) != -1 ) {
178 printf(
"\nTesting bad I/O structures...\n" );
180 printf(
"\nTesting bad sky position...\n" );
190 printf(
"\nTesting bad spindown parameters...\n" );
196 if (
status.statusCode ) {
197 printf(
"%s line %d: %s\n", __FILE__, __LINE__,
201 for (
j = 0; (
UINT4 )j < spindown->length;
j++ ) {
202 spindown->
data[
j] = 0;
213 printf(
"\nTesting bad duration...\n" );
220 printf(
"\nTesting bad maximum frequency...\n" );
238 printf(
"\nTesting bad output contents...\n" );
243 if (
status.statusCode ) {
251 printf(
"\nValid results for duration %e seconds:\n", in.
duration );
253 if (
status.statusCode ) {
254 printf(
"%s line %d: %s\n", __FILE__, __LINE__,
259 for (
k = 0;
k <=
j;
k++ ) {
260 printf(
" %+.3e",
metric->data[
k +
j * (
j + 1 ) / 2] );
265 if (
status.statusCode ) {
266 printf(
"%s line %d: %s\n", __FILE__, __LINE__,
270 printf(
"With f0 projected out:\n" );
272 for (
k = 1;
k <=
j;
k++ ) {
273 printf(
" %+.3e",
metric->data[
k +
j * (
j + 1 ) / 2] );
279 printf(
"\nValid results for duration 1e7 seconds:\n" );
282 if (
status.statusCode ) {
283 printf(
"%s line %d: %s\n", __FILE__, __LINE__,
288 for (
k = 0;
k <=
j;
k++ ) {
289 printf(
" %+.3e",
metric->data[
k +
j * (
j + 1 ) / 2] );
294 if (
status.statusCode ) {
295 printf(
"%s line %d: %s\n", __FILE__, __LINE__,
299 printf(
"With f0 projected out:\n" );
301 for (
k = 1;
k <=
j;
k++ ) {
302 printf(
" %+.3e",
metric->data[
k +
j * (
j + 1 ) / 2] );
311 if ( grace || nongrace ) {
315 pvc = popen(
"xmgrace -pipe",
"w" );
317 printf(
"%s line %d: %s\n", __FILE__, __LINE__,
321 fprintf( pvc,
"@xaxis label \"Right ascension (degrees)\"\n" );
322 fprintf( pvc,
"@yaxis label \"Declination (degrees)\"\n" );
325 fnongrace = fopen(
"nongrace.data",
"w" );
327 printf(
"%s line %d: %s\n", __FILE__, __LINE__,
335 for ( dec = 80; dec > 0; dec -= 10 ) {
336 for ( ra = 0; ra <= 90; ra += 15 ) {
337 float gaa, gad, gdd, angle, smaj, smin;
343 if (
status.statusCode ) {
344 printf(
"%s line %d: %s\n", __FILE__, __LINE__,
351 if (
status.statusCode ) {
352 printf(
"%s line %d: %s\n", __FILE__, __LINE__,
364 smin = gaa + gdd + sqrt( pow( gaa - gdd, 2 ) + pow( 2 * gad, 2 ) );
367 smaj = gaa + gdd - sqrt( pow( gaa - gdd, 2 ) + pow( 2 * gad, 2 ) );
370 angle = atan2( gad,
mismatch / smaj / smaj - gdd );
380 fprintf( pvc,
"@s%d color (0,0,0)\n",
j );
381 fprintf( pvc,
"@target G0.S%d\n@type xy\n",
j++ );
383 fprintf( pvc,
"%16.8g %16.8g\n", (
float )ra, (
float )dec );
388 fprintf( fnongrace,
"%16.8g %16.8g\n", (
float )ra, (
float )dec );
394 r = MAGNIFY *
LAL_180_PI * smaj * smin / sqrt( pow( smaj * sin(
c ), 2 )
395 + pow( smin * cos(
c ), 2 ) );
397 fprintf( pvc,
"%e %e\n", ra +
r * cos( angle -
c ), dec +
r * sin( angle -
c ) );
400 fprintf( fnongrace,
"%e %e\n", ra +
r * cos( angle -
c ),
401 dec +
r * sin( angle -
c ) );
415 printf(
"\nCleaning up and leaving...\n" );
418 if (
status.statusCode ) {
419 printf(
"%s line %d: %s\n", __FILE__, __LINE__,
425 if (
status.statusCode ) {
426 printf(
"%s line %d: %s\n", __FILE__, __LINE__,
LALDetectorIndexGEO600DIFF
void LALCheckMemoryLeaks(void)
int LALgetopt(int argc, char *const *argv, const char *optstring)
#define PTOLEMETRICTESTC_MSGESUB
#define PTOLEMETRICTESTC_ESYS
#define PTOLEMETRICTESTC_ESUB
#define PTOLEMETRICTESTC_MSGEMEM
#define PTOLEMETRICTESTC_MSGESYS
#define PTOLEMETRICTESTC_EMEM
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.