photon_mosaic.core.binaryimaging#

Classes

BinaryFolderImaging(folder_path)

BinaryFolderImaging is an internal format used in photon-mosaic.

BinaryImaging(file_paths, ...[, t_starts, ...])

ImagingExtractor for a binary format

BinaryImagingEpoch(file_path, ...)

read_binary

read_binary_folder

class photon_mosaic.core.binaryimaging.BinaryImaging(file_paths, sampling_frequency, shape, dtype, t_starts=None, file_offset=0, file_timestamps_paths=None)[source]#

ImagingExtractor for a binary format

Parameters:
  • file_paths (str or Path or list) – Path to the binary file

  • sampling_frequency (float) – The sampling frequency

  • shape (tuple(int, int) | tuple(int, int, int)) – Image height, width, and optionally number of planes

  • dtype (str or dtype) – The dtype of the binary file

  • t_starts (None or list of float, default: None) – Times in seconds of the first sample for each epoch. If None, defaults to 0 for all epochs.

  • file_offset (int, default: 0) – Number of bytes in the file to offset by during memmap instantiation.

  • file_timestamps_paths (str | Path | list[str | Path] | None) – Path to the binary file containing timestamps for each segment. If None, timestamps are not loaded

Returns:

imaging – The imaging object

Return type:

BinaryImaging

Methods

get_binary_description()

When imaging.is_binary_compatible() is True this returns a dictionary describing the binary format.

is_binary_compatible()

Checks if the imaging object is "binary" compatible.

is_binary_compatible()[source]#

Checks if the imaging object is “binary” compatible. To be used before calling imaging.get_binary_description()

Returns:

True if the underlying imaging object is binary

Return type:

bool

get_binary_description()[source]#

When imaging.is_binary_compatible() is True this returns a dictionary describing the binary format.

class photon_mosaic.core.binaryimaging.BinaryImagingEpoch(file_path, sampling_frequency, t_start, shape, dtype, file_offset, file_timestamps_path)[source]#

Methods

get_num_samples()

Returns the number of samples in this signal block

get_series(start_frame, end_frame[, ...])

Return the raw series, optionally for a subset of samples

get_num_samples()[source]#

Returns the number of samples in this signal block

Returns:

Number of samples in the signal block

Return type:

int

get_series(start_frame, end_frame, plane_indices=None)[source]#

Return the raw series, optionally for a subset of samples

Parameters:
  • start_frame (int) – start sample index, or zero if None

  • end_frame (int) – end_sample, or number of samples if None

  • plane_indices (slice | ndarray | None) – List of plane indices to include, or all planes if None

Returns:

series – Array of series, num_samples x height x width

Return type:

ndarray

photon_mosaic.core.binaryimaging.read_binary#

alias of BinaryImaging

class photon_mosaic.core.binaryimaging.BinaryFolderImaging(folder_path)[source]#

BinaryFolderImaging is an internal format used in photon-mosaic. It is a BinaryImaging + metadata contained in a folder.

It is created with the function: imaging.save(format=”binary”, folder=”/myfolder”)

Parameters:

folder_path (str or Path)

Returns:

imaging – The imaging object

Return type:

BinaryFolderImaging

Methods

get_binary_description()

When imaging.is_binary_compatible() is True this returns a dictionary describing the binary format.

is_binary_compatible()

Checks if the imaging object is "binary" compatible.

write_imaging(imaging, folder_path[, ...])

Write imaging data to a folder in binary format.

is_binary_compatible()[source]#

Checks if the imaging object is “binary” compatible. To be used before calling imaging.get_binary_description()

Returns:

True if the underlying imaging object is binary

Return type:

bool

get_binary_description()[source]#

When imaging.is_binary_compatible() is True this returns a dictionary describing the binary format.

static write_imaging(imaging, folder_path, verbose=False, overwrite=False, dtype=None, **job_kwargs)[source]#

Write imaging data to a folder in binary format.

Each epoch is written to its own .raw file.

Parameters:
  • imaging (BaseImaging) – Imaging object to write.

  • folder_path (str | Path) – Destination folder where binary files are saved.

  • verbose (bool) – If True, enables verbose output during writing.

  • overwrite (bool) – If True, removes an existing destination folder before writing.

  • dtype (dtype, optional) – Data type used to store trace data. If None, uses imaging.get_dtype().

  • **job_kwargs – Additional keyword arguments forwarded to spikeinterface.core.time_series_tools.write_binary().

Returns:

Path to the written BinaryFolderImaging.

Return type:

Path

Notes

Implemented as a static method so it can be called by BaseImaging.save() without instantiating BinaryImaging.

This is its only intended use.

photon_mosaic.core.binaryimaging.read_binary_folder#

alias of BinaryFolderImaging