Intracellular Electrophysiology#

Base Interface#

class BaseIcephysInterface(file_paths: list[Annotated[pathlib._local.Path, PathType(path_type='file')]])[source]#

Bases: BaseExtractorInterface

Primary class for all intracellular NeoInterfaces.

keywords: tuple[str] = ('intracellular electrophysiology', 'patch clamp', 'current clamp')#
classmethod get_source_schema() dict[source]#

Infer the JSON schema for the source_data from the method signature (annotation typing).

Returns:

The JSON schema for the source_data.

Return type:

dict

get_metadata_schema() dict[source]#

Retrieve JSON schema for metadata.

Returns:

The JSON schema defining the metadata structure.

Return type:

dict

get_metadata() DeepDict[source]#

Child DataInterface classes should override this to match their metadata.

Returns:

The metadata dictionary containing basic NWBFile metadata.

Return type:

DeepDict

get_original_timestamps() ndarray[source]#

Retrieve the original unaltered timestamps for the data in this interface.

This function should retrieve the data on-demand by re-initializing the IO.

Returns:

timestamps – The timestamps for the data stream.

Return type:

numpy.ndarray

get_timestamps() ndarray[source]#

Retrieve the timestamps for the data in this interface.

Returns:

timestamps – The timestamps for the data stream.

Return type:

numpy.ndarray

set_aligned_timestamps(aligned_timestamps: ndarray)[source]#

Replace all timestamps for this interface with those aligned to the common session start time.

Must be in units seconds relative to the common ‘session_start_time’.

Parameters:

aligned_timestamps (numpy.ndarray) – The synchronized timestamps for data in this interface.

set_aligned_starting_time(aligned_starting_time: float)[source]#

Align the starting time for this interface relative to the common session start time.

Must be in units seconds relative to the common ‘session_start_time’.

Parameters:

aligned_starting_time (float) – The starting time for all temporal data in this interface.

align_by_interpolation(unaligned_timestamps: ndarray, aligned_timestamps: ndarray)[source]#

Interpolate the timestamps of this interface using a mapping from some unaligned time basis to its aligned one.

Use this method if the unaligned timestamps of the data in this interface are not directly tracked by a primary system, but are known to occur between timestamps that are tracked, then align the timestamps of this interface by interpolating between the two.

An example could be a metronomic TTL pulse (e.g., every second) from a secondary data stream to the primary timing system; if the time references of this interface are recorded within the relative time of the secondary data stream, then their exact time in the primary system is inferred given the pulse times.

Must be in units seconds relative to the common ‘session_start_time’.

Parameters:
  • unaligned_timestamps (numpy.ndarray) – The timestamps of the unaligned secondary time basis.

  • aligned_timestamps (numpy.ndarray) – The timestamps aligned to the primary time basis.

add_to_nwbfile(nwbfile: NWBFile, metadata: dict = None, icephys_experiment_type: str = 'voltage_clamp', skip_electrodes: tuple[int] = ())[source]#

Primary function for converting raw (unprocessed) intracellular data to the NWB standard.

Parameters:
  • nwbfile (NWBFile) – nwb file to which the recording information is to be added

  • metadata (dict, optional) – metadata info for constructing the nwb file (optional).

  • icephys_experiment_type ({‘voltage_clamp’, ‘current_clamp’, ‘izero’}) – Type of icephys recording.

  • skip_electrodes (tuple, optional) – Electrode IDs to skip. Defaults to ().

Abf Interface#

get_start_datetime(neo_reader)[source]#

Get start datetime for Abf file.

Parameters:

neo_reader (neo.io.AxonIO) – The Neo reader object for the ABF file.

Returns:

The start date and time of the recording.

Return type:

datetime

class AbfInterface(file_paths: list[Annotated[pathlib._local.Path, PathType(path_type='file')]], icephys_metadata: dict | None = None, icephys_metadata_file_path: Annotated[pathlib._local.Path, PathType(path_type='file')] | None = None)[source]#

Bases: BaseIcephysInterface

Interface for ABF intracellular electrophysiology data.

ABF IcephysInterface based on Neo AxonIO.

Parameters:
  • file_paths (list of FilePaths) – List of files to be converted to the same NWB file.

  • icephys_metadata (dict, optional) – Dictionary containing the Icephys-specific metadata.

  • icephys_metadata_file_path (FilePath, optional) – JSON file containing the Icephys-specific metadata.

display_name: str | None = 'ABF Icephys'#
associated_suffixes: tuple[str] = ('.abf',)#
info: str | None = 'Interface for ABF intracellular electrophysiology data.'#
classmethod get_extractor_class()[source]#

Get the extractor class for this interface.

This classmethod must be implemented by each concrete interface to specify which extractor class to use.

Returns:

The extractor class or function to use for initialization.

Return type:

type or callable

classmethod get_source_schema() dict[source]#

Infer the JSON schema for the source_data from the method signature (annotation typing).

Returns:

The JSON schema for the source_data.

Return type:

dict

get_metadata() DeepDict[source]#

Child DataInterface classes should override this to match their metadata.

Returns:

The metadata dictionary containing basic NWBFile metadata.

Return type:

DeepDict

set_aligned_starting_time(aligned_starting_time: float)[source]#

Align the starting time for this interface relative to the common session start time.

Must be in units seconds relative to the common ‘session_start_time’.

Parameters:

aligned_starting_time (float) – The starting time for all temporal data in this interface.

set_aligned_segment_starting_times(aligned_segment_starting_times: list[list[float]], stub_test: bool = False)[source]#

Align the individual starting time for each video in this interface relative to the common session start time.

Must be in units seconds relative to the common ‘session_start_time’.

Parameters:
  • aligned_segment_starting_times (list of list of floats) – The relative starting times of each video. Outer list is over file paths (readers). Inner list is over segments of each recording.

  • stub_test (bool, default=False)