lifetime_fit — PHOTON lifetime op

데이터 종류: countstable

호출: import photoncount; photoncount.lifetime_fit(decay, bin_ps=100.0, background=None, min_counts=1.0, start_bin=None)(또는 opsphoton.get("lifetime_fit"))

사용법

TCSPC 감쇠 히스토그램으로부터의 단일 지수 형광 수명.

> 아래 상세 설명은 원문입니다 —— 요약과 제목은 번역되어 있습니다.

Fits `I(t) = A*exp(-t/tau) + b` by a **Poisson-weighted log-linear least

squares**: the background is removed, the logarithm of the remaining counts

is linear in `t with slope -1/tau`, and each bin is weighted by its own

counts because `var(ln N) ~ 1/N` — which is exactly the Poisson error bar

:func:photon_uncertainty reports.

The fit starts at the peak bin by default (or at *start_bin* if given):

the rising edge before the peak is the instrument response convolved with the

decay, not the decay, and including it flattens the log slope and so biases

the lifetime long. Measured on a 2000 ps decay blurred by a 600 ps IRF

(256 bins x 100 ps): starting at the peak (bin 4) gives 2008.0 ps (+0.40%),

forcing `start_bin=0` gives 2100.7 ps (+5.0%) — a 12x worse bias from four

extra bins. Only bins with more than *min_counts* counts after background

removal take part (the

logarithm of 0 is `-inf`, and single-count tail bins carry almost no

information but huge log-scatter).

*background* is the flat pedestal per bin; `None` (default) estimates it as

the median of the last decile of bins, which for a decay is tail. Pass

`0.0` to state that the data are already background free.

Returns a dict: `lifetime_ps · amplitude (the fitted A at t=0`

of the fit window, in counts per bin) · `background` (the level used) ·

`start_bin · n_bins_used · r_squared` (of the weighted log fit).

Ground truth: on a noiseless exponential the recovery is exact —

`lifetime_ps came back as 2000.000000000 ps for tau = 2000 ps` (256

bins x 100 ps), a measured relative error of 0.0, with `r_squared` 1.0.

*That stays true when the histogram is built by integrating the exponential

over each bin* rather than sampling it, because bin integration multiplies

every bin by the same constant and so cannot change the slope.

With Poisson noise the log-linear estimator is biased high, and the size

of the bias is worth knowing: at 20000 total photons, seed 0,

`min_counts=1` gives 2058.8 ps (+2.9%) from 133 bins, and raising

`min_counts` to 10 gives 2047.3 ps (+2.4%) from 94 bins. Averaged over

seeds 0-19 at `min_counts=10` the mean is 2014.3 ps (**+0.72% systematic

bias**) with a 18.2 ps (0.9%) seed-to-seed spread — so seed 0 is a

2-sigma-high draw, and the bias, not the scatter, is the thing to remember.

It comes from `E[ln N] < ln E[N]` in the sparse tail; a full Poisson MLE

would remove it and is not what this op does.

Raises `ValueError`: negative, non-finite or non-1-D *decay*, a

non-positive *bin_ps*, a negative *background* / *min_counts*, a *start_bin*

outside the histogram, fewer than 2 usable bins after the background and

threshold cuts (a straight line needs two points), a degenerate fit (all

usable bins at the same time), and — instead of returning a negative

lifetime — a fitted slope that is zero or positive, i.e. a profile that does

not decay.

자세한 사용 가이드

photon_timeresolved 패밀리 가이드

참고(샘플 데이터·문헌)

• 샘플 데이터 카탈로그(DL URL / 라이선스) —— 2-D 는 skimage.data(BSD/public)+ 합성, 3-D 는 실데이터 소스(Stanford/PDS 등)의 DL URL.

• 연산자의 내력·참고문헌 —— 이 연산자 족의 바탕이 된 연구/기법의 출처.

• 알고리즘의 정전(저자·연도)과 용도는 위의 패밀리 사용 가이드에 적혀 있습니다.

실행 가능한 예제(이 연산자를 실제로 호출하는 검증된 샘플)

photon_timeresolvedpy -3.11 examples/photon_timeresolved.py

타입이 이어지는 다음 연산자(table 를 입력으로 받는 것)

같은 카테고리(lifetime)

lifetime_phasor


*Provenance: photoncount.py — PHOTON 연산자 레지스트리. 이 op 노트는 tools/opdocs.py md 가 자동 생성합니다(직접 편집하지 마세요).*

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