Automatically converts among sky coordinate systems.
The function LALConvertSkyCoordinates()
transforms the contents of *input
to the system specified in *params
, storing the result in *output
(which may point to the same object as *input
for an in-place transformation). The routine makes calls to the functions in CelestialCoordinates.c and TerrestrialCoordinates.c as required; the *params
object must store any data fields required by these functions, or an error will occur.
The function LALNormalizeSkyPosition()
"normalizes" any given (spherical) sky-position (in radians), which means it projects the angles into \([0, 2\pi) \times [-\pi/2, \pi/2]\) if they lie outside.
LALConvertSkyCoordinates()
is structured as a simple loop over transformations, each of which moves the output sky position one step closer to the desired final coordinates system. The usual "flow" of the algorithm is:
although one can also convert directly between equatorial and horizon coordinate systems if params->zenith
is given in equatorial coordinates (i.e. if its longitudinal coordinate is the local mean sidereal time rather than the geographic longitude of the observer). This leads to the only error checking done within this function: when transforming to horizon coordinates, it checks that params->zenith
is either in sky-fixed equatorial or Earth-fixed geographic coordinates. Other than this, error checking is left to the secondary function call; if a parameter is absent or poorly formatted, the called function will return an error.
Prototypes | |
void | LALConvertSkyCoordinates (LALStatus *stat, SkyPosition *output, SkyPosition *input, ConvertSkyParams *params) |
void | LALNormalizeSkyPosition (LALStatus *stat, SkyPosition *posOut, const SkyPosition *posIn) |
void | XLALNormalizeSkyPosition (double *restrict longitude, double *restrict latitude) |
If sky-position is not in the canonical range \((\alpha,\delta)\in [0,2\pi]\times[-\pi/2, \pi/2]\), normalize it by mapping it into this coordinate-interval. More... | |
void LALConvertSkyCoordinates | ( | LALStatus * | stat, |
SkyPosition * | output, | ||
SkyPosition * | input, | ||
ConvertSkyParams * | params | ||
) |
Definition at line 73 of file SkyCoordinates.c.
void LALNormalizeSkyPosition | ( | LALStatus * | stat, |
SkyPosition * | posOut, | ||
const SkyPosition * | posIn | ||
) |
stat | pointer to LALStatus structure | |
[out] | posOut | normalized sky-position |
[in] | posIn | general sky-position |
Definition at line 166 of file SkyCoordinates.c.
void XLALNormalizeSkyPosition | ( | double *restrict | longitude, |
double *restrict | latitude | ||
) |
If sky-position is not in the canonical range \((\alpha,\delta)\in [0,2\pi]\times[-\pi/2, \pi/2]\), normalize it by mapping it into this coordinate-interval.
Based on Alicia's function with some additional "unwinding" added.
[in,out] | longitude | sky-position longitude to normalize |
[in,out] | latitude | sky-position latitude to normalize |
Definition at line 195 of file SkyCoordinates.c.