Skip to content

Instantly share code, notes, and snippets.

Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@rly
rly / fix_dandiset_000776.py
Last active February 8, 2024 02:01
Script to fix invalid "order_optical_channels" group in NWB files in dandiset 000776
# In dandiset 000776, the data is invalid against the spec. See https://github.com/dandi/helpdesk/issues/126
# To fix the files in dandiset 000776, run this script on dandihub. This script performs the following data surgery
# steps:
#
# 1. Replace the "order_optical_channels" link from all `ImagingVolume` objects with a subgroup
# that is the link target (at /processing/NeuroPAL/OpticalChannelRefs)
# 2. Add the "ndx-multichannel-volume" version 0.1.12 schema
# 3. Remove the "ndx-multichannel-volume" version 0.1.9 schema
# 4. Remove the "order_optical_channels" group from all "MultiChannelVolume" objects
# 5. Remove the "OpticalChannelRefs" group within "/processing"
@rly
rly / remove_units_table.ipynb
Created January 16, 2024 19:28
Demonstration of how to remove the Units table from an NWB file
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@rly
rly / measure_hdf5_group_overhead.ipynb
Created January 5, 2024 22:10
Measure the space overhead of creating many HDF5 groups
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@rly
rly / fix_dandiset_000114.py
Last active November 21, 2023 02:46
Script to fix incorrect namespace attributes in NWB files in dandiset 000114
import glob
import h5py
import argparse
from typing import Union
def replace_namespace(_: str, h5obj: Union[h5py.Dataset, h5py.Group]):
# change the attribute "namespace" from value "hdmf-experimental" to "hdmf-common"
# for all DynamicTableRegion and VectorData neurodata types from ndx-photometry.
if h5obj.attrs.get("namespace") == "hdmf-experimental":
@rly
rly / test_modify_nwb.ipynb
Created October 9, 2023 21:44
Tests on what is currently possible for modifying an NWB file using PyNWB and h5py
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@rly
rly / get_namespace_versions.ipynb
Last active August 16, 2023 17:56
Get the versions of the namespaces/extensions cached in an NWB file or used by PyNWB
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@rly
rly / spec_non_string_value.ipynb
Created June 17, 2023 12:29
Test behavior of PyNWB/HDMF with an attribute spec that has a non-text or non-scalar default value.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@rly
rly / test_column_of_containers.ipynb
Last active May 30, 2023 20:07
Create an NWB DynamicTable with a column of object references
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.