poulet_py.converters.seq module#

class Seq(input_file, *, height=None, width=None, raw=False)[source]#

Bases: Seq

A sequence handler for FLIR thermal data with export capabilities.

Extends flirpy.io.seq.Seq to add NumPy, HDF5, and pickle serialization.

Parameters:
  • input_file (str | Path) – Path to the input SEQ file.

  • height (int, optional) – Force a specific image height. If None, uses the file’s metadata.

  • width (int, optional) – Force a specific image width. If None, uses the file’s metadata.

  • raw (bool, default=False) – If True, returns the raw bytes not Fff class.

__init__(input_file, *, height=None, width=None, raw=False)[source]#

Load a FLIR SEQ file. Currently this must be a SEQ file containing FFF files. The resulting object can be indexed as a normal array and will return the

to_list()[source]#

Convert the sequence to a list of frames.

Returns:

List of frames (as ndarray or bytes if unprocessed).

Return type:

list

to_numpy(*, dtype=None)[source]#

Convert the sequence to a NumPy array.

Parameters:

dtype (type, optional) – Desired data type for the output array (e.g., np.float32).

Returns:

Stacked frames as a 3D array (n_frames, height, width).

Return type:

ndarray

to_hdf(path, *, key, mode='w', dtype=None, complib=None, complevel=None, meta=None)[source]#

Save the sequence to an HDF5 file.

Parameters:
  • path (str | Path) – Output file path.

  • key (str) – HDF5 dataset name.

  • mode (str, default="w") – File mode (‘w’, ‘a’, ‘r+’, etc.).

  • dtype (type, optional) – Data type for the stored array.

  • complib (str, optional) – Compression library (e.g., ‘gzip’, ‘lzf’).

  • complevel (int, optional) – Compression level (1-9 for gzip).

  • meta (dict, optional) – Metadata to store as HDF5 attributes.

to_pickle(path, *, dtype=None, compression='infer', protocol=5)[source]#

Save the sequence to a pickle file using pandas’ I/O handler.

Parameters:
  • path (str | Path) – Output file path.

  • dtype (type, optional) – Data type for the array.

  • compression (str or dict, default 'infer') – For on-the-fly compression of the output data. If ‘infer’ and ‘path’ is path-like, then detect compression from the following extensions: ‘.gz’, ‘.bz2’, ‘.zip’, ‘.xz’, ‘.zst’, ‘.tar’, ‘.tar.gz’, ‘.tar.xz’ or ‘.tar.bz2’ (otherwise no compression). Set to None for no compression. Can also be a dict with key ‘method’ set to one of {‘zip’, ‘gzip’, ‘bz2’, ‘zstd’, ‘xz’, ‘tar’} and other key-value pairs are forwarded to zipfile.ZipFile, gzip.GzipFile, bz2.BZ2File, zstandard.ZstdCompressor, lzma.LZMAFile or tarfile.TarFile, respectively. As an example, the following could be passed for faster compression and to create a reproducible gzip archive: compression={‘method’: ‘gzip’, ‘compresslevel’: 1, ‘mtime’: 1}

  • protocol (int, default=HIGHEST_PROTOCOL) – Pickle protocol version.