Open In Colab

Installing requirements¶

The cell below installs every Python package needed to run this notebook, at fully pinned versions, using uv for fast resolution. In Colab the cell is collapsed by default — click the ▶ button to run it.

In [1]:
# install cell skipped during CI (deps preinstalled into system Python)

⚠️ Restart runtime after install

The install may upgrade packages already loaded in the kernel. Go to Runtime → Restart session, then Run all cells below (skip this install cell on re-run).

000458 - summarize contents¶

This notebook summarizes the contents of all the NWB files in Dandiset 000458 including the file size, session description, and trial information. Readers can quickly and easily use these descriptions to determine which NWB files to investigate further.

In [2]:
# Suppress hdmf warnings about cached namespaces
import warnings
warnings.filterwarnings("ignore", category=UserWarning, module="hdmf.utils")
In [3]:
from helpers.stream_nwbfile import stream_nwbfile
import dandi.dandiarchive as da
from IPython.display import display, Markdown


DANDISET_ID = "000458"

parsed_url = da.parse_dandi_url(f"https://dandiarchive.org/dandiset/{DANDISET_ID}")

with parsed_url.navigate() as (client, dandiset, assets):
    if dandiset is None:
        raise Exception(f"Dandiset {DANDISET_ID} not found.")

    num_consecutive_not_nwb = 0
    asset_index = 0
    for asset_obj in dandiset.get_assets('path'):
        if not asset_obj.path.endswith(".nwb"):
            num_consecutive_not_nwb += 1
            if num_consecutive_not_nwb >= 20:
                # For example, this is important for 000026 because there are so many non-nwb assets
                raise Exception("Too many consecutive non-NWB files.")
            continue
        else:
            num_consecutive_not_nwb = 0
        asset = {
            "identifier": asset_obj.identifier,
            "path": asset_obj.path,
            "size": asset_obj.size,
            "download_url": asset_obj.download_url,
            "dandiset_id": DANDISET_ID,
        }
        nwbfile, io = stream_nwbfile(DANDISET_ID, asset["path"])
        md = ''
        ns_url = f'https://neurosift.app/?p=/nwb&url={asset["download_url"]}&dandisetId={DANDISET_ID}'
        md += f'**Asset {asset_index + 1}: [{asset["path"]}]({ns_url})**\n\n'
        experiment_description = nwbfile.experiment_description  # type: ignore
        session_description = nwbfile.session_description  # type: ignore
        stimulus_notes = nwbfile.stimulus_notes  # type: ignore
        md += experiment_description + '\n\n'
        md += session_description + '\n\n'
        md += stimulus_notes + '\n\n'
        trials = nwbfile.intervals['trials'].to_dataframe()  # type: ignore
        num_trials = len(trials)
        md += f'* Size: {asset["size"] / 1e6:.2f} MB\n'
        md += f"* {num_trials} trials\n"
        behavioral_epochs = trials['behavioral_epoch']
        is_valid = trials['is_valid']
        is_running = trials['is_running']
        unique_behavioral_epochs = behavioral_epochs.unique()
        md += f"* BEHAVIORAL EPOCHS\n"
        for be in unique_behavioral_epochs:
            num = len(behavioral_epochs[behavioral_epochs == be])
            num_valid = len(is_valid[(behavioral_epochs == be) & is_valid])
            num_valid_and_not_running = len(is_valid[(behavioral_epochs == be) & is_valid & ~is_running])
            md += f"  - {be}: {num_valid_and_not_running} valid and not running\n"
        stimulus_types = trials['stimulus_type']
        unique_stimulus_types = stimulus_types.unique()
        md += f"* STIMULUS TYPES\n"
        for st in unique_stimulus_types:
            num = len(stimulus_types[stimulus_types == st])
            num_valid = len(is_valid[(stimulus_types == st) & is_valid])
            num_valid_and_not_running = len(is_valid[(stimulus_types == st) & is_valid & ~is_running])
            md += f"  - {st}: {num_valid_and_not_running} valid and not running\n"
        stimulus_descriptions = trials['stimulus_description']
        unique_stimulus_descriptions = stimulus_descriptions.unique()
        md += f"* STIMULUS DESCRIPTIONS\n"
        for sd in unique_stimulus_descriptions:
            num = len(stimulus_descriptions[stimulus_descriptions == sd])
            num_valid = len(is_valid[(stimulus_descriptions == sd) & is_valid])
            num_valid_and_not_running = len(is_valid[(stimulus_descriptions == sd) & is_valid & ~is_running])
            md += f"  - {sd}: {num_valid_and_not_running} valid and not running\n"
        estim_target_regions = trials['estim_target_region']
        unique_estim_target_regions = estim_target_regions.unique()
        md += f"* ESTIM TARGET REGIONS\n"
        for etr in unique_estim_target_regions:
            num = len(estim_target_regions[estim_target_regions == etr])
            num_valid = len(is_valid[(estim_target_regions == etr) & is_valid])
            num_valid_and_not_running = len(is_valid[(estim_target_regions == etr) & is_valid & ~is_running])
            md += f"  - {etr}: {num_valid_and_not_running} valid and not running\n"
        display(Markdown(md))
        asset_index += 1

