Skip to content
Snippets Groups Projects
Commit 12d333b5 authored by David Hammer's avatar David Hammer
Browse files

Remove unnecessary handling of gain mode

Assuming the detector sends appropriate data.gain values in fixed gain mode(s),
the GPU kernel can just run as normal. Constants will include three gain stages
- fixed gain is purely a constant retrieval parameter.
parent cdfe2641
No related branches found
No related tags found
2 merge requests!12Snapshot: field test deployed version as of end of run 202201,!6Draft: add Jungfrau correction device
......@@ -17,23 +17,13 @@ from .base_correction import BaseCorrection, add_correction_step_schema
_pretend_pulse_table = np.arange(16, dtype=np.uint8)
class JungfrauConstants(enum.Enum):
Offset10Hz = enum.auto()
BadPixelsDark10Hz = enum.auto()
RelativeGain10Hz = enum.auto()
class JungfrauGainMode(enum.IntEnum):
# TODO: coordinate with pycalibration and check what is saved by control device
# gain stages: G0, G1, G2 (plus secret HG0 - high CDS)
dynamicgain = enum.auto() # default; uses G0-G2
dynamichg0 = enum.auto() # uses HG0, G1, G2
fixgain1 = enum.auto() # fix, use only G1
fixgain2 = enum.auto() # fix, use only G2
forceswitchg1 = enum.auto() # only for darks
forceswitchg2 = enum.auto() # only for darks
class CorrectionFlags(enum.IntFlag):
NONE = 0
OFFSET = 1
......@@ -55,7 +45,6 @@ class JungfrauGpuRunner(base_gpu.BaseGpuRunner):
output_data_dtype=cupy.float32,
bad_pixel_mask_value=cupy.nan,
burst_mode=False,
gain_mode=JungfrauGainMode.dynamicgain,
):
self.burst_mode = burst_mode
self.input_shape = (memory_cells, pixels_y, pixels_x)
......@@ -203,10 +192,15 @@ class JungfrauCalcatFriend(calcat_utils.BaseCalcatFriend):
STRING_ELEMENT(schema)
.key(f"{param_prefix}.gainMode")
.description("Gain mode (WIP)")
.displayedName("Gain mode")
.description(
"Detector may be operating in one of several gain modes. For this "
"device to query appropriate constants, it is sufficient to know "
"whether gain mode is dynamic or fixed."
)
.assignmentOptional()
.defaultValue("dynamicgain")
.options("dynamicgain,fixgain1,fixgain2")
.options("dynamicgain,fixedgain")
.commit(),
)
managed_keys.add(f"{param_prefix}.integrationTime")
......@@ -226,9 +220,9 @@ class JungfrauCalcatFriend(calcat_utils.BaseCalcatFriend):
res["Integration Time"] = self._get_param("integrationTime")
res["Sensor Temperature"] = self._get_param("sensorTemperature")
res["Gain Setting"] = self._get_param("gainSetting")
gain_mode = JungfrauGainMode[self._get_param("gainMode")]
if gain_mode != 0: #is not JungfrauGainMode.dynamicgain:
# TODO: figure out what to set
gain_mode = self._get_param("gainMode")
if gain_mode != "dynamicgain":
# NOTE: always include if CalCat is updated for this
res["Gain mode"] = 1
return res
......@@ -300,7 +294,6 @@ class JungfrauCorrection(BaseCorrection):
def __init__(self, config):
super().__init__(config)
# TODO: gain mode as constant parameter and / or device configuration
self.gain_mode = JungfrauGainMode[config.get("constantParameters.gainMode")]
try:
self.bad_pixel_mask_value = np.float32(
......@@ -310,7 +303,6 @@ class JungfrauCorrection(BaseCorrection):
self.bad_pixel_mask_value = np.float32("nan")
self._kernel_runner_init_args = {
"gain_mode": self.gain_mode,
"bad_pixel_mask_value": self.bad_pixel_mask_value,
"burst_mode": False, # TODO
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment