Skip to content

Add photons_absorbed, the inverse of the sensor signal/expose - #191

Merged
roytsmart merged 3 commits into
mainfrom
feature/sensor-photons-absorbed
Jul 23, 2026
Merged

Add photons_absorbed, the inverse of the sensor signal/expose#191
roytsmart merged 3 commits into
mainfrom
feature/sensor-photons-absorbed

Conversation

@roytsmart

Copy link
Copy Markdown
Collaborator

Adds photons_absorbed to the sensor materials and to ImagingSensor, mapping measured electrons back into the number of absorbed photons.

Materials

AbstractSensorMaterial.photons_absorbed(electrons, wavelength, direction=1) inverts the noiseless signal. Because the sensor absorbance is folded into the effective area, signal runs at unit absorbance, so the inverse depends only on the quantum yield and the charge collection efficiency, not the absorbance (it is photons_absorbed, not photons_incident). IdealSensorMaterial and the silicon materials each supply a concrete implementation.

A new test_photons_absorbed checks that it exactly recovers the photons passed through signal at unit absorbance, for both ideal and silicon materials and for normal/oblique incidence.

Sensor

ImagingSensor.photons_absorbed mirrors expose: it inverts the material response and divides by the exposure time, giving the incident photon rate.

Why

This is the detector-response inverse needed to make optika.systems.LinearSystem.image/backproject a matched forward/transpose pair (that wiring lives in the interpolated-system branch, #152).

🤖 Generated with Claude Code

Add `photons_absorbed` to the sensor materials and to `ImagingSensor`,
mapping measured electrons back into the number of absorbed photons.

For the materials this inverts the noiseless `signal` (which uses unit
absorbance, since absorbance is folded into the effective area) and so
depends only on the quantum yield and the charge collection efficiency,
not the absorbance. `IdealSensorMaterial` and the silicon materials each
supply a concrete implementation, and a new `test_photons_absorbed`
checks that it recovers the photons passed through `signal`.

`ImagingSensor.photons_absorbed` mirrors `expose`: it inverts the
material response and divides by the exposure time, giving the incident
photon rate. This provides the detector-response inverse needed to make
`LinearSystem.image`/`backproject` a matched pair.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CtdKmedevWkDab6BWupXqQ
@codecov

codecov Bot commented Jul 23, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.54%. Comparing base (bf75a1f) to head (2fcd39e).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #191   +/-   ##
=======================================
  Coverage   99.54%   99.54%           
=======================================
  Files         116      116           
  Lines        6374     6414   +40     
=======================================
+ Hits         6345     6385   +40     
  Misses         29       29           
Flag Coverage Δ
unittests 99.54% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

roytsmart and others added 2 commits July 23, 2026 08:00
Add a roundtrip test covering `ImagingSensor.photons_absorbed`, which was
otherwise unexercised, restoring patch coverage on the PR.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CtdKmedevWkDab6BWupXqQ
Use the sensor's own exposure time (via `dataclasses.replace`) instead
of passing `timedelta` explicitly, so the default branch of
`ImagingSensor.photons_absorbed` is exercised for patch coverage.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CtdKmedevWkDab6BWupXqQ
@roytsmart
roytsmart merged commit 2b713f6 into main Jul 23, 2026
12 checks passed
@roytsmart
roytsmart deleted the feature/sensor-photons-absorbed branch July 23, 2026 15:59
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