Skip to content
Snippets Groups Projects

JUNGFRAU: More user-friendly gain mode / gain setting parameters

Merged David Hammer requested to merge jungfrau-gainmode-enums into master
All threads resolved!
2 files
+ 23
16
Compare changes
  • Side-by-side
  • Inline
Files
2
@@ -2,13 +2,23 @@ import operator
from karabo.middlelayer import AccessMode, Assignment, String
from .. import base_condition
from ..corrections.JungfrauCorrection import GainModes, GainSettings
def settings_to_gain_setting(setting):
def gain_mode_translator(gain_mode_string):
if gain_mode_string in {"dynamic", "forceswitchg1", "forceswitchg2"}:
return GainModes.DYNAMIC_GAIN.name
elif gain_mode_string in {"fixg1", "fixg2"}:
return GainModes.FIXED_GAIN.name
else:
raise ValueError(f"Unknown gain mode {gain_mode_string}")
def gain_setting_translator(setting):
if setting == "gain0":
return "LOW_CDS"
return GainSettings.LOW_CDS.name
elif setting == "highgain0":
return "HIGH_CDS"
return GainSettings.HIGH_CDS.name
else:
raise ValueError(f"Unknown gain setting {setting}")
@@ -32,7 +42,7 @@ class JungfrauCondition(base_condition.ConditionBase):
lambda n: n * 1e6,
),
("highVoltage", "biasVoltage", operator.itemgetter(0)),
("settings", "gainSetting", settings_to_gain_setting),
("gainMode", "gainMode", None),
("settings", "gainSetting", gain_setting_translator),
("gainMode", "gainMode", gain_mode_translator),
]
}
Loading