Skip to content
Snippets Groups Projects

Revised CalCat API

Merged Thomas Kluyver requested to merge calcat-api-2 into master
Compare and Show latest version
1 file
+ 21
6
Compare changes
  • Side-by-side
  • Inline
@@ -72,6 +72,22 @@ def test_DSSC_modules_missing():
assert dssc_cd.module_nums == modnos
assert dssc_cd.qm_names == [f"Q{(m // 4) + 1}M{(m % 4) + 1}" for m in modnos]
offset = dssc_cd["Offset"]
assert offset.module_nums == modnos
# test ModulesConstantVersions.select_modules()
modnos_q3 = list(range(8, 12))
aggs_q3 = [f"DSSC{m:02}" for m in modnos_q3]
qm_q3 = [f"Q3M{i}" for i in range(1, 5)]
assert offset.select_modules(modnos_q3).module_nums == modnos_q3
assert offset.select_modules(aggregators=aggs_q3).module_nums == modnos_q3
assert offset.select_modules(qm_names=qm_q3).module_nums == modnos_q3
# test CalibrationData.select_modules()
assert dssc_cd.select_modules(modnos_q3).module_nums == modnos_q3
assert dssc_cd.select_modules(aggregators=aggs_q3).module_nums == modnos_q3
assert dssc_cd.select_modules(qm_names=qm_q3).module_nums == modnos_q3
@pytest.mark.requires_gpfs
def test_LPD_constant_missing():
@@ -82,13 +98,12 @@ def test_LPD_constant_missing():
)
# Constants are missing for 1 module (LPD05), but it was still included in
# the PDUs for the detector, so it should still appear in the lists.
modnos = range(16)
assert lpd_cd.aggregator_names == [f"LPD{m:02}" for m in modnos]
assert lpd_cd.module_nums == modnos
assert lpd_cd.qm_names == [f"Q{(m // 4) + 1}M{(m % 4) + 1}" for m in modnos]
assert lpd_cd.aggregator_names == [f"LPD{m:02}" for m in range(16)]
assert lpd_cd.module_nums == list(range(16))
assert lpd_cd.qm_names == [f"Q{(m // 4) + 1}M{(m % 4) + 1}" for m in range(16)]
assert len(lpd_cd["Offset"].module_nums) == 16
assert len(lpd_cd["Offset"].constants) == 15
# When we look at a specific constant, module LPD05 is missing
assert lpd_cd["Offset"].module_nums == list(range(0, 5)) + list(range(6, 16))
@pytest.mark.xfail
Loading