photon_mosaic.core.imaging_ops#

Operations that derive one imaging object from another.

Every public callable here takes imaging object(s) and hands back a new lazy proxy: selecting or subdividing epochs, cutting out a frame range, or joining objects along the plane axis. Nothing copies pixels — the proxies pull from their parents on read.

Functions

append_imaging(imagings)

Return a proxy with the epochs of each imaging object in list order.

concatenate_epochs(imagings)

Return a single-epoch proxy joining all input epochs in order.

frame_slice(parent_imaging[, start_frame, ...])

Return a single-epoch proxy over [start_frame, end_frame) of one parent epoch.

split_epoch_at_frames(imaging, epoch_index, ...)

Split one epoch of imaging into contiguous sub-epochs at the given frame boundaries.

split_epochs(imaging, epoch_indices)

Return a proxy imaging object with only the requested epochs.

split_imaging_by_epochs(imaging)

Return a list of proxy imaging objects, each containing a single epoch.

stack_planes(*imagings)

Stack imaging objects along the plane axis into one multi-plane volume.

Classes

AppendImaging(imagings)

Imaging proxy whose epochs are those of each input, in list order.

ConcatenateImaging(imagings)

Imaging proxy joining all epochs of one or several input imaging objects into one epoch along time.

FrameSliceImaging(parent_imaging[, ...])

Imaging proxy exposing one contiguous frame range of a parent epoch.

SelectEpochImaging(imaging, epoch_indices)

Proxy imaging object exposing only selected epochs from a parent imaging.

SplitEpochAtFramesImaging(imaging, ...)

Imaging proxy that subdivides one epoch of a parent into several sub-epochs.

StackPlanesImaging(imagings)

Imaging proxy that stacks several imaging objects along the plane axis.

class photon_mosaic.core.imaging_ops.SelectEpochImaging(imaging, epoch_indices)[source]#

Proxy imaging object exposing only selected epochs from a parent imaging.

Methods

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

Get a series of frames from the imaging data.

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

Get a series of frames from the imaging data.

Parameters:
  • start_frame (int | None) – The starting frame index (inclusive).

  • end_frame (int | None) – The ending frame index (exclusive).

  • plane_ids (list | ndarray | None) – The list of plane IDs to include. If None, all planes are included.

  • epoch_index (int | None) – The index of the imaging segment. If None and there is only one segment, it defaults to 0.

Returns:

The requested series of frames as a NumPy array.

Return type:

ndarray

photon_mosaic.core.imaging_ops.split_epochs(imaging, epoch_indices)[source]#

Return a proxy imaging object with only the requested epochs.

Return type:

SelectEpochImaging

photon_mosaic.core.imaging_ops.split_imaging_by_epochs(imaging)[source]#

Return a list of proxy imaging objects, each containing a single epoch.

Return type:

list[SelectEpochImaging]

class photon_mosaic.core.imaging_ops.SplitEpochAtFramesImaging(imaging, epoch_index, frame_boundaries)[source]#

Imaging proxy that subdivides one epoch of a parent into several sub-epochs.

The frame boundaries are interpreted in the same way as np.split: the boundaries split the parent epoch into len(boundaries) + 1 contiguous pieces, each exposed as its own epoch on the returned object. Pixels are pulled lazily from the parent — no data is copied.

photon_mosaic.core.imaging_ops.split_epoch_at_frames(imaging, epoch_index, frame_boundaries)[source]#

Split one epoch of imaging into contiguous sub-epochs at the given frame boundaries.

Convenience wrapper for SplitEpochAtFramesImaging. Useful when an extractor exposes recorded files as a single concatenated epoch (e.g. suite2p’s per-plane data.bin plus ops['frames_per_file']) and you want each underlying file as its own epoch.

Return type:

SplitEpochAtFramesImaging

class photon_mosaic.core.imaging_ops.FrameSliceImaging(parent_imaging, start_frame=None, end_frame=None, epoch_index=None)[source]#

Imaging proxy exposing one contiguous frame range of a parent epoch.

The imaging counterpart of SpikeInterface’s FrameSliceRecording: the way to cut a short stub out of a long video, whether for a test fixture, a quick look, or to hand something small to code that would choke on the whole recording. Pixels are pulled lazily from the parent.

The result has exactly one epoch. t_start stays on the parent’s timeline rather than being re-referenced to zero, so the stub keeps its place in the original recording.

Parameters:
  • parent_imaging (BaseImaging) – The imaging object to slice.

  • start_frame (int | None) – First included frame, or 0 if None.

  • end_frame (int | None) – End frame, excluded as in ordinary python slicing; the parent epoch’s frame count if None.

  • epoch_index (int | None) – Which epoch of the parent to slice. If None and the parent has a single epoch it defaults to that one; a multi-epoch parent must name its epoch, as it must for BaseImaging.get_series(). SpikeInterface refuses a multi-segment parent outright; naming the epoch keeps that capability without letting an unnamed one be picked silently (see issue #129).

photon_mosaic.core.imaging_ops.frame_slice(parent_imaging, start_frame=None, end_frame=None, epoch_index=None)[source]#

Return a single-epoch proxy over [start_frame, end_frame) of one parent epoch.

Convenience wrapper for FrameSliceImaging.

Return type:

FrameSliceImaging

class photon_mosaic.core.imaging_ops.ConcatenateImaging(imagings)[source]#

Imaging proxy joining all epochs of one or several input imaging objects into one epoch along time.

Epoch data is accessed lazily in input order; t_start is the first epoch’s from the first input.

photon_mosaic.core.imaging_ops.concatenate_epochs(imagings)[source]#

Return a single-epoch proxy joining all input epochs in order.

Return type:

ConcatenateImaging

class photon_mosaic.core.imaging_ops.AppendImaging(imagings)[source]#

Imaging proxy whose epochs are those of each input, in list order.

Inputs must share shape, sampling frequency and dtype. Nothing is copied.

photon_mosaic.core.imaging_ops.append_imaging(imagings)[source]#

Return a proxy with the epochs of each imaging object in list order.

Return type:

AppendImaging

class photon_mosaic.core.imaging_ops.StackPlanesImaging(imagings)[source]#

Imaging proxy that stacks several imaging objects along the plane axis.

All inputs must share the same epoch structure (number of epochs and the per-epoch frame counts), the same (height, width), sampling frequency and dtype. The resulting object has sum(num_planes) planes and pulls pixels lazily from the inputs — no data is copied.

Parameters:

imagings (Sequence[BaseImaging]) – Two or more imaging objects covering the same field of view at the same timestamps, each providing one or more planes.

photon_mosaic.core.imaging_ops.stack_planes(*imagings)[source]#

Stack imaging objects along the plane axis into one multi-plane volume.

Accepts the objects either as separate arguments (stack_planes(a, b)) or as a single sequence (stack_planes([a, b])).

Parameters:

*imagings (BaseImaging) – Two or more imaging objects of the same FOV / timestamps; see StackPlanesImaging.

Returns:

A lazy multi-plane view over the inputs.

Return type:

StackPlanesImaging