File Coverage

erfasrc/src/pmpx.c
Criterion Covered Total %
statement 0 19 0.0
branch 0 2 0.0
condition n/a
subroutine n/a
pod n/a
total 0 21 0.0


line stmt bran cond sub pod time code
1             #include "erfa.h"
2              
3 0           void eraPmpx(double rc, double dc, double pr, double pd,
4             double px, double rv, double pmt, double pob[3],
5             double pco[3])
6             /*
7             ** - - - - - - - -
8             ** e r a P m p x
9             ** - - - - - - - -
10             **
11             ** Proper motion and parallax.
12             **
13             ** Given:
14             ** rc,dc double ICRS RA,Dec at catalog epoch (radians)
15             ** pr double RA proper motion (radians/year; Note 1)
16             ** pd double Dec proper motion (radians/year)
17             ** px double parallax (arcsec)
18             ** rv double radial velocity (km/s, +ve if receding)
19             ** pmt double proper motion time interval (SSB, Julian years)
20             ** pob double[3] SSB to observer vector (au)
21             **
22             ** Returned:
23             ** pco double[3] coordinate direction (BCRS unit vector)
24             **
25             ** Notes:
26             **
27             ** 1) The proper motion in RA is dRA/dt rather than cos(Dec)*dRA/dt.
28             **
29             ** 2) The proper motion time interval is for when the starlight
30             ** reaches the solar system barycenter.
31             **
32             ** 3) To avoid the need for iteration, the Roemer effect (i.e. the
33             ** small annual modulation of the proper motion coming from the
34             ** changing light time) is applied approximately, using the
35             ** direction of the star at the catalog epoch.
36             **
37             ** References:
38             **
39             ** 1984 Astronomical Almanac, pp B39-B41.
40             **
41             ** Urban, S. & Seidelmann, P. K. (eds), Explanatory Supplement to
42             ** the Astronomical Almanac, 3rd ed., University Science Books
43             ** (2013), Section 7.2.
44             **
45             ** Called:
46             ** eraPdp scalar product of two p-vectors
47             ** eraPn decompose p-vector into modulus and direction
48             **
49             ** Copyright (C) 2013-2020, NumFOCUS Foundation.
50             ** Derived, with permission, from the SOFA library. See notes at end of file.
51             */
52             {
53             /* Km/s to au/year */
54             const double VF = ERFA_DAYSEC*ERFA_DJM/ERFA_DAU;
55              
56             /* Light time for 1 au, Julian years */
57             const double AULTY = ERFA_AULT/ERFA_DAYSEC/ERFA_DJY;
58              
59             int i;
60             double sr, cr, sd, cd, x, y, z, p[3], dt, pxr, w, pdz, pm[3];
61              
62              
63             /* Spherical coordinates to unit vector (and useful functions). */
64 0           sr = sin(rc);
65 0           cr = cos(rc);
66 0           sd = sin(dc);
67 0           cd = cos(dc);
68 0           p[0] = x = cr*cd;
69 0           p[1] = y = sr*cd;
70 0           p[2] = z = sd;
71              
72             /* Proper motion time interval (y) including Roemer effect. */
73 0           dt = pmt + eraPdp(p,pob)*AULTY;
74              
75             /* Space motion (radians per year). */
76 0           pxr = px * ERFA_DAS2R;
77 0           w = VF * rv * pxr;
78 0           pdz = pd * z;
79 0           pm[0] = - pr*y - pdz*cr + w*x;
80 0           pm[1] = pr*x - pdz*sr + w*y;
81 0           pm[2] = pd*cd + w*z;
82              
83             /* Coordinate direction of star (unit vector, BCRS). */
84 0 0         for (i = 0; i < 3; i++) {
85 0           p[i] += dt*pm[i] - pxr*pob[i];
86             }
87 0           eraPn(p, &w, pco);
88              
89             /* Finished. */
90              
91 0           }
92             /*----------------------------------------------------------------------
93             **
94             **
95             ** Copyright (C) 2013-2020, NumFOCUS Foundation.
96             ** All rights reserved.
97             **
98             ** This library is derived, with permission, from the International
99             ** Astronomical Union's "Standards of Fundamental Astronomy" library,
100             ** available from http://www.iausofa.org.
101             **
102             ** The ERFA version is intended to retain identical functionality to
103             ** the SOFA library, but made distinct through different function and
104             ** file names, as set out in the SOFA license conditions. The SOFA
105             ** original has a role as a reference standard for the IAU and IERS,
106             ** and consequently redistribution is permitted only in its unaltered
107             ** state. The ERFA version is not subject to this restriction and
108             ** therefore can be included in distributions which do not support the
109             ** concept of "read only" software.
110             **
111             ** Although the intent is to replicate the SOFA API (other than
112             ** replacement of prefix names) and results (with the exception of
113             ** bugs; any that are discovered will be fixed), SOFA is not
114             ** responsible for any errors found in this version of the library.
115             **
116             ** If you wish to acknowledge the SOFA heritage, please acknowledge
117             ** that you are using a library derived from SOFA, rather than SOFA
118             ** itself.
119             **
120             **
121             ** TERMS AND CONDITIONS
122             **
123             ** Redistribution and use in source and binary forms, with or without
124             ** modification, are permitted provided that the following conditions
125             ** are met:
126             **
127             ** 1 Redistributions of source code must retain the above copyright
128             ** notice, this list of conditions and the following disclaimer.
129             **
130             ** 2 Redistributions in binary form must reproduce the above copyright
131             ** notice, this list of conditions and the following disclaimer in
132             ** the documentation and/or other materials provided with the
133             ** distribution.
134             **
135             ** 3 Neither the name of the Standards Of Fundamental Astronomy Board,
136             ** the International Astronomical Union nor the names of its
137             ** contributors may be used to endorse or promote products derived
138             ** from this software without specific prior written permission.
139             **
140             ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
141             ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
142             ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
143             ** FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
144             ** COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
145             ** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
146             ** BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
147             ** LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
148             ** CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
149             ** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
150             ** ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
151             ** POSSIBILITY OF SUCH DAMAGE.
152             **
153             */