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

GOTTHARD2 streak-style preview, disable cell index warnings

parent f9673310
No related branches found
No related tags found
1 merge request!12Snapshot: field test deployed version as of end of run 202201
......@@ -9,6 +9,9 @@ from karabo.bound import (
OVERWRITE_ELEMENT,
UINT64_ELEMENT,
VECTOR_STRING_ELEMENT,
Dims,
Encoding,
Hash,
ImageData,
Schema,
)
......@@ -196,6 +199,7 @@ class Gotthard2Correction(BaseCorrection):
_managed_keys = BaseCorrection._managed_keys.copy()
_image_data_path = "data.adc"
_cell_table_path = "data.memoryCell"
_warn_memory_cell_range = False # for now, receiver always writes 255
@staticmethod
def expectedParameters(expected):
......@@ -328,6 +332,21 @@ class Gotthard2Correction(BaseCorrection):
),
metadata,
)
# custom additional preview for this 1D detector
self.writeChannel(
"preview.outputStreak",
Hash(
"image.data",
ImageData(
buffer_array,
Dims(*buffer_array.shape),
Encoding.GRAY,
bitsPerPixel=32,
),
"trainId",
train_id,
),
)
def _load_constant_to_runner(self, constant, constant_data):
if constant is Gotthard2Constants.Lut:
......
......@@ -196,6 +196,7 @@ class BaseCorrection(PythonDevice):
} # subclass can extend this, /must/ put it in schema as managedKeys
_image_data_path = "image.data" # customize for *some* subclasses
_cell_table_path = "image.cellId"
_warn_memory_cell_range = True # can be disabled for some detectors
def _load_constant_to_runner(self, constant_name, constant_data):
"""Subclass must define how to process constants into correction maps and store
......@@ -970,7 +971,11 @@ class BaseCorrection(PythonDevice):
train_id = metadata.getAttribute("timestamp", "tid")
self._train_ratio_tracker.update(train_id)
if self.unsafe_get("constantParameters.memoryCells") <= cell_table.max():
if (
self._warn_memory_cell_range
and self.unsafe_get("constantParameters.memoryCells")
<= cell_table.max()
):
self.log_status_warn("Input cell IDs out of range of constants")
if cell_table.size != self.unsafe_get("dataFormat.memoryCells"):
......
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