pub struct CameraModel {
pub photons_per_pixel: f64,
pub gain_counts_per_electron: f64,
pub offset_counts: f64,
pub read_noise_electrons: f64,
pub dark_current_electrons: f64,
pub shot_noise: bool,
pub pixel_sensitivity: Option<Vec<f64>>,
pub bit_depth: Option<u8>,
pub saturation_counts: Option<f64>,
pub quantize: bool,
pub bad_pixels: Vec<usize>,
pub bad_pixel_value_counts: Option<f64>,
}Expand description
Concrete detector pipeline from optical intensity to digital counts.
Fields§
§photons_per_pixel: f64Expected photoelectrons per pixel at unit optical intensity.
gain_counts_per_electron: f64Linear conversion gain in digital camera counts per collected electron.
offset_counts: f64Additive electronic bias in camera counts.
read_noise_electrons: f64Gaussian read-noise standard deviation in electrons per pixel.
dark_current_electrons: f64Expected dark-current electrons per pixel per simulated exposure.
shot_noise: boolWhether to Poisson-sample photoelectrons and dark current.
pixel_sensitivity: Option<Vec<f64>>Multiplicative detector sensitivity for each pixel.
bit_depth: Option<u8>Optional digitizer bit depth; maximum code is 2^bits - 1 counts.
saturation_counts: Option<f64>Optional upper clipping threshold in camera counts.
quantize: boolWhether to round final camera counts to the nearest integer.
bad_pixels: Vec<usize>Row-major pixel indices replaced after all other detector effects.
bad_pixel_value_counts: Option<f64>Replacement value for Self::bad_pixels, in camera counts.
Implementations§
Source§impl CameraModel
impl CameraModel
Sourcepub fn new() -> Self
pub fn new() -> Self
Creates the default noiseless linear detector with 1000 photons per unit intensity.
Sourcepub fn photons_per_pixel(self, value: f64) -> Self
pub fn photons_per_pixel(self, value: f64) -> Self
Sets the positive expected photoelectrons per pixel at unit optical intensity.
Sourcepub fn gain(self, counts_per_electron: f64) -> Self
pub fn gain(self, counts_per_electron: f64) -> Self
Sets positive linear gain in camera counts per electron.
Sourcepub fn offset_counts(self, value: f64) -> Self
pub fn offset_counts(self, value: f64) -> Self
Sets finite additive camera-count bias.
Sourcepub fn read_noise_electrons(self, value: f64) -> Self
pub fn read_noise_electrons(self, value: f64) -> Self
Sets non-negative Gaussian read-noise standard deviation in electrons.
Sourcepub fn dark_current_electrons(self, value: f64) -> Self
pub fn dark_current_electrons(self, value: f64) -> Self
Sets non-negative expected dark-current electrons per pixel and exposure.
Sourcepub fn shot_noise(self, enabled: bool) -> Self
pub fn shot_noise(self, enabled: bool) -> Self
Enables or disables Poisson sampling of photoelectrons plus dark current.
Sourcepub fn pixel_sensitivity(self, values: Vec<f64>) -> Self
pub fn pixel_sensitivity(self, values: Vec<f64>) -> Self
Sets one finite non-negative sensitivity multiplier per row-major detector pixel.
Sourcepub fn bit_depth(self, bits: u8) -> Self
pub fn bit_depth(self, bits: u8) -> Self
Sets digitizer bit depth in 1..=53, enabling the corresponding maximum code.
Sourcepub fn saturation(self, counts: f64) -> Self
pub fn saturation(self, counts: f64) -> Self
Sets a finite non-negative saturation threshold in camera counts.
Sourcepub fn quantize(self, enabled: bool) -> Self
pub fn quantize(self, enabled: bool) -> Self
Enables or disables rounding final counts to integer-valued f64 values.
Sourcepub fn bad_pixels(self, indices: Vec<usize>, value_counts: f64) -> Self
pub fn bad_pixels(self, indices: Vec<usize>, value_counts: f64) -> Self
Replaces unique row-major detector indices with value_counts after measurement.
Sourcepub fn validate(&self) -> Result<()>
pub fn validate(&self) -> Result<()>
Validates gains, noise parameters, clipping/quantization settings, sensitivities, and uniqueness of bad-pixel indices independently of frame shape.
Sourcepub fn validate_for_frame(&self, frame_len: usize) -> Result<()>
pub fn validate_for_frame(&self, frame_len: usize) -> Result<()>
Additionally checks sensitivity length and bad-pixel bounds for frame_len pixels.
Sourcepub fn measure_frame<R: Rng + ?Sized>(
&self,
intensity: &mut [f64],
rng: &mut R,
) -> Result<()>
pub fn measure_frame<R: Rng + ?Sized>( &self, intensity: &mut [f64], rng: &mut R, ) -> Result<()>
Converts one optical-intensity frame into detector counts in place.
Sourcepub fn compile_reconstruction_model(
&self,
model: ImagePlaneModel,
) -> Result<ImagePlaneModel>
pub fn compile_reconstruction_model( &self, model: ImagePlaneModel, ) -> Result<ImagePlaneModel>
Compiles known uniform linear response into a reconstruction model.
Pixel sensitivity, stochastic noise, clipping, quantization, and bad pixels remain detector effects and are not compiled into the model.
Trait Implementations§
Source§impl Clone for CameraModel
impl Clone for CameraModel
Source§fn clone(&self) -> CameraModel
fn clone(&self) -> CameraModel
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for CameraModel
impl Debug for CameraModel
Source§impl Default for CameraModel
impl Default for CameraModel
Source§impl<'de> Deserialize<'de> for CameraModel
impl<'de> Deserialize<'de> for CameraModel
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 CameraModel
impl RefUnwindSafe for CameraModel
impl Send for CameraModel
impl Sync for CameraModel
impl Unpin for CameraModel
impl UnsafeUnpin for CameraModel
impl UnwindSafe for CameraModel
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