Asset 1: sub-521885/sub-521885_ses-20200709_behavior+ecephys.nwb

in vivo electrophysiology in a head-fixed mouse during cortical electrical microstimulation

EEG recording during wakefulness and isoflurane anesthesia

single pulse electrical stimuli targeted to MOs (superficial layers)

  • Size: 312.14 MB
  • 360 trials
  • BEHAVIORAL EPOCHS
    • awake: 154 valid and not running
    • isoflurane: 174 valid and not running
  • STIMULUS TYPES
    • electrical: 328 valid and not running
  • STIMULUS DESCRIPTIONS
    • biphasic: 328 valid and not running
  • ESTIM TARGET REGIONS
    • MOs: 328 valid and not running

Asset 2: sub-521886/sub-521886_ses-20200716_behavior+ecephys.nwb

in vivo electrophysiology in a head-fixed mouse during cortical electrical microstimulation

EEG recording during wakefulness and isoflurane anesthesia

single pulse electrical stimuli targeted to MOs (superficial layers)

  • Size: 504.31 MB
  • 900 trials
  • BEHAVIORAL EPOCHS
    • awake: 262 valid and not running
    • isoflurane: 300 valid and not running
    • recovery: 264 valid and not running
  • STIMULUS TYPES
    • electrical: 826 valid and not running
  • STIMULUS DESCRIPTIONS
    • biphasic: 826 valid and not running
  • ESTIM TARGET REGIONS
    • MOs: 826 valid and not running

Asset 3: sub-521887/sub-521887_ses-20200730_behavior+ecephys.nwb

in vivo electrophysiology in a head-fixed mouse during cortical electrical microstimulation

EEG recording during wakefulness and isoflurane anesthesia

single pulse electrical stimuli targeted to MOs (superficial layers)

  • Size: 428.19 MB
  • 800 trials
  • BEHAVIORAL EPOCHS
    • awake: 148 valid and not running
    • isoflurane: 300 valid and not running
    • recovery: 278 valid and not running
  • STIMULUS TYPES
    • electrical: 726 valid and not running
  • STIMULUS DESCRIPTIONS
    • biphasic: 726 valid and not running
  • ESTIM TARGET REGIONS
    • MOs: 726 valid and not running

Asset 4: sub-543393/sub-543393_ses-20200820_behavior+ecephys.nwb

in vivo electrophysiology in a head-fixed mouse during cortical electrical microstimulation

EEG and Neuropixels recording during wakefulness and isoflurane anesthesia

single pulse electrical stimuli targeted to MOs (superficial layers)

  • Size: 527.51 MB
  • 900 trials
  • BEHAVIORAL EPOCHS
    • awake: 246 valid and not running
    • isoflurane: 300 valid and not running
    • recovery: 276 valid and not running
  • STIMULUS TYPES
    • electrical: 822 valid and not running
  • STIMULUS DESCRIPTIONS
    • biphasic: 822 valid and not running
  • ESTIM TARGET REGIONS
    • MOs: 822 valid and not running

Asset 5: sub-543394/sub-543394_ses-20200827_behavior+ecephys.nwb

in vivo electrophysiology in a head-fixed mouse during cortical electrical microstimulation

