Coverage Report

Created: 2026-05-16 06:09

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/rust/registry/src/index.crates.io-1949cf8c6b5b557f/sofars-0.6.1/src/astro/apcs13.rs
Line
Count
Source
1
use crate::eph::epv00;
2
3
use super::{IauAstrom, apcs};
4
5
///  Prepare for ICRS <−> CIRS, space
6
///
7
///  For an observer whose geocentric position and velocity are known,
8
///  prepare star-independent astrometry parameters for transformations
9
///  between ICRS and GCRS.  The Earth ephemeris is from SOFA models.
10
///
11
///  The parameters produced by this function are required in the space
12
///  motion, parallax, light deflection and aberration parts of the
13
///  astrometric transformation chain.
14
///
15
///  This function is part of the International Astronomical Union's
16
///  SOFA (Standards of Fundamental Astronomy) software collection.
17
///
18
///  Status:  support function.
19
///
20
///  Given:
21
///  ```
22
///     date1  double       TDB as a 2-part...
23
///     date2  double       ...Julian Date (Note 1)
24
///     pv     double[2][3] observer's geocentric pos/vel (Note 3)
25
///  ```
26
///  Returned:
27
///  ```
28
///     astrom iauASTROM*   star-independent astrometry parameters:
29
///      pmt    double       PM time interval (SSB, Julian years)
30
///      eb     double[3]    SSB to observer (vector, au)
31
///      eh     double[3]    Sun to observer (unit vector)
32
///      em     double       distance from Sun to observer (au)
33
///      v      double[3]    barycentric observer velocity (vector, c)
34
///      bm1    double       sqrt(1-|v|^2): reciprocal of Lorenz factor
35
///      bpn    double[3][3] bias-precession-nutation matrix
36
///      along  double       unchanged
37
///      xpl    double       unchanged
38
///      ypl    double       unchanged
39
///      sphi   double       unchanged
40
///      cphi   double       unchanged
41
///      diurab double       unchanged
42
///      eral   double       unchanged
43
///      refa   double       unchanged
44
///      refb   double       unchanged
45
///  ```
46
///  Notes:
47
///
48
///  1) The TDB date date1+date2 is a Julian Date, apportioned in any
49
///     convenient way between the two arguments.  For example,
50
///     JD(TDB)=2450123.7 could be expressed in any of these ways, among
51
///     others:
52
///  ```
53
///            date1          date2
54
///
55
///         2450123.7           0.0       (JD method)
56
///         2451545.0       -1421.3       (J2000 method)
57
///         2400000.5       50123.2       (MJD method)
58
///         2450123.5           0.2       (date & time method)
59
///  ```
60
///     The JD method is the most natural and convenient to use in cases
61
///     where the loss of several decimal digits of resolution is
62
///     acceptable.  The J2000 method is best matched to the way the
63
///     argument is handled internally and will deliver the optimum
64
///     resolution.  The MJD method and the date & time methods are both
65
///     good compromises between resolution and convenience.  For most
66
///     applications of this function the choice will not be at all
67
///     critical.
68
///
69
///     TT can be used instead of TDB without any significant impact on
70
///     accuracy.
71
///
72
///  2) All the vectors are with respect to BCRS axes.
73
///
74
///  3) The observer's position and velocity pv are geocentric but with
75
///     respect to BCRS axes, and in units of m and m/s.  No assumptions
76
///     are made about proximity to the Earth, and the function can be
77
///     used for deep space applications as well as Earth orbit and
78
///     terrestrial.
79
///
80
///  4) In cases where the caller wishes to supply his own Earth
81
///     ephemeris, the function iauApcs can be used instead of the present
82
///     function.
83
///
84
///  5) This is one of several functions that inserts into the astrom
85
///     structure star-independent parameters needed for the chain of
86
///     astrometric transformations ICRS <-> GCRS <-> CIRS <-> observed.
87
///
88
///     The various functions support different classes of observer and
89
///     portions of the transformation chain:
90
///  ```
91
///          functions         observer        transformation
92
///
93
///       iauApcg iauApcg13    geocentric      ICRS <-> GCRS
94
///       iauApci iauApci13    terrestrial     ICRS <-> CIRS
95
///       iauApco iauApco13    terrestrial     ICRS <-> observed
96
///       iauApcs iauApcs13    space           ICRS <-> GCRS
97
///       iauAper iauAper13    terrestrial     update Earth rotation
98
///       iauApio iauApio13    terrestrial     CIRS <-> observed
99
///  ```
100
///     Those with names ending in "13" use contemporary SOFA models to
101
///     compute the various ephemerides.  The others accept ephemerides
102
///     supplied by the caller.
103
///
104
///     The transformation from ICRS to GCRS covers space motion,
105
///     parallax, light deflection, and aberration.  From GCRS to CIRS
106
///     comprises frame bias and precession-nutation.  From CIRS to
107
///     observed takes account of Earth rotation, polar motion, diurnal
108
///     aberration and parallax (unless subsumed into the ICRS <-> GCRS
109
///     transformation), and atmospheric refraction.
110
///
111
///  6) The context structure astrom produced by this function is used by
112
///     iauAtciq* and iauAticq*.
113
///
114
///  Called:
115
///  ```
116
///     iauEpv00     Earth position and velocity
117
///     iauApcs      astrometry parameters, ICRS-GCRS, space observer
118
///  ```
119
0
pub fn apcs13(date1: f64, date2: f64, pv: &[[f64; 3]; 2], astrom: &mut IauAstrom) {
120
    /* Earth barycentric & heliocentric position/velocity (au, au/d). */
121
0
    let (ehpv, ebpv) = epv00(date1, date2).unwrap();
122
123
    /* Compute the star-independent astrometry parameters. */
124
0
    apcs(date1, date2, pv, &ebpv, &ehpv[0], astrom);
125
0
}