photon_sample — PHOTON counting op

数据种类:image2dimage2d

调用:import photoncount; photoncount.photon_sample(image, photons_per_unit=100.0, dark_rate=0.0, seed=0)(或 opsphoton.get("photon_sample"))

用法

把期望光子数图像做泊松采样,得到实际的光子计数图像。

> 以下的详细说明为原文 —— 摘要与标题已翻译。

*image* is a non-negative 2-D map of scene radiance in arbitrary units;

`lambda = image * photons_per_unit + dark_rate` is the expected number of

photons in each pixel over the exposure, and the result is one Poisson

realisation of it. *dark_rate* is the dark-count contribution (a SPAD counts

thermally generated carriers even in the dark) in the same photon units.

Returns the counts themselves as a float64 `(H, W)` image (integer

valued). That is the deliberate difference from

:func:backends_aug.aug_shot_noise, which returns `Poisson(v*K)/K` clipped

to `[0, 1]` for training-data augmentation: every operator downstream here

(Fano factor, Anscombe, Coates, dToF) needs `N`, and the rescale-and-clip

is not invertible.

`seed` is a required non-negative integer and the RNG is

`numpy.random.default_rng(seed)` — same seed, same frame, on any machine.

Ground truth it reproduces (pinned in `tests/test_photoncount.py`): the

sample mean and sample variance both converge to `lambda`. Measured on a

flat `lambda = 100` field of 512x512 pixels at seed 0 — mean 99.9796,

Fano factor 1.001089, so the photon-limited SNR is `sqrt(lambda)`: 9.9990

predicted from the mean, 9.9935 actually achieved.

Raises `ValueError`: negative or non-finite *image*, negative

*photons_per_unit* / *dark_rate*, a non-integer or negative *seed*, an image

over :data:MAX_IMAGE_ELEMENTS, and — instead of letting numpy fail deep

inside the sampler — any `lambda over :data:MAX_LAMBDA`.

详细使用指南

photon_timeresolved 族使用指南

参考(示例数据・文献)

• 示例数据目录(下载 URL / 许可证) —— 2-D 用 skimage.data(BSD/公有领域)加合成图,3-D 给出真实数据源(Stanford/PDS 等)的下载 URL。

• 算子来历与参考文献 —— 该算子族所依据的研究/方法出处。

• 算法的正典(作者・年份)与用途见上面的族使用指南

可运行的示例(实际调用该算子并已验证的样例)

photon_timeresolvedpy -3.11 examples/photon_timeresolved.py

类型可衔接的下一个算子(可接受 image2d 作为输入)

photon_statistics · photon_uncertainty · anscombe_transform · anscombe_inverse

同类别(counting)

photon_statistics · photon_uncertainty


*Provenance: photoncount.py — PHOTON 算子登记表。本条目由 tools/opdocs.py md 自动生成(请勿手工编辑)。*

© 2026 Kazufumi Furuse — Fullseye operator documentation. Licensed under Apache-2.0.