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

fix: restrict intensity to positive values after read-noise application #93

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

federico-carrara
Copy link
Contributor

@federico-carrara federico-carrara commented Feb 5, 2025

Description

This PR proposes a one-line change in quantize_electrons() method of _Camera.
Specifically, it restricts the output to only contain positive values. Negative values can be introduced by the random sampling from the Gaussian distribution simulating the read-out noise.

Motivation

  • A negative value of intensity is not physically realistic.
  • In the step after, array is casted to uint. Hence, all negative values are mapped to large numbers in the uint range (e.g., -1 --> 65534, etc., etc.). As a result, in the casted image we see some extremely bright dots in correspondence of what were the negative values before casting.

Copy link

codecov bot commented Feb 5, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 84.79%. Comparing base (729dcfe) to head (e3669df).

Additional details and impacted files
@@           Coverage Diff           @@
##             main      #93   +/-   ##
=======================================
  Coverage   84.79%   84.79%           
=======================================
  Files          47       47           
  Lines        3156     3156           
=======================================
  Hits         2676     2676           
  Misses        480      480           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant