This commit is contained in:
2020-06-03 14:40:51 +02:00
parent f07e722d26
commit 4053594c4d
10 changed files with 871 additions and 1091 deletions

View File

@ -331,6 +331,37 @@ std::string CmdProxy::DetectorSize(int action) {
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 */
std::string CmdProxy::Exptime(int action) {
@ -1224,37 +1255,6 @@ std::string CmdProxy::ThresholdNoTb(int action) {
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::ostringstream os;
os << cmd << ' ';
@ -1271,13 +1271,11 @@ std::string CmdProxy::TrimEnergies(int action) {
auto t = det->getTrimEnergies({det_id});
os << OutString(t) << '\n';
} else if (action == defs::PUT_ACTION) {
if (args.empty()) {
WrongNumberOfParameters(1);
}
std::vector<int> t(args.size());
for (size_t i = 0; i < t.size(); ++i) {
t[i] = StringTo<int>(args[i]);
if (!args.empty()) {
for (size_t i = 0; i < t.size(); ++i) {
t[i] = StringTo<int>(args[i]);
}
}
det->setTrimEnergies(t, {det_id});
os << sls::ToString(args) << '\n';