Skip to main content

SensorNoise

Struct SensorNoise 

Source
pub struct SensorNoise {
    pub shot: bool,
    pub read: f64,
    pub full_well: f64,
    pub bits: u32,
}
Expand description

検出器の雑音と AD 変換(検出器の露光で共通)。値は電子数 [e⁻]

Fields§

§shot: bool

ショット雑音(Poisson)を足す

§read: f64

読み出し雑音 [e⁻ rms]

§full_well: f64

飽和 [e⁻](0 なら飽和しない)。AD 変換の全幅

§bits: u32

AD 変換のビット数(0 なら丸めない)

Implementations§

Source§

impl SensorNoise

Source

pub fn is_quiet(&self) -> bool

何も足さない・丸めない

Source

pub fn check(&self) -> Result<()>

値を確かめる

Source

pub fn expose(&self, mu: f64, rng: &mut Rng) -> f64

1 画素の露光。mu は平均の電子数(背景を含む)。ショット雑音は Poisson(Rng::poisson)、読み出し雑音は 正規分布(どちらも Ziggurat 法の正規乱数、Rng::normal_fast)。bits > 0 なら刻み q = full_well / 2^bits で round(e/q)(四捨五入)を 0〜2^bits − 1 に切って q 倍、 bits = 0 で full_well > 0 なら 0〜full_well に切る。値でない mu はそのまま返す(乱数は使わない)

Source§

impl SensorNoise

Source

pub fn expose_mean_merged( &self, mu: f64, n: usize, rng: &mut Rng, ) -> Option<f64>

同じ平均 mu の画素を n 枚露光した平均を、まとめて 1 回で引く(Self::expose を n 回して平均する代わり)。 ショット雑音の和は Poisson(n·mu)、読み出し雑音の和は分散 n·read² の正規分布で、どちらも厳密。AD の丸めだけは 1 枚ごとの誤差を一様分布(分散 q²/12)とみて和を正規分布で近似する。近似が成り立たない画素(1 枚の雑音の標準偏差が 刻み q より小さい、平均 ± 5σ が 0〜飽和の外に出る)は None(1 枚ずつ露光する)。丸めがあってショット雑音ありで 読み出し雑音が 0.5 e⁻ 未満のときも None: 電子数が整数に近いまま刻み q で丸めると、整数と刻みのうなりで丸めの誤差が 平均 0 にならない(読み出し雑音 0・平均 30 e⁻ で平均が 20 枚平均の σ の 14 % ずれる)。値でない mu はそのまま返す

Trait Implementations§

Source§

impl Clone for SensorNoise

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for SensorNoise

Source§

impl Debug for SensorNoise

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for SensorNoise

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl PartialEq for SensorNoise

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for SensorNoise

Auto Trait Implementations§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts 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
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.