1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.

//! Useful constants.

use std::f64::consts::PI;

/// Speed of light \[metres/second\]
pub const VEL_C: f64 = erfa::constants::ERFA_CMPS;

/// Seconds per day (86400)
pub const DAYSEC: f64 = erfa::constants::ERFA_DAYSEC;
/// Seconds of time to radians (7.272205216643039903848712e-5).
pub const DS2R: f64 = erfa::constants::ERFA_DS2R;
/// Hour angle to radians (15 / 180 * PI).
pub const DH2R: f64 = 15.0 / 180.0 * PI;
/// Ratio of a solar day to a sidereal day (24/23.9344696 = 1.002737909).
pub const SOLAR2SIDEREAL: f64 = 24.0 / 23.9344696;

/// MWA latitude \[radians\]
pub const MWA_LAT_RAD: f64 = -0.4660608448386394;
/// MWA latitude \[degrees\]
pub const MWA_LAT_DEG: f64 = MWA_LAT_RAD * 180.0 / PI;
/// MWA longitude \[radians\]
pub const MWA_LONG_RAD: f64 = 2.0362898668561042;
/// MWA latitude \[degrees\]
pub const MWA_LONG_DEG: f64 = MWA_LONG_RAD * 180.0 / PI;
/// MWA height (a.k.a. altitude) \[metres\]
pub const MWA_HEIGHT_M: f64 = 377.827;

/// The weight given to time when calculating a weight factor. When combined
/// with [`FREQ_WEIGHT_FACTOR`], a visibility weight can be calculated.
pub const TIME_WEIGHT_FACTOR: f64 = 1.0;
/// The weight given to frequency when calculating a weight factor. When
/// combined with [`TIME_WEIGHT_FACTOR`], a visibility weight can be calculated.
pub const FREQ_WEIGHT_FACTOR: f64 = 10000.0;

// cotter's constants. Useful for being more precise when converting geocentric
// XYZ to geodetic XYZ!
/// cotter's MWA latitude on Earth in radians. Use [`MWA_LAT_RAD`] unless you know
/// what you're doing.
pub const COTTER_MWA_LATITUDE_RADIANS: f64 = -0.46606083776035967;
/// cotter's MWA longitude on Earth in radians. Use [`MWA_LONG_RAD`] unless you
/// know what you're doing.
pub const COTTER_MWA_LONGITUDE_RADIANS: f64 = 2.0362897754687257;
/// cotter's MWA altitude in metres. Use [`MWA_HEIGHT_M`] unless you know what
/// you're doing.
pub const COTTER_MWA_HEIGHT_METRES: f64 = 377.0;