pub struct Mpie {
pub iterations: usize,
pub object_step: f64,
pub stability: f64,
pub momentum_interval: usize,
pub momentum_friction: f64,
pub momentum_feedback: f64,
pub batch_size: usize,
pub epsilon: f64,
pub loss_type: LossType,
}Expand description
Momentum-accelerated regularized PIE adapted to image-plane FPM.
§Method
Mpie applies the same sequential, object-only rPIE projection as
super::Fpie, then periodically accelerates the centered high-resolution
object spectrum. After momentum_interval positive-weight measured-frame
updates, it updates the complex velocity and object as
V <- momentum_friction * V + (O_rpie - O_anchor)
O <- O_rpie + momentum_feedback * V.
A multiplexed measurement counts once after all of its source modes are
inserted. Zero-weight frames do not advance the interval. The counter,
velocity, anchor, and defining parameters are checkpointed, so changing
batch_size does not change the numerical path and a matching checkpoint
resumes exactly.
§Adaptation and assumptions
The cited method was formulated and tested for scanned ptychography and
applies momentum to both object and probe. This implementation accelerates
only the fixed-pupil Fourier-ptychographic object spectrum. It separates the
paper’s single eta_obj into friction and feedback controls; setting them
equal reproduces its Eqs. (19) and (21). object_step corresponds to the
paper’s gamma_obj in Eq. (22). Physical joint calibration is unsupported
because recompiling the model would require an explicit rule for resetting
or transporting momentum.
§Reference
A. Maiden, D. Johnson, and P. Li, “Further improvements to the ptychographical iterative engine” (2017), Optica 4(7), 736–745.
Fields§
§iterations: usizeNumber of complete passes through the acquisition schedule.
object_step: f64Relaxation factor applied to each rPIE object-spectrum correction.
stability: f64Blend between local pupil power (0) and maximum pupil power (1) in
the rPIE denominator.
momentum_interval: usizePositive-weight measured-frame updates between momentum events.
momentum_friction: f64Fraction of the previous velocity retained at each momentum event.
momentum_feedback: f64Fraction of the updated velocity added to the object spectrum.
batch_size: usizeNumber of measured frames supplied to each reconstruction step.
epsilon: f64Positive numerical floor added to the rPIE denominator.
loss_type: LossTypeLoss used for diagnostics; the projection itself always enforces the measured amplitude.
Implementations§
Source§impl Mpie
impl Mpie
Sourcepub fn iterations(self, iterations: usize) -> Self
pub fn iterations(self, iterations: usize) -> Self
Sets the number of complete acquisition-schedule passes.
Sourcepub fn object_step(self, object_step: f64) -> Self
pub fn object_step(self, object_step: f64) -> Self
Sets the finite positive relaxation applied to rPIE corrections.
Sourcepub fn stability(self, stability: f64) -> Self
pub fn stability(self, stability: f64) -> Self
Sets the rPIE pupil-power blend; validation requires [0, 1].
Sourcepub fn momentum_interval(self, momentum_interval: usize) -> Self
pub fn momentum_interval(self, momentum_interval: usize) -> Self
Sets the positive number of effective frame updates per momentum event.
Sourcepub fn momentum_friction(self, momentum_friction: f64) -> Self
pub fn momentum_friction(self, momentum_friction: f64) -> Self
Sets the retained-velocity fraction; validation requires [0, 1).
Sourcepub fn momentum_feedback(self, momentum_feedback: f64) -> Self
pub fn momentum_feedback(self, momentum_feedback: f64) -> Self
Sets the velocity-feedback fraction; validation requires [0, 1].
Sourcepub fn batch_size(self, batch_size: usize) -> Self
pub fn batch_size(self, batch_size: usize) -> Self
Sets the positive number of acquisition frames supplied per step.
Trait Implementations§
Source§impl ReconstructionAlgorithm for Mpie
impl ReconstructionAlgorithm for Mpie
Source§type IterationMetrics = NoIterationMetrics
type IterationMetrics = NoIterationMetrics
Source§fn validate(&self) -> Result<()>
fn validate(&self) -> Result<()>
Source§fn initialize<M: MeasurementRead>(
&self,
problem: &ReconstructionProblem<M>,
) -> Result<ReconstructionState>
fn initialize<M: MeasurementRead>( &self, problem: &ReconstructionProblem<M>, ) -> Result<ReconstructionState>
problem.Source§fn initialize_with_backend<M: MeasurementRead>(
&self,
problem: &ReconstructionProblem<M>,
backend: Arc<dyn Backend>,
) -> Result<ReconstructionState>
fn initialize_with_backend<M: MeasurementRead>( &self, problem: &ReconstructionProblem<M>, backend: Arc<dyn Backend>, ) -> Result<ReconstructionState>
backend.Source§fn supports_joint_reconstruction(&self) -> bool
fn supports_joint_reconstruction(&self) -> bool
Source§fn step<M: MeasurementRead>(
&mut self,
problem: &ReconstructionProblem<M>,
state: &mut ReconstructionState,
batch: &Batch,
_iteration: usize,
) -> Result<StepOutput<Self::IterationMetrics>>
fn step<M: MeasurementRead>( &mut self, problem: &ReconstructionProblem<M>, state: &mut ReconstructionState, batch: &Batch, _iteration: usize, ) -> Result<StepOutput<Self::IterationMetrics>>
state for one scheduled batch in zero-based iteration.Source§fn iterations(&self) -> usize
fn iterations(&self) -> usize
Source§fn batch_size(&self) -> usize
fn batch_size(&self) -> usize
Source§fn validate_problem<M: MeasurementRead>(
&self,
_problem: &ReconstructionProblem<M>,
) -> Result<()>
fn validate_problem<M: MeasurementRead>( &self, _problem: &ReconstructionProblem<M>, ) -> Result<()>
problem.Source§fn canonicalize_state<M: MeasurementRead>(
&self,
_problem: &ReconstructionProblem<M>,
_state: &mut ReconstructionState,
) -> Result<()>
fn canonicalize_state<M: MeasurementRead>( &self, _problem: &ReconstructionProblem<M>, _state: &mut ReconstructionState, ) -> Result<()>
Source§fn run<M: MeasurementRead>(
self,
problem: &ReconstructionProblem<M>,
) -> Result<ReconstructionResult>where
Self: Sized,
fn run<M: MeasurementRead>(
self,
problem: &ReconstructionProblem<M>,
) -> Result<ReconstructionResult>where
Self: Sized,
Source§fn run_with_callbacks<M: MeasurementRead>(
self,
problem: &ReconstructionProblem<M>,
callbacks: Vec<Box<dyn Callback>>,
) -> Result<ReconstructionResult>where
Self: Sized,
fn run_with_callbacks<M: MeasurementRead>(
self,
problem: &ReconstructionProblem<M>,
callbacks: Vec<Box<dyn Callback>>,
) -> Result<ReconstructionResult>where
Self: Sized,
callbacks at their declared hooks.Source§fn run_from_checkpoint<M: MeasurementRead>(
self,
problem: &ReconstructionProblem<M>,
checkpoint: ReconstructionCheckpoint,
) -> Result<ReconstructionResult>where
Self: Sized,
fn run_from_checkpoint<M: MeasurementRead>(
self,
problem: &ReconstructionProblem<M>,
checkpoint: ReconstructionCheckpoint,
) -> Result<ReconstructionResult>where
Self: Sized,
problem.Auto Trait Implementations§
impl Freeze for Mpie
impl RefUnwindSafe for Mpie
impl Send for Mpie
impl Sync for Mpie
impl Unpin for Mpie
impl UnsafeUnpin for Mpie
impl UnwindSafe for Mpie
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