mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-06 18:10:40 +02:00
WIP
This commit is contained in:
parent
f07e722d26
commit
4053594c4d
BIN
settingsdir/eiger/standard/4500eV/noise.sn000
Executable file
BIN
settingsdir/eiger/standard/4500eV/noise.sn000
Executable file
Binary file not shown.
@ -96,6 +96,8 @@ uint64_t eiger_virtual_startingframenumber = 1;
|
|||||||
int eiger_virtual_detPos[2] = {0, 0};
|
int eiger_virtual_detPos[2] = {0, 0};
|
||||||
int eiger_virtual_test_mode = 0;
|
int eiger_virtual_test_mode = 0;
|
||||||
int eiger_virtual_quad_mode = 0;
|
int eiger_virtual_quad_mode = 0;
|
||||||
|
int eiger_virtual_read_nlines = 256;
|
||||||
|
int eiger_virtual_interrupt_subframe = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int isInitCheckDone() { return initCheckDone; }
|
int isInitCheckDone() { return initCheckDone; }
|
||||||
@ -1516,13 +1518,15 @@ int setInterruptSubframe(int value) {
|
|||||||
if (!Feb_Control_SetInterruptSubframe(value)) {
|
if (!Feb_Control_SetInterruptSubframe(value)) {
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
eiger_virtual_interrupt_subframe = value;
|
||||||
#endif
|
#endif
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
int getInterruptSubframe() {
|
int getInterruptSubframe() {
|
||||||
#ifdef VIRTUAL
|
#ifdef VIRTUAL
|
||||||
return 0;
|
return eiger_virtual_interrupt_subframe;
|
||||||
#else
|
#else
|
||||||
return Feb_Control_GetInterruptSubframe();
|
return Feb_Control_GetInterruptSubframe();
|
||||||
#endif
|
#endif
|
||||||
@ -1536,13 +1540,15 @@ int setReadNLines(int value) {
|
|||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
Beb_SetReadNLines(value);
|
Beb_SetReadNLines(value);
|
||||||
|
#else
|
||||||
|
eiger_virtual_read_nlines = value;
|
||||||
#endif
|
#endif
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
int getReadNLines() {
|
int getReadNLines() {
|
||||||
#ifdef VIRTUAL
|
#ifdef VIRTUAL
|
||||||
return 0;
|
return eiger_virtual_read_nlines;
|
||||||
#else
|
#else
|
||||||
return Feb_Control_GetReadNLines();
|
return Feb_Control_GetReadNLines();
|
||||||
#endif
|
#endif
|
||||||
@ -1835,6 +1841,7 @@ void setExternalGating(int enable[]) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int setAllTrimbits(int val) {
|
int setAllTrimbits(int val) {
|
||||||
|
LOG(logINFO, ("Setting all trimbits to %d\n", val));
|
||||||
#ifndef VIRTUAL
|
#ifndef VIRTUAL
|
||||||
if (!Feb_Control_SaveAllTrimbitsTo(val, top)) {
|
if (!Feb_Control_SaveAllTrimbitsTo(val, top)) {
|
||||||
LOG(logERROR, ("Could not set all trimbits\n"));
|
LOG(logERROR, ("Could not set all trimbits\n"));
|
||||||
|
@ -4775,7 +4775,7 @@ int set_read_n_lines(int file_des) {
|
|||||||
} else {
|
} else {
|
||||||
if (setReadNLines(arg) == FAIL) {
|
if (setReadNLines(arg) == FAIL) {
|
||||||
ret = FAIL;
|
ret = FAIL;
|
||||||
sprintf(mess, "Could not set read n lines.\n");
|
sprintf(mess, "Could not set read n lines to %d.\n", arg);
|
||||||
LOG(logERROR, (mess));
|
LOG(logERROR, (mess));
|
||||||
} else {
|
} else {
|
||||||
int retval = getReadNLines();
|
int retval = getReadNLines();
|
||||||
|
@ -117,6 +117,16 @@ class Detector {
|
|||||||
/**[Eiger][Mythen3] */
|
/**[Eiger][Mythen3] */
|
||||||
void setAllTrimbits(int value, Positions pos = {});
|
void setAllTrimbits(int value, Positions pos = {});
|
||||||
|
|
||||||
|
/**[Eiger][Jungfrau] */
|
||||||
|
bool getGapPixelsinCallback() const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* [Eiger][Jungfrau]
|
||||||
|
* Only in client data call back
|
||||||
|
* Fills in gap pixels in data
|
||||||
|
*/
|
||||||
|
void setGapPixelsinCallback(const bool enable);
|
||||||
|
|
||||||
/**************************************************
|
/**************************************************
|
||||||
* *
|
* *
|
||||||
* Callbacks *
|
* Callbacks *
|
||||||
@ -146,16 +156,6 @@ class Detector {
|
|||||||
void *),
|
void *),
|
||||||
void *pArg);
|
void *pArg);
|
||||||
|
|
||||||
/**[Eiger][Jungfrau] */
|
|
||||||
bool getGapPixelsinCallback() const;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* [Eiger][Jungfrau]
|
|
||||||
* Only in client data call back
|
|
||||||
* Fills in gap pixels in data
|
|
||||||
*/
|
|
||||||
void setGapPixelsinCallback(const bool enable);
|
|
||||||
|
|
||||||
/**************************************************
|
/**************************************************
|
||||||
* *
|
* *
|
||||||
* Acquisition Parameters *
|
* Acquisition Parameters *
|
||||||
|
@ -331,6 +331,37 @@ std::string CmdProxy::DetectorSize(int action) {
|
|||||||
return os.str();
|
return os.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string CmdProxy::GapPixels(int action) {
|
||||||
|
std::ostringstream os;
|
||||||
|
os << cmd << ' ';
|
||||||
|
if (action == defs::HELP_ACTION) {
|
||||||
|
os << "[0, 1]\n\t[Eiger][Jungfrau] Include Gap pixels only in data "
|
||||||
|
"call back."
|
||||||
|
<< '\n';
|
||||||
|
} else if (action == defs::GET_ACTION) {
|
||||||
|
if (det_id != -1) {
|
||||||
|
throw sls::RuntimeError("Cannot get gap pixels at module level");
|
||||||
|
}
|
||||||
|
if (!args.empty()) {
|
||||||
|
WrongNumberOfParameters(0);
|
||||||
|
}
|
||||||
|
auto t = det->getGapPixelsinCallback();
|
||||||
|
os << t << '\n';
|
||||||
|
} else if (action == defs::PUT_ACTION) {
|
||||||
|
if (det_id != -1) {
|
||||||
|
throw sls::RuntimeError("Cannot add gap pixels at module level");
|
||||||
|
}
|
||||||
|
if (args.size() != 1) {
|
||||||
|
WrongNumberOfParameters(1);
|
||||||
|
}
|
||||||
|
det->setGapPixelsinCallback(StringTo<int>(args[0]));
|
||||||
|
os << args.front() << '\n';
|
||||||
|
} else {
|
||||||
|
throw sls::RuntimeError("Unknown action");
|
||||||
|
}
|
||||||
|
return os.str();
|
||||||
|
}
|
||||||
|
|
||||||
/* acquisition parameters */
|
/* acquisition parameters */
|
||||||
|
|
||||||
std::string CmdProxy::Exptime(int action) {
|
std::string CmdProxy::Exptime(int action) {
|
||||||
@ -1224,37 +1255,6 @@ std::string CmdProxy::ThresholdNoTb(int action) {
|
|||||||
return os.str();
|
return os.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string CmdProxy::GapPixels(int action) {
|
|
||||||
std::ostringstream os;
|
|
||||||
os << cmd << ' ';
|
|
||||||
if (action == defs::HELP_ACTION) {
|
|
||||||
os << "[0, 1]\n\t[Eiger][Jungfrau] Include Gap pixels only in data "
|
|
||||||
"call back."
|
|
||||||
<< '\n';
|
|
||||||
} else if (action == defs::GET_ACTION) {
|
|
||||||
if (det_id != -1) {
|
|
||||||
throw sls::RuntimeError("Cannot get gap pixels at module level");
|
|
||||||
}
|
|
||||||
if (!args.empty()) {
|
|
||||||
WrongNumberOfParameters(0);
|
|
||||||
}
|
|
||||||
auto t = det->getGapPixelsinCallback();
|
|
||||||
os << t << '\n';
|
|
||||||
} else if (action == defs::PUT_ACTION) {
|
|
||||||
if (det_id != -1) {
|
|
||||||
throw sls::RuntimeError("Cannot add gap pixels at module level");
|
|
||||||
}
|
|
||||||
if (args.size() != 1) {
|
|
||||||
WrongNumberOfParameters(1);
|
|
||||||
}
|
|
||||||
det->setGapPixelsinCallback(StringTo<int>(args[0]));
|
|
||||||
os << args.front() << '\n';
|
|
||||||
} else {
|
|
||||||
throw sls::RuntimeError("Unknown action");
|
|
||||||
}
|
|
||||||
return os.str();
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string CmdProxy::TrimEnergies(int action) {
|
std::string CmdProxy::TrimEnergies(int action) {
|
||||||
std::ostringstream os;
|
std::ostringstream os;
|
||||||
os << cmd << ' ';
|
os << cmd << ' ';
|
||||||
@ -1271,13 +1271,11 @@ std::string CmdProxy::TrimEnergies(int action) {
|
|||||||
auto t = det->getTrimEnergies({det_id});
|
auto t = det->getTrimEnergies({det_id});
|
||||||
os << OutString(t) << '\n';
|
os << OutString(t) << '\n';
|
||||||
} else if (action == defs::PUT_ACTION) {
|
} else if (action == defs::PUT_ACTION) {
|
||||||
if (args.empty()) {
|
|
||||||
WrongNumberOfParameters(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
std::vector<int> t(args.size());
|
std::vector<int> t(args.size());
|
||||||
for (size_t i = 0; i < t.size(); ++i) {
|
if (!args.empty()) {
|
||||||
t[i] = StringTo<int>(args[i]);
|
for (size_t i = 0; i < t.size(); ++i) {
|
||||||
|
t[i] = StringTo<int>(args[i]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
det->setTrimEnergies(t, {det_id});
|
det->setTrimEnergies(t, {det_id});
|
||||||
os << sls::ToString(args) << '\n';
|
os << sls::ToString(args) << '\n';
|
||||||
|
@ -565,6 +565,7 @@ class CmdProxy {
|
|||||||
{"settings", &CmdProxy::settings},
|
{"settings", &CmdProxy::settings},
|
||||||
{"trimbits", &CmdProxy::trimbits},
|
{"trimbits", &CmdProxy::trimbits},
|
||||||
{"trimval", &CmdProxy::trimval},
|
{"trimval", &CmdProxy::trimval},
|
||||||
|
{"gappixels", &CmdProxy::GapPixels},
|
||||||
|
|
||||||
/* acquisition parameters */
|
/* acquisition parameters */
|
||||||
{"acquire", &CmdProxy::acquire},
|
{"acquire", &CmdProxy::acquire},
|
||||||
@ -754,7 +755,6 @@ class CmdProxy {
|
|||||||
{"threshold", &CmdProxy::Threshold},
|
{"threshold", &CmdProxy::Threshold},
|
||||||
{"thresholdnotb", &CmdProxy::ThresholdNoTb},
|
{"thresholdnotb", &CmdProxy::ThresholdNoTb},
|
||||||
{"settingspath", &CmdProxy::settingspath},
|
{"settingspath", &CmdProxy::settingspath},
|
||||||
{"gappixels", &CmdProxy::GapPixels},
|
|
||||||
{"parallel", &CmdProxy::parallel},
|
{"parallel", &CmdProxy::parallel},
|
||||||
{"overflow", &CmdProxy::overflow},
|
{"overflow", &CmdProxy::overflow},
|
||||||
{"storeinram", &CmdProxy::storeinram},
|
{"storeinram", &CmdProxy::storeinram},
|
||||||
@ -923,6 +923,7 @@ class CmdProxy {
|
|||||||
std::string PackageVersion(int action);
|
std::string PackageVersion(int action);
|
||||||
std::string ClientVersion(int action);
|
std::string ClientVersion(int action);
|
||||||
std::string DetectorSize(int action);
|
std::string DetectorSize(int action);
|
||||||
|
std::string GapPixels(int action);
|
||||||
/* acquisition parameters */
|
/* acquisition parameters */
|
||||||
std::string acquire(int action);
|
std::string acquire(int action);
|
||||||
std::string Exptime(int action);
|
std::string Exptime(int action);
|
||||||
@ -954,7 +955,6 @@ class CmdProxy {
|
|||||||
std::string DynamicRange(int action);
|
std::string DynamicRange(int action);
|
||||||
std::string Threshold(int action);
|
std::string Threshold(int action);
|
||||||
std::string ThresholdNoTb(int action);
|
std::string ThresholdNoTb(int action);
|
||||||
std::string GapPixels(int action);
|
|
||||||
std::string TrimEnergies(int action);
|
std::string TrimEnergies(int action);
|
||||||
std::string RateCorrection(int action);
|
std::string RateCorrection(int action);
|
||||||
std::string Activate(int action);
|
std::string Activate(int action);
|
||||||
|
@ -161,6 +161,14 @@ void Detector::setAllTrimbits(int value, Positions pos) {
|
|||||||
pimpl->Parallel(&Module::setAllTrimbits, pos, value);
|
pimpl->Parallel(&Module::setAllTrimbits, pos, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Detector::getGapPixelsinCallback() const {
|
||||||
|
return pimpl->getGapPixelsinCallback();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Detector::setGapPixelsinCallback(bool enable) {
|
||||||
|
pimpl->setGapPixelsinCallback(enable);
|
||||||
|
}
|
||||||
|
|
||||||
// Callback
|
// Callback
|
||||||
|
|
||||||
void Detector::registerAcquisitionFinishedCallback(void (*func)(double, int,
|
void Detector::registerAcquisitionFinishedCallback(void (*func)(double, int,
|
||||||
@ -175,14 +183,6 @@ void Detector::registerDataCallback(void (*func)(detectorData *, uint64_t,
|
|||||||
pimpl->registerDataCallback(func, pArg);
|
pimpl->registerDataCallback(func, pArg);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Detector::getGapPixelsinCallback() const {
|
|
||||||
return pimpl->getGapPixelsinCallback();
|
|
||||||
}
|
|
||||||
|
|
||||||
void Detector::setGapPixelsinCallback(bool enable) {
|
|
||||||
pimpl->setGapPixelsinCallback(enable);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Acquisition Parameters
|
// Acquisition Parameters
|
||||||
|
|
||||||
Result<int64_t> Detector::getNumberOfFrames(Positions pos) const {
|
Result<int64_t> Detector::getNumberOfFrames(Positions pos) const {
|
||||||
|
@ -315,7 +315,7 @@ TEST_CASE("txndelay_right", "[.cmd][.new]") {
|
|||||||
|
|
||||||
/* Eiger Specific */
|
/* Eiger Specific */
|
||||||
|
|
||||||
TEST_CASE("dr", "[.cmd]") {
|
TEST_CASE("dr", "[.cmd][.new]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
CmdProxy proxy(&det);
|
CmdProxy proxy(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
@ -347,124 +347,7 @@ TEST_CASE("dr", "[.cmd]") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("interruptsubframe", "[.cmd][!mayfail]") {
|
TEST_CASE("subexptime", "[.cmd][.new]") {
|
||||||
// TODO! Fix this for virtual server
|
|
||||||
Detector det;
|
|
||||||
CmdProxy proxy(&det);
|
|
||||||
auto det_type = det.getDetectorType().squash();
|
|
||||||
if (det_type == defs::EIGER) {
|
|
||||||
auto previous = det.getInterruptSubframe();
|
|
||||||
|
|
||||||
std::ostringstream oss1, oss2, oss3;
|
|
||||||
proxy.Call("interruptsubframe", {"1"}, -1, PUT, oss1);
|
|
||||||
REQUIRE(oss1.str() == "interruptsubframe 1\n");
|
|
||||||
proxy.Call("interruptsubframe", {}, -1, GET, oss2);
|
|
||||||
REQUIRE(oss2.str() == "interruptsubframe 1\n");
|
|
||||||
proxy.Call("interruptsubframe", {"0"}, -1, PUT, oss3);
|
|
||||||
REQUIRE(oss3.str() == "interruptsubframe 0\n");
|
|
||||||
for (int i = 0; i != det.size(); ++i) {
|
|
||||||
det.setInterruptSubframe(previous[i], {i});
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
|
||||||
REQUIRE_THROWS(proxy.Call("interruptsubframe", {}, -1, GET));
|
|
||||||
REQUIRE_THROWS(proxy.Call("interruptsubframe", {"1"}, -1, PUT));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_CASE("overflow", "[.cmd]") {
|
|
||||||
Detector det;
|
|
||||||
CmdProxy proxy(&det);
|
|
||||||
auto det_type = det.getDetectorType().squash();
|
|
||||||
if (det_type == defs::EIGER) {
|
|
||||||
auto previous = det.getOverFlowMode();
|
|
||||||
|
|
||||||
std::ostringstream oss1, oss2, oss3;
|
|
||||||
proxy.Call("overflow", {"1"}, -1, PUT, oss1);
|
|
||||||
REQUIRE(oss1.str() == "overflow 1\n");
|
|
||||||
proxy.Call("overflow", {}, -1, GET, oss2);
|
|
||||||
REQUIRE(oss2.str() == "overflow 1\n");
|
|
||||||
proxy.Call("overflow", {"0"}, -1, PUT, oss3);
|
|
||||||
REQUIRE(oss3.str() == "overflow 0\n");
|
|
||||||
for (int i = 0; i != det.size(); ++i) {
|
|
||||||
det.setOverFlowMode(previous[i], {i});
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
|
||||||
REQUIRE_THROWS(proxy.Call("overflow", {}, -1, GET));
|
|
||||||
REQUIRE_THROWS(proxy.Call("overflow", {"1"}, -1, PUT));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_CASE("trimen", "[.cmd][.this]") {
|
|
||||||
// TODO! Also Mythen?
|
|
||||||
Detector det;
|
|
||||||
CmdProxy proxy(&det);
|
|
||||||
auto det_type = det.getDetectorType().squash();
|
|
||||||
if (det_type == defs::EIGER) {
|
|
||||||
|
|
||||||
auto previous = det.getTrimEnergies();
|
|
||||||
std::ostringstream oss1, oss2;
|
|
||||||
proxy.Call("trimen", {"4500", "5400", "6400"}, -1, PUT, oss1);
|
|
||||||
REQUIRE(oss1.str() == "trimen [4500, 5400, 6400]\n");
|
|
||||||
proxy.Call("trimen", {}, -1, GET, oss2);
|
|
||||||
REQUIRE(oss2.str() == "trimen [4500, 5400, 6400]\n");
|
|
||||||
|
|
||||||
for (int i = 0; i != det.size(); ++i) {
|
|
||||||
det.setTrimEnergies(previous[i], {i});
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
REQUIRE_THROWS(proxy.Call("trimen", {"4500", "5400", "6400"}, -1, PUT));
|
|
||||||
REQUIRE_THROWS(proxy.Call("trimen", {}, -1, GET));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// TEST_CASE("threshold"{
|
|
||||||
|
|
||||||
// })
|
|
||||||
|
|
||||||
// TEST_CASE("activate", "[.cmd][.eiger]") {
|
|
||||||
// if (test::type == slsDetectorDefs::EIGER) {
|
|
||||||
// {
|
|
||||||
// std::ostringstream oss;
|
|
||||||
// REQUIRE_NOTHROW(multiSlsDetectorClient("0:activate 1", PUT,
|
|
||||||
// nullptr, oss)); REQUIRE(oss.str() == "activate 1\n");
|
|
||||||
// }
|
|
||||||
// {
|
|
||||||
// std::ostringstream oss;
|
|
||||||
// REQUIRE_NOTHROW(multiSlsDetectorClient("0:activate 1 nopadding",
|
|
||||||
// PUT, nullptr, oss)); REQUIRE(oss.str() == "activate 1
|
|
||||||
// nopadding\n");
|
|
||||||
// }
|
|
||||||
// {
|
|
||||||
// std::ostringstream oss;
|
|
||||||
// REQUIRE_NOTHROW(multiSlsDetectorClient("0:activate 0 padding",
|
|
||||||
// PUT, nullptr, oss)); REQUIRE(oss.str() == "activate 0
|
|
||||||
// padding\n");
|
|
||||||
// }
|
|
||||||
// {
|
|
||||||
// std::ostringstream oss;
|
|
||||||
// REQUIRE_NOTHROW(multiSlsDetectorClient("0:activate 0 nopadding",
|
|
||||||
// PUT, nullptr, oss)); REQUIRE(oss.str() == "activate 0
|
|
||||||
// nopadding\n");
|
|
||||||
// }
|
|
||||||
// {
|
|
||||||
// std::ostringstream oss;
|
|
||||||
// REQUIRE_NOTHROW(multiSlsDetectorClient("0:activate 1 padding",
|
|
||||||
// PUT, nullptr, oss)); REQUIRE(oss.str() == "activate 1
|
|
||||||
// padding\n");
|
|
||||||
// }
|
|
||||||
// {
|
|
||||||
// std::ostringstream oss;
|
|
||||||
// REQUIRE_NOTHROW(multiSlsDetectorClient("0:activate", GET,
|
|
||||||
// nullptr, oss)); REQUIRE(oss.str() == "activate 1 padding\n");
|
|
||||||
// }
|
|
||||||
// } else {
|
|
||||||
// REQUIRE_THROWS(multiSlsDetectorClient("activate", GET));
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
TEST_CASE("subexptime", "[.cmd]") {
|
|
||||||
Detector det;
|
Detector det;
|
||||||
CmdProxy proxy(&det);
|
CmdProxy proxy(&det);
|
||||||
|
|
||||||
@ -485,7 +368,7 @@ TEST_CASE("subexptime", "[.cmd]") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("subdeadtime", "[.cmd]") {
|
TEST_CASE("subdeadtime", "[.cmd][.new]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
CmdProxy proxy(&det);
|
CmdProxy proxy(&det);
|
||||||
|
|
||||||
@ -506,37 +389,468 @@ TEST_CASE("subdeadtime", "[.cmd]") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("tengiga", "[.cmd]") {
|
TEST_CASE("threshold", "[.cmd][.new]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
CmdProxy proxy(&det);
|
CmdProxy proxy(&det);
|
||||||
|
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
if (det_type == defs::EIGER || det_type == defs::CHIPTESTBOARD) {
|
if (det_type == defs::EIGER) {
|
||||||
auto tengiga = det.getTenGiga();
|
auto prev_threshold = det.getThresholdEnergy();
|
||||||
det.setTenGiga(false);
|
auto prev_energies =
|
||||||
|
det.getTrimEnergies().tsquash("inconsistent trim energies to test");
|
||||||
std::ostringstream oss1, oss2;
|
if (prev_energies.size() != 0) {
|
||||||
proxy.Call("tengiga", {"1"}, -1, PUT, oss1);
|
std::ostringstream oss1, oss2;
|
||||||
REQUIRE(oss1.str() == "tengiga 1\n");
|
proxy.Call("threshold", {"4500", "standard"}, -1, PUT, oss1);
|
||||||
proxy.Call("tengiga", {}, -1, GET, oss2);
|
REQUIRE(oss1.str() == "threshold [4500, standard]\n");
|
||||||
REQUIRE(oss2.str() == "tengiga 1\n");
|
proxy.Call("threshold", {}, -1, GET, oss2);
|
||||||
|
REQUIRE(oss2.str() == "threshold 4500\n");
|
||||||
for (int i = 0; i != det.size(); ++i) {
|
det.setTrimEnergies(prev_energies);
|
||||||
det.setTenGiga(tengiga[i], {i});
|
for (int i = 0; i != det.size(); ++i) {
|
||||||
|
if (prev_threshold[i] >= 0) {
|
||||||
|
det.setThresholdEnergy(prev_threshold[i], defs::STANDARD,
|
||||||
|
true, {i});
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
REQUIRE_NOTHROW(proxy.Call("threshold", {}, -1, GET));
|
||||||
|
} else {
|
||||||
|
REQUIRE_THROWS(proxy.Call("threshold", {}, -1, GET));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("quad", "[.cmd]") {
|
TEST_CASE("thresholdnotb", "[.cmd][.new]") {
|
||||||
// TODO! set and get once available in virtual detector
|
Detector det;
|
||||||
|
CmdProxy proxy(&det);
|
||||||
|
|
||||||
|
auto det_type = det.getDetectorType().squash();
|
||||||
|
if (det_type == defs::EIGER) {
|
||||||
|
auto prev_threshold = det.getThresholdEnergy();
|
||||||
|
auto prev_energies =
|
||||||
|
det.getTrimEnergies().tsquash("inconsistent trim energies to test");
|
||||||
|
if (prev_energies.size() != 0) {
|
||||||
|
std::ostringstream oss1, oss2;
|
||||||
|
proxy.Call("thresholdnotb", {"4500 standard"}, -1, PUT, oss1);
|
||||||
|
REQUIRE(oss1.str() == "thresholdnotb [4500 standard]\n");
|
||||||
|
proxy.Call("threshold", {}, -1, GET, oss2);
|
||||||
|
REQUIRE(oss2.str() == "threshold 4500\n");
|
||||||
|
det.setTrimEnergies(prev_energies);
|
||||||
|
for (int i = 0; i != det.size(); ++i) {
|
||||||
|
if (prev_threshold[i] >= 0) {
|
||||||
|
det.setThresholdEnergy(prev_threshold[i], defs::STANDARD,
|
||||||
|
false, {i});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
REQUIRE_NOTHROW(proxy.Call("threshold", {}, -1, GET));
|
||||||
|
} else {
|
||||||
|
REQUIRE_THROWS(proxy.Call("thresholdnotb", {}, -1, GET));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_CASE("settingspath", "[.cmd][.new]") {
|
||||||
|
Detector det;
|
||||||
|
CmdProxy proxy(&det);
|
||||||
|
auto prev_val = det.getSettingsPath();
|
||||||
|
{
|
||||||
|
std::ostringstream oss1, oss2;
|
||||||
|
proxy.Call("settingspath", {"/tmp"}, -1, PUT, oss1);
|
||||||
|
REQUIRE(oss1.str() == "settingspath /tmp\n");
|
||||||
|
proxy.Call("settingspath", {}, -1, GET, oss2);
|
||||||
|
REQUIRE(oss2.str() == "settingspath /tmp\n");
|
||||||
|
}
|
||||||
|
for (int i = 0; i != det.size(); ++i) {
|
||||||
|
det.setSettingsPath(prev_val[i], {i});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_CASE("parallel", "[.cmd][.new]") {
|
||||||
|
Detector det;
|
||||||
|
CmdProxy proxy(&det);
|
||||||
|
auto det_type = det.getDetectorType().squash();
|
||||||
|
|
||||||
|
if (det_type == defs::EIGER) {
|
||||||
|
auto prev_val = det.getParallelMode();
|
||||||
|
{
|
||||||
|
std::ostringstream oss;
|
||||||
|
proxy.Call("parallel", {"1"}, -1, PUT, oss);
|
||||||
|
REQUIRE(oss.str() == "parallel 1\n");
|
||||||
|
}
|
||||||
|
{
|
||||||
|
std::ostringstream oss;
|
||||||
|
proxy.Call("parallel", {"0"}, -1, PUT, oss);
|
||||||
|
REQUIRE(oss.str() == "parallel 0\n");
|
||||||
|
}
|
||||||
|
{
|
||||||
|
std::ostringstream oss;
|
||||||
|
proxy.Call("parallel", {}, -1, GET, oss);
|
||||||
|
REQUIRE(oss.str() == "parallel 0\n");
|
||||||
|
}
|
||||||
|
for (int i = 0; i != det.size(); ++i) {
|
||||||
|
det.setParallelMode(prev_val[i], {i});
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
REQUIRE_THROWS(proxy.Call("parallel", {}, -1, GET));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_CASE("overflow", "[.cmd][.new]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
CmdProxy proxy(&det);
|
CmdProxy proxy(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
if (det_type == defs::EIGER) {
|
if (det_type == defs::EIGER) {
|
||||||
|
auto previous = det.getOverFlowMode();
|
||||||
|
std::ostringstream oss1, oss2, oss3;
|
||||||
|
proxy.Call("overflow", {"1"}, -1, PUT, oss1);
|
||||||
|
REQUIRE(oss1.str() == "overflow 1\n");
|
||||||
|
proxy.Call("overflow", {}, -1, GET, oss2);
|
||||||
|
REQUIRE(oss2.str() == "overflow 1\n");
|
||||||
|
proxy.Call("overflow", {"0"}, -1, PUT, oss3);
|
||||||
|
REQUIRE(oss3.str() == "overflow 0\n");
|
||||||
|
for (int i = 0; i != det.size(); ++i) {
|
||||||
|
det.setOverFlowMode(previous[i], {i});
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
REQUIRE_THROWS(proxy.Call("overflow", {}, -1, GET));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_CASE("storeinram", "[.cmd][.new]") {
|
||||||
|
Detector det;
|
||||||
|
CmdProxy proxy(&det);
|
||||||
|
auto det_type = det.getDetectorType().squash();
|
||||||
|
if (det_type == defs::EIGER) {
|
||||||
|
auto previous = det.getStoreInRamMode();
|
||||||
|
std::ostringstream oss1, oss2, oss3;
|
||||||
|
proxy.Call("storeinram", {"1"}, -1, PUT, oss1);
|
||||||
|
REQUIRE(oss1.str() == "storeinram 1\n");
|
||||||
|
proxy.Call("storeinram", {}, -1, GET, oss2);
|
||||||
|
REQUIRE(oss2.str() == "storeinram 1\n");
|
||||||
|
proxy.Call("storeinram", {"0"}, -1, PUT, oss3);
|
||||||
|
REQUIRE(oss3.str() == "storeinram 0\n");
|
||||||
|
for (int i = 0; i != det.size(); ++i) {
|
||||||
|
det.setStoreInRamMode(previous[i], {i});
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
REQUIRE_THROWS(proxy.Call("storeinram", {}, -1, GET));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_CASE("flippeddatax", "[.cmd][.new]") {
|
||||||
|
Detector det;
|
||||||
|
CmdProxy proxy(&det);
|
||||||
|
auto det_type = det.getDetectorType().squash();
|
||||||
|
if (det_type == defs::EIGER) {
|
||||||
|
auto previous = det.getBottom();
|
||||||
|
std::ostringstream oss1, oss2, oss3;
|
||||||
|
proxy.Call("flippeddatax", {"1"}, -1, PUT, oss1);
|
||||||
|
REQUIRE(oss1.str() == "flippeddatax 1\n");
|
||||||
|
proxy.Call("flippeddatax", {}, -1, GET, oss2);
|
||||||
|
REQUIRE(oss2.str() == "flippeddatax 1\n");
|
||||||
|
proxy.Call("flippeddatax", {"0"}, -1, PUT, oss3);
|
||||||
|
REQUIRE(oss3.str() == "flippeddatax 0\n");
|
||||||
|
for (int i = 0; i != det.size(); ++i) {
|
||||||
|
det.setBottom(previous[i], {i});
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
REQUIRE_THROWS(proxy.Call("flippeddatax", {}, -1, GET));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_CASE("trimen", "[.cmd][.this][.new]") {
|
||||||
|
Detector det;
|
||||||
|
CmdProxy proxy(&det);
|
||||||
|
auto det_type = det.getDetectorType().squash();
|
||||||
|
if (det_type == defs::EIGER) {
|
||||||
|
auto previous = det.getTrimEnergies();
|
||||||
|
std::ostringstream oss1, oss2;
|
||||||
|
proxy.Call("trimen", {"4500", "5400", "6400"}, -1, PUT, oss1);
|
||||||
|
REQUIRE(oss1.str() == "trimen [4500, 5400, 6400]\n");
|
||||||
|
proxy.Call("trimen", {}, -1, GET, oss2);
|
||||||
|
REQUIRE(oss2.str() == "trimen [4500, 5400, 6400]\n");
|
||||||
|
|
||||||
|
for (int i = 0; i != det.size(); ++i) {
|
||||||
|
det.setTrimEnergies(previous[i], {i});
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
REQUIRE_THROWS(proxy.Call("trimen", {"4500", "5400", "6400"}, -1, PUT));
|
||||||
|
REQUIRE_THROWS(proxy.Call("trimen", {}, -1, GET));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_CASE("ratecorr", "[.cmd][.new]") {
|
||||||
|
Detector det;
|
||||||
|
CmdProxy proxy(&det);
|
||||||
|
auto det_type = det.getDetectorType().squash();
|
||||||
|
if (det_type == defs::EIGER) {
|
||||||
|
auto prev_dr = det.getDynamicRange().tsquash("inconsistent dr to test");
|
||||||
|
auto prev_tau = det.getRateCorrection();
|
||||||
|
det.setDynamicRange(16);
|
||||||
|
{
|
||||||
|
std::ostringstream oss;
|
||||||
|
proxy.Call("ratecorr", {"120"}, -1, PUT, oss);
|
||||||
|
REQUIRE(oss.str() == "ratecorr 120ns\n");
|
||||||
|
}
|
||||||
|
{
|
||||||
|
std::ostringstream oss;
|
||||||
|
proxy.Call("ratecorr", {}, -1, GET, oss);
|
||||||
|
REQUIRE(oss.str() == "ratecorr 120ns\n");
|
||||||
|
}
|
||||||
|
// may fail if default settings not loaded
|
||||||
|
// REQUIRE_NOTHROW(proxy.Call("ratecorr", {"-1"}, -1, PUT));
|
||||||
|
{
|
||||||
|
std::ostringstream oss;
|
||||||
|
proxy.Call("ratecorr", {"0"}, -1, PUT, oss);
|
||||||
|
REQUIRE(oss.str() == "ratecorr 0ns\n");
|
||||||
|
}
|
||||||
|
for (int i = 0; i != det.size(); ++i) {
|
||||||
|
det.setRateCorrection(prev_tau[i], {i});
|
||||||
|
}
|
||||||
|
det.setDynamicRange(prev_dr);
|
||||||
|
} else {
|
||||||
|
REQUIRE_THROWS(proxy.Call("ratecorr", {}, -1, GET));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_CASE("readnlines", "[.cmd][.new]") {
|
||||||
|
Detector det;
|
||||||
|
CmdProxy proxy(&det);
|
||||||
|
auto det_type = det.getDetectorType().squash();
|
||||||
|
if (det_type == defs::EIGER) {
|
||||||
|
auto prev_val = det.getPartialReadout();
|
||||||
|
{
|
||||||
|
std::ostringstream oss;
|
||||||
|
proxy.Call("readnlines", {"256"}, -1, PUT, oss);
|
||||||
|
REQUIRE(oss.str() == "readnlines 256\n");
|
||||||
|
}
|
||||||
|
{
|
||||||
|
std::ostringstream oss;
|
||||||
|
proxy.Call("readnlines", {}, -1, GET, oss);
|
||||||
|
REQUIRE(oss.str() == "readnlines 256\n");
|
||||||
|
}
|
||||||
|
{
|
||||||
|
std::ostringstream oss;
|
||||||
|
proxy.Call("readnlines", {"16"}, -1, PUT, oss);
|
||||||
|
REQUIRE(oss.str() == "readnlines 16\n");
|
||||||
|
}
|
||||||
|
REQUIRE_THROWS(proxy.Call("readnlines", {"0"}, -1, PUT));
|
||||||
|
for (int i = 0; i != det.size(); ++i) {
|
||||||
|
det.setPartialReadout(prev_val[i], {i});
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
REQUIRE_THROWS(proxy.Call("readnlines", {}, -1, GET));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_CASE("interruptsubframe", "[.cmd][.new]") {
|
||||||
|
Detector det;
|
||||||
|
CmdProxy proxy(&det);
|
||||||
|
auto det_type = det.getDetectorType().squash();
|
||||||
|
if (det_type == defs::EIGER) {
|
||||||
|
auto prev_val = det.getInterruptSubframe();
|
||||||
|
|
||||||
|
std::ostringstream oss1, oss2, oss3;
|
||||||
|
proxy.Call("interruptsubframe", {"1"}, -1, PUT, oss1);
|
||||||
|
REQUIRE(oss1.str() == "interruptsubframe 1\n");
|
||||||
|
proxy.Call("interruptsubframe", {}, -1, GET, oss2);
|
||||||
|
REQUIRE(oss2.str() == "interruptsubframe 1\n");
|
||||||
|
proxy.Call("interruptsubframe", {"0"}, -1, PUT, oss3);
|
||||||
|
REQUIRE(oss3.str() == "interruptsubframe 0\n");
|
||||||
|
for (int i = 0; i != det.size(); ++i) {
|
||||||
|
det.setInterruptSubframe(prev_val[i], {i});
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
REQUIRE_THROWS(proxy.Call("interruptsubframe", {}, -1, GET));
|
||||||
|
REQUIRE_THROWS(proxy.Call("interruptsubframe", {"1"}, -1, PUT));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_CASE("measuredperiod", "[.cmd][.new]") {
|
||||||
|
Detector det;
|
||||||
|
CmdProxy proxy(&det);
|
||||||
|
auto det_type = det.getDetectorType().squash();
|
||||||
|
if (det_type == defs::EIGER) {
|
||||||
|
auto prev_frames = det.getNumberOfFrames().tsquash(
|
||||||
|
"inconsistent number of frames to test");
|
||||||
|
auto prev_timing =
|
||||||
|
det.getTimingMode().tsquash("inconsistent timing mode to test");
|
||||||
|
auto prev_period = det.getPeriod();
|
||||||
|
det.setNumberOfFrames(2);
|
||||||
|
det.setPeriod(std::chrono::seconds(1));
|
||||||
|
det.setTimingMode(defs::AUTO_TIMING);
|
||||||
|
det.startDetector();
|
||||||
|
std::this_thread::sleep_for(std::chrono::seconds(3));
|
||||||
|
std::ostringstream oss;
|
||||||
|
proxy.Call("measuredperiod", {}, -1, GET, oss);
|
||||||
|
std::string st = oss.str();
|
||||||
|
std::string s = st.erase(0, strlen("measuredperiod "));
|
||||||
|
double val = std::stod(s);
|
||||||
|
// REQUIRE(val >= 1.0);
|
||||||
|
REQUIRE(val < 2.0);
|
||||||
|
for (int i = 0; i != det.size(); ++i) {
|
||||||
|
det.setPeriod(prev_period[i], {i});
|
||||||
|
}
|
||||||
|
det.setNumberOfFrames(prev_frames);
|
||||||
|
det.setTimingMode(prev_timing);
|
||||||
|
} else {
|
||||||
|
REQUIRE_THROWS(proxy.Call("measuredperiod", {}, -1, GET));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_CASE("measuredsubperiod", "[.cmd][.new]") {
|
||||||
|
Detector det;
|
||||||
|
CmdProxy proxy(&det);
|
||||||
|
auto det_type = det.getDetectorType().squash();
|
||||||
|
if (det_type == defs::EIGER) {
|
||||||
|
auto prev_frames = det.getNumberOfFrames().tsquash(
|
||||||
|
"inconsistent number of frames to test");
|
||||||
|
auto prev_timing =
|
||||||
|
det.getTimingMode().tsquash("inconsistent timing mode to test");
|
||||||
|
auto prev_period = det.getPeriod();
|
||||||
|
auto prev_dr = det.getDynamicRange().tsquash("inconsistent dr to test");
|
||||||
|
det.setNumberOfFrames(1);
|
||||||
|
det.setPeriod(std::chrono::seconds(1));
|
||||||
|
det.setTimingMode(defs::AUTO_TIMING);
|
||||||
|
det.setDynamicRange(32);
|
||||||
|
det.startDetector();
|
||||||
|
std::this_thread::sleep_for(std::chrono::seconds(3));
|
||||||
|
std::ostringstream oss;
|
||||||
|
proxy.Call("measuredsubperiod", {}, -1, GET, oss);
|
||||||
|
std::string st = oss.str();
|
||||||
|
std::string s = st.erase(0, strlen("measuredsubperiod "));
|
||||||
|
double val = std::stod(s);
|
||||||
|
REQUIRE(val >= 0);
|
||||||
|
REQUIRE(val < 1000);
|
||||||
|
for (int i = 0; i != det.size(); ++i) {
|
||||||
|
det.setPeriod(prev_period[i], {i});
|
||||||
|
}
|
||||||
|
det.setNumberOfFrames(prev_frames);
|
||||||
|
det.setTimingMode(prev_timing);
|
||||||
|
det.setDynamicRange(prev_dr);
|
||||||
|
} else {
|
||||||
|
REQUIRE_THROWS(proxy.Call("measuredsubperiod", {}, -1, GET));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_CASE("activate", "[.cmd][.new]") {
|
||||||
|
Detector det;
|
||||||
|
CmdProxy proxy(&det);
|
||||||
|
auto det_type = det.getDetectorType().squash();
|
||||||
|
if (det_type == defs::EIGER) {
|
||||||
|
auto prev_val = det.getActive();
|
||||||
|
{
|
||||||
|
std::ostringstream oss;
|
||||||
|
proxy.Call("activate", {"1"}, -1, PUT, oss);
|
||||||
|
REQUIRE(oss.str() == "activate 1\n");
|
||||||
|
}
|
||||||
|
{
|
||||||
|
std::ostringstream oss;
|
||||||
|
proxy.Call("activate", {"1", "nopadding"}, -1, PUT, oss);
|
||||||
|
REQUIRE(oss.str() == "activate 1 nopadding\n");
|
||||||
|
}
|
||||||
|
{
|
||||||
|
std::ostringstream oss;
|
||||||
|
proxy.Call("activate", {"0", "padding"}, -1, PUT, oss);
|
||||||
|
REQUIRE(oss.str() == "activate 0 padding\n");
|
||||||
|
}
|
||||||
|
{
|
||||||
|
std::ostringstream oss;
|
||||||
|
proxy.Call("activate", {"0", "nopadding"}, -1, PUT, oss);
|
||||||
|
REQUIRE(oss.str() == "activate 0 nopadding\n");
|
||||||
|
}
|
||||||
|
{
|
||||||
|
std::ostringstream oss;
|
||||||
|
proxy.Call("activate", {"1", "padding"}, -1, PUT, oss);
|
||||||
|
REQUIRE(oss.str() == "activate 1 padding\n");
|
||||||
|
}
|
||||||
|
for (int i = 0; i != det.size(); ++i) {
|
||||||
|
det.setActive(prev_val[i], {i});
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
REQUIRE_THROWS(proxy.Call("activate", {}, -1, GET));
|
||||||
|
REQUIRE_THROWS(proxy.Call("activate", {"1"}, -1, PUT));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_CASE("partialreset", "[.cmd][.new]") {
|
||||||
|
Detector det;
|
||||||
|
CmdProxy proxy(&det);
|
||||||
|
auto det_type = det.getDetectorType().squash();
|
||||||
|
if (det_type == defs::EIGER) {
|
||||||
|
auto prev_val = det.getPartialReset();
|
||||||
|
std::ostringstream oss1, oss2, oss3;
|
||||||
|
proxy.Call("partialreset", {"1"}, -1, PUT, oss1);
|
||||||
|
REQUIRE(oss1.str() == "partialreset 1\n");
|
||||||
|
proxy.Call("partialreset", {}, -1, GET, oss2);
|
||||||
|
REQUIRE(oss2.str() == "partialreset 1\n");
|
||||||
|
proxy.Call("partialreset", {"0"}, -1, PUT, oss3);
|
||||||
|
REQUIRE(oss3.str() == "partialreset 0\n");
|
||||||
|
for (int i = 0; i != det.size(); ++i) {
|
||||||
|
det.setPartialReset(prev_val[i], {i});
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
REQUIRE_THROWS(proxy.Call("partialreset", {}, -1, GET));
|
||||||
|
REQUIRE_THROWS(proxy.Call("partialreset", {"1"}, -1, PUT));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_CASE("pulse", "[.cmd][.new]") {
|
||||||
|
Detector det;
|
||||||
|
CmdProxy proxy(&det);
|
||||||
|
auto det_type = det.getDetectorType().squash();
|
||||||
|
if (det_type == defs::EIGER) {
|
||||||
|
REQUIRE_THROWS(proxy.Call("pulse", {}, -1, GET));
|
||||||
|
std::ostringstream oss;
|
||||||
|
proxy.Call("pulse", {"1", "1", "5"}, -1, PUT, oss);
|
||||||
|
REQUIRE(oss.str() == "pulse [1, 1, 5]\n");
|
||||||
|
} else {
|
||||||
|
REQUIRE_THROWS(proxy.Call("pulse", {}, -1, GET));
|
||||||
|
REQUIRE_THROWS(proxy.Call("pulse", {"1", "1", "5"}, -1, PUT));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_CASE("pulsenmove", "[.cmd][.new]") {
|
||||||
|
Detector det;
|
||||||
|
CmdProxy proxy(&det);
|
||||||
|
auto det_type = det.getDetectorType().squash();
|
||||||
|
if (det_type == defs::EIGER) {
|
||||||
|
REQUIRE_THROWS(proxy.Call("pulsenmove", {}, -1, GET));
|
||||||
|
std::ostringstream oss;
|
||||||
|
proxy.Call("pulsenmove", {"1", "1", "5"}, -1, PUT, oss);
|
||||||
|
REQUIRE(oss.str() == "pulsenmove [1, 1, 5]\n");
|
||||||
|
} else {
|
||||||
|
REQUIRE_THROWS(proxy.Call("pulsenmove", {}, -1, GET));
|
||||||
|
REQUIRE_THROWS(proxy.Call("pulsenmove", {"1", "1", "5"}, -1, PUT));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_CASE("pulsechip", "[.cmd][.new]") {
|
||||||
|
Detector det;
|
||||||
|
CmdProxy proxy(&det);
|
||||||
|
auto det_type = det.getDetectorType().squash();
|
||||||
|
if (det_type == defs::EIGER) {
|
||||||
|
REQUIRE_THROWS(proxy.Call("pulsechip", {}, -1, GET));
|
||||||
|
std::ostringstream oss;
|
||||||
|
proxy.Call("pulsechip", {"1"}, -1, PUT, oss);
|
||||||
|
REQUIRE(oss.str() == "pulsechip 1\n");
|
||||||
|
} else {
|
||||||
|
REQUIRE_THROWS(proxy.Call("pulsechip", {}, -1, GET));
|
||||||
|
REQUIRE_THROWS(proxy.Call("pulsechip", {"1"}, -1, PUT));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_CASE("quad", "[.cmd]") {
|
||||||
|
Detector det;
|
||||||
|
CmdProxy proxy(&det);
|
||||||
|
auto det_type = det.getDetectorType().squash();
|
||||||
|
if (det_type == defs::EIGER) {
|
||||||
|
auto prev_val = det.getQuad().tsquash("inconsistent quad to test");
|
||||||
// Quad only works with a single half module EIGER
|
// Quad only works with a single half module EIGER
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("quad", {}, -1, GET, oss);
|
proxy.Call("quad", {}, -1, GET, oss);
|
||||||
REQUIRE(oss.str() == "quad 0\n");
|
REQUIRE(oss.str() == "quad 0\n");
|
||||||
|
det.setQuad(prev_val);
|
||||||
} else {
|
} else {
|
||||||
REQUIRE_THROWS(proxy.Call("quad", {}, -1, GET));
|
REQUIRE_THROWS(proxy.Call("quad", {}, -1, GET));
|
||||||
}
|
}
|
||||||
|
@ -125,114 +125,217 @@ TEST_CASE("selinterface", "[.cmd][.new]") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("nframes", "[.cmd]") {
|
/* Jungfrau Specific */
|
||||||
|
|
||||||
|
TEST_CASE("temp_threshold", "[.cmd][.new]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
CmdProxy proxy(&det);
|
CmdProxy proxy(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
if (det_type == defs::JUNGFRAU || det_type == defs::CHIPTESTBOARD) {
|
if (det_type == defs::JUNGFRAU) {
|
||||||
auto nframes = det.getNumberOfFramesFromStart().squash();
|
auto prev_val = det.getThresholdTemperature();
|
||||||
std::ostringstream oss;
|
{
|
||||||
proxy.Call("nframes", {}, -1, GET, oss);
|
std::ostringstream oss;
|
||||||
REQUIRE(oss.str() == "nframes " + std::to_string(nframes) + "\n");
|
proxy.Call("temp_threshold", {"65"}, -1, PUT, oss);
|
||||||
|
REQUIRE(oss.str() == "temp_threshold 65\n");
|
||||||
|
}
|
||||||
|
{
|
||||||
|
std::ostringstream oss;
|
||||||
|
proxy.Call("temp_threshold", {"70"}, -1, PUT, oss);
|
||||||
|
REQUIRE(oss.str() == "temp_threshold 70\n");
|
||||||
|
}
|
||||||
|
{
|
||||||
|
std::ostringstream oss;
|
||||||
|
proxy.Call("temp_threshold", {}, -1, GET, oss);
|
||||||
|
REQUIRE(oss.str() == "temp_threshold 70\n");
|
||||||
|
}
|
||||||
|
for (int i = 0; i != det.size(); ++i) {
|
||||||
|
det.setThresholdTemperature(prev_val[i], {i});
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
REQUIRE_THROWS(proxy.Call("nframes", {}, -1, GET));
|
REQUIRE_THROWS(proxy.Call("temp_threshold", {}, -1, GET));
|
||||||
|
REQUIRE_THROWS(proxy.Call("temp_threshold", {"70"}, -1, PUT));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("now", "[.cmd]") {
|
TEST_CASE("temp_control", "[.cmd][.new]") {
|
||||||
// TODO! can we test this?
|
|
||||||
Detector det;
|
Detector det;
|
||||||
CmdProxy proxy(&det);
|
CmdProxy proxy(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
if (det_type == defs::JUNGFRAU || det_type == defs::CHIPTESTBOARD) {
|
if (det_type == defs::JUNGFRAU) {
|
||||||
std::ostringstream oss;
|
auto prev_val = det.getTemperatureControl();
|
||||||
proxy.Call("now", {}, -1, GET, oss);
|
{
|
||||||
|
std::ostringstream oss;
|
||||||
// Get only
|
proxy.Call("temp_control", {"0"}, -1, PUT, oss);
|
||||||
REQUIRE_THROWS(proxy.Call("now", {"2019"}, -1, PUT));
|
REQUIRE(oss.str() == "temp_control 0\n");
|
||||||
|
}
|
||||||
|
{
|
||||||
|
std::ostringstream oss;
|
||||||
|
proxy.Call("temp_control", {"1"}, -1, PUT, oss);
|
||||||
|
REQUIRE(oss.str() == "temp_control 1\n");
|
||||||
|
}
|
||||||
|
{
|
||||||
|
std::ostringstream oss;
|
||||||
|
proxy.Call("temp_control", {}, -1, GET, oss);
|
||||||
|
REQUIRE(oss.str() == "temp_control 1\n");
|
||||||
|
}
|
||||||
|
for (int i = 0; i != det.size(); ++i) {
|
||||||
|
det.setTemperatureControl(prev_val[i], {i});
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
REQUIRE_THROWS(proxy.Call("now", {}, -1, GET));
|
REQUIRE_THROWS(proxy.Call("temp_control", {}, -1, GET));
|
||||||
|
REQUIRE_THROWS(proxy.Call("temp_control", {"0"}, -1, PUT));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("timestamp", "[.cmd]") {
|
TEST_CASE("temp_event", "[.cmd][.new]") {
|
||||||
// TODO! can we test this?
|
|
||||||
Detector det;
|
Detector det;
|
||||||
CmdProxy proxy(&det);
|
CmdProxy proxy(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
if (det_type == defs::JUNGFRAU || det_type == defs::CHIPTESTBOARD) {
|
if (det_type == defs::JUNGFRAU) {
|
||||||
std::ostringstream oss;
|
{
|
||||||
proxy.Call("timestamp", {}, -1, GET, oss);
|
std::ostringstream oss;
|
||||||
|
proxy.Call("temp_event", {"0"}, -1, PUT, oss);
|
||||||
// Get only
|
REQUIRE(oss.str() == "temp_event cleared\n");
|
||||||
REQUIRE_THROWS(proxy.Call("timestamp", {"2019"}, -1, PUT));
|
}
|
||||||
|
{
|
||||||
|
std::ostringstream oss;
|
||||||
|
proxy.Call("temp_event", {}, -1, GET, oss);
|
||||||
|
REQUIRE(oss.str() == "temp_event 0\n");
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
REQUIRE_THROWS(proxy.Call("timestamp", {}, -1, GET));
|
REQUIRE_THROWS(proxy.Call("temp_event", {}, -1, GET));
|
||||||
|
REQUIRE_THROWS(proxy.Call("temp_event", {"0"}, -1, PUT));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("adcreg", "[.cmd]") {
|
TEST_CASE("auto_comp_disable", "[.cmd][.new]") {
|
||||||
// TODO! what is a safe value to use?
|
|
||||||
Detector det;
|
Detector det;
|
||||||
CmdProxy proxy(&det);
|
CmdProxy proxy(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
if (det_type == defs::JUNGFRAU || det_type == defs::CHIPTESTBOARD ||
|
if (det_type == defs::JUNGFRAU) {
|
||||||
det_type == defs::GOTTHARD) {
|
auto prev_val = det.getAutoCompDisable();
|
||||||
std::ostringstream oss;
|
{
|
||||||
proxy.Call("adcreg", {"0x0", "0"}, -1, PUT, oss);
|
std::ostringstream oss;
|
||||||
REQUIRE(oss.str() == "adcreg [0x0, 0]\n");
|
proxy.Call("auto_comp_disable", {"0"}, -1, PUT, oss);
|
||||||
// This is a put only command
|
REQUIRE(oss.str() == "auto_comp_disable 0\n");
|
||||||
REQUIRE_THROWS(proxy.Call("adcreg", {}, -1, GET));
|
}
|
||||||
|
{
|
||||||
|
std::ostringstream oss;
|
||||||
|
proxy.Call("auto_comp_disable", {"1"}, -1, PUT, oss);
|
||||||
|
REQUIRE(oss.str() == "auto_comp_disable 1\n");
|
||||||
|
}
|
||||||
|
{
|
||||||
|
std::ostringstream oss;
|
||||||
|
proxy.Call("auto_comp_disable", {}, -1, GET, oss);
|
||||||
|
REQUIRE(oss.str() == "auto_comp_disable 1\n");
|
||||||
|
}
|
||||||
|
for (int i = 0; i != det.size(); ++i) {
|
||||||
|
det.setAutoCompDisable(prev_val[i], {i});
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
REQUIRE_THROWS(proxy.Call("adcreg", {"0x0", "0"}, -1, PUT));
|
REQUIRE_THROWS(proxy.Call("auto_comp_disable", {}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("adcreg", {}, -1, GET));
|
REQUIRE_THROWS(proxy.Call("auto_comp_disable", {"0"}, -1, PUT));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("bustest", "[.cmd]") {
|
TEST_CASE("storagecells", "[.cmd][.new]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
CmdProxy proxy(&det);
|
CmdProxy proxy(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
if (det_type == defs::JUNGFRAU || det_type == defs::CHIPTESTBOARD ||
|
if (det_type == defs::JUNGFRAU) {
|
||||||
det_type == defs::GOTTHARD) {
|
auto prev_val = det.getNumberOfAdditionalStorageCells().tsquash(
|
||||||
std::ostringstream oss;
|
"inconsistent #additional storage cells to test");
|
||||||
proxy.Call("bustest", {}, -1, PUT, oss);
|
{
|
||||||
REQUIRE(oss.str() == "bustest successful\n");
|
std::ostringstream oss;
|
||||||
REQUIRE_THROWS(proxy.Call("bustest", {}, -1, GET));
|
proxy.Call("storagecells", {"1"}, -1, PUT, oss);
|
||||||
|
REQUIRE(oss.str() == "storagecells 1\n");
|
||||||
|
}
|
||||||
|
{
|
||||||
|
std::ostringstream oss;
|
||||||
|
proxy.Call("storagecells", {"15"}, -1, PUT, oss);
|
||||||
|
REQUIRE(oss.str() == "storagecells 15\n");
|
||||||
|
}
|
||||||
|
{
|
||||||
|
std::ostringstream oss;
|
||||||
|
proxy.Call("storagecells", {"0"}, -1, PUT, oss);
|
||||||
|
REQUIRE(oss.str() == "storagecells 0\n");
|
||||||
|
}
|
||||||
|
{
|
||||||
|
std::ostringstream oss;
|
||||||
|
proxy.Call("storagecells", {}, -1, GET, oss);
|
||||||
|
REQUIRE(oss.str() == "storagecells 0\n");
|
||||||
|
}
|
||||||
|
REQUIRE_THROWS(proxy.Call("storagecells", {"16"}, -1, PUT));
|
||||||
|
det.setNumberOfAdditionalStorageCells(prev_val);
|
||||||
} else {
|
} else {
|
||||||
REQUIRE_THROWS(proxy.Call("bustest", {}, -1, GET));
|
REQUIRE_THROWS(proxy.Call("storagecells", {}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("bustest", {}, -1, PUT));
|
REQUIRE_THROWS(proxy.Call("storagecells", {"0"}, -1, PUT));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("firmwaretest", "[.cmd]") {
|
TEST_CASE("storagecell_start", "[.cmd][.new]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
CmdProxy proxy(&det);
|
CmdProxy proxy(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
if (det_type == defs::JUNGFRAU || det_type == defs::CHIPTESTBOARD ||
|
if (det_type == defs::JUNGFRAU) {
|
||||||
det_type == defs::GOTTHARD) {
|
auto prev_val = det.getStorageCellStart();
|
||||||
std::ostringstream oss;
|
{
|
||||||
proxy.Call("firmwaretest", {}, -1, PUT, oss);
|
std::ostringstream oss;
|
||||||
REQUIRE(oss.str() == "firmwaretest successful\n");
|
proxy.Call("storagecell_start", {"1"}, -1, PUT, oss);
|
||||||
REQUIRE_THROWS(proxy.Call("firmwaretest", {}, -1, GET));
|
REQUIRE(oss.str() == "storagecell_start 1\n");
|
||||||
|
}
|
||||||
|
{
|
||||||
|
std::ostringstream oss;
|
||||||
|
proxy.Call("storagecell_start", {"15"}, -1, PUT, oss);
|
||||||
|
REQUIRE(oss.str() == "storagecell_start 15\n");
|
||||||
|
}
|
||||||
|
{
|
||||||
|
std::ostringstream oss;
|
||||||
|
proxy.Call("storagecell_start", {"0"}, -1, PUT, oss);
|
||||||
|
REQUIRE(oss.str() == "storagecell_start 0\n");
|
||||||
|
}
|
||||||
|
{
|
||||||
|
std::ostringstream oss;
|
||||||
|
proxy.Call("storagecell_start", {}, -1, GET, oss);
|
||||||
|
REQUIRE(oss.str() == "storagecell_start 0\n");
|
||||||
|
}
|
||||||
|
REQUIRE_THROWS(proxy.Call("storagecell_start", {"16"}, -1, PUT));
|
||||||
|
for (int i = 0; i != det.size(); ++i) {
|
||||||
|
det.setStorageCellStart(prev_val[i], {i});
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
REQUIRE_THROWS(proxy.Call("firmwaretest", {}, -1, GET));
|
REQUIRE_THROWS(proxy.Call("storagecell_start", {}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("firmwaretest", {}, -1, PUT));
|
REQUIRE_THROWS(proxy.Call("storagecell_start", {"0"}, -1, PUT));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("resetfpga", "[.cmd]") {
|
TEST_CASE("storagecell_delay", "[.cmd][.new]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
CmdProxy proxy(&det);
|
CmdProxy proxy(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
if (det_type == defs::JUNGFRAU || det_type == defs::CHIPTESTBOARD) {
|
if (det_type == defs::JUNGFRAU) {
|
||||||
std::ostringstream oss;
|
auto prev_val = det.getStorageCellDelay();
|
||||||
proxy.Call("resetfpga", {}, -1, PUT, oss);
|
{
|
||||||
REQUIRE(oss.str() == "resetfpga successful\n");
|
std::ostringstream oss;
|
||||||
REQUIRE_THROWS(proxy.Call("resetfpga", {}, -1, GET));
|
proxy.Call("storagecell_delay", {"1.62ms"}, -1, PUT, oss);
|
||||||
|
REQUIRE(oss.str() == "storagecell_delay 1.62ms\n");
|
||||||
|
}
|
||||||
|
{
|
||||||
|
std::ostringstream oss;
|
||||||
|
proxy.Call("storagecell_delay", {}, -1, GET, oss);
|
||||||
|
REQUIRE(oss.str() == "storagecell_delay 1.62ms\n");
|
||||||
|
}
|
||||||
|
{
|
||||||
|
std::ostringstream oss;
|
||||||
|
proxy.Call("storagecell_delay", {"0"}, -1, PUT, oss);
|
||||||
|
REQUIRE(oss.str() == "storagecell_delay 0\n");
|
||||||
|
}
|
||||||
|
REQUIRE_THROWS(proxy.Call("storagecell_delay", {"1638376ns"}, -1, PUT));
|
||||||
|
for (int i = 0; i != det.size(); ++i) {
|
||||||
|
det.setStorageCellDelay(prev_val[i], {i});
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
REQUIRE_THROWS(proxy.Call("resetfpga", {}, -1, GET));
|
REQUIRE_THROWS(proxy.Call("storagecell_delay", {}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("resetfpga", {}, -1, PUT));
|
REQUIRE_THROWS(proxy.Call("storagecell_delay", {"0"}, -1, PUT));
|
||||||
}
|
}
|
||||||
}
|
}
|
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user