pub struct Beam { /* private fields */ }Expand description
A 2D elliptical Gaussian beam in FITS conventions: FWHM axes in degrees (BMAJ, BMIN) and position angle in degrees East of North (BPA).
use convolve_rs::Beam;
let beam = Beam::from_arcsec(20.0, 10.0, 45.0)?;
assert_eq!(beam.major_arcsec(), 20.0);
assert_eq!(beam.major_deg(), 20.0 / 3600.0);Implementations§
Source§impl Beam
impl Beam
Sourcepub fn new(
major_deg: f64,
minor_deg: f64,
pa_deg: f64,
) -> Result<Self, BeamError>
pub fn new( major_deg: f64, minor_deg: f64, pa_deg: f64, ) -> Result<Self, BeamError>
A beam from FWHM axes in degrees and a PA in degrees East of North.
§Errors
If a value is not finite, an axis is negative, or minor_deg > major_deg.
use convolve_rs::Beam;
let beam = Beam::new(20.0 / 3600.0, 10.0 / 3600.0, 45.0)?;
assert_eq!(beam.pa_deg(), 45.0);
assert!(Beam::new(10.0 / 3600.0, 20.0 / 3600.0, 0.0).is_err());Sourcepub fn from_arcsec(
major_arcsec: f64,
minor_arcsec: f64,
pa_deg: f64,
) -> Result<Self, BeamError>
pub fn from_arcsec( major_arcsec: f64, minor_arcsec: f64, pa_deg: f64, ) -> Result<Self, BeamError>
A beam from FWHM axes in arcseconds and a PA in degrees East of North.
use convolve_rs::Beam;
let beam = Beam::from_arcsec(20.0, 10.0, 45.0)?;
assert_eq!(beam.minor_deg(), 10.0 / 3600.0);pub fn major_deg(&self) -> f64
pub fn minor_deg(&self) -> f64
pub fn pa_deg(&self) -> f64
pub fn major_arcsec(&self) -> f64
pub fn minor_arcsec(&self) -> f64
pub fn is_zero(&self) -> bool
pub fn is_circular(&self, rtol: f64) -> bool
Sourcepub fn deconvolve(&self, other: &Beam) -> Result<Beam, BeamError>
pub fn deconvolve(&self, other: &Beam) -> Result<Beam, BeamError>
The beam that, convolved with other, gives self.
§Errors
BeamError::DeconvolveFailed if the result would not be a beam with
positive area, as in radio_beam.
use convolve_rs::Beam;
let a = Beam::from_arcsec(10.0, 8.0, 30.0)?;
let b = Beam::from_arcsec(6.0, 5.0, 15.0)?;
let recovered = a.convolve(&b).deconvolve(&a)?;
assert!((recovered.major_arcsec() - b.major_arcsec()).abs() < 1e-6);
assert!((recovered.minor_arcsec() - b.minor_arcsec()).abs() < 1e-6);
assert!(b.deconvolve(&a).is_err());Sourcepub fn deconvolve_or_zero(&self, other: &Beam) -> Beam
pub fn deconvolve_or_zero(&self, other: &Beam) -> Beam
Like Beam::deconvolve, but a zero beam on failure.
Sourcepub fn contains(&self, other: &Beam) -> bool
pub fn contains(&self, other: &Beam) -> bool
True if other can be convolved up to self.
Unlike Beam::deconvolve, this accepts a kernel that is a line or a
point (e.g. 20″×10″ inside 20″×20″), which the UV-plane filter handles.
use convolve_rs::Beam;
let target = Beam::from_arcsec(20.0, 20.0, 0.0)?;
assert!(target.contains(&Beam::from_arcsec(20.0, 10.0, 0.0)?));
assert!(!target.contains(&Beam::from_arcsec(21.0, 10.0, 0.0)?));Trait Implementations§
Auto Trait Implementations§
impl Freeze for Beam
impl RefUnwindSafe for Beam
impl Send for Beam
impl Sync for Beam
impl Unpin for Beam
impl UnsafeUnpin for Beam
impl UnwindSafe for Beam
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
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> ⓘ
Converts
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> ⓘ
Converts
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