Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modified optika.sensors.electrons_measured() to properly account for discretization noise. #113

Merged
merged 1 commit into from
Jan 14, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions optika/sensors/_materials/_materials.py
Original file line number Diff line number Diff line change
Expand Up @@ -741,9 +741,11 @@ def electrons_measured(
photons_absorbed_expected = absorbance * photons.to(u.ph)
photons_absorbed = na.random.poisson(photons_absorbed_expected)
electrons_expected = iqy * photons_absorbed
electrons = na.random.poisson(electrons_expected / fano_noise) * fano_noise
d = (2 / 12) * (u.electron / u.photon) ** 2
f = fano_noise + d * (photons_absorbed - 1 * u.photon) / electrons_expected
electrons = na.random.poisson(electrons_expected / f) * f
e_fractional, e_integral = np.modf(electrons / u.electron)
e_random = na.random.uniform(0, 1, electrons.shape) < e_fractional
e_random = na.random.binomial(1, e_fractional)
electrons_total = e_integral + e_random
result = na.random.binomial(electrons_total.astype(int), cce)
return result * u.electron
Expand Down
Loading