pub struct SpectralReconstructionCheckpoint { /* private fields */ }Expand description
Validated snapshot of a compiled spectral problem and one solver’s numerical state.
Spectral state stores centered spectra directly. Joint state stores amplitudes, OPD bounds and the fixed gauge, and retains automatic initialization records. Resume checks the exact ordered compiled model and a streaming SHA-256 of detector values, masks and weights. A changed total iteration target is allowed; stepping options and explicitly selected schedules must match. Scientific arrays and objectives resume exactly; elapsed wall times accumulate. The format rejects ordinary checkpoints and other spectral solver kinds.
§Example
use fpm_rs::{Result, algorithms::SpectralAlternatingProjection,
measurements::MeasurementRead, reconstruction::{SpectralRunner,
SpectralReconstructionCheckpoint, SpectralReconstructionProblem,
SpectralReconstructionResult}};
fn resume<M: MeasurementRead>(problem: &SpectralReconstructionProblem<M>,
checkpoint: SpectralReconstructionCheckpoint) -> Result<SpectralReconstructionResult> {
SpectralRunner::new(SpectralAlternatingProjection::default().iterations(50))
.with_checkpoint(checkpoint).run(problem)
}The example requires saved default stepping options and a target of at least the completed pass count. The saved schedule is inherited.
Implementations§
Source§impl SpectralReconstructionCheckpoint
impl SpectralReconstructionCheckpoint
Sourcepub fn format_version(&self) -> u32
pub fn format_version(&self) -> u32
Returns the separately versioned format number.
Sourcepub fn completed_iterations(&self) -> usize
pub fn completed_iterations(&self) -> usize
Returns completed passes or accepted joint updates, including those before resume.
Sourcepub fn algorithm(&self) -> &str
pub fn algorithm(&self) -> &str
Returns the solver name; it determines which resume entry point may consume this snapshot.
Sourcepub fn model(&self) -> &SpectralImagePlaneModel
pub fn model(&self) -> &SpectralImagePlaneModel
Borrows the exact ordered compiled model, including fixed pupils and detector calibration.
Sourcepub fn trace(&self) -> &ReconstructionTrace
pub fn trace(&self) -> &ReconstructionTrace
Borrows the accumulated objective trace; timing includes earlier runs.
Sourcepub fn opd_m(&self) -> Option<ArrayView2<'_, f64>>
pub fn opd_m(&self) -> Option<ArrayView2<'_, f64>>
Borrows the authoritative joint OPD map in metres, or returns None for spectral AP.
Sourcepub fn save(&self, path: impl AsRef<Path>) -> Result<()>
pub fn save(&self, path: impl AsRef<Path>) -> Result<()>
Validates and atomically saves JSON, preserving binary64 values through float-roundtrip parsing. A failed write leaves an existing destination intact.
Sourcepub fn load(path: impl AsRef<Path>) -> Result<Self>
pub fn load(path: impl AsRef<Path>) -> Result<Self>
Loads a spectral checkpoint, rejecting unknown fields, wrong kind/version, and invalid state.
Sourcepub fn load_for_problem<M: MeasurementRead>(
path: impl AsRef<Path>,
problem: &SpectralReconstructionProblem<M>,
) -> Result<Self>
pub fn load_for_problem<M: MeasurementRead>( path: impl AsRef<Path>, problem: &SpectralReconstructionProblem<M>, ) -> Result<Self>
Loads and verifies the model plus a streaming fingerprint of measurements, masks, and weights.
Sourcepub fn validate(&self) -> Result<()>
pub fn validate(&self) -> Result<()>
Checks metadata, array layouts/shapes, finite values, gauge, and contiguous trace numbering.
Sourcepub fn validate_for_problem<M: MeasurementRead>(
&self,
problem: &SpectralReconstructionProblem<M>,
) -> Result<()>
pub fn validate_for_problem<M: MeasurementRead>( &self, problem: &SpectralReconstructionProblem<M>, ) -> Result<()>
Rejects changed ordered kernels, acquisition, detector data, masks, or weights. Fingerprinting streams one detector frame at a time and performs no reconstruction.
Trait Implementations§
Source§impl Clone for SpectralReconstructionCheckpoint
impl Clone for SpectralReconstructionCheckpoint
Source§fn clone(&self) -> SpectralReconstructionCheckpoint
fn clone(&self) -> SpectralReconstructionCheckpoint
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<'de> Deserialize<'de> for SpectralReconstructionCheckpoint
impl<'de> Deserialize<'de> for SpectralReconstructionCheckpoint
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>,
Auto Trait Implementations§
impl Freeze for SpectralReconstructionCheckpoint
impl RefUnwindSafe for SpectralReconstructionCheckpoint
impl Send for SpectralReconstructionCheckpoint
impl Sync for SpectralReconstructionCheckpoint
impl Unpin for SpectralReconstructionCheckpoint
impl UnsafeUnpin for SpectralReconstructionCheckpoint
impl UnwindSafe for SpectralReconstructionCheckpoint
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