diff --git a/src/calng/Gotthard2Correction.py b/src/calng/Gotthard2Correction.py index 31349457f00257633337ae5b79b6624fa6588bf1..49cd9e01a70e22280b9add36f1aee19a279bb052 100644 --- a/src/calng/Gotthard2Correction.py +++ b/src/calng/Gotthard2Correction.py @@ -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: diff --git a/src/calng/base_correction.py b/src/calng/base_correction.py index ddba44849f94570dd32c0c724a683b1500a8bfc0..111abe78e80c50cf3eaeb8fa77eca63d9a72ba42 100644 --- a/src/calng/base_correction.py +++ b/src/calng/base_correction.py @@ -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"):