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
#fix of https://gist.github.com/nicain/be598d5b7be5f2ffe1fd7e8d27c87ec3 | |
# | |
from pynwb.spec import NWBNamespaceBuilder, NWBGroupSpec, NWBAttributeSpec | |
import numpy as np | |
from pynwb import get_class, load_namespaces | |
mylab = 'alleninstitute' | |
ns_path = "%s.namespace.yaml" % mylab | |
ext_source = "%s.extensions.yaml" % mylab |
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
import os | |
import h5py | |
import numpy as np | |
# Create compound data type | |
# a table with columns channel ID, xyz-coordinates, and impedence | |
coord_dt = np.dtype([('x', np.float), ('y', np.float), ('z', np.float)]) | |
ch_dt = np.dtype([("id", np.int), ("coord", coord_dt), ("imp", np.float)]) | |
# Make a fake channel table |
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
import numpy as np | |
from pynwb import get_class, load_namespaces | |
from datetime import datetime | |
from pynwb import NWBFile | |
import pandas as pd | |
from form.backends.hdf5 import HDF5IO | |
from pynwb import get_build_manager | |
ns_path = "alleninstitute.namespace.yaml" | |
ext_source = "alleninstitute.extensions.yaml" |
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
import numpy as np | |
from pynwb import get_class, load_namespaces | |
from datetime import datetime | |
from pynwb import NWBFile | |
import pandas as pd | |
from form.backends.hdf5 import HDF5IO | |
from pynwb import get_build_manager | |
ns_path = "alleninstitute.namespace.yaml" | |
ext_source = "alleninstitute.extensions.yaml" |
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
from datetime import datetime | |
from timeit import timeit | |
iso_setup = ''' | |
from datetime import datetime | |
iso_start = "2017-08-30T16:01:18Z" | |
iso_end = "2017-08-30T16:01:20Z" | |
fmt = "%Y-%m-%dT%H:%M:%SZ" | |
''' |
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
import pynwb | |
foo_ext_path = 'foo.namespace.yaml' # custom extension | |
foo_nwb_path = 'foo.nwb' # file using custom extension | |
bar_ext_path = 'bar.namespace.yaml' # another custom extension | |
bar_nwb_path = 'bar.nwb' # file using this other custom extension | |
baz_nwb_path = 'baz.nwb' # file with no extensions | |
############ READ ############# |
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
import filterframework | |
import pynwb | |
import multiprocessing # this is a core Python package | |
def my_analysis_func(...): | |
# user writes this | |
... | |
nwb_file = pynwb.NWBFile(...) | |
query_string = 'a toy query string' |
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
def get_builder_ns(self, builder): | |
return 'core' | |
def get_builder_dt(self, builder): | |
attrs = builder.attributes | |
ndt = attrs.get('neurodata_type') | |
if ndt == 'Module': | |
return 'ProcessingModule' | |
elif ndt == 'TimeSeries': |
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
""" import the pynwb packages""" | |
from pynwb import NWBFile, TimeSeries, get_manager | |
from pynwb.form.backends.hdf5 import HDF5IO | |
from pynwb.icephys import CurrentClampSeries | |
from pynwb.icephys import VoltageClampSeries | |
import datetime | |
import numpy as np | |
import os | |
experimentID = 'BJ5523'#folderPath.split('/')[-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 code was breaking at write. See https://github.com/NeurodataWithoutBorders/pynwb/issues/317 | |
mschachter hacked PyNWB and then had problems reading. See https://github.com/NeurodataWithoutBorders/pynwb/issues/318 | |
This commit should fix both of these issues: https://github.com/NeurodataWithoutBorders/pynwb/commit/72fafa686748de25571d0abd6aa43cd3ab889bb9 | |
""" | |
import json | |
from datetime import datetime | |
import numpy as np |
OlderNewer