OptrisOptrisDocumentation

Documentation/OTC SDK/optris_sdk — Python API referencev12.0

Detector

class optris_sdk.control.Detector

The sensor and its calibration: camera.detector.

Auto-NUC is the shutter calibration schedule. The camera closes its shutter, takes a uniform reference and corrects the sensor's per-pixel drift against it. Frames keep arriving while that happens: the SDK delivers the last good frame again, marked is_repeated_frame. The calibration a camera runs when it starts has no good frame to repeat, so its frames are delivered with thermal_data_reliable False instead, and are not measurements.

Detector — properties

nuc_in_progress

Whether the shutter is closed for a calibration right now.

chip_heating

The chip heating mode and its setpoint, as a pair.

The setpoint is in the SDK's temperature unit (Celsius unless optris_sdk.set_temperature_unit chose Fahrenheit), and NaN in every mode but CHIP_HEATING_FIXED.

flag_while_recording

The while-recording policy and its drift override, as a pair.

The override is a temperature difference in degrees of the SDK's temperature unit, as set_flag_while_recording takes it.

Read back from what was applied, so a policy this build does not recognise reads as FLAG_WHILE_RECORDING_USE rather than as itself -- which is also how the scheduler treats it.

shutter_deferral

What the while-recording policy is doing, and what it cost.

Returns the optris_sdk_shutter_deferral record. policy_in_force is the field to read first: it is zero when no recording is running, when the policy is "use the flag", when the automatic schedule is off, and while a process interface owns the flag -- that last being the case where a setting that was accepted does nothing at all. Ask camera.shutter_externally_controlled to tell it apart.

deferring_now marks the degraded frames. drift_c is how far the detector has moved from the reference those frames are corrected against, and peak_drift_c is the worst it reached over the recording -- kept after the recording stops, so it can be read once the file is closed. Both are temperature differences in degrees of the SDK's temperature unit (kelvin-sized in Celsius, Fahrenheit-sized in Fahrenheit).

recorded_flag_policy

What a recording says its shutter was told to do.

For a playback handle. None when the recording declares no policy, which for this metadata means the shutter was not held back -- the block is omitted entirely at the default policy, and every recording written before the setting existed is in that position.

Returns the optris_sdk_recorded_flag_policy record: the policy and its override from the file header, plus held and drift_c from the frame most recently delivered. A set held means that frame's temperatures are degraded by roughly drift_c, permanently. The override and drift_c are temperature differences in degrees of the SDK's temperature unit.

recorded_gap

Whether this frame is on the far side of a hole in the recording.

For a playback handle. That you get a value at all is the fact: the frames either side of the frame most recently delivered are not contiguous, because the camera stopped delivering in between. Two things put such a hole into a file -- a recording held open across a reconnect (RecordingOptions.hold_open_across_reconnect), and an armed pre-roll that spanned an outage.

Per frame, like recorded_render, so a replay has to be at the frame to see it. There is no file-level half to fall back to: a recording's metadata document is written before its first frame and cannot describe anything that happens afterwards.

None when this frame carries no marker, which is the complete answer rather than an absence -- the join here is sound. Every frame of a recording that ran without an outage is in that position, as is every frame of every recording written before this metadata existed.

Returns a optris_sdk.recording.RecordedGap, whose before_us is None rather than 0 when the SDK had no earlier frame to name: 0 is a legitimate capture time.

auto_nuc

What set_auto_nuc set, as it is in force.

A dict with enabled, min_interval_s, max_interval_s and temp_drift_threshold_c. Authoritative rather than remembered: the schedule is the SDK's own and never leaves this process, so what the SDK holds is what is being applied.

max_interval_s of 0 means no ceiling, and 0 is the default -- a camera therefore has no upper bound on its own. temp_drift_threshold_c is a temperature difference in degrees of the SDK's temperature unit, as set_auto_nuc takes it: 0.1 on a camera nobody configured, which reads 0.18 in Fahrenheit.

This exists because the drift threshold had no reader at all: it could be set and never read, so a settings page could only show the last value it had written and could not tell when that stopped being true.

  • Raises ~optris_sdk.errors.NotConnectedError — while no camera is open. The engine reports a zero drift threshold then, and zero is not a threshold a camera can run -- it would fire on every frame -- so it is refused as an answer rather than passed on.
  • Raises ~optris_sdk.errors.NotSupportedError — on a recording or a still.

auto_flag_enabled

Whether the camera closes its shutter on its own schedule.

flag_interval

The shutter interval in force, as (min_s, max_s).

A maximum of 0 is what a camera nobody configures reports, and it means no ceiling rather than a ceiling of zero seconds. A minimum of 0 means the drift arm is off. Both are writable back through set_flag_interval, which is the point: a plain comparison in the setter used to refuse the (12, 0) every camera reports, so the interval that had just been read could not be written back.

Authoritative rather than remembered, and not affected by anything a second client does, because the schedule never leaves this process.

