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 argparse | |
import os | |
import socket | |
import torch | |
from torch import nn | |
import torch.nn.functional as F | |
from torchvision import transforms | |
from torchvision.datasets import MNIST | |
from torch.utils.data import DataLoader, random_split | |
import pytorch_lightning as pl |
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 argparse | |
import sys | |
import h5py | |
import numpy as np | |
desc = ''' | |
Concatenate one or more .npy files into a dataset into an HDF5 file | |
''' | |
parser = argparse.ArgumentParser(description=desc) | |
parser.add_argument('output_h5', help='the .h5 file to write converted data to') |
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
BLACK = 0 | |
RED = 1 | |
class Interval(object): | |
def __init__(self, start, end): | |
self.__start = start | |
self.__end = end | |
self.__max = end | |
self.__left = None |
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
class MyClass(object): | |
def __init__(self, p): | |
self.__x = p | |
@property | |
def x(self): | |
return self.__x |
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 |
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
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 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
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
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" | |
''' |
NewerOlder