Skip to content

Commit b84ce13

Browse files
committed
use GAST for UVW calculations
1 parent d1558da commit b84ce13

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

src/io/ms.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1780,7 +1780,13 @@ impl VisWrite for MeasurementSetWriter {
17801780
avg_centroid_timestamp,
17811781
self.dut1,
17821782
);
1783-
let hadec = self.phase_centre.to_hadec(lmst);
1783+
// We use the same time for TT as we did for UT1 (which is what
1784+
// get_lmst does).
1785+
let mjd = (avg_centroid_timestamp + self.dut1).to_mjd_utc_days();
1786+
let eqeq = crate::pal::palEqeq(mjd);
1787+
let last = lmst + eqeq;
1788+
1789+
let hadec = self.phase_centre.to_hadec(last);
17841790
(self.antenna_positions.as_slice().into(), hadec)
17851791
};
17861792

src/pos/pal.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,23 @@ pub fn palGmst(ut1: f64) -> f64 {
4040
eraGmst06(ERFA_DJM0, ut1, ERFA_DJM0, ut1)
4141
}
4242

43+
/// Equation of the equinoxes (IAU 2006)
44+
///
45+
/// # Arguments
46+
/// date = double (Given)
47+
/// TT as a modified Julian Date (JD-2400000.5)
48+
///
49+
/// # Returned Value
50+
/// Equation of the equinoxes
51+
///
52+
/// # Description
53+
/// The equation of the equinoxes is the difference between apparent and
54+
/// mean sidereal time (GAST - GMST).
55+
pub fn palEqeq(date: f64) -> f64 {
56+
let rnpb = erfa::aliases::eraPnm06a(ERFA_DJM0, date);
57+
erfa::aliases::eraGst06(ERFA_DJM0, date, ERFA_DJM0, date, rnpb) - erfa::aliases::eraGmst06(ERFA_DJM0, date, ERFA_DJM0, date)
58+
}
59+
4360
/// Spherical coordinates to direction cosines
4461
///
4562
/// Arguments:

0 commit comments

Comments
 (0)