NEO#

get_electrodes_metadata(neo_reader, electrodes_ids: list, block: int = 0) list[source]#

Get electrodes metadata from Neo reader.

The typical information we look for is the information accepted by pynwb.icephys.IntracellularElectrode:
  • name – the name of this electrode

  • device – the device that was used to record from this electrode

  • description – Recording description, description of electrode (e.g., whole-cell, sharp, etc.)

  • comment: Free-form text (can be from Methods)

  • slice – Information about slice used for recording.

  • seal – Information about seal used for recording.

  • location – Area, layer, comments on estimation, stereotaxis coordinates (if in vivo, etc.).

  • resistance – Electrode resistance COMMENT: unit: Ohm.

  • filtering – Electrode specific filtering.

  • initial_access_resistance – Initial access resistance.

Parameters
  • neo_reader ([type]) (Neo reader)

  • electrodes_ids (list) (List of electrodes ids.)

  • block (int, optional) (Block id. Defaults to 0.)

Returns

list

Return type

List of dictionaries containing electrodes metadata.

get_number_of_electrodes(neo_reader) int[source]#

Get number of electrodes from Neo reader.

get_number_of_segments(neo_reader, block: int = 0) int[source]#

Get number of segments from Neo reader.

get_command_traces(neo_reader, segment: int = 0, cmd_channel: int = 0) Tuple[list, str, str][source]#

Get command traces (e.g. voltage clamp command traces).

Parameters
  • neo_reader (neo.io.baseio)

  • segment (int, optional) – Defaults to 0.

  • cmd_channel (int, optional) – ABF command channel (0 to 7). Defaults to 0.

get_conversion_from_unit(unit: str) float[source]#

Get conversion (to Volt or Ampere) from unit in string format.

Parameters

unit (str) (Unit as string. E.g. pA, mV, uV, etc…)

Returns

float

Return type

conversion to Ampere or Volt

get_nwb_metadata(neo_reader, metadata: Optional[dict] = None) dict[source]#

Return default metadata for all recording fields.

Parameters
  • neo_reader (Neo reader object)

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

add_icephys_electrode(neo_reader, nwbfile, metadata: Optional[dict] = None)[source]#

Add icephys electrodes to nwbfile object.

Will always ensure nwbfile has at least one icephys electrode. Will auto-generate a linked device if the specified name does not exist in the nwbfile.

Parameters
  • neo_reader (neo.io.baseio)

  • nwbfile (NWBFile) – NWBFile object to add the icephys electrode to.

  • metadata (dict, optional) – Metadata info for constructing the nwb file. Should be of the format

    metadata[‘Icephys’][‘Electrodes’] = [
    {

    ‘name’: my_name, ‘description’: my_description, ‘device_name’: my_device_name

    ]

add_icephys_recordings(neo_reader, nwbfile: NWBFile, metadata: Optional[dict] = None, icephys_experiment_type: str = 'voltage_clamp', stimulus_type: str = 'not described', skip_electrodes: Tuple[int] = (), compression: str = 'gzip')[source]#

Add icephys recordings (stimulus/response pairs) to nwbfile object.

Parameters
  • neo_reader (neo.io.baseio)

  • nwbfile (NWBFile)

  • metadata (dict, optional)

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

  • stimulus_type (str, default: ‘not described’)

  • skip_electrodes (tuple, default: ()) – Electrode IDs to skip.

  • compression (str | bool)

add_neo_to_nwb(neo_reader, nwbfile: NWBFile, metadata: Optional[dict] = None, compression: Optional[str] = 'gzip', icephys_experiment_type: str = 'voltage_clamp', stimulus_type: Optional[str] = None, skip_electrodes: Tuple[int] = ())[source]#

Auxiliary static method for nwbextractor.

Adds all recording related information from recording object and metadata to the nwbfile object.

Parameters
  • neo_reader (Neo reader object)

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

  • metadata (dict) – metadata info for constructing the nwb file (optional). Check the auxiliary function docstrings for more information about metadata format.

  • compression (str (optional, defaults to “gzip”)) – Type of compression to use. Valid types are “gzip” and “lzf”. Set to None to disable all compression.

  • icephys_experiment_type (str (optional)) – Type of Icephys experiment. Allowed types are: ‘voltage_clamp’, ‘current_clamp’ and ‘izero’. If no value is passed, ‘voltage_clamp’ is used as default.

  • stimulus_type (str, optional)

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

write_neo_to_nwb(neo_reader: BaseIO, save_path: Optional[FilePathType] = None, overwrite: bool = False, nwbfile=None, metadata: Optional[dict] = None, compression: Optional[str] = 'gzip', icephys_experiment_type: Optional[str] = None, stimulus_type: Optional[str] = None, skip_electrodes: Optional[tuple] = ())[source]#

Primary method for writing a Neo reader object to an NWBFile.

Parameters
  • neo_reader (Neo reader)

  • save_path (PathType) – Required if an nwbfile is not passed. Must be the path to the nwbfile being appended, otherwise one is created and written.

  • overwrite (bool) – If using save_path, whether to overwrite the NWBFile if it already exists.

  • nwbfile (NWBFile) – Required if a save_path is not specified. If passed, this function will fill the relevant fields within the nwbfile.

  • metadata (dict) –

    metadata info for constructing the nwb file (optional). Should be of the format

    metadata[‘Ecephys’] = {}

    with keys of the forms
    metadata[‘Ecephys’][‘Device’] = [
    {

    ‘name’: my_name, ‘description’: my_description

    ] metadata[‘Ecephys’][‘ElectrodeGroup’] = [

    {

    ‘name’: my_name, ‘description’: my_description, ‘location’: electrode_location, ‘device’: my_device_name

    ] metadata[‘Ecephys’][‘Electrodes’] = [

    {

    ‘name’: my_name, ‘description’: my_description

    ] metadata[‘Ecephys’][‘ElectricalSeries’] = {

    ‘name’: my_name, ‘description’: my_description

    }

    Note that data intended to be added to the electrodes table of the NWBFile should be set as channel properties in the RecordingExtractor object.

  • compression (str (optional, defaults to “gzip”)) – Type of compression to use. Valid types are “gzip” and “lzf”. Set to None to disable all compression.

  • icephys_experiment_type (str (optional)) – Type of Icephys experiment. Allowed types are: ‘voltage_clamp’, ‘current_clamp’ and ‘izero’. If no value is passed, ‘voltage_clamp’ is used as default.

  • stimulus_type (str, optional)

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