countrate_to_counts — REPRCONV algebra op

• 数据种类:countrate → counts

• 调用: import fullseye as fs; fs.ledger.countrate_to_counts(countrate, gate_s=0.001)(要直接调用实现,import reprconv; reprconv.countrate_to_counts(countrate, gate_s=0.001);从台账取用则 opsreprconv.get("countrate_to_counts"))

用法

计数率 [Hz] → 计数 counts。countrate 的出口(可逆)。

单位就是转换的全部内容: [1/s] * [s] = [1]。gate_s 是积分窗口的秒数, 默认 1 ms。counts 是“每个时间 bin 的光子数”的类型,所以若让速率序列直接冒充 counts,会在数量级偏差 7 位的情况下悄悄通过 (TYPE_CHECKS 对两者都只检查“非负的 1-D”)。

与 counts_to_countrate 往返实测 max|Δ| = 9.3e-10(值域为 1e3-1e7 Hz,所以是相对 1e-16 = 双精度舍入 1 个单位。只看绝对值会显得很大,所以像速率这样数量级跨度大的量用相对值来说)。

★用 2 次也不会抛异常。TYPE_TO_SORT 把 countrate 折叠进 counts, 所以出口直接接回入口。实测(2026-09-08,1,200 Hz 以 gate 1 ms): 1 次得 1.2000 counts,再通过 1 次得 0.0012 counts —— 1,000 倍的混淆,既不产生负值也不产生 NaN 就通过了。仅看值无法判定“是速率还是计数”,所以这 1 件只能不靠检查而靠 调用方的纪律来守(把连接的路径记录下来)。

Args:

countrate: (N,) 的非负速率 [Hz]。

gate_s: 积分窗口 [s]。> 0。

Returns:

(N,) float64 的非负计数。

Raises:

ValueError: 负速率 / gate_s <= 0 / 形状不正确 / 非有限。

参考(示例数据、文献)

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

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

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

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

• representation_roundtrip — py -3.11 examples/representation_roundtrip.py

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

counts_to_countrate

同类别(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 算子登记表。本条目由 tools/opdocs.py md 自动生成(请勿手工编辑)。*

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