{"id":18496631,"url":"https://github.com/mouseland/stringer-pachitariu-et-al-2018a","last_synced_at":"2025-07-10T01:33:08.168Z","repository":{"id":53190851,"uuid":"130262484","full_name":"MouseLand/stringer-pachitariu-et-al-2018a","owner":"MouseLand","description":"Recordings of 10k neurons during spontaneous behaviors","archived":false,"fork":false,"pushed_at":"2024-03-22T20:20:08.000Z","size":5987,"stargazers_count":47,"open_issues_count":4,"forks_count":15,"subscribers_count":14,"default_branch":"master","last_synced_at":"2024-05-10T18:39:39.859Z","etag":null,"topics":["neuroscience","openscience"],"latest_commit_sha":null,"homepage":"","language":"MATLAB","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MouseLand.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-04-19T19:24:45.000Z","updated_at":"2024-03-21T17:43:07.000Z","dependencies_parsed_at":"2023-01-27T23:15:22.373Z","dependency_job_id":null,"html_url":"https://github.com/MouseLand/stringer-pachitariu-et-al-2018a","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MouseLand%2Fstringer-pachitariu-et-al-2018a","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MouseLand%2Fstringer-pachitariu-et-al-2018a/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MouseLand%2Fstringer-pachitariu-et-al-2018a/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MouseLand%2Fstringer-pachitariu-et-al-2018a/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MouseLand","download_url":"https://codeload.github.com/MouseLand/stringer-pachitariu-et-al-2018a/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223346528,"owners_count":17130456,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["neuroscience","openscience"],"created_at":"2024-11-06T13:30:20.286Z","updated_at":"2024-11-06T13:32:29.948Z","avatar_url":"https://github.com/MouseLand.png","language":"MATLAB","funding_links":[],"categories":[],"sub_categories":[],"readme":"# stringer-pachitariu-et-al-2018a\n[![DOI](https://zenodo.org/badge/130262484.svg)](https://zenodo.org/badge/latestdoi/130262484)\n\n\nThis code produces the figures from Stringer, Pachitariu et al, 2018a:\n\nCarsen Stringer, Marius Pachitariu, Nicholas Steinmetz, Charu Bai Reddy, Matteo Carandini, Kenneth D. Harris\n**Spontaneous behaviors drive multidimensional, brain-wide population activity**\nhttps://www.biorxiv.org/content/10.1101/306019v2\n\nIt relies on data deposited on figshare at:\n\nCarsen Stringer, Marius Pachitariu, Charu Bai Reddy, Matteo Carandini, Kenneth D. Harris\n**Recordings of ten thousand neurons in visual cortex during spontaneous behaviors.** ([link](https://figshare.com/articles/Recordings_of_ten_thousand_neurons_in_visual_cortex_during_spontaneous_behaviors/6163622))\n\nand\n\nNicholas Steinmetz, Marius Pachitariu, Carsen Stringer, Matteo Carandini, Kenneth D. Harris\n**Eight probe neuropixels recordings during spontaneous behaviors.** ([link](https://figshare.com/articles/Eight-probe_Neuropixels_recordings_during_spontaneous_behaviors/7739750))\n\nHere's the two-photon data [description](dataSharing.pdf). Please cite the paper and the figshare if you use the data.\n\nThe script 'processData.m' processes all the data. Set useGPU=0 if you do not have a GPU. The script 'mainFigs.m' calls all figure-producing scripts. \n\nWhile this is useful for reproducing the paper, it does not easily allow building on the main analysis we do, or running these analyses on different data. Therefore, we will add separate scripts to run analyses one at at time, with the data clearly loaded at the top of the script, so you can swap yours in. \n\nOne such function that is easy to use is 'SVCA.m' which computes the cross-validated reliable variance of latent dimensions in the population activity.\n\n### How to load the 2P data into python ###\n```\nimport scipy.io as sio\nimport numpy as np\nmt = sio.loadmat('spont_M150824_MP019_2016-04-05.mat')\nspks = mt[‘Fsp’]                   # neurons by timepoints\nmed = mt[‘med’]                 # cell centers (X Y Z)\n\n### behavioral measures\nrunSpeed = mt[‘beh’][‘runSpeed’]    # running speed\n# get motion SVDs (time x components)\nmotionSVD=np.array(mt['beh'][0]['face'][0]['motionSVD'][0][0])  \n# get motion masks (pixelY x pixelX x components)\nmotionMask=np.array(mt['beh'][0]['face'][0]['motionMask’][0][0])     \n# pupil area and com\npupilArea =np.array(mt['beh'][0]['pupil'][0][‘area'][0][0])  \npupilCOM =np.array(mt['beh'][0]['pupil'][0][‘com'][0][0])  \n\n# cell statistics\nmt[‘stat’][0]     # first cell’s stats\nmt[‘stat’][0][‘npix’]       # one example field, tells you how pixels make up the cell\n```\n\n### How to load the ephys data into python ###\n```\nfrom scipy import io\n\nprobeLoc = io.loadmat('/home/carsen/dm11/data/Spikes/eightprobes/probeLocations.mat')\nprobeBorders = io.loadmat('/home/carsen/dm11/data/Spikes/eightprobes/probeBorders.mat', squeeze_me=True)\n\nmouse_names = ['Krebs','Waksman','Robbins']\n# start of spontaneous activity in each mouse (in seconds)\ntstart = [3811 3633 3323];\n\nimouse = 0\n\nspks = io.loadmat('/home/carsen/dm11/data/Spikes/eightprobes/spks/spks%s_Feb18.mat'%mouse_names[imouse], squeeze_me=True)\nfaces = io.loadmat('/home/carsen/dm11/data/Spikes/eightprobes/faces/%s_face_proc.mat'%mouse_names[imouse], squeeze_me=True)\n\n# probe k\nk = 0\n# spike times (in seconds)\nst = spks['spks'][k][0]\n# clusters\nclu = spks['spks'][k][1]\n# cluster heights (in microns)\n# (see siteCoords to convert to site location)\nWh = spks['spks'][k][2]\n\n# processed faces\nmotSVD = faces['motionSVD']\nvideo_timestamps = faces['times']\n\n# where is the probe in the brain (consolidated labels)\n# borders are in microns\n# use Wh to determine which clusters are in which brain region\nborders = probeBorders['probeBorders'][imouse]['borders'][k]\nfor j in range(len(borders)):\n   b = borders[j]\n   print('upper border %d, lower border %d, area %s'%(b[0],b[1],b[2]))\n   wneurons = np.logical_and(Wh\u003e=b[1], Wh\u003cb[0])\n   nn = wneurons.sum()\n   print('%d neurons in %s'%(nn,b[-1]))\n   \n# where is the probe in the brain (in microns)\nccfCoords = probeLoc['probeLocations'][0][imouse]['probe'][k][0]['ccfCoords']\n# name of area in Allen ontology by site on electrode\nccfNames = probeLoc['probeLocations'][0][imouse]['probe'][k][0]['ccfOntology']\n# coordinates of each site on the electrode\nsiteCoords = probeLoc['probeLocations'][0][imouse]['probe'][k][0]['siteCoords']\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmouseland%2Fstringer-pachitariu-et-al-2018a","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmouseland%2Fstringer-pachitariu-et-al-2018a","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmouseland%2Fstringer-pachitariu-et-al-2018a/lists"}