tophu.BinaryFile

class tophu.BinaryFile(filepath, shape, dtype)

A raw binary file for storing array data.

Notes

This class does not store an open file object. Instead, the file is opened on-demand for reading or writing and closed immediately after each read/write operation. This allows multiple spawned processes to write to the file in coordination (as long as a suitable mutex is used to guard file access.)

Attributes
ndim

int : Number of array dimensions.

Methods

BinaryFile.__init__(filepath, shape, dtype)

Construct a new BinaryFile object.

BinaryFile.__getitem__(key, /)

Read a block of data.

Attributes

BinaryFile.ndim

Number of array dimensions.

BinaryFile.filepath

The file path.

BinaryFile.shape

Tuple of array dimensions.

BinaryFile.dtype

Data-type of the array's elements.