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 | |
import ndx_franklab_novela | |
with pynwb.NWBHDF5IO('beans20190718.nwb', 'r') as io: | |
nwbfile = io.read() | |
orig_eseries = nwbfile.acquisition['e-series'] | |
n_timestamps = 4000000 # / 20000 Hz sampling rate = 200 seconds | |
data = orig_eseries.data[0:n_timestamps, :] | |
ts = orig_eseries.timestamps[0:n_timestamps] | |
electrodes = nwbfile.create_electrode_table_region( |
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 datetime | |
import numpy as np | |
from pynwb import NWBFile, NWBHDF5IO, validate | |
nwbfile = NWBFile( | |
session_description='session_description', | |
identifier='identifier', | |
session_start_time=datetime.datetime.now(datetime.timezone.utc), | |
) |
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 pynwb import NWBFile, NWBHDF5IO | |
from pynwb.ecephys import LFP, ElectricalSeries | |
import numpy as np | |
import datetime | |
# Create a test file | |
nwb = NWBFile( | |
session_description='session_description', | |
identifier='identifier', |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 pynwb import NWBHDF5IO | |
import pynwb | |
from hdmf.data_utils import GenericDataChunkIterator | |
from hdmf.backends.hdf5.h5_utils import H5DataIO | |
filepath = r"D:\GiocomoData_dandiset53\000053\sub-npI1\sub-npI1_ses-20190413_behavior+ecephys.nwb" | |
class H5DatasetDataChunkIterator(GenericDataChunkIterator): | |
"""A data chunk iterator that reads chunks over the 0th dimension of an HDF5 dataset up to a max length. |
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 | |
from pynwb.spec import NWBDatasetSpec, NWBGroupSpec, NWBNamespace | |
from hdmf.spec import NamespaceCatalog | |
from hdmf.build import TypeMap | |
def print_namespace_versions(type_map): | |
"""Print the namespace name and version of all namespaces in the given type map.""" | |
for ns_name in type_map.namespace_catalog.namespaces: |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 pynwb import NWBHDF5IO, NWBFile | |
def get_neurodata_type_objs_io(io: NWBHDF5IO, neurodata_type: str, namespace: str): | |
"""Return all PyNWB objects in the file that have a neurodata type from a namespace. | |
This works regardless of whether the extension was imported earlier in the python execution. | |
All objects that are instances of the class associated with the given neurodata_type in the | |
given namespace will be returned. This includes objects that are instances of a subclass. |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 glob | |
import h5py | |
import numpy as np | |
import argparse | |
import pynwb | |
STR_DTYPE = h5py.special_dtype(vlen=str) | |
OlderNewer