Ctb sense power signal names (#759)

*  adc names

* added python functions in src

*  signal, power, sense names

* fix tests
This commit is contained in:
2023-06-07 17:06:41 +02:00
committed by GitHub
parent b9a346a396
commit a7dcfe4b31
13 changed files with 1039 additions and 253 deletions

View File

@ -1218,96 +1218,6 @@ std::string CmdProxy::DacIndex(const int action) {
return os.str();
}
std::string CmdProxy::AdcList(const int action) {
std::ostringstream os;
os << cmd << ' ';
if (action == slsDetectorDefs::HELP_ACTION) {
os << "\n\t[adcname1 adcname2 .. adcname32] \n\t\t[ChipTestBoard] Set "
"the list of adc names for this board."
<< '\n';
return os.str();
}
if (det->getDetectorType().squash() != defs::CHIPTESTBOARD) {
throw RuntimeError("Named Adcs only allowed for CTB.");
}
if (action == slsDetectorDefs::GET_ACTION) {
if (!args.empty()) {
WrongNumberOfParameters(0);
}
auto t = det->getAdcNames();
os << ToString(t) << '\n';
} else if (action == slsDetectorDefs::PUT_ACTION) {
if (det_id != -1) {
throw RuntimeError("Cannot configure adcnames at module level");
}
det->setAdcNames(args);
os << ToString(args) << '\n';
} else {
throw RuntimeError("Unknown action");
}
return os.str();
}
std::string CmdProxy::AdcName(const int action) {
std::ostringstream os;
os << cmd << ' ';
if (action == slsDetectorDefs::HELP_ACTION) {
os << "\n\t[0-31][name] \n\t\t[ChipTestBoard] Set "
"the adc at the given position to the given name."
<< '\n';
return os.str();
}
if (det->getDetectorType().squash() != defs::CHIPTESTBOARD) {
throw RuntimeError("Named Adcs only allowed for CTB.");
}
int index = StringTo<int>(args[0]);
if (action == slsDetectorDefs::GET_ACTION) {
if (args.size() != 1) {
WrongNumberOfParameters(1);
}
auto t = det->getAdcName(index);
os << args[0] << ' ' << ToString(t) << '\n';
} else if (action == slsDetectorDefs::PUT_ACTION) {
if (det_id != -1) {
throw RuntimeError("Cannot configure adcnames at module level");
}
if (args.size() != 2) {
WrongNumberOfParameters(2);
}
det->setAdcName(index, args[1]);
os << ToString(args) << '\n';
} else {
throw RuntimeError("Unknown action");
}
return os.str();
}
std::string CmdProxy::AdcIndex(const int action) {
std::ostringstream os;
os << cmd << ' ';
if (action == slsDetectorDefs::HELP_ACTION) {
os << "\n\t[name] \n\t\t[ChipTestBoard] Get "
"the adc index for the given name."
<< '\n';
return os.str();
}
if (det->getDetectorType().squash() != defs::CHIPTESTBOARD) {
throw RuntimeError("Named Adcs only allowed for CTB.");
}
if (action == slsDetectorDefs::GET_ACTION) {
if (args.size() != 1) {
WrongNumberOfParameters(1);
}
auto t = det->getAdcIndex(args[0]);
os << ToString(t) << '\n';
} else if (action == slsDetectorDefs::PUT_ACTION) {
throw RuntimeError("Cannot set adc index");
} else {
throw RuntimeError("Unknown action");
}
return os.str();
}
/* dacs */
std::string CmdProxy::Dac(int action) {
std::ostringstream os;