Allen Institute - Visual Coding - Optical Physiology

Allen Institute - Visual Coding - Optical Physiology. Neurophysiology / NWB data on the DANDI Archive (3036 assets, 56.8 TB). License: spdx:CC-BY-4.0.

Category
Neuroscience
Provider
Allen Institute
License
spdx:CC-BY-4.0
DOI
10.48324/dandi.000728/0.240827.1809
Hosted on
Amazon S3, bucket dandiarchive/dandisets/000728, us-east-2
Access
Free and public. No account with the data provider is needed.
Source
https://dandiarchive.org/dandiset/000728
Data structure and loading code

Fields

assets.jsonld[]path, contentSize, encodingFormat (application/x-nwb), contentUrl[api download url, s3 blob url], digest…
dandiset.jsonldname, description, license, doi, citation, contributor[], assetsSummary{numberOfBytes, numberOfFiles, numberOfSubjects…
nwb_version [ophys]2.6.0
general/subject [ophys]age=P97D; description=Mus musculus in vivo.; genotype=Pvalb-IRES-Cre/wt;Ai162(TIT2L-GC6s-ICL-tTA2)/wt; sex=F…
acquisition/ [ophys]MotionCorrectedTwoPhotonSeries (TwoPhotonSeries), MotionCorrectionShiftsPerFrame (TimeSeries)
general/optophysiology [ophys]ImagingPlane
nwb_version [behavior+image+ophys]2.7.0
general/subject [behavior+image+ophys]age=P114D; description=Mus musculus in vivo.; genotype=Nr5a1-Cre/wt;Camk2a-tTA/wt;Ai93(TITL-GCaMP6f)/wt; sex=M…
processing/behavior [behavior+image+ophys]BehavioralTimeSeries:BehavioralTimeSeries
processing/ophys [behavior+image+ophys]ContaminationRatios:DynamicTable, DfOverF:DfOverF, Fluorescence:Fluorescence, ImageSegmentation:ImageSegmentation…
intervals/ [behavior+image+ophys]epochs (10 rows: id, start_time, stimulus_type, stop_time)
stimulus/presentation [behavior+image+ophys]locally_sparse_noise_4deg_stimulus:IndexSeries, locally_sparse_noise_8deg_stimulus:IndexSeries…
stimulus/templates [behavior+image+ophys]locally_sparse_noise_4deg_template, locally_sparse_noise_8deg_template, natural_movie_one, natural_movie_two
general/optophysiology [behavior+image+ophys]ImagingPlane

Files

Allen Visual Coding 2-photon (de Vries et al. 2020) re-packaged as NWB 2 with the RAW motion-corrected movies as TwoPhotonSeries, which is why this dandiset is 62 TB. The processed dF/F layer is the same data as allen-brain-observatory/visual-coding-2p (NWB 1.0.5).

What the mount contains: /mnt/archive/0.240827.1809/{assets.jsonld, assets.yaml, collection.jsonld, dandiset.jsonld, dandiset.yaml} and /mnt/archive/draft/{same five}. NOTHING ELSE. The 3,036 data files (62.5 TB) are content-addressed blobs at s3://dandiarchive/blobs/<a>/<b>/<uuid>, resolved per asset from assets.jsonld (contentUrl[1]) or via the DANDI API; the bucket is public (anonymous read).

Logical layout (asset paths):
  sub-<subject>/sub-<subject>_ses-<session>[_probe-<id>][_<kind>].nwb
  kinds: ophys x1,518, behavior+image+ophys x1,518
  extensions: .nwb x3,036
  subjects: 271 (from paths; DANDI says 271); sessions per subject up to 24
  file sizes: min 3 MB, median 1.0 GB, max 55 GB
  species: Mus musculus - House mouse
  approach: microscopy approach; cell population imaging; behavioral approach
  technique: surgical technique; two-photon microscopy technique; analytical technique; behavioral technique
  NWB neurodata types across assets: BehavioralTimeSeries, CompassDirection, EyeTracking, ImagingPlane, OpticalChannel, PlaneSegmentation, ProcessingModule, PupilTracking, SpatialSeries, TwoPhotonSeries
  license: spdx:CC-BY-4.0; DOI 10.48324/dandi.000728/0.240827.1809

Probed files (h5py over S3, 2026-09-09):
  sub-691657859/sub-691657859_ses-712919679-StimB_ophys.nwb (3 MB, ophys, 1,518 such files): NWB 2.6.0; acquisition MotionCorrectedTwoPhotonSeries, MotionCorrectionShiftsPerFrame; processing -; intervals -; units 0
  sub-577808199/sub-577808199_ses-593506468-StimC2_behavior+image+ophys.nwb (120 MB, behavior+image+ophys, 1,518 such files): NWB 2.7.0; acquisition -; processing behavior, ophys; intervals epochs; units 0

Example file: sub-691657859/sub-691657859_ses-712919679-StimB_ophys.nwb — 3 MB at s3://dandiarchive/blobs/c94/d81/c94d8194-0876-49e2-9747-20cd70db68f7; NWB 2.6.0; "2-photon recording of visual areas in head-fixed mouse with visual stimulus. Monitor was positioned 15 cm from the mous"

Load the data

import json, os, glob, collections
M = os.environ.get("SCIGANTIC_MOUNT_PATH", "/mnt/archive")
# The mount holds ONLY the dandiset metadata; the NWB files are content-addressed blobs elsewhere in the
# public dandiarchive bucket. assets.jsonld maps each logical path to its blob URL.
versions = sorted(d for d in os.listdir(M) if os.path.isdir(f"{M}/{d}"))
ver = "0.240827.1809" if "0.240827.1809" in versions else versions[-1]
assets = json.load(open(f"{M}/{ver}/assets.jsonld"))
assets = assets.get("@graph", assets) if isinstance(assets, dict) else assets
print(f"version {ver}: {len(assets)} assets, {sum(a.get('contentSize', 0) for a in assets)/1e9:.1f} GB")
def blob_key(a):
    return next((u.split(".s3.amazonaws.com/", 1)[1] for u in a.get("contentUrl", []) if ".s3.amazonaws.com/" in u), None)
import re
def kind(path):   # BIDS-style suffix = last "_" token without a "-"; none => bare "session" file
    if not path.endswith(".nwb"): return os.path.splitext(path)[1] or "other"
    toks = os.path.basename(path).rsplit(".", 1)[0].split("_")
    suffix = toks[-1] if len(toks) > 1 and "-" not in toks[-1] else "session"
    return ("probe-" if any(t.startswith("probe-") for t in toks) else "") + suffix
kinds = collections.Counter(kind(a["path"]) for a in assets)
print("file kinds:", dict(kinds))

# Open the smallest NWB of one kind lazily over anonymous S3 (h5py + s3fs; nothing is downloaded whole).
nwbs = sorted((a for a in assets if kind(a["path"]) == "ophys"), key=lambda a: a.get("contentSize", 0))
a = nwbs[0] if nwbs else sorted(assets, key=lambda a: a.get("contentSize", 0))[0]
key = blob_key(a); print("opening", a["path"], f"({a['contentSize']/1e6:.0f} MB) ->", key)
import h5py, s3fs
fs = s3fs.S3FileSystem(anon=True)
f = h5py.File(fs.open(f"dandiarchive/{key}", "rb", block_size=4 * 1024 * 1024), "r")
txt = lambda v: v.decode() if isinstance(v, bytes) else v
print("nwb", f.attrs.get("nwb_version"), "|", txt(f["session_description"][()]))
print("subject:", {k: txt(f["general/subject"][k][()]) for k in f["general/subject"]} if "general/subject" in f else "-")
print("acquisition:", list(f["acquisition"].keys())[:12])
print("processing:", {m: list(f["processing"][m].keys())[:8] for m in f["processing"]} if "processing" in f else {})
print("intervals:", list(f["intervals"].keys()) if "intervals" in f else [], "| units:", f["units/id"].shape[0] if "units" in f else 0)

# The same file through pynwb (preinstalled), still lazy:
from pynwb import NWBHDF5IO
io = NWBHDF5IO(file=f, mode="r", load_namespaces=True)
nwb = io.read(); print(nwb.identifier, "|", nwb.session_start_time)
print({k: type(v).__name__ for k, v in nwb.acquisition.items()})

Written for a Scigantic notebook, where /mnt/archive is the mounted dataset.

Analyze this dataset without downloading it

On Scigantic, Allen Institute - Visual Coding - Optical Physiology opens in a hosted JupyterLab notebook with the data already mounted, so you can read files where they are stored instead of copying them first. Each notebook includes an AI assistant that can see the mounted files and write and run analysis code. Open the dataset page to launch a notebook, or browse the full catalog.

Related Neuroscience datasets