Distinct from the camera's own autonomous shutter schedule, which is stored in the camera, survives a power cycle, and is not reachable through this ABI at all.

flag_forecast_enabled

Whether the drift compensation between cycles is on.

On unless something switched it off.

flag_open

Whether the shutter is open right now.

Open alone, not "not shut": a shutter on its way is not an open one, so this is False across the travelling edges as well as the closed window.

Answers for one instant and says nothing about when it changed. To follow the shutter -- the transitions, with timestamps -- use on_shutter. Takes a recording as well as a camera: the shutter state is in every frame's own record and the player replays it.

shutter_externally_controlled

Whether the flag belongs to a process-interface input rather than to the SDK.

True while any PIF input is configured as shutter control. The camera firmware then drives the flag from that pin, and for as long as it does the SDK runs no cycle of its own -- no automatic cycle, whatever auto_nuc says, and no startup calibration cycle -- while trigger_shutter refuses. Every closure the interface makes is still reported through on_shutter and still produces a correction.

So this does not mean the shutter is disabled. It means somebody else decides when, which is the point of the feature: a closure interrupts the measurement, and only the process knows when that is safe.

Ask this rather than inferring it from the channel table you sent: it answers from what was actually applied to the camera, so it cannot disagree with the behaviour, and it survives a reconnect. False for a simulated camera and for a recording -- neither has an interface to hand the flag to.

last_nuc_cycle

What the SDK's most recent own shutter cycle measured, as a NucCycleReport.

sequence == 0 means no cycle has been reported on this camera yet, which is also the answer for a simulated camera, for a recording, and for a camera on which every cycle so far was abandoned rather than decided. That is an answer, not a failure, and the call succeeds in all of those cases.

Read delivery_share only when it is not None. A share of 0 means the camera could not be measured, not that no frames arrived, and the SDK itself reads an unmeasurable camera as a share of 1 -- so the two cases mean opposite things about whether a short cycle was the host's fault, and only the absence tells them apart. That is why this reports None rather than 0.

last_shutter_correction

What came of the most recent closure the process interface made, as a ShutterCorrectionEvent.

sequence == 0 means no closure has been reported on this camera yet, which is also the answer for a camera whose flag no interface has taken, for a simulated camera and for a recording. The call succeeds in all of those cases.

reference_temperature

The reference-body correction in force, as a ReferenceCorrection.

active is False both for a source with no correction set and for one that cannot carry one. Those are different situations, and reference_correction_support is the query that separates them.

reference_correction_support

Whether this source can be corrected against a reference body, as one of the REFERENCE_CORRECTION_* constants.

REFERENCE_CORRECTION_UNKNOWN for a camera that is not open. Treat only REFERENCE_CORRECTION_SUPPORTED as support: anything else means the control should be hidden.

reference_correction_diagnosis

Why this source cannot be corrected, in words, when it cannot. Empty when it can.

Detector — methods

set_auto_nuc(enabled = True, min_interval_s = None, max_interval_s = None, temp_drift_threshold_c = None)

Schedule the shutter calibration.

A field left as None keeps the SDK's default for it. Unlike the C++ whole-record setter this takes the fields one at a time, because the flat ABI does too -- there is no NUC record to read, change and write back.

  • Parameter min_interval_s — never recalibrate more often than this.
  • Parameter max_interval_s — always recalibrate at least this often.
  • Parameter temp_drift_threshold_c — once the minimum interval has elapsed, a correction is due as soon as an internal probe has moved this far since the last one. Higher means fewer interruptions and more drift between corrections. A temperature difference in degrees of the SDK's temperature unit (kelvin-sized in Celsius, Fahrenheit-sized in Fahrenheit), with no offset.

set_chip_heating(mode, setpoint_c = 0.0)

Hold the sensor at a temperature, or let it float.

setpoint_c is the target for CHIP_HEATING_FIXED, in the SDK's temperature unit (Celsius unless optris_sdk.set_temperature_unit chose Fahrenheit), and is ignored in the other modes.

set_flag_while_recording(policy, override_drift_c = 0.0)

Choose what a running recording does to the shutter.

A shutter cycle interrupts the measurement for about a second. Avoiding it during a recording buys an unbroken stream and pays in drift -- and a recording stores finished temperatures, so that drift is in the file permanently and no replay removes it. Watch shutter_deferral to see what it is costing, and read the recording's own flag_policy metadata afterwards.

  • Parameter policy — one of FLAG_WHILE_RECORDING_USE (the default, and what every camera has always done), FLAG_WHILE_RECORDING_AVOID or FLAG_WHILE_RECORDING_AVOID_UNLESS_DRIFT.
  • Parameter override_drift_c — for the last of those, the drift past which a correction happens anyway: a temperature difference in degrees of the SDK's temperature unit (kelvin-sized in Celsius, Fahrenheit-sized in Fahrenheit), with no offset. Must be above zero for that policy and is ignored by the other two.

set_flag_interval(min_seconds, max_seconds)

The shortest and longest the camera waits between cycles.

