From a8ea523d1435c674bbf9ce3b30bf584efc29c528 Mon Sep 17 00:00:00 2001 From: pauladkisson Date: Fri, 24 Jan 2025 10:30:26 -0800 Subject: [PATCH 01/19] added returns section to various getters (Cline first try) --- src/neuroconv/basedatainterface.py | 29 +++++++-- src/neuroconv/baseextractorinterface.py | 8 +++ .../behavior/video/video_utils.py | 62 +++++++++++++++++-- .../behavior/video/videodatainterface.py | 2 +- .../ecephys/spikeglx/spikeglxdatainterface.py | 25 ++++++++ .../brukertiff/brukertiffdatainterface.py | 36 +++++++++-- .../text/timeintervalsinterface.py | 9 +++ src/neuroconv/nwbconverter.py | 38 ++++++++++-- src/neuroconv/tools/importing.py | 10 ++- src/neuroconv/tools/neo/neo.py | 42 +++++++++++-- .../nwb_helpers/_metadata_and_file_helpers.py | 39 +++++++++++- 11 files changed, 273 insertions(+), 27 deletions(-) diff --git a/src/neuroconv/basedatainterface.py b/src/neuroconv/basedatainterface.py index 9a2f25844..6c14c36f3 100644 --- a/src/neuroconv/basedatainterface.py +++ b/src/neuroconv/basedatainterface.py @@ -72,12 +72,26 @@ def __init__(self, verbose: bool = False, **source_data): self.source_data = source_data def get_metadata_schema(self) -> dict: - """Retrieve JSON schema for metadata.""" + """ + Retrieve JSON schema for metadata. + + Returns + ------- + dict + The JSON schema defining the metadata structure. + """ metadata_schema = load_dict_from_file(Path(__file__).parent / "schemas" / "base_metadata_schema.json") return metadata_schema def get_metadata(self) -> DeepDict: - """Child DataInterface classes should override this to match their metadata.""" + """ + Child DataInterface classes should override this to match their metadata. + + Returns + ------- + DeepDict + The metadata dictionary containing basic NWBFile metadata. + """ metadata = DeepDict() metadata["NWBFile"]["session_description"] = "" metadata["NWBFile"]["identifier"] = str(uuid.uuid4()) @@ -105,7 +119,14 @@ def validate_metadata(self, metadata: dict, append_mode: bool = False) -> None: validate(instance=decoded_metadata, schema=metdata_schema) def get_conversion_options_schema(self) -> dict: - """Infer the JSON schema for the conversion options from the method signature (annotation typing).""" + """ + Infer the JSON schema for the conversion options from the method signature (annotation typing). + + Returns + ------- + dict + The JSON schema for the conversion options. + """ return get_json_schema_from_method_signature(self.add_to_nwbfile, exclude=["nwbfile", "metadata"]) def create_nwbfile(self, metadata: Optional[dict] = None, **conversion_options) -> NWBFile: @@ -249,7 +270,7 @@ def get_default_backend_configuration( Returns ------- - backend_configuration : HDF5BackendConfiguration or ZarrBackendConfiguration + Union[HDF5BackendConfiguration, ZarrBackendConfiguration] The default configuration for the specified backend type. """ return get_default_backend_configuration(nwbfile=nwbfile, backend=backend) diff --git a/src/neuroconv/baseextractorinterface.py b/src/neuroconv/baseextractorinterface.py index a75fbe1f0..756a1c480 100644 --- a/src/neuroconv/baseextractorinterface.py +++ b/src/neuroconv/baseextractorinterface.py @@ -20,6 +20,14 @@ class BaseExtractorInterface(BaseTemporalAlignmentInterface, ABC): @classmethod def get_extractor(cls): + """ + Get the extractor class for this interface. + + Returns + ------- + type + The extractor class that will be used to read the data. + """ if cls.Extractor is not None: return cls.Extractor extractor_module = get_package(package_name=cls.ExtractorModuleName) diff --git a/src/neuroconv/datainterfaces/behavior/video/video_utils.py b/src/neuroconv/datainterfaces/behavior/video/video_utils.py index fe817a3b2..d134598a3 100644 --- a/src/neuroconv/datainterfaces/behavior/video/video_utils.py +++ b/src/neuroconv/datainterfaces/behavior/video/video_utils.py @@ -65,13 +65,27 @@ def get_video_timestamps(self, max_frames: Optional[int] = None, display_progres return np.array(timestamps) / 1000 def get_video_fps(self): - """Return the internal frames per second (fps) for a video file.""" + """ + Return the internal frames per second (fps) for a video file. + + Returns + ------- + float + The frames per second of the video. + """ assert self.isOpened(), self._video_open_msg prop = self.get_cv_attribute("CAP_PROP_FPS") return self.vc.get(prop) def get_frame_shape(self) -> Tuple: - """Return the shape of frames from a video file.""" + """ + Return the shape of frames from a video file. + + Returns + ------- + Tuple + The shape of the video frames (height, width, channels). + """ frame = self.get_video_frame(0) if frame is not None: return frame.shape @@ -91,6 +105,14 @@ def frame_count(self, val: int): self._frame_count = val def get_video_frame_count(self): + """ + Get the total number of frames in the video. + + Returns + ------- + int + The total number of frames in the video. + """ return self.frame_count def _video_frame_count(self): @@ -101,6 +123,19 @@ def _video_frame_count(self): @staticmethod def get_cv_attribute(attribute_name: str): + """ + Get an OpenCV attribute by name. + + Parameters + ---------- + attribute_name : str + The name of the OpenCV attribute to get. + + Returns + ------- + Any + The OpenCV attribute value. + """ cv2 = get_package(package_name="cv2", installation_instructions="pip install opencv-python-headless") if int(cv2.__version__.split(".")[0]) < 3: # pragma: no cover @@ -122,7 +157,19 @@ def current_frame(self, frame_number: int): raise ValueError(f"Could not set frame number (received {frame_number}).") def get_video_frame(self, frame_number: int): - """Return the specific frame from a video as an RGB colorspace.""" + """ + Return the specific frame from a video as an RGB colorspace. + + Parameters + ---------- + frame_number : int + The index of the frame to retrieve. + + Returns + ------- + numpy.ndarray + The video frame in RGB colorspace with shape (height, width, 3). + """ assert self.isOpened(), self._video_open_msg assert frame_number < self.get_video_frame_count(), "frame number is greater than length of video" initial_frame_number = self.current_frame @@ -132,7 +179,14 @@ def get_video_frame(self, frame_number: int): return np.flip(frame, 2) # np.flip to re-order color channels to RGB def get_video_frame_dtype(self): - """Return the dtype for frame in a video file.""" + """ + Return the dtype for frame in a video file. + + Returns + ------- + numpy.dtype + The data type of the video frames. + """ frame = self.get_video_frame(0) if frame is not None: return frame.dtype diff --git a/src/neuroconv/datainterfaces/behavior/video/videodatainterface.py b/src/neuroconv/datainterfaces/behavior/video/videodatainterface.py index aaa875f3e..133c5eda6 100644 --- a/src/neuroconv/datainterfaces/behavior/video/videodatainterface.py +++ b/src/neuroconv/datainterfaces/behavior/video/videodatainterface.py @@ -135,7 +135,7 @@ def get_timing_type(self) -> Literal["starting_time and rate", "timestamps"]: Returns ------- - timing_type : 'starting_time and rate' or 'timestamps' + Literal["starting_time and rate", "timestamps"] The type of timing that has been set explicitly according to alignment. If only timestamps have been set, then only those will be used. diff --git a/src/neuroconv/datainterfaces/ecephys/spikeglx/spikeglxdatainterface.py b/src/neuroconv/datainterfaces/ecephys/spikeglx/spikeglxdatainterface.py index 65dbc2b2e..58f9c7e25 100644 --- a/src/neuroconv/datainterfaces/ecephys/spikeglx/spikeglxdatainterface.py +++ b/src/neuroconv/datainterfaces/ecephys/spikeglx/spikeglxdatainterface.py @@ -31,6 +31,14 @@ class SpikeGLXRecordingInterface(BaseRecordingExtractorInterface): @classmethod def get_source_schema(cls) -> dict: + """ + Get the source schema for the SpikeGLX recording interface. + + Returns + ------- + dict + The JSON schema for the SpikeGLX recording data source. + """ source_schema = get_json_schema_from_method_signature(method=cls.__init__, exclude=["x_pitch", "y_pitch"]) source_schema["properties"]["file_path"]["description"] = "Path to SpikeGLX ap.bin or lf.bin file." return source_schema @@ -117,6 +125,14 @@ def __init__( add_recording_extractor_properties(self.recording_extractor) def get_metadata(self) -> dict: + """ + Get metadata for the SpikeGLX recording. + + Returns + ------- + dict + The metadata dictionary containing recording metadata from the SpikeGLX files. + """ metadata = super().get_metadata() session_start_time = get_session_start_time(self.meta) if session_start_time: @@ -164,6 +180,15 @@ def get_metadata(self) -> dict: return metadata def get_original_timestamps(self) -> np.ndarray: + """ + Get the original timestamps for the SpikeGLX recording. + + Returns + ------- + numpy.ndarray or list of numpy.ndarray + The timestamps for each sample in the recording. If there are multiple segments, + returns a list of timestamps arrays, one for each segment. + """ new_recording = self.get_extractor()( folder_path=self.folder_path, stream_id=self.stream_id, diff --git a/src/neuroconv/datainterfaces/ophys/brukertiff/brukertiffdatainterface.py b/src/neuroconv/datainterfaces/ophys/brukertiff/brukertiffdatainterface.py index ea1d1e4ba..a0ce9d503 100644 --- a/src/neuroconv/datainterfaces/ophys/brukertiff/brukertiffdatainterface.py +++ b/src/neuroconv/datainterfaces/ophys/brukertiff/brukertiffdatainterface.py @@ -16,7 +16,14 @@ class BrukerTiffMultiPlaneImagingInterface(BaseImagingExtractorInterface): @classmethod def get_source_schema(cls) -> dict: - """Get the source schema for the Bruker TIFF imaging data.""" + """ + Get the source schema for the Bruker TIFF imaging data. + + Returns + ------- + dict + The JSON schema for the Bruker TIFF imaging data source. + """ source_schema = super().get_source_schema() source_schema["properties"]["folder_path"][ "description" @@ -135,7 +142,14 @@ def _determine_position_current(self) -> list[float]: return position_values def get_metadata(self) -> DeepDict: - """get metadata for the Bruker TIFF imaging data.""" + """ + Get metadata for the Bruker TIFF imaging data. + + Returns + ------- + DeepDict + The metadata dictionary containing imaging metadata from the Bruker TIFF files. + """ metadata = super().get_metadata() xml_metadata = self.imaging_extractor.xml_metadata @@ -202,7 +216,14 @@ class BrukerTiffSinglePlaneImagingInterface(BaseImagingExtractorInterface): @classmethod def get_source_schema(cls) -> dict: - """Get the source schema for the Bruker TIFF imaging data.""" + """ + Get the source schema for the Bruker TIFF imaging data. + + Returns + ------- + dict + The JSON schema for the Bruker TIFF imaging data source. + """ source_schema = super().get_source_schema() source_schema["properties"]["folder_path"][ "description" @@ -296,7 +317,14 @@ def _determine_position_current(self) -> list[float]: return position_values def get_metadata(self) -> DeepDict: - """get metadata for the Bruker TIFF imaging data.""" + """ + Get metadata for the Bruker TIFF imaging data. + + Returns + ------- + DeepDict + The metadata dictionary containing imaging metadata from the Bruker TIFF files. + """ metadata = super().get_metadata() xml_metadata = self.imaging_extractor.xml_metadata diff --git a/src/neuroconv/datainterfaces/text/timeintervalsinterface.py b/src/neuroconv/datainterfaces/text/timeintervalsinterface.py index 2520a1236..7fea86abe 100644 --- a/src/neuroconv/datainterfaces/text/timeintervalsinterface.py +++ b/src/neuroconv/datainterfaces/text/timeintervalsinterface.py @@ -42,6 +42,15 @@ def __init__( self.time_intervals = None def get_metadata(self) -> dict: + """ + Get metadata for the time intervals. + + Returns + ------- + dict + The metadata dictionary containing time intervals metadata. + Includes a TimeIntervals key with trials information. + """ metadata = super().get_metadata() metadata["TimeIntervals"] = dict( trials=dict( diff --git a/src/neuroconv/nwbconverter.py b/src/neuroconv/nwbconverter.py index 05e26e866..540c8b94e 100644 --- a/src/neuroconv/nwbconverter.py +++ b/src/neuroconv/nwbconverter.py @@ -49,7 +49,14 @@ class NWBConverter: @classmethod def get_source_schema(cls) -> dict: - """Compile input schemas from each of the data interface classes.""" + """ + Compile input schemas from each of the data interface classes. + + Returns + ------- + dict + The compiled source schema from all data interface classes. + """ source_schema = get_base_schema( root=True, id_="source.schema.json", @@ -88,7 +95,14 @@ def __init__(self, source_data: dict[str, dict], verbose: bool = False): } def get_metadata_schema(self) -> dict: - """Compile metadata schemas from each of the data interface objects.""" + """ + Compile metadata schemas from each of the data interface objects. + + Returns + ------- + dict + The compiled metadata schema from all data interface objects. + """ metadata_schema = load_dict_from_file(Path(__file__).parent / "schemas" / "base_metadata_schema.json") for data_interface in self.data_interface_objects.values(): interface_schema = unroot_schema(data_interface.get_metadata_schema()) @@ -99,7 +113,14 @@ def get_metadata_schema(self) -> dict: return metadata_schema def get_metadata(self) -> DeepDict: - """Auto-fill as much of the metadata as possible. Must comply with metadata schema.""" + """ + Auto-fill as much of the metadata as possible. Must comply with metadata schema. + + Returns + ------- + DeepDict + The metadata dictionary containing auto-filled metadata from all interfaces. + """ metadata = get_default_nwbfile_metadata() for interface in self.data_interface_objects.values(): interface_metadata = interface.get_metadata() @@ -125,7 +146,14 @@ def validate_metadata(self, metadata: dict[str, dict], append_mode: bool = False print("Metadata is valid!") def get_conversion_options_schema(self) -> dict: - """Compile conversion option schemas from each of the data interface classes.""" + """ + Compile conversion option schemas from each of the data interface classes. + + Returns + ------- + dict + The compiled conversion options schema from all data interface classes. + """ conversion_options_schema = get_base_schema( root=True, id_="conversion_options.schema.json", @@ -316,7 +344,7 @@ def get_default_backend_configuration( Returns ------- - backend_configuration : HDF5BackendConfiguration or ZarrBackendConfiguration + Union[HDF5BackendConfiguration, ZarrBackendConfiguration] The default configuration for the specified backend type. """ return get_default_backend_configuration(nwbfile=nwbfile, backend=backend) diff --git a/src/neuroconv/tools/importing.py b/src/neuroconv/tools/importing.py index 04a3cbf21..02aacae10 100644 --- a/src/neuroconv/tools/importing.py +++ b/src/neuroconv/tools/importing.py @@ -129,7 +129,15 @@ def get_package( def get_format_summaries() -> dict[str, dict[str, Union[str, tuple[str, ...], None]]]: - """Simple helper function for compiling high level summaries of all format interfaces and converters.""" + """ + Simple helper function for compiling high level summaries of all format interfaces and converters. + + Returns + ------- + dict + A dictionary mapping interface/converter names to their summary information. + Each summary contains display_name, keywords, associated_suffixes, and info. + """ # Local scope import to avoid circularity from ..converters import converter_list from ..datainterfaces import interface_list diff --git a/src/neuroconv/tools/neo/neo.py b/src/neuroconv/tools/neo/neo.py index ccef706e5..4bf8b836c 100644 --- a/src/neuroconv/tools/neo/neo.py +++ b/src/neuroconv/tools/neo/neo.py @@ -55,13 +55,34 @@ def get_electrodes_metadata(neo_reader, electrodes_ids: list, block: int = 0) -> def get_number_of_electrodes(neo_reader) -> int: - """Get number of electrodes from Neo reader.""" + """ + Get number of electrodes from Neo reader. + + Returns + ------- + int + The total number of electrodes in the recording. + """ # TODO - take in account the case with multiple streams. return len(neo_reader.header["signal_channels"]) def get_number_of_segments(neo_reader, block: int = 0) -> int: - """Get number of segments from Neo reader.""" + """ + Get number of segments from Neo reader. + + Parameters + ---------- + neo_reader : neo.io.baseio + The Neo reader object. + block : int, default: 0 + Block index. + + Returns + ------- + int + The number of segments in the specified block. + """ return neo_reader.header["nb_segment"][block] @@ -92,11 +113,14 @@ def get_conversion_from_unit(unit: str) -> float: Parameters ---------- - unit (str): Unit as string. E.g. pA, mV, uV, etc... + unit : str + Unit as string. E.g. pA, mV, uV, etc... Returns ------- - float: conversion to Ampere or Volt + float + The conversion factor to convert to Ampere or Volt. + For example, for 'pA' returns 1e-12 to convert to Ampere. """ if unit in ["pA", "pV"]: conversion = 1e-12 @@ -120,9 +144,15 @@ def get_nwb_metadata(neo_reader, metadata: dict = None) -> dict: Parameters ---------- - neo_reader: Neo reader object - metadata: dict, optional + neo_reader : neo.io.baseio + Neo reader object + metadata : dict, optional Metadata info for constructing the nwb file. + + Returns + ------- + dict + Default metadata dictionary containing NWBFile and Icephys device information. """ metadata = dict( NWBFile=dict( diff --git a/src/neuroconv/tools/nwb_helpers/_metadata_and_file_helpers.py b/src/neuroconv/tools/nwb_helpers/_metadata_and_file_helpers.py index e7473f228..c92c5b7e4 100644 --- a/src/neuroconv/tools/nwb_helpers/_metadata_and_file_helpers.py +++ b/src/neuroconv/tools/nwb_helpers/_metadata_and_file_helpers.py @@ -22,7 +22,23 @@ def get_module(nwbfile: NWBFile, name: str, description: str = None): - """Check if processing module exists. If not, create it. Then return module.""" + """ + Check if processing module exists. If not, create it. Then return module. + + Parameters + ---------- + nwbfile : NWBFile + The NWB file to check or add the module to. + name : str + The name of the processing module. + description : str, optional + Description of the module. Only used if creating a new module. + + Returns + ------- + ProcessingModule + The existing or newly created processing module. + """ if name in nwbfile.processing: if description is not None and nwbfile.processing[name].description != description: warnings.warn( @@ -46,6 +62,12 @@ def get_default_nwbfile_metadata() -> DeepDict: metadata["NWBFile"]["identifier"] = str(uuid.uuid4()) Proper conversions should override these fields prior to calling ``NWBConverter.run_conversion()`` + + Returns + ------- + DeepDict + A dictionary containing default metadata values for an NWBFile, including + session description, identifier, and NeuroConv version information. """ neuroconv_version = importlib.metadata.version("neuroconv") @@ -62,7 +84,20 @@ def get_default_nwbfile_metadata() -> DeepDict: def make_nwbfile_from_metadata(metadata: dict) -> NWBFile: - """Make NWBFile from available metadata.""" + """ + Make NWBFile from available metadata. + + Parameters + ---------- + metadata : dict + Dictionary containing metadata for creating the NWBFile. + Must contain an 'NWBFile' key with required fields. + + Returns + ------- + NWBFile + A newly created NWBFile object initialized with the provided metadata. + """ # Validate metadata schema_path = Path(__file__).resolve().parent.parent.parent / "schemas" / "base_metadata_schema.json" base_metadata_schema = load_dict_from_file(file_path=schema_path) From ba96d90a02d39d542e206640acb490c10e7fc55f Mon Sep 17 00:00:00 2001 From: pauladkisson Date: Fri, 24 Jan 2025 12:18:15 -0800 Subject: [PATCH 02/19] added returns section to various getters (Cline second try w/ manual reversions) --- .../baserecordingextractorinterface.py | 33 +++++++++++-- .../ecephys/basesortingextractorinterface.py | 24 +++++++++- .../ecephys/neuroscope/neuroscope_utils.py | 41 ++++++++++++++-- .../neuroscope/neuroscopedatainterface.py | 32 ++++++++++++- .../openephys/openephysbinarydatainterface.py | 13 +++++ .../openephys/openephysdatainterface.py | 18 +++++++ .../openephys/openephyslegacydatainterface.py | 13 +++++ .../openephyssortingdatainterface.py | 10 +++- .../ecephys/spike2/spike2datainterface.py | 23 ++++++++- .../ecephys/spikeglx/spikeglxconverter.py | 34 +++++++++++++- .../ecephys/spikeglx/spikeglxnidqinterface.py | 9 +++- .../icephys/abf/abfdatainterface.py | 23 ++++++++- .../ophys/baseimagingextractorinterface.py | 31 ++++++------ .../ophys/brukertiff/brukertiffconverter.py | 22 +++++++-- .../ophys/caiman/caimandatainterface.py | 10 +++- .../micromanagertiffdatainterface.py | 20 +++++++- .../ophys/miniscope/miniscopeconverter.py | 9 +++- .../miniscopeimagingdatainterface.py | 30 ++++++++++-- .../ophys/sbx/sbxdatainterface.py | 10 +++- .../scanimage/scanimageimaginginterfaces.py | 47 +++++++++++++++++-- .../ophys/suite2p/suite2pdatainterface.py | 46 +++++++++++++++++- 21 files changed, 446 insertions(+), 52 deletions(-) diff --git a/src/neuroconv/datainterfaces/ecephys/baserecordingextractorinterface.py b/src/neuroconv/datainterfaces/ecephys/baserecordingextractorinterface.py index 1b7b18119..7d76586a9 100644 --- a/src/neuroconv/datainterfaces/ecephys/baserecordingextractorinterface.py +++ b/src/neuroconv/datainterfaces/ecephys/baserecordingextractorinterface.py @@ -48,7 +48,15 @@ def __init__(self, verbose: bool = False, es_key: str = "ElectricalSeries", **so self._number_of_segments = self.recording_extractor.get_num_segments() def get_metadata_schema(self) -> dict: - """Compile metadata schema for the RecordingExtractor.""" + """ + Compile metadata schema for the RecordingExtractor. + + Returns + ------- + dict + The metadata schema dictionary containing definitions for Device, ElectrodeGroup, + Electrodes, and optionally ElectricalSeries. + """ metadata_schema = super().get_metadata_schema() metadata_schema["properties"]["Ecephys"] = get_base_schema(tag="Ecephys") metadata_schema["properties"]["Ecephys"]["required"] = ["Device", "ElectrodeGroup"] @@ -86,6 +94,15 @@ def get_metadata_schema(self) -> dict: return metadata_schema def get_metadata(self) -> DeepDict: + """ + Get metadata for the recording extractor. + + Returns + ------- + DeepDict + Dictionary containing metadata including device information, electrode groups, + and electrical series configuration. + """ metadata = super().get_metadata() from ...tools.spikeinterface.spikeinterface import _get_group_name @@ -247,11 +264,11 @@ def set_probe(self, probe, group_mode: Literal["by_shank", "by_probe"]): def has_probe(self) -> bool: """ Check if the recording extractor has probe information. - + Returns ------- - has_probe : bool - True if the recording extractor has probe information. + bool + True if the recording extractor has probe information, False otherwise. """ return self.recording_extractor.has_probe() @@ -270,10 +287,16 @@ def align_by_interpolation( def subset_recording(self, stub_test: bool = False): """ Subset a recording extractor according to stub and channel subset options. - + Parameters ---------- stub_test : bool, default: False + If True, only a subset of frames will be included. + + Returns + ------- + spikeinterface.core.BaseRecording + The subsetted recording extractor. """ from spikeinterface.core.segmentutils import AppendSegmentRecording diff --git a/src/neuroconv/datainterfaces/ecephys/basesortingextractorinterface.py b/src/neuroconv/datainterfaces/ecephys/basesortingextractorinterface.py index 872927cd7..e590137ec 100644 --- a/src/neuroconv/datainterfaces/ecephys/basesortingextractorinterface.py +++ b/src/neuroconv/datainterfaces/ecephys/basesortingextractorinterface.py @@ -26,7 +26,15 @@ def __init__(self, verbose: bool = False, **source_data): self._number_of_segments = self.sorting_extractor.get_num_segments() def get_metadata_schema(self) -> dict: - """Compile metadata schema for the RecordingExtractor.""" + """ + Compile metadata schema for the RecordingExtractor. + + Returns + ------- + dict + The metadata schema dictionary containing definitions for Device, ElectrodeGroup, + Electrodes, and UnitProperties. + """ # Initiate Ecephys metadata metadata_schema = super().get_metadata_schema() @@ -85,6 +93,20 @@ def get_original_timestamps(self) -> np.ndarray: ) def get_timestamps(self) -> Union[np.ndarray, list[np.ndarray]]: + """ + Get the timestamps for the sorting data. + + Returns + ------- + numpy.ndarray or list of numpy.ndarray + The timestamps for each spike in the sorting data. If there are multiple segments, + returns a list of timestamp arrays. + + Raises + ------ + NotImplementedError + If no recording is attached to the sorting extractor. + """ if not self.sorting_extractor.has_recording(): raise NotImplementedError( "In order to align timestamps for a SortingInterface, it must have a recording " diff --git a/src/neuroconv/datainterfaces/ecephys/neuroscope/neuroscope_utils.py b/src/neuroconv/datainterfaces/ecephys/neuroscope/neuroscope_utils.py index fec9d532f..c88f7339f 100644 --- a/src/neuroconv/datainterfaces/ecephys/neuroscope/neuroscope_utils.py +++ b/src/neuroconv/datainterfaces/ecephys/neuroscope/neuroscope_utils.py @@ -11,13 +11,35 @@ def get_xml_file_path(data_file_path: str) -> str: Infer the xml_file_path from the data_file_path (.dat or .eeg). Assumes the two are in the same folder and follow the session_id naming convention. + + Parameters + ---------- + data_file_path : str + Path to the data file (.dat or .eeg) + + Returns + ------- + str + The path to the corresponding XML file. """ session_path = Path(data_file_path).parent return str(session_path / f"{session_path.stem}.xml") def get_xml(xml_file_path: str): - """Auxiliary function for retrieving root of xml.""" + """ + Auxiliary function for retrieving root of xml. + + Parameters + ---------- + xml_file_path : str + Path to the XML file. + + Returns + ------- + lxml.etree._Element + The root element of the XML tree. + """ etree = get_package(package_name="lxml.etree") return etree.parse(xml_file_path).getroot() @@ -87,9 +109,16 @@ def get_channel_groups(xml_file_path: str) -> list: These are all the channels that are connected to the probe. + Parameters + ---------- + xml_file_path : str + Path to the XML file. + Returns ------- - List reflecting the group structure of the channels. + list + List of lists, where each inner list contains the channel numbers for that group. + For example: [[1, 2, 3], [4, 5, 6]] represents two groups with three channels each. """ root = get_xml(xml_file_path) channel_groups = [ @@ -102,10 +131,16 @@ def get_channel_groups(xml_file_path: str) -> list: def get_session_start_time(xml_file_path: str) -> datetime: """ Auxiliary function for retrieving the session start time from the xml file. + + Parameters + ---------- + xml_file_path : str + Path to the XML file. Returns ------- - datetime object describing the start time + datetime + The session start time as a datetime object. Returns None if no date is found. """ root = get_xml(xml_file_path) date_elem = safe_nested_find(root, ["generalInfo", "date"]) diff --git a/src/neuroconv/datainterfaces/ecephys/neuroscope/neuroscopedatainterface.py b/src/neuroconv/datainterfaces/ecephys/neuroscope/neuroscopedatainterface.py index 9ed1201ab..d3396d8f6 100644 --- a/src/neuroconv/datainterfaces/ecephys/neuroscope/neuroscopedatainterface.py +++ b/src/neuroconv/datainterfaces/ecephys/neuroscope/neuroscopedatainterface.py @@ -109,7 +109,20 @@ def get_source_schema(self) -> dict: @staticmethod def get_ecephys_metadata(xml_file_path: str) -> dict: - """Auto-populates ecephys metadata from the xml_file_path.""" + """ + Auto-populates ecephys metadata from the xml_file_path. + + Parameters + ---------- + xml_file_path : str + Path to the XML file containing device and electrode configuration. + + Returns + ------- + dict + Dictionary containing metadata for ElectrodeGroup and Electrodes. + Includes group names, descriptions, and electrode properties. + """ channel_groups = get_channel_groups(xml_file_path=xml_file_path) ecephys_metadata = dict( ElectrodeGroup=[ @@ -163,6 +176,14 @@ def __init__( ) def get_metadata(self) -> dict: + """ + Get metadata for the NeuroScope recording. + + Returns + ------- + dict + Dictionary containing metadata including Ecephys information and session start time. + """ session_path = Path(self.source_data["file_path"]).parent session_id = session_path.stem xml_file_path = self.source_data.get("xml_file_path", str(session_path / f"{session_id}.xml")) @@ -174,6 +195,15 @@ def get_metadata(self) -> dict: return metadata def get_original_timestamps(self) -> np.ndarray: + """ + Get the original timestamps for the recording. + + Returns + ------- + numpy.ndarray or list of numpy.ndarray + The timestamps for each sample in the recording. If there are multiple segments, + returns a list of timestamp arrays, one for each segment. + """ # TODO: add generic method for aliasing from NeuroConv signature to SI init new_recording = self.get_extractor()(file_path=self.source_data["file_path"]) if self._number_of_segments == 1: diff --git a/src/neuroconv/datainterfaces/ecephys/openephys/openephysbinarydatainterface.py b/src/neuroconv/datainterfaces/ecephys/openephys/openephysbinarydatainterface.py index 503faa025..948d06613 100644 --- a/src/neuroconv/datainterfaces/ecephys/openephys/openephysbinarydatainterface.py +++ b/src/neuroconv/datainterfaces/ecephys/openephys/openephysbinarydatainterface.py @@ -21,6 +21,19 @@ class OpenEphysBinaryRecordingInterface(BaseRecordingExtractorInterface): @classmethod def get_stream_names(cls, folder_path: DirectoryPath) -> list[str]: + """ + Get the names of available recording streams in the OpenEphys binary folder. + + Parameters + ---------- + folder_path : DirectoryPath + Path to directory containing OpenEphys binary files. + + Returns + ------- + list of str + The names of the available recording streams. + """ from spikeinterface.extractors import OpenEphysBinaryRecordingExtractor stream_names, _ = OpenEphysBinaryRecordingExtractor.get_streams(folder_path=folder_path) diff --git a/src/neuroconv/datainterfaces/ecephys/openephys/openephysdatainterface.py b/src/neuroconv/datainterfaces/ecephys/openephys/openephysdatainterface.py index c25cc63ca..6506d7a49 100644 --- a/src/neuroconv/datainterfaces/ecephys/openephys/openephysdatainterface.py +++ b/src/neuroconv/datainterfaces/ecephys/openephys/openephysdatainterface.py @@ -27,6 +27,24 @@ def get_source_schema(cls) -> dict: @classmethod def get_stream_names(cls, folder_path: DirectoryPath) -> list[str]: + """ + Get the names of available recording streams in the OpenEphys folder. + + Parameters + ---------- + folder_path : DirectoryPath + Path to OpenEphys directory (.continuous or .dat files). + + Returns + ------- + list of str + The names of the available recording streams. + + Raises + ------ + AssertionError + If the data is neither in 'legacy' (.continuous) nor 'binary' (.dat) format. + """ if any(Path(folder_path).rglob("*.continuous")): return OpenEphysLegacyRecordingInterface.get_stream_names(folder_path=folder_path) elif any(Path(folder_path).rglob("*.dat")): diff --git a/src/neuroconv/datainterfaces/ecephys/openephys/openephyslegacydatainterface.py b/src/neuroconv/datainterfaces/ecephys/openephys/openephyslegacydatainterface.py index e6a8e0d79..bdab7752b 100644 --- a/src/neuroconv/datainterfaces/ecephys/openephys/openephyslegacydatainterface.py +++ b/src/neuroconv/datainterfaces/ecephys/openephys/openephyslegacydatainterface.py @@ -20,6 +20,19 @@ class OpenEphysLegacyRecordingInterface(BaseRecordingExtractorInterface): @classmethod def get_stream_names(cls, folder_path: DirectoryPath) -> list[str]: + """ + Get the names of available recording streams in the OpenEphys legacy folder. + + Parameters + ---------- + folder_path : DirectoryPath + Path to directory containing OpenEphys legacy files. + + Returns + ------- + list of str + The names of the available recording streams. + """ from spikeinterface.extractors import OpenEphysLegacyRecordingExtractor stream_names, _ = OpenEphysLegacyRecordingExtractor.get_streams(folder_path=folder_path) diff --git a/src/neuroconv/datainterfaces/ecephys/openephys/openephyssortingdatainterface.py b/src/neuroconv/datainterfaces/ecephys/openephys/openephyssortingdatainterface.py index ecf2067f1..1fc260927 100644 --- a/src/neuroconv/datainterfaces/ecephys/openephys/openephyssortingdatainterface.py +++ b/src/neuroconv/datainterfaces/ecephys/openephys/openephyssortingdatainterface.py @@ -13,7 +13,15 @@ class OpenEphysSortingInterface(BaseSortingExtractorInterface): @classmethod def get_source_schema(cls) -> dict: - """Compile input schema for the SortingExtractor.""" + """ + Compile input schema for the SortingExtractor. + + Returns + ------- + dict + The schema dictionary containing input parameters and descriptions + for initializing the SortingExtractor. + """ metadata_schema = get_json_schema_from_method_signature( method=cls.__init__, exclude=["recording_id", "experiment_id"] ) diff --git a/src/neuroconv/datainterfaces/ecephys/spike2/spike2datainterface.py b/src/neuroconv/datainterfaces/ecephys/spike2/spike2datainterface.py index 4fdf4239b..0d3fcfcff 100644 --- a/src/neuroconv/datainterfaces/ecephys/spike2/spike2datainterface.py +++ b/src/neuroconv/datainterfaces/ecephys/spike2/spike2datainterface.py @@ -29,6 +29,15 @@ class Spike2RecordingInterface(BaseRecordingExtractorInterface): @classmethod def get_source_schema(cls) -> dict: + """ + Get the schema for the source arguments. + + Returns + ------- + dict + The schema dictionary containing input parameters and descriptions + for initializing the Spike2 recording interface. + """ source_schema = get_json_schema_from_method_signature(method=cls.__init__, exclude=["smrx_channel_ids"]) source_schema.update(additionalProperties=True) source_schema["properties"]["file_path"].update(description="Path to .smrx file.") @@ -36,7 +45,19 @@ def get_source_schema(cls) -> dict: @classmethod def get_all_channels_info(cls, file_path: FilePath): - """Retrieve and inspect necessary channel information prior to initialization.""" + """ + Retrieve and inspect necessary channel information prior to initialization. + + Parameters + ---------- + file_path : FilePath + Path to .smr or .smrx file. + + Returns + ------- + dict + Dictionary containing information about all channels in the Spike2 file. + """ _test_sonpy_installation() return cls.get_extractor().get_all_channels_info(file_path=file_path) diff --git a/src/neuroconv/datainterfaces/ecephys/spikeglx/spikeglxconverter.py b/src/neuroconv/datainterfaces/ecephys/spikeglx/spikeglxconverter.py index 029955d24..40f6c59e2 100644 --- a/src/neuroconv/datainterfaces/ecephys/spikeglx/spikeglxconverter.py +++ b/src/neuroconv/datainterfaces/ecephys/spikeglx/spikeglxconverter.py @@ -22,14 +22,35 @@ class SpikeGLXConverterPipe(ConverterPipe): info = "Converter for multi-stream SpikeGLX recording data." @classmethod - def get_source_schema(cls): + def get_source_schema(cls) -> dict: + """ + Get the schema for the source arguments. + + Returns + ------- + dict + The schema dictionary containing input parameters and descriptions + for initializing the SpikeGLX converter. + """ source_schema = get_json_schema_from_method_signature(method=cls.__init__, exclude=["streams"]) source_schema["properties"]["folder_path"]["description"] = "Path to the folder containing SpikeGLX streams." return source_schema @classmethod def get_streams(cls, folder_path: DirectoryPath) -> list[str]: - "Return the stream ids available in the folder." + """ + Get the stream IDs available in the folder. + + Parameters + ---------- + folder_path : DirectoryPath + Path to the folder containing SpikeGLX streams. + + Returns + ------- + list of str + The IDs of all available streams in the folder. + """ from spikeinterface.extractors import SpikeGLXRecordingExtractor # The first entry is the stream ids the second is the stream names @@ -78,6 +99,15 @@ def __init__( super().__init__(data_interfaces=data_interfaces, verbose=verbose) def get_conversion_options_schema(self) -> dict: + """ + Get the schema for the conversion options. + + Returns + ------- + dict + The schema dictionary containing conversion options for each data interface + in this converter. + """ conversion_options_schema = super().get_conversion_options_schema() conversion_options_schema["properties"].update( {name: interface.get_conversion_options_schema() for name, interface in self.data_interface_objects.items()} diff --git a/src/neuroconv/datainterfaces/ecephys/spikeglx/spikeglxnidqinterface.py b/src/neuroconv/datainterfaces/ecephys/spikeglx/spikeglxnidqinterface.py index eae58421f..efa2a2119 100644 --- a/src/neuroconv/datainterfaces/ecephys/spikeglx/spikeglxnidqinterface.py +++ b/src/neuroconv/datainterfaces/ecephys/spikeglx/spikeglxnidqinterface.py @@ -136,7 +136,14 @@ def get_metadata(self) -> dict: return metadata def get_channel_names(self) -> list[str]: - """Return a list of channel names as set in the recording extractor.""" + """ + Get a list of channel names from the recording extractor. + + Returns + ------- + list of str + The names of all channels in the NIDQ recording. + """ return list(self.recording_extractor.get_channel_ids()) def add_to_nwbfile( diff --git a/src/neuroconv/datainterfaces/icephys/abf/abfdatainterface.py b/src/neuroconv/datainterfaces/icephys/abf/abfdatainterface.py index 535381466..9a92e1eaa 100644 --- a/src/neuroconv/datainterfaces/icephys/abf/abfdatainterface.py +++ b/src/neuroconv/datainterfaces/icephys/abf/abfdatainterface.py @@ -10,7 +10,19 @@ def get_start_datetime(neo_reader): - """Get start datetime for Abf file.""" + """ + Get start datetime for Abf file. + + Parameters + ---------- + neo_reader : neo.io.AxonIO + The Neo reader object for the ABF file. + + Returns + ------- + datetime + The start date and time of the recording. + """ if all(k in neo_reader._axon_info for k in ["uFileStartDate", "uFileStartTimeMS"]): startDate = str(neo_reader._axon_info["uFileStartDate"]) startTime = round(neo_reader._axon_info["uFileStartTimeMS"] / 1000) @@ -77,6 +89,15 @@ def __init__( ) def get_metadata(self) -> dict: + """ + Get metadata for the ABF recording. + + Returns + ------- + dict + Dictionary containing metadata including session start time, device information, + and recording session details. + """ from ....tools.neo import get_number_of_electrodes, get_number_of_segments metadata = super().get_metadata() diff --git a/src/neuroconv/datainterfaces/ophys/baseimagingextractorinterface.py b/src/neuroconv/datainterfaces/ophys/baseimagingextractorinterface.py index 08cd31125..8e921eedf 100644 --- a/src/neuroconv/datainterfaces/ophys/baseimagingextractorinterface.py +++ b/src/neuroconv/datainterfaces/ophys/baseimagingextractorinterface.py @@ -48,15 +48,13 @@ def get_metadata_schema( self, ) -> dict: """ - Retrieve the metadata schema for the optical physiology (Ophys) data, with optional handling of photon series type. - - Parameters - ---------- - photon_series_type : {"OnePhotonSeries", "TwoPhotonSeries"}, optional - The type of photon series to include in the schema. If None, the value from the instance is used. - This argument is deprecated and will be removed in a future version. Set `photon_series_type` during - the initialization of the `BaseImagingExtractorInterface` instance. - + Retrieve the metadata schema for the optical physiology (Ophys) data. + + Returns + ------- + dict + The metadata schema dictionary containing definitions for Device, ImagingPlane, + and either OnePhotonSeries or TwoPhotonSeries based on the photon_series_type. """ metadata_schema = super().get_metadata_schema() @@ -105,14 +103,13 @@ def get_metadata( self, ) -> DeepDict: """ - Retrieve the metadata for the imaging data, with optional handling of photon series type. - - Parameters - ---------- - photon_series_type : {"OnePhotonSeries", "TwoPhotonSeries"}, optional - The type of photon series to include in the metadata. If None, the value from the instance is used. - This argument is deprecated and will be removed in a future version. Instead, set `photon_series_type` - during the initialization of the `BaseImagingExtractorInterface` instance. + Retrieve the metadata for the imaging data. + + Returns + ------- + DeepDict + Dictionary containing metadata including device information, imaging plane details, + and photon series configuration. """ from ...tools.roiextractors import get_nwb_imaging_metadata diff --git a/src/neuroconv/datainterfaces/ophys/brukertiff/brukertiffconverter.py b/src/neuroconv/datainterfaces/ophys/brukertiff/brukertiffconverter.py index 81c17474d..87e116d38 100644 --- a/src/neuroconv/datainterfaces/ophys/brukertiff/brukertiffconverter.py +++ b/src/neuroconv/datainterfaces/ophys/brukertiff/brukertiffconverter.py @@ -30,8 +30,15 @@ def get_source_schema(cls): ] = "The folder that contains the Bruker TIF image files (.ome.tif) and configuration files (.xml, .env)." return source_schema - def get_conversion_options_schema(self): - """get the conversion options schema.""" + def get_conversion_options_schema(self) -> dict: + """ + Get the schema for the conversion options. + + Returns + ------- + dict + The schema dictionary containing conversion options for the Bruker TIFF interface. + """ interface_name = list(self.data_interface_objects.keys())[0] return self.data_interface_objects[interface_name].get_conversion_options_schema() @@ -173,8 +180,15 @@ class BrukerTiffSinglePlaneConverter(NWBConverter): def get_source_schema(cls): return get_json_schema_from_method_signature(cls) - def get_conversion_options_schema(self): - """Get the conversion options schema.""" + def get_conversion_options_schema(self) -> dict: + """ + Get the schema for the conversion options. + + Returns + ------- + dict + The schema dictionary containing conversion options for the Bruker TIFF interface. + """ interface_name = list(self.data_interface_objects.keys())[0] return self.data_interface_objects[interface_name].get_conversion_options_schema() diff --git a/src/neuroconv/datainterfaces/ophys/caiman/caimandatainterface.py b/src/neuroconv/datainterfaces/ophys/caiman/caimandatainterface.py index 9ab1f460f..8c668f89f 100644 --- a/src/neuroconv/datainterfaces/ophys/caiman/caimandatainterface.py +++ b/src/neuroconv/datainterfaces/ophys/caiman/caimandatainterface.py @@ -12,7 +12,15 @@ class CaimanSegmentationInterface(BaseSegmentationExtractorInterface): @classmethod def get_source_schema(cls) -> dict: - """Get the source schema for the Caiman segmentation interface.""" + """ + Get the source schema for the Caiman segmentation interface. + + Returns + ------- + dict + The schema dictionary containing input parameters and descriptions + for initializing the CaImAn segmentation interface. + """ source_metadata = super().get_source_schema() source_metadata["properties"]["file_path"]["description"] = "Path to .hdf5 file." return source_metadata diff --git a/src/neuroconv/datainterfaces/ophys/micromanagertiff/micromanagertiffdatainterface.py b/src/neuroconv/datainterfaces/ophys/micromanagertiff/micromanagertiffdatainterface.py index 8484920cd..97dd10742 100644 --- a/src/neuroconv/datainterfaces/ophys/micromanagertiff/micromanagertiffdatainterface.py +++ b/src/neuroconv/datainterfaces/ophys/micromanagertiff/micromanagertiffdatainterface.py @@ -13,7 +13,15 @@ class MicroManagerTiffImagingInterface(BaseImagingExtractorInterface): @classmethod def get_source_schema(cls) -> dict: - """get the source schema for the Micro-Manager TIFF imaging interface.""" + """ + Get the source schema for the Micro-Manager TIFF imaging interface. + + Returns + ------- + dict + The schema dictionary containing input parameters and descriptions + for initializing the Micro-Manager TIFF interface. + """ source_schema = super().get_source_schema() source_schema["properties"]["folder_path"]["description"] = "The folder containing the OME-TIF image files." @@ -38,7 +46,15 @@ def __init__(self, folder_path: DirectoryPath, verbose: bool = False): self.imaging_extractor._channel_names = [f"OpticalChannel{channel_name}"] def get_metadata(self) -> dict: - """Get metadata for the Micro-Manager TIFF imaging data.""" + """ + Get metadata for the Micro-Manager TIFF imaging data. + + Returns + ------- + dict + Dictionary containing metadata including session start time, imaging plane details, + and two-photon series configuration. + """ metadata = super().get_metadata() micromanager_metadata = self.imaging_extractor.micromanager_metadata diff --git a/src/neuroconv/datainterfaces/ophys/miniscope/miniscopeconverter.py b/src/neuroconv/datainterfaces/ophys/miniscope/miniscopeconverter.py index 75b72d06a..a5e1470e4 100644 --- a/src/neuroconv/datainterfaces/ophys/miniscope/miniscopeconverter.py +++ b/src/neuroconv/datainterfaces/ophys/miniscope/miniscopeconverter.py @@ -61,7 +61,14 @@ def __init__(self, folder_path: DirectoryPath, verbose: bool = False): ) def get_conversion_options_schema(self) -> dict: - """get the conversion options schema.""" + """ + Get the schema for the conversion options. + + Returns + ------- + dict + The schema dictionary containing conversion options for the Miniscope interface. + """ return self.data_interface_objects["MiniscopeImaging"].get_conversion_options_schema() def add_to_nwbfile( diff --git a/src/neuroconv/datainterfaces/ophys/miniscope/miniscopeimagingdatainterface.py b/src/neuroconv/datainterfaces/ophys/miniscope/miniscopeimagingdatainterface.py index 5a1f6d521..5a463b5ae 100644 --- a/src/neuroconv/datainterfaces/ophys/miniscope/miniscopeimagingdatainterface.py +++ b/src/neuroconv/datainterfaces/ophys/miniscope/miniscopeimagingdatainterface.py @@ -19,7 +19,15 @@ class MiniscopeImagingInterface(BaseImagingExtractorInterface): @classmethod def get_source_schema(cls) -> dict: - """Get the source schema for the Miniscope imaging interface.""" + """ + Get the source schema for the Miniscope imaging interface. + + Returns + ------- + dict + The schema dictionary containing input parameters and descriptions + for initializing the Miniscope imaging interface. + """ source_schema = super().get_source_schema() source_schema["properties"]["folder_path"][ "description" @@ -50,7 +58,15 @@ def __init__(self, folder_path: DirectoryPath): self.photon_series_type = "OnePhotonSeries" def get_metadata(self) -> DeepDict: - """Get metadata for the Miniscope imaging data.""" + """ + Get metadata for the Miniscope imaging data. + + Returns + ------- + DeepDict + Dictionary containing metadata including device information, imaging plane details, + and one-photon series configuration. + """ from ....tools.roiextractors import get_nwb_imaging_metadata metadata = super().get_metadata() @@ -76,7 +92,15 @@ def get_metadata(self) -> DeepDict: return metadata def get_metadata_schema(self) -> dict: - """Get the metadata schema for the Miniscope imaging data.""" + """ + Get the metadata schema for the Miniscope imaging data. + + Returns + ------- + dict + The schema dictionary containing metadata definitions and requirements + for the Miniscope imaging interface. + """ metadata_schema = super().get_metadata_schema() metadata_schema["properties"]["Ophys"]["definitions"]["Device"]["additionalProperties"] = True return metadata_schema diff --git a/src/neuroconv/datainterfaces/ophys/sbx/sbxdatainterface.py b/src/neuroconv/datainterfaces/ophys/sbx/sbxdatainterface.py index fc259cad2..c0e85553a 100644 --- a/src/neuroconv/datainterfaces/ophys/sbx/sbxdatainterface.py +++ b/src/neuroconv/datainterfaces/ophys/sbx/sbxdatainterface.py @@ -37,7 +37,15 @@ def __init__( ) def get_metadata(self) -> dict: - """Get metadata for the Scanbox imaging data.""" + """ + Get metadata for the Scanbox imaging data. + + Returns + ------- + dict + Dictionary containing metadata including device information and imaging details + specific to the Scanbox system. + """ metadata = super().get_metadata() metadata["Ophys"]["Device"][0]["description"] = "Scanbox imaging" return metadata diff --git a/src/neuroconv/datainterfaces/ophys/scanimage/scanimageimaginginterfaces.py b/src/neuroconv/datainterfaces/ophys/scanimage/scanimageimaginginterfaces.py index b004b8ee0..611ed1da7 100644 --- a/src/neuroconv/datainterfaces/ophys/scanimage/scanimageimaginginterfaces.py +++ b/src/neuroconv/datainterfaces/ophys/scanimage/scanimageimaginginterfaces.py @@ -28,7 +28,15 @@ class ScanImageImagingInterface(BaseImagingExtractorInterface): @classmethod def get_source_schema(cls) -> dict: - """Get the source schema for the ScanImage imaging interface.""" + """ + Get the source schema for the ScanImage imaging interface. + + Returns + ------- + dict + The schema dictionary containing input parameters and descriptions + for initializing the ScanImage interface. + """ source_schema = super().get_source_schema() source_schema["properties"]["file_path"]["description"] = "Path to Tiff file." return source_schema @@ -140,7 +148,15 @@ def __init__( super().__init__(file_path=file_path, fallback_sampling_frequency=fallback_sampling_frequency, verbose=verbose) def get_metadata(self) -> dict: - """get metadata for the ScanImage imaging data""" + """ + Get metadata for the ScanImage imaging data. + + Returns + ------- + dict + Dictionary containing metadata including session start time and device information + specific to the ScanImage system. + """ device_number = 0 # Imaging plane metadata is a list with metadata for each plane metadata = super().get_metadata() @@ -176,7 +192,15 @@ class ScanImageMultiFileImagingInterface(BaseImagingExtractorInterface): @classmethod def get_source_schema(cls) -> dict: - """get the source schema for the ScanImage multi-file imaging interface.""" + """ + Get the source schema for the ScanImage multi-file imaging interface. + + Returns + ------- + dict + The schema dictionary containing input parameters and descriptions + for initializing the ScanImage multi-file interface. + """ source_schema = super().get_source_schema() source_schema["properties"]["folder_path"]["description"] = "Path to the folder containing the TIFF files." return source_schema @@ -307,7 +331,15 @@ def __init__( ) def get_metadata(self) -> dict: - """get metadata for the ScanImage imaging data""" + """ + Get metadata for the ScanImage imaging data. + + Returns + ------- + dict + Dictionary containing metadata including session start time and device information + specific to the ScanImage system. + """ metadata = super().get_metadata() extracted_session_start_time = datetime.datetime.strptime( @@ -730,8 +762,13 @@ def get_scanimage_major_version(scanimage_metadata: dict) -> str: Returns ------- - version : str + str The version of ScanImage that produced the TIFF file. + + Raises + ------ + ValueError + If the ScanImage version could not be determined from metadata. """ if "SI.VERSION_MAJOR" in scanimage_metadata: return scanimage_metadata["SI.VERSION_MAJOR"] diff --git a/src/neuroconv/datainterfaces/ophys/suite2p/suite2pdatainterface.py b/src/neuroconv/datainterfaces/ophys/suite2p/suite2pdatainterface.py index a2a8e876c..31a260326 100644 --- a/src/neuroconv/datainterfaces/ophys/suite2p/suite2pdatainterface.py +++ b/src/neuroconv/datainterfaces/ophys/suite2p/suite2pdatainterface.py @@ -50,7 +50,15 @@ class Suite2pSegmentationInterface(BaseSegmentationExtractorInterface): @classmethod def get_source_schema(cls) -> dict: - """Get the source schema for the Suite2p segmentation interface.""" + """ + Get the source schema for the Suite2p segmentation interface. + + Returns + ------- + dict + The schema dictionary containing input parameters and descriptions + for initializing the Suite2p segmentation interface. + """ schema = super().get_source_schema() schema["properties"]["folder_path"][ "description" @@ -63,12 +71,38 @@ def get_source_schema(cls) -> dict: @classmethod def get_available_planes(cls, folder_path: DirectoryPath) -> dict: + """ + Get the available planes in the Suite2p segmentation folder. + + Parameters + ---------- + folder_path : DirectoryPath + Path to the folder containing Suite2p segmentation data. + + Returns + ------- + dict + Dictionary containing information about available planes in the dataset. + """ from roiextractors import Suite2pSegmentationExtractor return Suite2pSegmentationExtractor.get_available_planes(folder_path=folder_path) @classmethod def get_available_channels(cls, folder_path: DirectoryPath) -> dict: + """ + Get the available channels in the Suite2p segmentation folder. + + Parameters + ---------- + folder_path : DirectoryPath + Path to the folder containing Suite2p segmentation data. + + Returns + ------- + dict + Dictionary containing information about available channels in the dataset. + """ from roiextractors import Suite2pSegmentationExtractor return Suite2pSegmentationExtractor.get_available_channels(folder_path=folder_path) @@ -114,7 +148,15 @@ def __init__( self.verbose = verbose def get_metadata(self) -> DeepDict: - """get metadata for the Suite2p segmentation data""" + """ + Get metadata for the Suite2p segmentation data. + + Returns + ------- + DeepDict + Dictionary containing metadata including plane segmentation details, + fluorescence data, and segmentation images. + """ metadata = super().get_metadata() # No need to update the metadata links for the default plane segmentation name From 2085ad7ac4b57eb2cec80fdfe587243b2d48585b Mon Sep 17 00:00:00 2001 From: pauladkisson Date: Fri, 24 Jan 2025 12:18:40 -0800 Subject: [PATCH 03/19] added returns section to various getters (Cline second try w/ manual reversions) --- .../datainterfaces/icephys/abf/abfdatainterface.py | 9 --------- 1 file changed, 9 deletions(-) diff --git a/src/neuroconv/datainterfaces/icephys/abf/abfdatainterface.py b/src/neuroconv/datainterfaces/icephys/abf/abfdatainterface.py index 9a92e1eaa..fcf415f90 100644 --- a/src/neuroconv/datainterfaces/icephys/abf/abfdatainterface.py +++ b/src/neuroconv/datainterfaces/icephys/abf/abfdatainterface.py @@ -89,15 +89,6 @@ def __init__( ) def get_metadata(self) -> dict: - """ - Get metadata for the ABF recording. - - Returns - ------- - dict - Dictionary containing metadata including session start time, device information, - and recording session details. - """ from ....tools.neo import get_number_of_electrodes, get_number_of_segments metadata = super().get_metadata() From cadb7eda149cf0aa35ad6bc884976d150393d089 Mon Sep 17 00:00:00 2001 From: pauladkisson Date: Fri, 24 Jan 2025 13:01:12 -0800 Subject: [PATCH 04/19] added analyze_docstrings.py to help cline catch all the docstrings it was missing --- src/neuroconv/tools/analyze_docstrings.py | 142 + .../tools/getter_docstrings_analysis.txt | 2418 +++++++++++++++++ 2 files changed, 2560 insertions(+) create mode 100644 src/neuroconv/tools/analyze_docstrings.py create mode 100644 src/neuroconv/tools/getter_docstrings_analysis.txt diff --git a/src/neuroconv/tools/analyze_docstrings.py b/src/neuroconv/tools/analyze_docstrings.py new file mode 100644 index 000000000..b0c1ec318 --- /dev/null +++ b/src/neuroconv/tools/analyze_docstrings.py @@ -0,0 +1,142 @@ +"""Script to analyze docstrings of getter functions/methods in the neuroconv package.""" + +import ast +import os +from pathlib import Path +from typing import List, Tuple + + +def get_docstring(node: ast.FunctionDef) -> str: + """ + Extract docstring from a function node. + + Parameters + ---------- + node : ast.FunctionDef + The AST node representing a function definition. + + Returns + ------- + str + The docstring of the function, or "No docstring" if none exists. + """ + docstring_node = ast.get_docstring(node) + return docstring_node if docstring_node else "No docstring" + + +def is_getter_function(node: ast.FunctionDef) -> bool: + """ + Check if a function is a getter function (starts with 'get_'). + + Parameters + ---------- + node : ast.FunctionDef + The AST node representing a function definition. + + Returns + ------- + bool + True if the function is a getter function, False otherwise. + """ + return node.name.startswith("get_") + + +def get_class_methods(node: ast.ClassDef) -> dict: + """ + Get all getter methods from a class definition. + + Parameters + ---------- + node : ast.ClassDef + The class definition node to analyze. + + Returns + ------- + dict + Dictionary mapping method names to their docstrings. + """ + methods = {} + for item in node.body: + if isinstance(item, ast.FunctionDef) and is_getter_function(item): + methods[item.name] = get_docstring(item) + return methods + + +def analyze_file(file_path: Path, output_file) -> None: + """ + Analyze getter functions in a Python file. + + Parameters + ---------- + file_path : Path + Path to the Python file to analyze. + output_file : file object + File to write the analysis results to. + """ + try: + with open(file_path, "r", encoding="utf-8") as f: + tree = ast.parse(f.read(), filename=str(file_path)) + except Exception as e: + output_file.write(f"Error parsing {file_path}: {e}\n") + return + + # First pass: collect all classes and their methods + classes = {} + for node in ast.walk(tree): + if isinstance(node, ast.ClassDef): + methods = get_class_methods(node) + if methods: # Only add classes that have getter methods + classes[node.name] = methods + + # Second pass: handle standalone functions + for node in ast.walk(tree): + if isinstance(node, ast.FunctionDef) and is_getter_function(node): + # Skip if this is a method we've already processed + parent_class = next((class_name for class_name, methods in classes.items() + if node.name in methods), None) + if not parent_class: + output_file.write(f"\nFunction: {node.name}\n") + output_file.write("Docstring:\n") + output_file.write(f"{get_docstring(node)}\n") + output_file.write("-" * 80 + "\n") + + # Output class methods + for class_name, methods in classes.items(): + for method_name, docstring in methods.items(): + output_file.write(f"\nFunction: {class_name}.{method_name}\n") + output_file.write("Docstring:\n") + output_file.write(f"{docstring}\n") + output_file.write("-" * 80 + "\n") + + +def analyze_getter_functions(package_dir: Path, output_path: Path) -> None: + """ + Analyze all getter functions in the package. + + Parameters + ---------- + package_dir : Path + Path to the package directory to analyze. + output_path : Path + Path to the output file where results will be written. + """ + with open(output_path, "w", encoding="utf-8") as output_file: + for file_path in package_dir.rglob("*.py"): + if file_path.name.startswith("_"): # Skip private modules + continue + + output_file.write(f"\nAnalyzing {file_path}...\n") + analyze_file(file_path, output_file) + + +def main(): + """Run the docstring analysis.""" + # Get the package directory (src/neuroconv) + package_dir = Path(__file__).parent.parent + output_path = package_dir / "tools" / "getter_docstrings_analysis.txt" + analyze_getter_functions(package_dir, output_path) + print(f"Analysis complete. Results written to: {output_path}") + + +if __name__ == "__main__": + main() diff --git a/src/neuroconv/tools/getter_docstrings_analysis.txt b/src/neuroconv/tools/getter_docstrings_analysis.txt new file mode 100644 index 000000000..96b124dbc --- /dev/null +++ b/src/neuroconv/tools/getter_docstrings_analysis.txt @@ -0,0 +1,2418 @@ + +Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/basetemporalalignmentinterface.py... + +Function: BaseTemporalAlignmentInterface.get_original_timestamps +Docstring: +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: numpy.ndarray + The timestamps for the data stream. +-------------------------------------------------------------------------------- + +Function: BaseTemporalAlignmentInterface.get_timestamps +Docstring: +Retrieve the timestamps for the data in this interface. + +Returns +------- +timestamps: numpy.ndarray + The timestamps for the data stream. +-------------------------------------------------------------------------------- + +Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/baseextractorinterface.py... + +Function: BaseExtractorInterface.get_extractor +Docstring: +Get the extractor class for this interface. + +Returns +------- +type + The extractor class that will be used to read the data. +-------------------------------------------------------------------------------- + +Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/basedatainterface.py... + +Function: BaseDataInterface.get_source_schema +Docstring: +Infer the JSON schema for the source_data from the method signature (annotation typing). + +Returns +------- +dict + The JSON schema for the source_data. +-------------------------------------------------------------------------------- + +Function: BaseDataInterface.get_metadata_schema +Docstring: +Retrieve JSON schema for metadata. + +Returns +------- +dict + The JSON schema defining the metadata structure. +-------------------------------------------------------------------------------- + +Function: BaseDataInterface.get_metadata +Docstring: +Child DataInterface classes should override this to match their metadata. + +Returns +------- +DeepDict + The metadata dictionary containing basic NWBFile metadata. +-------------------------------------------------------------------------------- + +Function: BaseDataInterface.get_conversion_options_schema +Docstring: +Infer the JSON schema for the conversion options from the method signature (annotation typing). + +Returns +------- +dict + The JSON schema for the conversion options. +-------------------------------------------------------------------------------- + +Function: BaseDataInterface.get_default_backend_configuration +Docstring: +Fill and return a default backend configuration to serve as a starting point for further customization. + +Parameters +---------- +nwbfile : pynwb.NWBFile + The in-memory object with this interface's data already added to it. +backend : "hdf5", default: "hdf5" + The type of backend to use when creating the file. + Additional backend types will be added soon. + +Returns +------- +Union[HDF5BackendConfiguration, ZarrBackendConfiguration] + The default configuration for the specified backend type. +-------------------------------------------------------------------------------- + +Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/nwbconverter.py... + +Function: NWBConverter.get_source_schema +Docstring: +Compile input schemas from each of the data interface classes. + +Returns +------- +dict + The compiled source schema from all data interface classes. +-------------------------------------------------------------------------------- + +Function: NWBConverter.get_metadata_schema +Docstring: +Compile metadata schemas from each of the data interface objects. + +Returns +------- +dict + The compiled metadata schema from all data interface objects. +-------------------------------------------------------------------------------- + +Function: NWBConverter.get_metadata +Docstring: +Auto-fill as much of the metadata as possible. Must comply with metadata schema. + +Returns +------- +DeepDict + The metadata dictionary containing auto-filled metadata from all interfaces. +-------------------------------------------------------------------------------- + +Function: NWBConverter.get_conversion_options_schema +Docstring: +Compile conversion option schemas from each of the data interface classes. + +Returns +------- +dict + The compiled conversion options schema from all data interface classes. +-------------------------------------------------------------------------------- + +Function: NWBConverter.get_default_backend_configuration +Docstring: +Fill and return a default backend configuration to serve as a starting point for further customization. + +Parameters +---------- +nwbfile : pynwb.NWBFile + The in-memory object with this interface's data already added to it. +backend : "hdf5" or "zarr", default: "hdf5" + The type of backend to use when creating the file. + +Returns +------- +Union[HDF5BackendConfiguration, ZarrBackendConfiguration] + The default configuration for the specified backend type. +-------------------------------------------------------------------------------- + +Function: ConverterPipe.get_source_schema +Docstring: +No docstring +-------------------------------------------------------------------------------- + +Function: ConverterPipe.get_conversion_options_schema +Docstring: +Compile conversion option schemas from each of the data interface classes. +-------------------------------------------------------------------------------- + +Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/tools/path_expansion.py... + +Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/tools/importing.py... + +Function: get_package_version +Docstring: +Retrieve the version of a package. + +Parameters +---------- +name : str + Name of package. + +Returns +------- +version : Version + The package version as an object from packaging.version.Version. +-------------------------------------------------------------------------------- + +Function: get_package +Docstring: +Check if package is installed and return module if so. + +Otherwise, raise informative error describing how to perform the installation. +Inspired by https://docs.python.org/3/library/importlib.html#checking-if-a-module-can-be-imported. + +Parameters +---------- +package_name : str + Name of the package to be imported. +installation_instructions : str, optional + String describing the source, options, and alias of package name (if needed) for installation. + For example, + >>> installation_source = "conda install -c conda-forge my-package-name" + Defaults to f"pip install {package_name}". +excluded_python_versions : list of strs, optional + If a given package has no distribution available for a certain Python version, it can be excluded by this + import across all platforms. If you wish to be more specific about combinations of platforms and versions, + use the 'excluded_platforms_and_python_versions' keyword argument instead. + Allows all Python versions by default. +excluded_platforms_and_python_versions : dict, optional + Mapping of string platform names to a list of string versions. + Valid platform strings are: ["linux", "win32", "darwin"] or any other variant used by sys.platform + + In case some combinations of platforms or Python versions are not allowed for the given package, + specify this dictionary to raise a more specific error to that issue. + + For example, `excluded_platforms_and_python_versions = dict(darwin=["3.7"])` will raise an + informative error when running on macOS with Python version 3.7. + + This also applies to specific architectures of platforms, such as + `excluded_platforms_and_python_versions = dict(darwin=dict(arm=["3.7"]))` to exclude a specific Python + version for M1 Macs. + + Allows all platforms and Python versions by default. + +Raises +------ +ModuleNotFoundError +-------------------------------------------------------------------------------- + +Function: get_format_summaries +Docstring: +Simple helper function for compiling high level summaries of all format interfaces and converters. + +Returns +------- +dict + A dictionary mapping interface/converter names to their summary information. + Each summary contains display_name, keywords, associated_suffixes, and info. +-------------------------------------------------------------------------------- + +Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/tools/optogenetics.py... + +Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/tools/figshare.py... + +Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/tools/fiber_photometry.py... + +Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/tools/processes.py... + +Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/tools/analyze_docstrings.py... + +Function: get_docstring +Docstring: +Extract docstring from a function node. + +Parameters +---------- +node : ast.FunctionDef + The AST node representing a function definition. + +Returns +------- +str + The docstring of the function, or "No docstring" if none exists. +-------------------------------------------------------------------------------- + +Function: get_class_methods +Docstring: +Get all getter methods from a class definition. + +Parameters +---------- +node : ast.ClassDef + The class definition node to analyze. + +Returns +------- +dict + Dictionary mapping method names to their docstrings. +-------------------------------------------------------------------------------- + +Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/tools/text.py... + +Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/tools/hdmf.py... + +Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/tools/signal_processing.py... + +Function: get_rising_frames_from_ttl +Docstring: +Return the frame indices for rising events in a TTL pulse. + +Parameters +---------- +trace : numpy.ndarray + A TTL signal. +threshold : float, optional + The threshold used to distinguish on/off states in the trace. + The mean of the trace is used by default. + +Returns +------- +rising_frames : numpy.ndarray + The frame indices of rising events. +-------------------------------------------------------------------------------- + +Function: get_falling_frames_from_ttl +Docstring: +Return the frame indices for falling events in a TTL pulse. + +Parameters +---------- +trace : numpy.ndarray + A TTL signal. +threshold : float, optional + The threshold used to distinguish on/off states in the trace. + The mean of the trace is used by default. + +Returns +------- +falling_frames : numpy.ndarray + The frame indices of falling events. +-------------------------------------------------------------------------------- + +Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/utils/str_utils.py... + +Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/utils/checks.py... + +Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/utils/types.py... + +Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/utils/json_schema.py... + +Function: get_base_schema +Docstring: +Return the base schema used for all other schemas. +-------------------------------------------------------------------------------- + +Function: get_schema_from_method_signature +Docstring: +Deprecated version of `get_json_schema_from_method_signature`. +-------------------------------------------------------------------------------- + +Function: get_json_schema_from_method_signature +Docstring: +Get the equivalent JSON schema for a signature of a method. + +Also uses `docstring_parser` (NumPy style) to attempt to find descriptions for the arguments. + +Parameters +---------- +method : callable + The method to generate the JSON schema from. +exclude : list of str, optional + List of arguments to exclude from the schema generation. + Always includes 'self' and 'cls'. + +Returns +------- +json_schema : dict + The JSON schema corresponding to the method signature. +-------------------------------------------------------------------------------- + +Function: get_schema_from_hdmf_class +Docstring: +Get metadata schema from hdmf class. +-------------------------------------------------------------------------------- + +Function: get_metadata_schema_for_icephys +Docstring: +Returns the metadata schema for icephys data. + +Returns: + dict: The metadata schema for icephys data. +-------------------------------------------------------------------------------- + +Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/utils/dict.py... + +Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/utils/path.py... + +Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/tools/roiextractors/roiextractors.py... + +Function: get_nwb_imaging_metadata +Docstring: +Convert metadata from the ImagingExtractor into nwb specific metadata. + +Parameters +---------- +imgextractor : ImagingExtractor +photon_series_type : {'OnePhotonSeries', 'TwoPhotonSeries'}, optional +-------------------------------------------------------------------------------- + +Function: get_nwb_segmentation_metadata +Docstring: +Convert metadata from the segmentation into nwb specific metadata. + +Parameters +---------- +sgmextractor: SegmentationExtractor +-------------------------------------------------------------------------------- + +Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/tools/roiextractors/imagingextractordatachunkiterator.py... + +Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/tools/neo/neo.py... + +Function: get_electrodes_metadata +Docstring: +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: List of dictionaries containing electrodes metadata. +-------------------------------------------------------------------------------- + +Function: get_number_of_electrodes +Docstring: +Get number of electrodes from Neo reader. + +Returns +------- +int + The total number of electrodes in the recording. +-------------------------------------------------------------------------------- + +Function: get_number_of_segments +Docstring: +Get number of segments from Neo reader. + +Parameters +---------- +neo_reader : neo.io.baseio + The Neo reader object. +block : int, default: 0 + Block index. + +Returns +------- +int + The number of segments in the specified block. +-------------------------------------------------------------------------------- + +Function: get_command_traces +Docstring: +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. +-------------------------------------------------------------------------------- + +Function: get_conversion_from_unit +Docstring: +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 + The conversion factor to convert to Ampere or Volt. + For example, for 'pA' returns 1e-12 to convert to Ampere. +-------------------------------------------------------------------------------- + +Function: get_nwb_metadata +Docstring: +Return default metadata for all recording fields. + +Parameters +---------- +neo_reader : neo.io.baseio + Neo reader object +metadata : dict, optional + Metadata info for constructing the nwb file. + +Returns +------- +dict + Default metadata dictionary containing NWBFile and Icephys device information. +-------------------------------------------------------------------------------- + +Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/tools/testing/mock_interfaces.py... + +Function: MockInterface.get_metadata +Docstring: +No docstring +-------------------------------------------------------------------------------- + +Function: MockBehaviorEventInterface.get_source_schema +Docstring: +No docstring +-------------------------------------------------------------------------------- + +Function: MockBehaviorEventInterface.get_original_timestamps +Docstring: +Get the original event times before any alignment or transformation. + +Returns +------- +np.ndarray + The original event times as a NumPy array. +-------------------------------------------------------------------------------- + +Function: MockBehaviorEventInterface.get_timestamps +Docstring: +Get the current (possibly aligned) event times. + +Returns +------- +np.ndarray + The current event times as a NumPy array, possibly modified after alignment. +-------------------------------------------------------------------------------- + +Function: MockSpikeGLXNIDQInterface.get_source_schema +Docstring: +No docstring +-------------------------------------------------------------------------------- + +Function: MockRecordingInterface.get_metadata +Docstring: +Returns the metadata dictionary for the current object. +-------------------------------------------------------------------------------- + +Function: MockSortingInterface.get_metadata +Docstring: +No docstring +-------------------------------------------------------------------------------- + +Function: MockImagingInterface.get_metadata +Docstring: +No docstring +-------------------------------------------------------------------------------- + +Function: MockSegmentationInterface.get_metadata +Docstring: +No docstring +-------------------------------------------------------------------------------- + +Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/tools/testing/mock_files.py... + +Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/tools/testing/data_interface_mixins.py... + +Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/tools/testing/mock_probes.py... + +Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/tools/testing/mock_ttl_signals.py... + +Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/tools/audio/audio.py... + +Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/tools/spikeinterface/spikeinterface.py... + +Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/tools/spikeinterface/spikeinterfacerecordingdatachunkiterator.py... + +Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/datainterfaces/ophys/baseimagingextractorinterface.py... + +Function: BaseImagingExtractorInterface.get_metadata_schema +Docstring: +Retrieve the metadata schema for the optical physiology (Ophys) data. + +Returns +------- +dict + The metadata schema dictionary containing definitions for Device, ImagingPlane, + and either OnePhotonSeries or TwoPhotonSeries based on the photon_series_type. +-------------------------------------------------------------------------------- + +Function: BaseImagingExtractorInterface.get_metadata +Docstring: +Retrieve the metadata for the imaging data. + +Returns +------- +DeepDict + Dictionary containing metadata including device information, imaging plane details, + and photon series configuration. +-------------------------------------------------------------------------------- + +Function: BaseImagingExtractorInterface.get_original_timestamps +Docstring: +No docstring +-------------------------------------------------------------------------------- + +Function: BaseImagingExtractorInterface.get_timestamps +Docstring: +No docstring +-------------------------------------------------------------------------------- + +Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/datainterfaces/ophys/basesegmentationextractorinterface.py... + +Function: BaseSegmentationExtractorInterface.get_metadata_schema +Docstring: +Generate the metadata schema for Ophys data, updating required fields and properties. + +This method builds upon the base schema and customizes it for Ophys-specific metadata, including required +components such as devices, fluorescence data, imaging planes, and two-photon series. It also applies +temporary schema adjustments to handle certain use cases until a centralized metadata schema definition +is available. + +Returns +------- +dict + A dictionary representing the updated Ophys metadata schema. + +Notes +----- +- Ensures that `Device` and `ImageSegmentation` are marked as required. +- Updates various properties, including ensuring arrays for `ImagingPlane` and `TwoPhotonSeries`. +- Adjusts the schema for `Fluorescence`, including required fields and pattern properties. +- Adds schema definitions for `DfOverF`, segmentation images, and summary images. +- Applies temporary fixes, such as setting additional properties for `ImageSegmentation` to True. +-------------------------------------------------------------------------------- + +Function: BaseSegmentationExtractorInterface.get_metadata +Docstring: +No docstring +-------------------------------------------------------------------------------- + +Function: BaseSegmentationExtractorInterface.get_original_timestamps +Docstring: +No docstring +-------------------------------------------------------------------------------- + +Function: BaseSegmentationExtractorInterface.get_timestamps +Docstring: +No docstring +-------------------------------------------------------------------------------- + +Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/datainterfaces/ecephys/baserecordingextractorinterface.py... + +Function: BaseRecordingExtractorInterface.get_metadata_schema +Docstring: +Compile metadata schema for the RecordingExtractor. + +Returns +------- +dict + The metadata schema dictionary containing definitions for Device, ElectrodeGroup, + Electrodes, and optionally ElectricalSeries. +-------------------------------------------------------------------------------- + +Function: BaseRecordingExtractorInterface.get_metadata +Docstring: +Get metadata for the recording extractor. + +Returns +------- +DeepDict + Dictionary containing metadata including device information, electrode groups, + and electrical series configuration. +-------------------------------------------------------------------------------- + +Function: BaseRecordingExtractorInterface.get_original_timestamps +Docstring: +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: numpy.ndarray or list of numpy.ndarray + The timestamps for the data stream; if the recording has multiple segments, then a list of timestamps is returned. +-------------------------------------------------------------------------------- + +Function: BaseRecordingExtractorInterface.get_timestamps +Docstring: +Retrieve the timestamps for the data in this interface. + +Returns +------- +timestamps: numpy.ndarray or list of numpy.ndarray + The timestamps for the data stream; if the recording has multiple segments, then a list of timestamps is returned. +-------------------------------------------------------------------------------- + +Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/datainterfaces/ecephys/basesortingextractorinterface.py... + +Function: BaseSortingExtractorInterface.get_metadata_schema +Docstring: +Compile metadata schema for the RecordingExtractor. + +Returns +------- +dict + The metadata schema dictionary containing definitions for Device, ElectrodeGroup, + Electrodes, and UnitProperties. +-------------------------------------------------------------------------------- + +Function: BaseSortingExtractorInterface.get_original_timestamps +Docstring: +No docstring +-------------------------------------------------------------------------------- + +Function: BaseSortingExtractorInterface.get_timestamps +Docstring: +Get the timestamps for the sorting data. + +Returns +------- +numpy.ndarray or list of numpy.ndarray + The timestamps for each spike in the sorting data. If there are multiple segments, + returns a list of timestamp arrays. + +Raises +------ +NotImplementedError + If no recording is attached to the sorting extractor. +-------------------------------------------------------------------------------- + +Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/datainterfaces/ecephys/baselfpextractorinterface.py... + +Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/datainterfaces/icephys/baseicephysinterface.py... + +Function: BaseIcephysInterface.get_source_schema +Docstring: +No docstring +-------------------------------------------------------------------------------- + +Function: BaseIcephysInterface.get_metadata_schema +Docstring: +No docstring +-------------------------------------------------------------------------------- + +Function: BaseIcephysInterface.get_metadata +Docstring: +No docstring +-------------------------------------------------------------------------------- + +Function: BaseIcephysInterface.get_original_timestamps +Docstring: +No docstring +-------------------------------------------------------------------------------- + +Function: BaseIcephysInterface.get_timestamps +Docstring: +No docstring +-------------------------------------------------------------------------------- + +Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/datainterfaces/text/timeintervalsinterface.py... + +Function: TimeIntervalsInterface.get_metadata +Docstring: +Get metadata for the time intervals. + +Returns +------- +dict + The metadata dictionary containing time intervals metadata. + Includes a TimeIntervals key with trials information. +-------------------------------------------------------------------------------- + +Function: TimeIntervalsInterface.get_metadata_schema +Docstring: +Get the metadata schema for the time intervals. + +Returns +------- +dict + The schema dictionary for time intervals metadata. +-------------------------------------------------------------------------------- + +Function: TimeIntervalsInterface.get_original_timestamps +Docstring: +Get the original timestamps for a given column. + +Parameters +---------- +column : str + The name of the column containing timestamps. + +Returns +------- +np.ndarray + The original timestamps from the specified column. + +Raises +------ +ValueError + If the column name does not end with '_time'. +-------------------------------------------------------------------------------- + +Function: TimeIntervalsInterface.get_timestamps +Docstring: +Get the current timestamps for a given column. + +Parameters +---------- +column : str + The name of the column containing timestamps. + +Returns +------- +np.ndarray + The current timestamps from the specified column. + +Raises +------ +ValueError + If the column name does not end with '_time'. +-------------------------------------------------------------------------------- + +Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/datainterfaces/behavior/video/videodatainterface.py... + +Function: VideoInterface.get_metadata_schema +Docstring: +No docstring +-------------------------------------------------------------------------------- + +Function: VideoInterface.get_metadata +Docstring: +No docstring +-------------------------------------------------------------------------------- + +Function: VideoInterface.get_original_timestamps +Docstring: +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 : numpy.ndarray + The timestamps for the data stream. +stub_test : bool, default: False + This method scans through each video; a process which can take some time to complete. + + To limit that scan to a small number of frames, set `stub_test=True`. +-------------------------------------------------------------------------------- + +Function: VideoInterface.get_timing_type +Docstring: +Determine the type of timing used by this interface. + +Returns +------- +Literal["starting_time and rate", "timestamps"] + The type of timing that has been set explicitly according to alignment. + + If only timestamps have been set, then only those will be used. + If only starting times have been set, then only those will be used. + + If timestamps were set, and then starting times were set, the timestamps will take precedence + as they will then be shifted by the corresponding starting times. + + If neither has been set, and there is only one video in the file_paths, + it is assumed the video is regularly sampled and pre-aligned with + a starting_time of 0.0 relative to the session start time. +-------------------------------------------------------------------------------- + +Function: VideoInterface.get_timestamps +Docstring: +Retrieve the timestamps for the data in this interface. + +Returns +------- +timestamps : numpy.ndarray + The timestamps for the data stream. +stub_test : bool, default: False + If timestamps have not been set to this interface, it will attempt to retrieve them + using the `.get_original_timestamps` method, which scans through each video; + a process which can take some time to complete. + + To limit that scan to a small number of frames, set `stub_test=True`. +-------------------------------------------------------------------------------- + +Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/datainterfaces/behavior/video/video_utils.py... + +Function: VideoCaptureContext.get_video_timestamps +Docstring: +Return numpy array of the timestamps(s) for a video file. +-------------------------------------------------------------------------------- + +Function: VideoCaptureContext.get_video_fps +Docstring: +Return the internal frames per second (fps) for a video file. + +Returns +------- +float + The frames per second of the video. +-------------------------------------------------------------------------------- + +Function: VideoCaptureContext.get_frame_shape +Docstring: +Return the shape of frames from a video file. + +Returns +------- +Tuple + The shape of the video frames (height, width, channels). +-------------------------------------------------------------------------------- + +Function: VideoCaptureContext.get_video_frame_count +Docstring: +Get the total number of frames in the video. + +Returns +------- +int + The total number of frames in the video. +-------------------------------------------------------------------------------- + +Function: VideoCaptureContext.get_cv_attribute +Docstring: +Get an OpenCV attribute by name. + +Parameters +---------- +attribute_name : str + The name of the OpenCV attribute to get. + +Returns +------- +Any + The OpenCV attribute value. +-------------------------------------------------------------------------------- + +Function: VideoCaptureContext.get_video_frame +Docstring: +Return the specific frame from a video as an RGB colorspace. + +Parameters +---------- +frame_number : int + The index of the frame to retrieve. + +Returns +------- +numpy.ndarray + The video frame in RGB colorspace with shape (height, width, 3). +-------------------------------------------------------------------------------- + +Function: VideoCaptureContext.get_video_frame_dtype +Docstring: +Return the dtype for frame in a video file. + +Returns +------- +numpy.dtype + The data type of the video frames. +-------------------------------------------------------------------------------- + +Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/datainterfaces/behavior/sleap/sleapdatainterface.py... + +Function: SLEAPInterface.get_source_schema +Docstring: +No docstring +-------------------------------------------------------------------------------- + +Function: SLEAPInterface.get_original_timestamps +Docstring: +No docstring +-------------------------------------------------------------------------------- + +Function: SLEAPInterface.get_timestamps +Docstring: +No docstring +-------------------------------------------------------------------------------- + +Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/datainterfaces/behavior/sleap/sleap_utils.py... + +Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/datainterfaces/behavior/fictrac/fictracdatainterface.py... + +Function: FicTracDataInterface.get_source_schema +Docstring: +No docstring +-------------------------------------------------------------------------------- + +Function: FicTracDataInterface.get_metadata +Docstring: +No docstring +-------------------------------------------------------------------------------- + +Function: FicTracDataInterface.get_original_timestamps +Docstring: +Retrieve and correct timestamps from a FicTrac data file. + +This function addresses two specific issues with timestamps in FicTrac data: + +1. Resetting Initial Timestamp + In some instances, FicTrac replaces the initial timestamp (0) with the system time. This commonly occurs + when the data source is a video file, and OpenCV reports the first timestamp as 0. Since OpenCV also + uses 0 as a marker for invalid values, FicTrac defaults to system time in that case. This leads to + inconsistent timestamps like [system_time, t1, t2, t3, ...]. The function corrects this by resetting the + first timestamp back to 0 when a negative difference is detected between the first two timestamps. +2. Re-centering Unix Epoch Time + If timestamps are in Unix epoch time format (time since 1970-01-01 00:00:00 UTC), this function re-centers + the time series by subtracting the first timestamp. This adjustment ensures that timestamps represent the + elapsed time since the start of the experiment rather than the Unix epoch. This case appears when one of the + sources of data in FicTrac (such as PGR or Basler) lacks a timestamp extraction method. FicTrac + then falls back to using the system time, which is in Unix epoch format. + +Returns +------- +np.ndarray + An array of corrected timestamps, in seconds. + +Notes +----- +- The issue of the initial timestamp replacement appears in FicTrac 2.1.1 and earlier versions. +- Re-centering is essential for timestamps in Unix epoch format as timestamps in an NWB file must be relative +to the start of the session. The heuristic here is to check if the first timestamp is larger than the length +of a 10-year experiment in seconds. If so, it's assumed that the timestamps are in Unix epoch format. + +References +---------- +Issue discussion on FicTrac's timestamp inconsistencies: +https://github.com/rjdmoore/fictrac/issues/29 +-------------------------------------------------------------------------------- + +Function: FicTracDataInterface.get_timestamps +Docstring: +No docstring +-------------------------------------------------------------------------------- + +Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/datainterfaces/behavior/deeplabcut/deeplabcutdatainterface.py... + +Function: DeepLabCutInterface.get_source_schema +Docstring: +No docstring +-------------------------------------------------------------------------------- + +Function: DeepLabCutInterface.get_metadata +Docstring: +No docstring +-------------------------------------------------------------------------------- + +Function: DeepLabCutInterface.get_original_timestamps +Docstring: +No docstring +-------------------------------------------------------------------------------- + +Function: DeepLabCutInterface.get_timestamps +Docstring: +No docstring +-------------------------------------------------------------------------------- + +Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/datainterfaces/behavior/lightningpose/lightningposeconverter.py... + +Function: LightningPoseConverter.get_source_schema +Docstring: +No docstring +-------------------------------------------------------------------------------- + +Function: LightningPoseConverter.get_conversion_options_schema +Docstring: +No docstring +-------------------------------------------------------------------------------- + +Function: LightningPoseConverter.get_metadata +Docstring: +No docstring +-------------------------------------------------------------------------------- + +Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/datainterfaces/behavior/lightningpose/lightningposedatainterface.py... + +Function: LightningPoseDataInterface.get_metadata_schema +Docstring: +No docstring +-------------------------------------------------------------------------------- + +Function: LightningPoseDataInterface.get_original_timestamps +Docstring: +No docstring +-------------------------------------------------------------------------------- + +Function: LightningPoseDataInterface.get_timestamps +Docstring: +No docstring +-------------------------------------------------------------------------------- + +Function: LightningPoseDataInterface.get_metadata +Docstring: +No docstring +-------------------------------------------------------------------------------- + +Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/datainterfaces/behavior/audio/audiointerface.py... + +Function: AudioInterface.get_metadata_schema +Docstring: +No docstring +-------------------------------------------------------------------------------- + +Function: AudioInterface.get_metadata +Docstring: +No docstring +-------------------------------------------------------------------------------- + +Function: AudioInterface.get_original_timestamps +Docstring: +No docstring +-------------------------------------------------------------------------------- + +Function: AudioInterface.get_timestamps +Docstring: +No docstring +-------------------------------------------------------------------------------- + +Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/datainterfaces/behavior/miniscope/miniscopedatainterface.py... + +Function: MiniscopeBehaviorInterface.get_source_schema +Docstring: +No docstring +-------------------------------------------------------------------------------- + +Function: MiniscopeBehaviorInterface.get_metadata +Docstring: +No docstring +-------------------------------------------------------------------------------- + +Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/datainterfaces/behavior/medpc/medpc_helpers.py... + +Function: get_medpc_variables +Docstring: +Get the values of the given single-line variables from a MedPC file for all sessions in that file. + +Parameters +---------- +file_path : FilePathType + The path to the MedPC file. +variable_names : list + The names of the variables to get the values of. + +Returns +------- +dict + A dictionary with the variable names as keys and a list of variable values as values. +-------------------------------------------------------------------------------- + +Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/datainterfaces/behavior/medpc/medpcdatainterface.py... + +Function: MedPCInterface.get_metadata +Docstring: +No docstring +-------------------------------------------------------------------------------- + +Function: MedPCInterface.get_metadata_schema +Docstring: +No docstring +-------------------------------------------------------------------------------- + +Function: MedPCInterface.get_original_timestamps +Docstring: +Retrieve the original unaltered timestamps dictionary for the data in this interface. + +This function retrieves the data on-demand by re-reading the medpc file. + +Parameters +---------- +medpc_name_to_info_dict : dict + A dictionary mapping the names of the desired variables in the MedPC file + to an info dictionary with the names of the variables in the metadata and whether or not they are arrays. + ex. {"A": {"name": "left_nose_poke_times", "is_array": True}} + +Returns +------- +timestamps_dict: dict + A dictionary mapping the names of the variables to the original medpc timestamps. +-------------------------------------------------------------------------------- + +Function: MedPCInterface.get_timestamps +Docstring: +Retrieve the timestamps dictionary for the data in this interface. + +Returns +------- +timestamps_dict: dict + A dictionary mapping the names of the variables to the timestamps. +-------------------------------------------------------------------------------- + +Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/datainterfaces/behavior/neuralynx/nvt_utils.py... + +Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/datainterfaces/behavior/neuralynx/neuralynx_nvt_interface.py... + +Function: NeuralynxNvtInterface.get_original_timestamps +Docstring: +No docstring +-------------------------------------------------------------------------------- + +Function: NeuralynxNvtInterface.get_timestamps +Docstring: +No docstring +-------------------------------------------------------------------------------- + +Function: NeuralynxNvtInterface.get_metadata +Docstring: +No docstring +-------------------------------------------------------------------------------- + +Function: NeuralynxNvtInterface.get_metadata_schema +Docstring: +No docstring +-------------------------------------------------------------------------------- + +Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/datainterfaces/ophys/caiman/caimandatainterface.py... + +Function: CaimanSegmentationInterface.get_source_schema +Docstring: +Get the source schema for the Caiman segmentation interface. + +Returns +------- +dict + The schema dictionary containing input parameters and descriptions + for initializing the CaImAn segmentation interface. +-------------------------------------------------------------------------------- + +Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/datainterfaces/ophys/micromanagertiff/micromanagertiffdatainterface.py... + +Function: MicroManagerTiffImagingInterface.get_source_schema +Docstring: +Get the source schema for the Micro-Manager TIFF imaging interface. + +Returns +------- +dict + The schema dictionary containing input parameters and descriptions + for initializing the Micro-Manager TIFF interface. +-------------------------------------------------------------------------------- + +Function: MicroManagerTiffImagingInterface.get_metadata +Docstring: +Get metadata for the Micro-Manager TIFF imaging data. + +Returns +------- +dict + Dictionary containing metadata including session start time, imaging plane details, + and two-photon series configuration. +-------------------------------------------------------------------------------- + +Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/datainterfaces/ophys/cnmfe/cnmfedatainterface.py... + +Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/datainterfaces/ophys/sbx/sbxdatainterface.py... + +Function: SbxImagingInterface.get_metadata +Docstring: +Get metadata for the Scanbox imaging data. + +Returns +------- +dict + Dictionary containing metadata including device information and imaging details + specific to the Scanbox system. +-------------------------------------------------------------------------------- + +Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/datainterfaces/ophys/hdf5/hdf5datainterface.py... + +Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/datainterfaces/ophys/tdt_fp/tdtfiberphotometrydatainterface.py... + +Function: TDTFiberPhotometryInterface.get_metadata +Docstring: +Get metadata for the TDTFiberPhotometryInterface. +-------------------------------------------------------------------------------- + +Function: TDTFiberPhotometryInterface.get_metadata_schema +Docstring: +Get the metadata schema for the TDTFiberPhotometryInterface. +-------------------------------------------------------------------------------- + +Function: TDTFiberPhotometryInterface.get_original_timestamps +Docstring: +Get the original timestamps for the data. + +Parameters +---------- +t1 : float, optional + Retrieve data starting at t1 (in seconds), default = 0 for start of recording. +t2 : float, optional + Retrieve data ending at t2 (in seconds), default = 0 for end of recording. + +Returns +------- +dict[str, np.ndarray] + Dictionary of stream names to timestamps. +-------------------------------------------------------------------------------- + +Function: TDTFiberPhotometryInterface.get_timestamps +Docstring: +Get the timestamps for the data. + +Parameters +---------- +t1 : float, optional + Retrieve data starting at t1 (in seconds), default = 0 for start of recording. +t2 : float, optional + Retrieve data ending at t2 (in seconds), default = 0 for end of recording. + +Returns +------- +dict[str, np.ndarray] + Dictionary of stream names to timestamps. +-------------------------------------------------------------------------------- + +Function: TDTFiberPhotometryInterface.get_original_starting_time_and_rate +Docstring: +Get the original starting time and rate for the data. + +Parameters +---------- +t1 : float, optional + Retrieve data starting at t1 (in seconds), default = 0 for start of recording. +t2 : float, optional + Retrieve data ending at t2 (in seconds), default = 0 for end of recording. + +Returns +------- +dict[str, tuple[float, float]] + Dictionary of stream names to starting time and rate. +-------------------------------------------------------------------------------- + +Function: TDTFiberPhotometryInterface.get_starting_time_and_rate +Docstring: +Get the starting time and rate for the data. + +Parameters +---------- +t1 : float, optional + Retrieve data starting at t1 (in seconds), default = 0 for start of recording. +t2 : float, optional + Retrieve data ending at t2 (in seconds), default = 0 for end of recording. + +Returns +------- +dict[str, tuple[float, float]] + Dictionary of stream names to starting time and rate. +-------------------------------------------------------------------------------- + +Function: TDTFiberPhotometryInterface.get_events +Docstring: +Get a dictionary of events from the TDT files (e.g. camera TTL pulses). + +The events dictionary maps from the names of each epoc in the TDT data to an event dictionary. +Each event dictionary maps from "onset", "offset", and "data" to the corresponding arrays. + +Returns +------- +dict[str, dict[str, np.ndarray]] + Dictionary of events. +-------------------------------------------------------------------------------- + +Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/datainterfaces/ophys/scanimage/scanimageimaginginterfaces.py... + +Function: get_scanimage_major_version +Docstring: +Determine the version of ScanImage that produced the TIFF file. + +Parameters +---------- +scanimage_metadata : dict + Dictionary of metadata extracted from a TIFF file produced via ScanImage. + +Returns +------- +str + The version of ScanImage that produced the TIFF file. + +Raises +------ +ValueError + If the ScanImage version could not be determined from metadata. +-------------------------------------------------------------------------------- + +Function: ScanImageImagingInterface.get_source_schema +Docstring: +Get the source schema for the ScanImage imaging interface. + +Returns +------- +dict + The schema dictionary containing input parameters and descriptions + for initializing the ScanImage interface. +-------------------------------------------------------------------------------- + +Function: ScanImageLegacyImagingInterface.get_source_schema +Docstring: +No docstring +-------------------------------------------------------------------------------- + +Function: ScanImageLegacyImagingInterface.get_metadata +Docstring: +Get metadata for the ScanImage imaging data. + +Returns +------- +dict + Dictionary containing metadata including session start time and device information + specific to the ScanImage system. +-------------------------------------------------------------------------------- + +Function: ScanImageMultiFileImagingInterface.get_source_schema +Docstring: +Get the source schema for the ScanImage multi-file imaging interface. + +Returns +------- +dict + The schema dictionary containing input parameters and descriptions + for initializing the ScanImage multi-file interface. +-------------------------------------------------------------------------------- + +Function: ScanImageMultiPlaneImagingInterface.get_metadata +Docstring: +Get metadata for the ScanImage imaging data. + +Returns +------- +dict + Dictionary containing metadata including session start time and device information + specific to the ScanImage system. +-------------------------------------------------------------------------------- + +Function: ScanImageMultiPlaneMultiFileImagingInterface.get_metadata +Docstring: +get metadata for the ScanImage imaging data +-------------------------------------------------------------------------------- + +Function: ScanImageSinglePlaneImagingInterface.get_metadata +Docstring: +get metadata for the ScanImage imaging data +-------------------------------------------------------------------------------- + +Function: ScanImageSinglePlaneMultiFileImagingInterface.get_metadata +Docstring: +get metadata for the ScanImage imaging data +-------------------------------------------------------------------------------- + +Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/datainterfaces/ophys/miniscope/miniscopeconverter.py... + +Function: MiniscopeConverter.get_source_schema +Docstring: +No docstring +-------------------------------------------------------------------------------- + +Function: MiniscopeConverter.get_conversion_options_schema +Docstring: +Get the schema for the conversion options. + +Returns +------- +dict + The schema dictionary containing conversion options for the Miniscope interface. +-------------------------------------------------------------------------------- + +Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/datainterfaces/ophys/miniscope/miniscopeimagingdatainterface.py... + +Function: MiniscopeImagingInterface.get_source_schema +Docstring: +Get the source schema for the Miniscope imaging interface. + +Returns +------- +dict + The schema dictionary containing input parameters and descriptions + for initializing the Miniscope imaging interface. +-------------------------------------------------------------------------------- + +Function: MiniscopeImagingInterface.get_metadata +Docstring: +Get metadata for the Miniscope imaging data. + +Returns +------- +DeepDict + Dictionary containing metadata including device information, imaging plane details, + and one-photon series configuration. +-------------------------------------------------------------------------------- + +Function: MiniscopeImagingInterface.get_metadata_schema +Docstring: +Get the metadata schema for the Miniscope imaging data. + +Returns +------- +dict + The schema dictionary containing metadata definitions and requirements + for the Miniscope imaging interface. +-------------------------------------------------------------------------------- + +Function: MiniscopeImagingInterface.get_original_timestamps +Docstring: +No docstring +-------------------------------------------------------------------------------- + +Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/datainterfaces/ophys/extract/extractdatainterface.py... + +Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/datainterfaces/ophys/suite2p/suite2pdatainterface.py... + +Function: Suite2pSegmentationInterface.get_source_schema +Docstring: +Get the source schema for the Suite2p segmentation interface. + +Returns +------- +dict + The schema dictionary containing input parameters and descriptions + for initializing the Suite2p segmentation interface. +-------------------------------------------------------------------------------- + +Function: Suite2pSegmentationInterface.get_available_planes +Docstring: +Get the available planes in the Suite2p segmentation folder. + +Parameters +---------- +folder_path : DirectoryPath + Path to the folder containing Suite2p segmentation data. + +Returns +------- +dict + Dictionary containing information about available planes in the dataset. +-------------------------------------------------------------------------------- + +Function: Suite2pSegmentationInterface.get_available_channels +Docstring: +Get the available channels in the Suite2p segmentation folder. + +Parameters +---------- +folder_path : DirectoryPath + Path to the folder containing Suite2p segmentation data. + +Returns +------- +dict + Dictionary containing information about available channels in the dataset. +-------------------------------------------------------------------------------- + +Function: Suite2pSegmentationInterface.get_metadata +Docstring: +Get metadata for the Suite2p segmentation data. + +Returns +------- +DeepDict + Dictionary containing metadata including plane segmentation details, + fluorescence data, and segmentation images. +-------------------------------------------------------------------------------- + +Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/datainterfaces/ophys/tiff/tiffdatainterface.py... + +Function: TiffImagingInterface.get_source_schema +Docstring: +"Get the source schema for the TIFF imaging interface. +-------------------------------------------------------------------------------- + +Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/datainterfaces/ophys/brukertiff/brukertiffconverter.py... + +Function: BrukerTiffMultiPlaneConverter.get_source_schema +Docstring: +No docstring +-------------------------------------------------------------------------------- + +Function: BrukerTiffMultiPlaneConverter.get_conversion_options_schema +Docstring: +Get the schema for the conversion options. + +Returns +------- +dict + The schema dictionary containing conversion options for the Bruker TIFF interface. +-------------------------------------------------------------------------------- + +Function: BrukerTiffSinglePlaneConverter.get_source_schema +Docstring: +No docstring +-------------------------------------------------------------------------------- + +Function: BrukerTiffSinglePlaneConverter.get_conversion_options_schema +Docstring: +Get the schema for the conversion options. + +Returns +------- +dict + The schema dictionary containing conversion options for the Bruker TIFF interface. +-------------------------------------------------------------------------------- + +Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/datainterfaces/ophys/brukertiff/brukertiffdatainterface.py... + +Function: BrukerTiffMultiPlaneImagingInterface.get_source_schema +Docstring: +Get the source schema for the Bruker TIFF imaging data. + +Returns +------- +dict + The JSON schema for the Bruker TIFF imaging data source. +-------------------------------------------------------------------------------- + +Function: BrukerTiffMultiPlaneImagingInterface.get_streams +Docstring: +Get streams for the Bruker TIFF imaging data. + +Parameters +---------- +folder_path : DirectoryPath + Path to the folder containing the Bruker TIFF files. +plane_separation_type : Literal["contiguous", "disjoint"], optional + Type of plane separation to apply. If "contiguous", only the first plane stream for each channel is retained. + +Returns +------- +dict + A dictionary containing the streams for the Bruker TIFF imaging data. The dictionary has the following keys: + - "channel_streams": List of channel stream names. + - "plane_streams": Dictionary where keys are channel stream names and values are lists of plane streams. +-------------------------------------------------------------------------------- + +Function: BrukerTiffMultiPlaneImagingInterface.get_metadata +Docstring: +Get metadata for the Bruker TIFF imaging data. + +Returns +------- +DeepDict + The metadata dictionary containing imaging metadata from the Bruker TIFF files. +-------------------------------------------------------------------------------- + +Function: BrukerTiffSinglePlaneImagingInterface.get_source_schema +Docstring: +Get the source schema for the Bruker TIFF imaging data. + +Returns +------- +dict + The JSON schema for the Bruker TIFF imaging data source. +-------------------------------------------------------------------------------- + +Function: BrukerTiffSinglePlaneImagingInterface.get_streams +Docstring: +Get streams for the Bruker TIFF imaging data. + +Parameters +---------- +folder_path : DirectoryPath + Path to the folder containing the Bruker TIFF files. + +Returns +------- +dict + A dictionary containing the streams extracted from the Bruker TIFF files. +-------------------------------------------------------------------------------- + +Function: BrukerTiffSinglePlaneImagingInterface.get_metadata +Docstring: +Get metadata for the Bruker TIFF imaging data. + +Returns +------- +DeepDict + The metadata dictionary containing imaging metadata from the Bruker TIFF files. +-------------------------------------------------------------------------------- + +Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/datainterfaces/ophys/sima/simadatainterface.py... + +Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/datainterfaces/ecephys/spikeglx/spikeglx_utils.py... + +Function: get_session_start_time +Docstring: +Fetches the session start time from the recording_metadata dictionary. + +Parameters +---------- +recording_metadata : dict + The metadata dictionary as obtained from the Spikelgx recording. + +Returns +------- +datetime or None + the session start time in datetime format. +-------------------------------------------------------------------------------- + +Function: get_device_metadata +Docstring: +Returns a device with description including the metadata as described here +# https://billkarsh.github.io/SpikeGLX/Sgl_help/Metadata_30.html + +Returns +------- +dict + a dict containing the metadata necessary for creating the device +-------------------------------------------------------------------------------- + +Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/datainterfaces/ecephys/spikeglx/spikeglxconverter.py... + +Function: SpikeGLXConverterPipe.get_source_schema +Docstring: +Get the schema for the source arguments. + +Returns +------- +dict + The schema dictionary containing input parameters and descriptions + for initializing the SpikeGLX converter. +-------------------------------------------------------------------------------- + +Function: SpikeGLXConverterPipe.get_streams +Docstring: +Get the stream IDs available in the folder. + +Parameters +---------- +folder_path : DirectoryPath + Path to the folder containing SpikeGLX streams. + +Returns +------- +list of str + The IDs of all available streams in the folder. +-------------------------------------------------------------------------------- + +Function: SpikeGLXConverterPipe.get_conversion_options_schema +Docstring: +Get the schema for the conversion options. + +Returns +------- +dict + The schema dictionary containing conversion options for each data interface + in this converter. +-------------------------------------------------------------------------------- + +Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/datainterfaces/ecephys/spikeglx/spikeglxdatainterface.py... + +Function: SpikeGLXRecordingInterface.get_source_schema +Docstring: +Get the source schema for the SpikeGLX recording interface. + +Returns +------- +dict + The JSON schema for the SpikeGLX recording data source. +-------------------------------------------------------------------------------- + +Function: SpikeGLXRecordingInterface.get_metadata +Docstring: +Get metadata for the SpikeGLX recording. + +Returns +------- +dict + The metadata dictionary containing recording metadata from the SpikeGLX files. +-------------------------------------------------------------------------------- + +Function: SpikeGLXRecordingInterface.get_original_timestamps +Docstring: +Get the original timestamps for the SpikeGLX recording. + +Returns +------- +numpy.ndarray or list of numpy.ndarray + The timestamps for each sample in the recording. If there are multiple segments, + returns a list of timestamps arrays, one for each segment. +-------------------------------------------------------------------------------- + +Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/datainterfaces/ecephys/spikeglx/spikeglxnidqinterface.py... + +Function: SpikeGLXNIDQInterface.get_source_schema +Docstring: +No docstring +-------------------------------------------------------------------------------- + +Function: SpikeGLXNIDQInterface.get_metadata +Docstring: +No docstring +-------------------------------------------------------------------------------- + +Function: SpikeGLXNIDQInterface.get_channel_names +Docstring: +Get a list of channel names from the recording extractor. + +Returns +------- +list of str + The names of all channels in the NIDQ recording. +-------------------------------------------------------------------------------- + +Function: SpikeGLXNIDQInterface.get_event_times_from_ttl +Docstring: +Return the start of event times from the rising part of TTL pulses on one of the NIDQ channels. + +Parameters +---------- +channel_name : str + Name of the channel in the .nidq.bin file. + +Returns +------- +rising_times : numpy.ndarray + The times of the rising TTL pulses. +-------------------------------------------------------------------------------- + +Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/datainterfaces/ecephys/openephys/openephysdatainterface.py... + +Function: OpenEphysRecordingInterface.get_source_schema +Docstring: +No docstring +-------------------------------------------------------------------------------- + +Function: OpenEphysRecordingInterface.get_stream_names +Docstring: +Get the names of available recording streams in the OpenEphys folder. + +Parameters +---------- +folder_path : DirectoryPath + Path to OpenEphys directory (.continuous or .dat files). + +Returns +------- +list of str + The names of the available recording streams. + +Raises +------ +AssertionError + If the data is neither in 'legacy' (.continuous) nor 'binary' (.dat) format. +-------------------------------------------------------------------------------- + +Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/datainterfaces/ecephys/openephys/openephyssortingdatainterface.py... + +Function: OpenEphysSortingInterface.get_source_schema +Docstring: +Compile input schema for the SortingExtractor. + +Returns +------- +dict + The schema dictionary containing input parameters and descriptions + for initializing the SortingExtractor. +-------------------------------------------------------------------------------- + +Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/datainterfaces/ecephys/openephys/openephysbinarydatainterface.py... + +Function: OpenEphysBinaryRecordingInterface.get_stream_names +Docstring: +Get the names of available recording streams in the OpenEphys binary folder. + +Parameters +---------- +folder_path : DirectoryPath + Path to directory containing OpenEphys binary files. + +Returns +------- +list of str + The names of the available recording streams. +-------------------------------------------------------------------------------- + +Function: OpenEphysBinaryRecordingInterface.get_source_schema +Docstring: +Compile input schema for the RecordingExtractor. +-------------------------------------------------------------------------------- + +Function: OpenEphysBinaryRecordingInterface.get_metadata +Docstring: +No docstring +-------------------------------------------------------------------------------- + +Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/datainterfaces/ecephys/openephys/openephyslegacydatainterface.py... + +Function: OpenEphysLegacyRecordingInterface.get_stream_names +Docstring: +Get the names of available recording streams in the OpenEphys legacy folder. + +Parameters +---------- +folder_path : DirectoryPath + Path to directory containing OpenEphys legacy files. + +Returns +------- +list of str + The names of the available recording streams. +-------------------------------------------------------------------------------- + +Function: OpenEphysLegacyRecordingInterface.get_source_schema +Docstring: +Compile input schema for the RecordingExtractor. +-------------------------------------------------------------------------------- + +Function: OpenEphysLegacyRecordingInterface.get_metadata +Docstring: +No docstring +-------------------------------------------------------------------------------- + +Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/datainterfaces/ecephys/edf/edfdatainterface.py... + +Function: EDFRecordingInterface.get_source_schema +Docstring: +No docstring +-------------------------------------------------------------------------------- + +Function: EDFRecordingInterface.get_metadata +Docstring: +No docstring +-------------------------------------------------------------------------------- + +Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/datainterfaces/ecephys/plexon/plexondatainterface.py... + +Function: PlexonRecordingInterface.get_source_schema +Docstring: +No docstring +-------------------------------------------------------------------------------- + +Function: PlexonRecordingInterface.get_metadata +Docstring: +No docstring +-------------------------------------------------------------------------------- + +Function: Plexon2RecordingInterface.get_source_schema +Docstring: +No docstring +-------------------------------------------------------------------------------- + +Function: Plexon2RecordingInterface.get_metadata +Docstring: +No docstring +-------------------------------------------------------------------------------- + +Function: PlexonSortingInterface.get_source_schema +Docstring: +No docstring +-------------------------------------------------------------------------------- + +Function: PlexonSortingInterface.get_metadata +Docstring: +No docstring +-------------------------------------------------------------------------------- + +Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/datainterfaces/ecephys/spikegadgets/spikegadgetsdatainterface.py... + +Function: SpikeGadgetsRecordingInterface.get_source_schema +Docstring: +No docstring +-------------------------------------------------------------------------------- + +Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/datainterfaces/ecephys/kilosort/kilosortdatainterface.py... + +Function: KiloSortSortingInterface.get_source_schema +Docstring: +No docstring +-------------------------------------------------------------------------------- + +Function: KiloSortSortingInterface.get_metadata +Docstring: +No docstring +-------------------------------------------------------------------------------- + +Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/datainterfaces/ecephys/tdt/tdtdatainterface.py... + +Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/datainterfaces/ecephys/phy/phydatainterface.py... + +Function: PhySortingInterface.get_source_schema +Docstring: +No docstring +-------------------------------------------------------------------------------- + +Function: PhySortingInterface.get_metadata +Docstring: +No docstring +-------------------------------------------------------------------------------- + +Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/datainterfaces/ecephys/axona/axona_utils.py... + +Function: get_eeg_sampling_frequency +Docstring: +Read sampling frequency from .eegX or .egfX file header. + +Parameters +---------- +file_path : Path or str + Full file_path of Axona `.eegX` or `.egfX` file. + +Returns +------- +float + Sampling frequency +-------------------------------------------------------------------------------- + +Function: get_all_file_paths +Docstring: +Read LFP file_paths of `.eeg` or `.egf` files in file_path's directory. +E.g. if file_path='/my/directory/my_file.eeg', all .eeg channels will be +appended to the output. + +Parameters +---------- +file_path : FilePathType + Full file_path of either .egg or .egf file + +Returns +------- +path_list : list + List of file_paths +-------------------------------------------------------------------------------- + +Function: get_header_bstring +Docstring: +Scan file for the occurrence of 'data_start' and return the header +as byte string + +Parameters +---------- +file (str or path) : file to be loaded + +Returns +------- +str + header byte content +-------------------------------------------------------------------------------- + +Function: get_position_object +Docstring: +Read position data from .bin or .pos file and convert to +pynwb.behavior.SpatialSeries objects. If possible it should always +be preferred to read position data from the `.bin` file to ensure +samples are locked to ecephys time courses. + +Parameters: +---------- +file_path (Path or Str): + Full file_path of Axona file with any extension. + +Returns: +------- +position: pynwb.behavior.Position +-------------------------------------------------------------------------------- + +Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/datainterfaces/ecephys/axona/axonadatainterface.py... + +Function: AxonaRecordingInterface.get_source_schema +Docstring: +No docstring +-------------------------------------------------------------------------------- + +Function: AxonaRecordingInterface.get_metadata +Docstring: +No docstring +-------------------------------------------------------------------------------- + +Function: AxonaUnitRecordingInterface.get_source_schema +Docstring: +No docstring +-------------------------------------------------------------------------------- + +Function: AxonaLFPDataInterface.get_source_schema +Docstring: +No docstring +-------------------------------------------------------------------------------- + +Function: AxonaPositionDataInterface.get_source_schema +Docstring: +No docstring +-------------------------------------------------------------------------------- + +Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/datainterfaces/ecephys/neuroscope/neuroscopedatainterface.py... + +Function: NeuroScopeRecordingInterface.get_source_schema +Docstring: +No docstring +-------------------------------------------------------------------------------- + +Function: NeuroScopeRecordingInterface.get_ecephys_metadata +Docstring: +Auto-populates ecephys metadata from the xml_file_path. + +Parameters +---------- +xml_file_path : str + Path to the XML file containing device and electrode configuration. + +Returns +------- +dict + Dictionary containing metadata for ElectrodeGroup and Electrodes. + Includes group names, descriptions, and electrode properties. +-------------------------------------------------------------------------------- + +Function: NeuroScopeRecordingInterface.get_metadata +Docstring: +Get metadata for the NeuroScope recording. + +Returns +------- +dict + Dictionary containing metadata including Ecephys information and session start time. +-------------------------------------------------------------------------------- + +Function: NeuroScopeRecordingInterface.get_original_timestamps +Docstring: +Get the original timestamps for the recording. + +Returns +------- +numpy.ndarray or list of numpy.ndarray + The timestamps for each sample in the recording. If there are multiple segments, + returns a list of timestamp arrays, one for each segment. +-------------------------------------------------------------------------------- + +Function: NeuroScopeLFPInterface.get_source_schema +Docstring: +No docstring +-------------------------------------------------------------------------------- + +Function: NeuroScopeLFPInterface.get_metadata +Docstring: +No docstring +-------------------------------------------------------------------------------- + +Function: NeuroScopeSortingInterface.get_source_schema +Docstring: +No docstring +-------------------------------------------------------------------------------- + +Function: NeuroScopeSortingInterface.get_metadata +Docstring: +No docstring +-------------------------------------------------------------------------------- + +Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/datainterfaces/ecephys/neuroscope/neuroscope_utils.py... + +Function: get_xml_file_path +Docstring: +Infer the xml_file_path from the data_file_path (.dat or .eeg). + +Assumes the two are in the same folder and follow the session_id naming convention. + +Parameters +---------- +data_file_path : str + Path to the data file (.dat or .eeg) + +Returns +------- +str + The path to the corresponding XML file. +-------------------------------------------------------------------------------- + +Function: get_xml +Docstring: +Auxiliary function for retrieving root of xml. + +Parameters +---------- +xml_file_path : str + Path to the XML file. + +Returns +------- +lxml.etree._Element + The root element of the XML tree. +-------------------------------------------------------------------------------- + +Function: get_neural_channels +Docstring: +Extracts the channels corresponding to neural data from an XML file. + +Parameters +---------- +xml_file_path : str + Path to the XML file containing the necessary data. + +Returns +------- +list + List reflecting the group structure of the channels. + +Notes +----- +This function attempts to extract the channels that correspond to neural data, +specifically those that come from the probe. It uses the `spikeDetection` structure +in the XML file to identify the channels involved in spike detection. Channels that are +not involved in spike detection, such as auxiliary channels from the intan system, are excluded. + +The function returns a list representing the group structure of the channels. + +Example: +[[1, 2, 3], [4, 5, 6], [7, 8, 9] + +Where [1, 2, 3] are the channels in the first group, [4, 5, 6] are the channels in the second group, etc. + +Warning: +This function assumes that all the channels that correspond to neural data are involved in spike detection. +More concretely, it assumes that the channels appear on the `spikeDetection` field of the XML file. +If this is not the case, the function will return an incorrect list of neural channels. +Please report this as an issue if this is the case. +-------------------------------------------------------------------------------- + +Function: get_channel_groups +Docstring: +Auxiliary function for retrieving a list of groups, each containing a list of channels. + +These are all the channels that are connected to the probe. + +Parameters +---------- +xml_file_path : str + Path to the XML file. + +Returns +------- +list + List of lists, where each inner list contains the channel numbers for that group. + For example: [[1, 2, 3], [4, 5, 6]] represents two groups with three channels each. +-------------------------------------------------------------------------------- + +Function: get_session_start_time +Docstring: +Auxiliary function for retrieving the session start time from the xml file. + +Parameters +---------- +xml_file_path : str + Path to the XML file. + +Returns +------- +datetime + The session start time as a datetime object. Returns None if no date is found. +-------------------------------------------------------------------------------- + +Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/datainterfaces/ecephys/alphaomega/alphaomegadatainterface.py... + +Function: AlphaOmegaRecordingInterface.get_source_schema +Docstring: +No docstring +-------------------------------------------------------------------------------- + +Function: AlphaOmegaRecordingInterface.get_metadata +Docstring: +No docstring +-------------------------------------------------------------------------------- + +Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/datainterfaces/ecephys/blackrock/header_tools.py... + +Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/datainterfaces/ecephys/blackrock/blackrockdatainterface.py... + +Function: BlackrockRecordingInterface.get_source_schema +Docstring: +No docstring +-------------------------------------------------------------------------------- + +Function: BlackrockRecordingInterface.get_metadata +Docstring: +No docstring +-------------------------------------------------------------------------------- + +Function: BlackrockSortingInterface.get_source_schema +Docstring: +No docstring +-------------------------------------------------------------------------------- + +Function: BlackrockSortingInterface.get_metadata +Docstring: +No docstring +-------------------------------------------------------------------------------- + +Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/datainterfaces/ecephys/biocam/biocamdatainterface.py... + +Function: BiocamRecordingInterface.get_source_schema +Docstring: +No docstring +-------------------------------------------------------------------------------- + +Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/datainterfaces/ecephys/cellexplorer/cellexplorerdatainterface.py... + +Function: CellExplorerRecordingInterface.get_source_schema +Docstring: +No docstring +-------------------------------------------------------------------------------- + +Function: CellExplorerRecordingInterface.get_original_timestamps +Docstring: +No docstring +-------------------------------------------------------------------------------- + +Function: CellExplorerSortingInterface.get_metadata +Docstring: +No docstring +-------------------------------------------------------------------------------- + +Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/datainterfaces/ecephys/maxwell/maxonedatainterface.py... + +Function: MaxOneRecordingInterface.get_metadata +Docstring: +No docstring +-------------------------------------------------------------------------------- + +Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/datainterfaces/ecephys/intan/intandatainterface.py... + +Function: IntanRecordingInterface.get_source_schema +Docstring: +No docstring +-------------------------------------------------------------------------------- + +Function: IntanRecordingInterface.get_metadata_schema +Docstring: +No docstring +-------------------------------------------------------------------------------- + +Function: IntanRecordingInterface.get_metadata +Docstring: +No docstring +-------------------------------------------------------------------------------- + +Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/datainterfaces/ecephys/spike2/spike2datainterface.py... + +Function: Spike2RecordingInterface.get_source_schema +Docstring: +Get the schema for the source arguments. + +Returns +------- +dict + The schema dictionary containing input parameters and descriptions + for initializing the Spike2 recording interface. +-------------------------------------------------------------------------------- + +Function: Spike2RecordingInterface.get_all_channels_info +Docstring: +Retrieve and inspect necessary channel information prior to initialization. + +Parameters +---------- +file_path : FilePath + Path to .smr or .smrx file. + +Returns +------- +dict + Dictionary containing information about all channels in the Spike2 file. +-------------------------------------------------------------------------------- + +Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/datainterfaces/ecephys/neuralynx/neuralynxdatainterface.py... + +Function: NeuralynxRecordingInterface.get_stream_names +Docstring: +No docstring +-------------------------------------------------------------------------------- + +Function: NeuralynxRecordingInterface.get_source_schema +Docstring: +No docstring +-------------------------------------------------------------------------------- + +Function: NeuralynxRecordingInterface.get_metadata +Docstring: +No docstring +-------------------------------------------------------------------------------- + +Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/datainterfaces/ecephys/mcsraw/mcsrawdatainterface.py... + +Function: MCSRawRecordingInterface.get_source_schema +Docstring: +No docstring +-------------------------------------------------------------------------------- + +Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/datainterfaces/ecephys/mearec/mearecdatainterface.py... + +Function: MEArecRecordingInterface.get_source_schema +Docstring: +No docstring +-------------------------------------------------------------------------------- + +Function: MEArecRecordingInterface.get_metadata +Docstring: +No docstring +-------------------------------------------------------------------------------- + +Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/datainterfaces/icephys/abf/abfdatainterface.py... + +Function: get_start_datetime +Docstring: +Get start datetime for Abf file. + +Parameters +---------- +neo_reader : neo.io.AxonIO + The Neo reader object for the ABF file. + +Returns +------- +datetime + The start date and time of the recording. +-------------------------------------------------------------------------------- + +Function: AbfInterface.get_source_schema +Docstring: +No docstring +-------------------------------------------------------------------------------- + +Function: AbfInterface.get_metadata +Docstring: +No docstring +-------------------------------------------------------------------------------- + +Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/datainterfaces/text/excel/exceltimeintervalsinterface.py... + +Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/datainterfaces/text/csv/csvtimeintervalsinterface.py... From c4bf1b0843eabae18b357683bdb251005a875a83 Mon Sep 17 00:00:00 2001 From: pauladkisson Date: Fri, 24 Jan 2025 14:27:50 -0800 Subject: [PATCH 05/19] added returns section to various getters (Cline third try w/ manual reversions) --- .../ecephys/axona/axona_utils.py | 12 ++++---- .../ecephys/spikeglx/spikeglx_utils.py | 5 ++++ .../scanimage/scanimageimaginginterfaces.py | 30 +++++++++++++++++-- .../tdt_fp/tdtfiberphotometrydatainterface.py | 18 +++++++++-- .../tools/roiextractors/roiextractors.py | 17 ++++++++++- 5 files changed, 71 insertions(+), 11 deletions(-) diff --git a/src/neuroconv/datainterfaces/ecephys/axona/axona_utils.py b/src/neuroconv/datainterfaces/ecephys/axona/axona_utils.py index f7db5924d..a8e6895fe 100644 --- a/src/neuroconv/datainterfaces/ecephys/axona/axona_utils.py +++ b/src/neuroconv/datainterfaces/ecephys/axona/axona_utils.py @@ -20,7 +20,7 @@ def get_eeg_sampling_frequency(file_path: FilePath) -> float: Returns ------- float - Sampling frequency + The sampling frequency in Hz extracted from the file header's sample_rate field. """ Fs_entry = parse_generic_header(file_path, ["sample_rate"]) Fs = float(Fs_entry.get("sample_rate").split(" ")[0]) @@ -76,8 +76,9 @@ def get_all_file_paths(file_path: FilePath) -> list: Returns ------- - path_list : list - List of file_paths + list + List of file paths for all .eeg or .egf files found in the same directory + as the input file path. """ suffix = Path(file_path).suffix[0:4] @@ -183,8 +184,9 @@ def get_header_bstring(file: FilePath) -> bytes: Returns ------- - str - header byte content + bytes + The header content as bytes, including everything from the start of the file + up to and including the 'data_start' marker. """ header = b"" with open(file, "rb") as f: diff --git a/src/neuroconv/datainterfaces/ecephys/spikeglx/spikeglx_utils.py b/src/neuroconv/datainterfaces/ecephys/spikeglx/spikeglx_utils.py index 5c7aa66d9..ba467067d 100644 --- a/src/neuroconv/datainterfaces/ecephys/spikeglx/spikeglx_utils.py +++ b/src/neuroconv/datainterfaces/ecephys/spikeglx/spikeglx_utils.py @@ -94,6 +94,11 @@ def get_device_metadata(meta) -> dict: """Returns a device with description including the metadata as described here # https://billkarsh.github.io/SpikeGLX/Sgl_help/Metadata_30.html + Parameters + ---------- + meta : dict + The metadata dictionary containing SpikeGLX probe information. + Returns ------- dict diff --git a/src/neuroconv/datainterfaces/ophys/scanimage/scanimageimaginginterfaces.py b/src/neuroconv/datainterfaces/ophys/scanimage/scanimageimaginginterfaces.py index 611ed1da7..302266e98 100644 --- a/src/neuroconv/datainterfaces/ophys/scanimage/scanimageimaginginterfaces.py +++ b/src/neuroconv/datainterfaces/ophys/scanimage/scanimageimaginginterfaces.py @@ -457,7 +457,15 @@ def __init__( ) def get_metadata(self) -> dict: - """get metadata for the ScanImage imaging data""" + """ + Get metadata for the ScanImage imaging data. + + Returns + ------- + dict + Dictionary containing metadata including session start time, device information, + and imaging plane configuration specific to the ScanImage system. + """ metadata = super().get_metadata() extracted_session_start_time = datetime.datetime.strptime( @@ -585,7 +593,15 @@ def __init__( ) def get_metadata(self) -> dict: - """get metadata for the ScanImage imaging data""" + """ + Get metadata for the ScanImage imaging data. + + Returns + ------- + dict + Dictionary containing metadata including session start time, device information, + and imaging plane configuration specific to the ScanImage system. + """ metadata = super().get_metadata() extracted_session_start_time = datetime.datetime.strptime( @@ -715,7 +731,15 @@ def __init__( ) def get_metadata(self) -> dict: - """get metadata for the ScanImage imaging data""" + """ + Get metadata for the ScanImage imaging data. + + Returns + ------- + dict + Dictionary containing metadata including session start time, device information, + and imaging plane configuration specific to the ScanImage system. + """ metadata = super().get_metadata() extracted_session_start_time = datetime.datetime.strptime( diff --git a/src/neuroconv/datainterfaces/ophys/tdt_fp/tdtfiberphotometrydatainterface.py b/src/neuroconv/datainterfaces/ophys/tdt_fp/tdtfiberphotometrydatainterface.py index bef262cab..a186263c9 100644 --- a/src/neuroconv/datainterfaces/ophys/tdt_fp/tdtfiberphotometrydatainterface.py +++ b/src/neuroconv/datainterfaces/ophys/tdt_fp/tdtfiberphotometrydatainterface.py @@ -47,7 +47,14 @@ def __init__(self, folder_path: DirectoryPath, verbose: bool = False): import ndx_fiber_photometry # noqa: F401 def get_metadata(self) -> DeepDict: - """Get metadata for the TDTFiberPhotometryInterface.""" + """ + Get metadata for the TDTFiberPhotometryInterface. + + Returns + ------- + DeepDict + The metadata dictionary for this interface. + """ metadata = super().get_metadata() tdt_photometry = self.load(evtype=["scalars"]) # This evtype quickly loads info without loading all the data. start_timestamp = tdt_photometry.info.start_date.timestamp() @@ -56,7 +63,14 @@ def get_metadata(self) -> DeepDict: return metadata def get_metadata_schema(self) -> dict: - """Get the metadata schema for the TDTFiberPhotometryInterface.""" + """ + Get the metadata schema for the TDTFiberPhotometryInterface. + + Returns + ------- + dict + The metadata schema for this interface. + """ metadata_schema = super().get_metadata_schema() return metadata_schema diff --git a/src/neuroconv/tools/roiextractors/roiextractors.py b/src/neuroconv/tools/roiextractors/roiextractors.py index afe58ede6..3c6eac8c2 100644 --- a/src/neuroconv/tools/roiextractors/roiextractors.py +++ b/src/neuroconv/tools/roiextractors/roiextractors.py @@ -151,7 +151,15 @@ def get_nwb_imaging_metadata( Parameters ---------- imgextractor : ImagingExtractor + The imaging extractor to get metadata from. photon_series_type : {'OnePhotonSeries', 'TwoPhotonSeries'}, optional + The type of photon series to create metadata for. + + Returns + ------- + dict + Dictionary containing metadata for devices, imaging planes, and photon series + specific to the imaging data. """ metadata = _get_default_ophys_metadata() @@ -869,7 +877,14 @@ def get_nwb_segmentation_metadata(sgmextractor: SegmentationExtractor) -> dict: Parameters ---------- - sgmextractor: SegmentationExtractor + sgmextractor : SegmentationExtractor + The segmentation extractor to get metadata from. + + Returns + ------- + dict + Dictionary containing metadata for devices, imaging planes, image segmentation, + and fluorescence data specific to the segmentation. """ metadata = _get_default_segmentation_metadata() # Optical Channel name: From e7b1d83197173a6ac89cbfc5b840a4f41f5ef952 Mon Sep 17 00:00:00 2001 From: pauladkisson Date: Fri, 24 Jan 2025 14:43:34 -0800 Subject: [PATCH 06/19] added returns section to various getters (Cline fourth try w/ manual reversions) --- .../openephys/openephysbinarydatainterface.py | 11 +- .../openephys/openephyslegacydatainterface.py | 11 +- .../ophys/tiff/tiffdatainterface.py | 10 +- src/neuroconv/nwbconverter.py | 15 +- .../tools/getter_docstrings_analysis.txt | 145 ++++++++++++++++-- src/neuroconv/utils/json_schema.py | 52 ++++++- 6 files changed, 228 insertions(+), 16 deletions(-) diff --git a/src/neuroconv/datainterfaces/ecephys/openephys/openephysbinarydatainterface.py b/src/neuroconv/datainterfaces/ecephys/openephys/openephysbinarydatainterface.py index 948d06613..7bc990e0a 100644 --- a/src/neuroconv/datainterfaces/ecephys/openephys/openephysbinarydatainterface.py +++ b/src/neuroconv/datainterfaces/ecephys/openephys/openephysbinarydatainterface.py @@ -41,7 +41,16 @@ def get_stream_names(cls, folder_path: DirectoryPath) -> list[str]: @classmethod def get_source_schema(cls) -> dict: - """Compile input schema for the RecordingExtractor.""" + """ + Compile input schema for the RecordingExtractor. + + Returns + ------- + dict + The JSON schema for the OpenEphys binary recording interface source data, + containing folder path and other configuration parameters. The schema + excludes recording_id, experiment_id, and stub_test parameters. + """ source_schema = get_json_schema_from_method_signature( method=cls.__init__, exclude=["recording_id", "experiment_id", "stub_test"] ) diff --git a/src/neuroconv/datainterfaces/ecephys/openephys/openephyslegacydatainterface.py b/src/neuroconv/datainterfaces/ecephys/openephys/openephyslegacydatainterface.py index bdab7752b..14e218dae 100644 --- a/src/neuroconv/datainterfaces/ecephys/openephys/openephyslegacydatainterface.py +++ b/src/neuroconv/datainterfaces/ecephys/openephys/openephyslegacydatainterface.py @@ -40,7 +40,16 @@ def get_stream_names(cls, folder_path: DirectoryPath) -> list[str]: @classmethod def get_source_schema(cls): - """Compile input schema for the RecordingExtractor.""" + """ + Compile input schema for the RecordingExtractor. + + Returns + ------- + dict + The JSON schema for the OpenEphys legacy recording interface source data, + containing folder path and other configuration parameters. The schema + inherits from the base recording extractor interface schema. + """ source_schema = super().get_source_schema() source_schema["properties"]["folder_path"][ "description" diff --git a/src/neuroconv/datainterfaces/ophys/tiff/tiffdatainterface.py b/src/neuroconv/datainterfaces/ophys/tiff/tiffdatainterface.py index 5c83f0c72..05ebc1061 100644 --- a/src/neuroconv/datainterfaces/ophys/tiff/tiffdatainterface.py +++ b/src/neuroconv/datainterfaces/ophys/tiff/tiffdatainterface.py @@ -14,7 +14,15 @@ class TiffImagingInterface(BaseImagingExtractorInterface): @classmethod def get_source_schema(cls) -> dict: - """ "Get the source schema for the TIFF imaging interface.""" + """ + Get the source schema for the TIFF imaging interface. + + Returns + ------- + dict + The JSON schema for the TIFF imaging interface source data, + containing file path and other configuration parameters. + """ source_schema = super().get_source_schema() source_schema["properties"]["file_path"]["description"] = "Path to Tiff file." return source_schema diff --git a/src/neuroconv/nwbconverter.py b/src/neuroconv/nwbconverter.py index 540c8b94e..6cb3d4a91 100644 --- a/src/neuroconv/nwbconverter.py +++ b/src/neuroconv/nwbconverter.py @@ -382,7 +382,20 @@ def __init__(self, data_interfaces: Union[list[BaseDataInterface], dict[str, Bas } def get_conversion_options_schema(self) -> dict: - """Compile conversion option schemas from each of the data interface classes.""" + """ + Compile conversion option schemas from each of the data interface classes. + + Returns + ------- + dict + The compiled conversion options schema containing: + - root: True + - id: "conversion_options.schema.json" + - title: "Conversion options schema" + - description: "Schema for the conversion options" + - version: "0.1.0" + - properties: Dictionary mapping interface names to their unrooted schemas + """ conversion_options_schema = get_base_schema( root=True, id_="conversion_options.schema.json", diff --git a/src/neuroconv/tools/getter_docstrings_analysis.txt b/src/neuroconv/tools/getter_docstrings_analysis.txt index 96b124dbc..afde575af 100644 --- a/src/neuroconv/tools/getter_docstrings_analysis.txt +++ b/src/neuroconv/tools/getter_docstrings_analysis.txt @@ -162,6 +162,17 @@ No docstring Function: ConverterPipe.get_conversion_options_schema Docstring: Compile conversion option schemas from each of the data interface classes. + +Returns +------- +dict + The compiled conversion options schema containing: + - root: True + - id: "conversion_options.schema.json" + - title: "Conversion options schema" + - description: "Schema for the conversion options" + - version: "0.1.0" + - properties: Dictionary mapping interface names to their unrooted schemas -------------------------------------------------------------------------------- Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/tools/path_expansion.py... @@ -329,6 +340,36 @@ Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/ne Function: get_base_schema Docstring: Return the base schema used for all other schemas. + +Parameters +---------- +tag : str, optional + Tag to identify the schema. +root : bool, default: False + Whether this schema is a root schema. +id_ : str, optional + Schema identifier. +required : list of str, optional + List of required property names. +properties : dict, optional + Dictionary of property definitions. +**kwargs + Additional schema properties. + +Returns +------- +dict + Base JSON schema with the following structure: + { + "required": List of required properties (empty if not provided) + "properties": Dictionary of property definitions (empty if not provided) + "type": "object" + "additionalProperties": False + "tag": Optional tag if provided + "$schema": Schema version if root is True + "$id": Schema ID if provided + **kwargs: Any additional properties + } -------------------------------------------------------------------------------- Function: get_schema_from_method_signature @@ -359,6 +400,20 @@ json_schema : dict Function: get_schema_from_hdmf_class Docstring: Get metadata schema from hdmf class. + +Parameters +---------- +hdmf_class : type + The HDMF class to generate a schema from. + +Returns +------- +dict + JSON schema derived from the HDMF class, containing: + - tag: Full class path (module.name) + - required: List of required fields + - properties: Dictionary of field definitions including types and descriptions + - additionalProperties: Whether extra fields are allowed -------------------------------------------------------------------------------- Function: get_metadata_schema_for_icephys @@ -382,7 +437,15 @@ Convert metadata from the ImagingExtractor into nwb specific metadata. Parameters ---------- imgextractor : ImagingExtractor + The imaging extractor to get metadata from. photon_series_type : {'OnePhotonSeries', 'TwoPhotonSeries'}, optional + The type of photon series to create metadata for. + +Returns +------- +dict + Dictionary containing metadata for devices, imaging planes, and photon series + specific to the imaging data. -------------------------------------------------------------------------------- Function: get_nwb_segmentation_metadata @@ -391,7 +454,14 @@ Convert metadata from the segmentation into nwb specific metadata. Parameters ---------- -sgmextractor: SegmentationExtractor +sgmextractor : SegmentationExtractor + The segmentation extractor to get metadata from. + +Returns +------- +dict + Dictionary containing metadata for devices, imaging planes, image segmentation, + and fluorescence data specific to the segmentation. -------------------------------------------------------------------------------- Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/tools/roiextractors/imagingextractordatachunkiterator.py... @@ -1267,11 +1337,21 @@ Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/ne Function: TDTFiberPhotometryInterface.get_metadata Docstring: Get metadata for the TDTFiberPhotometryInterface. + +Returns +------- +DeepDict + The metadata dictionary for this interface. -------------------------------------------------------------------------------- Function: TDTFiberPhotometryInterface.get_metadata_schema Docstring: Get the metadata schema for the TDTFiberPhotometryInterface. + +Returns +------- +dict + The metadata schema for this interface. -------------------------------------------------------------------------------- Function: TDTFiberPhotometryInterface.get_original_timestamps @@ -1428,17 +1508,35 @@ dict Function: ScanImageMultiPlaneMultiFileImagingInterface.get_metadata Docstring: -get metadata for the ScanImage imaging data +Get metadata for the ScanImage imaging data. + +Returns +------- +dict + Dictionary containing metadata including session start time, device information, + and imaging plane configuration specific to the ScanImage system. -------------------------------------------------------------------------------- Function: ScanImageSinglePlaneImagingInterface.get_metadata Docstring: -get metadata for the ScanImage imaging data +Get metadata for the ScanImage imaging data. + +Returns +------- +dict + Dictionary containing metadata including session start time, device information, + and imaging plane configuration specific to the ScanImage system. -------------------------------------------------------------------------------- Function: ScanImageSinglePlaneMultiFileImagingInterface.get_metadata Docstring: -get metadata for the ScanImage imaging data +Get metadata for the ScanImage imaging data. + +Returns +------- +dict + Dictionary containing metadata including session start time, device information, + and imaging plane configuration specific to the ScanImage system. -------------------------------------------------------------------------------- Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/datainterfaces/ophys/miniscope/miniscopeconverter.py... @@ -1558,7 +1656,13 @@ Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/ne Function: TiffImagingInterface.get_source_schema Docstring: -"Get the source schema for the TIFF imaging interface. +Get the source schema for the TIFF imaging interface. + +Returns +------- +dict + The JSON schema for the TIFF imaging interface source data, + containing file path and other configuration parameters. -------------------------------------------------------------------------------- Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/datainterfaces/ophys/brukertiff/brukertiffconverter.py... @@ -1693,6 +1797,11 @@ Docstring: Returns a device with description including the metadata as described here # https://billkarsh.github.io/SpikeGLX/Sgl_help/Metadata_30.html +Parameters +---------- +meta : dict + The metadata dictionary containing SpikeGLX probe information. + Returns ------- dict @@ -1868,6 +1977,13 @@ list of str Function: OpenEphysBinaryRecordingInterface.get_source_schema Docstring: Compile input schema for the RecordingExtractor. + +Returns +------- +dict + The JSON schema for the OpenEphys binary recording interface source data, + containing folder path and other configuration parameters. The schema + excludes recording_id, experiment_id, and stub_test parameters. -------------------------------------------------------------------------------- Function: OpenEphysBinaryRecordingInterface.get_metadata @@ -1895,6 +2011,13 @@ list of str Function: OpenEphysLegacyRecordingInterface.get_source_schema Docstring: Compile input schema for the RecordingExtractor. + +Returns +------- +dict + The JSON schema for the OpenEphys legacy recording interface source data, + containing folder path and other configuration parameters. The schema + inherits from the base recording extractor interface schema. -------------------------------------------------------------------------------- Function: OpenEphysLegacyRecordingInterface.get_metadata @@ -1993,7 +2116,7 @@ file_path : Path or str Returns ------- float - Sampling frequency + The sampling frequency in Hz extracted from the file header's sample_rate field. -------------------------------------------------------------------------------- Function: get_all_file_paths @@ -2009,8 +2132,9 @@ file_path : FilePathType Returns ------- -path_list : list - List of file_paths +list + List of file paths for all .eeg or .egf files found in the same directory + as the input file path. -------------------------------------------------------------------------------- Function: get_header_bstring @@ -2024,8 +2148,9 @@ file (str or path) : file to be loaded Returns ------- -str - header byte content +bytes + The header content as bytes, including everything from the start of the file + up to and including the 'data_start' marker. -------------------------------------------------------------------------------- Function: get_position_object diff --git a/src/neuroconv/utils/json_schema.py b/src/neuroconv/utils/json_schema.py index b05019fe4..c1f9f6248 100644 --- a/src/neuroconv/utils/json_schema.py +++ b/src/neuroconv/utils/json_schema.py @@ -73,7 +73,39 @@ def get_base_schema( properties: Optional[dict] = None, **kwargs, ) -> dict: - """Return the base schema used for all other schemas.""" + """ + Return the base schema used for all other schemas. + + Parameters + ---------- + tag : str, optional + Tag to identify the schema. + root : bool, default: False + Whether this schema is a root schema. + id_ : str, optional + Schema identifier. + required : list of str, optional + List of required property names. + properties : dict, optional + Dictionary of property definitions. + **kwargs + Additional schema properties. + + Returns + ------- + dict + Base JSON schema with the following structure: + { + "required": List of required properties (empty if not provided) + "properties": Dictionary of property definitions (empty if not provided) + "type": "object" + "additionalProperties": False + "tag": Optional tag if provided + "$schema": Schema version if root is True + "$id": Schema ID if provided + **kwargs: Any additional properties + } + """ base_schema = dict( required=required or [], properties=properties or {}, @@ -241,7 +273,23 @@ def _is_member(types, target_types): def get_schema_from_hdmf_class(hdmf_class): - """Get metadata schema from hdmf class.""" + """ + Get metadata schema from hdmf class. + + Parameters + ---------- + hdmf_class : type + The HDMF class to generate a schema from. + + Returns + ------- + dict + JSON schema derived from the HDMF class, containing: + - tag: Full class path (module.name) + - required: List of required fields + - properties: Dictionary of field definitions including types and descriptions + - additionalProperties: Whether extra fields are allowed + """ schema = get_base_schema() schema["tag"] = hdmf_class.__module__ + "." + hdmf_class.__name__ From ecaaaf6592f8222d84aa2ff3864970f342b36378 Mon Sep 17 00:00:00 2001 From: pauladkisson Date: Fri, 24 Jan 2025 14:49:33 -0800 Subject: [PATCH 07/19] added returns section to various getters (Cline fifth try w/ manual reversions) --- .../behavior/video/video_utils.py | 21 +++++++++- .../tools/getter_docstrings_analysis.txt | 38 ++++++++++++++++++- src/neuroconv/tools/importing.py | 8 ++++ src/neuroconv/tools/neo/neo.py | 15 +++++++- 4 files changed, 79 insertions(+), 3 deletions(-) diff --git a/src/neuroconv/datainterfaces/behavior/video/video_utils.py b/src/neuroconv/datainterfaces/behavior/video/video_utils.py index d134598a3..554ecf578 100644 --- a/src/neuroconv/datainterfaces/behavior/video/video_utils.py +++ b/src/neuroconv/datainterfaces/behavior/video/video_utils.py @@ -19,6 +19,8 @@ def get_video_timestamps(file_path: FilePath, max_frames: Optional[int] = None, The path to a multimedia video file max_frames : Optional[int], optional If provided, extract the timestamps of the video only up to max_frames. + display_progress : bool, default: True + Whether to display a progress bar during timestamp extraction. Returns ------- @@ -45,7 +47,24 @@ def __init__(self, file_path: FilePath): self._video_open_msg = "The video file is not open!" def get_video_timestamps(self, max_frames: Optional[int] = None, display_progress: bool = True): - """Return numpy array of the timestamps(s) for a video file.""" + """ + Return numpy array of the timestamps(s) for a video file. + + Parameters + ---------- + max_frames : Optional[int], optional + If provided, extract the timestamps of the video only up to max_frames. + display_progress : bool, default: True + Whether to display a progress bar during timestamp extraction. + + Returns + ------- + numpy.ndarray + Array of timestamps in seconds, representing the time from the start + of the video for each frame. Timestamps are extracted from the video's + metadata using cv2.CAP_PROP_POS_MSEC and converted from milliseconds + to seconds. + """ cv2 = get_package(package_name="cv2", installation_instructions="pip install opencv-python-headless") timestamps = [] diff --git a/src/neuroconv/tools/getter_docstrings_analysis.txt b/src/neuroconv/tools/getter_docstrings_analysis.txt index afde575af..ecbe54432 100644 --- a/src/neuroconv/tools/getter_docstrings_analysis.txt +++ b/src/neuroconv/tools/getter_docstrings_analysis.txt @@ -231,9 +231,17 @@ excluded_platforms_and_python_versions : dict, optional Allows all platforms and Python versions by default. +Returns +------- +ModuleType + The imported module object. If the package is already imported, returns the + existing module from sys.modules. Otherwise, imports and returns the module. + Raises ------ ModuleNotFoundError + If the package is not installed, or if it's not available for the current + Python version or platform combination. -------------------------------------------------------------------------------- Function: get_format_summaries @@ -529,10 +537,23 @@ Get command traces (e.g. voltage clamp command traces). Parameters ---------- neo_reader : neo.io.baseio + The Neo reader object. segment : int, optional - Defaults to 0. + Segment index. Defaults to 0. cmd_channel : int, optional ABF command channel (0 to 7). Defaults to 0. + +Returns +------- +tuple[list, str, str] + A tuple containing: + - list: The command trace data + - str: The title of the command trace + - str: The units of the command trace + +Notes +----- +This function only works for AxonIO interface. -------------------------------------------------------------------------------- Function: get_conversion_from_unit @@ -954,6 +975,21 @@ Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/ne Function: VideoCaptureContext.get_video_timestamps Docstring: Return numpy array of the timestamps(s) for a video file. + +Parameters +---------- +max_frames : Optional[int], optional + If provided, extract the timestamps of the video only up to max_frames. +display_progress : bool, default: True + Whether to display a progress bar during timestamp extraction. + +Returns +------- +numpy.ndarray + Array of timestamps in seconds, representing the time from the start + of the video for each frame. Timestamps are extracted from the video's + metadata using cv2.CAP_PROP_POS_MSEC and converted from milliseconds + to seconds. -------------------------------------------------------------------------------- Function: VideoCaptureContext.get_video_fps diff --git a/src/neuroconv/tools/importing.py b/src/neuroconv/tools/importing.py index 02aacae10..12ea5f519 100644 --- a/src/neuroconv/tools/importing.py +++ b/src/neuroconv/tools/importing.py @@ -80,9 +80,17 @@ def get_package( Allows all platforms and Python versions by default. + Returns + ------- + ModuleType + The imported module object. If the package is already imported, returns the + existing module from sys.modules. Otherwise, imports and returns the module. + Raises ------ ModuleNotFoundError + If the package is not installed, or if it's not available for the current + Python version or platform combination. """ installation_instructions = installation_instructions or f"pip install {package_name}" excluded_python_versions = excluded_python_versions or list() diff --git a/src/neuroconv/tools/neo/neo.py b/src/neuroconv/tools/neo/neo.py index 4bf8b836c..d2fa9cfc7 100644 --- a/src/neuroconv/tools/neo/neo.py +++ b/src/neuroconv/tools/neo/neo.py @@ -93,10 +93,23 @@ def get_command_traces(neo_reader, segment: int = 0, cmd_channel: int = 0) -> tu Parameters ---------- neo_reader : neo.io.baseio + The Neo reader object. segment : int, optional - Defaults to 0. + Segment index. Defaults to 0. cmd_channel : int, optional ABF command channel (0 to 7). Defaults to 0. + + Returns + ------- + tuple[list, str, str] + A tuple containing: + - list: The command trace data + - str: The title of the command trace + - str: The units of the command trace + + Notes + ----- + This function only works for AxonIO interface. """ try: traces, titles, units = neo_reader.read_raw_protocol() From 654f40a1fa5c0b3bd90f40de8292658771f1311a Mon Sep 17 00:00:00 2001 From: pauladkisson Date: Fri, 24 Jan 2025 14:52:28 -0800 Subject: [PATCH 08/19] added returns section to various getters (Cline 6th try) --- .../datainterfaces/ecephys/axona/axona_utils.py | 12 ++++++++---- src/neuroconv/utils/json_schema.py | 8 +++++--- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/src/neuroconv/datainterfaces/ecephys/axona/axona_utils.py b/src/neuroconv/datainterfaces/ecephys/axona/axona_utils.py index a8e6895fe..2baeee846 100644 --- a/src/neuroconv/datainterfaces/ecephys/axona/axona_utils.py +++ b/src/neuroconv/datainterfaces/ecephys/axona/axona_utils.py @@ -367,14 +367,18 @@ def get_position_object(file_path: FilePath) -> Position: be preferred to read position data from the `.bin` file to ensure samples are locked to ecephys time courses. - Parameters: + Parameters ---------- - file_path (Path or Str): + file_path : Path or str Full file_path of Axona file with any extension. - Returns: + Returns ------- - position: pynwb.behavior.Position + pynwb.behavior.Position + Position object containing multiple SpatialSeries, one for each position + channel (time, X, Y, x, y, PX, px, px_total, unused). Each series contains + timestamps and corresponding position data. The timestamps are in milliseconds + and are aligned to the start of raw acquisition if reading from a .bin file. """ position = Position() diff --git a/src/neuroconv/utils/json_schema.py b/src/neuroconv/utils/json_schema.py index c1f9f6248..d8b0aca3f 100644 --- a/src/neuroconv/utils/json_schema.py +++ b/src/neuroconv/utils/json_schema.py @@ -359,9 +359,11 @@ def get_metadata_schema_for_icephys() -> dict: """ Returns the metadata schema for icephys data. - Returns: - dict: The metadata schema for icephys data. - + Returns + ------- + dict + The metadata schema for icephys data, containing definitions for Device, + Electrode, and Session configurations. """ schema = get_base_schema(tag="Icephys") schema["required"] = ["Device", "Electrodes"] From 9c0b2310e48e12c2e3ff372fc432720da3548bc9 Mon Sep 17 00:00:00 2001 From: pauladkisson Date: Fri, 24 Jan 2025 14:59:35 -0800 Subject: [PATCH 09/19] added returns section to various getters (Cline 7th try) --- .../tools/getter_docstrings_analysis.txt | 37 +++++++++++++++---- .../tools/testing/mock_interfaces.py | 7 +++- src/neuroconv/utils/json_schema.py | 15 +++++++- 3 files changed, 50 insertions(+), 9 deletions(-) diff --git a/src/neuroconv/tools/getter_docstrings_analysis.txt b/src/neuroconv/tools/getter_docstrings_analysis.txt index ecbe54432..7d1436ce3 100644 --- a/src/neuroconv/tools/getter_docstrings_analysis.txt +++ b/src/neuroconv/tools/getter_docstrings_analysis.txt @@ -383,6 +383,17 @@ dict Function: get_schema_from_method_signature Docstring: Deprecated version of `get_json_schema_from_method_signature`. + +Returns +------- +dict + The JSON schema corresponding to the method signature. See + get_json_schema_from_method_signature for details. + +Notes +----- +This method is deprecated and will be removed after January 2025. +Use get_json_schema_from_method_signature instead. -------------------------------------------------------------------------------- Function: get_json_schema_from_method_signature @@ -428,8 +439,11 @@ Function: get_metadata_schema_for_icephys Docstring: Returns the metadata schema for icephys data. -Returns: - dict: The metadata schema for icephys data. +Returns +------- +dict + The metadata schema for icephys data, containing definitions for Device, + Electrode, and Session configurations. -------------------------------------------------------------------------------- Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/utils/dict.py... @@ -628,7 +642,12 @@ No docstring Function: MockRecordingInterface.get_metadata Docstring: -Returns the metadata dictionary for the current object. +Get metadata for the recording interface. + +Returns +------- +dict + The metadata dictionary containing NWBFile metadata with session start time. -------------------------------------------------------------------------------- Function: MockSortingInterface.get_metadata @@ -2196,14 +2215,18 @@ pynwb.behavior.SpatialSeries objects. If possible it should always be preferred to read position data from the `.bin` file to ensure samples are locked to ecephys time courses. -Parameters: +Parameters ---------- -file_path (Path or Str): +file_path : Path or str Full file_path of Axona file with any extension. -Returns: +Returns ------- -position: pynwb.behavior.Position +pynwb.behavior.Position + Position object containing multiple SpatialSeries, one for each position + channel (time, X, Y, x, y, PX, px, px_total, unused). Each series contains + timestamps and corresponding position data. The timestamps are in milliseconds + and are aligned to the start of raw acquisition if reading from a .bin file. -------------------------------------------------------------------------------- Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/datainterfaces/ecephys/axona/axonadatainterface.py... diff --git a/src/neuroconv/tools/testing/mock_interfaces.py b/src/neuroconv/tools/testing/mock_interfaces.py index 128b9365f..a4f84bb24 100644 --- a/src/neuroconv/tools/testing/mock_interfaces.py +++ b/src/neuroconv/tools/testing/mock_interfaces.py @@ -228,7 +228,12 @@ def __init__( def get_metadata(self) -> dict: """ - Returns the metadata dictionary for the current object. + Get metadata for the recording interface. + + Returns + ------- + dict + The metadata dictionary containing NWBFile metadata with session start time. """ metadata = super().get_metadata() session_start_time = datetime.now().astimezone() diff --git a/src/neuroconv/utils/json_schema.py b/src/neuroconv/utils/json_schema.py index d8b0aca3f..b76d5b446 100644 --- a/src/neuroconv/utils/json_schema.py +++ b/src/neuroconv/utils/json_schema.py @@ -123,7 +123,20 @@ def get_base_schema( def get_schema_from_method_signature(method: Callable, exclude: Optional[list[str]] = None) -> dict: - """Deprecated version of `get_json_schema_from_method_signature`.""" + """ + Deprecated version of `get_json_schema_from_method_signature`. + + Returns + ------- + dict + The JSON schema corresponding to the method signature. See + get_json_schema_from_method_signature for details. + + Notes + ----- + This method is deprecated and will be removed after January 2025. + Use get_json_schema_from_method_signature instead. + """ message = ( "The method `get_schema_from_method_signature` is now named `get_json_schema_from_method_signature`." "This method is deprecated and will be removed after January 2025." From dff145727055d209b756d94e8f9c8ae6fad67f92 Mon Sep 17 00:00:00 2001 From: pauladkisson Date: Fri, 24 Jan 2025 15:10:49 -0800 Subject: [PATCH 10/19] removed docstring helpers --- src/neuroconv/tools/analyze_docstrings.py | 142 - .../tools/getter_docstrings_analysis.txt | 2602 ----------------- 2 files changed, 2744 deletions(-) delete mode 100644 src/neuroconv/tools/analyze_docstrings.py delete mode 100644 src/neuroconv/tools/getter_docstrings_analysis.txt diff --git a/src/neuroconv/tools/analyze_docstrings.py b/src/neuroconv/tools/analyze_docstrings.py deleted file mode 100644 index b0c1ec318..000000000 --- a/src/neuroconv/tools/analyze_docstrings.py +++ /dev/null @@ -1,142 +0,0 @@ -"""Script to analyze docstrings of getter functions/methods in the neuroconv package.""" - -import ast -import os -from pathlib import Path -from typing import List, Tuple - - -def get_docstring(node: ast.FunctionDef) -> str: - """ - Extract docstring from a function node. - - Parameters - ---------- - node : ast.FunctionDef - The AST node representing a function definition. - - Returns - ------- - str - The docstring of the function, or "No docstring" if none exists. - """ - docstring_node = ast.get_docstring(node) - return docstring_node if docstring_node else "No docstring" - - -def is_getter_function(node: ast.FunctionDef) -> bool: - """ - Check if a function is a getter function (starts with 'get_'). - - Parameters - ---------- - node : ast.FunctionDef - The AST node representing a function definition. - - Returns - ------- - bool - True if the function is a getter function, False otherwise. - """ - return node.name.startswith("get_") - - -def get_class_methods(node: ast.ClassDef) -> dict: - """ - Get all getter methods from a class definition. - - Parameters - ---------- - node : ast.ClassDef - The class definition node to analyze. - - Returns - ------- - dict - Dictionary mapping method names to their docstrings. - """ - methods = {} - for item in node.body: - if isinstance(item, ast.FunctionDef) and is_getter_function(item): - methods[item.name] = get_docstring(item) - return methods - - -def analyze_file(file_path: Path, output_file) -> None: - """ - Analyze getter functions in a Python file. - - Parameters - ---------- - file_path : Path - Path to the Python file to analyze. - output_file : file object - File to write the analysis results to. - """ - try: - with open(file_path, "r", encoding="utf-8") as f: - tree = ast.parse(f.read(), filename=str(file_path)) - except Exception as e: - output_file.write(f"Error parsing {file_path}: {e}\n") - return - - # First pass: collect all classes and their methods - classes = {} - for node in ast.walk(tree): - if isinstance(node, ast.ClassDef): - methods = get_class_methods(node) - if methods: # Only add classes that have getter methods - classes[node.name] = methods - - # Second pass: handle standalone functions - for node in ast.walk(tree): - if isinstance(node, ast.FunctionDef) and is_getter_function(node): - # Skip if this is a method we've already processed - parent_class = next((class_name for class_name, methods in classes.items() - if node.name in methods), None) - if not parent_class: - output_file.write(f"\nFunction: {node.name}\n") - output_file.write("Docstring:\n") - output_file.write(f"{get_docstring(node)}\n") - output_file.write("-" * 80 + "\n") - - # Output class methods - for class_name, methods in classes.items(): - for method_name, docstring in methods.items(): - output_file.write(f"\nFunction: {class_name}.{method_name}\n") - output_file.write("Docstring:\n") - output_file.write(f"{docstring}\n") - output_file.write("-" * 80 + "\n") - - -def analyze_getter_functions(package_dir: Path, output_path: Path) -> None: - """ - Analyze all getter functions in the package. - - Parameters - ---------- - package_dir : Path - Path to the package directory to analyze. - output_path : Path - Path to the output file where results will be written. - """ - with open(output_path, "w", encoding="utf-8") as output_file: - for file_path in package_dir.rglob("*.py"): - if file_path.name.startswith("_"): # Skip private modules - continue - - output_file.write(f"\nAnalyzing {file_path}...\n") - analyze_file(file_path, output_file) - - -def main(): - """Run the docstring analysis.""" - # Get the package directory (src/neuroconv) - package_dir = Path(__file__).parent.parent - output_path = package_dir / "tools" / "getter_docstrings_analysis.txt" - analyze_getter_functions(package_dir, output_path) - print(f"Analysis complete. Results written to: {output_path}") - - -if __name__ == "__main__": - main() diff --git a/src/neuroconv/tools/getter_docstrings_analysis.txt b/src/neuroconv/tools/getter_docstrings_analysis.txt deleted file mode 100644 index 7d1436ce3..000000000 --- a/src/neuroconv/tools/getter_docstrings_analysis.txt +++ /dev/null @@ -1,2602 +0,0 @@ - -Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/basetemporalalignmentinterface.py... - -Function: BaseTemporalAlignmentInterface.get_original_timestamps -Docstring: -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: numpy.ndarray - The timestamps for the data stream. --------------------------------------------------------------------------------- - -Function: BaseTemporalAlignmentInterface.get_timestamps -Docstring: -Retrieve the timestamps for the data in this interface. - -Returns -------- -timestamps: numpy.ndarray - The timestamps for the data stream. --------------------------------------------------------------------------------- - -Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/baseextractorinterface.py... - -Function: BaseExtractorInterface.get_extractor -Docstring: -Get the extractor class for this interface. - -Returns -------- -type - The extractor class that will be used to read the data. --------------------------------------------------------------------------------- - -Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/basedatainterface.py... - -Function: BaseDataInterface.get_source_schema -Docstring: -Infer the JSON schema for the source_data from the method signature (annotation typing). - -Returns -------- -dict - The JSON schema for the source_data. --------------------------------------------------------------------------------- - -Function: BaseDataInterface.get_metadata_schema -Docstring: -Retrieve JSON schema for metadata. - -Returns -------- -dict - The JSON schema defining the metadata structure. --------------------------------------------------------------------------------- - -Function: BaseDataInterface.get_metadata -Docstring: -Child DataInterface classes should override this to match their metadata. - -Returns -------- -DeepDict - The metadata dictionary containing basic NWBFile metadata. --------------------------------------------------------------------------------- - -Function: BaseDataInterface.get_conversion_options_schema -Docstring: -Infer the JSON schema for the conversion options from the method signature (annotation typing). - -Returns -------- -dict - The JSON schema for the conversion options. --------------------------------------------------------------------------------- - -Function: BaseDataInterface.get_default_backend_configuration -Docstring: -Fill and return a default backend configuration to serve as a starting point for further customization. - -Parameters ----------- -nwbfile : pynwb.NWBFile - The in-memory object with this interface's data already added to it. -backend : "hdf5", default: "hdf5" - The type of backend to use when creating the file. - Additional backend types will be added soon. - -Returns -------- -Union[HDF5BackendConfiguration, ZarrBackendConfiguration] - The default configuration for the specified backend type. --------------------------------------------------------------------------------- - -Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/nwbconverter.py... - -Function: NWBConverter.get_source_schema -Docstring: -Compile input schemas from each of the data interface classes. - -Returns -------- -dict - The compiled source schema from all data interface classes. --------------------------------------------------------------------------------- - -Function: NWBConverter.get_metadata_schema -Docstring: -Compile metadata schemas from each of the data interface objects. - -Returns -------- -dict - The compiled metadata schema from all data interface objects. --------------------------------------------------------------------------------- - -Function: NWBConverter.get_metadata -Docstring: -Auto-fill as much of the metadata as possible. Must comply with metadata schema. - -Returns -------- -DeepDict - The metadata dictionary containing auto-filled metadata from all interfaces. --------------------------------------------------------------------------------- - -Function: NWBConverter.get_conversion_options_schema -Docstring: -Compile conversion option schemas from each of the data interface classes. - -Returns -------- -dict - The compiled conversion options schema from all data interface classes. --------------------------------------------------------------------------------- - -Function: NWBConverter.get_default_backend_configuration -Docstring: -Fill and return a default backend configuration to serve as a starting point for further customization. - -Parameters ----------- -nwbfile : pynwb.NWBFile - The in-memory object with this interface's data already added to it. -backend : "hdf5" or "zarr", default: "hdf5" - The type of backend to use when creating the file. - -Returns -------- -Union[HDF5BackendConfiguration, ZarrBackendConfiguration] - The default configuration for the specified backend type. --------------------------------------------------------------------------------- - -Function: ConverterPipe.get_source_schema -Docstring: -No docstring --------------------------------------------------------------------------------- - -Function: ConverterPipe.get_conversion_options_schema -Docstring: -Compile conversion option schemas from each of the data interface classes. - -Returns -------- -dict - The compiled conversion options schema containing: - - root: True - - id: "conversion_options.schema.json" - - title: "Conversion options schema" - - description: "Schema for the conversion options" - - version: "0.1.0" - - properties: Dictionary mapping interface names to their unrooted schemas --------------------------------------------------------------------------------- - -Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/tools/path_expansion.py... - -Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/tools/importing.py... - -Function: get_package_version -Docstring: -Retrieve the version of a package. - -Parameters ----------- -name : str - Name of package. - -Returns -------- -version : Version - The package version as an object from packaging.version.Version. --------------------------------------------------------------------------------- - -Function: get_package -Docstring: -Check if package is installed and return module if so. - -Otherwise, raise informative error describing how to perform the installation. -Inspired by https://docs.python.org/3/library/importlib.html#checking-if-a-module-can-be-imported. - -Parameters ----------- -package_name : str - Name of the package to be imported. -installation_instructions : str, optional - String describing the source, options, and alias of package name (if needed) for installation. - For example, - >>> installation_source = "conda install -c conda-forge my-package-name" - Defaults to f"pip install {package_name}". -excluded_python_versions : list of strs, optional - If a given package has no distribution available for a certain Python version, it can be excluded by this - import across all platforms. If you wish to be more specific about combinations of platforms and versions, - use the 'excluded_platforms_and_python_versions' keyword argument instead. - Allows all Python versions by default. -excluded_platforms_and_python_versions : dict, optional - Mapping of string platform names to a list of string versions. - Valid platform strings are: ["linux", "win32", "darwin"] or any other variant used by sys.platform - - In case some combinations of platforms or Python versions are not allowed for the given package, - specify this dictionary to raise a more specific error to that issue. - - For example, `excluded_platforms_and_python_versions = dict(darwin=["3.7"])` will raise an - informative error when running on macOS with Python version 3.7. - - This also applies to specific architectures of platforms, such as - `excluded_platforms_and_python_versions = dict(darwin=dict(arm=["3.7"]))` to exclude a specific Python - version for M1 Macs. - - Allows all platforms and Python versions by default. - -Returns -------- -ModuleType - The imported module object. If the package is already imported, returns the - existing module from sys.modules. Otherwise, imports and returns the module. - -Raises ------- -ModuleNotFoundError - If the package is not installed, or if it's not available for the current - Python version or platform combination. --------------------------------------------------------------------------------- - -Function: get_format_summaries -Docstring: -Simple helper function for compiling high level summaries of all format interfaces and converters. - -Returns -------- -dict - A dictionary mapping interface/converter names to their summary information. - Each summary contains display_name, keywords, associated_suffixes, and info. --------------------------------------------------------------------------------- - -Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/tools/optogenetics.py... - -Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/tools/figshare.py... - -Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/tools/fiber_photometry.py... - -Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/tools/processes.py... - -Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/tools/analyze_docstrings.py... - -Function: get_docstring -Docstring: -Extract docstring from a function node. - -Parameters ----------- -node : ast.FunctionDef - The AST node representing a function definition. - -Returns -------- -str - The docstring of the function, or "No docstring" if none exists. --------------------------------------------------------------------------------- - -Function: get_class_methods -Docstring: -Get all getter methods from a class definition. - -Parameters ----------- -node : ast.ClassDef - The class definition node to analyze. - -Returns -------- -dict - Dictionary mapping method names to their docstrings. --------------------------------------------------------------------------------- - -Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/tools/text.py... - -Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/tools/hdmf.py... - -Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/tools/signal_processing.py... - -Function: get_rising_frames_from_ttl -Docstring: -Return the frame indices for rising events in a TTL pulse. - -Parameters ----------- -trace : numpy.ndarray - A TTL signal. -threshold : float, optional - The threshold used to distinguish on/off states in the trace. - The mean of the trace is used by default. - -Returns -------- -rising_frames : numpy.ndarray - The frame indices of rising events. --------------------------------------------------------------------------------- - -Function: get_falling_frames_from_ttl -Docstring: -Return the frame indices for falling events in a TTL pulse. - -Parameters ----------- -trace : numpy.ndarray - A TTL signal. -threshold : float, optional - The threshold used to distinguish on/off states in the trace. - The mean of the trace is used by default. - -Returns -------- -falling_frames : numpy.ndarray - The frame indices of falling events. --------------------------------------------------------------------------------- - -Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/utils/str_utils.py... - -Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/utils/checks.py... - -Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/utils/types.py... - -Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/utils/json_schema.py... - -Function: get_base_schema -Docstring: -Return the base schema used for all other schemas. - -Parameters ----------- -tag : str, optional - Tag to identify the schema. -root : bool, default: False - Whether this schema is a root schema. -id_ : str, optional - Schema identifier. -required : list of str, optional - List of required property names. -properties : dict, optional - Dictionary of property definitions. -**kwargs - Additional schema properties. - -Returns -------- -dict - Base JSON schema with the following structure: - { - "required": List of required properties (empty if not provided) - "properties": Dictionary of property definitions (empty if not provided) - "type": "object" - "additionalProperties": False - "tag": Optional tag if provided - "$schema": Schema version if root is True - "$id": Schema ID if provided - **kwargs: Any additional properties - } --------------------------------------------------------------------------------- - -Function: get_schema_from_method_signature -Docstring: -Deprecated version of `get_json_schema_from_method_signature`. - -Returns -------- -dict - The JSON schema corresponding to the method signature. See - get_json_schema_from_method_signature for details. - -Notes ------ -This method is deprecated and will be removed after January 2025. -Use get_json_schema_from_method_signature instead. --------------------------------------------------------------------------------- - -Function: get_json_schema_from_method_signature -Docstring: -Get the equivalent JSON schema for a signature of a method. - -Also uses `docstring_parser` (NumPy style) to attempt to find descriptions for the arguments. - -Parameters ----------- -method : callable - The method to generate the JSON schema from. -exclude : list of str, optional - List of arguments to exclude from the schema generation. - Always includes 'self' and 'cls'. - -Returns -------- -json_schema : dict - The JSON schema corresponding to the method signature. --------------------------------------------------------------------------------- - -Function: get_schema_from_hdmf_class -Docstring: -Get metadata schema from hdmf class. - -Parameters ----------- -hdmf_class : type - The HDMF class to generate a schema from. - -Returns -------- -dict - JSON schema derived from the HDMF class, containing: - - tag: Full class path (module.name) - - required: List of required fields - - properties: Dictionary of field definitions including types and descriptions - - additionalProperties: Whether extra fields are allowed --------------------------------------------------------------------------------- - -Function: get_metadata_schema_for_icephys -Docstring: -Returns the metadata schema for icephys data. - -Returns -------- -dict - The metadata schema for icephys data, containing definitions for Device, - Electrode, and Session configurations. --------------------------------------------------------------------------------- - -Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/utils/dict.py... - -Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/utils/path.py... - -Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/tools/roiextractors/roiextractors.py... - -Function: get_nwb_imaging_metadata -Docstring: -Convert metadata from the ImagingExtractor into nwb specific metadata. - -Parameters ----------- -imgextractor : ImagingExtractor - The imaging extractor to get metadata from. -photon_series_type : {'OnePhotonSeries', 'TwoPhotonSeries'}, optional - The type of photon series to create metadata for. - -Returns -------- -dict - Dictionary containing metadata for devices, imaging planes, and photon series - specific to the imaging data. --------------------------------------------------------------------------------- - -Function: get_nwb_segmentation_metadata -Docstring: -Convert metadata from the segmentation into nwb specific metadata. - -Parameters ----------- -sgmextractor : SegmentationExtractor - The segmentation extractor to get metadata from. - -Returns -------- -dict - Dictionary containing metadata for devices, imaging planes, image segmentation, - and fluorescence data specific to the segmentation. --------------------------------------------------------------------------------- - -Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/tools/roiextractors/imagingextractordatachunkiterator.py... - -Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/tools/neo/neo.py... - -Function: get_electrodes_metadata -Docstring: -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: List of dictionaries containing electrodes metadata. --------------------------------------------------------------------------------- - -Function: get_number_of_electrodes -Docstring: -Get number of electrodes from Neo reader. - -Returns -------- -int - The total number of electrodes in the recording. --------------------------------------------------------------------------------- - -Function: get_number_of_segments -Docstring: -Get number of segments from Neo reader. - -Parameters ----------- -neo_reader : neo.io.baseio - The Neo reader object. -block : int, default: 0 - Block index. - -Returns -------- -int - The number of segments in the specified block. --------------------------------------------------------------------------------- - -Function: get_command_traces -Docstring: -Get command traces (e.g. voltage clamp command traces). - -Parameters ----------- -neo_reader : neo.io.baseio - The Neo reader object. -segment : int, optional - Segment index. Defaults to 0. -cmd_channel : int, optional - ABF command channel (0 to 7). Defaults to 0. - -Returns -------- -tuple[list, str, str] - A tuple containing: - - list: The command trace data - - str: The title of the command trace - - str: The units of the command trace - -Notes ------ -This function only works for AxonIO interface. --------------------------------------------------------------------------------- - -Function: get_conversion_from_unit -Docstring: -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 - The conversion factor to convert to Ampere or Volt. - For example, for 'pA' returns 1e-12 to convert to Ampere. --------------------------------------------------------------------------------- - -Function: get_nwb_metadata -Docstring: -Return default metadata for all recording fields. - -Parameters ----------- -neo_reader : neo.io.baseio - Neo reader object -metadata : dict, optional - Metadata info for constructing the nwb file. - -Returns -------- -dict - Default metadata dictionary containing NWBFile and Icephys device information. --------------------------------------------------------------------------------- - -Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/tools/testing/mock_interfaces.py... - -Function: MockInterface.get_metadata -Docstring: -No docstring --------------------------------------------------------------------------------- - -Function: MockBehaviorEventInterface.get_source_schema -Docstring: -No docstring --------------------------------------------------------------------------------- - -Function: MockBehaviorEventInterface.get_original_timestamps -Docstring: -Get the original event times before any alignment or transformation. - -Returns -------- -np.ndarray - The original event times as a NumPy array. --------------------------------------------------------------------------------- - -Function: MockBehaviorEventInterface.get_timestamps -Docstring: -Get the current (possibly aligned) event times. - -Returns -------- -np.ndarray - The current event times as a NumPy array, possibly modified after alignment. --------------------------------------------------------------------------------- - -Function: MockSpikeGLXNIDQInterface.get_source_schema -Docstring: -No docstring --------------------------------------------------------------------------------- - -Function: MockRecordingInterface.get_metadata -Docstring: -Get metadata for the recording interface. - -Returns -------- -dict - The metadata dictionary containing NWBFile metadata with session start time. --------------------------------------------------------------------------------- - -Function: MockSortingInterface.get_metadata -Docstring: -No docstring --------------------------------------------------------------------------------- - -Function: MockImagingInterface.get_metadata -Docstring: -No docstring --------------------------------------------------------------------------------- - -Function: MockSegmentationInterface.get_metadata -Docstring: -No docstring --------------------------------------------------------------------------------- - -Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/tools/testing/mock_files.py... - -Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/tools/testing/data_interface_mixins.py... - -Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/tools/testing/mock_probes.py... - -Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/tools/testing/mock_ttl_signals.py... - -Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/tools/audio/audio.py... - -Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/tools/spikeinterface/spikeinterface.py... - -Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/tools/spikeinterface/spikeinterfacerecordingdatachunkiterator.py... - -Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/datainterfaces/ophys/baseimagingextractorinterface.py... - -Function: BaseImagingExtractorInterface.get_metadata_schema -Docstring: -Retrieve the metadata schema for the optical physiology (Ophys) data. - -Returns -------- -dict - The metadata schema dictionary containing definitions for Device, ImagingPlane, - and either OnePhotonSeries or TwoPhotonSeries based on the photon_series_type. --------------------------------------------------------------------------------- - -Function: BaseImagingExtractorInterface.get_metadata -Docstring: -Retrieve the metadata for the imaging data. - -Returns -------- -DeepDict - Dictionary containing metadata including device information, imaging plane details, - and photon series configuration. --------------------------------------------------------------------------------- - -Function: BaseImagingExtractorInterface.get_original_timestamps -Docstring: -No docstring --------------------------------------------------------------------------------- - -Function: BaseImagingExtractorInterface.get_timestamps -Docstring: -No docstring --------------------------------------------------------------------------------- - -Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/datainterfaces/ophys/basesegmentationextractorinterface.py... - -Function: BaseSegmentationExtractorInterface.get_metadata_schema -Docstring: -Generate the metadata schema for Ophys data, updating required fields and properties. - -This method builds upon the base schema and customizes it for Ophys-specific metadata, including required -components such as devices, fluorescence data, imaging planes, and two-photon series. It also applies -temporary schema adjustments to handle certain use cases until a centralized metadata schema definition -is available. - -Returns -------- -dict - A dictionary representing the updated Ophys metadata schema. - -Notes ------ -- Ensures that `Device` and `ImageSegmentation` are marked as required. -- Updates various properties, including ensuring arrays for `ImagingPlane` and `TwoPhotonSeries`. -- Adjusts the schema for `Fluorescence`, including required fields and pattern properties. -- Adds schema definitions for `DfOverF`, segmentation images, and summary images. -- Applies temporary fixes, such as setting additional properties for `ImageSegmentation` to True. --------------------------------------------------------------------------------- - -Function: BaseSegmentationExtractorInterface.get_metadata -Docstring: -No docstring --------------------------------------------------------------------------------- - -Function: BaseSegmentationExtractorInterface.get_original_timestamps -Docstring: -No docstring --------------------------------------------------------------------------------- - -Function: BaseSegmentationExtractorInterface.get_timestamps -Docstring: -No docstring --------------------------------------------------------------------------------- - -Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/datainterfaces/ecephys/baserecordingextractorinterface.py... - -Function: BaseRecordingExtractorInterface.get_metadata_schema -Docstring: -Compile metadata schema for the RecordingExtractor. - -Returns -------- -dict - The metadata schema dictionary containing definitions for Device, ElectrodeGroup, - Electrodes, and optionally ElectricalSeries. --------------------------------------------------------------------------------- - -Function: BaseRecordingExtractorInterface.get_metadata -Docstring: -Get metadata for the recording extractor. - -Returns -------- -DeepDict - Dictionary containing metadata including device information, electrode groups, - and electrical series configuration. --------------------------------------------------------------------------------- - -Function: BaseRecordingExtractorInterface.get_original_timestamps -Docstring: -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: numpy.ndarray or list of numpy.ndarray - The timestamps for the data stream; if the recording has multiple segments, then a list of timestamps is returned. --------------------------------------------------------------------------------- - -Function: BaseRecordingExtractorInterface.get_timestamps -Docstring: -Retrieve the timestamps for the data in this interface. - -Returns -------- -timestamps: numpy.ndarray or list of numpy.ndarray - The timestamps for the data stream; if the recording has multiple segments, then a list of timestamps is returned. --------------------------------------------------------------------------------- - -Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/datainterfaces/ecephys/basesortingextractorinterface.py... - -Function: BaseSortingExtractorInterface.get_metadata_schema -Docstring: -Compile metadata schema for the RecordingExtractor. - -Returns -------- -dict - The metadata schema dictionary containing definitions for Device, ElectrodeGroup, - Electrodes, and UnitProperties. --------------------------------------------------------------------------------- - -Function: BaseSortingExtractorInterface.get_original_timestamps -Docstring: -No docstring --------------------------------------------------------------------------------- - -Function: BaseSortingExtractorInterface.get_timestamps -Docstring: -Get the timestamps for the sorting data. - -Returns -------- -numpy.ndarray or list of numpy.ndarray - The timestamps for each spike in the sorting data. If there are multiple segments, - returns a list of timestamp arrays. - -Raises ------- -NotImplementedError - If no recording is attached to the sorting extractor. --------------------------------------------------------------------------------- - -Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/datainterfaces/ecephys/baselfpextractorinterface.py... - -Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/datainterfaces/icephys/baseicephysinterface.py... - -Function: BaseIcephysInterface.get_source_schema -Docstring: -No docstring --------------------------------------------------------------------------------- - -Function: BaseIcephysInterface.get_metadata_schema -Docstring: -No docstring --------------------------------------------------------------------------------- - -Function: BaseIcephysInterface.get_metadata -Docstring: -No docstring --------------------------------------------------------------------------------- - -Function: BaseIcephysInterface.get_original_timestamps -Docstring: -No docstring --------------------------------------------------------------------------------- - -Function: BaseIcephysInterface.get_timestamps -Docstring: -No docstring --------------------------------------------------------------------------------- - -Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/datainterfaces/text/timeintervalsinterface.py... - -Function: TimeIntervalsInterface.get_metadata -Docstring: -Get metadata for the time intervals. - -Returns -------- -dict - The metadata dictionary containing time intervals metadata. - Includes a TimeIntervals key with trials information. --------------------------------------------------------------------------------- - -Function: TimeIntervalsInterface.get_metadata_schema -Docstring: -Get the metadata schema for the time intervals. - -Returns -------- -dict - The schema dictionary for time intervals metadata. --------------------------------------------------------------------------------- - -Function: TimeIntervalsInterface.get_original_timestamps -Docstring: -Get the original timestamps for a given column. - -Parameters ----------- -column : str - The name of the column containing timestamps. - -Returns -------- -np.ndarray - The original timestamps from the specified column. - -Raises ------- -ValueError - If the column name does not end with '_time'. --------------------------------------------------------------------------------- - -Function: TimeIntervalsInterface.get_timestamps -Docstring: -Get the current timestamps for a given column. - -Parameters ----------- -column : str - The name of the column containing timestamps. - -Returns -------- -np.ndarray - The current timestamps from the specified column. - -Raises ------- -ValueError - If the column name does not end with '_time'. --------------------------------------------------------------------------------- - -Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/datainterfaces/behavior/video/videodatainterface.py... - -Function: VideoInterface.get_metadata_schema -Docstring: -No docstring --------------------------------------------------------------------------------- - -Function: VideoInterface.get_metadata -Docstring: -No docstring --------------------------------------------------------------------------------- - -Function: VideoInterface.get_original_timestamps -Docstring: -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 : numpy.ndarray - The timestamps for the data stream. -stub_test : bool, default: False - This method scans through each video; a process which can take some time to complete. - - To limit that scan to a small number of frames, set `stub_test=True`. --------------------------------------------------------------------------------- - -Function: VideoInterface.get_timing_type -Docstring: -Determine the type of timing used by this interface. - -Returns -------- -Literal["starting_time and rate", "timestamps"] - The type of timing that has been set explicitly according to alignment. - - If only timestamps have been set, then only those will be used. - If only starting times have been set, then only those will be used. - - If timestamps were set, and then starting times were set, the timestamps will take precedence - as they will then be shifted by the corresponding starting times. - - If neither has been set, and there is only one video in the file_paths, - it is assumed the video is regularly sampled and pre-aligned with - a starting_time of 0.0 relative to the session start time. --------------------------------------------------------------------------------- - -Function: VideoInterface.get_timestamps -Docstring: -Retrieve the timestamps for the data in this interface. - -Returns -------- -timestamps : numpy.ndarray - The timestamps for the data stream. -stub_test : bool, default: False - If timestamps have not been set to this interface, it will attempt to retrieve them - using the `.get_original_timestamps` method, which scans through each video; - a process which can take some time to complete. - - To limit that scan to a small number of frames, set `stub_test=True`. --------------------------------------------------------------------------------- - -Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/datainterfaces/behavior/video/video_utils.py... - -Function: VideoCaptureContext.get_video_timestamps -Docstring: -Return numpy array of the timestamps(s) for a video file. - -Parameters ----------- -max_frames : Optional[int], optional - If provided, extract the timestamps of the video only up to max_frames. -display_progress : bool, default: True - Whether to display a progress bar during timestamp extraction. - -Returns -------- -numpy.ndarray - Array of timestamps in seconds, representing the time from the start - of the video for each frame. Timestamps are extracted from the video's - metadata using cv2.CAP_PROP_POS_MSEC and converted from milliseconds - to seconds. --------------------------------------------------------------------------------- - -Function: VideoCaptureContext.get_video_fps -Docstring: -Return the internal frames per second (fps) for a video file. - -Returns -------- -float - The frames per second of the video. --------------------------------------------------------------------------------- - -Function: VideoCaptureContext.get_frame_shape -Docstring: -Return the shape of frames from a video file. - -Returns -------- -Tuple - The shape of the video frames (height, width, channels). --------------------------------------------------------------------------------- - -Function: VideoCaptureContext.get_video_frame_count -Docstring: -Get the total number of frames in the video. - -Returns -------- -int - The total number of frames in the video. --------------------------------------------------------------------------------- - -Function: VideoCaptureContext.get_cv_attribute -Docstring: -Get an OpenCV attribute by name. - -Parameters ----------- -attribute_name : str - The name of the OpenCV attribute to get. - -Returns -------- -Any - The OpenCV attribute value. --------------------------------------------------------------------------------- - -Function: VideoCaptureContext.get_video_frame -Docstring: -Return the specific frame from a video as an RGB colorspace. - -Parameters ----------- -frame_number : int - The index of the frame to retrieve. - -Returns -------- -numpy.ndarray - The video frame in RGB colorspace with shape (height, width, 3). --------------------------------------------------------------------------------- - -Function: VideoCaptureContext.get_video_frame_dtype -Docstring: -Return the dtype for frame in a video file. - -Returns -------- -numpy.dtype - The data type of the video frames. --------------------------------------------------------------------------------- - -Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/datainterfaces/behavior/sleap/sleapdatainterface.py... - -Function: SLEAPInterface.get_source_schema -Docstring: -No docstring --------------------------------------------------------------------------------- - -Function: SLEAPInterface.get_original_timestamps -Docstring: -No docstring --------------------------------------------------------------------------------- - -Function: SLEAPInterface.get_timestamps -Docstring: -No docstring --------------------------------------------------------------------------------- - -Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/datainterfaces/behavior/sleap/sleap_utils.py... - -Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/datainterfaces/behavior/fictrac/fictracdatainterface.py... - -Function: FicTracDataInterface.get_source_schema -Docstring: -No docstring --------------------------------------------------------------------------------- - -Function: FicTracDataInterface.get_metadata -Docstring: -No docstring --------------------------------------------------------------------------------- - -Function: FicTracDataInterface.get_original_timestamps -Docstring: -Retrieve and correct timestamps from a FicTrac data file. - -This function addresses two specific issues with timestamps in FicTrac data: - -1. Resetting Initial Timestamp - In some instances, FicTrac replaces the initial timestamp (0) with the system time. This commonly occurs - when the data source is a video file, and OpenCV reports the first timestamp as 0. Since OpenCV also - uses 0 as a marker for invalid values, FicTrac defaults to system time in that case. This leads to - inconsistent timestamps like [system_time, t1, t2, t3, ...]. The function corrects this by resetting the - first timestamp back to 0 when a negative difference is detected between the first two timestamps. -2. Re-centering Unix Epoch Time - If timestamps are in Unix epoch time format (time since 1970-01-01 00:00:00 UTC), this function re-centers - the time series by subtracting the first timestamp. This adjustment ensures that timestamps represent the - elapsed time since the start of the experiment rather than the Unix epoch. This case appears when one of the - sources of data in FicTrac (such as PGR or Basler) lacks a timestamp extraction method. FicTrac - then falls back to using the system time, which is in Unix epoch format. - -Returns -------- -np.ndarray - An array of corrected timestamps, in seconds. - -Notes ------ -- The issue of the initial timestamp replacement appears in FicTrac 2.1.1 and earlier versions. -- Re-centering is essential for timestamps in Unix epoch format as timestamps in an NWB file must be relative -to the start of the session. The heuristic here is to check if the first timestamp is larger than the length -of a 10-year experiment in seconds. If so, it's assumed that the timestamps are in Unix epoch format. - -References ----------- -Issue discussion on FicTrac's timestamp inconsistencies: -https://github.com/rjdmoore/fictrac/issues/29 --------------------------------------------------------------------------------- - -Function: FicTracDataInterface.get_timestamps -Docstring: -No docstring --------------------------------------------------------------------------------- - -Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/datainterfaces/behavior/deeplabcut/deeplabcutdatainterface.py... - -Function: DeepLabCutInterface.get_source_schema -Docstring: -No docstring --------------------------------------------------------------------------------- - -Function: DeepLabCutInterface.get_metadata -Docstring: -No docstring --------------------------------------------------------------------------------- - -Function: DeepLabCutInterface.get_original_timestamps -Docstring: -No docstring --------------------------------------------------------------------------------- - -Function: DeepLabCutInterface.get_timestamps -Docstring: -No docstring --------------------------------------------------------------------------------- - -Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/datainterfaces/behavior/lightningpose/lightningposeconverter.py... - -Function: LightningPoseConverter.get_source_schema -Docstring: -No docstring --------------------------------------------------------------------------------- - -Function: LightningPoseConverter.get_conversion_options_schema -Docstring: -No docstring --------------------------------------------------------------------------------- - -Function: LightningPoseConverter.get_metadata -Docstring: -No docstring --------------------------------------------------------------------------------- - -Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/datainterfaces/behavior/lightningpose/lightningposedatainterface.py... - -Function: LightningPoseDataInterface.get_metadata_schema -Docstring: -No docstring --------------------------------------------------------------------------------- - -Function: LightningPoseDataInterface.get_original_timestamps -Docstring: -No docstring --------------------------------------------------------------------------------- - -Function: LightningPoseDataInterface.get_timestamps -Docstring: -No docstring --------------------------------------------------------------------------------- - -Function: LightningPoseDataInterface.get_metadata -Docstring: -No docstring --------------------------------------------------------------------------------- - -Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/datainterfaces/behavior/audio/audiointerface.py... - -Function: AudioInterface.get_metadata_schema -Docstring: -No docstring --------------------------------------------------------------------------------- - -Function: AudioInterface.get_metadata -Docstring: -No docstring --------------------------------------------------------------------------------- - -Function: AudioInterface.get_original_timestamps -Docstring: -No docstring --------------------------------------------------------------------------------- - -Function: AudioInterface.get_timestamps -Docstring: -No docstring --------------------------------------------------------------------------------- - -Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/datainterfaces/behavior/miniscope/miniscopedatainterface.py... - -Function: MiniscopeBehaviorInterface.get_source_schema -Docstring: -No docstring --------------------------------------------------------------------------------- - -Function: MiniscopeBehaviorInterface.get_metadata -Docstring: -No docstring --------------------------------------------------------------------------------- - -Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/datainterfaces/behavior/medpc/medpc_helpers.py... - -Function: get_medpc_variables -Docstring: -Get the values of the given single-line variables from a MedPC file for all sessions in that file. - -Parameters ----------- -file_path : FilePathType - The path to the MedPC file. -variable_names : list - The names of the variables to get the values of. - -Returns -------- -dict - A dictionary with the variable names as keys and a list of variable values as values. --------------------------------------------------------------------------------- - -Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/datainterfaces/behavior/medpc/medpcdatainterface.py... - -Function: MedPCInterface.get_metadata -Docstring: -No docstring --------------------------------------------------------------------------------- - -Function: MedPCInterface.get_metadata_schema -Docstring: -No docstring --------------------------------------------------------------------------------- - -Function: MedPCInterface.get_original_timestamps -Docstring: -Retrieve the original unaltered timestamps dictionary for the data in this interface. - -This function retrieves the data on-demand by re-reading the medpc file. - -Parameters ----------- -medpc_name_to_info_dict : dict - A dictionary mapping the names of the desired variables in the MedPC file - to an info dictionary with the names of the variables in the metadata and whether or not they are arrays. - ex. {"A": {"name": "left_nose_poke_times", "is_array": True}} - -Returns -------- -timestamps_dict: dict - A dictionary mapping the names of the variables to the original medpc timestamps. --------------------------------------------------------------------------------- - -Function: MedPCInterface.get_timestamps -Docstring: -Retrieve the timestamps dictionary for the data in this interface. - -Returns -------- -timestamps_dict: dict - A dictionary mapping the names of the variables to the timestamps. --------------------------------------------------------------------------------- - -Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/datainterfaces/behavior/neuralynx/nvt_utils.py... - -Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/datainterfaces/behavior/neuralynx/neuralynx_nvt_interface.py... - -Function: NeuralynxNvtInterface.get_original_timestamps -Docstring: -No docstring --------------------------------------------------------------------------------- - -Function: NeuralynxNvtInterface.get_timestamps -Docstring: -No docstring --------------------------------------------------------------------------------- - -Function: NeuralynxNvtInterface.get_metadata -Docstring: -No docstring --------------------------------------------------------------------------------- - -Function: NeuralynxNvtInterface.get_metadata_schema -Docstring: -No docstring --------------------------------------------------------------------------------- - -Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/datainterfaces/ophys/caiman/caimandatainterface.py... - -Function: CaimanSegmentationInterface.get_source_schema -Docstring: -Get the source schema for the Caiman segmentation interface. - -Returns -------- -dict - The schema dictionary containing input parameters and descriptions - for initializing the CaImAn segmentation interface. --------------------------------------------------------------------------------- - -Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/datainterfaces/ophys/micromanagertiff/micromanagertiffdatainterface.py... - -Function: MicroManagerTiffImagingInterface.get_source_schema -Docstring: -Get the source schema for the Micro-Manager TIFF imaging interface. - -Returns -------- -dict - The schema dictionary containing input parameters and descriptions - for initializing the Micro-Manager TIFF interface. --------------------------------------------------------------------------------- - -Function: MicroManagerTiffImagingInterface.get_metadata -Docstring: -Get metadata for the Micro-Manager TIFF imaging data. - -Returns -------- -dict - Dictionary containing metadata including session start time, imaging plane details, - and two-photon series configuration. --------------------------------------------------------------------------------- - -Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/datainterfaces/ophys/cnmfe/cnmfedatainterface.py... - -Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/datainterfaces/ophys/sbx/sbxdatainterface.py... - -Function: SbxImagingInterface.get_metadata -Docstring: -Get metadata for the Scanbox imaging data. - -Returns -------- -dict - Dictionary containing metadata including device information and imaging details - specific to the Scanbox system. --------------------------------------------------------------------------------- - -Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/datainterfaces/ophys/hdf5/hdf5datainterface.py... - -Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/datainterfaces/ophys/tdt_fp/tdtfiberphotometrydatainterface.py... - -Function: TDTFiberPhotometryInterface.get_metadata -Docstring: -Get metadata for the TDTFiberPhotometryInterface. - -Returns -------- -DeepDict - The metadata dictionary for this interface. --------------------------------------------------------------------------------- - -Function: TDTFiberPhotometryInterface.get_metadata_schema -Docstring: -Get the metadata schema for the TDTFiberPhotometryInterface. - -Returns -------- -dict - The metadata schema for this interface. --------------------------------------------------------------------------------- - -Function: TDTFiberPhotometryInterface.get_original_timestamps -Docstring: -Get the original timestamps for the data. - -Parameters ----------- -t1 : float, optional - Retrieve data starting at t1 (in seconds), default = 0 for start of recording. -t2 : float, optional - Retrieve data ending at t2 (in seconds), default = 0 for end of recording. - -Returns -------- -dict[str, np.ndarray] - Dictionary of stream names to timestamps. --------------------------------------------------------------------------------- - -Function: TDTFiberPhotometryInterface.get_timestamps -Docstring: -Get the timestamps for the data. - -Parameters ----------- -t1 : float, optional - Retrieve data starting at t1 (in seconds), default = 0 for start of recording. -t2 : float, optional - Retrieve data ending at t2 (in seconds), default = 0 for end of recording. - -Returns -------- -dict[str, np.ndarray] - Dictionary of stream names to timestamps. --------------------------------------------------------------------------------- - -Function: TDTFiberPhotometryInterface.get_original_starting_time_and_rate -Docstring: -Get the original starting time and rate for the data. - -Parameters ----------- -t1 : float, optional - Retrieve data starting at t1 (in seconds), default = 0 for start of recording. -t2 : float, optional - Retrieve data ending at t2 (in seconds), default = 0 for end of recording. - -Returns -------- -dict[str, tuple[float, float]] - Dictionary of stream names to starting time and rate. --------------------------------------------------------------------------------- - -Function: TDTFiberPhotometryInterface.get_starting_time_and_rate -Docstring: -Get the starting time and rate for the data. - -Parameters ----------- -t1 : float, optional - Retrieve data starting at t1 (in seconds), default = 0 for start of recording. -t2 : float, optional - Retrieve data ending at t2 (in seconds), default = 0 for end of recording. - -Returns -------- -dict[str, tuple[float, float]] - Dictionary of stream names to starting time and rate. --------------------------------------------------------------------------------- - -Function: TDTFiberPhotometryInterface.get_events -Docstring: -Get a dictionary of events from the TDT files (e.g. camera TTL pulses). - -The events dictionary maps from the names of each epoc in the TDT data to an event dictionary. -Each event dictionary maps from "onset", "offset", and "data" to the corresponding arrays. - -Returns -------- -dict[str, dict[str, np.ndarray]] - Dictionary of events. --------------------------------------------------------------------------------- - -Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/datainterfaces/ophys/scanimage/scanimageimaginginterfaces.py... - -Function: get_scanimage_major_version -Docstring: -Determine the version of ScanImage that produced the TIFF file. - -Parameters ----------- -scanimage_metadata : dict - Dictionary of metadata extracted from a TIFF file produced via ScanImage. - -Returns -------- -str - The version of ScanImage that produced the TIFF file. - -Raises ------- -ValueError - If the ScanImage version could not be determined from metadata. --------------------------------------------------------------------------------- - -Function: ScanImageImagingInterface.get_source_schema -Docstring: -Get the source schema for the ScanImage imaging interface. - -Returns -------- -dict - The schema dictionary containing input parameters and descriptions - for initializing the ScanImage interface. --------------------------------------------------------------------------------- - -Function: ScanImageLegacyImagingInterface.get_source_schema -Docstring: -No docstring --------------------------------------------------------------------------------- - -Function: ScanImageLegacyImagingInterface.get_metadata -Docstring: -Get metadata for the ScanImage imaging data. - -Returns -------- -dict - Dictionary containing metadata including session start time and device information - specific to the ScanImage system. --------------------------------------------------------------------------------- - -Function: ScanImageMultiFileImagingInterface.get_source_schema -Docstring: -Get the source schema for the ScanImage multi-file imaging interface. - -Returns -------- -dict - The schema dictionary containing input parameters and descriptions - for initializing the ScanImage multi-file interface. --------------------------------------------------------------------------------- - -Function: ScanImageMultiPlaneImagingInterface.get_metadata -Docstring: -Get metadata for the ScanImage imaging data. - -Returns -------- -dict - Dictionary containing metadata including session start time and device information - specific to the ScanImage system. --------------------------------------------------------------------------------- - -Function: ScanImageMultiPlaneMultiFileImagingInterface.get_metadata -Docstring: -Get metadata for the ScanImage imaging data. - -Returns -------- -dict - Dictionary containing metadata including session start time, device information, - and imaging plane configuration specific to the ScanImage system. --------------------------------------------------------------------------------- - -Function: ScanImageSinglePlaneImagingInterface.get_metadata -Docstring: -Get metadata for the ScanImage imaging data. - -Returns -------- -dict - Dictionary containing metadata including session start time, device information, - and imaging plane configuration specific to the ScanImage system. --------------------------------------------------------------------------------- - -Function: ScanImageSinglePlaneMultiFileImagingInterface.get_metadata -Docstring: -Get metadata for the ScanImage imaging data. - -Returns -------- -dict - Dictionary containing metadata including session start time, device information, - and imaging plane configuration specific to the ScanImage system. --------------------------------------------------------------------------------- - -Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/datainterfaces/ophys/miniscope/miniscopeconverter.py... - -Function: MiniscopeConverter.get_source_schema -Docstring: -No docstring --------------------------------------------------------------------------------- - -Function: MiniscopeConverter.get_conversion_options_schema -Docstring: -Get the schema for the conversion options. - -Returns -------- -dict - The schema dictionary containing conversion options for the Miniscope interface. --------------------------------------------------------------------------------- - -Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/datainterfaces/ophys/miniscope/miniscopeimagingdatainterface.py... - -Function: MiniscopeImagingInterface.get_source_schema -Docstring: -Get the source schema for the Miniscope imaging interface. - -Returns -------- -dict - The schema dictionary containing input parameters and descriptions - for initializing the Miniscope imaging interface. --------------------------------------------------------------------------------- - -Function: MiniscopeImagingInterface.get_metadata -Docstring: -Get metadata for the Miniscope imaging data. - -Returns -------- -DeepDict - Dictionary containing metadata including device information, imaging plane details, - and one-photon series configuration. --------------------------------------------------------------------------------- - -Function: MiniscopeImagingInterface.get_metadata_schema -Docstring: -Get the metadata schema for the Miniscope imaging data. - -Returns -------- -dict - The schema dictionary containing metadata definitions and requirements - for the Miniscope imaging interface. --------------------------------------------------------------------------------- - -Function: MiniscopeImagingInterface.get_original_timestamps -Docstring: -No docstring --------------------------------------------------------------------------------- - -Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/datainterfaces/ophys/extract/extractdatainterface.py... - -Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/datainterfaces/ophys/suite2p/suite2pdatainterface.py... - -Function: Suite2pSegmentationInterface.get_source_schema -Docstring: -Get the source schema for the Suite2p segmentation interface. - -Returns -------- -dict - The schema dictionary containing input parameters and descriptions - for initializing the Suite2p segmentation interface. --------------------------------------------------------------------------------- - -Function: Suite2pSegmentationInterface.get_available_planes -Docstring: -Get the available planes in the Suite2p segmentation folder. - -Parameters ----------- -folder_path : DirectoryPath - Path to the folder containing Suite2p segmentation data. - -Returns -------- -dict - Dictionary containing information about available planes in the dataset. --------------------------------------------------------------------------------- - -Function: Suite2pSegmentationInterface.get_available_channels -Docstring: -Get the available channels in the Suite2p segmentation folder. - -Parameters ----------- -folder_path : DirectoryPath - Path to the folder containing Suite2p segmentation data. - -Returns -------- -dict - Dictionary containing information about available channels in the dataset. --------------------------------------------------------------------------------- - -Function: Suite2pSegmentationInterface.get_metadata -Docstring: -Get metadata for the Suite2p segmentation data. - -Returns -------- -DeepDict - Dictionary containing metadata including plane segmentation details, - fluorescence data, and segmentation images. --------------------------------------------------------------------------------- - -Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/datainterfaces/ophys/tiff/tiffdatainterface.py... - -Function: TiffImagingInterface.get_source_schema -Docstring: -Get the source schema for the TIFF imaging interface. - -Returns -------- -dict - The JSON schema for the TIFF imaging interface source data, - containing file path and other configuration parameters. --------------------------------------------------------------------------------- - -Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/datainterfaces/ophys/brukertiff/brukertiffconverter.py... - -Function: BrukerTiffMultiPlaneConverter.get_source_schema -Docstring: -No docstring --------------------------------------------------------------------------------- - -Function: BrukerTiffMultiPlaneConverter.get_conversion_options_schema -Docstring: -Get the schema for the conversion options. - -Returns -------- -dict - The schema dictionary containing conversion options for the Bruker TIFF interface. --------------------------------------------------------------------------------- - -Function: BrukerTiffSinglePlaneConverter.get_source_schema -Docstring: -No docstring --------------------------------------------------------------------------------- - -Function: BrukerTiffSinglePlaneConverter.get_conversion_options_schema -Docstring: -Get the schema for the conversion options. - -Returns -------- -dict - The schema dictionary containing conversion options for the Bruker TIFF interface. --------------------------------------------------------------------------------- - -Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/datainterfaces/ophys/brukertiff/brukertiffdatainterface.py... - -Function: BrukerTiffMultiPlaneImagingInterface.get_source_schema -Docstring: -Get the source schema for the Bruker TIFF imaging data. - -Returns -------- -dict - The JSON schema for the Bruker TIFF imaging data source. --------------------------------------------------------------------------------- - -Function: BrukerTiffMultiPlaneImagingInterface.get_streams -Docstring: -Get streams for the Bruker TIFF imaging data. - -Parameters ----------- -folder_path : DirectoryPath - Path to the folder containing the Bruker TIFF files. -plane_separation_type : Literal["contiguous", "disjoint"], optional - Type of plane separation to apply. If "contiguous", only the first plane stream for each channel is retained. - -Returns -------- -dict - A dictionary containing the streams for the Bruker TIFF imaging data. The dictionary has the following keys: - - "channel_streams": List of channel stream names. - - "plane_streams": Dictionary where keys are channel stream names and values are lists of plane streams. --------------------------------------------------------------------------------- - -Function: BrukerTiffMultiPlaneImagingInterface.get_metadata -Docstring: -Get metadata for the Bruker TIFF imaging data. - -Returns -------- -DeepDict - The metadata dictionary containing imaging metadata from the Bruker TIFF files. --------------------------------------------------------------------------------- - -Function: BrukerTiffSinglePlaneImagingInterface.get_source_schema -Docstring: -Get the source schema for the Bruker TIFF imaging data. - -Returns -------- -dict - The JSON schema for the Bruker TIFF imaging data source. --------------------------------------------------------------------------------- - -Function: BrukerTiffSinglePlaneImagingInterface.get_streams -Docstring: -Get streams for the Bruker TIFF imaging data. - -Parameters ----------- -folder_path : DirectoryPath - Path to the folder containing the Bruker TIFF files. - -Returns -------- -dict - A dictionary containing the streams extracted from the Bruker TIFF files. --------------------------------------------------------------------------------- - -Function: BrukerTiffSinglePlaneImagingInterface.get_metadata -Docstring: -Get metadata for the Bruker TIFF imaging data. - -Returns -------- -DeepDict - The metadata dictionary containing imaging metadata from the Bruker TIFF files. --------------------------------------------------------------------------------- - -Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/datainterfaces/ophys/sima/simadatainterface.py... - -Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/datainterfaces/ecephys/spikeglx/spikeglx_utils.py... - -Function: get_session_start_time -Docstring: -Fetches the session start time from the recording_metadata dictionary. - -Parameters ----------- -recording_metadata : dict - The metadata dictionary as obtained from the Spikelgx recording. - -Returns -------- -datetime or None - the session start time in datetime format. --------------------------------------------------------------------------------- - -Function: get_device_metadata -Docstring: -Returns a device with description including the metadata as described here -# https://billkarsh.github.io/SpikeGLX/Sgl_help/Metadata_30.html - -Parameters ----------- -meta : dict - The metadata dictionary containing SpikeGLX probe information. - -Returns -------- -dict - a dict containing the metadata necessary for creating the device --------------------------------------------------------------------------------- - -Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/datainterfaces/ecephys/spikeglx/spikeglxconverter.py... - -Function: SpikeGLXConverterPipe.get_source_schema -Docstring: -Get the schema for the source arguments. - -Returns -------- -dict - The schema dictionary containing input parameters and descriptions - for initializing the SpikeGLX converter. --------------------------------------------------------------------------------- - -Function: SpikeGLXConverterPipe.get_streams -Docstring: -Get the stream IDs available in the folder. - -Parameters ----------- -folder_path : DirectoryPath - Path to the folder containing SpikeGLX streams. - -Returns -------- -list of str - The IDs of all available streams in the folder. --------------------------------------------------------------------------------- - -Function: SpikeGLXConverterPipe.get_conversion_options_schema -Docstring: -Get the schema for the conversion options. - -Returns -------- -dict - The schema dictionary containing conversion options for each data interface - in this converter. --------------------------------------------------------------------------------- - -Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/datainterfaces/ecephys/spikeglx/spikeglxdatainterface.py... - -Function: SpikeGLXRecordingInterface.get_source_schema -Docstring: -Get the source schema for the SpikeGLX recording interface. - -Returns -------- -dict - The JSON schema for the SpikeGLX recording data source. --------------------------------------------------------------------------------- - -Function: SpikeGLXRecordingInterface.get_metadata -Docstring: -Get metadata for the SpikeGLX recording. - -Returns -------- -dict - The metadata dictionary containing recording metadata from the SpikeGLX files. --------------------------------------------------------------------------------- - -Function: SpikeGLXRecordingInterface.get_original_timestamps -Docstring: -Get the original timestamps for the SpikeGLX recording. - -Returns -------- -numpy.ndarray or list of numpy.ndarray - The timestamps for each sample in the recording. If there are multiple segments, - returns a list of timestamps arrays, one for each segment. --------------------------------------------------------------------------------- - -Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/datainterfaces/ecephys/spikeglx/spikeglxnidqinterface.py... - -Function: SpikeGLXNIDQInterface.get_source_schema -Docstring: -No docstring --------------------------------------------------------------------------------- - -Function: SpikeGLXNIDQInterface.get_metadata -Docstring: -No docstring --------------------------------------------------------------------------------- - -Function: SpikeGLXNIDQInterface.get_channel_names -Docstring: -Get a list of channel names from the recording extractor. - -Returns -------- -list of str - The names of all channels in the NIDQ recording. --------------------------------------------------------------------------------- - -Function: SpikeGLXNIDQInterface.get_event_times_from_ttl -Docstring: -Return the start of event times from the rising part of TTL pulses on one of the NIDQ channels. - -Parameters ----------- -channel_name : str - Name of the channel in the .nidq.bin file. - -Returns -------- -rising_times : numpy.ndarray - The times of the rising TTL pulses. --------------------------------------------------------------------------------- - -Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/datainterfaces/ecephys/openephys/openephysdatainterface.py... - -Function: OpenEphysRecordingInterface.get_source_schema -Docstring: -No docstring --------------------------------------------------------------------------------- - -Function: OpenEphysRecordingInterface.get_stream_names -Docstring: -Get the names of available recording streams in the OpenEphys folder. - -Parameters ----------- -folder_path : DirectoryPath - Path to OpenEphys directory (.continuous or .dat files). - -Returns -------- -list of str - The names of the available recording streams. - -Raises ------- -AssertionError - If the data is neither in 'legacy' (.continuous) nor 'binary' (.dat) format. --------------------------------------------------------------------------------- - -Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/datainterfaces/ecephys/openephys/openephyssortingdatainterface.py... - -Function: OpenEphysSortingInterface.get_source_schema -Docstring: -Compile input schema for the SortingExtractor. - -Returns -------- -dict - The schema dictionary containing input parameters and descriptions - for initializing the SortingExtractor. --------------------------------------------------------------------------------- - -Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/datainterfaces/ecephys/openephys/openephysbinarydatainterface.py... - -Function: OpenEphysBinaryRecordingInterface.get_stream_names -Docstring: -Get the names of available recording streams in the OpenEphys binary folder. - -Parameters ----------- -folder_path : DirectoryPath - Path to directory containing OpenEphys binary files. - -Returns -------- -list of str - The names of the available recording streams. --------------------------------------------------------------------------------- - -Function: OpenEphysBinaryRecordingInterface.get_source_schema -Docstring: -Compile input schema for the RecordingExtractor. - -Returns -------- -dict - The JSON schema for the OpenEphys binary recording interface source data, - containing folder path and other configuration parameters. The schema - excludes recording_id, experiment_id, and stub_test parameters. --------------------------------------------------------------------------------- - -Function: OpenEphysBinaryRecordingInterface.get_metadata -Docstring: -No docstring --------------------------------------------------------------------------------- - -Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/datainterfaces/ecephys/openephys/openephyslegacydatainterface.py... - -Function: OpenEphysLegacyRecordingInterface.get_stream_names -Docstring: -Get the names of available recording streams in the OpenEphys legacy folder. - -Parameters ----------- -folder_path : DirectoryPath - Path to directory containing OpenEphys legacy files. - -Returns -------- -list of str - The names of the available recording streams. --------------------------------------------------------------------------------- - -Function: OpenEphysLegacyRecordingInterface.get_source_schema -Docstring: -Compile input schema for the RecordingExtractor. - -Returns -------- -dict - The JSON schema for the OpenEphys legacy recording interface source data, - containing folder path and other configuration parameters. The schema - inherits from the base recording extractor interface schema. --------------------------------------------------------------------------------- - -Function: OpenEphysLegacyRecordingInterface.get_metadata -Docstring: -No docstring --------------------------------------------------------------------------------- - -Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/datainterfaces/ecephys/edf/edfdatainterface.py... - -Function: EDFRecordingInterface.get_source_schema -Docstring: -No docstring --------------------------------------------------------------------------------- - -Function: EDFRecordingInterface.get_metadata -Docstring: -No docstring --------------------------------------------------------------------------------- - -Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/datainterfaces/ecephys/plexon/plexondatainterface.py... - -Function: PlexonRecordingInterface.get_source_schema -Docstring: -No docstring --------------------------------------------------------------------------------- - -Function: PlexonRecordingInterface.get_metadata -Docstring: -No docstring --------------------------------------------------------------------------------- - -Function: Plexon2RecordingInterface.get_source_schema -Docstring: -No docstring --------------------------------------------------------------------------------- - -Function: Plexon2RecordingInterface.get_metadata -Docstring: -No docstring --------------------------------------------------------------------------------- - -Function: PlexonSortingInterface.get_source_schema -Docstring: -No docstring --------------------------------------------------------------------------------- - -Function: PlexonSortingInterface.get_metadata -Docstring: -No docstring --------------------------------------------------------------------------------- - -Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/datainterfaces/ecephys/spikegadgets/spikegadgetsdatainterface.py... - -Function: SpikeGadgetsRecordingInterface.get_source_schema -Docstring: -No docstring --------------------------------------------------------------------------------- - -Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/datainterfaces/ecephys/kilosort/kilosortdatainterface.py... - -Function: KiloSortSortingInterface.get_source_schema -Docstring: -No docstring --------------------------------------------------------------------------------- - -Function: KiloSortSortingInterface.get_metadata -Docstring: -No docstring --------------------------------------------------------------------------------- - -Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/datainterfaces/ecephys/tdt/tdtdatainterface.py... - -Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/datainterfaces/ecephys/phy/phydatainterface.py... - -Function: PhySortingInterface.get_source_schema -Docstring: -No docstring --------------------------------------------------------------------------------- - -Function: PhySortingInterface.get_metadata -Docstring: -No docstring --------------------------------------------------------------------------------- - -Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/datainterfaces/ecephys/axona/axona_utils.py... - -Function: get_eeg_sampling_frequency -Docstring: -Read sampling frequency from .eegX or .egfX file header. - -Parameters ----------- -file_path : Path or str - Full file_path of Axona `.eegX` or `.egfX` file. - -Returns -------- -float - The sampling frequency in Hz extracted from the file header's sample_rate field. --------------------------------------------------------------------------------- - -Function: get_all_file_paths -Docstring: -Read LFP file_paths of `.eeg` or `.egf` files in file_path's directory. -E.g. if file_path='/my/directory/my_file.eeg', all .eeg channels will be -appended to the output. - -Parameters ----------- -file_path : FilePathType - Full file_path of either .egg or .egf file - -Returns -------- -list - List of file paths for all .eeg or .egf files found in the same directory - as the input file path. --------------------------------------------------------------------------------- - -Function: get_header_bstring -Docstring: -Scan file for the occurrence of 'data_start' and return the header -as byte string - -Parameters ----------- -file (str or path) : file to be loaded - -Returns -------- -bytes - The header content as bytes, including everything from the start of the file - up to and including the 'data_start' marker. --------------------------------------------------------------------------------- - -Function: get_position_object -Docstring: -Read position data from .bin or .pos file and convert to -pynwb.behavior.SpatialSeries objects. If possible it should always -be preferred to read position data from the `.bin` file to ensure -samples are locked to ecephys time courses. - -Parameters ----------- -file_path : Path or str - Full file_path of Axona file with any extension. - -Returns -------- -pynwb.behavior.Position - Position object containing multiple SpatialSeries, one for each position - channel (time, X, Y, x, y, PX, px, px_total, unused). Each series contains - timestamps and corresponding position data. The timestamps are in milliseconds - and are aligned to the start of raw acquisition if reading from a .bin file. --------------------------------------------------------------------------------- - -Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/datainterfaces/ecephys/axona/axonadatainterface.py... - -Function: AxonaRecordingInterface.get_source_schema -Docstring: -No docstring --------------------------------------------------------------------------------- - -Function: AxonaRecordingInterface.get_metadata -Docstring: -No docstring --------------------------------------------------------------------------------- - -Function: AxonaUnitRecordingInterface.get_source_schema -Docstring: -No docstring --------------------------------------------------------------------------------- - -Function: AxonaLFPDataInterface.get_source_schema -Docstring: -No docstring --------------------------------------------------------------------------------- - -Function: AxonaPositionDataInterface.get_source_schema -Docstring: -No docstring --------------------------------------------------------------------------------- - -Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/datainterfaces/ecephys/neuroscope/neuroscopedatainterface.py... - -Function: NeuroScopeRecordingInterface.get_source_schema -Docstring: -No docstring --------------------------------------------------------------------------------- - -Function: NeuroScopeRecordingInterface.get_ecephys_metadata -Docstring: -Auto-populates ecephys metadata from the xml_file_path. - -Parameters ----------- -xml_file_path : str - Path to the XML file containing device and electrode configuration. - -Returns -------- -dict - Dictionary containing metadata for ElectrodeGroup and Electrodes. - Includes group names, descriptions, and electrode properties. --------------------------------------------------------------------------------- - -Function: NeuroScopeRecordingInterface.get_metadata -Docstring: -Get metadata for the NeuroScope recording. - -Returns -------- -dict - Dictionary containing metadata including Ecephys information and session start time. --------------------------------------------------------------------------------- - -Function: NeuroScopeRecordingInterface.get_original_timestamps -Docstring: -Get the original timestamps for the recording. - -Returns -------- -numpy.ndarray or list of numpy.ndarray - The timestamps for each sample in the recording. If there are multiple segments, - returns a list of timestamp arrays, one for each segment. --------------------------------------------------------------------------------- - -Function: NeuroScopeLFPInterface.get_source_schema -Docstring: -No docstring --------------------------------------------------------------------------------- - -Function: NeuroScopeLFPInterface.get_metadata -Docstring: -No docstring --------------------------------------------------------------------------------- - -Function: NeuroScopeSortingInterface.get_source_schema -Docstring: -No docstring --------------------------------------------------------------------------------- - -Function: NeuroScopeSortingInterface.get_metadata -Docstring: -No docstring --------------------------------------------------------------------------------- - -Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/datainterfaces/ecephys/neuroscope/neuroscope_utils.py... - -Function: get_xml_file_path -Docstring: -Infer the xml_file_path from the data_file_path (.dat or .eeg). - -Assumes the two are in the same folder and follow the session_id naming convention. - -Parameters ----------- -data_file_path : str - Path to the data file (.dat or .eeg) - -Returns -------- -str - The path to the corresponding XML file. --------------------------------------------------------------------------------- - -Function: get_xml -Docstring: -Auxiliary function for retrieving root of xml. - -Parameters ----------- -xml_file_path : str - Path to the XML file. - -Returns -------- -lxml.etree._Element - The root element of the XML tree. --------------------------------------------------------------------------------- - -Function: get_neural_channels -Docstring: -Extracts the channels corresponding to neural data from an XML file. - -Parameters ----------- -xml_file_path : str - Path to the XML file containing the necessary data. - -Returns -------- -list - List reflecting the group structure of the channels. - -Notes ------ -This function attempts to extract the channels that correspond to neural data, -specifically those that come from the probe. It uses the `spikeDetection` structure -in the XML file to identify the channels involved in spike detection. Channels that are -not involved in spike detection, such as auxiliary channels from the intan system, are excluded. - -The function returns a list representing the group structure of the channels. - -Example: -[[1, 2, 3], [4, 5, 6], [7, 8, 9] - -Where [1, 2, 3] are the channels in the first group, [4, 5, 6] are the channels in the second group, etc. - -Warning: -This function assumes that all the channels that correspond to neural data are involved in spike detection. -More concretely, it assumes that the channels appear on the `spikeDetection` field of the XML file. -If this is not the case, the function will return an incorrect list of neural channels. -Please report this as an issue if this is the case. --------------------------------------------------------------------------------- - -Function: get_channel_groups -Docstring: -Auxiliary function for retrieving a list of groups, each containing a list of channels. - -These are all the channels that are connected to the probe. - -Parameters ----------- -xml_file_path : str - Path to the XML file. - -Returns -------- -list - List of lists, where each inner list contains the channel numbers for that group. - For example: [[1, 2, 3], [4, 5, 6]] represents two groups with three channels each. --------------------------------------------------------------------------------- - -Function: get_session_start_time -Docstring: -Auxiliary function for retrieving the session start time from the xml file. - -Parameters ----------- -xml_file_path : str - Path to the XML file. - -Returns -------- -datetime - The session start time as a datetime object. Returns None if no date is found. --------------------------------------------------------------------------------- - -Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/datainterfaces/ecephys/alphaomega/alphaomegadatainterface.py... - -Function: AlphaOmegaRecordingInterface.get_source_schema -Docstring: -No docstring --------------------------------------------------------------------------------- - -Function: AlphaOmegaRecordingInterface.get_metadata -Docstring: -No docstring --------------------------------------------------------------------------------- - -Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/datainterfaces/ecephys/blackrock/header_tools.py... - -Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/datainterfaces/ecephys/blackrock/blackrockdatainterface.py... - -Function: BlackrockRecordingInterface.get_source_schema -Docstring: -No docstring --------------------------------------------------------------------------------- - -Function: BlackrockRecordingInterface.get_metadata -Docstring: -No docstring --------------------------------------------------------------------------------- - -Function: BlackrockSortingInterface.get_source_schema -Docstring: -No docstring --------------------------------------------------------------------------------- - -Function: BlackrockSortingInterface.get_metadata -Docstring: -No docstring --------------------------------------------------------------------------------- - -Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/datainterfaces/ecephys/biocam/biocamdatainterface.py... - -Function: BiocamRecordingInterface.get_source_schema -Docstring: -No docstring --------------------------------------------------------------------------------- - -Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/datainterfaces/ecephys/cellexplorer/cellexplorerdatainterface.py... - -Function: CellExplorerRecordingInterface.get_source_schema -Docstring: -No docstring --------------------------------------------------------------------------------- - -Function: CellExplorerRecordingInterface.get_original_timestamps -Docstring: -No docstring --------------------------------------------------------------------------------- - -Function: CellExplorerSortingInterface.get_metadata -Docstring: -No docstring --------------------------------------------------------------------------------- - -Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/datainterfaces/ecephys/maxwell/maxonedatainterface.py... - -Function: MaxOneRecordingInterface.get_metadata -Docstring: -No docstring --------------------------------------------------------------------------------- - -Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/datainterfaces/ecephys/intan/intandatainterface.py... - -Function: IntanRecordingInterface.get_source_schema -Docstring: -No docstring --------------------------------------------------------------------------------- - -Function: IntanRecordingInterface.get_metadata_schema -Docstring: -No docstring --------------------------------------------------------------------------------- - -Function: IntanRecordingInterface.get_metadata -Docstring: -No docstring --------------------------------------------------------------------------------- - -Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/datainterfaces/ecephys/spike2/spike2datainterface.py... - -Function: Spike2RecordingInterface.get_source_schema -Docstring: -Get the schema for the source arguments. - -Returns -------- -dict - The schema dictionary containing input parameters and descriptions - for initializing the Spike2 recording interface. --------------------------------------------------------------------------------- - -Function: Spike2RecordingInterface.get_all_channels_info -Docstring: -Retrieve and inspect necessary channel information prior to initialization. - -Parameters ----------- -file_path : FilePath - Path to .smr or .smrx file. - -Returns -------- -dict - Dictionary containing information about all channels in the Spike2 file. --------------------------------------------------------------------------------- - -Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/datainterfaces/ecephys/neuralynx/neuralynxdatainterface.py... - -Function: NeuralynxRecordingInterface.get_stream_names -Docstring: -No docstring --------------------------------------------------------------------------------- - -Function: NeuralynxRecordingInterface.get_source_schema -Docstring: -No docstring --------------------------------------------------------------------------------- - -Function: NeuralynxRecordingInterface.get_metadata -Docstring: -No docstring --------------------------------------------------------------------------------- - -Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/datainterfaces/ecephys/mcsraw/mcsrawdatainterface.py... - -Function: MCSRawRecordingInterface.get_source_schema -Docstring: -No docstring --------------------------------------------------------------------------------- - -Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/datainterfaces/ecephys/mearec/mearecdatainterface.py... - -Function: MEArecRecordingInterface.get_source_schema -Docstring: -No docstring --------------------------------------------------------------------------------- - -Function: MEArecRecordingInterface.get_metadata -Docstring: -No docstring --------------------------------------------------------------------------------- - -Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/datainterfaces/icephys/abf/abfdatainterface.py... - -Function: get_start_datetime -Docstring: -Get start datetime for Abf file. - -Parameters ----------- -neo_reader : neo.io.AxonIO - The Neo reader object for the ABF file. - -Returns -------- -datetime - The start date and time of the recording. --------------------------------------------------------------------------------- - -Function: AbfInterface.get_source_schema -Docstring: -No docstring --------------------------------------------------------------------------------- - -Function: AbfInterface.get_metadata -Docstring: -No docstring --------------------------------------------------------------------------------- - -Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/datainterfaces/text/excel/exceltimeintervalsinterface.py... - -Analyzing /Users/pauladkisson/Documents/CatalystNeuro/Neuroconv/neuroconv/src/neuroconv/datainterfaces/text/csv/csvtimeintervalsinterface.py... From 2081ee30d56651b1cc0c8d54e9db852e3f4acb16 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Fri, 24 Jan 2025 23:13:45 +0000 Subject: [PATCH 11/19] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- src/neuroconv/basedatainterface.py | 6 +++--- src/neuroconv/baseextractorinterface.py | 2 +- .../datainterfaces/behavior/video/video_utils.py | 16 ++++++++-------- .../ecephys/baserecordingextractorinterface.py | 10 +++++----- .../ecephys/basesortingextractorinterface.py | 6 +++--- .../ecephys/neuroscope/neuroscope_utils.py | 10 +++++----- .../neuroscope/neuroscopedatainterface.py | 8 ++++---- .../openephys/openephysbinarydatainterface.py | 4 ++-- .../ecephys/openephys/openephysdatainterface.py | 6 +++--- .../openephys/openephyslegacydatainterface.py | 4 ++-- .../openephys/openephyssortingdatainterface.py | 2 +- .../ecephys/spike2/spike2datainterface.py | 6 +++--- .../ecephys/spikeglx/spikeglxconverter.py | 8 ++++---- .../ecephys/spikeglx/spikeglxdatainterface.py | 6 +++--- .../ecephys/spikeglx/spikeglxnidqinterface.py | 2 +- .../icephys/abf/abfdatainterface.py | 4 ++-- .../ophys/baseimagingextractorinterface.py | 4 ++-- .../ophys/brukertiff/brukertiffconverter.py | 4 ++-- .../ophys/brukertiff/brukertiffdatainterface.py | 8 ++++---- .../ophys/caiman/caimandatainterface.py | 2 +- .../micromanagertiffdatainterface.py | 4 ++-- .../ophys/miniscope/miniscopeconverter.py | 2 +- .../miniscope/miniscopeimagingdatainterface.py | 6 +++--- .../datainterfaces/ophys/sbx/sbxdatainterface.py | 2 +- .../scanimage/scanimageimaginginterfaces.py | 10 +++++----- .../ophys/suite2p/suite2pdatainterface.py | 12 ++++++------ .../text/timeintervalsinterface.py | 2 +- src/neuroconv/nwbconverter.py | 8 ++++---- src/neuroconv/tools/importing.py | 2 +- src/neuroconv/tools/neo/neo.py | 8 ++++---- .../nwb_helpers/_metadata_and_file_helpers.py | 8 ++++---- 31 files changed, 91 insertions(+), 91 deletions(-) diff --git a/src/neuroconv/basedatainterface.py b/src/neuroconv/basedatainterface.py index 6c14c36f3..18241b999 100644 --- a/src/neuroconv/basedatainterface.py +++ b/src/neuroconv/basedatainterface.py @@ -74,7 +74,7 @@ def __init__(self, verbose: bool = False, **source_data): def get_metadata_schema(self) -> dict: """ Retrieve JSON schema for metadata. - + Returns ------- dict @@ -86,7 +86,7 @@ def get_metadata_schema(self) -> dict: def get_metadata(self) -> DeepDict: """ Child DataInterface classes should override this to match their metadata. - + Returns ------- DeepDict @@ -121,7 +121,7 @@ def validate_metadata(self, metadata: dict, append_mode: bool = False) -> None: def get_conversion_options_schema(self) -> dict: """ Infer the JSON schema for the conversion options from the method signature (annotation typing). - + Returns ------- dict diff --git a/src/neuroconv/baseextractorinterface.py b/src/neuroconv/baseextractorinterface.py index 756a1c480..6f20d1815 100644 --- a/src/neuroconv/baseextractorinterface.py +++ b/src/neuroconv/baseextractorinterface.py @@ -22,7 +22,7 @@ class BaseExtractorInterface(BaseTemporalAlignmentInterface, ABC): def get_extractor(cls): """ Get the extractor class for this interface. - + Returns ------- type diff --git a/src/neuroconv/datainterfaces/behavior/video/video_utils.py b/src/neuroconv/datainterfaces/behavior/video/video_utils.py index 554ecf578..b90302b46 100644 --- a/src/neuroconv/datainterfaces/behavior/video/video_utils.py +++ b/src/neuroconv/datainterfaces/behavior/video/video_utils.py @@ -86,7 +86,7 @@ def get_video_timestamps(self, max_frames: Optional[int] = None, display_progres def get_video_fps(self): """ Return the internal frames per second (fps) for a video file. - + Returns ------- float @@ -99,7 +99,7 @@ def get_video_fps(self): def get_frame_shape(self) -> Tuple: """ Return the shape of frames from a video file. - + Returns ------- Tuple @@ -126,7 +126,7 @@ def frame_count(self, val: int): def get_video_frame_count(self): """ Get the total number of frames in the video. - + Returns ------- int @@ -144,12 +144,12 @@ def _video_frame_count(self): def get_cv_attribute(attribute_name: str): """ Get an OpenCV attribute by name. - + Parameters ---------- attribute_name : str The name of the OpenCV attribute to get. - + Returns ------- Any @@ -178,12 +178,12 @@ def current_frame(self, frame_number: int): def get_video_frame(self, frame_number: int): """ Return the specific frame from a video as an RGB colorspace. - + Parameters ---------- frame_number : int The index of the frame to retrieve. - + Returns ------- numpy.ndarray @@ -200,7 +200,7 @@ def get_video_frame(self, frame_number: int): def get_video_frame_dtype(self): """ Return the dtype for frame in a video file. - + Returns ------- numpy.dtype diff --git a/src/neuroconv/datainterfaces/ecephys/baserecordingextractorinterface.py b/src/neuroconv/datainterfaces/ecephys/baserecordingextractorinterface.py index 7d76586a9..ab59a33ac 100644 --- a/src/neuroconv/datainterfaces/ecephys/baserecordingextractorinterface.py +++ b/src/neuroconv/datainterfaces/ecephys/baserecordingextractorinterface.py @@ -50,7 +50,7 @@ def __init__(self, verbose: bool = False, es_key: str = "ElectricalSeries", **so def get_metadata_schema(self) -> dict: """ Compile metadata schema for the RecordingExtractor. - + Returns ------- dict @@ -96,7 +96,7 @@ def get_metadata_schema(self) -> dict: def get_metadata(self) -> DeepDict: """ Get metadata for the recording extractor. - + Returns ------- DeepDict @@ -264,7 +264,7 @@ def set_probe(self, probe, group_mode: Literal["by_shank", "by_probe"]): def has_probe(self) -> bool: """ Check if the recording extractor has probe information. - + Returns ------- bool @@ -287,12 +287,12 @@ def align_by_interpolation( def subset_recording(self, stub_test: bool = False): """ Subset a recording extractor according to stub and channel subset options. - + Parameters ---------- stub_test : bool, default: False If True, only a subset of frames will be included. - + Returns ------- spikeinterface.core.BaseRecording diff --git a/src/neuroconv/datainterfaces/ecephys/basesortingextractorinterface.py b/src/neuroconv/datainterfaces/ecephys/basesortingextractorinterface.py index e590137ec..1ebb8a9f5 100644 --- a/src/neuroconv/datainterfaces/ecephys/basesortingextractorinterface.py +++ b/src/neuroconv/datainterfaces/ecephys/basesortingextractorinterface.py @@ -28,7 +28,7 @@ def __init__(self, verbose: bool = False, **source_data): def get_metadata_schema(self) -> dict: """ Compile metadata schema for the RecordingExtractor. - + Returns ------- dict @@ -95,13 +95,13 @@ def get_original_timestamps(self) -> np.ndarray: def get_timestamps(self) -> Union[np.ndarray, list[np.ndarray]]: """ Get the timestamps for the sorting data. - + Returns ------- numpy.ndarray or list of numpy.ndarray The timestamps for each spike in the sorting data. If there are multiple segments, returns a list of timestamp arrays. - + Raises ------ NotImplementedError diff --git a/src/neuroconv/datainterfaces/ecephys/neuroscope/neuroscope_utils.py b/src/neuroconv/datainterfaces/ecephys/neuroscope/neuroscope_utils.py index c88f7339f..92d36f2e5 100644 --- a/src/neuroconv/datainterfaces/ecephys/neuroscope/neuroscope_utils.py +++ b/src/neuroconv/datainterfaces/ecephys/neuroscope/neuroscope_utils.py @@ -11,12 +11,12 @@ def get_xml_file_path(data_file_path: str) -> str: Infer the xml_file_path from the data_file_path (.dat or .eeg). Assumes the two are in the same folder and follow the session_id naming convention. - + Parameters ---------- data_file_path : str Path to the data file (.dat or .eeg) - + Returns ------- str @@ -29,12 +29,12 @@ def get_xml_file_path(data_file_path: str) -> str: def get_xml(xml_file_path: str): """ Auxiliary function for retrieving root of xml. - + Parameters ---------- xml_file_path : str Path to the XML file. - + Returns ------- lxml.etree._Element @@ -131,7 +131,7 @@ def get_channel_groups(xml_file_path: str) -> list: def get_session_start_time(xml_file_path: str) -> datetime: """ Auxiliary function for retrieving the session start time from the xml file. - + Parameters ---------- xml_file_path : str diff --git a/src/neuroconv/datainterfaces/ecephys/neuroscope/neuroscopedatainterface.py b/src/neuroconv/datainterfaces/ecephys/neuroscope/neuroscopedatainterface.py index d3396d8f6..f57edd87b 100644 --- a/src/neuroconv/datainterfaces/ecephys/neuroscope/neuroscopedatainterface.py +++ b/src/neuroconv/datainterfaces/ecephys/neuroscope/neuroscopedatainterface.py @@ -111,12 +111,12 @@ def get_source_schema(self) -> dict: def get_ecephys_metadata(xml_file_path: str) -> dict: """ Auto-populates ecephys metadata from the xml_file_path. - + Parameters ---------- xml_file_path : str Path to the XML file containing device and electrode configuration. - + Returns ------- dict @@ -178,7 +178,7 @@ def __init__( def get_metadata(self) -> dict: """ Get metadata for the NeuroScope recording. - + Returns ------- dict @@ -197,7 +197,7 @@ def get_metadata(self) -> dict: def get_original_timestamps(self) -> np.ndarray: """ Get the original timestamps for the recording. - + Returns ------- numpy.ndarray or list of numpy.ndarray diff --git a/src/neuroconv/datainterfaces/ecephys/openephys/openephysbinarydatainterface.py b/src/neuroconv/datainterfaces/ecephys/openephys/openephysbinarydatainterface.py index 7bc990e0a..cb8cc3342 100644 --- a/src/neuroconv/datainterfaces/ecephys/openephys/openephysbinarydatainterface.py +++ b/src/neuroconv/datainterfaces/ecephys/openephys/openephysbinarydatainterface.py @@ -23,12 +23,12 @@ class OpenEphysBinaryRecordingInterface(BaseRecordingExtractorInterface): def get_stream_names(cls, folder_path: DirectoryPath) -> list[str]: """ Get the names of available recording streams in the OpenEphys binary folder. - + Parameters ---------- folder_path : DirectoryPath Path to directory containing OpenEphys binary files. - + Returns ------- list of str diff --git a/src/neuroconv/datainterfaces/ecephys/openephys/openephysdatainterface.py b/src/neuroconv/datainterfaces/ecephys/openephys/openephysdatainterface.py index 6506d7a49..51e578b22 100644 --- a/src/neuroconv/datainterfaces/ecephys/openephys/openephysdatainterface.py +++ b/src/neuroconv/datainterfaces/ecephys/openephys/openephysdatainterface.py @@ -29,17 +29,17 @@ def get_source_schema(cls) -> dict: def get_stream_names(cls, folder_path: DirectoryPath) -> list[str]: """ Get the names of available recording streams in the OpenEphys folder. - + Parameters ---------- folder_path : DirectoryPath Path to OpenEphys directory (.continuous or .dat files). - + Returns ------- list of str The names of the available recording streams. - + Raises ------ AssertionError diff --git a/src/neuroconv/datainterfaces/ecephys/openephys/openephyslegacydatainterface.py b/src/neuroconv/datainterfaces/ecephys/openephys/openephyslegacydatainterface.py index 14e218dae..f1ff3b301 100644 --- a/src/neuroconv/datainterfaces/ecephys/openephys/openephyslegacydatainterface.py +++ b/src/neuroconv/datainterfaces/ecephys/openephys/openephyslegacydatainterface.py @@ -22,12 +22,12 @@ class OpenEphysLegacyRecordingInterface(BaseRecordingExtractorInterface): def get_stream_names(cls, folder_path: DirectoryPath) -> list[str]: """ Get the names of available recording streams in the OpenEphys legacy folder. - + Parameters ---------- folder_path : DirectoryPath Path to directory containing OpenEphys legacy files. - + Returns ------- list of str diff --git a/src/neuroconv/datainterfaces/ecephys/openephys/openephyssortingdatainterface.py b/src/neuroconv/datainterfaces/ecephys/openephys/openephyssortingdatainterface.py index 1fc260927..ffbd596f1 100644 --- a/src/neuroconv/datainterfaces/ecephys/openephys/openephyssortingdatainterface.py +++ b/src/neuroconv/datainterfaces/ecephys/openephys/openephyssortingdatainterface.py @@ -15,7 +15,7 @@ class OpenEphysSortingInterface(BaseSortingExtractorInterface): def get_source_schema(cls) -> dict: """ Compile input schema for the SortingExtractor. - + Returns ------- dict diff --git a/src/neuroconv/datainterfaces/ecephys/spike2/spike2datainterface.py b/src/neuroconv/datainterfaces/ecephys/spike2/spike2datainterface.py index 0d3fcfcff..c6d40bc08 100644 --- a/src/neuroconv/datainterfaces/ecephys/spike2/spike2datainterface.py +++ b/src/neuroconv/datainterfaces/ecephys/spike2/spike2datainterface.py @@ -31,7 +31,7 @@ class Spike2RecordingInterface(BaseRecordingExtractorInterface): def get_source_schema(cls) -> dict: """ Get the schema for the source arguments. - + Returns ------- dict @@ -47,12 +47,12 @@ def get_source_schema(cls) -> dict: def get_all_channels_info(cls, file_path: FilePath): """ Retrieve and inspect necessary channel information prior to initialization. - + Parameters ---------- file_path : FilePath Path to .smr or .smrx file. - + Returns ------- dict diff --git a/src/neuroconv/datainterfaces/ecephys/spikeglx/spikeglxconverter.py b/src/neuroconv/datainterfaces/ecephys/spikeglx/spikeglxconverter.py index 40f6c59e2..85d12d907 100644 --- a/src/neuroconv/datainterfaces/ecephys/spikeglx/spikeglxconverter.py +++ b/src/neuroconv/datainterfaces/ecephys/spikeglx/spikeglxconverter.py @@ -25,7 +25,7 @@ class SpikeGLXConverterPipe(ConverterPipe): def get_source_schema(cls) -> dict: """ Get the schema for the source arguments. - + Returns ------- dict @@ -40,12 +40,12 @@ def get_source_schema(cls) -> dict: def get_streams(cls, folder_path: DirectoryPath) -> list[str]: """ Get the stream IDs available in the folder. - + Parameters ---------- folder_path : DirectoryPath Path to the folder containing SpikeGLX streams. - + Returns ------- list of str @@ -101,7 +101,7 @@ def __init__( def get_conversion_options_schema(self) -> dict: """ Get the schema for the conversion options. - + Returns ------- dict diff --git a/src/neuroconv/datainterfaces/ecephys/spikeglx/spikeglxdatainterface.py b/src/neuroconv/datainterfaces/ecephys/spikeglx/spikeglxdatainterface.py index 58f9c7e25..b191c3518 100644 --- a/src/neuroconv/datainterfaces/ecephys/spikeglx/spikeglxdatainterface.py +++ b/src/neuroconv/datainterfaces/ecephys/spikeglx/spikeglxdatainterface.py @@ -33,7 +33,7 @@ class SpikeGLXRecordingInterface(BaseRecordingExtractorInterface): def get_source_schema(cls) -> dict: """ Get the source schema for the SpikeGLX recording interface. - + Returns ------- dict @@ -127,7 +127,7 @@ def __init__( def get_metadata(self) -> dict: """ Get metadata for the SpikeGLX recording. - + Returns ------- dict @@ -182,7 +182,7 @@ def get_metadata(self) -> dict: def get_original_timestamps(self) -> np.ndarray: """ Get the original timestamps for the SpikeGLX recording. - + Returns ------- numpy.ndarray or list of numpy.ndarray diff --git a/src/neuroconv/datainterfaces/ecephys/spikeglx/spikeglxnidqinterface.py b/src/neuroconv/datainterfaces/ecephys/spikeglx/spikeglxnidqinterface.py index efa2a2119..c4c7c161e 100644 --- a/src/neuroconv/datainterfaces/ecephys/spikeglx/spikeglxnidqinterface.py +++ b/src/neuroconv/datainterfaces/ecephys/spikeglx/spikeglxnidqinterface.py @@ -138,7 +138,7 @@ def get_metadata(self) -> dict: def get_channel_names(self) -> list[str]: """ Get a list of channel names from the recording extractor. - + Returns ------- list of str diff --git a/src/neuroconv/datainterfaces/icephys/abf/abfdatainterface.py b/src/neuroconv/datainterfaces/icephys/abf/abfdatainterface.py index fcf415f90..8133b44ed 100644 --- a/src/neuroconv/datainterfaces/icephys/abf/abfdatainterface.py +++ b/src/neuroconv/datainterfaces/icephys/abf/abfdatainterface.py @@ -12,12 +12,12 @@ def get_start_datetime(neo_reader): """ Get start datetime for Abf file. - + Parameters ---------- neo_reader : neo.io.AxonIO The Neo reader object for the ABF file. - + Returns ------- datetime diff --git a/src/neuroconv/datainterfaces/ophys/baseimagingextractorinterface.py b/src/neuroconv/datainterfaces/ophys/baseimagingextractorinterface.py index 8e921eedf..698e5f329 100644 --- a/src/neuroconv/datainterfaces/ophys/baseimagingextractorinterface.py +++ b/src/neuroconv/datainterfaces/ophys/baseimagingextractorinterface.py @@ -49,7 +49,7 @@ def get_metadata_schema( ) -> dict: """ Retrieve the metadata schema for the optical physiology (Ophys) data. - + Returns ------- dict @@ -104,7 +104,7 @@ def get_metadata( ) -> DeepDict: """ Retrieve the metadata for the imaging data. - + Returns ------- DeepDict diff --git a/src/neuroconv/datainterfaces/ophys/brukertiff/brukertiffconverter.py b/src/neuroconv/datainterfaces/ophys/brukertiff/brukertiffconverter.py index 87e116d38..7aeeceef2 100644 --- a/src/neuroconv/datainterfaces/ophys/brukertiff/brukertiffconverter.py +++ b/src/neuroconv/datainterfaces/ophys/brukertiff/brukertiffconverter.py @@ -33,7 +33,7 @@ def get_source_schema(cls): def get_conversion_options_schema(self) -> dict: """ Get the schema for the conversion options. - + Returns ------- dict @@ -183,7 +183,7 @@ def get_source_schema(cls): def get_conversion_options_schema(self) -> dict: """ Get the schema for the conversion options. - + Returns ------- dict diff --git a/src/neuroconv/datainterfaces/ophys/brukertiff/brukertiffdatainterface.py b/src/neuroconv/datainterfaces/ophys/brukertiff/brukertiffdatainterface.py index a0ce9d503..42601858d 100644 --- a/src/neuroconv/datainterfaces/ophys/brukertiff/brukertiffdatainterface.py +++ b/src/neuroconv/datainterfaces/ophys/brukertiff/brukertiffdatainterface.py @@ -18,7 +18,7 @@ class BrukerTiffMultiPlaneImagingInterface(BaseImagingExtractorInterface): def get_source_schema(cls) -> dict: """ Get the source schema for the Bruker TIFF imaging data. - + Returns ------- dict @@ -144,7 +144,7 @@ def _determine_position_current(self) -> list[float]: def get_metadata(self) -> DeepDict: """ Get metadata for the Bruker TIFF imaging data. - + Returns ------- DeepDict @@ -218,7 +218,7 @@ class BrukerTiffSinglePlaneImagingInterface(BaseImagingExtractorInterface): def get_source_schema(cls) -> dict: """ Get the source schema for the Bruker TIFF imaging data. - + Returns ------- dict @@ -319,7 +319,7 @@ def _determine_position_current(self) -> list[float]: def get_metadata(self) -> DeepDict: """ Get metadata for the Bruker TIFF imaging data. - + Returns ------- DeepDict diff --git a/src/neuroconv/datainterfaces/ophys/caiman/caimandatainterface.py b/src/neuroconv/datainterfaces/ophys/caiman/caimandatainterface.py index 8c668f89f..09e6b0551 100644 --- a/src/neuroconv/datainterfaces/ophys/caiman/caimandatainterface.py +++ b/src/neuroconv/datainterfaces/ophys/caiman/caimandatainterface.py @@ -14,7 +14,7 @@ class CaimanSegmentationInterface(BaseSegmentationExtractorInterface): def get_source_schema(cls) -> dict: """ Get the source schema for the Caiman segmentation interface. - + Returns ------- dict diff --git a/src/neuroconv/datainterfaces/ophys/micromanagertiff/micromanagertiffdatainterface.py b/src/neuroconv/datainterfaces/ophys/micromanagertiff/micromanagertiffdatainterface.py index 97dd10742..3b1ea9513 100644 --- a/src/neuroconv/datainterfaces/ophys/micromanagertiff/micromanagertiffdatainterface.py +++ b/src/neuroconv/datainterfaces/ophys/micromanagertiff/micromanagertiffdatainterface.py @@ -15,7 +15,7 @@ class MicroManagerTiffImagingInterface(BaseImagingExtractorInterface): def get_source_schema(cls) -> dict: """ Get the source schema for the Micro-Manager TIFF imaging interface. - + Returns ------- dict @@ -48,7 +48,7 @@ def __init__(self, folder_path: DirectoryPath, verbose: bool = False): def get_metadata(self) -> dict: """ Get metadata for the Micro-Manager TIFF imaging data. - + Returns ------- dict diff --git a/src/neuroconv/datainterfaces/ophys/miniscope/miniscopeconverter.py b/src/neuroconv/datainterfaces/ophys/miniscope/miniscopeconverter.py index a5e1470e4..d5b25b445 100644 --- a/src/neuroconv/datainterfaces/ophys/miniscope/miniscopeconverter.py +++ b/src/neuroconv/datainterfaces/ophys/miniscope/miniscopeconverter.py @@ -63,7 +63,7 @@ def __init__(self, folder_path: DirectoryPath, verbose: bool = False): def get_conversion_options_schema(self) -> dict: """ Get the schema for the conversion options. - + Returns ------- dict diff --git a/src/neuroconv/datainterfaces/ophys/miniscope/miniscopeimagingdatainterface.py b/src/neuroconv/datainterfaces/ophys/miniscope/miniscopeimagingdatainterface.py index 5a463b5ae..a6c0b7741 100644 --- a/src/neuroconv/datainterfaces/ophys/miniscope/miniscopeimagingdatainterface.py +++ b/src/neuroconv/datainterfaces/ophys/miniscope/miniscopeimagingdatainterface.py @@ -21,7 +21,7 @@ class MiniscopeImagingInterface(BaseImagingExtractorInterface): def get_source_schema(cls) -> dict: """ Get the source schema for the Miniscope imaging interface. - + Returns ------- dict @@ -60,7 +60,7 @@ def __init__(self, folder_path: DirectoryPath): def get_metadata(self) -> DeepDict: """ Get metadata for the Miniscope imaging data. - + Returns ------- DeepDict @@ -94,7 +94,7 @@ def get_metadata(self) -> DeepDict: def get_metadata_schema(self) -> dict: """ Get the metadata schema for the Miniscope imaging data. - + Returns ------- dict diff --git a/src/neuroconv/datainterfaces/ophys/sbx/sbxdatainterface.py b/src/neuroconv/datainterfaces/ophys/sbx/sbxdatainterface.py index c0e85553a..a5fb87017 100644 --- a/src/neuroconv/datainterfaces/ophys/sbx/sbxdatainterface.py +++ b/src/neuroconv/datainterfaces/ophys/sbx/sbxdatainterface.py @@ -39,7 +39,7 @@ def __init__( def get_metadata(self) -> dict: """ Get metadata for the Scanbox imaging data. - + Returns ------- dict diff --git a/src/neuroconv/datainterfaces/ophys/scanimage/scanimageimaginginterfaces.py b/src/neuroconv/datainterfaces/ophys/scanimage/scanimageimaginginterfaces.py index 302266e98..dea5676fa 100644 --- a/src/neuroconv/datainterfaces/ophys/scanimage/scanimageimaginginterfaces.py +++ b/src/neuroconv/datainterfaces/ophys/scanimage/scanimageimaginginterfaces.py @@ -30,7 +30,7 @@ class ScanImageImagingInterface(BaseImagingExtractorInterface): def get_source_schema(cls) -> dict: """ Get the source schema for the ScanImage imaging interface. - + Returns ------- dict @@ -150,7 +150,7 @@ def __init__( def get_metadata(self) -> dict: """ Get metadata for the ScanImage imaging data. - + Returns ------- dict @@ -194,7 +194,7 @@ class ScanImageMultiFileImagingInterface(BaseImagingExtractorInterface): def get_source_schema(cls) -> dict: """ Get the source schema for the ScanImage multi-file imaging interface. - + Returns ------- dict @@ -333,7 +333,7 @@ def __init__( def get_metadata(self) -> dict: """ Get metadata for the ScanImage imaging data. - + Returns ------- dict @@ -788,7 +788,7 @@ def get_scanimage_major_version(scanimage_metadata: dict) -> str: ------- str The version of ScanImage that produced the TIFF file. - + Raises ------ ValueError diff --git a/src/neuroconv/datainterfaces/ophys/suite2p/suite2pdatainterface.py b/src/neuroconv/datainterfaces/ophys/suite2p/suite2pdatainterface.py index 31a260326..b85f8a453 100644 --- a/src/neuroconv/datainterfaces/ophys/suite2p/suite2pdatainterface.py +++ b/src/neuroconv/datainterfaces/ophys/suite2p/suite2pdatainterface.py @@ -52,7 +52,7 @@ class Suite2pSegmentationInterface(BaseSegmentationExtractorInterface): def get_source_schema(cls) -> dict: """ Get the source schema for the Suite2p segmentation interface. - + Returns ------- dict @@ -73,12 +73,12 @@ def get_source_schema(cls) -> dict: def get_available_planes(cls, folder_path: DirectoryPath) -> dict: """ Get the available planes in the Suite2p segmentation folder. - + Parameters ---------- folder_path : DirectoryPath Path to the folder containing Suite2p segmentation data. - + Returns ------- dict @@ -92,12 +92,12 @@ def get_available_planes(cls, folder_path: DirectoryPath) -> dict: def get_available_channels(cls, folder_path: DirectoryPath) -> dict: """ Get the available channels in the Suite2p segmentation folder. - + Parameters ---------- folder_path : DirectoryPath Path to the folder containing Suite2p segmentation data. - + Returns ------- dict @@ -150,7 +150,7 @@ def __init__( def get_metadata(self) -> DeepDict: """ Get metadata for the Suite2p segmentation data. - + Returns ------- DeepDict diff --git a/src/neuroconv/datainterfaces/text/timeintervalsinterface.py b/src/neuroconv/datainterfaces/text/timeintervalsinterface.py index 7fea86abe..8834770f6 100644 --- a/src/neuroconv/datainterfaces/text/timeintervalsinterface.py +++ b/src/neuroconv/datainterfaces/text/timeintervalsinterface.py @@ -44,7 +44,7 @@ def __init__( def get_metadata(self) -> dict: """ Get metadata for the time intervals. - + Returns ------- dict diff --git a/src/neuroconv/nwbconverter.py b/src/neuroconv/nwbconverter.py index 6cb3d4a91..9bbfc9f65 100644 --- a/src/neuroconv/nwbconverter.py +++ b/src/neuroconv/nwbconverter.py @@ -51,7 +51,7 @@ class NWBConverter: def get_source_schema(cls) -> dict: """ Compile input schemas from each of the data interface classes. - + Returns ------- dict @@ -97,7 +97,7 @@ def __init__(self, source_data: dict[str, dict], verbose: bool = False): def get_metadata_schema(self) -> dict: """ Compile metadata schemas from each of the data interface objects. - + Returns ------- dict @@ -115,7 +115,7 @@ def get_metadata_schema(self) -> dict: def get_metadata(self) -> DeepDict: """ Auto-fill as much of the metadata as possible. Must comply with metadata schema. - + Returns ------- DeepDict @@ -148,7 +148,7 @@ def validate_metadata(self, metadata: dict[str, dict], append_mode: bool = False def get_conversion_options_schema(self) -> dict: """ Compile conversion option schemas from each of the data interface classes. - + Returns ------- dict diff --git a/src/neuroconv/tools/importing.py b/src/neuroconv/tools/importing.py index 12ea5f519..bc1c65011 100644 --- a/src/neuroconv/tools/importing.py +++ b/src/neuroconv/tools/importing.py @@ -139,7 +139,7 @@ def get_package( def get_format_summaries() -> dict[str, dict[str, Union[str, tuple[str, ...], None]]]: """ Simple helper function for compiling high level summaries of all format interfaces and converters. - + Returns ------- dict diff --git a/src/neuroconv/tools/neo/neo.py b/src/neuroconv/tools/neo/neo.py index d2fa9cfc7..0f673d37b 100644 --- a/src/neuroconv/tools/neo/neo.py +++ b/src/neuroconv/tools/neo/neo.py @@ -57,7 +57,7 @@ def get_electrodes_metadata(neo_reader, electrodes_ids: list, block: int = 0) -> def get_number_of_electrodes(neo_reader) -> int: """ Get number of electrodes from Neo reader. - + Returns ------- int @@ -70,14 +70,14 @@ def get_number_of_electrodes(neo_reader) -> int: def get_number_of_segments(neo_reader, block: int = 0) -> int: """ Get number of segments from Neo reader. - + Parameters ---------- neo_reader : neo.io.baseio The Neo reader object. block : int, default: 0 Block index. - + Returns ------- int @@ -106,7 +106,7 @@ def get_command_traces(neo_reader, segment: int = 0, cmd_channel: int = 0) -> tu - list: The command trace data - str: The title of the command trace - str: The units of the command trace - + Notes ----- This function only works for AxonIO interface. diff --git a/src/neuroconv/tools/nwb_helpers/_metadata_and_file_helpers.py b/src/neuroconv/tools/nwb_helpers/_metadata_and_file_helpers.py index c92c5b7e4..49968961a 100644 --- a/src/neuroconv/tools/nwb_helpers/_metadata_and_file_helpers.py +++ b/src/neuroconv/tools/nwb_helpers/_metadata_and_file_helpers.py @@ -24,7 +24,7 @@ def get_module(nwbfile: NWBFile, name: str, description: str = None): """ Check if processing module exists. If not, create it. Then return module. - + Parameters ---------- nwbfile : NWBFile @@ -33,7 +33,7 @@ def get_module(nwbfile: NWBFile, name: str, description: str = None): The name of the processing module. description : str, optional Description of the module. Only used if creating a new module. - + Returns ------- ProcessingModule @@ -86,13 +86,13 @@ def get_default_nwbfile_metadata() -> DeepDict: def make_nwbfile_from_metadata(metadata: dict) -> NWBFile: """ Make NWBFile from available metadata. - + Parameters ---------- metadata : dict Dictionary containing metadata for creating the NWBFile. Must contain an 'NWBFile' key with required fields. - + Returns ------- NWBFile From 857436aac85283ad94b3af0b073887308c38ec11 Mon Sep 17 00:00:00 2001 From: pauladkisson Date: Fri, 24 Jan 2025 15:17:34 -0800 Subject: [PATCH 12/19] updated changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index b8b887fb8..488a85905 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ ## Improvements * Simple writing no longer uses a context manager [PR #1180](https://github.com/catalystneuro/neuroconv/pull/1180) +* Added Returns section to all getter docstrings [PR #1185](https://github.com/catalystneuro/neuroconv/pull/1185) # v0.6.7 (January 20, 2025) From b56f3d6849cd85cbf540036b44056b5bdf7956ce Mon Sep 17 00:00:00 2001 From: Paul Adkisson Date: Fri, 7 Feb 2025 08:53:22 +1100 Subject: [PATCH 13/19] Update src/neuroconv/datainterfaces/behavior/video/video_utils.py Co-authored-by: Heberto Mayorquin --- src/neuroconv/datainterfaces/behavior/video/video_utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/neuroconv/datainterfaces/behavior/video/video_utils.py b/src/neuroconv/datainterfaces/behavior/video/video_utils.py index b90302b46..b153cf0f6 100644 --- a/src/neuroconv/datainterfaces/behavior/video/video_utils.py +++ b/src/neuroconv/datainterfaces/behavior/video/video_utils.py @@ -83,7 +83,7 @@ def get_video_timestamps(self, max_frames: Optional[int] = None, display_progres timestamps.append(self.vc.get(cv2.CAP_PROP_POS_MSEC)) return np.array(timestamps) / 1000 - def get_video_fps(self): + def get_video_fps(self) -> int: """ Return the internal frames per second (fps) for a video file. From f48ef6c93c1e6af937d7d7ed96bd8b245cf4ad2d Mon Sep 17 00:00:00 2001 From: Paul Adkisson Date: Fri, 7 Feb 2025 08:53:39 +1100 Subject: [PATCH 14/19] Update src/neuroconv/datainterfaces/behavior/video/video_utils.py Co-authored-by: Heberto Mayorquin --- src/neuroconv/datainterfaces/behavior/video/video_utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/neuroconv/datainterfaces/behavior/video/video_utils.py b/src/neuroconv/datainterfaces/behavior/video/video_utils.py index b153cf0f6..05422964e 100644 --- a/src/neuroconv/datainterfaces/behavior/video/video_utils.py +++ b/src/neuroconv/datainterfaces/behavior/video/video_utils.py @@ -123,7 +123,7 @@ def frame_count(self, val: int): ), "Cannot set manual frame_count beyond length of video (received {val})." self._frame_count = val - def get_video_frame_count(self): + def get_video_frame_count(self) -> int: """ Get the total number of frames in the video. From 738d8868e4c883a13190dbde4916dcec9ec02ff3 Mon Sep 17 00:00:00 2001 From: Paul Adkisson Date: Fri, 7 Feb 2025 08:54:02 +1100 Subject: [PATCH 15/19] Update src/neuroconv/datainterfaces/ophys/scanimage/scanimageimaginginterfaces.py Co-authored-by: Heberto Mayorquin --- .../ophys/scanimage/scanimageimaginginterfaces.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/neuroconv/datainterfaces/ophys/scanimage/scanimageimaginginterfaces.py b/src/neuroconv/datainterfaces/ophys/scanimage/scanimageimaginginterfaces.py index dea5676fa..000819fb3 100644 --- a/src/neuroconv/datainterfaces/ophys/scanimage/scanimageimaginginterfaces.py +++ b/src/neuroconv/datainterfaces/ophys/scanimage/scanimageimaginginterfaces.py @@ -786,7 +786,7 @@ def get_scanimage_major_version(scanimage_metadata: dict) -> str: Returns ------- - str + vesion: str The version of ScanImage that produced the TIFF file. Raises From afd4b30e09d5e76576dfb400293b34c32f132d0b Mon Sep 17 00:00:00 2001 From: Paul Adkisson Date: Fri, 7 Feb 2025 08:54:36 +1100 Subject: [PATCH 16/19] Update src/neuroconv/tools/roiextractors/roiextractors.py Co-authored-by: Heberto Mayorquin --- src/neuroconv/tools/roiextractors/roiextractors.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/neuroconv/tools/roiextractors/roiextractors.py b/src/neuroconv/tools/roiextractors/roiextractors.py index 3c6eac8c2..ad644017a 100644 --- a/src/neuroconv/tools/roiextractors/roiextractors.py +++ b/src/neuroconv/tools/roiextractors/roiextractors.py @@ -877,7 +877,7 @@ def get_nwb_segmentation_metadata(sgmextractor: SegmentationExtractor) -> dict: Parameters ---------- - sgmextractor : SegmentationExtractor + segmentation_extractor : SegmentationExtractor The segmentation extractor to get metadata from. Returns From 5b0c6a199c8f6fff47b1d9e44a5c0fd0bd7b0916 Mon Sep 17 00:00:00 2001 From: pauladkisson Date: Thu, 6 Feb 2025 14:08:23 -0800 Subject: [PATCH 17/19] removed extra get_metadata_docstring --- .../datainterfaces/text/timeintervalsinterface.py | 9 --------- 1 file changed, 9 deletions(-) diff --git a/src/neuroconv/datainterfaces/text/timeintervalsinterface.py b/src/neuroconv/datainterfaces/text/timeintervalsinterface.py index 8834770f6..2520a1236 100644 --- a/src/neuroconv/datainterfaces/text/timeintervalsinterface.py +++ b/src/neuroconv/datainterfaces/text/timeintervalsinterface.py @@ -42,15 +42,6 @@ def __init__( self.time_intervals = None def get_metadata(self) -> dict: - """ - Get metadata for the time intervals. - - Returns - ------- - dict - The metadata dictionary containing time intervals metadata. - Includes a TimeIntervals key with trials information. - """ metadata = super().get_metadata() metadata["TimeIntervals"] = dict( trials=dict( From 2d164a0ca0b391126ffde14d98c396424c91b85f Mon Sep 17 00:00:00 2001 From: pauladkisson Date: Thu, 6 Feb 2025 14:16:30 -0800 Subject: [PATCH 18/19] removed extra docstrings --- .../baserecordingextractorinterface.py | 9 ------- .../ecephys/basesortingextractorinterface.py | 14 ----------- .../neuroscope/neuroscopedatainterface.py | 17 ------------- .../ecephys/spike2/spike2datainterface.py | 9 ------- .../ecephys/spikeglx/spikeglxconverter.py | 9 ------- .../ecephys/spikeglx/spikeglxdatainterface.py | 25 ------------------- 6 files changed, 83 deletions(-) diff --git a/src/neuroconv/datainterfaces/ecephys/baserecordingextractorinterface.py b/src/neuroconv/datainterfaces/ecephys/baserecordingextractorinterface.py index ab59a33ac..e38cda56d 100644 --- a/src/neuroconv/datainterfaces/ecephys/baserecordingextractorinterface.py +++ b/src/neuroconv/datainterfaces/ecephys/baserecordingextractorinterface.py @@ -94,15 +94,6 @@ def get_metadata_schema(self) -> dict: return metadata_schema def get_metadata(self) -> DeepDict: - """ - Get metadata for the recording extractor. - - Returns - ------- - DeepDict - Dictionary containing metadata including device information, electrode groups, - and electrical series configuration. - """ metadata = super().get_metadata() from ...tools.spikeinterface.spikeinterface import _get_group_name diff --git a/src/neuroconv/datainterfaces/ecephys/basesortingextractorinterface.py b/src/neuroconv/datainterfaces/ecephys/basesortingextractorinterface.py index 1ebb8a9f5..09352c393 100644 --- a/src/neuroconv/datainterfaces/ecephys/basesortingextractorinterface.py +++ b/src/neuroconv/datainterfaces/ecephys/basesortingextractorinterface.py @@ -93,20 +93,6 @@ def get_original_timestamps(self) -> np.ndarray: ) def get_timestamps(self) -> Union[np.ndarray, list[np.ndarray]]: - """ - Get the timestamps for the sorting data. - - Returns - ------- - numpy.ndarray or list of numpy.ndarray - The timestamps for each spike in the sorting data. If there are multiple segments, - returns a list of timestamp arrays. - - Raises - ------ - NotImplementedError - If no recording is attached to the sorting extractor. - """ if not self.sorting_extractor.has_recording(): raise NotImplementedError( "In order to align timestamps for a SortingInterface, it must have a recording " diff --git a/src/neuroconv/datainterfaces/ecephys/neuroscope/neuroscopedatainterface.py b/src/neuroconv/datainterfaces/ecephys/neuroscope/neuroscopedatainterface.py index f57edd87b..4cfacb291 100644 --- a/src/neuroconv/datainterfaces/ecephys/neuroscope/neuroscopedatainterface.py +++ b/src/neuroconv/datainterfaces/ecephys/neuroscope/neuroscopedatainterface.py @@ -176,14 +176,6 @@ def __init__( ) def get_metadata(self) -> dict: - """ - Get metadata for the NeuroScope recording. - - Returns - ------- - dict - Dictionary containing metadata including Ecephys information and session start time. - """ session_path = Path(self.source_data["file_path"]).parent session_id = session_path.stem xml_file_path = self.source_data.get("xml_file_path", str(session_path / f"{session_id}.xml")) @@ -195,15 +187,6 @@ def get_metadata(self) -> dict: return metadata def get_original_timestamps(self) -> np.ndarray: - """ - Get the original timestamps for the recording. - - Returns - ------- - numpy.ndarray or list of numpy.ndarray - The timestamps for each sample in the recording. If there are multiple segments, - returns a list of timestamp arrays, one for each segment. - """ # TODO: add generic method for aliasing from NeuroConv signature to SI init new_recording = self.get_extractor()(file_path=self.source_data["file_path"]) if self._number_of_segments == 1: diff --git a/src/neuroconv/datainterfaces/ecephys/spike2/spike2datainterface.py b/src/neuroconv/datainterfaces/ecephys/spike2/spike2datainterface.py index c6d40bc08..47a703bd8 100644 --- a/src/neuroconv/datainterfaces/ecephys/spike2/spike2datainterface.py +++ b/src/neuroconv/datainterfaces/ecephys/spike2/spike2datainterface.py @@ -29,15 +29,6 @@ class Spike2RecordingInterface(BaseRecordingExtractorInterface): @classmethod def get_source_schema(cls) -> dict: - """ - Get the schema for the source arguments. - - Returns - ------- - dict - The schema dictionary containing input parameters and descriptions - for initializing the Spike2 recording interface. - """ source_schema = get_json_schema_from_method_signature(method=cls.__init__, exclude=["smrx_channel_ids"]) source_schema.update(additionalProperties=True) source_schema["properties"]["file_path"].update(description="Path to .smrx file.") diff --git a/src/neuroconv/datainterfaces/ecephys/spikeglx/spikeglxconverter.py b/src/neuroconv/datainterfaces/ecephys/spikeglx/spikeglxconverter.py index 85d12d907..94c0485c6 100644 --- a/src/neuroconv/datainterfaces/ecephys/spikeglx/spikeglxconverter.py +++ b/src/neuroconv/datainterfaces/ecephys/spikeglx/spikeglxconverter.py @@ -99,15 +99,6 @@ def __init__( super().__init__(data_interfaces=data_interfaces, verbose=verbose) def get_conversion_options_schema(self) -> dict: - """ - Get the schema for the conversion options. - - Returns - ------- - dict - The schema dictionary containing conversion options for each data interface - in this converter. - """ conversion_options_schema = super().get_conversion_options_schema() conversion_options_schema["properties"].update( {name: interface.get_conversion_options_schema() for name, interface in self.data_interface_objects.items()} diff --git a/src/neuroconv/datainterfaces/ecephys/spikeglx/spikeglxdatainterface.py b/src/neuroconv/datainterfaces/ecephys/spikeglx/spikeglxdatainterface.py index b191c3518..65dbc2b2e 100644 --- a/src/neuroconv/datainterfaces/ecephys/spikeglx/spikeglxdatainterface.py +++ b/src/neuroconv/datainterfaces/ecephys/spikeglx/spikeglxdatainterface.py @@ -31,14 +31,6 @@ class SpikeGLXRecordingInterface(BaseRecordingExtractorInterface): @classmethod def get_source_schema(cls) -> dict: - """ - Get the source schema for the SpikeGLX recording interface. - - Returns - ------- - dict - The JSON schema for the SpikeGLX recording data source. - """ source_schema = get_json_schema_from_method_signature(method=cls.__init__, exclude=["x_pitch", "y_pitch"]) source_schema["properties"]["file_path"]["description"] = "Path to SpikeGLX ap.bin or lf.bin file." return source_schema @@ -125,14 +117,6 @@ def __init__( add_recording_extractor_properties(self.recording_extractor) def get_metadata(self) -> dict: - """ - Get metadata for the SpikeGLX recording. - - Returns - ------- - dict - The metadata dictionary containing recording metadata from the SpikeGLX files. - """ metadata = super().get_metadata() session_start_time = get_session_start_time(self.meta) if session_start_time: @@ -180,15 +164,6 @@ def get_metadata(self) -> dict: return metadata def get_original_timestamps(self) -> np.ndarray: - """ - Get the original timestamps for the SpikeGLX recording. - - Returns - ------- - numpy.ndarray or list of numpy.ndarray - The timestamps for each sample in the recording. If there are multiple segments, - returns a list of timestamps arrays, one for each segment. - """ new_recording = self.get_extractor()( folder_path=self.folder_path, stream_id=self.stream_id, From 2ce07425cc77e632748929f26913623318e8d812 Mon Sep 17 00:00:00 2001 From: pauladkisson Date: Fri, 7 Feb 2025 08:24:14 -0800 Subject: [PATCH 19/19] fixed typo --- .../ophys/scanimage/scanimageimaginginterfaces.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/neuroconv/datainterfaces/ophys/scanimage/scanimageimaginginterfaces.py b/src/neuroconv/datainterfaces/ophys/scanimage/scanimageimaginginterfaces.py index 000819fb3..5a2f0aad7 100644 --- a/src/neuroconv/datainterfaces/ophys/scanimage/scanimageimaginginterfaces.py +++ b/src/neuroconv/datainterfaces/ophys/scanimage/scanimageimaginginterfaces.py @@ -786,7 +786,7 @@ def get_scanimage_major_version(scanimage_metadata: dict) -> str: Returns ------- - vesion: str + version: str The version of ScanImage that produced the TIFF file. Raises