tcspc_background_subtract — PHOTON tcspc op

• 数据种类:counts → counts

• 调用: import fullseye as fs; fs.ledger.tcspc_background_subtract(hist, method='median', leading_bins=None, quantile=0.5, scale=1.0)(要直接调用实现,import photoncount; photoncount.tcspc_background_subtract(hist, method='median', leading_bins=None, quantile=0.5, scale=1.0);从台账取用则 opsphoton.get("tcspc_background_subtract"))

用法

从到达时间直方图中去掉环境光 / 暗计数的底噪。

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

Outdoors, most of what a dToF sensor counts is sunlight: a roughly uniform pedestal under the return pulse. It biases the centroid toward the middle of the window (a floor of b per bin pulls the first moment toward window/2) and it inflates the apparent signal, so it is removed before any depth or lifetime estimate.

The level is estimated by *method* and then subtracted (the sign trap:

the result is hist - level, clipped at 0, never hist + level):

• "median" (default) — the median of every bin. Robust while the pulse occupies well under half the window, which is the normal dToF case.

• "leading" — the mean of the first *leading_bins* bins, the classical choice when the pulse is known to arrive late (a far target).

• "trailing" — the mean of the last *leading_bins* bins, for fluorescence decays where the tail is background.

• "quantile" — the given *quantile* of all bins, for tuning by hand.

*leading_bins* defaults to None = min(8, len(hist)), so the default call works on a short histogram instead of raising over a constant nobody chose (a fixed default of 8 made method="leading" fail on any histogram with fewer than 8 bins).

*scale* multiplies the estimated level before subtraction (scale=1.2 for a deliberately aggressive removal). Clipping at 0 means the result is a valid non-negative histogram that the rest of this module will accept.

Ground truth: on a noiseless histogram with a known flat pedestal of 20 counts/bin under a 5000-photon pulse covering 5.1% of the window, the median estimate recovers 20.000000 and the returned histogram equals the pedestal- free pulse exactly (measured area error 0.0, pinned in the tests).

Returns a float64 1-D histogram of the same length as *hist*.

Raises ValueError: negative, non-finite or non-1-D *hist*, an unknown *method*, a *leading_bins* outside [1, len(hist)], a *quantile* outside [0, 1], and a negative *scale*.

详细使用指南

• photon_timeresolved 族使用指南

参考(示例数据、文献)

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

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

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

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

• photon_timeresolved — py -3.11 examples/photon_timeresolved.py

• poc_dtof_ranging — py -3.11 examples/poc_dtof_ranging.py

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

tcspc_coates_correct · tcspc_irf_convolve · tcspc_stats · dtof_depth · lifetime_fit · lifetime_phasor

同类别(tcspc)

tcspc_simulate · tcspc_irf_convolve · tcspc_stats


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

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