-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into add_week_long_session
- Loading branch information
Showing
7 changed files
with
106 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
src/cai_lab_to_nwb/zaki_2024/interfaces/zaki_2024_shock_stimuli_interface.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
"""Primary class for converting experiment-specific behavior.""" | ||
|
||
from pynwb.file import NWBFile | ||
|
||
from neuroconv.basedatainterface import BaseDataInterface | ||
from neuroconv.utils import DeepDict | ||
from typing import Optional, List | ||
from pynwb.epoch import TimeIntervals | ||
|
||
|
||
class Zaki2024ShockStimuliInterface(BaseDataInterface): | ||
"""Adds annotated events of shock times.""" | ||
|
||
keywords = ["behavior", "sleep stages"] | ||
|
||
def __init__(self, verbose: bool = False): | ||
|
||
self.verbose = verbose | ||
super().__init__() | ||
|
||
def get_metadata(self) -> DeepDict: | ||
# Automatically retrieve as much metadata as possible from the source files available | ||
metadata = super().get_metadata() | ||
|
||
return metadata | ||
|
||
def add_to_nwbfile( | ||
self, | ||
nwbfile: NWBFile, | ||
shock_amplitude: float, | ||
shock_times: list, | ||
shock_duration: float, | ||
metadata: Optional[dict] = None, | ||
): | ||
|
||
description = ( | ||
"During aversive encoding, after a baseline period of 2 min, mice received three 2 s foot shocks " | ||
"of either amplitude 0.25 mA (low-shock) or 1.5 mA (high-shock), with an intershock interval of 1 min. " | ||
"All testing was done in Med Associates chambers. " | ||
) | ||
|
||
shock_stimuli = TimeIntervals(name="ShockStimuli", description=description) | ||
column_description = "Shock amplitude in mA" | ||
shock_stimuli.add_column(name="shock_amplitude", description=column_description) | ||
for start_time in shock_times: | ||
shock_stimuli.add_interval( | ||
start_time=start_time, stop_time=start_time + shock_duration, shock_amplitude=shock_amplitude | ||
) | ||
|
||
nwbfile.add_stimulus(shock_stimuli) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters