1395 lines
667 KiB
Plaintext
1395 lines
667 KiB
Plaintext
|
{
|
||
|
"cells": [
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 1,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"%load_ext autoreload\n",
|
||
|
"%autoreload 2"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 2,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"name": "stderr",
|
||
|
"output_type": "stream",
|
||
|
"text": [
|
||
|
"14:34:31 [I] klustakwik KlustaKwik2 version 0.2.6\n"
|
||
|
]
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"import os\n",
|
||
|
"import expipe\n",
|
||
|
"import pathlib\n",
|
||
|
"import numpy as np\n",
|
||
|
"import spatial_maps.stats as stats\n",
|
||
|
"import septum_mec.analysis.data_processing as dp\n",
|
||
|
"from septum_mec.analysis.registration import store_notebook\n",
|
||
|
"import head_direction.head as head\n",
|
||
|
"import spatial_maps as sp\n",
|
||
|
"import pnnmec.registration\n",
|
||
|
"import speed_cells.speed as spd\n",
|
||
|
"import re\n",
|
||
|
"import joblib\n",
|
||
|
"import multiprocessing\n",
|
||
|
"import shutil\n",
|
||
|
"import psutil\n",
|
||
|
"import pandas as pd\n",
|
||
|
"import matplotlib.pyplot as plt\n",
|
||
|
"import pnnmec\n",
|
||
|
"import scipy.ndimage.measurements\n",
|
||
|
"import quantities as pq\n",
|
||
|
"import exdir\n",
|
||
|
"from tqdm import tqdm_notebook as tqdm\n",
|
||
|
"from septum_mec.analysis.trackunitmulticomparison import TrackMultipleSessions\n",
|
||
|
"import networkx as nx\n",
|
||
|
"from nxpd import draw\n",
|
||
|
"%matplotlib inline"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 307,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"project_path = dp.project_path()\n",
|
||
|
"\n",
|
||
|
"project = expipe.get_project(project_path)\n",
|
||
|
"actions = project.actions"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 308,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"identify_neurons = project.require_action('identify-neurons')"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 309,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
|
"text/plain": [
|
||
|
"{'users': ['Charlotte'],\n",
|
||
|
" 'tags': ['11hz', 'open-ephys', 'septum'],\n",
|
||
|
" 'datetime': '2019-07-01T12:54:49',\n",
|
||
|
" 'type': 'Recording',\n",
|
||
|
" 'registered': '2019-07-02T14:53:28',\n",
|
||
|
" 'data': {'main': 'main.exdir'},\n",
|
||
|
" 'location': 'IMB',\n",
|
||
|
" 'entities': ['1833']}"
|
||
|
]
|
||
|
},
|
||
|
"execution_count": 309,
|
||
|
"metadata": {},
|
||
|
"output_type": "execute_result"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"actions['1833-010719-2'].attributes"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 310,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
|
"text/plain": [
|
||
|
"{'users': ['Charlotte'],\n",
|
||
|
" 'tags': ['baseline I', 'open-ephys', 'septum'],\n",
|
||
|
" 'datetime': '2019-07-01T12:25:01',\n",
|
||
|
" 'type': 'Recording',\n",
|
||
|
" 'registered': '2019-07-02T14:53:03',\n",
|
||
|
" 'data': {'main': 'main.exdir'},\n",
|
||
|
" 'location': 'IMB',\n",
|
||
|
" 'entities': ['1833']}"
|
||
|
]
|
||
|
},
|
||
|
"execution_count": 310,
|
||
|
"metadata": {},
|
||
|
"output_type": "execute_result"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"actions['1833-010719-1'].attributes"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 311,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"data_loader = dp.Data()"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 313,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"sessions = []\n",
|
||
|
"for action in actions.values():\n",
|
||
|
" if action.type != 'Recording':\n",
|
||
|
" continue\n",
|
||
|
" action_data_path = pathlib.Path(action.data_path('main'))\n",
|
||
|
" processing = exdir.File(action_data_path)['processing']\n",
|
||
|
" if not 'electrophysiology' in processing:\n",
|
||
|
" continue\n",
|
||
|
" elphys = processing['electrophysiology']\n",
|
||
|
" if 'spikesorting' not in elphys:\n",
|
||
|
" continue\n",
|
||
|
" tags = [t.lower() for t in action.tags]\n",
|
||
|
" \n",
|
||
|
" freq = np.nan\n",
|
||
|
" stimulated = False\n",
|
||
|
" control = False\n",
|
||
|
" \n",
|
||
|
" stim_times = data_loader.stim_times(action.id)\n",
|
||
|
" if stim_times is not None:\n",
|
||
|
" stimulated = True\n",
|
||
|
" freq = round(1 / np.mean(np.diff(stim_times)))\n",
|
||
|
" \n",
|
||
|
" \n",
|
||
|
" tag = \"\"\n",
|
||
|
" stim_location = \"\"\n",
|
||
|
" tag_i = [i for i, t in enumerate(tags) if 'baseline' in t or 'stim' in t]\n",
|
||
|
" if len(tag_i) == 1:\n",
|
||
|
" tag = tags[tag_i[0]]\n",
|
||
|
" if 'stim' in tag:\n",
|
||
|
" stim_location = tag.split('-')[-1]\n",
|
||
|
" elif 'baseline' in tag:\n",
|
||
|
" control = True\n",
|
||
|
" \n",
|
||
|
" \n",
|
||
|
"\n",
|
||
|
" sessions.append({\n",
|
||
|
" 'tag': tag,\n",
|
||
|
" 'action': action.id,\n",
|
||
|
" 'stimulated': stimulated,\n",
|
||
|
" 'control': control,\n",
|
||
|
" 'frequency': freq,\n",
|
||
|
" 'session': int(action.id.split('-')[-1]),\n",
|
||
|
" 'stim_location': stim_location,\n",
|
||
|
" 'entity': int(action.entities[0]),\n",
|
||
|
"\n",
|
||
|
" })\n",
|
||
|
"sessions = pd.DataFrame(sessions)"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 316,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
|
"text/html": [
|
||
|
"<div>\n",
|
||
|
"<style scoped>\n",
|
||
|
" .dataframe tbody tr th:only-of-type {\n",
|
||
|
" vertical-align: middle;\n",
|
||
|
" }\n",
|
||
|
"\n",
|
||
|
" .dataframe tbody tr th {\n",
|
||
|
" vertical-align: top;\n",
|
||
|
" }\n",
|
||
|
"\n",
|
||
|
" .dataframe thead th {\n",
|
||
|
" text-align: right;\n",
|
||
|
" }\n",
|
||
|
"</style>\n",
|
||
|
"<table border=\"1\" class=\"dataframe\">\n",
|
||
|
" <thead>\n",
|
||
|
" <tr style=\"text-align: right;\">\n",
|
||
|
" <th></th>\n",
|
||
|
" <th>action</th>\n",
|
||
|
" <th>control</th>\n",
|
||
|
" <th>entity</th>\n",
|
||
|
" <th>frequency</th>\n",
|
||
|
" <th>session</th>\n",
|
||
|
" <th>stim_location</th>\n",
|
||
|
" <th>stimulated</th>\n",
|
||
|
" <th>tag</th>\n",
|
||
|
" </tr>\n",
|
||
|
" </thead>\n",
|
||
|
" <tbody>\n",
|
||
|
" <tr>\n",
|
||
|
" <th>1</th>\n",
|
||
|
" <td>1839-120619-4</td>\n",
|
||
|
" <td>False</td>\n",
|
||
|
" <td>1839</td>\n",
|
||
|
" <td>30.0 Hz</td>\n",
|
||
|
" <td>4</td>\n",
|
||
|
" <td></td>\n",
|
||
|
" <td>True</td>\n",
|
||
|
" <td></td>\n",
|
||
|
" </tr>\n",
|
||
|
" <tr>\n",
|
||
|
" <th>3</th>\n",
|
||
|
" <td>1839-060619-3</td>\n",
|
||
|
" <td>False</td>\n",
|
||
|
" <td>1839</td>\n",
|
||
|
" <td>11.0 Hz</td>\n",
|
||
|
" <td>3</td>\n",
|
||
|
" <td></td>\n",
|
||
|
" <td>True</td>\n",
|
||
|
" <td></td>\n",
|
||
|
" </tr>\n",
|
||
|
" <tr>\n",
|
||
|
" <th>5</th>\n",
|
||
|
" <td>1834-120319-4</td>\n",
|
||
|
" <td>False</td>\n",
|
||
|
" <td>1834</td>\n",
|
||
|
" <td>30.0 Hz</td>\n",
|
||
|
" <td>4</td>\n",
|
||
|
" <td></td>\n",
|
||
|
" <td>True</td>\n",
|
||
|
" <td></td>\n",
|
||
|
" </tr>\n",
|
||
|
" <tr>\n",
|
||
|
" <th>6</th>\n",
|
||
|
" <td>1849-280219-4</td>\n",
|
||
|
" <td>False</td>\n",
|
||
|
" <td>1849</td>\n",
|
||
|
" <td>30.0 Hz</td>\n",
|
||
|
" <td>4</td>\n",
|
||
|
" <td>ms</td>\n",
|
||
|
" <td>True</td>\n",
|
||
|
" <td>stim-ms</td>\n",
|
||
|
" </tr>\n",
|
||
|
" <tr>\n",
|
||
|
" <th>7</th>\n",
|
||
|
" <td>1849-110319-2</td>\n",
|
||
|
" <td>False</td>\n",
|
||
|
" <td>1849</td>\n",
|
||
|
" <td>11.0 Hz</td>\n",
|
||
|
" <td>2</td>\n",
|
||
|
" <td></td>\n",
|
||
|
" <td>True</td>\n",
|
||
|
" <td></td>\n",
|
||
|
" </tr>\n",
|
||
|
" <tr>\n",
|
||
|
" <th>9</th>\n",
|
||
|
" <td>1834-220319-2</td>\n",
|
||
|
" <td>False</td>\n",
|
||
|
" <td>1834</td>\n",
|
||
|
" <td>11.0 Hz</td>\n",
|
||
|
" <td>2</td>\n",
|
||
|
" <td></td>\n",
|
||
|
" <td>True</td>\n",
|
||
|
" <td></td>\n",
|
||
|
" </tr>\n",
|
||
|
" <tr>\n",
|
||
|
" <th>11</th>\n",
|
||
|
" <td>1833-020719-4</td>\n",
|
||
|
" <td>False</td>\n",
|
||
|
" <td>1833</td>\n",
|
||
|
" <td>30.0 Hz</td>\n",
|
||
|
" <td>4</td>\n",
|
||
|
" <td></td>\n",
|
||
|
" <td>True</td>\n",
|
||
|
" <td></td>\n",
|
||
|
" </tr>\n",
|
||
|
" <tr>\n",
|
||
|
" <th>12</th>\n",
|
||
|
" <td>1834-120319-2</td>\n",
|
||
|
" <td>False</td>\n",
|
||
|
" <td>1834</td>\n",
|
||
|
" <td>11.0 Hz</td>\n",
|
||
|
" <td>2</td>\n",
|
||
|
" <td></td>\n",
|
||
|
" <td>True</td>\n",
|
||
|
" <td></td>\n",
|
||
|
" </tr>\n",
|
||
|
" <tr>\n",
|
||
|
" <th>15</th>\n",
|
||
|
" <td>1834-150319-4</td>\n",
|
||
|
" <td>False</td>\n",
|
||
|
" <td>1834</td>\n",
|
||
|
" <td>30.0 Hz</td>\n",
|
||
|
" <td>4</td>\n",
|
||
|
" <td></td>\n",
|
||
|
" <td>True</td>\n",
|
||
|
" <td></td>\n",
|
||
|
" </tr>\n",
|
||
|
" <tr>\n",
|
||
|
" <th>16</th>\n",
|
||
|
" <td>1834-220319-4</td>\n",
|
||
|
" <td>False</td>\n",
|
||
|
" <td>1834</td>\n",
|
||
|
" <td>30.0 Hz</td>\n",
|
||
|
" <td>4</td>\n",
|
||
|
" <td></td>\n",
|
||
|
" <td>True</td>\n",
|
||
|
" <td></td>\n",
|
||
|
" </tr>\n",
|
||
|
" <tr>\n",
|
||
|
" <th>19</th>\n",
|
||
|
" <td>1833-260619-2</td>\n",
|
||
|
" <td>False</td>\n",
|
||
|
" <td>1833</td>\n",
|
||
|
" <td>11.0 Hz</td>\n",
|
||
|
" <td>2</td>\n",
|
||
|
" <td></td>\n",
|
||
|
" <td>True</td>\n",
|
||
|
" <td></td>\n",
|
||
|
" </tr>\n",
|
||
|
" <tr>\n",
|
||
|
" <th>20</th>\n",
|
||
|
" <td>1849-010319-4</td>\n",
|
||
|
" <td>False</td>\n",
|
||
|
" <td>1849</td>\n",
|
||
|
" <td>11.0 Hz</td>\n",
|
||
|
" <td>4</td>\n",
|
||
|
" <td>mecr</td>\n",
|
||
|
" <td>True</td>\n",
|
||
|
" <td>stim-mecr</td>\n",
|
||
|
" </tr>\n",
|
||
|
" <tr>\n",
|
||
|
" <th>22</th>\n",
|
||
|
" <td>1833-200619-4</td>\n",
|
||
|
" <td>False</td>\n",
|
||
|
" <td>1833</td>\n",
|
||
|
" <td>30.0 Hz</td>\n",
|
||
|
" <td>4</td>\n",
|
||
|
" <td></td>\n",
|
||
|
" <td>True</td>\n",
|
||
|
" <td></td>\n",
|
||
|
" </tr>\n",
|
||
|
" <tr>\n",
|
||
|
" <th>23</th>\n",
|
||
|
" <td>1849-220319-3</td>\n",
|
||
|
" <td>False</td>\n",
|
||
|
" <td>1849</td>\n",
|
||
|
" <td>11.0 Hz</td>\n",
|
||
|
" <td>3</td>\n",
|
||
|
" <td></td>\n",
|
||
|
" <td>True</td>\n",
|
||
|
" <td></td>\n",
|
||
|
" </tr>\n",
|
||
|
" <tr>\n",
|
||
|
" <th>28</th>\n",
|
||
|
" <td>1834-150319-2</td>\n",
|
||
|
" <td>False</td>\n",
|
||
|
" <td>1834</td>\n",
|
||
|
" <td>11.0 Hz</td>\n",
|
||
|
" <td>2</td>\n",
|
||
|
" <td></td>\n",
|
||
|
" <td>True</td>\n",
|
||
|
" <td></td>\n",
|
||
|
" </tr>\n",
|
||
|
" <tr>\n",
|
||
|
" <th>30</th>\n",
|
||
|
" <td>1839-290519-2</td>\n",
|
||
|
" <td>False</td>\n",
|
||
|
" <td>1839</td>\n",
|
||
|
" <td>11.0 Hz</td>\n",
|
||
|
" <td>2</td>\n",
|
||
|
" <td></td>\n",
|
||
|
" <td>True</td>\n",
|
||
|
" <td></td>\n",
|
||
|
" </tr>\n",
|
||
|
" <tr>\n",
|
||
|
" <th>32</th>\n",
|
||
|
" <td>1834-010319-5</td>\n",
|
||
|
" <td>False</td>\n",
|
||
|
" <td>1834</td>\n",
|
||
|
" <td>30.0 Hz</td>\n",
|
||
|
" <td>5</td>\n",
|
||
|
" <td>ms</td>\n",
|
||
|
" <td>True</td>\n",
|
||
|
" <td>stim-ms</td>\n",
|
||
|
" </tr>\n",
|
||
|
" <tr>\n",
|
||
|
" <th>37</th>\n",
|
||
|
" <td>1849-150319-2</td>\n",
|
||
|
" <td>False</td>\n",
|
||
|
" <td>1849</td>\n",
|
||
|
" <td>11.0 Hz</td>\n",
|
||
|
" <td>2</td>\n",
|
||
|
" <td></td>\n",
|
||
|
" <td>True</td>\n",
|
||
|
" <td></td>\n",
|
||
|
" </tr>\n",
|
||
|
" <tr>\n",
|
||
|
" <th>38</th>\n",
|
||
|
" <td>1849-280219-2</td>\n",
|
||
|
" <td>False</td>\n",
|
||
|
" <td>1849</td>\n",
|
||
|
" <td>11.0 Hz</td>\n",
|
||
|
" <td>2</td>\n",
|
||
|
" <td>ms</td>\n",
|
||
|
" <td>True</td>\n",
|
||
|
" <td>stim-ms</td>\n",
|
||
|
" </tr>\n",
|
||
|
" <tr>\n",
|
||
|
" <th>43</th>\n",
|
||
|
" <td>1849-060319-4</td>\n",
|
||
|
" <td>False</td>\n",
|
||
|
" <td>1849</td>\n",
|
||
|
" <td>30.0 Hz</td>\n",
|
||
|
" <td>4</td>\n",
|
||
|
" <td>ms</td>\n",
|
||
|
" <td>True</td>\n",
|
||
|
" <td>stim-ms</td>\n",
|
||
|
" </tr>\n",
|
||
|
" <tr>\n",
|
||
|
" <th>44</th>\n",
|
||
|
" <td>1834-010319-3</td>\n",
|
||
|
" <td>False</td>\n",
|
||
|
" <td>1834</td>\n",
|
||
|
" <td>11.0 Hz</td>\n",
|
||
|
" <td>3</td>\n",
|
||
|
" <td>ms</td>\n",
|
||
|
" <td>True</td>\n",
|
||
|
" <td>stim-ms</td>\n",
|
||
|
" </tr>\n",
|
||
|
" <tr>\n",
|
||
|
" <th>45</th>\n",
|
||
|
" <td>1833-050619-2</td>\n",
|
||
|
" <td>False</td>\n",
|
||
|
" <td>1833</td>\n",
|
||
|
" <td>11.0 Hz</td>\n",
|
||
|
" <td>2</td>\n",
|
||
|
" <td></td>\n",
|
||
|
" <td>True</td>\n",
|
||
|
" <td></td>\n",
|
||
|
" </tr>\n",
|
||
|
" <tr>\n",
|
||
|
" <th>47</th>\n",
|
||
|
" <td>1833-120619-2</td>\n",
|
||
|
" <td>False</td>\n",
|
||
|
" <td>1833</td>\n",
|
||
|
" <td>11.0 Hz</td>\n",
|
||
|
" <td>2</td>\n",
|
||
|
" <td></td>\n",
|
||
|
" <td>True</td>\n",
|
||
|
" <td></td>\n",
|
||
|
" </tr>\n",
|
||
|
" <tr>\n",
|
||
|
" <th>50</th>\n",
|
||
|
" <td>1849-010319-5</td>\n",
|
||
|
" <td>False</td>\n",
|
||
|
" <td>1849</td>\n",
|
||
|
" <td>11.0 Hz</td>\n",
|
||
|
" <td>5</td>\n",
|
||
|
" <td>mecl</td>\n",
|
||
|
" <td>True</td>\n",
|
||
|
" <td>stim-mecl</td>\n",
|
||
|
" </tr>\n",
|
||
|
" <tr>\n",
|
||
|
" <th>51</th>\n",
|
||
|
" <td>1849-150319-4</td>\n",
|
||
|
" <td>False</td>\n",
|
||
|
" <td>1849</td>\n",
|
||
|
" <td>30.0 Hz</td>\n",
|
||
|
" <td>4</td>\n",
|
||
|
" <td></td>\n",
|
||
|
" <td>True</td>\n",
|
||
|
" <td></td>\n",
|
||
|
" </tr>\n",
|
||
|
" <tr>\n",
|
||
|
" <th>52</th>\n",
|
||
|
" <td>1834-060319-4</td>\n",
|
||
|
" <td>False</td>\n",
|
||
|
" <td>1834</td>\n",
|
||
|
" <td>30.0 Hz</td>\n",
|
||
|
" <td>4</td>\n",
|
||
|
" <td>ms</td>\n",
|
||
|
" <td>True</td>\n",
|
||
|
" <td>stim-ms</td>\n",
|
||
|
" </tr>\n",
|
||
|
" <tr>\n",
|
||
|
" <th>53</th>\n",
|
||
|
" <td>1834-060319-2</td>\n",
|
||
|
" <td>False</td>\n",
|
||
|
" <td>1834</td>\n",
|
||
|
" <td>11.0 Hz</td>\n",
|
||
|
" <td>2</td>\n",
|
||
|
" <td>ms</td>\n",
|
||
|
" <td>True</td>\n",
|
||
|
" <td>stim-ms</td>\n",
|
||
|
" </tr>\n",
|
||
|
" <tr>\n",
|
||
|
" <th>56</th>\n",
|
||
|
" <td>1849-060319-2</td>\n",
|
||
|
" <td>False</td>\n",
|
||
|
" <td>1849</td>\n",
|
||
|
" <td>11.0 Hz</td>\n",
|
||
|
" <td>2</td>\n",
|
||
|
" <td>ms</td>\n",
|
||
|
" <td>True</td>\n",
|
||
|
" <td>stim-ms</td>\n",
|
||
|
" </tr>\n",
|
||
|
" <tr>\n",
|
||
|
" <th>60</th>\n",
|
||
|
" <td>1834-110319-2</td>\n",
|
||
|
" <td>False</td>\n",
|
||
|
" <td>1834</td>\n",
|
||
|
" <td>11.0 Hz</td>\n",
|
||
|
" <td>2</td>\n",
|
||
|
" <td></td>\n",
|
||
|
" <td>True</td>\n",
|
||
|
" <td></td>\n",
|
||
|
" </tr>\n",
|
||
|
" <tr>\n",
|
||
|
" <th>61</th>\n",
|
||
|
" <td>1833-020719-2</td>\n",
|
||
|
" <td>False</td>\n",
|
||
|
" <td>1833</td>\n",
|
||
|
" <td>11.0 Hz</td>\n",
|
||
|
" <td>2</td>\n",
|
||
|
" <td></td>\n",
|
||
|
" <td>True</td>\n",
|
||
|
" <td></td>\n",
|
||
|
" </tr>\n",
|
||
|
" <tr>\n",
|
||
|
" <th>63</th>\n",
|
||
|
" <td>1833-050619-4</td>\n",
|
||
|
" <td>False</td>\n",
|
||
|
" <td>1833</td>\n",
|
||
|
" <td>30.0 Hz</td>\n",
|
||
|
" <td>4</td>\n",
|
||
|
" <td></td>\n",
|
||
|
" <td>True</td>\n",
|
||
|
" <td></td>\n",
|
||
|
" </tr>\n",
|
||
|
" <tr>\n",
|
||
|
" <th>64</th>\n",
|
||
|
" <td>1833-260619-4</td>\n",
|
||
|
" <td>False</td>\n",
|
||
|
" <td>1833</td>\n",
|
||
|
" <td>30.0 Hz</td>\n",
|
||
|
" <td>4</td>\n",
|
||
|
" <td></td>\n",
|
||
|
" <td>True</td>\n",
|
||
|
" <td></td>\n",
|
||
|
" </tr>\n",
|
||
|
" <tr>\n",
|
||
|
" <th>65</th>\n",
|
||
|
" <td>1833-200619-2</td>\n",
|
||
|
" <td>False</td>\n",
|
||
|
" <td>1833</td>\n",
|
||
|
" <td>11.0 Hz</td>\n",
|
||
|
" <td>2</td>\n",
|
||
|
" <td></td>\n",
|
||
|
" <td>True</td>\n",
|
||
|
" <td></td>\n",
|
||
|
" </tr>\n",
|
||
|
" <tr>\n",
|
||
|
" <th>67</th>\n",
|
||
|
" <td>1833-120619-4</td>\n",
|
||
|
" <td>False</td>\n",
|
||
|
" <td>1833</td>\n",
|
||
|
" <td>30.0 Hz</td>\n",
|
||
|
" <td>4</td>\n",
|
||
|
" <td></td>\n",
|
||
|
" <td>True</td>\n",
|
||
|
" <td></td>\n",
|
||
|
" </tr>\n",
|
||
|
" <tr>\n",
|
||
|
" <th>68</th>\n",
|
||
|
" <td>1833-290519-4</td>\n",
|
||
|
" <td>False</td>\n",
|
||
|
" <td>1833</td>\n",
|
||
|
" <td>30.0 Hz</td>\n",
|
||
|
" <td>4</td>\n",
|
||
|
" <td></td>\n",
|
||
|
" <td>True</td>\n",
|
||
|
" <td></td>\n",
|
||
|
" </tr>\n",
|
||
|
" <tr>\n",
|
||
|
" <th>70</th>\n",
|
||
|
" <td>1839-060619-5</td>\n",
|
||
|
" <td>False</td>\n",
|
||
|
" <td>1839</td>\n",
|
||
|
" <td>30.0 Hz</td>\n",
|
||
|
" <td>5</td>\n",
|
||
|
" <td></td>\n",
|
||
|
" <td>True</td>\n",
|
||
|
" <td></td>\n",
|
||
|
" </tr>\n",
|
||
|
" <tr>\n",
|
||
|
" <th>74</th>\n",
|
||
|
" <td>1833-290519-2</td>\n",
|
||
|
" <td>False</td>\n",
|
||
|
" <td>1833</td>\n",
|
||
|
" <td>11.0 Hz</td>\n",
|
||
|
" <td>2</td>\n",
|
||
|
" <td></td>\n",
|
||
|
" <td>True</td>\n",
|
||
|
" <td></td>\n",
|
||
|
" </tr>\n",
|
||
|
" <tr>\n",
|
||
|
" <th>75</th>\n",
|
||
|
" <td>1833-060619-2</td>\n",
|
||
|
" <td>False</td>\n",
|
||
|
" <td>1833</td>\n",
|
||
|
" <td>30.0 Hz</td>\n",
|
||
|
" <td>2</td>\n",
|
||
|
" <td></td>\n",
|
||
|
" <td>True</td>\n",
|
||
|
" <td></td>\n",
|
||
|
" </tr>\n",
|
||
|
" <tr>\n",
|
||
|
" <th>76</th>\n",
|
||
|
" <td>1839-120619-2</td>\n",
|
||
|
" <td>False</td>\n",
|
||
|
" <td>1839</td>\n",
|
||
|
" <td>11.0 Hz</td>\n",
|
||
|
" <td>2</td>\n",
|
||
|
" <td></td>\n",
|
||
|
" <td>True</td>\n",
|
||
|
" <td></td>\n",
|
||
|
" </tr>\n",
|
||
|
" <tr>\n",
|
||
|
" <th>77</th>\n",
|
||
|
" <td>1849-220319-5</td>\n",
|
||
|
" <td>False</td>\n",
|
||
|
" <td>1849</td>\n",
|
||
|
" <td>30.0 Hz</td>\n",
|
||
|
" <td>5</td>\n",
|
||
|
" <td></td>\n",
|
||
|
" <td>True</td>\n",
|
||
|
" <td></td>\n",
|
||
|
" </tr>\n",
|
||
|
" <tr>\n",
|
||
|
" <th>81</th>\n",
|
||
|
" <td>1834-110319-5</td>\n",
|
||
|
" <td>False</td>\n",
|
||
|
" <td>1834</td>\n",
|
||
|
" <td>11.0 Hz</td>\n",
|
||
|
" <td>5</td>\n",
|
||
|
" <td></td>\n",
|
||
|
" <td>True</td>\n",
|
||
|
" <td></td>\n",
|
||
|
" </tr>\n",
|
||
|
" <tr>\n",
|
||
|
" <th>82</th>\n",
|
||
|
" <td>1839-200619-2</td>\n",
|
||
|
" <td>False</td>\n",
|
||
|
" <td>1839</td>\n",
|
||
|
" <td>11.0 Hz</td>\n",
|
||
|
" <td>2</td>\n",
|
||
|
" <td></td>\n",
|
||
|
" <td>True</td>\n",
|
||
|
" <td></td>\n",
|
||
|
" </tr>\n",
|
||
|
" <tr>\n",
|
||
|
" <th>86</th>\n",
|
||
|
" <td>1833-010719-2</td>\n",
|
||
|
" <td>False</td>\n",
|
||
|
" <td>1833</td>\n",
|
||
|
" <td>11.0 Hz</td>\n",
|
||
|
" <td>2</td>\n",
|
||
|
" <td></td>\n",
|
||
|
" <td>True</td>\n",
|
||
|
" <td></td>\n",
|
||
|
" </tr>\n",
|
||
|
" </tbody>\n",
|
||
|
"</table>\n",
|
||
|
"</div>"
|
||
|
],
|
||
|
"text/plain": [
|
||
|
" action control entity frequency session stim_location \\\n",
|
||
|
"1 1839-120619-4 False 1839 30.0 Hz 4 \n",
|
||
|
"3 1839-060619-3 False 1839 11.0 Hz 3 \n",
|
||
|
"5 1834-120319-4 False 1834 30.0 Hz 4 \n",
|
||
|
"6 1849-280219-4 False 1849 30.0 Hz 4 ms \n",
|
||
|
"7 1849-110319-2 False 1849 11.0 Hz 2 \n",
|
||
|
"9 1834-220319-2 False 1834 11.0 Hz 2 \n",
|
||
|
"11 1833-020719-4 False 1833 30.0 Hz 4 \n",
|
||
|
"12 1834-120319-2 False 1834 11.0 Hz 2 \n",
|
||
|
"15 1834-150319-4 False 1834 30.0 Hz 4 \n",
|
||
|
"16 1834-220319-4 False 1834 30.0 Hz 4 \n",
|
||
|
"19 1833-260619-2 False 1833 11.0 Hz 2 \n",
|
||
|
"20 1849-010319-4 False 1849 11.0 Hz 4 mecr \n",
|
||
|
"22 1833-200619-4 False 1833 30.0 Hz 4 \n",
|
||
|
"23 1849-220319-3 False 1849 11.0 Hz 3 \n",
|
||
|
"28 1834-150319-2 False 1834 11.0 Hz 2 \n",
|
||
|
"30 1839-290519-2 False 1839 11.0 Hz 2 \n",
|
||
|
"32 1834-010319-5 False 1834 30.0 Hz 5 ms \n",
|
||
|
"37 1849-150319-2 False 1849 11.0 Hz 2 \n",
|
||
|
"38 1849-280219-2 False 1849 11.0 Hz 2 ms \n",
|
||
|
"43 1849-060319-4 False 1849 30.0 Hz 4 ms \n",
|
||
|
"44 1834-010319-3 False 1834 11.0 Hz 3 ms \n",
|
||
|
"45 1833-050619-2 False 1833 11.0 Hz 2 \n",
|
||
|
"47 1833-120619-2 False 1833 11.0 Hz 2 \n",
|
||
|
"50 1849-010319-5 False 1849 11.0 Hz 5 mecl \n",
|
||
|
"51 1849-150319-4 False 1849 30.0 Hz 4 \n",
|
||
|
"52 1834-060319-4 False 1834 30.0 Hz 4 ms \n",
|
||
|
"53 1834-060319-2 False 1834 11.0 Hz 2 ms \n",
|
||
|
"56 1849-060319-2 False 1849 11.0 Hz 2 ms \n",
|
||
|
"60 1834-110319-2 False 1834 11.0 Hz 2 \n",
|
||
|
"61 1833-020719-2 False 1833 11.0 Hz 2 \n",
|
||
|
"63 1833-050619-4 False 1833 30.0 Hz 4 \n",
|
||
|
"64 1833-260619-4 False 1833 30.0 Hz 4 \n",
|
||
|
"65 1833-200619-2 False 1833 11.0 Hz 2 \n",
|
||
|
"67 1833-120619-4 False 1833 30.0 Hz 4 \n",
|
||
|
"68 1833-290519-4 False 1833 30.0 Hz 4 \n",
|
||
|
"70 1839-060619-5 False 1839 30.0 Hz 5 \n",
|
||
|
"74 1833-290519-2 False 1833 11.0 Hz 2 \n",
|
||
|
"75 1833-060619-2 False 1833 30.0 Hz 2 \n",
|
||
|
"76 1839-120619-2 False 1839 11.0 Hz 2 \n",
|
||
|
"77 1849-220319-5 False 1849 30.0 Hz 5 \n",
|
||
|
"81 1834-110319-5 False 1834 11.0 Hz 5 \n",
|
||
|
"82 1839-200619-2 False 1839 11.0 Hz 2 \n",
|
||
|
"86 1833-010719-2 False 1833 11.0 Hz 2 \n",
|
||
|
"\n",
|
||
|
" stimulated tag \n",
|
||
|
"1 True \n",
|
||
|
"3 True \n",
|
||
|
"5 True \n",
|
||
|
"6 True stim-ms \n",
|
||
|
"7 True \n",
|
||
|
"9 True \n",
|
||
|
"11 True \n",
|
||
|
"12 True \n",
|
||
|
"15 True \n",
|
||
|
"16 True \n",
|
||
|
"19 True \n",
|
||
|
"20 True stim-mecr \n",
|
||
|
"22 True \n",
|
||
|
"23 True \n",
|
||
|
"28 True \n",
|
||
|
"30 True \n",
|
||
|
"32 True stim-ms \n",
|
||
|
"37 True \n",
|
||
|
"38 True stim-ms \n",
|
||
|
"43 True stim-ms \n",
|
||
|
"44 True stim-ms \n",
|
||
|
"45 True \n",
|
||
|
"47 True \n",
|
||
|
"50 True stim-mecl \n",
|
||
|
"51 True \n",
|
||
|
"52 True stim-ms \n",
|
||
|
"53 True stim-ms \n",
|
||
|
"56 True stim-ms \n",
|
||
|
"60 True \n",
|
||
|
"61 True \n",
|
||
|
"63 True \n",
|
||
|
"64 True \n",
|
||
|
"65 True \n",
|
||
|
"67 True \n",
|
||
|
"68 True \n",
|
||
|
"70 True \n",
|
||
|
"74 True \n",
|
||
|
"75 True \n",
|
||
|
"76 True \n",
|
||
|
"77 True \n",
|
||
|
"81 True \n",
|
||
|
"82 True \n",
|
||
|
"86 True "
|
||
|
]
|
||
|
},
|
||
|
"execution_count": 316,
|
||
|
"metadata": {},
|
||
|
"output_type": "execute_result"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"sessions.query('stimulated and not control')"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": null,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": []
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"# Identify unique neurons"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 304,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"output = pathlib.Path('output/identify_neurons_weighted')\n",
|
||
|
"\n",
|
||
|
"max_dissimilarity = .035\n",
|
||
|
"for entity in sessions.entity.unique():\n",
|
||
|
" unit_matching = TrackMultipleSessions(\n",
|
||
|
" actions, list(sessions.query(f'entity=={entity}').action), \n",
|
||
|
" progress_bar=tqdm, verbose=False, data_path=output / f'{entity}-graphs'\n",
|
||
|
" )\n",
|
||
|
" unit_matching.do_matching()\n",
|
||
|
" unit_matching.make_graphs_from_matches()\n",
|
||
|
" # save graph with all dissimilarities for later use\n",
|
||
|
" unit_matching.save_graphs()\n",
|
||
|
" # cutoff large dissimilarities\n",
|
||
|
" unit_matching.threshold_dissimilarity(max_dissimilarity)\n",
|
||
|
" unit_matching.remove_edges_with_duplicate_actions()\n",
|
||
|
" unit_matching.identify_units()\n",
|
||
|
" units = []\n",
|
||
|
" for ch, group in unit_matching.identified_units.items():\n",
|
||
|
" for unit_id, val in group.items():\n",
|
||
|
" for action_id, orig_unit_ids in val['original_unit_ids'].items():\n",
|
||
|
" units.extend([\n",
|
||
|
" {\n",
|
||
|
" 'unit_name': name, \n",
|
||
|
" 'unit_id': unit_id, \n",
|
||
|
" 'action_id': action_id,\n",
|
||
|
" 'channel_group': ch,\n",
|
||
|
" 'max_dissimilarity': max_dissimilarity\n",
|
||
|
" } \n",
|
||
|
" for name in orig_unit_ids])\n",
|
||
|
"\n",
|
||
|
" pd.DataFrame(units).to_csv(output / f'{entity}-units.csv', index=False)"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 282,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"sessions.to_csv(output / 'sessions.csv', index=False)"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 283,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"unique_units = pd.concat([\n",
|
||
|
" pd.read_csv(p) \n",
|
||
|
" for p in output.iterdir() \n",
|
||
|
" if p.name.endswith('units.csv')])"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 284,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"unique_units.to_csv(output / 'unique_units.csv', index=False)"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"# yoyoyo"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 288,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"unit_comp = TrackMultipleSessions(actions, data_path=f'output/identify_neurons_weighted/1833-graphs')"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 299,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"unit_comp.load_graphs()"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 300,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"# unit_comp._compute_timedelta()\n",
|
||
|
"# unit_comp.save_graphs()"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 301,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"unit_comp.threshold_dissimilarity(0.08)"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 302,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"# unit_comp.threshold_timedelta(timedelta(days=10))"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 303,
|
||
|
"metadata": {
|
||
|
"scrolled": false
|
||
|
},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAsgAAAkuCAYAAACgsaoTAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4zLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvnQurowAAIABJREFUeJzs3Xd4FNX++PH3zvbspvdGejahNwkREGJBQUAgEfCqIF6/CApIEUVRkCuKglgQUZErRVHRABaaSBOkKR0CWUJ6722z2T6/PxR+gGANIt55PU+eJ5lyWk4mnz1z5oxMFEUkEolEIpFIJBLJj4RrXQCJRCKRSCQSieTvRAqQJRKJRCKRSCSSC0gBskQikUgkEolEcgEpQJZIJBKJRCKRSC4gBcgSiUQikUgkEskFpABZIpFIJBKJRCK5gOJaF0AikUgkEonkjzh06FCAQqFYCrRFGvST/D4u4KTD4XioS5cuFZfulAJkiUQikUgk1yWFQrE0KCgo0d/fv1YQBOnFDpLfzOVyySorK1uXlZUtBQZdul/6tCWRSCQSieR61dbf379BCo4lv5cgCKK/v389P959+Jm/5QhyUlKSGBoaeq2LIfkTMjIyqoxGo39Lpyv1jevf1eobIPWPfwLp2iG5kiv0DUEKjiV/1E9957KDxX/LADk0NJS1a9de62JI/gSDwZB/NdKV+sb172r1DZD6xz+BdO2QXMnVvHZIJJeSplhIJBKJRCKR/An79+/XpaWlGc79fOTIEe2gQYMShgwZYpg4cWKk0+kE4N133/UfMGBA4sCBAxM/++wzbwCTySSMGjUqJjU11TB8+PD4oqIi5aXp19XVyUeOHBmbmppquOuuuxL27t2rA9i3b59u4MCBCYMHD0546aWXggGcTidTp05tdddddyWkpaUZsrKy1ABZWVnq4cOHx6emphpGjBgRV1VVJT+XflZWlrpv376tz/2ck5OjSk1NNQwdOtTwyCOPRDU1Nf0sXszIyNAMGTLEMHjw4IQJEyZE2u32i/bv3LnTfcyYMdEXbnvuuedCV65c6Xuldlyw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YsWK7FmzZuVPmTIlyuVyyZKSkhq6d+/e5HQ62bNnj8fgwYMTRFHkpZdeygN44YUX8mbPnt3qlVdekQUHB1tnzZpVdWk+58TGxlqmTp0arVQqxaioqOaXX375Z9MTxowZU/rEE09EKZVKl1qtds2bN++iZfg8PT1dU6ZMKXzooYdi1Wq1y+FwCMOHD6+Ii4uzFhcXqy5N70IBAQF2u90umzVrVujs2bOLf+nYhIQE6+XaddSoUTGXa7NfSutCMlH8+62vPXToUFFar/L6ZjAYDhmNxq4tna7UN65/V6tvgNQ//gmka8f/d6LRzG0HzzDS35u870r4Pq8GRBFvVyPtDHq2xYRzk487H7aPRv4/MC/5cn3j2LFjeR06dLhioCeR/Jpjx475dejQIfLS7dIIskQikUgkf0Ov5ZXjLhfYvyWXugYrz90ahn3LchoKsqAAKOrKlt6DmXk0kxc6JV7r4kok/ygtGiAbDAYl8D4QCaiBOUAhsB7I+umwt41G4+qWzFcikUgkkn+S06ZmNlbVY2hwUVxl5v20WE4tmYPNbKbPyIeo1QZw9POdtD19iP8mdiFi5y7G9LnpWhdbIvnHaOkR5PuAaqPReL/BYPABjgL/AV41Go0LWjgviUQi+Uexu0TmZxbxQUk1Kid01Wp4pVs03ppfnK4n+Qf6sKQaJZB3sJxJvaNYt+YrMtTdaHtjZ2JbRXFHmyAi27Zj1Ds78Kmu5AW9Hr/01QxJHcalD0tJJJLfr6VXsfgMePan72WAA+gC3GkwGHYZDIb/GgwG9yu
|
||
|
"text/plain": [
|
||
|
"<Figure size 720x12744 with 44 Axes>"
|
||
|
]
|
||
|
},
|
||
|
"metadata": {
|
||
|
"needs_background": "light"
|
||
|
},
|
||
|
"output_type": "display_data"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"unit_comp.remove_edges_with_duplicate_actions()\n",
|
||
|
"unit_comp.identify_units()\n",
|
||
|
"unit_comp.plot_matches('template', chan_group=6, step_color=False)\n",
|
||
|
"plt.tight_layout()"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 298,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
|
"text/plain": [
|
||
|
"[0.09634455200883546,\n",
|
||
|
" 0.07499588360280243,\n",
|
||
|
" 0.06162436970571908,\n",
|
||
|
" 0.06857233657530502,\n",
|
||
|
" 0.09694714236387678,\n",
|
||
|
" 0.0804227088795645,\n",
|
||
|
" 0.08824651636929137,\n",
|
||
|
" 0.08722175061166056,\n",
|
||
|
" 0.09845396075578684,\n",
|
||
|
" 0.09294308631598447,\n",
|
||
|
" 0.09659570944622126,\n",
|
||
|
" 0.07647245393573131,\n",
|
||
|
" 0.09195911715516754,\n",
|
||
|
" 0.0833125753315933,\n",
|
||
|
" 0.051087130456977776,\n",
|
||
|
" 0.049521116821066226,\n",
|
||
|
" 0.02600808417111924,\n",
|
||
|
" 0.0320818045314623,\n",
|
||
|
" 0.03229996342323004,\n",
|
||
|
" 0.029418636630051426,\n",
|
||
|
" 0.04647284442507242,\n",
|
||
|
" 0.087113075493381,\n",
|
||
|
" 0.05515341343597296,\n",
|
||
|
" 0.05825520656684215,\n",
|
||
|
" 0.0707770976250612,\n",
|
||
|
" 0.04259170631553064,\n",
|
||
|
" 0.04251915445433371,\n",
|
||
|
" 0.08660506600667285,\n",
|
||
|
" 0.060867941039334024,\n",
|
||
|
" 0.09247442840294415,\n",
|
||
|
" 0.05688725030444264,\n",
|
||
|
" 0.02585312905314643,\n",
|
||
|
" 0.02256877562004955,\n",
|
||
|
" 0.03841936694076317,\n",
|
||
|
" 0.050287440931407607,\n",
|
||
|
" 0.08012546713128958,\n",
|
||
|
" 0.015016185438421958,\n",
|
||
|
" 0.039239181359156536,\n",
|
||
|
" 0.04873498182486496,\n",
|
||
|
" 0.07384202529475573,\n",
|
||
|
" 0.031544066489664284,\n",
|
||
|
" 0.038465046537750666,\n",
|
||
|
" 0.038985147903295735,\n",
|
||
|
" 0.045067437101008266,\n",
|
||
|
" 0.07420871091322713,\n",
|
||
|
" 0.017205498433729347,\n",
|
||
|
" 0.05187686886128337,\n",
|
||
|
" 0.043003485904860445,\n",
|
||
|
" 0.06992615155905807,\n",
|
||
|
" 0.06967030449524804,\n",
|
||
|
" 0.044568413688232646,\n",
|
||
|
" 0.0874738260681804,\n",
|
||
|
" 0.09039484124249249,\n",
|
||
|
" 0.09594371946463928,\n",
|
||
|
" 0.055167110959496904,\n",
|
||
|
" 0.04298880990313309,\n",
|
||
|
" 0.07367751723966846,\n",
|
||
|
" 0.07201899464292785,\n",
|
||
|
" 0.05080452341862692,\n",
|
||
|
" 0.04854896792437264,\n",
|
||
|
" 0.04711365764947379,\n",
|
||
|
" 0.052188349723749666,\n",
|
||
|
" 0.06483119038403079,\n",
|
||
|
" 0.023433139145706546,\n",
|
||
|
" 0.08855768408846616,\n",
|
||
|
" 0.08560448741739592,\n",
|
||
|
" 0.08995174608668689,\n",
|
||
|
" 0.08987859018329981,\n",
|
||
|
" 0.062133641073307475,\n",
|
||
|
" 0.02956535592106278,\n",
|
||
|
" 0.014587645320492237,\n",
|
||
|
" 0.02624471658364597,\n",
|
||
|
" 0.03341375983806098,\n",
|
||
|
" 0.07304877481520819,\n",
|
||
|
" 0.0393218609123345,\n",
|
||
|
" 0.08423515060892538,\n",
|
||
|
" 0.05024844706593054,\n",
|
||
|
" 0.07672057147673768,\n",
|
||
|
" 0.05284121132788224,\n",
|
||
|
" 0.05807034939928806,\n",
|
||
|
" 0.07348830627663666]"
|
||
|
]
|
||
|
},
|
||
|
"execution_count": 298,
|
||
|
"metadata": {},
|
||
|
"output_type": "execute_result"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"[d['weight'] for _,_, d in unit_comp.graphs[6].edges(data=True)]"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 87,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"cmp = TrackMultipleSessions(actions)"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 95,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"from septum_mec.analysis.track_units_tools import plot_waveform, dissimilarity, dissimilarity_weighted"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 90,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"from matplotlib import gridspec"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 230,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
|
"text/plain": [
|
||
|
"[<matplotlib.axes._subplots.AxesSubplot at 0x7f96971e2240>,\n",
|
||
|
" <matplotlib.axes._subplots.AxesSubplot at 0x7f96a0c1fa58>,\n",
|
||
|
" <matplotlib.axes._subplots.AxesSubplot at 0x7f9696fc2208>,\n",
|
||
|
" <matplotlib.axes._subplots.AxesSubplot at 0x7f969628e2b0>]"
|
||
|
]
|
||
|
},
|
||
|
"execution_count": 230,
|
||
|
"metadata": {},
|
||
|
"output_type": "execute_result"
|
||
|
},
|
||
|
{
|
||
|
"data": {
|
||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAA6wAAAILCAYAAADsVRGmAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4zLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvnQurowAAIABJREFUeJzs3Xd4W+d5P/zvwSK4RVLUoqhpidbwUry3YzuOYzuO47hxVptVp02aWf/aZrdp0jbTjbPeNKNppkeW4zge8kg843gPyaK2RImSKA6sM5/1/nEACsQiAALEAXh/rouXL4skcEgC55z7ee6hKaVACCGEEEIIIYR4ja/WB0AIIYQQQgghhORCASshhBBCCCGEEE+igJUQQg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WAoN8Hv08r+LWpYLXcGn2TCbQ2BaBphZ+nGA6XbpCatrDmcInOlmDdnndniqKJBsI8kA6cTrc5QgEfXWAJIaROMSFzZu40UsDKuES+hryvHIrhs7/bgu7WEN559gos7Ahjy8EofvfCMJ7YNYb3nrcSrz9pSUVuUnNRyt1lbW3yIWIwdLWGpr3xJmSus5iAbvMp566AT0NLKIBw0Jf1fhVSIWo4U0ofSiWVG7S2hGYWWjEhETWcrAaqQilEDAfzWkJ1e+6dCQpYG4gX6lfTSbipwd1tTbU+FEIIIWWw89RP8jquY81c3M1MeU7ZdTSBz9yxBfNagvjCNRsxP3ktO7l/Hq4+pQ83P7AD33tkD4YjFm44f1XVAkmLCTSH/ACAqOGgqzVUtQCZkHpnODxnwyQuFWIWQ8IGmgJ+NAV9UMq9d7a5KDkNOBfTmXnAmrB
|
||
|
"text/plain": [
|
||
|
"<Figure size 1152x648 with 4 Axes>"
|
||
|
]
|
||
|
},
|
||
|
"metadata": {
|
||
|
"needs_background": "light"
|
||
|
},
|
||
|
"output_type": "display_data"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"fig = plt.figure(figsize=(16, 9))\n",
|
||
|
"gs = gridspec.GridSpec(1, 1)\n",
|
||
|
"\n",
|
||
|
"wf1 = cmp.load_waveforms('1833-050619-3', 143, 6)\n",
|
||
|
"wf2 = cmp.load_waveforms('1833-200619-3', 126, 6)\n",
|
||
|
"axs = plot_waveform(wf1, fig, gs[0])\n",
|
||
|
"plot_waveform(wf2, fig, gs[0], axs=axs)"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 276,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
|
"text/plain": [
|
||
|
"0.24673824079040996"
|
||
|
]
|
||
|
},
|
||
|
"execution_count": 276,
|
||
|
"metadata": {},
|
||
|
"output_type": "execute_result"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"d00 = dissimilarity(wf1.mean(), wf2.mean())\n",
|
||
|
"d00"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 275,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
|
"text/plain": [
|
||
|
"0.12165202171836166"
|
||
|
]
|
||
|
},
|
||
|
"execution_count": 275,
|
||
|
"metadata": {},
|
||
|
"output_type": "execute_result"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"d10 = dissimilarity_weighted(wf1, wf2)\n",
|
||
|
"d10"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 233,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
|
"text/plain": [
|
||
|
"[<matplotlib.axes._subplots.AxesSubplot at 0x7f9697399358>,\n",
|
||
|
" <matplotlib.axes._subplots.AxesSubplot at 0x7f9695eec9e8>,\n",
|
||
|
" <matplotlib.axes._subplots.AxesSubplot at 0x7f9695eeb320>,\n",
|
||
|
" <matplotlib.axes._subplots.AxesSubplot at 0x7f969641b518>]"
|
||
|
]
|
||
|
},
|
||
|
"execution_count": 233,
|
||
|
"metadata": {},
|
||
|
"output_type": "execute_result"
|
||
|
},
|
||
|
{
|
||
|
"data": {
|
||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAA6wAAAILCAYAAADsVRGmAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4zLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvnQurowAAIABJREFUeJzs3XmcXGWVN/DfvXVr6X3J2p3OvnQgQNhkJyyGfRFRRB0dx3HUcRwZUWd8FUUdx2VEwGXwlZEZl1dmxBUkCAgKKCBbQhISkg7Zk+50p5fa7/Zs7x+3qtNLVXd1p6rrVvf5fj79gX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UbXVEIy8q1ZtSgteEaggHWacYeMPrlclDy/nwk1mCaslIIjJFI2XWAJIWQ6cJj0zu1DRj5ZJlCVChU5A6iUqoiCLVwqHE3aMGk9K5nhpFR5039pHevMQAHrNKIyvfGyLFcWLRV4zO3iWJowE94oPJ1ACCGksnHhpQM7XGJoXDo0FZhXYMDKhAL3Sf/V8bhCoTtuU9ojmdHsMVL4vQJwdM853RW1DyspL1fIwQPa5WLKC2JwCcQtjvqwhiQYggEdAX10/1ZCCCH+lx0AZSPWlXCpIKWCrmvgUiJUYWPfpssxkdtbJiQe2tyFfX1p9CRszK4N462nLUD7/LqS7eNQJhPoiplY2FwDLUdPdEKmu/EKkLlcImxQT9bpjALWaaQcs6sjKQUkbAahDBgWQ1NNqAx7QQgh5Hg5XI7K3MlyhUREDwwWYKok9gTSgV0u8dXf7cArB6KYVx/G3LoINh+K4dndfVjb1oB/Wr8Sc+siJdxbT8IW6I5ZaGmqLvm
|
||
|
"text/plain": [
|
||
|
"<Figure size 1152x648 with 4 Axes>"
|
||
|
]
|
||
|
},
|
||
|
"metadata": {
|
||
|
"needs_background": "light"
|
||
|
},
|
||
|
"output_type": "display_data"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"fig = plt.figure(figsize=(16, 9))\n",
|
||
|
"gs = gridspec.GridSpec(1, 1)\n",
|
||
|
"\n",
|
||
|
"wf3 = cmp.load_waveforms('1833-050619-3', 143, 6)\n",
|
||
|
"wf4 = cmp.load_waveforms('1833-060619-1', 170, 6)\n",
|
||
|
"axs = plot_waveform(wf3, fig, gs[0])\n",
|
||
|
"plot_waveform(wf4, fig, gs[0], axs=axs)"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 278,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
|
"text/plain": [
|
||
|
"0.04522270245629878"
|
||
|
]
|
||
|
},
|
||
|
"execution_count": 278,
|
||
|
"metadata": {},
|
||
|
"output_type": "execute_result"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"d01 = dissimilarity(wf3.mean(), wf4.mean())\n",
|
||
|
"d01"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 277,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
|
"text/plain": [
|
||
|
"0.05528103485716783"
|
||
|
]
|
||
|
},
|
||
|
"execution_count": 277,
|
||
|
"metadata": {},
|
||
|
"output_type": "execute_result"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"d11 = dissimilarity_weighted(wf3, wf4)\n",
|
||
|
"d11"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 236,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
|
"text/plain": [
|
||
|
"5.45607023438829"
|
||
|
]
|
||
|
},
|
||
|
"execution_count": 236,
|
||
|
"metadata": {},
|
||
|
"output_type": "execute_result"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"d00 / d01"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 237,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
|
"text/plain": [
|
||
|
"1.1824085223080825"
|
||
|
]
|
||
|
},
|
||
|
"execution_count": 237,
|
||
|
"metadata": {},
|
||
|
"output_type": "execute_result"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"d10 / d11"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 239,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"t = abs(actions['1833-260619-2'].datetime - actions['1833-050619-3'].datetime)"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 240,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
|
"text/plain": [
|
||
|
"True"
|
||
|
]
|
||
|
},
|
||
|
"execution_count": 240,
|
||
|
"metadata": {},
|
||
|
"output_type": "execute_result"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"t > timedelta(15)"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"# Store results in Expipe action"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 64,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"identify_neurons.data['sessions'] = 'sessions.csv'\n",
|
||
|
"identify_neurons.data['units'] = 'units.csv'"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 67,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"sessions.to_csv(identify_neurons.data_path('sessions'), index=False)\n",
|
||
|
"units.to_csv(identify_neurons.data_path('units'), index=False)"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 69,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"store_notebook(\n",
|
||
|
" identify_neurons, \"00-identify-neurons.ipynb\")"
|
||
|
]
|
||
|
}
|
||
|
],
|
||
|
"metadata": {
|
||
|
"kernelspec": {
|
||
|
"display_name": "Python 3",
|
||
|
"language": "python",
|
||
|
"name": "python3"
|
||
|
},
|
||
|
"language_info": {
|
||
|
"codemirror_mode": {
|
||
|
"name": "ipython",
|
||
|
"version": 3
|
||
|
},
|
||
|
"file_extension": ".py",
|
||
|
"mimetype": "text/x-python",
|
||
|
"name": "python",
|
||
|
"nbconvert_exporter": "python",
|
||
|
"pygments_lexer": "ipython3",
|
||
|
"version": "3.6.8"
|
||
|
}
|
||
|
},
|
||
|
"nbformat": 4,
|
||
|
"nbformat_minor": 2
|
||
|
}
|