Snapshot
class optris_sdk.snapshot.Snapshot
A snapshot this SDK wrote, read into memory.
Opened with open and released by close, which is
what with does. The file is parsed once, at the open, and every
getter here answers from memory -- asking six questions about one
file reads it once rather than six times.
CSV is write-only. It carries no metadata document, so there is
nothing to read back and open says so rather than guessing.
Snapshot — properties
info
What the file says about its own capture.
A SnapshotInfo, exactly the type
optris_sdk.camera.Camera.save_snapshot takes, so a
round trip through disk is expressible in one type.
render
How the colorized picture in the file was drawn.
A SnapshotRender, or None when the file's primary
image is the 16-bit greyscale one -- a TIFF, or a PNG written
with no live view to take a picture from. That is routine
rather than an error, which is why it is None and not an
exception.
metadata_json
The full metadata document, as a str of JSON.
Everything SnapshotInfo carries and everything it does
not: the pixel scale, the scene statistics, the capture
telemetry, the measuring regions, the attachment index and any
extra_json the writer merged in.
encoding
What a pixel in this file means.
ENCODING_TEMPERATURE, ENCODING_RAW_ADU or
ENCODING_ENERGY, which decides whether to read the image
back with load_thermal or read_raw_pixels.
width
height
attachments
The files the application attached to this snapshot.
A list of Attachment, in the order they were written.
Their bytes are not read until something asks for them.
Not every file the snapshot carries. Three of the SDK's own are left out on purpose, each matched on name and MIME type so that an application which attached something of its own under one of those names keeps it:
thermal.png
On a colour snapshot, the measurement itself. It is the
image's data rather than a payload, and
load_thermal is how to reach it.
characteristic-curve.otc
The camera's characteristic curve.
radiometry.otc
The radiometry bundle.
So a file carrying nothing but those gives an empty list, and that is not a failure. An attachment list has always meant "the files I attached", and putting the SDK's own in front of them would shift every index and every count in code written before any of them existed.
All three stay in the file and stay in the attachments array
of metadata_json, which describes the container
literally -- so a reader that has never heard of this SDK sees
them, and so can you.
The curve and the bundle cannot be read back as data, here
or on any binding. What a file's curve is for is reached
instead by opening the snapshot with
optris_sdk.camera.Camera.open_still: the measurement is
then redone through the carried curve, which is what makes a
per-region emissivity and a different global emissivity work on
a still.
optris_sdk.camera.Camera.honours_region_emissivity says
whether this file carried one at all.
Snapshot — methods
open(cls, path)
Open a PNG or TIFF this SDK wrote.
Raises optris_sdk.errors.IoError when the file cannot
be read or an attachment fails the SHA-256 recorded for it, and
optris_sdk.errors.InvalidArgumentError when the file
carries no metadata document -- which is how a file from before
this format is recognised rather than guessed at.
load_thermal()
Read the temperatures back as a camera.Frame.
Exact for every temperature file this SDK writes: the internal
value that went in is the internal value that comes out. The
frame is yours -- close it, or use it as a context manager --
and it answers width, celsius, samples and
to_numpy like any other.
Raises optris_sdk.errors.NotSupportedError when the
file holds detector counts rather than temperature. Ask
encoding first, or read the counts with
read_raw_pixels.
read_raw_pixels()
Read uncalibrated detector counts back, bit for bit.
width * height counts, row-major. Raises
optris_sdk.errors.NotSupportedError when the file
holds temperature rather than raw counts -- reading one as the
other would hand back a plausible-looking grid of nonsense, so
it is refused instead.
close()
Release the handle. Closing twice is a no-op.