diff --git a/src/jadhav_lab_to_nwb/olson_2024/olson_2024_metadata.yaml b/src/jadhav_lab_to_nwb/olson_2024/olson_2024_metadata.yaml index 3934249..3541557 100644 --- a/src/jadhav_lab_to_nwb/olson_2024/olson_2024_metadata.yaml +++ b/src/jadhav_lab_to_nwb/olson_2024/olson_2024_metadata.yaml @@ -40,6 +40,10 @@ Ecephys: ElectricalSeries: - name: ElectricalSeries description: Raw acquisition of extracellular electrophysiology data recorded by SpikeGadgets. + LFP: + ElectricalSeries: + - name: ElectricalSeriesLFP + description: Local field potential data recorded by SpikeGadgets (1 channel per tetrode). Behavior: Videos: diff --git a/src/jadhav_lab_to_nwb/olson_2024/olson_2024_spike_gadgets_lfp_interface.py b/src/jadhav_lab_to_nwb/olson_2024/olson_2024_spike_gadgets_lfp_interface.py index d4319a9..0a45dd6 100644 --- a/src/jadhav_lab_to_nwb/olson_2024/olson_2024_spike_gadgets_lfp_interface.py +++ b/src/jadhav_lab_to_nwb/olson_2024/olson_2024_spike_gadgets_lfp_interface.py @@ -8,6 +8,7 @@ from pynwb.ecephys import ElectricalSeries, LFP from neuroconv import BaseDataInterface from neuroconv.tools import nwb_helpers +from neuroconv.utils import get_base_schema class Olson2024SpikeGadgetsLFPInterface(BaseDataInterface): @@ -18,6 +19,29 @@ class Olson2024SpikeGadgetsLFPInterface(BaseDataInterface): def __init__(self, folder_path: DirectoryPath): super().__init__(folder_path=folder_path) + def get_metadata_schema(self): + metadata_schema = super().get_metadata_schema() + metadata_schema["properties"]["Ecephys"] = get_base_schema(tag="Ecephys") + metadata_schema["properties"]["Ecephys"]["properties"]["LFP"] = { + "type": "object", + "required": ["ElectricalSeries"], + "properties": { + "ElectricalSeries": { + "type": "array", + "minItems": 1, + "items": { + "required": ["name", "description"], + "properties": { + "name": {"type": "string"}, + "description": {"type": "string"}, + }, + }, + }, + }, + } + + return metadata_schema + def add_to_nwbfile(self, nwbfile: NWBFile, metadata: dict, stub_test: bool = False): folder_path = Path(self.source_data["folder_path"]) electrodes_table = nwbfile.electrodes.to_dataframe() @@ -52,8 +76,10 @@ def add_to_nwbfile(self, nwbfile: NWBFile, metadata: dict, stub_test: bool = Fal if stub_test: lfp_data = lfp_data[:100] timestamps = timestamps[:100] + lfp_metadata = metadata["Ecephys"]["LFP"] lfp_electrical_series = ElectricalSeries( - name="ElectricalSeries", + name=lfp_metadata["ElectricalSeries"][0]["name"], + description=lfp_metadata["ElectricalSeries"][0]["description"], data=lfp_data, timestamps=timestamps, electrodes=lfp_table_region,