Skip to content

Commit

Permalink
added metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
pauladkisson committed Nov 25, 2024
1 parent e202d5b commit a1c9ff4
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/jadhav_lab_to_nwb/olson_2024/olson_2024_metadata.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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()
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit a1c9ff4

Please sign in to comment.