EEG and Neuropixels recording during wakefulness and isoflurane anesthesia

single pulse electrical stimuli targeted to MOs (superficial layers)

  • Size: 589.19 MB
  • 900 trials
  • BEHAVIORAL EPOCHS
    • awake: 192 valid and not running
    • isoflurane: 300 valid and not running
    • recovery: 281 valid and not running
  • STIMULUS TYPES
    • electrical: 773 valid and not running
  • STIMULUS DESCRIPTIONS
    • biphasic: 773 valid and not running
  • ESTIM TARGET REGIONS
    • MOs: 773 valid and not running

Asset 6: sub-546655/sub-546655_ses-20201023_behavior+ecephys.nwb

in vivo electrophysiology in a head-fixed mouse during cortical electrical microstimulation

EEG and Neuropixels recording during wakefulness and isoflurane anesthesia

single pulse electrical stimuli targeted to MOs (deep layers)

  • Size: 14872.63 MB
  • 1459 trials
  • BEHAVIORAL EPOCHS
    • awake: 121 valid and not running
    • isoflurane: 397 valid and not running
    • recovery: 258 valid and not running
  • STIMULUS TYPES
    • electrical: 641 valid and not running
    • visual: 135 valid and not running
  • STIMULUS DESCRIPTIONS
    • biphasic: 641 valid and not running
    • white fullscreen: 135 valid and not running
  • ESTIM TARGET REGIONS
    • MOs: 641 valid and not running
    • n/a: 135 valid and not running

Asset 7: sub-551397/sub-551397_ses-20210211_behavior+ecephys.nwb

in vivo electrophysiology in a head-fixed mouse during cortical electrical microstimulation

EEG and Neuropixels recording during wakefulness and isoflurane anesthesia

single pulse electrical stimuli targeted to MOs (deep layers)

  • Size: 15202.44 MB
  • 1800 trials
  • BEHAVIORAL EPOCHS
    • awake: 386 valid and not running
    • isoflurane: 480 valid and not running
    • recovery: 553 valid and not running
  • STIMULUS TYPES
    • electrical: 1103 valid and not running
    • visual: 316 valid and not running
  • STIMULUS DESCRIPTIONS
    • biphasic: 1103 valid and not running
    • white circle: 316 valid and not running
  • ESTIM TARGET REGIONS
    • MOs: 1103 valid and not running
    • n/a: 316 valid and not running

Asset 8: sub-551399/sub-551399_ses-20210128_behavior+ecephys.nwb

in vivo electrophysiology in a head-fixed mouse during cortical electrical microstimulation

EEG and Neuropixels recording during wakefulness and isoflurane anesthesia

single pulse electrical stimuli targeted to MOs (deep layers)

  • Size: 11687.84 MB
  • 1440 trials
  • BEHAVIORAL EPOCHS
    • awake: 323 valid and not running
    • isoflurane: 359 valid and not running
    • recovery: 654 valid and not running
  • STIMULUS TYPES
    • electrical: 1336 valid and not running
  • STIMULUS DESCRIPTIONS
    • biphasic: 1336 valid and not running
  • ESTIM TARGET REGIONS
    • MOs: 1336 valid and not running

Asset 9: sub-569062/sub-569062_ses-20210218_behavior+ecephys.nwb

in vivo electrophysiology in a head-fixed mouse during cortical electrical microstimulation

EEG and Neuropixels recording during wakefulness and isoflurane anesthesia

single pulse electrical stimuli targeted to MOs (deep layers)

  • Size: 24829.25 MB
  • 1440 trials
  • BEHAVIORAL EPOCHS
    • awake: 398 valid and not running
    • isoflurane: 479 valid and not running
    • recovery: 449 valid and not running
  • STIMULUS TYPES
    • electrical: 985 valid and not running
    • visual: 341 valid and not running
  • STIMULUS DESCRIPTIONS
    • biphasic: 985 valid and not running
    • white circle: 341 valid and not running
  • ESTIM TARGET REGIONS
    • MOs: 985 valid and not running
    • n/a: 341 valid and not running

Asset 10: sub-569064/sub-569064_ses-20210408_behavior+ecephys.nwb

