Classes

This section shows the different classes used in AERzip. Currently, there is only one class which is used to handle the compressed file header.

_images/AERzip_CompressedFileHeader.png
class AERzip.CompressedFileHeader.CompressedFileHeader(compressor=None, address_size=None, timestamp_size=None)

Bases: object

A CompressedFileHeader contains useful metadata for compressed files from AERzip. Thus, compressed files consist of a header and the recorded data (addresses and time stamps of the spikes).

The main fields of this header are the following:

  • library_version (string): A string indicating the library version.

  • compressor (string): A string indicating the compressor used.

  • address_size (int): An integer indicating the size of the addresses contained in the compressed file.

  • timestamp_size (int): An integer indicating the size of the timestamps contained in the compressed file.

  • header_end (string): The string that represents the end of the header. This is the string used in generic AEDAT files.

Each field has a specific size. Thus, the sum of the size of all these fields determines the total size of the header.

addOptional(data)

This function allows to insert data (in bytes) into the optional field of the header.

Parameters:

data (bytearray) – Data to insert into the optional

Raises:

MemoryError – It is not allowed to use this function when there is not enough space in the optional field.

Returns:

None

toBytes()

This function constructs a bytearray from the CompressedFileHeader object. This facilitates its storage in a compressed file.

Returns:

The CompressedFileHeader object as a bytearray.

Return type:

bytearray