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';

View File

@ -565,6 +565,7 @@ class CmdProxy {
{"settings", &CmdProxy::settings},
{"trimbits", &CmdProxy::trimbits},
{"trimval", &CmdProxy::trimval},
{"gappixels", &CmdProxy::GapPixels},
/* acquisition parameters */
{"acquire", &CmdProxy::acquire},
@ -754,7 +755,6 @@ class CmdProxy {
{"threshold", &CmdProxy::Threshold},
{"thresholdnotb", &CmdProxy::ThresholdNoTb},
{"settingspath", &CmdProxy::settingspath},
{"gappixels", &CmdProxy::GapPixels},
{"parallel", &CmdProxy::parallel},
{"overflow", &CmdProxy::overflow},
{"storeinram", &CmdProxy::storeinram},
@ -923,6 +923,7 @@ class CmdProxy {
std::string PackageVersion(int action);
std::string ClientVersion(int action);
std::string DetectorSize(int action);
std::string GapPixels(int action);
/* acquisition parameters */
std::string acquire(int action);
std::string Exptime(int action);
@ -954,7 +955,6 @@ class CmdProxy {
std::string DynamicRange(int action);
std::string Threshold(int action);
std::string ThresholdNoTb(int action);
std::string GapPixels(int action);
std::string TrimEnergies(int action);
std::string RateCorrection(int action);
std::string Activate(int action);

View File

@ -161,6 +161,14 @@ void Detector::setAllTrimbits(int value, Positions pos) {
pimpl->Parallel(&Module::setAllTrimbits, pos, value);
}
bool Detector::getGapPixelsinCallback() const {
return pimpl->getGapPixelsinCallback();
}
void Detector::setGapPixelsinCallback(bool enable) {
pimpl->setGapPixelsinCallback(enable);
}
// Callback
void Detector::registerAcquisitionFinishedCallback(void (*func)(double, int,
@ -175,14 +183,6 @@ void Detector::registerDataCallback(void (*func)(detectorData *, uint64_t,
pimpl->registerDataCallback(func, pArg);
}
bool Detector::getGapPixelsinCallback() const {
return pimpl->getGapPixelsinCallback();
}
void Detector::setGapPixelsinCallback(bool enable) {
pimpl->setGapPixelsinCallback(enable);
}
// Acquisition Parameters
Result<int64_t> Detector::getNumberOfFrames(Positions pos) const {