in vivo electrophysiology in a head-fixed mouse during cortical electrical microstimulation

EEG and Neuropixels recording during wakefulness and isoflurane anesthesia

single pulse electrical stimuli targeted to MOs (deep layers)

  • Size: 25890.18 MB
  • 1920 trials
  • BEHAVIORAL EPOCHS
    • awake: 468 valid and not running
    • isoflurane: 477 valid and not running
    • recovery: 877 valid and not running
  • STIMULUS TYPES
    • electrical: 1350 valid and not running
    • visual: 472 valid and not running
  • STIMULUS DESCRIPTIONS
    • biphasic: 1350 valid and not running
    • white circle: 472 valid and not running
  • ESTIM TARGET REGIONS
    • MOs: 1350 valid and not running
    • n/a: 472 valid and not running

Asset 11: sub-569068/sub-569068_ses-20210304_behavior+ecephys.nwb

in vivo electrophysiology in a head-fixed mouse during cortical electrical microstimulation

EEG and Neuropixels recording during wakefulness and isoflurane anesthesia

single pulse electrical stimuli targeted to MOs (deep layers)

  • Size: 27288.59 MB
  • 1800 trials
  • BEHAVIORAL EPOCHS
    • awake: 380 valid and not running
    • isoflurane: 477 valid and not running
    • recovery: 516 valid and not running
  • STIMULUS TYPES
    • electrical: 1119 valid and not running
    • visual: 254 valid and not running
  • STIMULUS DESCRIPTIONS
    • biphasic: 1119 valid and not running
    • white circle: 254 valid and not running
  • ESTIM TARGET REGIONS
    • MOs: 1119 valid and not running
    • n/a: 254 valid and not running

Asset 12: sub-569069/sub-569069_ses-20210312_behavior+ecephys.nwb

in vivo electrophysiology in a head-fixed mouse during cortical electrical microstimulation

EEG and Neuropixels recording during wakefulness and isoflurane anesthesia

single pulse electrical stimuli targeted to MOs (deep layers)

  • Size: 22471.66 MB
  • 1800 trials
  • BEHAVIORAL EPOCHS
    • awake: 309 valid and not running
    • isoflurane: 471 valid and not running
    • recovery: 658 valid and not running
  • STIMULUS TYPES
    • electrical: 1173 valid and not running
    • visual: 265 valid and not running
  • STIMULUS DESCRIPTIONS
    • biphasic: 1173 valid and not running
    • white circle: 265 valid and not running
  • ESTIM TARGET REGIONS
    • MOs: 1173 valid and not running
    • n/a: 265 valid and not running

Asset 13: sub-569070/sub-569070_ses-20210401_behavior+ecephys.nwb

in vivo electrophysiology in a head-fixed mouse during cortical electrical microstimulation

EEG and Neuropixels recording during wakefulness and isoflurane anesthesia

single pulse electrical stimuli targeted to MOs (deep layers)

  • Size: 1124.31 MB
  • 1440 trials
  • BEHAVIORAL EPOCHS
    • awake: 273 valid and not running
    • isoflurane: 360 valid and not running
    • recovery: 0 valid and not running
  • STIMULUS TYPES
    • electrical: 633 valid and not running
  • STIMULUS DESCRIPTIONS
    • biphasic: 633 valid and not running
  • ESTIM TARGET REGIONS
    • MOs: 633 valid and not running

Asset 14: sub-569072/sub-569072_ses-20210422_behavior+ecephys.nwb

in vivo electrophysiology in a head-fixed mouse during cortical electrical microstimulation

EEG and Neuropixels recording during wakefulness and isoflurane anesthesia

single pulse electrical stimuli targeted to SSp (deep layers)

  • Size: 13304.27 MB
  • 960 trials
  • BEHAVIORAL EPOCHS
    • awake: 430 valid and not running
    • isoflurane: 477 valid and not running
  • STIMULUS TYPES
    • electrical: 680 valid and not running
    • visual: 227 valid and not running
  • STIMULUS DESCRIPTIONS
    • biphasic: 680 valid and not running
    • white circle: 227 valid and not running
  • ESTIM TARGET REGIONS
    • SSp: 680 valid and not running
    • n/a: 227 valid and not running

