pub struct RADec {
pub ra: f64,
pub dec: f64,
}
Expand description
A struct containing a Right Ascension and Declination. All units are in radians.
Note that the serialised units are degrees and are automatically converted when serialising/deserialising.
Fields§
§ra: f64
Right ascension [radians]
dec: f64
Declination [radians]
Implementations§
source§impl RADec
impl RADec
sourcepub fn from_radians(ra: f64, dec: f64) -> RADec
pub fn from_radians(ra: f64, dec: f64) -> RADec
Make a new RADec
struct from values in radians.
sourcepub fn from_degrees(ra: f64, dec: f64) -> RADec
pub fn from_degrees(ra: f64, dec: f64) -> RADec
Make a new RADec
struct from values in degrees.
sourcepub fn new(ra_rad: f64, dec_rad: f64) -> RADec
👎Deprecated: use RADec::from_radians
instead
pub fn new(ra_rad: f64, dec_rad: f64) -> RADec
RADec::from_radians
insteadMake a new RADec
struct from values in radians.
sourcepub fn new_degrees(ra_deg: f64, dec_deg: f64) -> RADec
👎Deprecated: use RADec::from_degrees
instead
pub fn new_degrees(ra_deg: f64, dec_deg: f64) -> RADec
RADec::from_degrees
insteadMake a new RADec
struct from values in degrees.
sourcepub fn from_hadec(hadec: HADec, lst_rad: f64) -> Self
pub fn from_hadec(hadec: HADec, lst_rad: f64) -> Self
sourcepub fn weighted_average(radecs: &[Self], weights: &[f64]) -> Option<Self>
pub fn weighted_average(radecs: &[Self], weights: &[f64]) -> Option<Self>
From a collection of RADec
coordinates and weights, find the average
RADec
position. The lengths of both collection must be the same to
get sensible results. Not providing any RADec
coordinates will make
this function return None
.
This function accounts for Right Ascension coordinates that range over
360 degrees. If the right ascension coordinates span a huge range (e.g.
0, 90, 180, 270), None
is returned.
The average position is found by converting the RADec
coordinates
(“spherical coordinates”) to cartesian coordinates (direction cosines),
performing the average, then converting the average back to spherical.
The results have been verified with scipy.optimize
(a sample program
is provided at the bottom of this file) and online calculators. When
coordinates are widely separated, the average can appear to have strange
values due to them falling on great circles.
sourcepub fn separation(&self, b: Self) -> f64
pub fn separation(&self, b: Self) -> f64
Calculate the distance between two sets of coordinates [radians].
sourcepub fn from_mwalib_phase_center(context: &MetafitsContext) -> Option<RADec>
pub fn from_mwalib_phase_center(context: &MetafitsContext) -> Option<RADec>
Given an mwalib::MetafitsContext
, make an Option<RADec>
from the
(ra|dec)_phase_center_degrees
if these are available, otherwise
None
.
sourcepub fn from_mwalib_tile_pointing(context: &MetafitsContext) -> RADec
pub fn from_mwalib_tile_pointing(context: &MetafitsContext) -> RADec
Given an mwalib::MetafitsContext
, make a RADec
from the
(ra|dec)_tile_pointing_degrees
.
sourcepub fn from_mwalib_phase_or_pointing(context: &MetafitsContext) -> RADec
pub fn from_mwalib_phase_or_pointing(context: &MetafitsContext) -> RADec
Given an mwalib::MetafitsContext
, make a RADec
from the
(ra|dec)_phase_center_degrees
if these are available, otherwise use
the (ra|dec)_tile_pointing_degrees
.