{ "cells": [ { "cell_type": "markdown", "metadata": { "colab_type": "text", "execution": {}, "id": "view-in-github" }, "source": [ "\"Open   \"Open" ] }, { "cell_type": "markdown", "metadata": { "execution": {} }, "source": [ "## Loading of Steinmetz data\n", "\n", "includes some visualizations" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "execution": {} }, "outputs": [], "source": [ "import numpy as np\n", "import matplotlib.pyplot as plt" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "cellView": "form", "execution": {} }, "outputs": [], "source": [ "# @title Import matplotlib and set defaults\n", "from matplotlib import rcParams\n", "\n", "rcParams['figure.figsize'] = [20, 4]\n", "rcParams['font.size'] = 15\n", "rcParams['axes.spines.top'] = False\n", "rcParams['axes.spines.right'] = False\n", "rcParams['figure.autolayout'] = True" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "cellView": "form", "execution": {} }, "outputs": [], "source": [ "# @title Data retrieval\n", "import os, requests\n", "\n", "fname = ['steinmetz_st.npz']\n", "fname.append('steinmetz_wav.npz')\n", "fname.append('steinmetz_lfp.npz')\n", "\n", "url = [\"https://osf.io/4bjns/download\"]\n", "url.append(\"https://osf.io/ugm9v/download\")\n", "url.append(\"https://osf.io/kx3v9/download\")\n", "\n", "for j in range(len(url)):\n", " if not os.path.isfile(fname[j]):\n", " try:\n", " r = requests.get(url[j])\n", " except requests.ConnectionError:\n", " print(\"!!! Failed to download data !!!\")\n", " else:\n", " if r.status_code != requests.codes.ok:\n", " print(\"!!! Failed to download data !!!\")\n", " else:\n", " with open(fname[j], \"wb\") as fid:\n", " fid.write(r.content)" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "cellView": "form", "execution": {} }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "dict_keys(['lfp', 'lfp_passive', 'brain_area_lfp'])\n", "dict_keys(['waveform_w', 'waveform_u', 'trough_to_peak'])\n", "dict_keys(['ss', 'ss_passive'])\n" ] } ], "source": [ "# @title Data loading\n", "\n", "dat_LFP = np.load('steinmetz_lfp.npz', allow_pickle=True)['dat']\n", "dat_WAV = np.load('steinmetz_wav.npz', allow_pickle=True)['dat']\n", "dat_ST = np.load('steinmetz_st.npz', allow_pickle=True)['dat']\n", "\n", "# select just one of the recordings here. 11 is nice because it has some neurons in vis ctx.\n", "dat = dat_LFP[11]\n", "print(dat.keys())\n", "dat = dat_WAV[11]\n", "print(dat.keys())\n", "dat = dat_ST[11]\n", "print(dat.keys())" ] }, { "cell_type": "markdown", "metadata": { "execution": {} }, "source": [ "`dat_LFP`, `dat_WAV`, `dat_ST` contain 39 sessions from 10 mice, data from Steinmetz et al, 2019, supplemental to the main data provided for NMA. Time bins for all measurements are 10ms, starting 500ms before stimulus onset (same as the main data). The followin fields are available across the three supplemental files. \n", "\n", "* `dat['lfp']`: recording of the local field potential in each brain area from this experiment, binned at `10ms`.\n", "* `dat['brain_area_lfp']`: brain area names for the LFP channels. \n", "* `dat['trough_to_peak']`: measures the width of the action potential waveform for each neuron. Widths `<=10` samples are \"putative fast spiking neurons\". \n", "* `dat['waveform_w']`: temporal components of spike waveforms. `w@u` reconstructs the time by channels action potential shape. \n", "* `dat['waveform_u]`: spatial components of spike waveforms.\n", "* `dat['ss']`: neurons by trials. Exact spikes times for each neuron and each trial, reference to the stimulus onset. A (neuron,trial) entry can be an empty list if that neuron did not fire at all on that trial. \n", "* `dat['%X%_passive']`: same as above for `X` = {`lfp`, `ss`} but for passive trials at the end of the recording when the mouse was no longer engaged and stopped making responses. \n", "\n", "\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "execution": {} }, "outputs": [], "source": [ "# groupings of brain regions\n", "regions = [\"vis ctx\", \"thal\", \"hipp\", \"other ctx\", \"midbrain\", \"basal ganglia\", \"cortical subplate\", \"other\"]\n", "brain_groups = [[\"VISa\", \"VISam\", \"VISl\", \"VISp\", \"VISpm\", \"VISrl\"], # visual cortex\n", " [\"CL\", \"LD\", \"LGd\", \"LH\", \"LP\", \"MD\", \"MG\", \"PO\", \"POL\", \"PT\", \"RT\", \"SPF\", \"TH\", \"VAL\", \"VPL\", \"VPM\"], # thalamus\n", " [\"CA\", \"CA1\", \"CA2\", \"CA3\", \"DG\", \"SUB\", \"POST\"], # hippocampal\n", " [\"ACA\", \"AUD\", \"COA\", \"DP\", \"ILA\", \"MOp\", \"MOs\", \"OLF\", \"ORB\", \"ORBm\", \"PIR\", \"PL\", \"SSp\", \"SSs\", \"RSP\",\" TT\"], # non-visual cortex\n", " [\"APN\", \"IC\", \"MB\", \"MRN\", \"NB\", \"PAG\", \"RN\", \"SCs\", \"SCm\", \"SCig\", \"SCsg\", \"ZI\"], # midbrain\n", " [\"ACB\", \"CP\", \"GPe\", \"LS\", \"LSc\", \"LSr\", \"MS\", \"OT\", \"SNr\", \"SI\"], # basal ganglia\n", " [\"BLA\", \"BMA\", \"EP\", \"EPd\", \"MEA\"] # cortical subplate\n", " ]" ] } ], "metadata": { "colab": { "collapsed_sections": [], "include_colab_link": true, "name": "load_steinmetz_extra", "provenance": [], "toc_visible": true }, "kernel": { "display_name": "Python 3", "language": "python", "name": "python3" }, "kernelspec": { "display_name": "Python 3", "name": "python3" } }, "nbformat": 4, "nbformat_minor": 0 }