nqm.irimager package¶
Module contents¶
Optris PI and XI imager IR camera controller
We use the IRImagerDirect SDK (see http://documentation.evocortex.com/libirimager2/html/index.html) to control these cameras.
- class nqm.irimager.IRImager¶
Bases:
pybind11_object
IRImager object - interfaces with a camera.
- get_frame(self: nqm.irimager.IRImager) tuple[numpy.ndarray[numpy.uint16[m, n]], datetime.datetime] ¶
Return a frame.
If the shutter is down (normally done automatically by the thermal camera for calibration), this function will wait until the shutter is back up, before returning (usually around ~1s).
- Throws:
RuntimeError if a frame cannot be loaded, e.g. if the camera isn’t streaming.
- Returns:
1. A 2-D matrix containing the image. This must be adjusted by
get_temp_range_decimal()
to get the actual temperature in degrees Celcius, offset from -100 ℃. 2. The approximate time the image was taken.- Return type:
A tuple containing
- get_frame_monotonic(self: nqm.irimager.IRImager) tuple[numpy.ndarray[numpy.uint16[m, n]], datetime.timedelta] ¶
Return a frame, with a monotonic/steady_clock timestamp.
Similar to
get_frame()
, except returns a monotonic timepoint that the IRImagerDirectSDK returns, which is more accurate.Please be aware that the epoch of the monotonic timepoint is undefined, and may be the time since last boot or the time since the program started.
- get_library_version(self: nqm.irimager.IRImager) str ¶
Get the version of the libirimager library.
- Returns:
the version of the libirmager library, or “MOCKED” if the library has been mocked.
- get_temp_range_decimal(self: nqm.irimager.IRImager) int ¶
The number of decimal places in the thermal data
For example, if
get_frame()
returns 19000, you can divide this number by 10 to the power of the result ofget_temp_range_decimal()
, then subtract 100, to get the actual temperature in degrees Celcius.
- start_streaming(self: nqm.irimager.IRImager) None ¶
Start video grabbing
Prefer using with irimager: … to automatically start/stop streaming on errors.
- Throws:
RuntimeError if streaming cannot be started, e.g. if the camera is not connected.
- stop_streaming(self: nqm.irimager.IRImager) None ¶
Stop video grabbing
- class nqm.irimager.IRImagerMock¶
Bases:
IRImager
Mocked version of IRImager.
This class can be used to return dummy data when there isn’t a camera connected (e.g. for testing).
- get_frame(self: nqm.irimager.IRImagerMock) tuple[numpy.ndarray[numpy.uint16[m, n]], datetime.datetime] ¶
Return a frame.
If the shutter is down (normally done automatically by the thermal camera for calibration), this function will wait until the shutter is back up, before returning (usually around ~1s).
- Throws:
RuntimeError if a frame cannot be loaded, e.g. if the camera isn’t streaming.
- Returns:
1. A 2-D matrix containing the image. This must be adjusted by
get_temp_range_decimal()
to get the actual temperature in degrees Celcius, offset from -100 ℃. 2. The approximate time the image was taken.- Return type:
A tuple containing
- get_frame_monotonic(self: nqm.irimager.IRImagerMock) tuple[numpy.ndarray[numpy.uint16[m, n]], datetime.timedelta] ¶
Return a frame, with a monotonic/steady_clock timestamp.
Similar to
get_frame()
, except returns a monotonic timepoint that the IRImagerDirectSDK returns, which is more accurate.Please be aware that the epoch of the monotonic timepoint is undefined, and may be the time since last boot or the time since the program started.
- get_temp_range_decimal(self: nqm.irimager.IRImagerMock) int ¶
The number of decimal places in the thermal data
For example, if
get_frame()
returns 19000, you can divide this number by 10 to the power of the result ofget_temp_range_decimal()
, then subtract 100, to get the actual temperature in degrees Celcius.
- start_streaming(self: nqm.irimager.IRImagerMock) None ¶
Start video grabbing
Prefer using with irimager: … to automatically start/stop streaming on errors.
- Throws:
RuntimeError if streaming cannot be started, e.g. if the camera is not connected.
- stop_streaming(self: nqm.irimager.IRImagerMock) None ¶
Stop video grabbing
- class nqm.irimager.Logger¶
Bases:
pybind11_object
Handles converting C++ logs to Python
logging.Logger
.After you instantiate an object of this class, all spdlogs will no longer be printed to
stderr
. Instead, they’ll go to callback you’ve defined, or alogging.Logger
.Additionally, evo::IRLogger logs will also be captured.
Only a single instance of this object can exist at a time. You must destroy existing instances to create a new instance.
- class nqm.irimager.LoggerContextManager¶
Bases:
pybind11_object
Context Manager around a Logger object.
Designed for use with Python’s
with
syntax.
- nqm.irimager.monotonic_to_system_clock(arg0: datetime.timedelta) datetime.datetime ¶
Converts from steady_clock to system_clock.
Converts a time_point from std::chrono::steady_clock (time since last boot) to std::chrono::system_clock (aka time since UNIX epoch).
C++20 has a function called std::chrono::clock_cast that will do this for us, but we’re stuck on C++17, so instead we have to do this imprecise monstrosity to do the conversion.
- Remark:
s This function is imprecise!!! Calling it multiple times with the same data will result in different results.
Warning
The monotonic/steady_clock might only count when the computer is powered on. E.g. if the system was in a sleep state, the monotonic time may not have increased. Because of this, you should not rely on this function to return accurate results for past time points.