Skip to content

Commit

Permalink
Modified opitka.sensors.AbstractImagingSensor.readout() to more gra…
Browse files Browse the repository at this point in the history
…cefully deal with negative photons.
  • Loading branch information
byrdie committed Nov 6, 2024
1 parent f62246d commit 336e999
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions optika/sensors/_sensors.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,11 @@ def readout(

where = where & rays.unvignetted

sgn = np.sign(rays.intensity)

rays = dataclasses.replace(
rays,
intensity=rays.intensity * timedelta,
intensity=np.abs(rays.intensity) * timedelta,
)

normal = self.sag.normal(rays.position)
Expand All @@ -128,6 +130,11 @@ def readout(
normal=normal,
)

rays = dataclasses.replace(
rays,
intensity=sgn * rays.intensity,
)

rays = self.material.charge_diffusion(
rays=rays,
normal=normal,
Expand All @@ -151,7 +158,7 @@ def readout(
wavelength=np.mean(rays.wavelength, axis=axis),
position=hist.inputs,
),
outputs=hist.outputs,
outputs=np.maximum(hist.outputs, 0),
)


Expand Down

0 comments on commit 336e999

Please sign in to comment.