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

@ -101,11 +101,11 @@ def test_module_size(virtual_jf_detectors):
def test_settings(virtual_jf_detectors):
d = ExperimentalDetector()
assert d.settings == detectorSettings.DYNAMICGAIN
assert d.settings == detectorSettings.GAIN0
gain_list = [
detectorSettings.DYNAMICHG0,
detectorSettings.DYNAMICGAIN,
detectorSettings.GAIN0,
detectorSettings.HIGHGAIN0,
]
# Set all viable gain for Jungfrau to make sure nothing is crashing
@ -113,14 +113,14 @@ def test_settings(virtual_jf_detectors):
d.settings = gain
assert d.settings == gain
d.setSettings(detectorSettings.DYNAMICGAIN, [1])
d.setSettings(detectorSettings.GAIN0, [1])
assert d.settings == [
detectorSettings.DYNAMICHG0,
detectorSettings.DYNAMICGAIN,
detectorSettings.GAIN0,
detectorSettings.HIGHGAIN0,
]
d.settings = detectorSettings.DYNAMICGAIN
assert d.settings == detectorSettings.DYNAMICGAIN
d.settings = detectorSettings.GAIN0
assert d.settings == detectorSettings.GAIN0
def test_frames(virtual_jf_detectors):
d = ExperimentalDetector()
@ -161,9 +161,12 @@ def test_gainmode(virtual_jf_detectors):
assert d.gainMode == gainMode.NORMAL_GAIN_MODE
gain_list = [
gainMode.NORMAL_GAIN_MODE,
gainMode.DYNAMIC_GAIN,
gainMode.FORCE_SWITCH_G1,
gainMode.FORCE_SWITCH_G2,
gainMode.FIX_G1,
gainMode.FIX_G2,
gainMode.FIX_G0
]
# Set all viable gain for Jungfrau to make sure nothing is crashing
@ -173,9 +176,12 @@ def test_gainmode(virtual_jf_detectors):
d.setGainMode(gainMode.FORCE_SWITCH_G1, [1])
assert d.gainMode == [
gainMode.NORMAL_GAIN_MODE,
gainMode.DYNAMIC_GAIN,
gainMode.FORCE_SWITCH_G1,
gainMode.FORCE_SWITCH_G2,
gainMode.FIX_G1,
gainMode.FIX_G2,
gainMode.FIX_G0
]
d.gainMode = gainMode.FORCE_SWITCH_G1

View File

@ -311,7 +311,7 @@ class Detector(CppDetectorApi):
-----
[Eiger] Use threshold command to load settings
[Jungfrau] DYNAMICGAIN, DYNAMICHG0 \n
[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, G2_LOWCAP_LOWGAIN, G4_HIGHGAIN, G4_LOWGAIN \n
@ -2201,8 +2201,8 @@ class Detector(CppDetectorApi):
[Jungfrau] Detector gain mode. Enum: gainMode
Note
-----
[Jungfrau] NORMAL_GAIN_MODE, 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!!!
[Jungfrau] 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!!!
"""
return element_if_equal(self.getGainMode())

View File

@ -210,7 +210,7 @@ void init_enums(py::module &m) {
.value("LOWGAIN", slsDetectorDefs::detectorSettings::LOWGAIN)
.value("MEDIUMGAIN", slsDetectorDefs::detectorSettings::MEDIUMGAIN)
.value("VERYHIGHGAIN", slsDetectorDefs::detectorSettings::VERYHIGHGAIN)
.value("DYNAMICHG0", slsDetectorDefs::detectorSettings::DYNAMICHG0)
.value("HIGHGAIN0", slsDetectorDefs::detectorSettings::HIGHGAIN0)
.value("FIXGAIN1", slsDetectorDefs::detectorSettings::FIXGAIN1)
.value("FIXGAIN2", slsDetectorDefs::detectorSettings::FIXGAIN2)
.value("VERYLOWGAIN", slsDetectorDefs::detectorSettings::VERYLOWGAIN)
@ -226,6 +226,7 @@ void init_enums(py::module &m) {
slsDetectorDefs::detectorSettings::G2_LOWCAP_LOWGAIN)
.value("G4_HIGHGAIN", slsDetectorDefs::detectorSettings::G4_HIGHGAIN)
.value("G4_LOWGAIN", slsDetectorDefs::detectorSettings::G4_LOWGAIN)
.value("GAIN0", slsDetectorDefs::detectorSettings::GAIN0)
.value("UNDEFINED", slsDetectorDefs::detectorSettings::UNDEFINED)
.value("UNINITIALIZED",
slsDetectorDefs::detectorSettings::UNINITIALIZED)
@ -307,8 +308,11 @@ void init_enums(py::module &m) {
.export_values();
py::enum_<slsDetectorDefs::gainMode>(Defs, "gainMode")
.value("NORMAL_GAIN_MODE", slsDetectorDefs::gainMode::NORMAL_GAIN_MODE)
.value("DYNAMIC_GAIN", slsDetectorDefs::gainMode::DYNAMIC_GAIN)
.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)
.value("FIX_G2", slsDetectorDefs::gainMode::FIX_G2)
.value("FIX_G0", slsDetectorDefs::gainMode::FIX_G0)
.export_values();
}