Skip to main content

fpm_rs/simulation/
result.rs

1use ndarray::Array2;
2use serde::{Deserialize, Serialize};
3
4use crate::{Complex64, measurements::MeasurementStack, model::ImagePlaneModel};
5
6use super::{CameraModel, IlluminationAcquisitionErrors};
7
8/// Owned simulated measurements with true and assumed models and retained ground truth.
9#[derive(Clone, Debug)]
10pub struct SimulationResult {
11    /// Simulated low-resolution detector intensities or camera counts in frame order.
12    pub measurements: MeasurementStack,
13    /// True high-resolution complex sample field shaped `(height, width)`.
14    pub ground_truth_object: Array2<Complex64>,
15    /// Compiled optical model used to generate measurements.
16    pub true_model: ImagePlaneModel,
17    /// Assumed model supplied to reconstruction, including known linear camera response.
18    pub reconstruction_model: ImagePlaneModel,
19    /// Detector pipeline, or `None` for direct ideal optical intensities.
20    pub camera: Option<CameraModel>,
21    /// Injected non-geometric source errors, or `None` when absent.
22    pub illumination_acquisition_errors: Option<IlluminationAcquisitionErrors>,
23    /// Compact record of the realized simulation dimensions and missing frames.
24    pub parameters: SimulationParameters,
25    /// Seed used to initialize deterministic pseudorandom effects.
26    pub random_seed: u64,
27}
28
29/// Serializable summary of a completed simulated acquisition.
30#[derive(Clone, Debug, Serialize, Deserialize)]
31pub struct SimulationParameters {
32    /// Whether no camera or acquisition-error effects were requested.
33    pub ideal: bool,
34    /// Number of acquisition frames in [`SimulationResult::measurements`].
35    pub frame_count: usize,
36    /// Low-resolution frame shape as `(height, width)`.
37    pub image_shape: (usize, usize),
38    /// Zero-based acquisition-frame indices whose illumination was forced to zero.
39    pub missing_frames: Vec<usize>,
40}