nanover.recording.reading module

exception nanover.recording.reading.InvalidMagicNumber

Bases: Exception

The magic number read from a file is not the expected one.

The file may not be in the correct format, or it may be corrupted.

class nanover.recording.reading.Parseable(*args, **kwargs)

Bases: Protocol

ParseFromString(_: bytes) bytes
exception nanover.recording.reading.UnsupportedFormatVersion(format_version: int, supported_format_versions: tuple[int])

Bases: Exception

The version of the file format is not supported by the parser.

nanover.recording.reading.advance_to_first_coordinate_frame(frames: Iterable[Tuple[int, int, FrameData]])
nanover.recording.reading.advance_to_first_particle_frame(frames: Iterable[Tuple[int, int, FrameData]])
nanover.recording.reading.iter_recording_buffers(io: BinaryIO)

Iterate over elements of a recording, yielding pairs of a timestamp in microseconds and a buffer of bytes.

Parameters:

io – Stream of bytes to read.

nanover.recording.reading.iter_recording_entries(io: BinaryIO, message_type: Callable[[], TMessage])
nanover.recording.reading.iter_recording_files(*, traj: PathLike[str] | None = None, state: PathLike[str] | None = None)

Iterate one or both of trajectory and state recording files, yield a timestamp and one or both of frame and update that occurred at that instant. Frame index is included in frame data under the key “index”.

nanover.recording.reading.iter_state_file(path)

Iterate over all state updates in a recording file.

Parameters:

path – Path of recording file to read from.

nanover.recording.reading.iter_state_recording(io: BinaryIO)
nanover.recording.reading.iter_trajectory_file(path)

Iterate over all frame updates in a recording file.

Parameters:

path – Path of recording file to read from.

nanover.recording.reading.iter_trajectory_recording(io: BinaryIO)
nanover.recording.reading.iter_trajectory_with_elapsed_integrated(frames: Iterable[Tuple[int, int, FrameData]])
nanover.recording.reading.read(io: BinaryIO, count: int)
nanover.recording.reading.read_u128(io: BinaryIO)
nanover.recording.reading.read_u64(io: BinaryIO)