-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from catalystneuro/add_miniscope_utils
Add miniscope utils
- Loading branch information
Showing
13 changed files
with
503 additions
and
133 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
pynwb | ||
nwb_docutils | ||
natsort>=8.3.1 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,4 +8,4 @@ namespaces: | |
neurodata_types: | ||
- Device | ||
- source: ndx-miniscope.extensions.yaml | ||
version: 0.4.0 | ||
version: 0.5.0 |
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 |
---|---|---|
@@ -1 +1,12 @@ | ||
from .miniscope import * | ||
import os | ||
|
||
from pynwb import get_class, load_namespaces | ||
|
||
name = "ndx-miniscope" | ||
|
||
here = os.path.abspath(os.path.dirname(__file__)) | ||
ndx_miniscope_spec_path = os.path.join(here, "spec", name + ".namespace.yaml") | ||
|
||
load_namespaces(ndx_miniscope_spec_path) | ||
|
||
Miniscope = get_class("Miniscope", name) |
This file was deleted.
Oops, something went wrong.
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,9 @@ | ||
from .notes import read_notes | ||
from .nwb import add_miniscope_device, add_miniscope_image_series | ||
from .settings import read_miniscope_config | ||
from .timestamps import ( | ||
get_recording_start_times, | ||
get_timestamps, | ||
read_miniscope_timestamps, | ||
) | ||
from .video import get_starting_frames |
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,35 @@ | ||
import os | ||
|
||
import pandas as pd | ||
from packaging import version | ||
from pynwb.misc import AnnotationSeries | ||
|
||
from ..utils.settings import get_miniscope_version | ||
|
||
|
||
def read_notes(folder_path: str): | ||
"""Reads the notes from the settings_and_notes.dat file and creates a pynwb.misc.AnnotationSeries | ||
Parameters | ||
---------- | ||
folder_path: str | ||
data dir containing settings_and_notes.dat | ||
Returns | ||
------- | ||
None or pynwb.misc.AnnotationSeries | ||
""" | ||
miniscope_version = get_miniscope_version(folder_path=folder_path) | ||
if miniscope_version == version.Version("4"): | ||
raise NotImplementedError("This function is not supported for Miniscope V4 format.") | ||
|
||
fpath = os.path.join(folder_path, "settings_and_notes.dat") | ||
df = pd.read_csv(fpath, skiprows=3, delimiter="\t") | ||
if len(df): | ||
return AnnotationSeries( | ||
name="notes", | ||
data=df["Note"].values, | ||
timestamps=df["elapsedTime"].values / 1000, | ||
description="read from miniscope settings_and_notes.dat file", | ||
) |
Oops, something went wrong.