Skip to main content

ForwardModel

Struct ForwardModel 

Source
pub struct ForwardModel<'a> { /* private fields */ }
Expand description

Allocation-friendly CPU implementation of the image-plane FPM forward model.

Implementations§

Source§

impl<'a> ForwardModel<'a>

Source

pub fn new(model: &'a ImagePlaneModel) -> Result<Self>

Source

pub fn with_backend( model: &'a ImagePlaneModel, backend: Arc<dyn Backend>, ) -> Result<Self>

Source

pub fn model(&self) -> &ImagePlaneModel

Source

pub fn workspace(&self) -> ForwardWorkspace

Source

pub fn extract_patch( &self, object_spectrum: &Array2<Complex64>, source: usize, ) -> Result<Array2<Complex64>>

Source

pub fn insert_patch_update( &self, object_spectrum: &mut Array2<Complex64>, source: usize, update: &[Complex64], scale: f64, ) -> Result<()>

Source

pub fn apply_pupil( &self, patch: &[Complex64], pupil: &Pupil, destination: &mut [Complex64], ) -> Result<()>

Source

pub fn forward_source_field( &self, object_spectrum: &Array2<Complex64>, pupil: &Pupil, source: usize, ) -> Result<Array2<Complex64>>

Coherent low-resolution field for one illumination source.

Source

pub fn forward_source_field_into<'b>( &self, object_spectrum: &Array2<Complex64>, pupil: &Pupil, source: usize, workspace: &'b mut ForwardWorkspace, ) -> Result<&'b [Complex64]>

Source

pub fn forward_field( &self, object_spectrum: &Array2<Complex64>, pupil: &Pupil, frame: usize, ) -> Result<Array2<Complex64>>

Coherent field for a non-multiplexed frame. A coded frame with exactly one source is represented by a field scaled by the square-root weight.

Source

pub fn forward_intensity( &self, object_spectrum: &Array2<Complex64>, pupil: &Pupil, frame: usize, ) -> Result<Array2<f64>>

Source

pub fn forward_intensity_into( &self, object_spectrum: &Array2<Complex64>, pupil: &Pupil, frame: usize, workspace: &mut ForwardWorkspace, destination: &mut [f64], ) -> Result<()>

Source

pub fn forward_intensity_stack_into( &self, object_spectrum: &Array2<Complex64>, pupil: &Pupil, destination: &mut [f64], worker_count: usize, ) -> Result<()>

Predicts every measured frame into a contiguous [frame][row][column] destination using independent worker scratch.

Frame order and floating-point results within each frame are unchanged by worker_count. Values larger than the frame count are capped; zero is rejected. A worker count of one executes directly without spawning.

Source

pub fn forward_intensity_stack( &self, object_spectrum: &Array2<Complex64>, pupil: &Pupil, worker_count: usize, ) -> Result<Vec<f64>>

Allocation-owning convenience wrapper for Self::forward_intensity_stack_into.

Source

pub fn residual( &self, object_spectrum: &Array2<Complex64>, pupil: &Pupil, frame: usize, measured: &[f64], ) -> Result<Vec<f64>>

Source

pub fn amplitude_projection( &self, field: &[Complex64], measured_intensity: &[f64], frame: usize, epsilon: f64, ) -> Result<Vec<Complex64>>

Source

pub fn frame_loss( &self, object_spectrum: &Array2<Complex64>, pupil: &Pupil, frame: usize, measured: &[f64], loss_type: LossType, ) -> Result<f64>

Auto Trait Implementations§

§

impl<'a> Freeze for ForwardModel<'a>

§

impl<'a> !RefUnwindSafe for ForwardModel<'a>

§

impl<'a> Send for ForwardModel<'a>

§

impl<'a> Sync for ForwardModel<'a>

§

impl<'a> Unpin for ForwardModel<'a>

§

impl<'a> UnsafeUnpin for ForwardModel<'a>

§

impl<'a> !UnwindSafe for ForwardModel<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,