Loading [MathJax]/extensions/tex2jax.js
LAL 7.7.0.1-5e288d3
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
SkyCoordinatesTest.c
Go to the documentation of this file.
1/*
2* Copyright (C) 2007 Jolien Creighton, Reinhard Prix, Teviet Creighton
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/**
21 * \author Creighton, T. D.
22 * \ingroup SkyCoordinates_h
23 * \file
24 * \brief Transforms coordinates among various systems.
25 *
26 * ### Usage ###
27 *
28 * \code
29 * SkyCoordinatesTest [-i system lat lon] [-o system] [-z lat lon]
30 * [-a altitude] [-c lat lon rad] [-t sec nsec] [-d debuglevel]
31 * \endcode
32 *
33 * ### Description ###
34 *
35 * This program converts between any two celestial coordinate systems, or
36 * between geocentric and geodetic terrestrial coordinates, using the
37 * routines in \ref SkyCoordinates_h. The following option flags are
38 * accepted:
39 * <ul>
40 * <li><tt>-i</tt> Sets the input coordinate system and coordinate
41 * values for a celestial coordinate trasformation: \c system may be
42 * one of \c horizon, \c geographic, \c equatorial,
43 * \c ecliptic, or \c galactic; \c lat and \c lon are the
44 * latitude and longitude coordinates in that system (in degrees). If
45 * the <tt>-i</tt> option is not given, then no celestial coordinate
46 * transformation will be performed (although a terrestrial coordinate
47 * transformation may still occur; see below).</li>
48 * <li><tt>-o</tt> Sets the output coordinate system for a cellestial
49 * coodinate transformation: \c system may be any of the above. If the
50 * <tt>-o</tt> option is not given, then no celestial coordinate
51 * transformation will be performed (although a terrestrial coordinate
52 * transformation may still occur; see below).</li>
53 * <li><tt>-z</tt> Sets the \e geodetic latitude and longitude of
54 * the observer to \c lat and \c lon, respectively (in degrees).
55 * Either this or the <tt>-c</tt> option (below) is required for a
56 * celestial coordinate transformation involving the horizon system.</li>
57 * <li><tt>-a</tt> Sets the elevation of the observer above the
58 * Earth's reference ellipsoid to \c altitude (in metres). If given
59 * along with the <tt>-z</tt> option, above, the program will compute and
60 * print out the geocentric coordinates of the observer as well.</li>
61 * <li><tt>-c</tt> Sets the \e geocentric latitude and longitude
62 * of the observer to \c lat and \c lon, respectively (in
63 * degrees), and the distance from the geocentre to \c rad (in
64 * metres). The program will convert and print out the geodetic
65 * coordinates of the observer. Either this or the <tt>-z</tt> option
66 * (below) is required for a celestial coordinate transformation
67 * involving the horizon system; if both are given, this option is
68 * ignored.</li>
69 * <li><tt>-t</tt> Sets the GPS time of the conversion to \c sec
70 * seconds plus \c nsec nanoseconds. The time will be printed in
71 * various other formats. This option is required for any transformation
72 * between Earth-fixed and sky-fixed coordinate systems.</li>
73 * <li><tt>-d</tt> Sets the debug level to \c debuglevel. If not
74 * specified, level 0 is assumed.</li>
75 * </ul>
76 * If no option flags are specified at all, then the routine will
77 * randomly generate a sky position in Galactic coordinates, convert it
78 * to ecliptic coordinates and back again, and return an error if the
79 * result disagrees by more than a milliradian.
80 */
81/** \name Error Codes */
82/** @{ */
83#define SKYCOORDINATESTESTC_ENORM 0 /**< Normal exit */
84#define SKYCOORDINATESTESTC_ESUB 1 /**< Subroutine failed */
85#define SKYCOORDINATESTESTC_EARG 2 /**< Error parsing arguments */
86#define SKYCOORDINATESTESTC_EMEM 3 /**< Out of memory */
87#define SKYCOORDINATESTESTC_ETEST 4 /**< Test case failed */
88/** @} */
89
90/** \cond DONT_DOXYGEN */
91#define SKYCOORDINATESTESTC_MSGENORM "Normal exit"
92#define SKYCOORDINATESTESTC_MSGESUB "Subroutine failed"
93#define SKYCOORDINATESTESTC_MSGEARG "Error parsing arguments"
94#define SKYCOORDINATESTESTC_MSGEMEM "Out of memory"
95#define SKYCOORDINATESTESTC_MSGETEST "Test case failed"
96
97#include <math.h>
98#include <time.h>
99#include <stdlib.h>
100#include <lal/LALStdio.h>
101#include <lal/LALStdlib.h>
102#include <lal/LALConstants.h>
103#include <lal/AVFactories.h>
104#include <lal/Random.h>
105#include <lal/Date.h>
106#include <lal/SkyCoordinates.h>
107
108/* Default parameter settings. */
109
110/* Usage format string. */
111#define USAGE "Usage: %s [-i system lat lon] [-o system] [-z lat lon]\n" \
112"\t[-a altitude] [-c lat lon rad] [-t sec nsec] [-d debuglevel]\n"
113
114/* Macros for printing errors and testing subroutines. */
115#define ERROR( code, msg, statement ) \
116do \
117if ( lalDebugLevel & LALERROR ) \
118{ \
119 LALPrintError( "Error[0] %d: program %s, file %s, line %d, %s\n" \
120 " %s %s\n", (code), *argv, __FILE__, \
121 __LINE__, "$Id$", statement ? \
122 statement : "", (msg) ); \
123} \
124while (0)
125
126#define INFO( statement ) \
127do \
128if ( lalDebugLevel & LALINFO ) \
129{ \
130 LALPrintError( "Info[0]: program %s, file %s, line %d, %s\n" \
131 " %s\n", *argv, __FILE__, __LINE__, \
132 "$Id$", (statement) ); \
133} \
134while (0)
135
136#define WARNING( statement ) \
137do \
138if ( lalDebugLevel & LALWARNING ) \
139{ \
140 LALPrintError( "Warning[0]: program %s, file %s, line %d, %s\n" \
141 " %s\n", *argv, __FILE__, __LINE__, \
142 "$Id$", (statement) ); \
143} \
144while (0)
145
146#define SUB( func, statusptr ) \
147do \
148if ( (func), (statusptr)->statusCode ) \
149{ \
150 ERROR( SKYCOORDINATESTESTC_ESUB, SKYCOORDINATESTESTC_MSGESUB, \
151 "Function call \"" #func "\" failed:" ); \
152 return SKYCOORDINATESTESTC_ESUB; \
153} \
154while (0)
155
156int
157main( int argc, char **argv )
158{
159 int arg; /* command-line argument counter */
160 BOOLEAN in = 0, out = 0; /* whether -i or -o options were given */
161 BOOLEAN gd = 0, alt = 0; /* whether -z or -a options were given */
162 BOOLEAN gc = 0, t = 0; /* whether -c or -t options were given */
163 static LALStatus stat; /* status structure */
164 LIGOTimeGPS gpsTime; /* time of transformation */
165 SkyPosition sky; /* celestial coordinates */
166 EarthPosition earth; /* terrestrial coordinates */
167 ConvertSkyParams params; /* additional parameters for conversion */
168
169
170 memset( &params, 0, sizeof(ConvertSkyParams ) );
171
172 /*******************************************************************
173 * PARSE ARGUMENTS (arg stores the current position) *
174 *******************************************************************/
175
176 arg = 1;
177 while ( arg < argc ) {
178
179 /* Parse input option. */
180 if ( !strcmp( argv[arg], "-i" ) ) {
181 if ( argc > arg + 3 ) {
182 arg++;
183 in = 1;
184 if ( !strncmp( argv[arg], "h", 1 ) )
186 else if ( !strncmp( argv[arg], "ge", 2 ) )
188 else if ( !strncmp( argv[arg], "eq", 2 ) )
190 else if ( !strncmp( argv[arg], "ec", 2 ) )
192 else if ( !strncmp( argv[arg], "ga", 2 ) )
194 else {
195 ERROR( SKYCOORDINATESTESTC_EARG, SKYCOORDINATESTESTC_MSGEARG, 0 );
196 LALPrintError( USAGE, *argv );
198 }
199 arg++;
200 sky.latitude = LAL_PI_180*atof( argv[arg++] );
201 sky.longitude = LAL_PI_180*atof( argv[arg++] );
202 } else {
203 ERROR( SKYCOORDINATESTESTC_EARG, SKYCOORDINATESTESTC_MSGEARG, 0 );
204 LALPrintError( USAGE, *argv );
206 }
207 }
208
209 /* Parse output option. */
210 else if ( !strcmp( argv[arg], "-o" ) ) {
211 if ( argc > arg + 1 ) {
212 arg++;
213 out = 1;
214 if ( !strncmp( argv[arg], "h", 1 ) )
216 else if ( !strncmp( argv[arg], "ge", 2 ) )
218 else if ( !strncmp( argv[arg], "eq", 2 ) )
220 else if ( !strncmp( argv[arg], "ec", 2 ) )
222 else if ( !strncmp( argv[arg], "ga", 2 ) )
224 else {
225 ERROR( SKYCOORDINATESTESTC_EARG, SKYCOORDINATESTESTC_MSGEARG, 0 );
226 LALPrintError( USAGE, *argv );
228 }
229 arg++;
230 } else {
231 ERROR( SKYCOORDINATESTESTC_EARG, SKYCOORDINATESTESTC_MSGEARG, 0 );
232 LALPrintError( USAGE, *argv );
234 }
235 }
236
237 /* Parse zenith position option. */
238 else if ( !strcmp( argv[arg], "-z" ) ) {
239 if ( argc > arg + 2 ) {
240 arg++;
241 gd = 1;
243 earth.geodetic.latitude = LAL_PI_180*atof( argv[arg++] );
244 earth.geodetic.longitude = LAL_PI_180*atof( argv[arg++] );
245 } else {
246 ERROR( SKYCOORDINATESTESTC_EARG, SKYCOORDINATESTESTC_MSGEARG, 0 );
247 LALPrintError( USAGE, *argv );
249 }
250 }
251
252 /* Parse observer altitude option. */
253 else if ( !strcmp( argv[arg], "-a" ) ) {
254 if ( argc > arg + 1 ) {
255 arg++;
256 alt = 1;
257 earth.elevation = atof( argv[arg++] );
258 } else {
259 ERROR( SKYCOORDINATESTESTC_EARG, SKYCOORDINATESTESTC_MSGEARG, 0 );
260 LALPrintError( USAGE, *argv );
262 }
263 }
264
265 /* Parse geocentric coordinates option. */
266 else if ( !strcmp( argv[arg], "-c" ) ) {
267 if ( argc > arg + 3 ) {
268 arg++;
269 gc = 1;
271 earth.geocentric.latitude = LAL_PI_180*atof( argv[arg++] );
272 earth.geocentric.longitude = LAL_PI_180*atof( argv[arg++] );
273 earth.radius = atof( argv[arg++] );
274 } else {
275 ERROR( SKYCOORDINATESTESTC_EARG, SKYCOORDINATESTESTC_MSGEARG, 0 );
276 LALPrintError( USAGE, *argv );
278 }
279 }
280
281 /* Parse GPS time option. */
282 else if ( !strcmp( argv[arg], "-t" ) ) {
283 if ( argc > arg + 2 ) {
284 arg++;
285 t = 1;
286 gpsTime.gpsSeconds = atof( argv[arg++] );
287 gpsTime.gpsNanoSeconds = atof( argv[arg++] );
288 } else {
289 ERROR( SKYCOORDINATESTESTC_EARG, SKYCOORDINATESTESTC_MSGEARG, 0 );
290 LALPrintError( USAGE, *argv );
292 }
293 }
294
295 /* Parse debug level option. */
296 else if ( !strcmp( argv[arg], "-d" ) ) {
297 if ( argc > arg + 1 ) {
298 arg++;
299 }else{
300 ERROR( SKYCOORDINATESTESTC_EARG, SKYCOORDINATESTESTC_MSGEARG, 0 );
301 LALPrintError( USAGE, *argv );
303 }
304 }
305
306 /* Check for unrecognized options. */
307 else if ( argv[arg][0] == '-' ) {
308 ERROR( SKYCOORDINATESTESTC_EARG, SKYCOORDINATESTESTC_MSGEARG, 0 );
309 LALPrintError( USAGE, *argv );
311 }
312 } /* End of argument parsing loop. */
313
314
315 /*******************************************************************
316 * TEST CASE *
317 *******************************************************************/
318
319 /* If no arguments were given, convert a random position and check
320 the result. */
321 if ( !in && !out && !gd && !gc && !alt && !t ) {
322 REAL8 diff; /* difference in converted longitude */
323 SkyPosition sky2; /* converted celestial coordinates */
324 RandomParams *rparams = NULL; /* pseudorandom sequence parameters */
325
326
327 printf ("Testing LALConvertSkyCoordinates()\n");
328 /* Set up random Galactic position. */
329 rparams = XLALCreateRandomParams( 0 );
330 sky.latitude = LAL_PI*XLALUniformDeviate( rparams ) - LAL_PI_2;
331 sky.longitude = LAL_TWOPI*XLALUniformDeviate( rparams );
332 XLALDestroyRandomParams( rparams );
334
335 /* Convert to Ecliptic and back. */
336 fprintf( stdout, "Galactic (%7.3f,%7.3f)\n",
339 SUB( LALConvertSkyCoordinates( &stat, &sky2, &sky, &params ),
340 &stat );
341 fprintf( stdout, "Equatorial (%7.3f,%7.3f)\n",
344 SUB( LALConvertSkyCoordinates( &stat, &sky2, &sky2, &params ),
345 &stat );
346 fprintf( stdout, "Ecliptic (%7.3f,%7.3f)\n",
349 SUB( LALConvertSkyCoordinates( &stat, &sky2, &sky2, &params ),
350 &stat );
351 fprintf( stdout, "Equatorial (%7.3f,%7.3f)\n",
354 SUB( LALConvertSkyCoordinates( &stat, &sky2, &sky2, &params ),
355 &stat );
356 fprintf( stdout, "Galactic (%7.3f,%7.3f)\n",
358
359 /* Make sure conversion is consistent. */
360 diff = sky2.longitude - sky.longitude;
361 while ( diff < -LAL_PI )
362 diff += LAL_TWOPI;
363 while ( diff > LAL_PI )
364 diff -= LAL_TWOPI;
365 if ( fabs( sky2.latitude - sky.latitude ) > 0.001 ||
366 fabs( diff ) > 0.001 ) {
367 ERROR( SKYCOORDINATESTESTC_ETEST, SKYCOORDINATESTESTC_MSGETEST, 0 );
369 }
370
371
372 /***********************************************************************
373 * Test LALNormalizeSkyPosition()
374 * we completely ignore the coordinate-system here, they are all treated
375 * the same (provided we can assume they are spherical and their coordinates
376 * lie within the range [0,2pi)x[-pi/2,pi/2]
377 ************************************************************************/
378 {
379 SkyPosition testIn, testOut;
380 SkyPosition correct = { 3.4, 0.9, 0 };
381 printf ("Testing LALNormalizeSkyPosition()\n");
382 /* now add some cycles of 2pi*/
383 testIn.longitude = correct.longitude + 4 * LAL_TWOPI;
384 testIn.latitude = correct.latitude - 7 * LAL_TWOPI;
385 SUB (LALNormalizeSkyPosition (&stat, &testOut, &testIn), &stat);
386 if ( (fabs(testOut.longitude - correct.longitude) > 1e-14)
387 || (fabs(testOut.latitude-correct.latitude)>1e-14))
388 {
389 printf ( "1.) LALNormalizeSkyPosition failed: got (%f,%f) instead of (%f,%f)\n",
390 testOut.longitude, testOut.latitude, correct.longitude, correct.latitude);
391 ERROR( SKYCOORDINATESTESTC_ETEST, SKYCOORDINATESTESTC_MSGETEST, 0 );
393 }
394 /* try going over the pole */
395 testIn.latitude = LAL_PI - testIn.latitude;
396 testIn.longitude += LAL_PI + 2 * LAL_TWOPI;
397 SUB (LALNormalizeSkyPosition (&stat, &testOut, &testIn), &stat);
398 if ( (fabs(testOut.longitude - correct.longitude) > 1e-14)
399 || (fabs(testOut.latitude-correct.latitude)>1e-14))
400 {
401 printf ( "2.) LALNormalizeSkyPosition failed: got (%f,%f) instead of (%f,%f)\n",
402 testOut.longitude, testOut.latitude, correct.longitude, correct.latitude);
403 ERROR( SKYCOORDINATESTESTC_ETEST, SKYCOORDINATESTESTC_MSGETEST, 0 );
405 }
406
407
408 } /* testing LALNormalizeSkyPosition() */
409 /***********************************************************************/
410
411
412 /* Everything's fine, and nothing should have been allocated. */
414 INFO( SKYCOORDINATESTESTC_MSGENORM );
416 }
417
418
419 /*******************************************************************
420 * TERRESTRIAL COORDINATES *
421 *******************************************************************/
422
423 /* Convert geocentric to geodetic, if required. */
424 fprintf( stdout, "\n" );
425 if ( gc && !gd ) {
426 fprintf( stdout, "TERRESTRIAL COORDINATES\n"
427 "Geocentric: latitude = %6.2f deg, longitude = %6.2f deg,"
428 " radius = %.0fm\n", LAL_180_PI*earth.geocentric.latitude,
429 LAL_180_PI*earth.geocentric.longitude, 1.0*earth.radius );
430 earth.x = earth.radius*cos( earth.geocentric.latitude )
431 *cos( earth.geocentric.longitude );
432 earth.y = earth.radius*cos( earth.geocentric.latitude )
433 *sin( earth.geocentric.longitude );
434 earth.z = earth.radius*sin( earth.geocentric.latitude );
435 fprintf( stdout,
436 " x = %.0fm, y = %.0fm, z = %.0fm\n",
437 1.0*earth.x, 1.0*earth.y, 1.0*earth.z );
438 SUB( LALGeocentricToGeodetic( &stat, &earth ), &stat );
439 fprintf( stdout,
440 "Geodetic: latitude = %6.2f deg, longitude = %6.2f"
441 " deg, elevation = %.0fm\n",
444 1.0*earth.elevation );
445 params.zenith = &(earth.geodetic);
446 fprintf( stdout, "\n" );
447 }
448
449 /* Convert geodetic to geocentric, if required. */
450 else if ( gd ) {
451 fprintf( stdout, "TERRESTRIAL COORDINATES\n"
452 "Geodetic: latitude = %6.2f deg, longitude = %6.2f"
453 " deg", LAL_180_PI*earth.geodetic.latitude,
455 if ( alt ) {
456 fprintf( stdout, ", elevation = %.0fm\n", 1.0*earth.elevation );
457 SUB( LALGeodeticToGeocentric( &stat, &earth ), &stat );
458 fprintf( stdout,
459 "Geocentric: latitude = %6.2f deg, longitude = %6.2f"
460 " deg, radius = %.0fm\n"
461 " x = %.0fm, y = %.0fm, z = %.0fm\n",
463 LAL_180_PI*earth.geocentric.longitude, 1.0*earth.radius,
464 1.0*earth.x, 1.0*earth.y, 1.0*earth.z );
465 } else
466 fprintf( stdout, "\n" );
467
468 /* Assign strcuture for other location-dependent conversions. */
469 params.zenith = &(earth.geodetic);
470 fprintf( stdout, "\n" );
471 }
472
473
474 /*******************************************************************
475 * TIME COORDINATE *
476 *******************************************************************/
477
478 /* Print the time in various formats. */
479 if ( t ) {
480 INT8 nsec; /* time as INT8 nanoseconds */
481 struct tm date; /* UTC */
482 REAL8 gmst; /* Greenwich mean sidereal time */
483
484 /* Convert to INT8 seconds and back, just to test things (and get
485 the LIGOTimeGPS structure into standard form). */
486 nsec = XLALGPSToINT8NS(&gpsTime);
487 XLALINT8NSToGPS(&gpsTime, nsec);
488 fprintf( stdout, "TIME COORDINATE\n" );
489
490 /* Convert to UTC timestamp. */
491 if ( gpsTime.gpsSeconds >= 0 ) {
492 CHARVector *timeStamp = NULL; /* date string */
493
494 fprintf( stdout, "GPS time: %i.%09is\n", gpsTime.gpsSeconds,
495 gpsTime.gpsNanoSeconds );
496 XLALGPSToUTC(&date, gpsTime.gpsSeconds);
497 SUB( LALCHARCreateVector( &stat, &timeStamp, 32 ), &stat );
498 strftime(timeStamp->data, timeStamp->length, "%F %T UTC %a", &date);
499 fprintf( stdout, "UTC time: %s\n", timeStamp->data );
500 SUB( LALCHARDestroyVector( &stat, &timeStamp ), &stat );
501
502 /* Convert to Greenwich mean sidereal time (degrees). */
503 gmst = fmod(XLALGreenwichMeanSiderealTime(&gpsTime), LAL_TWOPI) * 360.0 / LAL_TWOPI;
504 fprintf( stdout, "Greenwich mean sidereal time: %6.2f deg\n",
505 1.0*gmst );
506 } else
507 fprintf( stdout, "GPS time: %i.%09is\n", gpsTime.gpsSeconds,
508 -gpsTime.gpsNanoSeconds );
509
510 /* Assign strcuture for other time-dependent conversions. */
511 params.gpsTime = &gpsTime;
512 fprintf( stdout, "\n" );
513 }
514
515
516 /*******************************************************************
517 * CELESTIAL COORDINATES *
518 *******************************************************************/
519
520 /* Print the input coordinates. */
521 if ( in ) {
522 fprintf( stdout, "CELESTIAL COORDINATES\n" );
523 switch ( sky.system ) {
524 case COORDINATESYSTEM_HORIZON: fprintf( stdout, "Horizon " );
525 break;
526 case COORDINATESYSTEM_GEOGRAPHIC: fprintf( stdout, "Geographic" );
527 break;
528 case COORDINATESYSTEM_EQUATORIAL: fprintf( stdout, "Equatorial" );
529 break;
530 case COORDINATESYSTEM_ECLIPTIC: fprintf( stdout, "Ecliptic " );
531 break;
532 case COORDINATESYSTEM_GALACTIC: fprintf( stdout, "Galactic " );
533 break;
534 default: fprintf( stdout, "Unknown " );
535 }
536 fprintf( stdout, ": latitude = %6.2f deg, longitude = %6.2f deg\n",
538
539 /* Print the output coordinates. */
540 if ( out ) {
541 SUB( LALConvertSkyCoordinates( &stat, &sky, &sky, &params ),
542 &stat );
543 switch ( sky.system ) {
544 case COORDINATESYSTEM_HORIZON: fprintf( stdout, "Horizon " );
545 break;
546 case COORDINATESYSTEM_GEOGRAPHIC: fprintf( stdout, "Geographic" );
547 break;
548 case COORDINATESYSTEM_EQUATORIAL: fprintf( stdout, "Equatorial" );
549 break;
550 case COORDINATESYSTEM_ECLIPTIC: fprintf( stdout, "Ecliptic " );
551 break;
552 case COORDINATESYSTEM_GALACTIC: fprintf( stdout, "Galactic " );
553 break;
554 default: fprintf( stdout, "Unknown " );
555 }
556 fprintf( stdout, ": latitude = %6.2f deg, longitude = %6.2f deg\n",
558 }
559 fprintf( stdout, "\n" );
560 }
561
562 /* Clean up and exit. */
564 INFO( SKYCOORDINATESTESTC_MSGENORM );
566}
567/** \endcond */
#define USAGE
Definition: GzipTest.c:27
void LALCheckMemoryLeaks(void)
Definition: LALMalloc.c:784
#define SUB(func, statusptr)
#define ERROR(code, msg, statement)
#define INFO(statement)
#define SKYCOORDINATESTESTC_ENORM
Normal exit.
#define SKYCOORDINATESTESTC_ETEST
Test case failed.
#define SKYCOORDINATESTESTC_EARG
Error parsing arguments.
#define fprintf
int main(int argc, char *argv[])
Definition: cache.c:25
#define LAL_PI_2
pi/2
Definition: LALConstants.h:181
#define LAL_180_PI
pi/180 is the number of radians in one degree
Definition: LALConstants.h:187
#define LAL_PI_180
180/pi is the number of degrees in one radian
Definition: LALConstants.h:186
#define LAL_PI
Archimedes's constant, pi.
Definition: LALConstants.h:179
#define LAL_TWOPI
2*pi is circumference of a circle divided by its radius
Definition: LALConstants.h:180
unsigned char BOOLEAN
Boolean logical type, see Headers LAL(Atomic)Datatypes.h for more details.
double REAL8
Double precision real floating-point number (8 bytes).
int64_t INT8
Eight-byte signed integer; on some platforms this is equivalent to long int instead.
int LALPrintError(const char *fmt,...)
Definition: LALError.c:46
RandomParams * XLALCreateRandomParams(INT4 seed)
Definition: Random.c:102
REAL4 XLALUniformDeviate(RandomParams *params)
Definition: Random.c:146
void XLALDestroyRandomParams(RandomParams *params)
Definition: Random.c:140
void LALConvertSkyCoordinates(LALStatus *stat, SkyPosition *output, SkyPosition *input, ConvertSkyParams *params)
void LALNormalizeSkyPosition(LALStatus *stat, SkyPosition *posOut, const SkyPosition *posIn)
@ COORDINATESYSTEM_GALACTIC
The galactic coordinate system.
@ COORDINATESYSTEM_ECLIPTIC
The ecliptic coordinate system.
@ COORDINATESYSTEM_GEOGRAPHIC
The Earth-fixed geographic coordinate system.
@ COORDINATESYSTEM_HORIZON
A horizon coordinate system.
@ COORDINATESYSTEM_EQUATORIAL
The sky-fixed equatorial coordinate system.
void LALGeocentricToGeodetic(LALStatus *, EarthPosition *location)
void LALGeodeticToGeocentric(LALStatus *, EarthPosition *location)
void LALCHARCreateVector(LALStatus *, CHARVector **, UINT4)
void LALCHARDestroyVector(LALStatus *, CHARVector **)
struct tm * XLALGPSToUTC(struct tm *utc, INT4 gpssec)
Returns a pointer to a tm structure representing the time specified in seconds since the GPS epoch.
REAL8 XLALGreenwichMeanSiderealTime(const LIGOTimeGPS *gpstime)
Convenience wrapper, calling XLALGreenwichSiderealTime() with the equation of equinoxes set to 0.
LIGOTimeGPS * XLALINT8NSToGPS(LIGOTimeGPS *epoch, INT8 ns)
Converts nano seconds stored as an INT8 to GPS time.
Definition: XLALTime.c:46
INT8 XLALGPSToINT8NS(const LIGOTimeGPS *epoch)
Converts GPS time to nano seconds stored as an INT8.
Definition: XLALTime.c:36
Vector of type CHAR, see DATATYPE-Vector types for more details.
Definition: LALDatatypes.h:73
CHAR * data
Pointer to the data array.
Definition: LALDatatypes.h:78
UINT4 length
Number of elements in array.
Definition: LALDatatypes.h:77
This structure stores parameters for the function LALConvertSkyPosition().
CoordinateSystem system
The coordinate system to which one is transforming.
SkyPosition * zenith
The position of the zenith of the horizon coordinate system; may be NULL if one is neither converting...
LIGOTimeGPS * gpsTime
The GPS time for conversions between Earth-fixed and sky-fixed coordinates; may be NULL if no such co...
This structure stores the location of a point on (or near) the surface of the Earth in both geodetic ...
SkyPosition geocentric
The geographic coordinates of the direction from the centre of the Earth through the point; that is,...
REAL8 radius
The distance of the point from the geocentre, in metres.
REAL8 elevation
The vertical distance of the point above the reference ellipsoid, in metres.
REAL8 z
The Earth-fixed geocentric Cartesian coordinates of the point, in metres.
SkyPosition geodetic
The geographic coordinates of the upward vertical direction from the point; that is,...
LAL status structure, see The LALStatus structure for more details.
Definition: LALDatatypes.h:947
Epoch relative to GPS epoch, see LIGOTimeGPS type for more details.
Definition: LALDatatypes.h:458
INT4 gpsSeconds
Seconds since 0h UTC 6 Jan 1980.
Definition: LALDatatypes.h:459
INT4 gpsNanoSeconds
Residual nanoseconds.
Definition: LALDatatypes.h:460
This structure contains the parameters necessary for generating the current sequence of random number...
Definition: Random.h:86
This structure stores the two spherical coordinates of a sky position; ie a generic latitude and long...
REAL8 longitude
The longitudinal coordinate (in radians), as defined above.
REAL8 latitude
The latitudinal coordinate (in radians), as defined above.
CoordinateSystem system
The coordinate system in which latitude/longitude are expressed.