Asset 15: sub-569073/sub-569073_ses-20210415_behavior+ecephys.nwb

in vivo electrophysiology in a head-fixed mouse during cortical electrical microstimulation

EEG and Neuropixels recording during wakefulness and isoflurane anesthesia

single pulse electrical stimuli targeted to MOs (deep layers)

  • Size: 26729.21 MB
  • 2040 trials
  • BEHAVIORAL EPOCHS
    • awake: 383 valid and not running
    • isoflurane: 600 valid and not running
    • recovery: 810 valid and not running
  • STIMULUS TYPES
    • electrical: 1279 valid and not running
    • visual: 514 valid and not running
  • STIMULUS DESCRIPTIONS
    • biphasic: 1279 valid and not running
    • white circle: 514 valid and not running
  • ESTIM TARGET REGIONS
    • MOs: 1279 valid and not running
    • n/a: 514 valid and not running

Asset 16: sub-569073/sub-569073_ses-20210416_behavior+ecephys.nwb

in vivo electrophysiology in a head-fixed mouse during cortical electrical microstimulation

EEG and Neuropixels recording during wakefulness and isoflurane anesthesia

single pulse electrical stimuli targeted to SSp (deep layers)

  • Size: 13200.52 MB
  • 720 trials
  • BEHAVIORAL EPOCHS
    • awake: 269 valid and not running
    • isoflurane: 360 valid and not running
  • STIMULUS TYPES
    • electrical: 629 valid and not running
  • STIMULUS DESCRIPTIONS
    • biphasic: 629 valid and not running
  • ESTIM TARGET REGIONS
    • SSp: 629 valid and not running

Asset 17: sub-571619/sub-571619_ses-20210319_behavior+ecephys.nwb

in vivo electrophysiology in a head-fixed mouse during cortical electrical microstimulation

EEG and Neuropixels recording during wakefulness and isoflurane anesthesia

single pulse electrical stimuli targeted to MOs (superficial and deep layers)

  • Size: 23171.96 MB
  • 1440 trials
  • BEHAVIORAL EPOCHS
    • awake: 577 valid and not running
    • isoflurane: 719 valid and not running
  • STIMULUS TYPES
    • electrical: 1296 valid and not running
  • STIMULUS DESCRIPTIONS
    • biphasic: 1296 valid and not running
  • ESTIM TARGET REGIONS
    • MOs: 1296 valid and not running

Asset 18: sub-571620/sub-571620_ses-20210513_behavior+ecephys.nwb

in vivo electrophysiology in a head-fixed mouse during cortical electrical microstimulation

EEG and Neuropixels recording during wakefulness and isoflurane anesthesia

single pulse electrical stimuli targeted to SSp (superficial and deep layers)

  • Size: 23246.55 MB
  • 1680 trials
  • BEHAVIORAL EPOCHS
    • awake: 811 valid and not running
    • isoflurane: 720 valid and not running
  • STIMULUS TYPES
    • electrical: 1306 valid and not running
    • visual: 225 valid and not running
  • STIMULUS DESCRIPTIONS
    • biphasic: 1306 valid and not running
    • white circle: 225 valid and not running
  • ESTIM TARGET REGIONS
    • SSp: 1306 valid and not running
    • n/a: 225 valid and not running

Asset 19: sub-575102/sub-575102_ses-20210603_behavior+ecephys.nwb

in vivo electrophysiology in a head-fixed mouse during cortical electrical microstimulation

EEG and Neuropixels recording during wakefulness and isoflurane anesthesia

single pulse electrical stimuli targeted to MOs (superficial layers)

  • Size: 24332.63 MB
  • 1882 trials
  • BEHAVIORAL EPOCHS
    • awake: 354 valid and not running
    • isoflurane: 480 valid and not running
    • recovery: 223 valid and not running
  • STIMULUS TYPES
    • electrical: 826 valid and not running
    • visual: 231 valid and not running
  • STIMULUS DESCRIPTIONS
    • biphasic: 826 valid and not running
    • white circle: 231 valid and not running
  • ESTIM TARGET REGIONS
    • MOs: 826 valid and not running
    • n/a: 231 valid and not running

