Device Module

Thermal Device Manager

Manages the thermal camera device initialization by starting pythermal-recorder in a separate process and providing access to thermal data via shared memory.

class pythermal.core.device.ThermalDevice(native_dir: str | None = None, device_index: int | None = None)[source]

Bases: object

Manages thermal camera device initialization and shared memory access.

This class starts the pythermal-recorder process in the background and provides access to thermal data through the shared memory interface.

__init__(native_dir: str | None = None, device_index: int | None = None)[source]

Initialize thermal device manager.

Parameters:
  • native_dir – Optional path to native directory containing pythermal-recorder. If None, uses default package location.

  • device_index – Index of the USB device to use (0 for first device, 1 for second, etc.). If None, uses the smallest available device ID from the mapping file. Default is None. Each device uses a separate shared memory segment.

start(timeout: float = 10.0) bool[source]

Start the thermal recorder process and initialize shared memory.

Parameters:

timeout – Maximum time to wait for shared memory to become available (seconds)

Returns:

True if successful, False otherwise

stop()[source]

Stop the thermal recorder process and cleanup resources.

is_running() bool[source]

Check if the thermal recorder is running.

get_shared_memory() ThermalSharedMemory[source]

Get the shared memory reader instance.

Returns:

ThermalSharedMemory instance for reading thermal data

cleanup()[source]

Cleanup resources (called automatically on exit).