Skip to content

BaseCorrection

Base classes: PythonDevice

dataInput

InputChannel

Fast data sources (fastSources)

Type
VECTOR_STRING
Access mode
INITONLY
Assignment
OPTIONAL
Description
Sources to get data from. Only incoming hashes from these sources will be processed. This will typically be a single entry of the form: '[instrument]DET[detector]/DET/[channel]:xtdf'.
Default value
[]

Frame filter (frameFilter)

The frame filter - if set - slices the input data. Frames not in the filter will be discarded before any processing happens and will not get to dataOutput or preview. Note that this filter goes by frame index rather than cell ID or pulse ID; set accordingly. Handle with care - an invalid filter can prevent all processing. How the filter is specified depends on frameFilter.type. See frameFilter.current to inspect the currently set frame filter array (if any).

Type (frameFilter.type)

Type
STRING
Access mode
RECONFIGURABLE
Assignment
OPTIONAL
Description
Controls how frameFilter.spec is used. The default value of 'none' means that no filter is set (regardless of frameFilter.spec). 'arange' allows between one and three integers separated by ',' which are parsed and passed directly to numpy.arange. 'commaseparated' reads a list of integers separated by commas.
Options:
none, range, commaseparated
Default value
none

Specification (frameFilter.spec)

Type
STRING
Access mode
RECONFIGURABLE
Assignment
OPTIONAL
Default value
empty string

Current filter (frameFilter.current)

Type
VECTOR_UINT32
Access mode
READONLY
Assignment
OPTIONAL
Description
This read-only value is used to display the contents of the current frame filter. An empty array means no filtering is done.
Default value
[]

Output buffer size limit (outputShmemBufferSize)

Type
UINT32
Access mode
INITONLY
Assignment
OPTIONAL
Description
Corrected trains are written to shared memory locations. These are pre-allocated and re-used (circular buffer). This parameter determines how much memory to set aside for that buffer.
Default value
10

Standalone mode (useShmemHandles)

Type
BOOL
Access mode
INITONLY
Assignment
OPTIONAL
Description
If enabled, full corrected data (not using shared memory handles) will be sent on main output and preview outputs will be configured to be suitable for use directly into Karabo GUI rather than through an assembler.
Default value
True

Use infiniband (useInfiniband)

Type
BOOL
Access mode
INITONLY
Assignment
OPTIONAL
Description
If enabled, device will during initialization try to bind its main data output channel (dataOutput) to its node's infiniband interface. Default interface is used if no 'ib0' interface is found.
Default value
True

Data format (in/out) (dataFormat)

Input image data dtype (dataFormat.inputImageDtype)

Type
STRING
Access mode
READONLY
Assignment
OPTIONAL
Description
The (numpy) dtype to expect for incoming image data.
Default value
uint16

Output image data dtype (dataFormat.outputImageDtype)

Type
STRING
Access mode
RECONFIGURABLE
Assignment
OPTIONAL
Description
The (numpy) dtype to use for outgoing image data. Input is cast to float32, corrections are applied, and only then will the result be cast to outputImageDtype. Be aware that casting to integer type causes truncation rather than rounding.
Options:
float16, float32, uint16
Default value
float32

Pixels x (dataFormat.pixelsX)

Type
UINT32
Access mode
INITONLY
Assignment
OPTIONAL
Description
Number of pixels of image data along X axis
Default value
512

Pixels y (dataFormat.pixelsY)

Type
UINT32
Access mode
INITONLY
Assignment
OPTIONAL
Description
Number of pixels of image data along Y axis
Default value
128

Frames (dataFormat.frames)

Type
UINT32
Access mode
INITONLY
Assignment
OPTIONAL
Description
Number of image frames per train in incoming data
Default value
1

Frames after filter (dataFormat.filteredFrames)

Type
UINT32
Access mode
READONLY
Assignment
OPTIONAL
Description
Number of frames left after applying frame filter
Default value
0

Output axis order (dataFormat.outputAxisOrder)

Type
STRING
Access mode
RECONFIGURABLE
Assignment
OPTIONAL
Description
Axes of main data output can be reordered after correction. Axis order is specified as string consisting of 'x', 'y', and 'f', with the latter indicating the image frame. The default value of 'fxy' puts pixels on the fast axes.
Options:
fxy, fyx, xfy, xyf, yfx, yxf
Default value
fxy

Input data shape (dataFormat.inputDataShape)

