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: f64Right ascension [radians]
dec: f64Declination [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.
Trait Implementations§
impl Copy for RADec
impl StructuralPartialEq for RADec
Auto Trait Implementations§
impl Freeze for RADec
impl RefUnwindSafe for RADec
impl Send for RADec
impl Sync for RADec
impl Unpin for RADec
impl UnwindSafe for RADec
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more