countrate_to_counts — REPRCONV algebra op

• Data kinds: countrate → counts

• Call: import fullseye as fs; fs.ledger.countrate_to_counts(countrate, gate_s=0.001) (to call the implementation directly, import reprconv; reprconv.countrate_to_counts(countrate, gate_s=0.001); from the registry, opsreprconv.get("countrate_to_counts"))

Usage

Count rate [Hz] → counts. The exit from countrate (invertible).

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

Round trip with counts_to_countrate measured max|Δ| = 9.3e-10 (the value range is 1e3-1e7 Hz, so this is relative 1e-16 = 1 unit of double-precision rounding. Looking only at the absolute value it seems large, so quantities spanning many orders of magnitude, like rates, are stated in relative terms).

★Applying it 2 times raises no exception. TYPE_TO_SORT folds countrate into counts, so the exit connects straight back to the entrance. Measured (2026-09-08, 1,200 Hz at gate 1 ms): 1 pass gives 1.2000 counts, 1 more pass gives 0.0012 counts -- a 1,000-fold mix-up passes without producing negative values or NaN. There is no way to tell "rate or count" from the values alone, so this 1 case can be guarded not by a check but only 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 / bad shape / non-finite.

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.

• The canonical algorithm (author, year) and its uses are named in the family usage guide above.

Runnable examples (verified samples that actually call this op)

• representation_roundtrip — py -3.11 examples/representation_roundtrip.py

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

counts_to_countrate

Same category (algebra)

angle_to_matrix · matrix_to_angle · rot_scale_to_matrix · matrix_to_rot_scale · shift_to_vector · vector_to_shift · cscalar_to_polar · polar_to_cscalar


*Provenance: reprconv.py — REPRCONV 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.