sdkinfo — functions
Facts about the SDK itself, none of which needs a camera.
Three questions, answered without opening anything:
Which build is this? build_info -- version, commit,
branch, build type and platform, in one call, which is what a
diagnostics bundle should record. optris_sdk.version answers
the version alone, for a caller that only wants to print it.
Is there a GPU, and if not, why not? gpu_info. The
"why not" is the half that is hard to get any other way: a
software-only adapter counts as no GPU, and without
unavailable_reason a caller cannot tell that from a machine with
no adapter at all.
How big is a model's sensor? sensor_dimensions, from the
model alone -- which is what you have before a camera is plugged in.
Use it rather than keeping your own table. The SDK held this one
privately until recently, so applications copied it, and a copy
drifts: one application's copy disagreed with the SDK on eleven
models and shipped every one of them.
build_info()
Which build of the SDK is loaded, as a BuildInfo.
Reads constants compiled into the library: it touches no camera, no file and no network, cannot block, and is safe to call from any thread at any time, including before the first camera is opened.
Put str(build_info()) in whatever a customer sends back. The
version alone does not identify a build -- two libraries stamped
12.0.0 can be different commits, and commit carrying
-dirty says the one in front of you was never committed at
all.
gpu_info()
What the SDK found to run the GPU pipeline on, as a
GpuInfo.
Needs no camera, and is the call to make before blaming a camera for running the CPU pipeline: a build without GPU support, a machine with no adapter and a machine whose only adapter is a software rasteriser all look identical from the frame rate alone, and want three different answers.
sensor_dimensions(device_type)
A camera model's native sensor size, without a camera.
enumerate_devices() reports the size of a camera that is
attached. This answers from the model alone, which is what you
have before one opens -- a placeholder for a camera that is not
plugged in, a window layout restored before enumeration ran, a
tile that should not jump to its real size when the camera
connects.
The sensor's size, which is not always the size of the frames
an open camera delivers: a camera opened in a clipped or binned
operation mode streams that mode's shape instead. Size a
placeholder from this, and read camera.width once it is open.
Raises optris_sdk.errors.NotSupportedError for a model
this SDK has no size for, DEVICE_UNKNOWN included. Use
try_sensor_dimensions where that is an ordinary answer
rather than a fault.
It never answers zero for an unknown model. The outputs are left untouched on failure, deliberately: the PI 1 answered 0 x 0 from this table for as long as the table existed, a simulated one streamed 160 x 120 regardless, and nothing anywhere noticed the two disagreed.
try_sensor_dimensions(device_type)
sensor_dimensions, or None if the SDK has no size.
For a caller holding a model it did not choose -- a restored layout, a stored configuration -- where "this SDK does not know that model" is a case to draw differently rather than a fault to report.
None rather than SensorDimensions(0, 0), so a caller
cannot mistake an unknown model for a zero-sized one.