py_fort_hermes.file

This module provides a Context to read sequences of tracking file.

Through the file.open() function one can get a context to read hermes tracking data file sequences.

Example

import py_fort_hermes as fh

with fh.file.open('tracking.0000.hermes') as f:
    try:
        for ro in f:
            #do something with ro
    except fh.UnexpectedEndOfFileSequence as e:
        print("%s is corrupted"%e.segmentPath)
class py_fort_hermes.file.Context(filepath, followFile=True, allocateNewMessages=False)

A context manager class to open a sequence of hermes tracking file.

It is an iterable to be used in a for loop.

close()

Closes the context manager manually

py_fort_hermes.file.open(filepath, followFile=True, allocateNewMessages=False)

Opens a sequence of hermes tracking file.

Parameters
  • filepath – a path-like object to open

  • followFile (bool) – if True the sequence will be read until the last file, otherwise only filepath is read

  • allocateNewMessages (bool) – if True each call to next() will return a new FrameReadout. Otherwise, the same object will be Clear() and returned.

Returns

a context manager which is iterable

Return type

Context