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
|
assert d.gainMode == gainMode.NORMAL_GAIN_MODE
|
||||||
|
|
||||||
gain_list = [
|
gain_list = [
|
||||||
gainMode.DYNAMIC_GAIN,
|
gainMode.DYNAMIC_GAIN_MODE,
|
||||||
gainMode.FORCE_SWITCH_G1,
|
gainMode.FORCE_SWITCH_G1,
|
||||||
gainMode.FORCE_SWITCH_G2,
|
gainMode.FORCE_SWITCH_G2,
|
||||||
gainMode.FIX_G1,
|
gainMode.FIX_G1,
|
||||||
@ -176,7 +176,7 @@ def test_gainmode(virtual_jf_detectors):
|
|||||||
|
|
||||||
d.setGainMode(gainMode.FORCE_SWITCH_G1, [1])
|
d.setGainMode(gainMode.FORCE_SWITCH_G1, [1])
|
||||||
assert d.gainMode == [
|
assert d.gainMode == [
|
||||||
gainMode.DYNAMIC_GAIN,
|
gainMode.DYNAMIC_GAIN_MODE,
|
||||||
gainMode.FORCE_SWITCH_G1,
|
gainMode.FORCE_SWITCH_G1,
|
||||||
gainMode.FORCE_SWITCH_G2,
|
gainMode.FORCE_SWITCH_G2,
|
||||||
gainMode.FIX_G1,
|
gainMode.FIX_G1,
|
||||||
|
@ -2201,7 +2201,7 @@ class Detector(CppDetectorApi):
|
|||||||
[Jungfrau] Detector gain mode. Enum: gainMode
|
[Jungfrau] Detector gain mode. Enum: gainMode
|
||||||
Note
|
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!!!
|
CAUTION: Do not use FIX_G0 blindly, you can damage the detector!!!
|
||||||
"""
|
"""
|
||||||
return element_if_equal(self.getGainMode())
|
return element_if_equal(self.getGainMode())
|
||||||
|
@ -308,7 +308,7 @@ void init_enums(py::module &m) {
|
|||||||
.export_values();
|
.export_values();
|
||||||
|
|
||||||
py::enum_<slsDetectorDefs::gainMode>(Defs, "gainMode")
|
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_G1", slsDetectorDefs::gainMode::FORCE_SWITCH_G1)
|
||||||
.value("FORCE_SWITCH_G2", slsDetectorDefs::gainMode::FORCE_SWITCH_G2)
|
.value("FORCE_SWITCH_G2", slsDetectorDefs::gainMode::FORCE_SWITCH_G2)
|
||||||
.value("FIX_G1", slsDetectorDefs::gainMode::FIX_G1)
|
.value("FIX_G1", slsDetectorDefs::gainMode::FIX_G1)
|
||||||
|
@ -793,6 +793,11 @@ int selectStoragecellStart(int pos) {
|
|||||||
LOG(logINFO, ("Setting storage cell start: %d\n", pos));
|
LOG(logINFO, ("Setting storage cell start: %d\n", pos));
|
||||||
bus_w(addr, bus_r(addr) & ~mask);
|
bus_w(addr, bus_r(addr) & ~mask);
|
||||||
bus_w(addr, bus_r(addr) | ((value << offset) & 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
|
// read value back
|
||||||
@ -1098,7 +1103,7 @@ enum gainMode getGainMode() {
|
|||||||
|
|
||||||
switch (retval_force) {
|
switch (retval_force) {
|
||||||
case DAQ_FRCE_GAIN_STG_0_VAL:
|
case DAQ_FRCE_GAIN_STG_0_VAL:
|
||||||
return DYNAMIC_GAIN;
|
return DYNAMIC_GAIN_MODE;
|
||||||
case DAQ_FRCE_GAIN_STG_1_VAL:
|
case DAQ_FRCE_GAIN_STG_1_VAL:
|
||||||
return FORCE_SWITCH_G1;
|
return FORCE_SWITCH_G1;
|
||||||
case DAQ_FRCE_GAIN_STG_2_VAL:
|
case DAQ_FRCE_GAIN_STG_2_VAL:
|
||||||
@ -1128,7 +1133,7 @@ void setGainMode(enum gainMode mode) {
|
|||||||
uint32_t value = bus_r(addr);
|
uint32_t value = bus_r(addr);
|
||||||
|
|
||||||
switch (mode) {
|
switch (mode) {
|
||||||
case DYNAMIC_GAIN:
|
case DYNAMIC_GAIN_MODE:
|
||||||
value &= ~(DAQ_GAIN_MODE_MASK);
|
value &= ~(DAQ_GAIN_MODE_MASK);
|
||||||
bus_w(addr, value);
|
bus_w(addr, value);
|
||||||
LOG(logINFO,
|
LOG(logINFO,
|
||||||
|
@ -98,7 +98,7 @@ enum CLKINDEX { RUN_CLK, ADC_CLK, DBIT_CLK, NUM_CLOCKS };
|
|||||||
#define DEFAULT_HIGH_VOLTAGE (0)
|
#define DEFAULT_HIGH_VOLTAGE (0)
|
||||||
#define DEFAULT_TIMING_MODE (AUTO_TIMING)
|
#define DEFAULT_TIMING_MODE (AUTO_TIMING)
|
||||||
#define DEFAULT_SETTINGS (GAIN0)
|
#define DEFAULT_SETTINGS (GAIN0)
|
||||||
#define DEFAULT_GAINMODE (DYNAMIC_GAIN)
|
#define DEFAULT_GAINMODE (DYNAMIC_GAIN_MODE)
|
||||||
#define DEFAULT_TX_UDP_PORT (0x7e9a)
|
#define DEFAULT_TX_UDP_PORT (0x7e9a)
|
||||||
#define DEFAULT_TMP_THRSHLD (65 * 1000) // milli degree Celsius
|
#define DEFAULT_TMP_THRSHLD (65 * 1000) // milli degree Celsius
|
||||||
#define DEFAULT_NUM_STRG_CLLS (0)
|
#define DEFAULT_NUM_STRG_CLLS (0)
|
||||||
|
@ -8560,7 +8560,7 @@ int set_default_dac(int file_des) {
|
|||||||
int get_gain_mode(int file_des) {
|
int get_gain_mode(int file_des) {
|
||||||
ret = OK;
|
ret = OK;
|
||||||
memset(mess, 0, sizeof(mess));
|
memset(mess, 0, sizeof(mess));
|
||||||
enum gainMode retval = NORMAL_GAIN_MODE;
|
enum gainMode retval = DYNAMIC_GAIN_MODE;
|
||||||
LOG(logDEBUG1, ("Getting gain mode\n"));
|
LOG(logDEBUG1, ("Getting gain mode\n"));
|
||||||
|
|
||||||
#ifndef JUNGFRAUD
|
#ifndef JUNGFRAUD
|
||||||
@ -8593,7 +8593,7 @@ int set_gain_mode(int file_des) {
|
|||||||
// only set
|
// only set
|
||||||
if (Server_VerifyLock() == OK) {
|
if (Server_VerifyLock() == OK) {
|
||||||
switch (gainmode) {
|
switch (gainmode) {
|
||||||
case DYNAMIC_GAIN:
|
case DYNAMIC_GAIN_MODE:
|
||||||
case FORCE_SWITCH_G1:
|
case FORCE_SWITCH_G1:
|
||||||
case FORCE_SWITCH_G2:
|
case FORCE_SWITCH_G2:
|
||||||
case FIX_G1:
|
case FIX_G1:
|
||||||
|
@ -1179,7 +1179,7 @@ class Detector {
|
|||||||
/** [Jungfrau]*/
|
/** [Jungfrau]*/
|
||||||
Result<defs::gainMode> getGainMode(Positions pos = {}) const;
|
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
|
* FIX_G1, FIX_G2, FIX_G0 \n\CAUTION: Do not use FIX_G0 blindly, you can
|
||||||
* damage the detector!!!\n
|
* damage the detector!!!\n
|
||||||
*/
|
*/
|
||||||
|
@ -1494,9 +1494,12 @@ void Detector::setStorageCellDelay(ns value, Positions pos) {
|
|||||||
std::vector<defs::gainMode> Detector::getGainModeList() const {
|
std::vector<defs::gainMode> Detector::getGainModeList() const {
|
||||||
switch (getDetectorType().squash()) {
|
switch (getDetectorType().squash()) {
|
||||||
case defs::JUNGFRAU:
|
case defs::JUNGFRAU:
|
||||||
return std::vector<defs::gainMode>{
|
return std::vector<defs::gainMode>{defs::DYNAMIC_GAIN_MODE,
|
||||||
defs::DYNAMIC_GAIN, defs::FORCE_SWITCH_G1, defs::FORCE_SWITCH_G2,
|
defs::FORCE_SWITCH_G1,
|
||||||
defs::FIX_G1, defs::FIX_G2, defs::FIX_G0};
|
defs::FORCE_SWITCH_G2,
|
||||||
|
defs::FIX_G1,
|
||||||
|
defs::FIX_G2,
|
||||||
|
defs::FIX_G0};
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw RuntimeError("Gain mode is not implemented for this detector.");
|
throw RuntimeError("Gain mode is not implemented for this detector.");
|
||||||
|
@ -416,12 +416,11 @@ typedef struct {
|
|||||||
enum vetoAlgorithm { DEFAULT_ALGORITHM };
|
enum vetoAlgorithm { DEFAULT_ALGORITHM };
|
||||||
|
|
||||||
enum gainMode {
|
enum gainMode {
|
||||||
DYNAMIC_GAIN,
|
DYNAMIC_GAIN_MODE,
|
||||||
FORCE_SWITCH_G1,
|
FORCE_SWITCH_G1,
|
||||||
FORCE_SWITCH_G2,
|
FORCE_SWITCH_G2,
|
||||||
FIX_G1,
|
FIX_G1,
|
||||||
FIX_G2,
|
FIX_G2,
|
||||||
FIX_G0,
|
|
||||||
FIX_G0
|
FIX_G0
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -583,7 +583,7 @@ std::string ToString(const defs::vetoAlgorithm s) {
|
|||||||
|
|
||||||
std::string ToString(const defs::gainMode s) {
|
std::string ToString(const defs::gainMode s) {
|
||||||
switch (s) {
|
switch (s) {
|
||||||
case defs::DYNAMIC_GAIN:
|
case defs::DYNAMIC_GAIN_MODE:
|
||||||
return std::string("dynamicgain");
|
return std::string("dynamicgain");
|
||||||
case defs::FORCE_SWITCH_G1:
|
case defs::FORCE_SWITCH_G1:
|
||||||
return std::string("forceswitchg1");
|
return std::string("forceswitchg1");
|
||||||
@ -987,7 +987,7 @@ template <> defs::vetoAlgorithm StringTo(const std::string &s) {
|
|||||||
|
|
||||||
template <> defs::gainMode StringTo(const std::string &s) {
|
template <> defs::gainMode StringTo(const std::string &s) {
|
||||||
if (s == "dynamicgain")
|
if (s == "dynamicgain")
|
||||||
return defs::DYNAMIC_GAIN;
|
return defs::DYNAMIC_GAIN_MODE;
|
||||||
if (s == "forceswitchg1")
|
if (s == "forceswitchg1")
|
||||||
return defs::FORCE_SWITCH_G1;
|
return defs::FORCE_SWITCH_G1;
|
||||||
if (s == "forceswitchg2")
|
if (s == "forceswitchg2")
|
||||||
|
Reference in New Issue
Block a user