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 |
|
Multi-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 |
|
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.
External Parity Suite#
A separate external parity suite lives in calibrate_parity_tests/
(sibling directory). It covers 21 datasets across TP, OTF, chopped,
beam-switch, gain interpolation, and multi-frontend modes. Current
status: 16 PASS, 0 FAIL with T_sys deviations between 0.4% and 2.7%.
The workspace contains 168 unit/integration tests total
(cargo test --workspace).
Test Data#
Test data lives in kalibrate_test_lib/ (sibling directory):
data_fits/– 28 original FITS observation filesdata_zarr_v3/– pre-converted Zarr v3 storesreference_data/– 33 golden CSVs + ATM table