mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-12 12:57:13 +02:00
wip
This commit is contained in:
@ -161,7 +161,7 @@ def test_gainmode(virtual_jf_detectors):
|
||||
assert d.gainMode == gainMode.NORMAL_GAIN_MODE
|
||||
|
||||
gain_list = [
|
||||
gainMode.DYNAMIC_GAIN,
|
||||
gainMode.DYNAMIC_GAIN_MODE,
|
||||
gainMode.FORCE_SWITCH_G1,
|
||||
gainMode.FORCE_SWITCH_G2,
|
||||
gainMode.FIX_G1,
|
||||
@ -176,7 +176,7 @@ def test_gainmode(virtual_jf_detectors):
|
||||
|
||||
d.setGainMode(gainMode.FORCE_SWITCH_G1, [1])
|
||||
assert d.gainMode == [
|
||||
gainMode.DYNAMIC_GAIN,
|
||||
gainMode.DYNAMIC_GAIN_MODE,
|
||||
gainMode.FORCE_SWITCH_G1,
|
||||
gainMode.FORCE_SWITCH_G2,
|
||||
gainMode.FIX_G1,
|
||||
|
@ -2201,7 +2201,7 @@ class Detector(CppDetectorApi):
|
||||
[Jungfrau] Detector gain mode. Enum: gainMode
|
||||
Note
|
||||
-----
|
||||
[Jungfrau] DYNAMIC_GAIN, FORCE_SWITCH_G1, FORCE_SWITCH_G2, FIX_G1, FIX_G2, FIX_G0 \n
|
||||
[Jungfrau] DYNAMIC_GAIN_MODE, 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!!!
|
||||
"""
|
||||
return element_if_equal(self.getGainMode())
|
||||
|
@ -308,7 +308,7 @@ void init_enums(py::module &m) {
|
||||
.export_values();
|
||||
|
||||
py::enum_<slsDetectorDefs::gainMode>(Defs, "gainMode")
|
||||
.value("DYNAMIC_GAIN", slsDetectorDefs::gainMode::DYNAMIC_GAIN)
|
||||
.value("DYNAMIC_GAIN_MODE", slsDetectorDefs::gainMode::DYNAMIC_GAIN_MODE)
|
||||
.value("FORCE_SWITCH_G1", slsDetectorDefs::gainMode::FORCE_SWITCH_G1)
|
||||
.value("FORCE_SWITCH_G2", slsDetectorDefs::gainMode::FORCE_SWITCH_G2)
|
||||
.value("FIX_G1", slsDetectorDefs::gainMode::FIX_G1)
|
||||
|
@ -793,6 +793,11 @@ int selectStoragecellStart(int pos) {
|
||||
LOG(logINFO, ("Setting storage cell start: %d\n", pos));
|
||||
bus_w(addr, bus_r(addr) & ~mask);
|
||||
bus_w(addr, bus_r(addr) | ((value << offset) & mask));
|
||||
// should not do a get to verify (status register does not update
|
||||
// immediately during acquisition)
|
||||
if (getChipVersion() == 11) {
|
||||
return pos;
|
||||
}
|
||||
}
|
||||
|
||||
// read value back
|
||||
@ -1098,7 +1103,7 @@ enum gainMode getGainMode() {
|
||||
|
||||
switch (retval_force) {
|
||||
case DAQ_FRCE_GAIN_STG_0_VAL:
|
||||
return DYNAMIC_GAIN;
|
||||
return DYNAMIC_GAIN_MODE;
|
||||
case DAQ_FRCE_GAIN_STG_1_VAL:
|
||||
return FORCE_SWITCH_G1;
|
||||
case DAQ_FRCE_GAIN_STG_2_VAL:
|
||||
@ -1128,7 +1133,7 @@ void setGainMode(enum gainMode mode) {
|
||||
uint32_t value = bus_r(addr);
|
||||
|
||||
switch (mode) {
|
||||
case DYNAMIC_GAIN:
|
||||
case DYNAMIC_GAIN_MODE:
|
||||
value &= ~(DAQ_GAIN_MODE_MASK);
|
||||
bus_w(addr, value);
|
||||
LOG(logINFO,
|
||||
|
@ -98,7 +98,7 @@ enum CLKINDEX { RUN_CLK, ADC_CLK, DBIT_CLK, NUM_CLOCKS };
|
||||
#define DEFAULT_HIGH_VOLTAGE (0)
|
||||
#define DEFAULT_TIMING_MODE (AUTO_TIMING)
|
||||
#define DEFAULT_SETTINGS (GAIN0)
|
||||
#define DEFAULT_GAINMODE (DYNAMIC_GAIN)
|
||||
#define DEFAULT_GAINMODE (DYNAMIC_GAIN_MODE)
|
||||
#define DEFAULT_TX_UDP_PORT (0x7e9a)
|
||||
#define DEFAULT_TMP_THRSHLD (65 * 1000) // milli degree Celsius
|
||||
#define DEFAULT_NUM_STRG_CLLS (0)
|
||||
|
@ -8560,7 +8560,7 @@ int set_default_dac(int file_des) {
|
||||
int get_gain_mode(int file_des) {
|
||||
ret = OK;
|
||||
memset(mess, 0, sizeof(mess));
|
||||
enum gainMode retval = NORMAL_GAIN_MODE;
|
||||
enum gainMode retval = DYNAMIC_GAIN_MODE;
|
||||
LOG(logDEBUG1, ("Getting gain mode\n"));
|
||||
|
||||
#ifndef JUNGFRAUD
|
||||
@ -8593,7 +8593,7 @@ int set_gain_mode(int file_des) {
|
||||
// only set
|
||||
if (Server_VerifyLock() == OK) {
|
||||
switch (gainmode) {
|
||||
case DYNAMIC_GAIN:
|
||||
case DYNAMIC_GAIN_MODE:
|
||||
case FORCE_SWITCH_G1:
|
||||
case FORCE_SWITCH_G2:
|
||||
case FIX_G1:
|
||||
|
@ -1179,7 +1179,7 @@ class Detector {
|
||||
/** [Jungfrau]*/
|
||||
Result<defs::gainMode> getGainMode(Positions pos = {}) const;
|
||||
|
||||
/** [Jungfrau] Options: DYNAMIC_GAIN, FORCE_SWITCH_G1, FORCE_SWITCH_G2,
|
||||
/** [Jungfrau] Options: DYNAMIC_GAIN_MODE, 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
|
||||
*/
|
||||
|
@ -1494,9 +1494,12 @@ void Detector::setStorageCellDelay(ns value, Positions pos) {
|
||||
std::vector<defs::gainMode> Detector::getGainModeList() const {
|
||||
switch (getDetectorType().squash()) {
|
||||
case defs::JUNGFRAU:
|
||||
return std::vector<defs::gainMode>{
|
||||
defs::DYNAMIC_GAIN, defs::FORCE_SWITCH_G1, defs::FORCE_SWITCH_G2,
|
||||
defs::FIX_G1, defs::FIX_G2, defs::FIX_G0};
|
||||
return std::vector<defs::gainMode>{defs::DYNAMIC_GAIN_MODE,
|
||||
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.");
|
||||
|
@ -416,12 +416,11 @@ typedef struct {
|
||||
enum vetoAlgorithm { DEFAULT_ALGORITHM };
|
||||
|
||||
enum gainMode {
|
||||
DYNAMIC_GAIN,
|
||||
DYNAMIC_GAIN_MODE,
|
||||
FORCE_SWITCH_G1,
|
||||
FORCE_SWITCH_G2,
|
||||
FIX_G1,
|
||||
FIX_G2,
|
||||
FIX_G0,
|
||||
FIX_G0
|
||||
};
|
||||
|
||||
|
@ -583,7 +583,7 @@ std::string ToString(const defs::vetoAlgorithm s) {
|
||||
|
||||
std::string ToString(const defs::gainMode s) {
|
||||
switch (s) {
|
||||
case defs::DYNAMIC_GAIN:
|
||||
case defs::DYNAMIC_GAIN_MODE:
|
||||
return std::string("dynamicgain");
|
||||
case defs::FORCE_SWITCH_G1:
|
||||
return std::string("forceswitchg1");
|
||||
@ -987,7 +987,7 @@ template <> defs::vetoAlgorithm StringTo(const std::string &s) {
|
||||
|
||||
template <> defs::gainMode StringTo(const std::string &s) {
|
||||
if (s == "dynamicgain")
|
||||
return defs::DYNAMIC_GAIN;
|
||||
return defs::DYNAMIC_GAIN_MODE;
|
||||
if (s == "forceswitchg1")
|
||||
return defs::FORCE_SWITCH_G1;
|
||||
if (s == "forceswitchg2")
|
||||
|
Reference in New Issue
Block a user