dapkel¶
Data Analysis Package for the Kelpie v2 SPAD camera.
Every analysis here is the same pipeline with a different reduction in the middle:
folder of .bin → discover files → fold frames into a sensor map
→ scale to physical units → save
→ load → plot
The three stages¶
| stage | what it does | on disk |
|---|---|---|
| 0. raw | the camera writes .bin; dapkel decodes it |
*.bin (read-only) |
| 1. process | fold frames into an array, scale to units, save | processed/ |
| 2. plot | load the saved array, render figures | results/<kind>/ |
The rule that keeps this honest: processed/ holds data, results/ holds
pictures, and stage 2 never re-unpacks .bin files. Retrying a colormap costs
a load, not a full re-read of the raw data.
So every analysis module has two public functions:
| call | does | returns |
|---|---|---|
process_<x>(path, nframes, ...) |
unpack the .bin files, reduce, always save to processed/ |
the saved path |
plot_<x>(path, tag, ...) |
load that artifact, write figures to results/<kind>/ |
the data it plotted |
| module | process | plot |
|---|---|---|
data_quality |
process_time_codes |
plot_time_codes |
hitmap_analysis |
process_hitmap |
plot_hitmap |
dcr_analysis |
process_dcr |
plot_dcr |
crosstalk_analysis |
process_crosstalk |
plot_crosstalk |
tdc_calibration |
process_tdc_calibration |
plot_tdc_calibration |
coincidences |
process_coincidences |
plot_coincidences |
Shared code lives in dapkel.core; retired code (the feather
delta-t path, the dense per-clock TDC LUTs, the two-Gaussian fit, ...) is kept,
unmaintained, in the repository's archive/ folder.
Start here¶
On a fresh acquisition, run the data-quality check first. A TDC that never stopped produces data that looks completely normal to every other analysis in this package.
The analyses¶
- Decoding
.binfiles — the shared foundation - Dark count rate — per-pixel DCR maps in cps
- Optical cross-talk — including the clockwise SPAD geometry
- Hitmaps — occupancy and photon rate
- TDC calibration — the code density test
- Coincidences — delta-t and timing jitter
- Background subtraction — measure the
accidental background by shifting frames instead of fitting it
(
subtract_background=Trueincoincidences) - Data quality — check the run before trusting it
Reference¶
- Adding an analysis — the contract for new measurements
- The triangular delta-t background — why a flat fit inflates the jitter
dapkel.core— the shared substrate- Open items — what is known to need deciding, and why it has not been
Plot styling¶
Importing dapkel applies its matplotlib house style through komorebi_mpl,
so plots look consistent out of the box. Your choice always wins:
import dapkel # applies the default style on import
import komorebi_mpl
from dapkel.functions import hitmap_analysis
komorebi_mpl.use("night_wave") # or any registered style, or "default"
hitmap_analysis.plot_hitmap(path) # stage 2: reads the saved map
The plotting functions never touch rcParams themselves, so whatever style is
active when they draw is what you get — set it once, after the imports.
Figure sizing follows one rule: square sensor maps are 16×16 in code
(core.plots.sensor_map does this), everything else takes figure.figsize
from the active style.