pub struct Pupil { /* private fields */ }Expand description
Owned sampled complex pupil and same-shaped binary aperture support.
Arrays are shaped (height, width) on the low-resolution Fourier grid and stored
in standard row-major order. Values encode amplitude and phase transfer; support
entries are exactly zero or one.
Implementations§
Source§impl Pupil
impl Pupil
Sourcepub fn new(values: Array2<Complex64>, support: Array2<u8>) -> Result<Self>
pub fn new(values: Array2<Complex64>, support: Array2<u8>) -> Result<Self>
Stores owned pupil arrays without copying their elements.
Both inputs must have identical, non-zero shapes and C-contiguous standard row-major layout. Nonstandard inputs are rejected rather than copied. Support entries must be exactly zero or one.
Sourcepub fn circular(
shape: (usize, usize),
sampling: &Sampling,
optics: &Optics,
) -> Result<Self>
pub fn circular( shape: (usize, usize), sampling: &Sampling, optics: &Optics, ) -> Result<Self>
Builds a sampled circular pupil from microscope optics.
Samples outside sqrt(kx^2 + ky^2) <= 2 pi NA / lambda are set to zero.
Inside the support, optional defocus contributes the paraxial phase
-z * (kx^2 + ky^2) / (2 k0), where k0 = 2 pi n / lambda.
If crate::experiment::PupilAberration is present, this method adds
crate-specific phase terms
astigmatism * rho^2 * cos(2 theta),
coma * (3 rho^3 - 2 rho) * cos(theta), and
spherical * (6 rho^4 - 6 rho^2 + 1), with amplitude
exp(-edge_apodization * rho^2). These coefficients are direct radian
weights, not normalized Zernike coefficients.
Sourcepub fn values(&self) -> ArrayView2<'_, Complex64>
pub fn values(&self) -> ArrayView2<'_, Complex64>
Borrows the pupil values without allocating or copying.
Sourcepub fn values_mut(&mut self) -> ArrayViewMut2<'_, Complex64>
pub fn values_mut(&mut self) -> ArrayViewMut2<'_, Complex64>
Mutably borrows pupil elements without permitting structural mutation.
Sourcepub fn support(&self) -> ArrayView2<'_, u8>
pub fn support(&self) -> ArrayView2<'_, u8>
Borrows the binary pupil support without allocating or copying.
Sourcepub fn replace_values(&mut self, values: Array2<Complex64>) -> Result<()>
pub fn replace_values(&mut self, values: Array2<Complex64>) -> Result<()>
Replaces owned complex values without changing support.
values must be finite, standard row-major, and have Self::shape.
Sourcepub fn apply_support(&mut self)
pub fn apply_support(&mut self)
Sets every complex pupil value outside the binary aperture to zero in place.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Pupil
impl<'de> Deserialize<'de> for Pupil
Source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
impl StructuralPartialEq for Pupil
Auto Trait Implementations§
impl Freeze for Pupil
impl RefUnwindSafe for Pupil
impl Send for Pupil
impl Sync for Pupil
impl Unpin for Pupil
impl UnsafeUnpin for Pupil
impl UnwindSafe for Pupil
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