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/atciq.rs
Line
Count
Source
1
use super::{IauAstrom, ab, ldsun, pmpx};
2
use crate::vm::{anp, c2s, rxp};
3
4
///  Quick ICRS −> CIRS
5
///
6
///  Quick ICRS, epoch J2000.0, to CIRS transformation, given precomputed
7
///  star-independent astrometry parameters.
8
///
9
///  Use of this function is appropriate when efficiency is important and
10
///  where many star positions are to be transformed for one date.  The
11
///  star-independent parameters can be obtained by calling one of the
12
///  functions iauApci[13], iauApcg[13], iauApco[13] or iauApcs[13].
13
///
14
///  If the parallax and proper motions are zero the iauAtciqz function
15
///  can be used instead.
16
///
17
///  This function is part of the International Astronomical Union's
18
///  SOFA (Standards of Fundamental Astronomy) software collection.
19
///
20
///  Status:  support function.
21
///
22
///  Given:
23
///  ```
24
///     rc,dc  double     ICRS RA,Dec at J2000.0 (radians, Note 1)
25
///     pr     double     RA proper motion (radians/year, Note 2)
26
///     pd     double     Dec proper motion (radians/year)
27
///     px     double     parallax (arcsec)
28
///     rv     double     radial velocity (km/s, +ve if receding)
29
///     astrom iauASTROM* star-independent astrometry parameters:
30
///      pmt    double       PM time interval (SSB, Julian years)
31
///      eb     double[3]    SSB to observer (vector, au)
32
///      eh     double[3]    Sun to observer (unit vector)
33
///      em     double       distance from Sun to observer (au)
34
///      v      double[3]    barycentric observer velocity (vector, c)
35
///      bm1    double       sqrt(1-|v|^2): reciprocal of Lorenz factor
36
///      bpn    double[3][3] bias-precession-nutation matrix
37
///      along  double       longitude + s' (radians)
38
///      xpl    double       polar motion xp wrt local meridian (radians)
39
///      ypl    double       polar motion yp wrt local meridian (radians)
40
///      sphi   double       sine of geodetic latitude
41
///      cphi   double       cosine of geodetic latitude
42
///      diurab double       magnitude of diurnal aberration vector
43
///      eral   double       "local" Earth rotation angle (radians)
44
///      refa   double       refraction constant A (radians)
45
///      refb   double       refraction constant B (radians)
46
///  ```
47
///  Returned:
48
///  ```
49
///     ri,di   double    CIRS RA,Dec (radians)
50
///  ```
51
///  Notes:
52
///
53
///  1) Star data for an epoch other than J2000.0 (for example from the
54
///     Hipparcos catalog, which has an epoch of J1991.25) will require a
55
///     preliminary call to iauPmsafe before use.
56
///
57
///  2) The proper motion in RA is dRA/dt rather than cos(Dec)*dRA/dt.
58
///
59
///  Called:
60
///  ```
61
///     iauPmpx      proper motion and parallax
62
///     iauLdsun     light deflection by the Sun
63
///     iauAb        stellar aberration
64
///     iauRxp       product of r-matrix and pv-vector
65
///     iauC2s       p-vector to spherical
66
///  ```
67
0
pub fn atciq(
68
0
    rc: f64,
69
0
    dc: f64,
70
0
    pr: f64,
71
0
    pd: f64,
72
0
    px: f64,
73
0
    rv: f64,
74
0
    astrom: &mut IauAstrom,
75
0
) -> (f64, f64) {
76
0
    let pco = pmpx(rc, dc, pr, pd, px, rv, astrom.pmt, astrom.eb);
77
0
    let pnat = ldsun(pco, astrom.eh, astrom.em);
78
0
    let ppr = ab(&pnat, &astrom.v, astrom.em, astrom.bm1);
79
0
    let pi = &mut [0.0; 3];
80
0
    rxp(&astrom.bpn, &ppr, pi);
81
0
    let (w, di) = c2s(pi);
82
0
    let ri = anp(w);
83
0
    (ri, di)
84
0
}