rewrote settings enums, gainmode enums

This commit is contained in:
2021-08-04 13:07:48 +02:00
parent 550810a3ca
commit 0e5e0f346b
16 changed files with 109 additions and 114 deletions

View File

@ -113,7 +113,7 @@ class Detector {
/** [Jungfrau][Gotthard][Gotthard2][Mythen3] */
Result<defs::detectorSettings> getSettings(Positions pos = {}) const;
/** [Jungfrau] DYNAMICGAIN, DYNAMICHG0 \n [Gotthard] DYNAMICGAIN, HIGHGAIN,
/** [Jungfrau] GAIN0, HIGHGAIN0 \n [Gotthard] DYNAMICGAIN, HIGHGAIN,
* LOWGAIN, MEDIUMGAIN, VERYHIGHGAIN \n [Gotthard2] DYNAMICGAIN,
* FIXGAIN1, FIXGAIN2 \n [Moench] G1_HIGHGAIN, G1_LOWGAIN,
* G2_HIGHCAP_HIGHGAIN, G2_HIGHCAP_LOWGAIN, G2_LOWCAP_HIGHGAIN,
@ -1179,9 +1179,9 @@ class Detector {
/** [Jungfrau]*/
Result<defs::gainMode> getGainMode(Positions pos = {}) const;
/** [Jungfrau] Options: DYNAMICGAIN, FORCE_SWITCH_G1, FORCE_SWITCH_G2,
* FIX_G1, FIX_G2, FIX_G0, FIX_HG0 \n\CAUTION: Do not use FIX_G0 and FIX_HG0
* blindly, you can damage the detector!!!\n
/** [Jungfrau] Options: DYNAMIC_GAIN, FORCE_SWITCH_G1, FORCE_SWITCH_G2,
* FIX_G1, FIX_G2, FIX_G0 \n\CAUTION: Do not use FIX_G0 blindly, you can
* damage the detector!!!\n
*/
void setGainMode(const defs::gainMode mode, Positions pos = {});

View File

@ -1203,12 +1203,12 @@ class CmdProxy {
settings, getSettings, setSettings,
sls::StringTo<slsDetectorDefs::detectorSettings>,
"[standard, fast, highgain, dynamicgain, lowgain, "
"mediumgain, veryhighgain, dynamichg0, "
"mediumgain, veryhighgain, highgain0, "
"fixgain1, fixgain2, forceswitchg1, forceswitchg2, "
"verylowgain, g1_hg, g1_lg, g2_hc_hg, g2_hc_lg, "
"g2_lc_hg, g2_lc_lg, g4_hg, g4_lg]"
"g2_lc_hg, g2_lc_lg, g4_hg, g4_lg, gain0]"
"\n\t Detector Settings"
"\n\t[Jungfrau] - [dynamicgain | dynamichg0]"
"\n\t[Jungfrau] - [ gain0 | highgain0]"
"\n\t[Gotthard] - [dynamicgain | highgain | lowgain | "
"mediumgain | veryhighgain]"
"\n\t[Gotthard2] - [dynamicgain | fixgain1 | fixgain2]"
@ -1877,9 +1877,9 @@ class CmdProxy {
INTEGER_COMMAND_VEC_ID(
gainmode, getGainMode, setGainMode,
sls::StringTo<slsDetectorDefs::gainMode>,
"[forceswitchg1|forceswitchg2|fixgain1|fixgain2|fixgain0|"
"fixhighgain0]\n\t[Jungfrau] Gain mode.\n\tCAUTION: Do not use "
"fixgain0 and fixhighgain0 blindly, you can damage the detector!!!");
"[dynamicgain|forceswitchg1|forceswitchg2|fixg1|fixg2|fixg0]\n\t["
"Jungfrau] Gain mode.\n\tCAUTION: Do not use fixg0 blindly, you can "
"damage the detector!!!");
/* Gotthard Specific */
TIME_GET_COMMAND(exptimel, getExptimeLeft,

View File

@ -158,8 +158,8 @@ std::vector<defs::detectorSettings> Detector::getSettingsList() const {
defs::HIGHGAIN, defs::DYNAMICGAIN, defs::LOWGAIN, defs::MEDIUMGAIN,
defs::VERYHIGHGAIN};
case defs::JUNGFRAU:
return std::vector<defs::detectorSettings>{defs::DYNAMICGAIN,
defs::DYNAMICHG0};
return std::vector<defs::detectorSettings>{defs::GAIN0,
defs::HIGHGAIN0};
case defs::GOTTHARD2:
return std::vector<defs::detectorSettings>{
defs::DYNAMICGAIN, defs::DYNAMICHG0, defs::FIXGAIN1,
@ -1495,9 +1495,8 @@ std::vector<defs::gainMode> Detector::getGainModeList() const {
switch (getDetectorType().squash()) {
case defs::JUNGFRAU:
return std::vector<defs::gainMode>{
defs::DYNAMICGAIN, defs::FORCE_SWITCH_G1, defs::FORCE_SWITCH_G2,
defs::FIX_G1, defs::FIX_G2, defs::FIX_G0,
defs::FIX_HG0};
defs::DYNAMIC_GAIN, defs::FORCE_SWITCH_G1, defs::FORCE_SWITCH_G2,
defs::FIX_G1, defs::FIX_G2, defs::FIX_G0};
break;
default:
throw RuntimeError("Gain mode is not implemented for this detector.");

View File

@ -456,6 +456,11 @@ TEST_CASE("gainmode", "[.cmd]") {
proxy.Call("gainmode", {}, -1, GET, oss);
REQUIRE(oss.str() == "gainmode forceswitchg1\n");
}
{
std::ostringstream oss;
proxy.Call("gainmode", {"dynamicgain"}, -1, PUT, oss);
REQUIRE(oss.str() == "gainmode dynamicgain\n");
}
{
std::ostringstream oss;
proxy.Call("gainmode", {"forceswitchg2"}, -1, PUT, oss);
@ -473,8 +478,8 @@ TEST_CASE("gainmode", "[.cmd]") {
}
{
std::ostringstream oss;
proxy.Call("gainmode", {"dynamic"}, -1, PUT, oss);
REQUIRE(oss.str() == "gainmode dynamic\n");
proxy.Call("gainmode", {"fixg0"}, -1, PUT, oss);
REQUIRE(oss.str() == "gainmode fixg0\n");
}
for (int i = 0; i != det.size(); ++i) {
det.setGainMode(prev_val[i], {i});

View File

@ -150,7 +150,7 @@ TEST_CASE("settings", "[.cmd]") {
allSett.push_back("lowgain");
allSett.push_back("mediumgain");
allSett.push_back("veryhighgain");
allSett.push_back("dynamichg0");
allSett.push_back("highgain0");
allSett.push_back("fixgain1");
allSett.push_back("fixgain2");
allSett.push_back("verylowgain");
@ -164,12 +164,13 @@ TEST_CASE("settings", "[.cmd]") {
allSett.push_back("g4_lg");
allSett.push_back("forceswitchg1");
allSett.push_back("forceswitchg2");
allSett.push_back("gain0");
std::vector<std::string> sett;
switch (det_type) {
case defs::JUNGFRAU:
sett.push_back("dynamicgain");
sett.push_back("dynamichg0");
sett.push_back("gain0");
sett.push_back("highgain0");
break;
case defs::GOTTHARD:
sett.push_back("highgain");