Asset 20: sub-586466/sub-586466_ses-20210729_behavior+ecephys.nwb

in vivo electrophysiology in a head-fixed mouse during cortical electrical microstimulation

EEG and Neuropixels recording during wakefulness and isoflurane anesthesia

single pulse electrical stimuli targeted to SSp (superficial and deep layers)

  • Size: 14282.62 MB
  • 1680 trials
  • BEHAVIORAL EPOCHS
    • awake: 867 valid and not running
    • isoflurane: 712 valid and not running
  • STIMULUS TYPES
    • electrical: 1377 valid and not running
    • visual: 202 valid and not running
  • STIMULUS DESCRIPTIONS
    • biphasic: 1377 valid and not running
    • white circle: 202 valid and not running
  • ESTIM TARGET REGIONS
    • SSp: 1377 valid and not running
    • n/a: 202 valid and not running

Asset 21: sub-586468/sub-586468_ses-20210819_behavior+ecephys.nwb

in vivo electrophysiology in a head-fixed mouse during cortical electrical microstimulation

EEG and Neuropixels recording during wakefulness and isoflurane anesthesia

single pulse electrical stimuli targeted to SSp (superficial and deep layers)

  • Size: 22105.06 MB
  • 1680 trials
  • BEHAVIORAL EPOCHS
    • awake: 410 valid and not running
    • isoflurane: 360 valid and not running
  • STIMULUS TYPES
    • electrical: 650 valid and not running
    • visual: 120 valid and not running
  • STIMULUS DESCRIPTIONS
    • biphasic: 650 valid and not running
    • white circle: 120 valid and not running
  • ESTIM TARGET REGIONS
    • SSp: 650 valid and not running
    • n/a: 120 valid and not running

Asset 22: sub-590479/sub-590479_ses-20210921_behavior+ecephys.nwb

in vivo electrophysiology in a head-fixed mouse during cortical electrical microstimulation

EEG and Neuropixels recording during wakefulness and isoflurane anesthesia

single pulse electrical stimuli targeted to SSp (superficial and deep layers)

  • Size: 12027.34 MB
  • 1440 trials
  • BEHAVIORAL EPOCHS
    • awake: 593 valid and not running
    • isoflurane: 719 valid and not running
  • STIMULUS TYPES
    • electrical: 1312 valid and not running
  • STIMULUS DESCRIPTIONS
    • biphasic: 1312 valid and not running
  • ESTIM TARGET REGIONS
    • SSp: 1312 valid and not running

Asset 23: sub-590480/sub-590480_ses-20211111_behavior+ecephys.nwb

in vivo electrophysiology in a head-fixed mouse during cortical electrical microstimulation

EEG and Neuropixels recording during wakefulness and isoflurane anesthesia

single pulse electrical stimuli targeted to SSp (superficial and deep layers)

  • Size: 21088.74 MB
  • 1680 trials
  • BEHAVIORAL EPOCHS
    • awake: 473 valid and not running
    • isoflurane: 720 valid and not running
  • STIMULUS TYPES
    • electrical: 1028 valid and not running
    • visual: 165 valid and not running
  • STIMULUS DESCRIPTIONS
    • biphasic: 1028 valid and not running
    • white circle: 165 valid and not running
  • ESTIM TARGET REGIONS
    • SSp: 1028 valid and not running
    • n/a: 165 valid and not running

Asset 24: sub-599017/sub-599017_ses-20220210_behavior+ecephys.nwb

in vivo electrophysiology in a head-fixed mouse during cortical electrical microstimulation

EEG and Neuropixels recording during wakefulness and isoflurane anesthesia

single pulse electrical stimuli targeted to SSp (superficial and deep layers)

  • Size: 22265.17 MB
  • 1680 trials
  • BEHAVIORAL EPOCHS
    • awake: 254 valid and not running
    • isoflurane: 720 valid and not running
  • STIMULUS TYPES
    • electrical: 828 valid and not running
    • visual: 146 valid and not running
  • STIMULUS DESCRIPTIONS
    • biphasic: 828 valid and not running
    • white circle: 146 valid and not running
  • ESTIM TARGET REGIONS
    • SSp: 828 valid and not running
    • n/a: 146 valid and not running