Files
slsDetectorPackage/slsDetectorSoftware/tests/Caller/test-Caller-moench.cpp
Dhanya Thattil ee27f0bc1b readoutspeed in rx master file and other master file inconsistencies (#1245)
readout speed added to json and h5 master files.
Also fixed master file inconsistencies

Sserver binaries
- update server binaries because readoutspeed needs to be sent to receiver with rx_hostname command

API
- added const to Detector class set/getburstmode

Python
- updated python bindings (burstmode const and roi arguments)

Cmd generation
- added pragma once in Caller.in.h as Caller is included in test files

m3: num channels due to #counters < 3
* workaround for m3 for messed up num channels (client always assumes all counters enabled and adds them to num channels), fix for hdf5

g2: exptime master file inconsistency
- exptime didnt match because of round of when setting burst mode (sets to a different clk divider)
- so updating actual time for all timers (exptime, period, subexptime etc, )  in Module class, get timer values from detector when setting it and then send to receiver to write in master file

ctb image size incorrect:
-  write actual size into master file and not the reserved size (digital reduces depending on dbit list and dbit offset)
- added a calculate ctb image size free function in generalData.h that is used there as well as for the tests.


master file inconsistencies
- refactored master attributes writing using templates
-    names changed to keep it consistent between json and hdf5 master file (Version, Pixels, Exposure Times, GateDelays, Acquisition Period, etc.)
-  datatypes changed to keep it simple where possible: imageSize, dynamicRange, tengiga, quad, readnrows, analog, analogsamples, digital, digitalsamples, dbitreorder, dbitoffset, transceivermask, transeiver, transceiversamples, countermask, gates =>int
- replacing "toString" with arrays, objects etc for eg for scan, rois, etc.
- json header always written (empty dataset or empty brackets)
- hdf5 needs const char* so have to convert strings to it, but taking care that strings exist prior to push_back
- master attributes (redundant string literals->error prone

tests for master file
- suppressed deprecated functions in rapidjson warnings just for the tests
- added slsREceiverSoftware/src to allow access to receiver_defs.h to test binary/hdf5 version
- refactored acquire tests by moving all the acquire tests from individual detector type files to a single one=test-Caller-acquire.cpp
- set some default settings (loadBasicSettings) for a basic acquire at load config part for the test_simulator python scripts. so minimum number of settings for detector to be set for any acquire tests.
- added tests to test master files for json and hdf5= test-Caller-master-attributes.cpp
- added option to add '-m' markers for tests using test_simulator python script
2025-07-25 11:45:26 +02:00

106 lines
4.8 KiB
C++

// SPDX-License-Identifier: LGPL-3.0-or-other
// Copyright (C) 2021 Contributors to the SLS Detector Package
#include "Caller.h"
#include "catch.hpp"
#include "sls/Detector.h"
#include "sls/sls_detector_defs.h"
#include <sstream>
#include "sls/versionAPI.h"
#include "test-Caller-global.h"
#include "tests/globals.h"
namespace sls {
using test::GET;
using test::PUT;
/* dacs */
TEST_CASE("Setting and reading back moench dacs", "[.cmdcall][.dacs]") {
// vbp_colbuf, vipre, vin_cm, vb_sda, vcasc_sfp, vout_cm, vipre_cds,
// ibias_sfp
Detector det;
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
if (det_type == defs::MOENCH) {
SECTION("vbp_colbuf") {
test_dac_caller(defs::VBP_COLBUF, "vbp_colbuf", 1300);
}
SECTION("vipre") { test_dac_caller(defs::VIPRE, "vipre", 1000); }
SECTION("vin_cm") { test_dac_caller(defs::VIN_CM, "vin_cm", 1400); }
SECTION("vb_sda") { test_dac_caller(defs::VB_SDA, "vb_sda", 680); }
SECTION("vcasc_sfp") {
test_dac_caller(defs::VCASC_SFP, "vcasc_sfp", 1428);
}
SECTION("vout_cm") { test_dac_caller(defs::VOUT_CM, "vout_cm", 1200); }
SECTION("vipre_cds") {
test_dac_caller(defs::VIPRE_CDS, "vipre_cds", 800);
}
SECTION("ibias_sfp") {
test_dac_caller(defs::IBIAS_SFP, "ibias_sfp", 900);
}
// eiger
REQUIRE_THROWS(caller.call("vthreshold", {}, -1, GET));
REQUIRE_THROWS(caller.call("vsvp", {}, -1, GET));
REQUIRE_THROWS(caller.call("vsvn", {}, -1, GET));
REQUIRE_THROWS(caller.call("vtrim", {}, -1, GET));
REQUIRE_THROWS(caller.call("vrpreamp", {}, -1, GET));
REQUIRE_THROWS(caller.call("vrshaper", {}, -1, GET));
REQUIRE_THROWS(caller.call("vtgstv", {}, -1, GET));
REQUIRE_THROWS(caller.call("vcmp_ll", {}, -1, GET));
REQUIRE_THROWS(caller.call("vcmp_lr", {}, -1, GET));
REQUIRE_THROWS(caller.call("vcal", {}, -1, GET));
REQUIRE_THROWS(caller.call("vcmp_rl", {}, -1, GET));
REQUIRE_THROWS(caller.call("vcmp_rr", {}, -1, GET));
REQUIRE_THROWS(caller.call("rxb_rb", {}, -1, GET));
REQUIRE_THROWS(caller.call("rxb_lb", {}, -1, GET));
REQUIRE_THROWS(caller.call("vcp", {}, -1, GET));
REQUIRE_THROWS(caller.call("vcn", {}, -1, GET));
REQUIRE_THROWS(caller.call("vishaper", {}, -1, GET));
REQUIRE_THROWS(caller.call("iodelay", {}, -1, GET));
// mythen3
REQUIRE_THROWS(caller.call("vrpreamp", {}, -1, GET));
REQUIRE_THROWS(caller.call("vrshaper", {}, -1, GET));
REQUIRE_THROWS(caller.call("vrshaper_n", {}, -1, GET));
// REQUIRE_THROWS(caller.call("vipre", {}, -1, GET));
REQUIRE_THROWS(caller.call("vishaper", {}, -1, GET));
REQUIRE_THROWS(caller.call("vdcsh", {}, -1, GET));
REQUIRE_THROWS(caller.call("vth1", {}, -1, GET));
REQUIRE_THROWS(caller.call("vth2", {}, -1, GET));
REQUIRE_THROWS(caller.call("vth3", {}, -1, GET));
REQUIRE_THROWS(caller.call("vcal_n", {}, -1, GET));
REQUIRE_THROWS(caller.call("vcal_p", {}, -1, GET));
REQUIRE_THROWS(caller.call("vtrim", {}, -1, GET));
REQUIRE_THROWS(caller.call("vcassh", {}, -1, GET));
REQUIRE_THROWS(caller.call("vcas", {}, -1, GET));
REQUIRE_THROWS(caller.call("vicin", {}, -1, GET));
REQUIRE_THROWS(caller.call("vipre_out", {}, -1, GET));
// gotthard2
REQUIRE_THROWS(caller.call("vref_h_adc", {}, -1, GET));
REQUIRE_THROWS(caller.call("vb_comp_fe", {}, -1, GET));
REQUIRE_THROWS(caller.call("vb_comp_adc", {}, -1, GET));
REQUIRE_THROWS(caller.call("vcom_cds", {}, -1, GET));
REQUIRE_THROWS(caller.call("vref_rstore", {}, -1, GET));
REQUIRE_THROWS(caller.call("vb_opa_1st", {}, -1, GET));
REQUIRE_THROWS(caller.call("vref_comp_fe", {}, -1, GET));
REQUIRE_THROWS(caller.call("vcom_adc1", {}, -1, GET));
REQUIRE_THROWS(caller.call("vref_l_adc", {}, -1, GET));
REQUIRE_THROWS(caller.call("vref_cds", {}, -1, GET));
REQUIRE_THROWS(caller.call("vb_cs", {}, -1, GET));
REQUIRE_THROWS(caller.call("vb_opa_fd", {}, -1, GET));
REQUIRE_THROWS(caller.call("vcom_adc2", {}, -1, GET));
// jungfrau
REQUIRE_THROWS(caller.call("vb_comp", {}, -1, GET));
REQUIRE_THROWS(caller.call("vdd_prot", {}, -1, GET));
REQUIRE_THROWS(caller.call("vin_com", {}, -1, GET));
REQUIRE_THROWS(caller.call("vref_prech", {}, -1, GET));
REQUIRE_THROWS(caller.call("vb_pixbuf", {}, -1, GET));
REQUIRE_THROWS(caller.call("vb_ds", {}, -1, GET));
REQUIRE_THROWS(caller.call("vref_ds", {}, -1, GET));
REQUIRE_THROWS(caller.call("vref_comp", {}, -1, GET));
}
}
} // namespace sls