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

Allow replacing preview-breaking values for GH2 streak, too

parent e12c19d5
No related branches found
No related tags found
1 merge request!12Snapshot: field test deployed version as of end of run 202201
......@@ -2,6 +2,7 @@ import enum
import numpy as np
from karabo.bound import (
FLOAT_ELEMENT,
IMAGEDATA_ELEMENT,
KARABO_CLASSINFO,
NODE_ELEMENT,
......@@ -232,6 +233,14 @@ class Gotthard2Correction(BaseCorrection):
.key("preview.outputStreak")
.dataSchema(streak_preview_schema)
.commit(),
FLOAT_ELEMENT(expected)
.key("preview.replaceNanWith")
.displayedName("Replace streak NaNs by by")
.assignmentOptional()
.defaultValue(-1000)
.reconfigurable()
.commit(),
)
Gotthard2CalcatFriend.add_schema(expected, Gotthard2Correction._managed_keys)
......@@ -334,12 +343,16 @@ class Gotthard2Correction(BaseCorrection):
metadata,
)
# custom additional preview for this 1D detector
streak_preview = buffer_array.copy()
replacement = self.unsafe_get("preview.replaceNanWith")
streak_preview[np.isnan(streak_preview)] = replacement
streak_preview[np.isinf(streak_preview)] = replacement
self.writeChannel(
"preview.outputStreak",
Hash(
"image.data",
ImageData(
buffer_array,
streak_preview,
Dims(*buffer_array.shape),
Encoding.GRAY,
bitsPerPixel=32,
......
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