TDC Renderer
TdcRenderer converts raw time-to-digital-converter tap codes into
calibrated time-of-arrival values. It is the same algorithm used by
LINTag and LINCam Capture; exposed in Python for off-line reprocessing
of raw recordings.
from photonscore import TdcRenderer
r = TdcRenderer(
rnd_seed=42,
seed_data=initial_calibration,
update_period=4096,
number_of_taps=216,
clock_period=2000, # 2 ns in ps
mode="Sum",
)
# Per-chunk rendering — state is preserved across calls
dt = r.render_picosecond_index(raw_chunk)
TdcRenderer
tdc_renderer.TdcRenderer
TDC tap-code renderer.
Construct once with the device's seed calibration and clock period,
then call :meth:render (or :meth:render_picosecond_index) for
each chunk of raw events. The renderer keeps internal state so
successive chunks share the same drifting calibration.
Source code in tdc_renderer.py
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 | |
__init__(rnd_seed, seed_data, update_period, number_of_taps, clock_period, mode='Sum')
Set up the renderer.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
rnd_seed
|
int
|
Seed for the internal pseudo-random generator
(only relevant in |
required |
seed_data
|
ndarray
|
Initial calibration array used to bootstrap the
renderer. Must be at least |
required |
update_period
|
int
|
How many events between successive recalibrations. |
required |
number_of_taps
|
int
|
Number of physical TDC taps on the device. |
required |
clock_period
|
float
|
Period of the TDC reference clock in picoseconds. |
required |
mode
|
str
|
|
'Sum'
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
Source code in tdc_renderer.py
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 | |
render(chunk)
Render chunk of raw tap codes into the renderer's native units.
For "Sum" mode the result is the cumulative tap width in
raw units; for "Rnd" mode it is a dithered picosecond index.
Source code in tdc_renderer.py
78 79 80 81 82 83 84 | |
render_picosecond_index(chunk)
Render chunk directly as picosecond indices.
Available in both modes. In "Sum" mode the picosecond index
is derived from the tap widths and clock_period; in "Rnd"
mode it is the dithered output described above.
Source code in tdc_renderer.py
86 87 88 89 90 91 92 93 | |