jf: timing info decoder (#987)

* timing_info_decoder command with options swissfel (default) and shine. added to python, command line generation, autocomplete, tostring, tests.
This commit is contained in:
2024-10-01 11:17:35 +02:00
committed by GitHub
parent 8a7ed30676
commit f43bb8eea4
33 changed files with 23282 additions and 20749 deletions

View File

@ -44,6 +44,7 @@ std::string ToString(const defs::streamingInterface s);
std::string ToString(const defs::vetoAlgorithm s);
std::string ToString(const defs::gainMode s);
std::string ToString(const defs::polarity s);
std::string ToString(const defs::timingInfoDecoder s);
std::string ToString(const defs::collectionMode s);
std::string ToString(const slsDetectorDefs::xy &coord);
@ -319,6 +320,7 @@ template <> defs::streamingInterface StringTo(const std::string &s);
template <> defs::vetoAlgorithm StringTo(const std::string &s);
template <> defs::gainMode StringTo(const std::string &s);
template <> defs::polarity StringTo(const std::string &s);
template <> defs::timingInfoDecoder StringTo(const std::string &s);
template <> defs::collectionMode StringTo(const std::string &s);
template <> uint8_t StringTo(const std::string &s);

View File

@ -519,7 +519,7 @@ enum streamingInterface {
};
enum polarity { POSITIVE, NEGATIVE };
enum timingInfoDecoder { SWISSFEL, SHINE };
enum collectionMode { HOLE, ELECTRON };
#ifdef __cplusplus

View File

@ -293,6 +293,8 @@ enum detFuncs {
F_GET_PEDESTAL_MODE,
F_SET_PEDESTAL_MODE,
F_CONFIG_TRANSCEIVER,
F_GET_TIMING_INFO_DECODER,
F_SET_TIMING_INFO_DECODER,
F_GET_COLLECTION_MODE,
F_SET_COLLECTION_MODE,
@ -695,6 +697,8 @@ const char* getFunctionNameFromEnum(enum detFuncs func) {
case F_GET_PEDESTAL_MODE: return "F_GET_PEDESTAL_MODE";
case F_SET_PEDESTAL_MODE: return "F_SET_PEDESTAL_MODE";
case F_CONFIG_TRANSCEIVER: return "F_CONFIG_TRANSCEIVER";
case F_GET_TIMING_INFO_DECODER: return "F_GET_TIMING_INFO_DECODER";
case F_SET_TIMING_INFO_DECODER: return "F_SET_TIMING_INFO_DECODER";
case F_GET_COLLECTION_MODE: return "F_GET_COLLECTION_MODE";
case F_SET_COLLECTION_MODE: return "F_SET_COLLECTION_MODE";

View File

@ -10,5 +10,5 @@
#define APIMOENCH "developer 0x240918"
#define APIXILINXCTB "developer 0x240918"
#define APIEIGER "developer 0x240918"
#define APIJUNGFRAU "developer 0x240930"
#define APIMYTHEN3 "developer 0x240930"
#define APIJUNGFRAU "developer 0x241001"
#define APIMYTHEN3 "developer 0x241001"

View File

@ -679,6 +679,17 @@ std::string ToString(const defs::polarity s) {
}
}
std::string ToString(const defs::timingInfoDecoder s) {
switch (s) {
case defs::SWISSFEL:
return std::string("swissfel");
case defs::SHINE:
return std::string("shine");
default:
return std::string("Unknown");
}
}
std::string ToString(const defs::collectionMode s) {
switch (s) {
case defs::HOLE:
@ -1115,6 +1126,14 @@ template <> defs::polarity StringTo(const std::string &s) {
throw RuntimeError("Unknown polarity mode " + s);
}
template <> defs::timingInfoDecoder StringTo(const std::string &s) {
if (s == "swissfel")
return defs::SWISSFEL;
if (s == "shine")
return defs::SHINE;
throw RuntimeError("Unknown Timing Info Decoder " + s);
}
template <> defs::collectionMode StringTo(const std::string &s) {
if (s == "hole")
return defs::HOLE;

View File

@ -357,4 +357,17 @@ TEST_CASE("string to speedLevel") {
REQUIRE(StringTo<defs::speedLevel>("144") == defs::speedLevel::G2_144MHZ);
}
// Timing Info Decoder
TEST_CASE("timingInfoDecoder to string") {
REQUIRE(ToString(defs::timingInfoDecoder::SWISSFEL) == "swissfel");
REQUIRE(ToString(defs::timingInfoDecoder::SHINE) == "shine");
}
TEST_CASE("string to timingInfoDecoder") {
REQUIRE(StringTo<defs::timingInfoDecoder>("swissfel") ==
defs::timingInfoDecoder::SWISSFEL);
REQUIRE(StringTo<defs::timingInfoDecoder>("shine") ==
defs::timingInfoDecoder::SHINE);
}
} // namespace sls