min_seconds is the drift arm's lockout: no drift-triggered cycle until this much time has passed since the last one, and 0 switches the drift arm off so only the ceiling can start one. max_seconds is the ceiling: a cycle is forced once this much time has passed whether or not anything drifted, and 0 means no ceiling.

Both at 0 means no automatic cycle at all, although auto_flag_enabled still reports True -- the schedule is on and neither arm can fire.

  • Raises ~optris_sdk.errors.InvalidArgumentError — when min_seconds exceeds max_seconds and max_seconds is above 0. The maximum is excluded from the comparison at 0 because 0 is not a ceiling of zero seconds. An inverted pair with a real ceiling, such as (90, 9), is still refused: it runs a fixed 9 s timer and never consults drift.

trigger_shutter()

Close and reopen the shutter now, and re-reference the detector from it.

This is the non-uniformity correction. The two are one operation on this hardware: the shutter closes over the detector, the host builds a per-pixel offset table from the frames captured while it is closed, and the shutter reopens. There is no camera command that corrects without moving the flag -- the firmware does not compute a correction at all -- so an application offering explicit control needs one button, not two. There was a perform_nuc beside this until API version 30, calling the identical code under a second name.

The frames during a cycle are not measurements: the camera is looking at its own flag, and they say so through Frame.flag_open.

skip_startup_calibration()

Skip the calibration a camera runs when it starts.

The frames during it are unreliable and the SDK says so. Skipping gets a picture sooner and gets worse numbers until the camera has settled.

It also delays the first reliable frame, by more than it saves. The startup calibration commands three shutter cycles of its own, and the detector-settling criterion needs two references it can compare before it will say the detector has stopped moving. Measured on an Xi 410, warm: first frame with reliable thermal data at 20.9 s without skipping and 231.7 s with it. If you need a measurement, do not skip.

It does not have to be called before start; called while the calibration is running it ends it there.

  • Raises ~optris_sdk.errors.NotSupportedError — if the camera will not -- which includes a calibration that has already finished, because there is then nothing to skip.

set_reference_temperature(reference_c, measured_c, ambient_c = None)

Correct the whole scale against a known temperature.

The correction is folded into the camera's energy-to-temperature table, so every temperature the pipeline reports -- pixels, spots, regions and the recorded stream alike -- is corrected by one act.

Ask reference_correction_support first and hide the control when it is not REFERENCE_CORRECTION_SUPPORTED, rather than discovering the refusal by making this call. Through version 12.0 this returned success and applied no correction at all, with no getter that could contradict it; there is one now.

Which fit is applied is chosen when the table is next rebuilt, from how far the reference is from the shutter temperature, so this call cannot report it; reference_temperature's gain_fit reports what was applied.

  • Parameter reference_c — what the reference body really is, in the SDK's temperature unit (Celsius unless optris_sdk.set_temperature_unit chose Fahrenheit). Must be above -100, in either unit: -100 is the SDK's no-temperature marker, not a temperature.
  • Parameter measured_c — what the camera reads there now, in the same unit. Must be above -100.
  • Parameter ambient_c — the air temperature at the reference, in the same unit, or None to leave the camera to estimate it. Not inert, and the default is not neutral: a value pins the ambient temperature, and on a camera whose ambient is pinned passing None moves every reported temperature by itself, on top of the correction. Pass the ambient you are already using to change only the correction.
  • Raises ~optris_sdk.errors.NotSupportedError — when this source cannot be corrected.
  • Raises ~optris_sdk.errors.InvalidArgumentError — when either temperature is -100 or below.

reset_reference_temperature()

Discard that correction and go back to the camera's own scale.

Rebuilds the table without the correction, so temperatures move back on the next frame rather than at the next shutter cycle.

  • Raises ~optris_sdk.errors.NotSupportedError — when this source could never have carried a correction. Clearing one that was never possible is not success.

on_shutter(handler)

Call handler(ShutterEvent) on every shutter transition.

This is how to follow the shutter. flag_open answers for one instant and says nothing about when it changed, and the frames taken while the shutter is shut are not measurements -- so an application that must not present one needs the transition, not a poll.

Fires on an SDK thread. Every rule in optris_sdk.callbacks applies.

on_nuc_cycle(handler)

Call handler(NucCycleReport) when a shutter cycle ends.

The push half of last_nuc_cycle, and the one to use if the outcome matters: a cycle that was discarded for too few frames leaves the previous correction in force, and polling can miss that it happened at all.

Fires on an SDK thread. Every rule in optris_sdk.callbacks applies.

on_shutter_correction(handler)

Call handler(ShutterCorrectionEvent) when a closure the process interface made produces a correction.

Distinct from on_nuc_cycle, which reports the SDK's own cycles. While the flag belongs to a PIF input the SDK runs no cycle of its own -- see shutter_externally_controlled -- so this is the only report of a correction on such a camera.

Fires on an SDK thread. Every rule in optris_sdk.callbacks applies.