tb_countrate_to_counts — 2D typed op

• Data kinds: counts → counts

• Call: fullseye.apply(img, "tb_countrate_to_counts", a=0.5, b=0.5) (the 2-D model is one image plus two scalar knobs a,b∈[0,1])

tb_countrate_to_counts: input → output

*The figure is the actual output on a synthetic 128×128 input. Left: input, right: output. Point clouds are drawn as a top-down scatter (brightness = z), 1-D series as a line plot, volumes as the maximum-intensity projection along z, videos as the middle frame, complex images as magnitude; return values that are not pictures are shown as the values themselves.*

Sweeping knob a (0.1 / 0.5 / 0.9, the other knob at its default):

▸ tb_countrate_to_counts: knob a sweep (docs site)

*Knob b does not change the output (measured: identical at 0.1 / 0.5 / 0.9).*

Stages (the ops that come before → this op, left to right):

▸ tb_countrate_to_counts: stages (docs site)

On other images (synthetic scene / photo / coins. Top row: inputs, bottom row: their outputs. Knobs at default):

▸ tb_countrate_to_counts: other inputs (docs site)

Usage

Count rate [Hz] -> counts counts. An exit of countrate (reversible).

The units are the whole content of the conversion: [1/s] * [s] = [1]. gate_s is the integration window in seconds, default 1 ms. counts is the type "photon count per time bin", so letting a rate series call itself counts passes silently with the magnitude off by 7 orders (TYPE_CHECKS only checks both as "non-negative 1-D").

A round trip with counts_to_countrate measures max|Δ| = 9.3e-10 (the range is 1e3-1e7 Hz, so that is relative 1e-16 = 1 unit of double-precision rounding. Looking only at the absolute value it looks large, so quantities spanning many orders of magnitude, like rates, are stated relatively).

★Applying it 2 times raises no exception. TYPE_TO_SORT folds countrate into counts, so the output connects straight back to the input. Measured (2026-09-08, 1,200 Hz with a 1 ms gate): 1.2000 counts after 1 pass, 0.0012 counts after 1 more pass —— a 1,000-fold mix-up passes without producing a negative value or a NaN. There is no way to judge "rate or count" from the values alone, so this one case can only be guarded not by a check but by the caller's discipline (write down the path you connected).

Args:

countrate: (N,) non-negative rate [Hz].

gate_s: integration window [s]. > 0.

Returns:

(N,) float64 non-negative counts.

Raises:

ValueError: negative rate / gate_s <= 0 / invalid shape / non-finite.

The reprconv op countrate_to_counts bridged into the 2-D evolution registry. The implementation is the same; only the calling convention is adapted to op(v, a, b). a sweeps gate_s (default 0.001). b is unused.

References (sample data, literature)

• Sample-data catalog (download URLs / licences) — 2-D uses skimage.data (BSD/public domain) plus synthetic images; 3-D lists download URLs for real data sources (Stanford, PDS, …).

• Operator provenance and references — the sources of the research/methods this op family came from.

Try it in Studio

The program below has been verified to run (same input as the figure). In Studio's help this block becomes buttons that load and run it on the spot.

img_to_counts 0.50 0.50
tb_countrate_to_counts 0.50 0.50

▸ Load this pipeline  ·  Load & run

Runnable examples (verified samples that actually call this op)

The examples below call the underlying ledger op countrate_to_counts. This bridge op is the same implementation adapted to the fn(v, a, b) convention, so the behaviour carries over unchanged (only the call form differs).

• representation_roundtrip — py -3.11 examples/representation_roundtrip.py

Ops the type connects to (they accept counts as input)

identity · tb_spad_deadtime_apply · tb_spad_deadtime_correct · tb_tcspc_coates_correct · tb_tcspc_irf_convolve · tb_tcspc_background_subtract · tb_dtof_depth · tb_counts_to_countrate

Same category (typed)

tb_points_to_voxel · tb_estimate_point_normals · tb_iss_keypoints · tb_project_points · tb_render_point_depth · tb_statistical_outlier_removal · tb_radius_outlier_removal · tb_voxel_grid_downsample


*Provenance: ops.py — 2D operator registry. This per-op note is generated by tools/opdocs.py md (do not hand-edit).*

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