Last active
July 31, 2017 18:53
-
-
Save nicain/8965460ebcab2075fb478839843cad9f to your computer and use it in GitHub Desktop.
hackathon
This file contains hidden or 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 pynwb import NWBNamespaceBuilder, NWBGroupSpec, NWBAttributeSpec | |
import numpy as np | |
ns_path = "mylab.namespace.yaml" | |
ext_source = "mylab.extensions.yaml" | |
nwb_as = NWBAttributeSpec('unit', 'str', 'the population name', value = 'Hz') | |
ns_builder = NWBNamespaceBuilder('Extension for use in my Lab', "mylab") | |
ext = NWBGroupSpec('A custom TimeSeries for my lab', | |
attributes=[nwb_as], | |
neurodata_type_inc='TimeSeries', | |
neurodata_type_def='FiringRateSeries') | |
ns_builder.add_spec(ext_source, ext) | |
ns_builder.export(ns_path) | |
from pynwb import get_class, load_namespaces | |
ns_path = "mylab.namespace.yaml" | |
load_namespaces(ns_path) | |
FiringRateSeries = get_class('FiringRateSeries', 'mylab') | |
fs = FiringRateSeries(data=np.random.rand(5), | |
name='my_population', | |
source='acquisition') |
Author
nicain
commented
Jul 31, 2017
•
my-lab.extensions.yaml:
groups:
- attributes:
- doc: the population name
dtype: str
name: unit
value: Hz
doc: A custom TimeSeries for my lab
neurodata_type_def: FiringRateSeries
neurodata_type_inc: TimeSeries
- doc: the population name
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment