Skip to main content

fpm_rs/simulation/
illumination_acquisition_errors.rs

1use serde::{Deserialize, Serialize};
2
3/// Non-geometric illumination errors introduced during acquisition.
4///
5/// Physical source geometry belongs on the concrete illumination source used
6/// to compile the true and reconstruction models.
7#[derive(Clone, Debug, Default, Serialize, Deserialize)]
8pub struct IlluminationAcquisitionErrors {
9    /// Relative one-sigma frame-gain variation.
10    pub frame_gain_relative_std: f64,
11    /// Acquisition-frame indices for which illumination fails.
12    pub missing_frames: Vec<usize>,
13    /// Source index assigned to each compiled source slot.
14    pub source_permutation: Option<Vec<usize>>,
15}
16
17impl IlluminationAcquisitionErrors {
18    /// Creates an acquisition with no gain variation, missing frames, or source permutation.
19    pub fn new() -> Self {
20        Self::default()
21    }
22
23    /// Sets non-negative Gaussian one-sigma gain variation relative to each frame's gain.
24    pub fn frame_gain_relative_std(mut self, relative_standard_deviation: f64) -> Self {
25        self.frame_gain_relative_std = relative_standard_deviation;
26        self
27    }
28
29    /// Sets unique acquisition-frame indices whose simulated illumination is forced to zero.
30    pub fn missing_frames(mut self, indices: Vec<usize>) -> Self {
31        self.missing_frames = indices;
32        self
33    }
34
35    /// Sets a complete permutation assigning a true source to each compiled source slot.
36    pub fn source_permutation(mut self, permutation: Vec<usize>) -> Self {
37        self.source_permutation = Some(permutation);
38        self
39    }
40}