Type
VECTOR_UINT32
Access mode
READONLY
Assignment
OPTIONAL
Description
Image data shape in incoming data (from reader / DAQ). This value is computed from pixelsX, pixelsY, and frames - this field just shows what is currently expected.
Default value
[]

Output data shape (dataFormat.outputDataShape)

Type
VECTOR_UINT32
Access mode
READONLY
Assignment
OPTIONAL
Description
Image data shape for data output from this device. This value is computed from pixelsX, pixelsY, and the size of the frame filter - this field just shows what is currently expected.
Default value
[]

dataFormat.cellId

Type
VECTOR_UINT32
Access mode
READONLY
Assignment
OPTIONAL
Default value
[]

dataFormat.pulseId

Type
VECTOR_UINT32
Access mode
READONLY
Assignment
OPTIONAL
Default value
[]

Workarounds (workarounds)

Override input axis order (workarounds.overrideInputAxisOrder)

Type
BOOL
Access mode
RECONFIGURABLE
Assignment
OPTIONAL
Description
The shape of the image data ndarray as received from the DataAggregator is sometimes wrong - the axes are actually in a different order than the ndarray shape suggests. If this flag is on, the shape of the ndarray will be overridden with the axis order which was expected.
Default value
True

Spurious future train ID threshold (workarounds.trainFromFutureThreshold)

Type
UINT64
Access mode
RECONFIGURABLE
Assignment
OPTIONAL
Description
Some detectors occasionally send a train with incorrect and much too large train ID. To avoid these 'future trains' from interfering with train matching, use this threshold to discard them immediately. If a train arrives with an ID which exceeds the current train ID from the time server by more than this threshold, the train is ignored.
Default value
10000

Load most recent constants (loadMostRecentConstants)

Type
Slot
Access mode
RECONFIGURABLE
Description
Calling this slot will flush all constant buffers and cause the device to start querying CalCat for the most recent constants (all constants applicable for this device) available with the currently set constant parameters. This should typically be called after instantiating pipeline, after changing parameters, or after generating new constants.

inputDataState

Type
STRING
Access mode
READONLY
Assignment
OPTIONAL
Default value
NORMAL

deviceInternalsState

Type
STRING
Access mode
READONLY
Assignment
OPTIONAL
Default value
NORMAL

processingState

Type
STRING
Access mode
READONLY
Assignment
OPTIONAL
Default value
NORMAL

Preview (preview)

Index (or stat) for preview (preview.index)

Type
INT32
Access mode
RECONFIGURABLE
Assignment
OPTIONAL
Description
If this value is ≥ 0, the corresponding index (frame, cell, or pulse) will be sliced for the preview output. If this value is < 0, preview will be one of the following stats: -1: max, -2: mean, -3: sum, -4: stdev. These stats are computed across frames, ignoring NaN values.
Default value
0

Index selection mode (preview.selectionMode)

Type
STRING
Access mode
RECONFIGURABLE
Assignment
OPTIONAL
Description
The value of preview.index can be used in multiple ways, controlled by this value. If this is set to 'frame', preview.index is sliced directly from data. If 'cell' (or 'pulse') is selected, I will look at cell (or pulse) table for the requested cell (or pulse ID). Special (stat) index values <0 are not affected by this.
Options:
frame, cell, pulse
Default value
frame

Train ID (trainId)

Type
UINT64
Access mode
READONLY
Assignment
OPTIONAL
Description
ID of latest train processed by this device.
Default value
0

Performance measures (performance)

Processing time (performance.processingTime)

Type
DOUBLE
Access mode
READONLY
Assignment
OPTIONAL
Default value
0.0

Rate (performance.rate)

Type
DOUBLE
Access mode
READONLY
Assignment
OPTIONAL
Description
Actual rate with which this device gets, processes, and sends trains. This is a simple windowed moving average.
Default value
0.0

Input delay (performance.inputDelay)

Type
DOUBLE
Access mode
READONLY
Assignment
OPTIONAL
Description
Measured delay on the input channel. Measured by difference between 'now' and timestamp in input metadata.
Default value
0.0

performance.ratioOfRecentTrainsReceived

Type
DOUBLE
Access mode
READONLY
Assignment
OPTIONAL
Description
Of the latest trains (from last received train, going back [some buffer range]), how many did we receive? This estimate is updated when new trains come in, so is unreliable if nothing is coming at all.
Default value
0.0

Correction steps (corrections)

Access mode
RECONFIGURABLE

warningLamps

Type
VECTOR_STRING
Access mode
INITONLY
Assignment
OPTIONAL
Default value
['deviceInternalsState', 'inputDataState', 'processingState']