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 | |
from pynwb import get_class, load_namespaces | |
from datetime import datetime | |
from pynwb import NWBFile | |
from form.backends.hdf5 import HDF5IO | |
from pynwb import get_build_manager | |
ns_path = "mylab.namespace.yaml" |
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, NWBDatasetSpec | |
import numpy as np | |
from pynwb import get_class, load_namespaces | |
from datetime import datetime | |
from pynwb import NWBFile | |
from form.backends.hdf5 import HDF5IO | |
from pynwb import get_build_manager | |
ns_path = "alleninstitute.namespace.yaml" |
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
import numpy as np | |
import xarray | |
from allensdk.core.brain_observatory_cache import BrainObservatoryCache | |
from allensdk.brain_observatory import stimulus_info as si | |
TIME = 'time' | |
SEC = 'second' | |
MS = 'millisecond' | |
IDX = 'index' |
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 datetime import datetime | |
from pynwb import NWBFile | |
from form.backends.hdf5 import HDF5IO | |
from pynwb import get_build_manager | |
from pynwb.base import TimeSeries | |
import numpy as np | |
f = NWBFile('tmp.nwb', 'my first synthetic recording', 'EXAMPLE_ID', identifier='hi', | |
experimenter='Dr. Bilbo Baggins', | |
lab='Bag End Labatory', |
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
import numpy as np | |
import h5py | |
import xarray as xr | |
import os | |
import types | |
import json | |
# https://github.com/pydata/xarray/issues/1599 | |
# https://github.com/nicain/xarray/tree/feature/1599-to_dict_numpy | |
# https://codereview.stackexchange.com/questions/120802/recursively-save-python-dictionaries-to-hdf5-files-using-h5py |
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
import allensdk | |
from allensdk.core.brain_observatory_cache import BrainObservatoryCache | |
import os | |
from distutils.version import StrictVersion | |
assert allensdk.__version__ == StrictVersion('0.14.2') | |
from allensdk.brain_observatory.brain_observatory_exceptions import EpochSeparationException | |
import matplotlib.pyplot as plt | |
# Settings: | |
oeid = 556363813 |
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
import pandas as pd | |
import collections | |
import numpy as np | |
import matplotlib.pyplot as plt | |
from allensdk.core.brain_observatory_nwb_data_set import BrainObservatoryNwbDataSet | |
df = pd.read_csv('/allen/aibs/technology/nicholasc/brain_observatory_cell_df.csv', sep=' ').drop('Unnamed: 0', axis=1) | |
# print df.columns |
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
import numpy as np | |
import h5py | |
import os | |
def pass_function(*args): return | |
def visit(group, group_callback=pass_function, | |
dataset_callback=pass_function, | |
softlink_callback=pass_function, | |
broken_link_callback=pass_function, path='/'): |
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
import warnings | |
from allensdk.core.brain_observatory_cache import BrainObservatoryCache | |
import allensdk.brain_observatory.stimulus_info as si | |
import pynwb | |
ophys_experiment_id = 570014520 | |
boc = BrainObservatoryCache(manifest_file=brain_observatory_cache_manifest_file) | |
exp = boc.get_ophys_experiment_data(ophys_experiment_id) | |
legacy_map = pynwb.legacy.get_type_map() |
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
class EphysBrainObservatoryAdapter(object): | |
def __init__(self, nwb_file_name, analysis_dir, probe_unit_dict=cortex_probe_dict): | |
self.convert_inner_unit_to_unit = {} | |
self.convert_unit_to_inner_unit = {} | |
self.probe_unit_id_dict = {} |