Testing#
Running Tests#
make test # all tests (needs libcfitsio-dev)
make test-cal # calibration tests only (no cfitsio)
make test-zarr # FITS conversion tests only
Test Categories#
Unit Tests (cal-core)#
Pure math functions with known inputs/outputs:
Rayleigh-Jeans correction at various frequencies and temperatures
Gamma computation from synthetic HOT/COLD counts
Receiver temperature Y-factor
Bad channel detection edge cases
Flag bit operations
Atmospheric transmission at known PWV
Dump averaging with NaN padding
Integration Tests (cal-io)#
Test |
Purpose |
Data source |
|---|---|---|
|
Single-pixel HFAV OTF parity |
Pre-converted Zarr v3 |
|
7-dataset multi-mode parity |
Pre-converted Zarr v3 |
|
L0 read → calibrate → L1 write → L1 read |
Synthetic |
|
Generate synthetic L1 for downstream tests |
Synthetic |
|
Parallel Zarr write safety |
Synthetic |
|
Per-pixel vs vectorized path agreement |
Pre-converted Zarr v3 |
|
Export per-channel stats for analysis |
Pre-converted Zarr v3 |
Conversion Tests (zarr-fits-core)#
Filename parsing regex (standard, relative, simple patterns)
FITS value parsing (bool, int, float, string)
Profile auto-detection
Parity Methodology#
The parity tests compare the engine’s output against golden reference CSVs produced by the legacy kalibrate C++/Fortran code. For each dataset:
Load L0 Zarr store (pre-converted from test FITS data)
Calibrate with
KalibrateCompatphysics constantsCompare mean \(T_{rec}\) per pixel against reference CSV
Assert deviation < 1% (acceptance threshold)
The KalibrateCompat physics mode reproduces the exact
h/k = 0.047995 K/GHz constant and f32 truncation behaviour of the
legacy code.
Test Data#
Test data lives in kalibrate_test_lib/ (sibling directory):
data_fits/— 18 original FITS observation filesdata_zarr_v3/— 10 pre-converted Zarr v3 storesreference_data/— 33 golden CSVs + ATM table