Astro-PAL
view release on metacpan or search on metacpan
erfasrc/src/starpv.c view on Meta::CPAN
** coordinate time, TCB. For most practical applications, it is
** permissible to neglect the distinction between TCB and ordinary
** "proper" time on Earth (TT/TAI). The result will, as a rule, be
** limited by the intrinsic accuracy of the proper-motion and
** radial-velocity data; moreover, the pv-vector is likely to be
** merely an intermediate result, so that a change of time unit
** would cancel out overall.
**
** In accordance with normal star-catalog conventions, the object's
** right ascension and declination are freed from the effects of
** secular aberration. The frame, which is aligned to the catalog
** equator and equinox, is Lorentzian and centered on the SSB.
**
** 2) The resulting position and velocity pv-vector is with respect to
** the same frame and, like the catalog coordinates, is freed from
** the effects of secular aberration. Should the "coordinate
** direction", where the object was located at the catalog epoch, be
** required, it may be obtained by calculating the magnitude of the
** position vector pv[0][0-2] dividing by the speed of light in
** au/day to give the light-time, and then multiplying the space
** velocity pv[1][0-2] by this light-time and adding the result to
** pv[0][0-2].
**
** Summarizing, the pv-vector returned is for most stars almost
** identical to the result of applying the standard geometrical
** "space motion" transformation. The differences, which are the
** subject of the Stumpff paper referenced below, are:
**
** (i) In stars with significant radial velocity and proper motion,
** the constantly changing light-time distorts the apparent proper
** motion. Note that this is a classical, not a relativistic,
** effect.
**
** (ii) The transformation complies with special relativity.
**
** 3) Care is needed with units. The star coordinates are in radians
** and the proper motions in radians per Julian year, but the
** parallax is in arcseconds; the radial velocity is in km/s, but
** the pv-vector result is in au and au/day.
**
** 4) The RA proper motion is in terms of coordinate angle, not true
** angle. If the catalog uses arcseconds for both RA and Dec proper
** motions, the RA proper motion will need to be divided by cos(Dec)
** before use.
**
** 5) Straight-line motion at constant speed, in the inertial frame,
** is assumed.
**
** 6) An extremely small (or zero or negative) parallax is interpreted
** to mean that the object is on the "celestial sphere", the radius
** of which is an arbitrary (large) value (see the constant PXMIN).
** When the distance is overridden in this way, the status,
** initially zero, has 1 added to it.
**
** 7) If the space velocity is a significant fraction of c (see the
** constant VMAX), it is arbitrarily set to zero. When this action
** occurs, 2 is added to the status.
**
** 8) The relativistic adjustment involves an iterative calculation.
** If the process fails to converge within a set number (IMAX) of
** iterations, 4 is added to the status.
**
** 9) The inverse transformation is performed by the function
** eraPvstar.
**
** Called:
** eraS2pv spherical coordinates to pv-vector
** eraPm modulus of p-vector
** eraZp zero p-vector
** eraPn decompose p-vector into modulus and direction
** eraPdp scalar product of two p-vectors
** eraSxp multiply p-vector by scalar
** eraPmp p-vector minus p-vector
** eraPpp p-vector plus p-vector
**
** Reference:
**
** Stumpff, P., 1985, Astron.Astrophys. 144, 232-240.
**
** Copyright (C) 2013-2020, NumFOCUS Foundation.
** Derived, with permission, from the SOFA library. See notes at end of file.
*/
{
/* Smallest allowed parallax */
static const double PXMIN = 1e-7;
/* Largest allowed speed (fraction of c) */
static const double VMAX = 0.5;
/* Maximum number of iterations for relativistic solution */
static const int IMAX = 100;
int i, iwarn;
double w, r, rd, rad, decd, v, x[3], usr[3], ust[3],
vsr, vst, betst, betsr, bett, betr,
dd, ddel, ur[3], ut[3],
d = 0.0, del = 0.0, /* to prevent */
odd = 0.0, oddel = 0.0, /* compiler */
od = 0.0, odel = 0.0; /* warnings */
/* Distance (au). */
if (px >= PXMIN) {
w = px;
iwarn = 0;
} else {
w = PXMIN;
iwarn = 1;
}
r = ERFA_DR2AS / w;
/* Radial velocity (au/day). */
rd = ERFA_DAYSEC * rv * 1e3 / ERFA_DAU;
/* Proper motion (radian/day). */
rad = pmr / ERFA_DJY;
decd = pmd / ERFA_DJY;
/* To pv-vector (au,au/day). */
eraS2pv(ra, dec, r, rad, decd, rd, pv);
/* If excessive velocity, arbitrarily set it to zero. */
v = eraPm(pv[1]);
if (v / ERFA_DC > VMAX) {
eraZp(pv[1]);
iwarn += 2;
}
/* Isolate the radial component of the velocity (au/day). */
eraPn(pv[0], &w, x);
vsr = eraPdp(x, pv[1]);
eraSxp(vsr, x, usr);
/* Isolate the transverse component of the velocity (au/day). */
eraPmp(pv[1], usr, ust);
vst = eraPm(ust);
/* Special-relativity dimensionless parameters. */
betsr = vsr / ERFA_DC;
betst = vst / ERFA_DC;
/* Determine the inertial-to-observed relativistic correction terms. */
bett = betst;
betr = betsr;
for (i = 0; i < IMAX; i++) {
d = 1.0 + betr;
w = betr*betr + bett*bett;
del = - w / (sqrt(1.0 - w) + 1.0);
betr = d * betsr + del;
bett = d * betst;
( run in 1.517 second using v1.01-cache-2.11-cpan-71847e10f99 )