mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2026-01-16 16:08:38 +01:00
jungfrau: api changed from set/getFilterCell to set/getNumberOfFilterCells, storagecells command line changed to extrastoragecells, fixed wrong numberof arguments parsing message
This commit is contained in:
@@ -1240,11 +1240,11 @@ class Detector {
|
||||
void setGainMode(const defs::gainMode mode, Positions pos = {});
|
||||
|
||||
/** [Jungfrau] Advanced */
|
||||
Result<int> getFilterCell(Positions pos = {}) const;
|
||||
Result<int> getNumberOfFilterCells(Positions pos = {}) const;
|
||||
|
||||
/** [Jungfrau] Advanced Options[0-12], only for chip v1.1
|
||||
*/
|
||||
void setFilterCell(int cell, Positions pos = {});
|
||||
void setNumberOfFilterCells(int cell, Positions pos = {});
|
||||
|
||||
///@{
|
||||
|
||||
|
||||
@@ -87,9 +87,9 @@ void CmdProxy::WrongNumberOfParameters(size_t expected) {
|
||||
" expected no parameter/s but got " +
|
||||
std::to_string(args.size()) + "\n");
|
||||
}
|
||||
throw RuntimeError(
|
||||
"Command " + cmd + " expected >=" + std::to_string(expected) +
|
||||
" parameter/s but got " + std::to_string(args.size()) + "\n");
|
||||
throw RuntimeError("Command " + cmd + " expected (or >=) " +
|
||||
std::to_string(expected) + " parameter/s but got " +
|
||||
std::to_string(args.size()) + "\n");
|
||||
}
|
||||
|
||||
/************************************************
|
||||
|
||||
@@ -725,6 +725,8 @@ class CmdProxy {
|
||||
{"resmat", "partialreset"},
|
||||
|
||||
/* Jungfrau Specific */
|
||||
{"storagecells", "extrastoragecells"},
|
||||
|
||||
/* Gotthard Specific */
|
||||
/* Gotthard2 Specific */
|
||||
/* Mythen3 Specific */
|
||||
@@ -944,7 +946,7 @@ class CmdProxy {
|
||||
{"temp_event", &CmdProxy::TemperatureEvent},
|
||||
{"auto_comp_disable", &CmdProxy::auto_comp_disable},
|
||||
{"comp_disable_time", &CmdProxy::comp_disable_time},
|
||||
{"storagecells", &CmdProxy::storagecells},
|
||||
{"extrastoragecells", &CmdProxy::extrastoragecells},
|
||||
{"storagecell_start", &CmdProxy::storagecell_start},
|
||||
{"storagecell_delay", &CmdProxy::storagecell_delay},
|
||||
{"gainmode", &CmdProxy::gainmode},
|
||||
@@ -1923,12 +1925,12 @@ class CmdProxy {
|
||||
"only possible for chipv1.1.");
|
||||
|
||||
INTEGER_COMMAND_SET_NOID_GET_ID(
|
||||
storagecells, getNumberOfAdditionalStorageCells,
|
||||
extrastoragecells, getNumberOfAdditionalStorageCells,
|
||||
setNumberOfAdditionalStorageCells, StringTo<int>,
|
||||
"[0-15]\n\t[Jungfrau] Only for chipv1.0. Number of additional storage "
|
||||
"cells. Default is "
|
||||
"0. For advanced users only. \n\tThe #images = #frames x #triggers x "
|
||||
"(#storagecells + 1).");
|
||||
"(#extrastoragecells + 1).");
|
||||
|
||||
INTEGER_COMMAND_VEC_ID(
|
||||
storagecell_start, getStorageCellStart, setStorageCellStart,
|
||||
@@ -1951,8 +1953,8 @@ class CmdProxy {
|
||||
"Jungfrau] Gain mode.\n\tCAUTION: Do not use fixg0 without caution, "
|
||||
"you can damage the detector!!!");
|
||||
|
||||
INTEGER_COMMAND_VEC_ID(filtercells, getFilterCell, setFilterCell,
|
||||
sls::StringTo<int>,
|
||||
INTEGER_COMMAND_VEC_ID(filtercells, getNumberOfFilterCells,
|
||||
setNumberOfFilterCells, sls::StringTo<int>,
|
||||
"[0-12]\n\t[Jungfrau] Set Filter Cell. Only for "
|
||||
"chipv1.1. Advanced user Command");
|
||||
|
||||
|
||||
@@ -1562,12 +1562,12 @@ void Detector::setGainMode(const defs::gainMode mode, Positions pos) {
|
||||
pimpl->Parallel(&Module::setGainMode, pos, mode);
|
||||
}
|
||||
|
||||
Result<int> Detector::getFilterCell(Positions pos) const {
|
||||
return pimpl->Parallel(&Module::getFilterCell, pos);
|
||||
Result<int> Detector::getNumberOfFilterCells(Positions pos) const {
|
||||
return pimpl->Parallel(&Module::getNumberOfFilterCells, pos);
|
||||
}
|
||||
|
||||
void Detector::setFilterCell(int cell, Positions pos) {
|
||||
pimpl->Parallel(&Module::setFilterCell, pos, cell);
|
||||
void Detector::setNumberOfFilterCells(int cell, Positions pos) {
|
||||
pimpl->Parallel(&Module::setNumberOfFilterCells, pos, cell);
|
||||
}
|
||||
|
||||
// Gotthard Specific
|
||||
|
||||
@@ -1692,12 +1692,12 @@ void Module::setGainMode(const slsDetectorDefs::gainMode mode) {
|
||||
sendToDetector(F_SET_GAIN_MODE, mode, nullptr);
|
||||
}
|
||||
|
||||
int Module::getFilterCell() const {
|
||||
return sendToDetector<int>(F_GET_FILTER_CELL);
|
||||
int Module::getNumberOfFilterCells() const {
|
||||
return sendToDetector<int>(F_GET_NUM_FILTER_CELLS);
|
||||
}
|
||||
|
||||
void Module::setFilterCell(int value) {
|
||||
sendToDetector(F_SET_FILTER_CELL, value, nullptr);
|
||||
void Module::setNumberOfFilterCells(int value) {
|
||||
sendToDetector(F_SET_NUM_FILTER_CELLS, value, nullptr);
|
||||
}
|
||||
|
||||
// Gotthard Specific
|
||||
|
||||
@@ -387,8 +387,8 @@ class Module : public virtual slsDetectorDefs {
|
||||
void setStorageCellDelay(int64_t value);
|
||||
gainMode getGainMode() const;
|
||||
void setGainMode(const gainMode mode);
|
||||
int getFilterCell() const;
|
||||
void setFilterCell(int value);
|
||||
int getNumberOfFilterCells() const;
|
||||
void setNumberOfFilterCells(int value);
|
||||
|
||||
/**************************************************
|
||||
* *
|
||||
|
||||
@@ -316,7 +316,7 @@ TEST_CASE("comp_disable_time", "[.cmd]") {
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("storagecells", "[.cmd]") {
|
||||
TEST_CASE("extrastoragecells", "[.cmd]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
@@ -327,35 +327,35 @@ TEST_CASE("storagecells", "[.cmd]") {
|
||||
"inconsistent #additional storage cells to test");
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("storagecells", {"1"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "storagecells 1\n");
|
||||
proxy.Call("extrastoragecells", {"1"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "extrastoragecells 1\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("storagecells", {"15"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "storagecells 15\n");
|
||||
proxy.Call("extrastoragecells", {"15"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "extrastoragecells 15\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("storagecells", {"0"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "storagecells 0\n");
|
||||
proxy.Call("extrastoragecells", {"0"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "extrastoragecells 0\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("storagecells", {}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == "storagecells 0\n");
|
||||
proxy.Call("extrastoragecells", {}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == "extrastoragecells 0\n");
|
||||
}
|
||||
REQUIRE_THROWS(proxy.Call("storagecells", {"16"}, -1, PUT));
|
||||
REQUIRE_THROWS(proxy.Call("extrastoragecells", {"16"}, -1, PUT));
|
||||
det.setNumberOfAdditionalStorageCells(prev_val);
|
||||
}
|
||||
// chip version 1.1
|
||||
else {
|
||||
// cannot set number of addl. storage cells
|
||||
REQUIRE_THROWS(proxy.Call("storagecells", {"1"}, -1, PUT));
|
||||
REQUIRE_THROWS(proxy.Call("extrastoragecells", {"1"}, -1, PUT));
|
||||
}
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("storagecells", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("storagecells", {"0"}, -1, PUT));
|
||||
REQUIRE_THROWS(proxy.Call("extrastoragecells", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("extrastoragecells", {"0"}, -1, PUT));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -494,47 +494,47 @@ TEST_CASE("gainmode", "[.cmd]") {
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("filtercell", "[.cmd]") {
|
||||
TEST_CASE("filtercells", "[.cmd]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
if (det_type == defs::JUNGFRAU) {
|
||||
// chip version 1.1
|
||||
if (det.getChipVersion().squash() * 10 == 11) {
|
||||
auto prev_val = det.getFilterCell();
|
||||
auto prev_val = det.getNumberOfFilterCells();
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("filtercell", {"1"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "filtercell 1\n");
|
||||
proxy.Call("filtercells", {"1"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "filtercells 1\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("filtercell", {"12"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "filtercell 12\n");
|
||||
proxy.Call("filtercells", {"12"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "filtercells 12\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("filtercell", {"0"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "filtercell 0\n");
|
||||
proxy.Call("filtercells", {"0"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "filtercells 0\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("filtercell", {}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == "filtercell 0\n");
|
||||
proxy.Call("filtercells", {}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == "filtercells 0\n");
|
||||
}
|
||||
REQUIRE_THROWS(proxy.Call("filtercell", {"13"}, -1, PUT));
|
||||
REQUIRE_THROWS(proxy.Call("filtercells", {"13"}, -1, PUT));
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
det.setFilterCell(prev_val[i], {i});
|
||||
det.setNumberOfFilterCells(prev_val[i], {i});
|
||||
}
|
||||
}
|
||||
// chip version 1.0
|
||||
else {
|
||||
// cannot set/get filter cell
|
||||
REQUIRE_THROWS(proxy.Call("filtercell", {"1"}, -1, PUT));
|
||||
REQUIRE_THROWS(proxy.Call("filtercell", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("filtercells", {"1"}, -1, PUT));
|
||||
REQUIRE_THROWS(proxy.Call("filtercells", {}, -1, GET));
|
||||
}
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("filtercell", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("filtercell", {"0"}, -1, PUT));
|
||||
REQUIRE_THROWS(proxy.Call("filtercells", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("filtercells", {"0"}, -1, PUT));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user