pub struct SyntheticWavelengthUnwrapper {
pub opd_range_m: (f64, f64),
pub minimum_amplitude: f64,
pub max_phase_residual_rad: Option<f64>,
}Expand description
Combines registered complex fields into one nondispersive OPD map.
For transmission phase φ_i = wrap(2π d / λ_i), subtracting the phase of
the longer wavelength from that of the shorter produces period
Λ = λ_short λ_long / (λ_long - λ_short). The longest such period selects
the coarse branch in an explicit half-open OPD interval. All remaining
shorter difference periods and original wavelengths refine integer orders
by rounding; a final equal-phase-weight least-squares fit uses every original
channel. This is post-reconstruction phase mixing, not optical interference
between colors or a joint intensity/OPD optimizer.
Inputs must have matching spatial registration, resolution, phase reference, and negligible OPD dispersion. No spatial continuity is required, so jumps exceeding an original wavelength can be recovered. Noise in a coarse OPD estimate must remain below half the next ladder period for correct rounding. This implementation uses an explicit interval instead of spatially unwrapping the longest synthetic phase and does not use phase-sum synthetic wavelengths.
§Example
use fpm_rs::{Complex64, reconstruction::{PhaseReference, SyntheticWavelengthUnwrapper}};
use ndarray::Array2;
let wavelengths = [500e-9, 550e-9];
let fields: Vec<_> = wavelengths.iter().map(|&wavelength| {
Array2::from_elem((2, 3), Complex64::from_polar(1.0,
std::f64::consts::TAU * 2.1e-6 / wavelength))
}).collect();
let views: Vec<_> = fields.iter().map(|field| field.view()).collect();
let result = SyntheticWavelengthUnwrapper::new((0.0, 4e-6))?
.unwrap_fields(&views, &wavelengths, &PhaseReference::Offsets(vec![0.0; 2]), None)?;
assert!((result.opd_m[(0, 0)] - 2.1e-6).abs() < 1e-18);§References
S. K. Mirsky and N. T. Shaked, “Six-pack holography for dynamic profiling of thick and extended objects by simultaneous three-wavelength phase unwrapping with doubled field of view”, Scientific Reports 13, article 19293 (2023), synthetic-wavelength and hierarchical phase-unwrapping sections. Here their phase-difference hierarchy is applied to already reconstructed FPM fields, without their holographic optics.
Fields§
§opd_range_m: (f64, f64)Half-open allowed absolute OPD interval [minimum, maximum) in metres.
Its width must not exceed the longest difference synthetic wavelength.
minimum_amplitude: f64All channel amplitudes must strictly exceed this finite nonnegative value.
max_phase_residual_rad: Option<f64>Optional maximum RMS phase residual in radians, in (0, π].
None retains all otherwise valid pixels and still reports residuals.
Implementations§
Source§impl SyntheticWavelengthUnwrapper
impl SyntheticWavelengthUnwrapper
Sourcepub fn new(opd_range_m: (f64, f64)) -> Result<Self>
pub fn new(opd_range_m: (f64, f64)) -> Result<Self>
Creates a validated interval configuration with no residual cutoff and zero amplitude floor.
Sourcepub fn validate(&self) -> Result<()>
pub fn validate(&self) -> Result<()>
Checks finite ordered bounds, amplitude floor, and optional residual tolerance.
Sourcepub fn unwrap_fields(
&self,
fields: &[ArrayView2<'_, Complex64>],
wavelengths_vacuum_m: &[f64],
reference: &PhaseReference,
mask: Option<ArrayView2<'_, u8>>,
) -> Result<OpticalPathDifferenceResult>
pub fn unwrap_fields( &self, fields: &[ArrayView2<'_, Complex64>], wavelengths_vacuum_m: &[f64], reference: &PhaseReference, mask: Option<ArrayView2<'_, u8>>, ) -> Result<OpticalPathDifferenceResult>
Recovers OPD from at least two finite C-contiguous fields on one nonempty grid.
reference explicitly supplies pistons or a constant-known-OPD reference
mask. mask, when present, is a common-grid uint8 validity mask (zero
excludes a pixel). Zero/below-floor amplitudes in any channel invalidate
that pixel. Reference means use only pixels valid in every channel.
Undefined reference means, numerically ill-conditioned beat periods, and
malformed shapes/layout/values return errors;
individual range/residual failures are represented in the returned mask.
Wavelengths are vacuum wavelengths in metres in the same order as fields.
Trait Implementations§
Source§impl Clone for SyntheticWavelengthUnwrapper
impl Clone for SyntheticWavelengthUnwrapper
Source§fn clone(&self) -> SyntheticWavelengthUnwrapper
fn clone(&self) -> SyntheticWavelengthUnwrapper
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for SyntheticWavelengthUnwrapper
impl RefUnwindSafe for SyntheticWavelengthUnwrapper
impl Send for SyntheticWavelengthUnwrapper
impl Sync for SyntheticWavelengthUnwrapper
impl Unpin for SyntheticWavelengthUnwrapper
impl UnsafeUnpin for SyntheticWavelengthUnwrapper
impl UnwindSafe for SyntheticWavelengthUnwrapper
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