ravi — functions
PIX Connect recordings (.ravi) into SDK recordings (.mkv).
A .ravi is what PIX Connect 3 records. It stores energy counts and
rebuilds temperatures on playback from a header in every frame.
import_ravi does that once, with PIX Connect's own model, and
writes an ordinary SDK recording that
optris_sdk.camera.Camera.open_recording plays. PIX Connect's
measuring areas become regions.
inspect says whether a file will convert from a few hundred
kilobytes of it, whatever its size, so a folder of them can be sorted
before anything is converted::
from optris_sdk import ravi
info = ravi.inspect('old.ravi')
if info.verdict == ravi.RaviVerdict.CONVERTIBLE:
result = ravi.import_ravi(
'old.ravi', 'old.mkv',
progress=lambda p: print(f'pass {p.pass_number}: '
f'{p.frames_done}/{p.frames_total}'))
A .ravi stores when it started as the recording PC's local clock
showed it, with no time zone. Give that PC's zone as time_zone to
inspect, inspect_start_time and import_ravi: an
IANA name such as 'Europe/Berlin' (daylight saving time follows the
zone's rules for the recording's date), a zoneinfo.ZoneInfo, or
a fixed offset as a datetime.timedelta or
datetime.timezone. Without one, this computer's zone is used and
the recording says it was assumed; correct_start_time sets the
real one afterwards::
ravi.import_ravi('old.ravi', 'old.mkv', time_zone='Europe/Berlin')
Mirrors rec::InspectRavi() and rec::ImportRavi() in C++ and
optris_sdk_ravi_inspect() / optris_sdk_ravi_import() in C.
inspect(path, norm_directory = None, time_zone = None)
Say what a .ravi holds and whether it converts.
Reads a few hundred kilobytes whatever the file's size. Never
raises for a bad file: a missing, unreadable or foreign file is
RaviVerdict.UNREADABLE with the reason in detail.
- Parameter
path— the file. - Parameter
norm_directory— whereNorm-<n>.prnis, orNonefor the tables the SDK ships, which is right unless you mean to use others. - Parameter
time_zone— the recording PC's zone, forrecorded_at_utc(see the module's description);Nonefor this computer's. - Returns — a
RaviInfo. - Raises
InvalidArgumentError—time_zonenames a zone this computer's zone database does not have.
inspect_start_time(path, time_zone = None)
Say when a .ravi started: the recording PC's clock reading,
and that reading placed in time_zone.
Reads the first frame header only. Never raises for a bad file:
one that cannot be read, or records no start, gives an empty
recorded_at_local.
- Parameter
path— the file. - Parameter
time_zone— the recording PC's zone (see the module's description);Nonefor this computer's, andtime_zone_assumedthen says so. - Returns — a
RaviStartTime. - Raises
InvalidArgumentError—time_zonecannot be used.
correct_start_time(recording, time_zone = None, utc = None)
Set the time zone, and with it the UTC start, of a recording
converted from a .ravi.
For a recording converted without a zone, or with the wrong one. The
start is read again from the recording PC's clock reading the
conversion kept, and every place the recording states its start is
rewritten to match: optris_sdk.camera.Camera.playback_started_at,
optris_sdk.camera.Camera.playback_time_zone (which then
says corrected and no longer assumed) and the documents in
the recording. Works on recordings converted by any SDK release.
The recording is written again beside itself and renamed into place, so it needs free space for a second copy while this runs, and a failure leaves it as it was.
- Parameter
recording— the.mkvimport_raviwrote. - Parameter
time_zone— the recording PC's zone (see the module's description). - Parameter
utc— instead of a zone, the real start as an awaredatetime; the zone is then the fixed offset between the clock reading and it, to the minute. - Returns — the
RaviStartTimethe recording now states. - Raises
InvalidArgumentError— the recording was not converted from a.ravi(a recording of a camera states the known zone and start of the computer that made it), the zone cannot be used, or the recording is in several parts. - Raises
IoError— the recording cannot be read or rewritten.
inspect_frame_counts(path)
Say how many frames a .ravi declares, and in which header.
Reads the headers and the RIFF part headers, a few hundred
kilobytes whatever the file's size. Never raises for a bad
file: readable is then false.
- Parameter
path— the file. - Returns — a
RaviFrameCounts.
import_ravi(source, destination, norm_directory = None, allow_short_wave = False, clamp_to_range = False, frame_limit = 0, scan = True, per_frame_extras = True, progress = None, cancel = None, time_zone = None)
Convert a PIX Connect .ravi into an SDK recording.
Temperatures come from PIX Connect's own model, frame by frame,
from each frame's own header. The recording says when the original
was recorded (optris_sdk.camera.Camera.playback_started_at),
which camera made it when the file says so, and carries PIX
Connect's measuring areas as regions.
The recording is written beside destination under a temporary
name and moved into place when complete, so a failure or a cancel
leaves nothing at destination, and a file already there is
replaced only by a finished recording.
- Parameter
source— the.ravi. - Parameter
destination— the.mkvto write. - Parameter
norm_directory— as forinspect. - Parameter
allow_short_wave— convert a file whose verdict isRaviVerdict.SHORT_WAVEanyway, on the linear axis; see that verdict for what is then wrong. A short-wave recording PIX Connect's split axis is built for converts without it. - Parameter
clamp_to_range— clamp temperatures to the camera's range plus 26 K either side, as PIX Connect does when it plays the file. - Parameter
frame_limit— convert only the first N frames; 0 converts all. - Parameter
scan— read the file once first for the scene's temperature range.Falsehalves the work and records no range. - Parameter
per_frame_extras— keep each frame's PIX Connect extras -- the five-state shutter flag, NMEA position, process interface readings -- in the frame records. - Parameter
progress— called with aRaviImportProgressafter every frame of every pass, on the calling thread. Returning a true value cancels. An exception it raises cancels the import and is re-raised once the import has returned. - Parameter
cancel— an object withis_set()-- athreading.Event-- checked after every frame; set from any thread to cancel. - Parameter
time_zone— the zone the recording PC was in (see the module's description). The recording always states a UTC start and a zone. Without one, this computer's zone is used: the recording says the zone was assumed, the log warns, andcorrect_start_timesets it right afterwards. - Returns — a
RaviImportResult;cancelledsays whether it was stopped. - Raises
RaviDeclinedError— the file has no radiometric model, or its verdict isRaviVerdict.SHORT_WAVEandallow_short_waveis off. Not a failure:inspectsays which. - Raises
IoError— the source cannot be read or is not a.ravi, or the destination cannot be written. - Raises
InvalidArgumentError—time_zonecannot be used.