anscombe_inverse — PHOTON transform op

Datenarten: image2dimage2d

Aufruf: import photoncount; photoncount.anscombe_inverse(values, gain=1.0, read_sigma=0.0, offset=0.0, mode='algebraic') (oder opsphoton.get("anscombe_inverse"))

Verwendung

Invertiert :func:anscombe_transform — algebraisch oder erwartungstreu.

> Die ausführliche Beschreibung unten ist der Originaltext — Zusammenfassung und Überschriften sind übersetzt.

`mode="algebraic"` is the exact algebraic inverse of

:func:anscombe_transform::

x = ((g*A/2)^2 - (3/8)*g^2 - sigma_r^2)/g + offset

so `anscombe_inverse(anscombe_transform(x)) == x` to machine precision

(measured over 100001 values of `x spanning [0, 1e4]`: max absolute

error 2.7e-12, max relative error 3.7e-16 for `x > 1`). It is, however,

biased: `E[A(X)] != A(E[X])`, so applying it to a *denoised* (i.e.

averaged) Anscombe image underestimates the intensity.

`mode="unbiased"` is the closed-form exact unbiased inverse of Makitalo &

Foi (IEEE TIP 2011)::

x = D^2/4 + (1/4)*sqrt(3/2)/D - (11/8)/D^2 + (5/8)*sqrt(3/2)/D^3 - 1/8

which is defined for the classical transform only (`gain=1`,

`read_sigma=0, offset=0`) — passing generalised parameters with this

mode raises rather than returning a formula that does not apply.

Measured bias — apply the inverse to the *ideal denoised* value

`D = E[A(X)], X ~ Poisson(lambda), and compare with lambda`. Both

computed exactly from the Poisson pmf (no sampling):

======== ================== ==================

lambda algebraic bias unbiased bias

======== ================== ==================

1 -0.179361 -0.003668

2 -0.231074 -0.006374

4 -0.249688 +0.003779

10 -0.250227 +0.016904

30 -0.250019 +0.017041

100 -0.250002 +0.011960

======== ================== ==================

The algebraic inverse converges to a constant -1/4 photon offset, which

at 1 photon/pixel is a 18% error; the closed form keeps the worst case to

0.017 photons (a 49x reduction at `lambda = 1`, 15x at its own worst point

near `lambda = 10-30`). It is a closed-form *approximation* of the exact

unbiased inverse, so it is not bias-free — those +0.017 are the honest

residual, not round-off.

The result is clipped at 0 — stated here rather than done quietly — but the

clip essentially never fires: the closed form's positive root is

exactly `A(0) = 2*sqrt(3/8) = 1.2247448714` (measured: the root and

`A(0)` agree to 0.0), which is also the smallest value

:func:anscombe_transform can produce, so over the whole valid domain the

formula is non-negative to round-off (measured minimum -1.11e-16 over

`D in [A(0), 6] on 500001 samples). Below A(0)` it does go

genuinely negative (-0.0217 at `D = 1.20`), which is why values there are

refused outright rather than clipped.

Returns a float64 array of the same shape as *values*.

Raises `ValueError`: non-finite *values*, an unknown *mode*, a

non-positive *gain*, a negative *read_sigma*, `mode="unbiased"` combined

with any non-default generalised parameter, and — instead of dividing by

zero — `mode="unbiased" with any value <= 0 (the 1/D^3` term).

Ausführlicher Anwendungsleitfaden

Leitfaden zur Familie photon_timeresolved

Referenzen (Beispieldaten, Literatur)

• Katalog der Beispieldaten (Download-URLs / Lizenzen) — 2-D nutzt skimage.data (BSD/Public Domain) plus synthetische Bilder, 3-D nennt Download-URLs echter Datenquellen (Stanford, PDS, …).

• Herkunft und Literatur der Operatoren — die Quellen der Forschung/Verfahren, auf denen diese Operatorfamilie beruht.

• Der kanonische Algorithmus (Autor, Jahr) und seine Anwendungen stehen im Familienleitfaden oben.

Ausführbare Beispiele (verifizierte Samples, die diesen Operator wirklich aufrufen)

photon_timeresolvedpy -3.11 examples/photon_timeresolved.py

Typkompatible Folge-Operatoren (nehmen image2d als Eingabe)

photon_sample · photon_statistics · photon_uncertainty · anscombe_transform

Gleiche Kategorie (transform)

anscombe_transform


*Provenance: photoncount.py — PHOTON Operator-Registry. Diese Notiz wird von tools/opdocs.py md erzeugt (nicht von Hand bearbeiten).*

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