2019-10-16 05:28:13 +00:00
{
"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": [
2019-10-22 10:22:00 +00:00
"12:05:23 [I] klustakwik KlustaKwik2 version 0.2.6\n",
2019-10-16 05:28:13 +00:00
"/home/mikkel/.virtualenvs/expipe/lib/python3.6/importlib/_bootstrap.py:219: RuntimeWarning: numpy.ufunc size changed, may indicate binary incompatibility. Expected 192 from C header, got 216 from PyObject\n",
" return f(*args, **kwds)\n",
"/home/mikkel/.virtualenvs/expipe/lib/python3.6/importlib/_bootstrap.py:219: RuntimeWarning: numpy.ufunc size changed, may indicate binary incompatibility. Expected 192 from C header, got 216 from PyObject\n",
" return f(*args, **kwds)\n"
]
}
],
"source": [
"import os\n",
"import pathlib\n",
"import numpy as np\n",
"import matplotlib.pyplot as plt\n",
"import re\n",
"import shutil\n",
"import pandas as pd\n",
"import scipy.stats\n",
"\n",
"import exdir\n",
"import expipe\n",
"from distutils.dir_util import copy_tree\n",
"import septum_mec\n",
"import spatial_maps as sp\n",
"import head_direction.head as head\n",
"import septum_mec.analysis.data_processing as dp\n",
"import septum_mec.analysis.registration\n",
"from septum_mec.analysis.plotting import violinplot\n",
"\n",
"from spike_statistics.core import permutation_resampling"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
"project_path = dp.project_path()\n",
"project = expipe.get_project(project_path)\n",
"actions = project.actions\n",
"\n",
"output_path = pathlib.Path(\"output\") / \"comparisons-gridcells\"\n",
"(output_path / \"statistics\").mkdir(exist_ok=True, parents=True)\n",
"(output_path / \"figures\").mkdir(exist_ok=True, parents=True)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Load cell statistics and shuffling quantiles"
]
},
{
"cell_type": "code",
"execution_count": 4,
"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>baseline</th>\n",
" <th>entity</th>\n",
" <th>frequency</th>\n",
" <th>i</th>\n",
" <th>ii</th>\n",
" <th>session</th>\n",
" <th>stim_location</th>\n",
" <th>stimulated</th>\n",
" <th>tag</th>\n",
" <th>...</th>\n",
" <th>burst_event_ratio</th>\n",
" <th>bursty_spike_ratio</th>\n",
" <th>gridness</th>\n",
" <th>border_score</th>\n",
" <th>information_rate</th>\n",
" <th>information_specificity</th>\n",
" <th>head_mean_ang</th>\n",
" <th>head_mean_vec_len</th>\n",
" <th>spacing</th>\n",
" <th>orientation</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>1849-060319-3</td>\n",
" <td>True</td>\n",
" <td>1849</td>\n",
" <td>NaN</td>\n",
" <td>False</td>\n",
" <td>True</td>\n",
" <td>3</td>\n",
" <td>NaN</td>\n",
" <td>False</td>\n",
" <td>baseline ii</td>\n",
" <td>...</td>\n",
2019-10-22 10:22:00 +00:00
" <td>0.398230</td>\n",
" <td>0.678064</td>\n",
" <td>-0.466923</td>\n",
" <td>0.029328</td>\n",
" <td>1.009215</td>\n",
" <td>0.317256</td>\n",
" <td>5.438033</td>\n",
" <td>0.040874</td>\n",
" <td>0.628784</td>\n",
" <td>20.224859</td>\n",
2019-10-16 05:28:13 +00:00
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>1849-060319-3</td>\n",
" <td>True</td>\n",
" <td>1849</td>\n",
" <td>NaN</td>\n",
" <td>False</td>\n",
" <td>True</td>\n",
" <td>3</td>\n",
" <td>NaN</td>\n",
" <td>False</td>\n",
" <td>baseline ii</td>\n",
" <td>...</td>\n",
2019-10-22 10:22:00 +00:00
" <td>0.138014</td>\n",
" <td>0.263173</td>\n",
" <td>-0.666792</td>\n",
" <td>0.308146</td>\n",
" <td>0.192524</td>\n",
" <td>0.033447</td>\n",
" <td>1.951740</td>\n",
" <td>0.017289</td>\n",
" <td>0.789388</td>\n",
" <td>27.897271</td>\n",
2019-10-16 05:28:13 +00:00
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>1849-060319-3</td>\n",
" <td>True</td>\n",
" <td>1849</td>\n",
" <td>NaN</td>\n",
" <td>False</td>\n",
" <td>True</td>\n",
" <td>3</td>\n",
" <td>NaN</td>\n",
" <td>False</td>\n",
" <td>baseline ii</td>\n",
" <td>...</td>\n",
2019-10-22 10:22:00 +00:00
" <td>0.373986</td>\n",
" <td>0.659259</td>\n",
" <td>-0.572566</td>\n",
" <td>0.143252</td>\n",
" <td>4.745836</td>\n",
" <td>0.393704</td>\n",
" <td>4.439721</td>\n",
" <td>0.124731</td>\n",
" <td>0.555402</td>\n",
" <td>28.810794</td>\n",
2019-10-16 05:28:13 +00:00
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>1849-060319-3</td>\n",
" <td>True</td>\n",
" <td>1849</td>\n",
" <td>NaN</td>\n",
" <td>False</td>\n",
" <td>True</td>\n",
" <td>3</td>\n",
" <td>NaN</td>\n",
" <td>False</td>\n",
" <td>baseline ii</td>\n",
" <td>...</td>\n",
2019-10-22 10:22:00 +00:00
" <td>0.087413</td>\n",
" <td>0.179245</td>\n",
" <td>-0.437492</td>\n",
" <td>0.268948</td>\n",
" <td>0.157394</td>\n",
" <td>0.073553</td>\n",
" <td>6.215195</td>\n",
" <td>0.101911</td>\n",
" <td>0.492250</td>\n",
" <td>9.462322</td>\n",
2019-10-16 05:28:13 +00:00
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>1849-060319-3</td>\n",
" <td>True</td>\n",
" <td>1849</td>\n",
" <td>NaN</td>\n",
" <td>False</td>\n",
" <td>True</td>\n",
" <td>3</td>\n",
" <td>NaN</td>\n",
" <td>False</td>\n",
" <td>baseline ii</td>\n",
" <td>...</td>\n",
2019-10-22 10:22:00 +00:00
" <td>0.248771</td>\n",
" <td>0.463596</td>\n",
" <td>-0.085938</td>\n",
" <td>0.218744</td>\n",
" <td>0.519153</td>\n",
" <td>0.032683</td>\n",
" <td>1.531481</td>\n",
" <td>0.053810</td>\n",
" <td>0.559905</td>\n",
2019-10-16 05:28:13 +00:00
" <td>0.000000</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
2019-10-17 17:51:12 +00:00
"<p>5 rows × 39 columns</p>\n",
2019-10-16 05:28:13 +00:00
"</div>"
],
"text/plain": [
" action baseline entity frequency i ii session \\\n",
"0 1849-060319-3 True 1849 NaN False True 3 \n",
"1 1849-060319-3 True 1849 NaN False True 3 \n",
"2 1849-060319-3 True 1849 NaN False True 3 \n",
"3 1849-060319-3 True 1849 NaN False True 3 \n",
"4 1849-060319-3 True 1849 NaN False True 3 \n",
"\n",
" stim_location stimulated tag ... burst_event_ratio \\\n",
2019-10-22 10:22:00 +00:00
"0 NaN False baseline ii ... 0.398230 \n",
"1 NaN False baseline ii ... 0.138014 \n",
"2 NaN False baseline ii ... 0.373986 \n",
"3 NaN False baseline ii ... 0.087413 \n",
"4 NaN False baseline ii ... 0.248771 \n",
2019-10-16 05:28:13 +00:00
"\n",
2019-10-17 17:51:12 +00:00
" bursty_spike_ratio gridness border_score information_rate \\\n",
2019-10-22 10:22:00 +00:00
"0 0.678064 -0.466923 0.029328 1.009215 \n",
"1 0.263173 -0.666792 0.308146 0.192524 \n",
"2 0.659259 -0.572566 0.143252 4.745836 \n",
"3 0.179245 -0.437492 0.268948 0.157394 \n",
"4 0.463596 -0.085938 0.218744 0.519153 \n",
2019-10-16 05:28:13 +00:00
"\n",
2019-10-17 17:51:12 +00:00
" information_specificity head_mean_ang head_mean_vec_len spacing \\\n",
2019-10-22 10:22:00 +00:00
"0 0.317256 5.438033 0.040874 0.628784 \n",
"1 0.033447 1.951740 0.017289 0.789388 \n",
"2 0.393704 4.439721 0.124731 0.555402 \n",
"3 0.073553 6.215195 0.101911 0.492250 \n",
"4 0.032683 1.531481 0.053810 0.559905 \n",
2019-10-16 05:28:13 +00:00
"\n",
" orientation \n",
2019-10-22 10:22:00 +00:00
"0 20.224859 \n",
"1 27.897271 \n",
"2 28.810794 \n",
"3 9.462322 \n",
2019-10-16 05:28:13 +00:00
"4 0.000000 \n",
"\n",
2019-10-17 17:51:12 +00:00
"[5 rows x 39 columns]"
2019-10-16 05:28:13 +00:00
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"statistics_action = actions['calculate-statistics']\n",
"identification_action = actions['identify-neurons']\n",
"sessions = pd.read_csv(identification_action.data_path('sessions'))\n",
"units = pd.read_csv(identification_action.data_path('units'))\n",
"session_units = pd.merge(sessions, units, on='action')\n",
"statistics_results = pd.read_csv(statistics_action.data_path('results'))\n",
"statistics = pd.merge(session_units, statistics_results, how='left')\n",
"statistics.head()"
]
},
{
"cell_type": "code",
"execution_count": 5,
"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>border_score</th>\n",
" <th>gridness</th>\n",
" <th>head_mean_ang</th>\n",
" <th>head_mean_vec_len</th>\n",
" <th>information_rate</th>\n",
" <th>speed_score</th>\n",
" <th>action</th>\n",
" <th>channel_group</th>\n",
" <th>unit_name</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>0.348023</td>\n",
" <td>0.275109</td>\n",
" <td>3.012689</td>\n",
" <td>0.086792</td>\n",
" <td>0.707197</td>\n",
" <td>0.149071</td>\n",
" <td>1833-010719-1</td>\n",
" <td>0.0</td>\n",
" <td>127.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>0.362380</td>\n",
" <td>0.166475</td>\n",
" <td>3.133138</td>\n",
" <td>0.037271</td>\n",
" <td>0.482486</td>\n",
" <td>0.132212</td>\n",
" <td>1833-010719-1</td>\n",
" <td>0.0</td>\n",
" <td>161.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>0.367498</td>\n",
" <td>0.266865</td>\n",
" <td>5.586395</td>\n",
" <td>0.182843</td>\n",
" <td>0.271188</td>\n",
" <td>0.062821</td>\n",
" <td>1833-010719-1</td>\n",
" <td>0.0</td>\n",
" <td>191.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>0.331942</td>\n",
" <td>0.312155</td>\n",
" <td>5.955767</td>\n",
" <td>0.090786</td>\n",
" <td>0.354018</td>\n",
" <td>0.052009</td>\n",
" <td>1833-010719-1</td>\n",
" <td>0.0</td>\n",
" <td>223.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>0.325842</td>\n",
" <td>0.180495</td>\n",
" <td>5.262721</td>\n",
" <td>0.103584</td>\n",
" <td>0.210427</td>\n",
" <td>0.094041</td>\n",
" <td>1833-010719-1</td>\n",
" <td>0.0</td>\n",
" <td>225.0</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" border_score gridness head_mean_ang head_mean_vec_len information_rate \\\n",
"0 0.348023 0.275109 3.012689 0.086792 0.707197 \n",
"1 0.362380 0.166475 3.133138 0.037271 0.482486 \n",
"2 0.367498 0.266865 5.586395 0.182843 0.271188 \n",
"3 0.331942 0.312155 5.955767 0.090786 0.354018 \n",
"4 0.325842 0.180495 5.262721 0.103584 0.210427 \n",
"\n",
" speed_score action channel_group unit_name \n",
"0 0.149071 1833-010719-1 0.0 127.0 \n",
"1 0.132212 1833-010719-1 0.0 161.0 \n",
"2 0.062821 1833-010719-1 0.0 191.0 \n",
"3 0.052009 1833-010719-1 0.0 223.0 \n",
"4 0.094041 1833-010719-1 0.0 225.0 "
]
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"shuffling = actions['shuffling']\n",
"quantiles_95 = pd.read_csv(shuffling.data_path('quantiles_95'))\n",
"quantiles_95.head()"
]
},
{
"cell_type": "code",
"execution_count": 6,
"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>baseline</th>\n",
" <th>entity</th>\n",
" <th>frequency</th>\n",
" <th>i</th>\n",
" <th>ii</th>\n",
" <th>session</th>\n",
" <th>stim_location</th>\n",
" <th>stimulated</th>\n",
" <th>tag</th>\n",
" <th>...</th>\n",
" <th>head_mean_vec_len</th>\n",
" <th>spacing</th>\n",
" <th>orientation</th>\n",
" <th>border_score_threshold</th>\n",
" <th>gridness_threshold</th>\n",
" <th>head_mean_ang_threshold</th>\n",
" <th>head_mean_vec_len_threshold</th>\n",
" <th>information_rate_threshold</th>\n",
" <th>speed_score_threshold</th>\n",
" <th>specificity</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>1849-060319-3</td>\n",
" <td>True</td>\n",
" <td>1849</td>\n",
" <td>NaN</td>\n",
" <td>False</td>\n",
" <td>True</td>\n",
" <td>3</td>\n",
" <td>NaN</td>\n",
" <td>False</td>\n",
" <td>baseline ii</td>\n",
" <td>...</td>\n",
2019-10-22 10:22:00 +00:00
" <td>0.040874</td>\n",
" <td>0.628784</td>\n",
" <td>20.224859</td>\n",
2019-10-16 05:28:13 +00:00
" <td>0.332548</td>\n",
" <td>0.229073</td>\n",
" <td>6.029431</td>\n",
" <td>0.205362</td>\n",
" <td>1.115825</td>\n",
" <td>0.066736</td>\n",
2019-10-22 10:22:00 +00:00
" <td>0.451741</td>\n",
2019-10-16 05:28:13 +00:00
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>1849-060319-3</td>\n",
" <td>True</td>\n",
" <td>1849</td>\n",
" <td>NaN</td>\n",
" <td>False</td>\n",
" <td>True</td>\n",
" <td>3</td>\n",
" <td>NaN</td>\n",
" <td>False</td>\n",
" <td>baseline ii</td>\n",
" <td>...</td>\n",
2019-10-22 10:22:00 +00:00
" <td>0.017289</td>\n",
" <td>0.789388</td>\n",
" <td>27.897271</td>\n",
2019-10-16 05:28:13 +00:00
" <td>0.354830</td>\n",
" <td>0.089333</td>\n",
" <td>6.120055</td>\n",
" <td>0.073566</td>\n",
" <td>0.223237</td>\n",
" <td>0.052594</td>\n",
2019-10-22 10:22:00 +00:00
" <td>0.098517</td>\n",
2019-10-16 05:28:13 +00:00
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>1849-060319-3</td>\n",
" <td>True</td>\n",
" <td>1849</td>\n",
" <td>NaN</td>\n",
" <td>False</td>\n",
" <td>True</td>\n",
" <td>3</td>\n",
" <td>NaN</td>\n",
" <td>False</td>\n",
" <td>baseline ii</td>\n",
" <td>...</td>\n",
2019-10-22 10:22:00 +00:00
" <td>0.124731</td>\n",
" <td>0.555402</td>\n",
" <td>28.810794</td>\n",
2019-10-16 05:28:13 +00:00
" <td>0.264610</td>\n",
" <td>-0.121081</td>\n",
" <td>5.759406</td>\n",
" <td>0.150827</td>\n",
" <td>4.964984</td>\n",
" <td>0.027120</td>\n",
2019-10-22 10:22:00 +00:00
" <td>0.400770</td>\n",
2019-10-16 05:28:13 +00:00
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>1849-060319-3</td>\n",
" <td>True</td>\n",
" <td>1849</td>\n",
" <td>NaN</td>\n",
" <td>False</td>\n",
" <td>True</td>\n",
" <td>3</td>\n",
" <td>NaN</td>\n",
" <td>False</td>\n",
" <td>baseline ii</td>\n",
" <td>...</td>\n",
2019-10-22 10:22:00 +00:00
" <td>0.101911</td>\n",
" <td>0.492250</td>\n",
" <td>9.462322</td>\n",
2019-10-16 05:28:13 +00:00
" <td>0.344280</td>\n",
" <td>0.215829</td>\n",
" <td>6.033364</td>\n",
" <td>0.110495</td>\n",
" <td>0.239996</td>\n",
" <td>0.054074</td>\n",
2019-10-22 10:22:00 +00:00
" <td>0.269461</td>\n",
2019-10-16 05:28:13 +00:00
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>1849-060319-3</td>\n",
" <td>True</td>\n",
" <td>1849</td>\n",
" <td>NaN</td>\n",
" <td>False</td>\n",
" <td>True</td>\n",
" <td>3</td>\n",
" <td>NaN</td>\n",
" <td>False</td>\n",
" <td>baseline ii</td>\n",
" <td>...</td>\n",
2019-10-22 10:22:00 +00:00
" <td>0.053810</td>\n",
" <td>0.559905</td>\n",
2019-10-16 05:28:13 +00:00
" <td>0.000000</td>\n",
" <td>0.342799</td>\n",
" <td>0.218967</td>\n",
" <td>5.768170</td>\n",
" <td>0.054762</td>\n",
" <td>0.524990</td>\n",
" <td>0.144702</td>\n",
2019-10-22 10:22:00 +00:00
" <td>0.133410</td>\n",
2019-10-16 05:28:13 +00:00
" </tr>\n",
" </tbody>\n",
"</table>\n",
2019-10-17 17:51:12 +00:00
"<p>5 rows × 46 columns</p>\n",
2019-10-16 05:28:13 +00:00
"</div>"
],
"text/plain": [
" action baseline entity frequency i ii session \\\n",
"0 1849-060319-3 True 1849 NaN False True 3 \n",
"1 1849-060319-3 True 1849 NaN False True 3 \n",
"2 1849-060319-3 True 1849 NaN False True 3 \n",
"3 1849-060319-3 True 1849 NaN False True 3 \n",
"4 1849-060319-3 True 1849 NaN False True 3 \n",
"\n",
" stim_location stimulated tag ... head_mean_vec_len spacing \\\n",
2019-10-22 10:22:00 +00:00
"0 NaN False baseline ii ... 0.040874 0.628784 \n",
"1 NaN False baseline ii ... 0.017289 0.789388 \n",
"2 NaN False baseline ii ... 0.124731 0.555402 \n",
"3 NaN False baseline ii ... 0.101911 0.492250 \n",
"4 NaN False baseline ii ... 0.053810 0.559905 \n",
2019-10-16 05:28:13 +00:00
"\n",
2019-10-17 17:51:12 +00:00
" orientation border_score_threshold gridness_threshold \\\n",
2019-10-22 10:22:00 +00:00
"0 20.224859 0.332548 0.229073 \n",
"1 27.897271 0.354830 0.089333 \n",
"2 28.810794 0.264610 -0.121081 \n",
"3 9.462322 0.344280 0.215829 \n",
2019-10-17 17:51:12 +00:00
"4 0.000000 0.342799 0.218967 \n",
2019-10-16 05:28:13 +00:00
"\n",
" head_mean_ang_threshold head_mean_vec_len_threshold \\\n",
"0 6.029431 0.205362 \n",
"1 6.120055 0.073566 \n",
"2 5.759406 0.150827 \n",
"3 6.033364 0.110495 \n",
"4 5.768170 0.054762 \n",
"\n",
2019-10-17 17:51:12 +00:00
" information_rate_threshold speed_score_threshold specificity \n",
2019-10-22 10:22:00 +00:00
"0 1.115825 0.066736 0.451741 \n",
"1 0.223237 0.052594 0.098517 \n",
"2 4.964984 0.027120 0.400770 \n",
"3 0.239996 0.054074 0.269461 \n",
"4 0.524990 0.144702 0.133410 \n",
2019-10-16 05:28:13 +00:00
"\n",
2019-10-17 17:51:12 +00:00
"[5 rows x 46 columns]"
2019-10-16 05:28:13 +00:00
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"action_columns = ['action', 'channel_group', 'unit_name']\n",
"data = pd.merge(statistics, quantiles_95, on=action_columns, suffixes=(\"\", \"_threshold\"))\n",
"\n",
"data['specificity'] = np.log10(data['in_field_mean_rate'] / data['out_field_mean_rate'])\n",
"\n",
"data.head()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Statistics about all cell-sessions"
]
},
{
"cell_type": "code",
2019-10-17 17:51:12 +00:00
"execution_count": 7,
2019-10-16 05:28:13 +00:00
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"stimulated\n",
"False 624\n",
2019-10-17 17:51:12 +00:00
"True 660\n",
2019-10-16 05:28:13 +00:00
"Name: action, dtype: int64"
]
},
2019-10-17 17:51:12 +00:00
"execution_count": 7,
2019-10-16 05:28:13 +00:00
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"data.groupby('stimulated').count()['action']"
]
},
2019-10-17 17:51:12 +00:00
{
"cell_type": "code",
2019-10-22 10:22:00 +00:00
"execution_count": 8,
2019-10-17 17:51:12 +00:00
"metadata": {},
"outputs": [],
"source": [
"data['unit_day'] = data.apply(lambda x: str(x.unit_idnum) + '_' + x.action.split('-')[1], axis=1)"
]
},
2019-10-16 05:28:13 +00:00
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Find all cells with gridness above threshold"
]
},
{
"cell_type": "code",
2019-10-22 10:22:00 +00:00
"execution_count": 9,
2019-10-16 05:28:13 +00:00
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
2019-10-22 10:22:00 +00:00
"Number of sessions above threshold 194\n",
2019-10-16 05:28:13 +00:00
"Number of animals 4\n"
]
}
],
"source": [
2019-10-22 10:22:00 +00:00
"query = (\n",
" 'gridness > gridness_threshold and '\n",
" 'information_rate > information_rate_threshold and '\n",
" 'gridness > .2 and '\n",
" 'average_rate < 25'\n",
")\n",
2019-10-16 05:28:13 +00:00
"sessions_above_threshold = data.query(query)\n",
2019-10-22 10:22:00 +00:00
"print(\"Number of sessions above threshold\", len(sessions_above_threshold))\n",
2019-10-16 05:28:13 +00:00
"print(\"Number of animals\", len(sessions_above_threshold.groupby(['entity'])))"
]
},
{
"cell_type": "code",
2019-10-22 10:22:00 +00:00
"execution_count": 10,
2019-10-16 05:28:13 +00:00
"metadata": {},
"outputs": [],
"source": [
2019-10-17 17:51:12 +00:00
"gridcell_sessions = data[data.unit_day.isin(sessions_above_threshold.unit_day.values)]"
2019-10-16 05:28:13 +00:00
]
},
2019-10-22 10:22:00 +00:00
{
"cell_type": "code",
"execution_count": 11,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Number of gridcells 139\n",
"Number of gridcell recordings 231\n",
"Number of animals 4\n"
]
}
],
"source": [
"print(\"Number of gridcells\", gridcell_sessions.unit_idnum.nunique())\n",
"print(\"Number of gridcell recordings\", len(gridcell_sessions))\n",
"print(\"Number of animals\", len(gridcell_sessions.groupby(['entity'])))"
]
},
2019-10-16 05:28:13 +00:00
{
"cell_type": "code",
2019-10-17 17:51:12 +00:00
"execution_count": 12,
2019-10-16 05:28:13 +00:00
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
2019-10-22 10:22:00 +00:00
"Number of gridcells in baseline i sessions 66\n",
"Number of gridcells in stimulated 11Hz ms sessions 61\n",
"Number of gridcells in baseline ii sessions 56\n",
"Number of gridcells in stimulated 30Hz ms sessions 40\n"
2019-10-16 05:28:13 +00:00
]
}
],
"source": [
2019-10-17 17:51:12 +00:00
"baseline_i = gridcell_sessions.query('baseline and Hz11')\n",
"stimulated_11 = gridcell_sessions.query('frequency==11 and stim_location==\"ms\"')\n",
2019-10-16 05:28:13 +00:00
"\n",
2019-10-17 17:51:12 +00:00
"baseline_ii = gridcell_sessions.query('baseline and Hz30')\n",
"stimulated_30 = gridcell_sessions.query('frequency==30 and stim_location==\"ms\"')\n",
2019-10-16 05:28:13 +00:00
"\n",
"print(\"Number of gridcells in baseline i sessions\", len(baseline_i))\n",
"print(\"Number of gridcells in stimulated 11Hz ms sessions\", len(stimulated_11))\n",
"\n",
"print(\"Number of gridcells in baseline ii sessions\", len(baseline_ii))\n",
"print(\"Number of gridcells in stimulated 30Hz ms sessions\", len(stimulated_30))"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# slice unique units"
]
},
{
"cell_type": "code",
2019-10-17 17:51:12 +00:00
"execution_count": 13,
2019-10-16 05:28:13 +00:00
"metadata": {},
"outputs": [],
"source": [
"baseline_i = baseline_i.drop_duplicates('unit_id')\n",
"stimulated_11 = stimulated_11.drop_duplicates('unit_id')\n",
"baseline_ii = baseline_ii.drop_duplicates('unit_id')\n",
"stimulated_30 = stimulated_30.drop_duplicates('unit_id')"
]
},
{
"cell_type": "code",
2019-10-17 17:51:12 +00:00
"execution_count": 14,
2019-10-16 05:28:13 +00:00
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
2019-10-22 10:22:00 +00:00
"Number of gridcells in baseline i sessions 63\n",
"Number of gridcells in stimulated 11Hz ms sessions 58\n",
"Number of gridcells in baseline ii sessions 52\n",
"Number of gridcells in stimulated 30Hz ms sessions 38\n"
2019-10-16 05:28:13 +00:00
]
}
],
"source": [
"print(\"Number of gridcells in baseline i sessions\", len(baseline_i))\n",
"print(\"Number of gridcells in stimulated 11Hz ms sessions\", len(stimulated_11))\n",
"\n",
"print(\"Number of gridcells in baseline ii sessions\", len(baseline_ii))\n",
"print(\"Number of gridcells in stimulated 30Hz ms sessions\", len(stimulated_30))"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Calculate statistics"
]
},
{
"cell_type": "code",
2019-10-17 17:51:12 +00:00
"execution_count": 15,
2019-10-16 05:28:13 +00:00
"metadata": {},
"outputs": [],
"source": [
"columns = [\n",
" 'average_rate', 'gridness', 'sparsity', 'selectivity', 'information_specificity',\n",
" 'max_rate', 'information_rate', 'interspike_interval_cv', \n",
" 'in_field_mean_rate', 'out_field_mean_rate', \n",
" 'burst_event_ratio', 'specificity', 'speed_score'\n",
"]"
]
},
{
"cell_type": "code",
2019-10-17 17:51:12 +00:00
"execution_count": 16,
2019-10-16 05:28:13 +00:00
"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>average_rate</th>\n",
" <th>gridness</th>\n",
" <th>sparsity</th>\n",
" <th>selectivity</th>\n",
" <th>information_specificity</th>\n",
" <th>max_rate</th>\n",
" <th>information_rate</th>\n",
" <th>interspike_interval_cv</th>\n",
" <th>in_field_mean_rate</th>\n",
" <th>out_field_mean_rate</th>\n",
" <th>burst_event_ratio</th>\n",
" <th>specificity</th>\n",
" <th>speed_score</th>\n",
" </tr>\n",
" <tr>\n",
" <th>stimulated</th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>False</th>\n",
2019-10-22 10:22:00 +00:00
" <td>8.904501</td>\n",
" <td>0.521371</td>\n",
" <td>0.618384</td>\n",
" <td>5.934539</td>\n",
" <td>0.234632</td>\n",
" <td>37.437808</td>\n",
" <td>1.246546</td>\n",
" <td>2.404647</td>\n",
" <td>14.717635</td>\n",
" <td>6.346875</td>\n",
" <td>0.211840</td>\n",
" <td>0.478775</td>\n",
" <td>0.135495</td>\n",
2019-10-16 05:28:13 +00:00
" </tr>\n",
" <tr>\n",
" <th>True</th>\n",
2019-10-22 10:22:00 +00:00
" <td>8.392252</td>\n",
" <td>0.440296</td>\n",
" <td>0.655698</td>\n",
" <td>5.977408</td>\n",
" <td>0.215736</td>\n",
" <td>33.716478</td>\n",
" <td>0.964787</td>\n",
" <td>2.223636</td>\n",
" <td>12.936021</td>\n",
" <td>6.122228</td>\n",
" <td>0.197264</td>\n",
" <td>0.455878</td>\n",
" <td>0.104697</td>\n",
2019-10-16 05:28:13 +00:00
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" average_rate gridness sparsity selectivity \\\n",
"stimulated \n",
2019-10-22 10:22:00 +00:00
"False 8.904501 0.521371 0.618384 5.934539 \n",
"True 8.392252 0.440296 0.655698 5.977408 \n",
2019-10-16 05:28:13 +00:00
"\n",
" information_specificity max_rate information_rate \\\n",
"stimulated \n",
2019-10-22 10:22:00 +00:00
"False 0.234632 37.437808 1.246546 \n",
"True 0.215736 33.716478 0.964787 \n",
2019-10-16 05:28:13 +00:00
"\n",
" interspike_interval_cv in_field_mean_rate out_field_mean_rate \\\n",
"stimulated \n",
2019-10-22 10:22:00 +00:00
"False 2.404647 14.717635 6.346875 \n",
"True 2.223636 12.936021 6.122228 \n",
2019-10-16 05:28:13 +00:00
"\n",
" burst_event_ratio specificity speed_score \n",
"stimulated \n",
2019-10-22 10:22:00 +00:00
"False 0.211840 0.478775 0.135495 \n",
"True 0.197264 0.455878 0.104697 "
2019-10-16 05:28:13 +00:00
]
},
2019-10-17 17:51:12 +00:00
"execution_count": 16,
2019-10-16 05:28:13 +00:00
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
2019-10-17 17:51:12 +00:00
"gridcell_sessions.groupby('stimulated')[columns].mean()"
2019-10-16 05:28:13 +00:00
]
},
{
"cell_type": "code",
2019-10-17 17:51:12 +00:00
"execution_count": 17,
2019-10-16 05:28:13 +00:00
"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>average_rate</th>\n",
" <th>gridness</th>\n",
" <th>sparsity</th>\n",
" <th>selectivity</th>\n",
" <th>information_specificity</th>\n",
" <th>max_rate</th>\n",
" <th>information_rate</th>\n",
" <th>interspike_interval_cv</th>\n",
" <th>in_field_mean_rate</th>\n",
" <th>out_field_mean_rate</th>\n",
" <th>burst_event_ratio</th>\n",
" <th>specificity</th>\n",
" <th>speed_score</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>count</th>\n",
2019-10-22 10:22:00 +00:00
" <td>129.000000</td>\n",
" <td>129.000000</td>\n",
" <td>129.000000</td>\n",
" <td>129.000000</td>\n",
" <td>129.000000</td>\n",
" <td>129.000000</td>\n",
" <td>129.000000</td>\n",
" <td>129.000000</td>\n",
" <td>129.000000</td>\n",
" <td>129.000000</td>\n",
" <td>129.000000</td>\n",
" <td>129.000000</td>\n",
" <td>129.000000</td>\n",
2019-10-16 05:28:13 +00:00
" </tr>\n",
" <tr>\n",
" <th>mean</th>\n",
2019-10-22 10:22:00 +00:00
" <td>8.904501</td>\n",
" <td>0.521371</td>\n",
" <td>0.618384</td>\n",
" <td>5.934539</td>\n",
" <td>0.234632</td>\n",
" <td>37.437808</td>\n",
" <td>1.246546</td>\n",
" <td>2.404647</td>\n",
" <td>14.717635</td>\n",
" <td>6.346875</td>\n",
" <td>0.211840</td>\n",
" <td>0.478775</td>\n",
" <td>0.135495</td>\n",
2019-10-16 05:28:13 +00:00
" </tr>\n",
" <tr>\n",
" <th>std</th>\n",
2019-10-22 10:22:00 +00:00
" <td>7.605598</td>\n",
" <td>0.337607</td>\n",
" <td>0.187934</td>\n",
" <td>3.217366</td>\n",
" <td>0.200726</td>\n",
" <td>16.300117</td>\n",
" <td>0.605971</td>\n",
" <td>0.756407</td>\n",
" <td>9.267522</td>\n",
" <td>6.805499</td>\n",
" <td>0.080143</td>\n",
" <td>0.209531</td>\n",
" <td>0.072831</td>\n",
2019-10-16 05:28:13 +00:00
" </tr>\n",
" <tr>\n",
" <th>min</th>\n",
2019-10-22 10:22:00 +00:00
" <td>0.478349</td>\n",
" <td>-0.684924</td>\n",
" <td>0.200066</td>\n",
" <td>1.533216</td>\n",
" <td>0.007807</td>\n",
" <td>3.346027</td>\n",
" <td>0.117638</td>\n",
" <td>1.304387</td>\n",
" <td>0.924066</td>\n",
" <td>0.159076</td>\n",
" <td>0.025000</td>\n",
" <td>0.071681</td>\n",
" <td>-0.025629</td>\n",
2019-10-16 05:28:13 +00:00
" </tr>\n",
" <tr>\n",
" <th>25%</th>\n",
2019-10-22 10:22:00 +00:00
" <td>3.518392</td>\n",
" <td>0.316326</td>\n",
" <td>0.437499</td>\n",
" <td>3.729863</td>\n",
" <td>0.093252</td>\n",
" <td>26.948843</td>\n",
" <td>0.786753</td>\n",
" <td>1.872991</td>\n",
" <td>7.701156</td>\n",
" <td>1.669844</td>\n",
" <td>0.160795</td>\n",
" <td>0.310822</td>\n",
" <td>0.084280</td>\n",
2019-10-16 05:28:13 +00:00
" </tr>\n",
" <tr>\n",
" <th>50%</th>\n",
2019-10-22 10:22:00 +00:00
" <td>6.456882</td>\n",
" <td>0.529243</td>\n",
" <td>0.642167</td>\n",
" <td>4.794970</td>\n",
" <td>0.180286</td>\n",
" <td>35.064991</td>\n",
" <td>1.156087</td>\n",
" <td>2.221185</td>\n",
" <td>12.212289</td>\n",
" <td>4.314913</td>\n",
" <td>0.210240</td>\n",
" <td>0.436340</td>\n",
" <td>0.128603</td>\n",
2019-10-16 05:28:13 +00:00
" </tr>\n",
" <tr>\n",
" <th>75%</th>\n",
2019-10-22 10:22:00 +00:00
" <td>12.721755</td>\n",
" <td>0.783682</td>\n",
" <td>0.758097</td>\n",
" <td>7.439464</td>\n",
" <td>0.312487</td>\n",
" <td>44.324873</td>\n",
" <td>1.592948</td>\n",
" <td>2.770624</td>\n",
" <td>20.974026</td>\n",
" <td>9.121505</td>\n",
" <td>0.267568</td>\n",
" <td>0.624834</td>\n",
" <td>0.188948</td>\n",
2019-10-16 05:28:13 +00:00
" </tr>\n",
" <tr>\n",
" <th>max</th>\n",
2019-10-22 10:22:00 +00:00
" <td>59.365312</td>\n",
" <td>1.148979</td>\n",
" <td>0.976157</td>\n",
" <td>18.975875</td>\n",
" <td>1.243307</td>\n",
" <td>90.160158</td>\n",
" <td>3.456796</td>\n",
" <td>5.671362</td>\n",
" <td>66.350754</td>\n",
" <td>56.255544</td>\n",
" <td>0.393306</td>\n",
" <td>1.066391</td>\n",
" <td>0.297548</td>\n",
2019-10-16 05:28:13 +00:00
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" average_rate gridness sparsity selectivity \\\n",
2019-10-22 10:22:00 +00:00
"count 129.000000 129.000000 129.000000 129.000000 \n",
"mean 8.904501 0.521371 0.618384 5.934539 \n",
"std 7.605598 0.337607 0.187934 3.217366 \n",
"min 0.478349 -0.684924 0.200066 1.533216 \n",
"25% 3.518392 0.316326 0.437499 3.729863 \n",
"50% 6.456882 0.529243 0.642167 4.794970 \n",
"75% 12.721755 0.783682 0.758097 7.439464 \n",
"max 59.365312 1.148979 0.976157 18.975875 \n",
2019-10-16 05:28:13 +00:00
"\n",
" information_specificity max_rate information_rate \\\n",
2019-10-22 10:22:00 +00:00
"count 129.000000 129.000000 129.000000 \n",
"mean 0.234632 37.437808 1.246546 \n",
"std 0.200726 16.300117 0.605971 \n",
"min 0.007807 3.346027 0.117638 \n",
"25% 0.093252 26.948843 0.786753 \n",
"50% 0.180286 35.064991 1.156087 \n",
"75% 0.312487 44.324873 1.592948 \n",
"max 1.243307 90.160158 3.456796 \n",
2019-10-16 05:28:13 +00:00
"\n",
" interspike_interval_cv in_field_mean_rate out_field_mean_rate \\\n",
2019-10-22 10:22:00 +00:00
"count 129.000000 129.000000 129.000000 \n",
"mean 2.404647 14.717635 6.346875 \n",
"std 0.756407 9.267522 6.805499 \n",
"min 1.304387 0.924066 0.159076 \n",
"25% 1.872991 7.701156 1.669844 \n",
"50% 2.221185 12.212289 4.314913 \n",
"75% 2.770624 20.974026 9.121505 \n",
"max 5.671362 66.350754 56.255544 \n",
2019-10-16 05:28:13 +00:00
"\n",
" burst_event_ratio specificity speed_score \n",
2019-10-22 10:22:00 +00:00
"count 129.000000 129.000000 129.000000 \n",
"mean 0.211840 0.478775 0.135495 \n",
"std 0.080143 0.209531 0.072831 \n",
"min 0.025000 0.071681 -0.025629 \n",
"25% 0.160795 0.310822 0.084280 \n",
"50% 0.210240 0.436340 0.128603 \n",
"75% 0.267568 0.624834 0.188948 \n",
"max 0.393306 1.066391 0.297548 "
2019-10-16 05:28:13 +00:00
]
},
2019-10-17 17:51:12 +00:00
"execution_count": 17,
2019-10-16 05:28:13 +00:00
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
2019-10-17 17:51:12 +00:00
"gridcell_sessions.query('baseline')[columns].describe()"
2019-10-16 05:28:13 +00:00
]
},
{
"cell_type": "code",
2019-10-17 17:51:12 +00:00
"execution_count": 18,
2019-10-16 05:28:13 +00:00
"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>average_rate</th>\n",
" <th>gridness</th>\n",
" <th>sparsity</th>\n",
" <th>selectivity</th>\n",
" <th>information_specificity</th>\n",
" <th>max_rate</th>\n",
" <th>information_rate</th>\n",
" <th>interspike_interval_cv</th>\n",
" <th>in_field_mean_rate</th>\n",
" <th>out_field_mean_rate</th>\n",
" <th>burst_event_ratio</th>\n",
" <th>specificity</th>\n",
" <th>speed_score</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>count</th>\n",
2019-10-22 10:22:00 +00:00
" <td>102.000000</td>\n",
" <td>102.000000</td>\n",
" <td>102.000000</td>\n",
" <td>102.000000</td>\n",
" <td>102.000000</td>\n",
" <td>102.000000</td>\n",
" <td>102.000000</td>\n",
" <td>102.000000</td>\n",
" <td>102.000000</td>\n",
" <td>102.000000</td>\n",
" <td>102.000000</td>\n",
" <td>102.000000</td>\n",
" <td>102.000000</td>\n",
2019-10-16 05:28:13 +00:00
" </tr>\n",
" <tr>\n",
" <th>mean</th>\n",
2019-10-22 10:22:00 +00:00
" <td>8.392252</td>\n",
" <td>0.440296</td>\n",
" <td>0.655698</td>\n",
" <td>5.977408</td>\n",
" <td>0.215736</td>\n",
" <td>33.716478</td>\n",
" <td>0.964787</td>\n",
" <td>2.223636</td>\n",
" <td>12.936021</td>\n",
" <td>6.122228</td>\n",
" <td>0.197264</td>\n",
" <td>0.455878</td>\n",
" <td>0.104697</td>\n",
2019-10-16 05:28:13 +00:00
" </tr>\n",
" <tr>\n",
" <th>std</th>\n",
2019-10-22 10:22:00 +00:00
" <td>6.057001</td>\n",
" <td>0.357038</td>\n",
" <td>0.211704</td>\n",
" <td>3.702400</td>\n",
" <td>0.235916</td>\n",
" <td>13.249312</td>\n",
" <td>0.572972</td>\n",
" <td>0.819734</td>\n",
" <td>7.211895</td>\n",
" <td>5.366332</td>\n",
" <td>0.082164</td>\n",
" <td>0.236777</td>\n",
" <td>0.081989</td>\n",
2019-10-16 05:28:13 +00:00
" </tr>\n",
" <tr>\n",
" <th>min</th>\n",
2019-10-22 10:22:00 +00:00
" <td>0.198337</td>\n",
" <td>-0.516914</td>\n",
" <td>0.172684</td>\n",
" <td>1.930026</td>\n",
" <td>0.013088</td>\n",
" <td>2.846281</td>\n",
" <td>0.063173</td>\n",
" <td>1.110672</td>\n",
" <td>0.524639</td>\n",
" <td>0.099060</td>\n",
" <td>0.008475</td>\n",
" <td>0.097718</td>\n",
" <td>-0.138128</td>\n",
2019-10-16 05:28:13 +00:00
" </tr>\n",
" <tr>\n",
" <th>25%</th>\n",
2019-10-22 10:22:00 +00:00
" <td>3.579184</td>\n",
" <td>0.265949</td>\n",
" <td>0.458493</td>\n",
" <td>3.044303</td>\n",
" <td>0.066656</td>\n",
" <td>25.555110</td>\n",
" <td>0.564279</td>\n",
" <td>1.620472</td>\n",
" <td>7.555760</td>\n",
" <td>1.733624</td>\n",
" <td>0.146755</td>\n",
" <td>0.248057</td>\n",
" <td>0.056903</td>\n",
2019-10-16 05:28:13 +00:00
" </tr>\n",
" <tr>\n",
" <th>50%</th>\n",
2019-10-22 10:22:00 +00:00
" <td>6.838561</td>\n",
" <td>0.399053</td>\n",
" <td>0.699561</td>\n",
" <td>4.891855</td>\n",
" <td>0.128562</td>\n",
" <td>31.402558</td>\n",
" <td>0.862413</td>\n",
" <td>2.084020</td>\n",
" <td>11.451560</td>\n",
" <td>4.234871</td>\n",
" <td>0.192948</td>\n",
" <td>0.376143</td>\n",
" <td>0.106314</td>\n",
2019-10-16 05:28:13 +00:00
" </tr>\n",
" <tr>\n",
" <th>75%</th>\n",
2019-10-22 10:22:00 +00:00
" <td>11.934599</td>\n",
" <td>0.749561</td>\n",
" <td>0.842332</td>\n",
" <td>8.001587</td>\n",
" <td>0.300713</td>\n",
" <td>42.334786</td>\n",
" <td>1.190324</td>\n",
" <td>2.673991</td>\n",
" <td>17.335356</td>\n",
" <td>8.583415</td>\n",
" <td>0.247405</td>\n",
" <td>0.684623</td>\n",
" <td>0.149313</td>\n",
2019-10-16 05:28:13 +00:00
" </tr>\n",
" <tr>\n",
" <th>max</th>\n",
2019-10-22 10:22:00 +00:00
" <td>24.858738</td>\n",
" <td>1.155123</td>\n",
" <td>0.967003</td>\n",
" <td>19.911477</td>\n",
" <td>1.359164</td>\n",
" <td>65.990793</td>\n",
" <td>3.182285</td>\n",
" <td>6.526960</td>\n",
" <td>34.489913</td>\n",
" <td>21.696265</td>\n",
" <td>0.393037</td>\n",
" <td>1.091064</td>\n",
" <td>0.390079</td>\n",
2019-10-16 05:28:13 +00:00
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
2019-10-17 17:51:12 +00:00
" average_rate gridness sparsity selectivity \\\n",
2019-10-22 10:22:00 +00:00
"count 102.000000 102.000000 102.000000 102.000000 \n",
"mean 8.392252 0.440296 0.655698 5.977408 \n",
"std 6.057001 0.357038 0.211704 3.702400 \n",
"min 0.198337 -0.516914 0.172684 1.930026 \n",
"25% 3.579184 0.265949 0.458493 3.044303 \n",
"50% 6.838561 0.399053 0.699561 4.891855 \n",
"75% 11.934599 0.749561 0.842332 8.001587 \n",
"max 24.858738 1.155123 0.967003 19.911477 \n",
2019-10-16 05:28:13 +00:00
"\n",
" information_specificity max_rate information_rate \\\n",
2019-10-22 10:22:00 +00:00
"count 102.000000 102.000000 102.000000 \n",
"mean 0.215736 33.716478 0.964787 \n",
"std 0.235916 13.249312 0.572972 \n",
"min 0.013088 2.846281 0.063173 \n",
"25% 0.066656 25.555110 0.564279 \n",
"50% 0.128562 31.402558 0.862413 \n",
"75% 0.300713 42.334786 1.190324 \n",
"max 1.359164 65.990793 3.182285 \n",
2019-10-16 05:28:13 +00:00
"\n",
" interspike_interval_cv in_field_mean_rate out_field_mean_rate \\\n",
2019-10-22 10:22:00 +00:00
"count 102.000000 102.000000 102.000000 \n",
"mean 2.223636 12.936021 6.122228 \n",
"std 0.819734 7.211895 5.366332 \n",
"min 1.110672 0.524639 0.099060 \n",
"25% 1.620472 7.555760 1.733624 \n",
"50% 2.084020 11.451560 4.234871 \n",
"75% 2.673991 17.335356 8.583415 \n",
"max 6.526960 34.489913 21.696265 \n",
2019-10-16 05:28:13 +00:00
"\n",
" burst_event_ratio specificity speed_score \n",
2019-10-22 10:22:00 +00:00
"count 102.000000 102.000000 102.000000 \n",
"mean 0.197264 0.455878 0.104697 \n",
"std 0.082164 0.236777 0.081989 \n",
"min 0.008475 0.097718 -0.138128 \n",
"25% 0.146755 0.248057 0.056903 \n",
"50% 0.192948 0.376143 0.106314 \n",
"75% 0.247405 0.684623 0.149313 \n",
"max 0.393037 1.091064 0.390079 "
2019-10-16 05:28:13 +00:00
]
},
2019-10-17 17:51:12 +00:00
"execution_count": 18,
2019-10-16 05:28:13 +00:00
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
2019-10-17 17:51:12 +00:00
"gridcell_sessions.query(\"stimulated\")[columns].describe()"
2019-10-16 05:28:13 +00:00
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Create nice table"
]
},
{
"cell_type": "code",
2019-10-17 17:51:12 +00:00
"execution_count": 19,
2019-10-16 05:28:13 +00:00
"metadata": {},
"outputs": [],
"source": [
"def summarize(data):\n",
" return \"{:.2f} ± {:.2f} ({})\".format(data.mean(), data.sem(), sum(~np.isnan(data)))\n",
"\n",
"\n",
"def MWU(column, stim, base):\n",
" '''\n",
" Mann Whitney U\n",
" '''\n",
" Uvalue, pvalue = scipy.stats.mannwhitneyu(\n",
" stim[column].dropna(), \n",
" base[column].dropna(),\n",
" alternative='two-sided')\n",
"\n",
" return \"{:.2f}, {:.3f}\".format(Uvalue, pvalue)\n",
"\n",
"\n",
"def PRS(column, stim, base):\n",
" '''\n",
" Permutation ReSampling\n",
" '''\n",
" pvalue, observed_diff, diffs = permutation_resampling(\n",
" stim[column].dropna(), \n",
" base[column].dropna(), statistic=np.median)\n",
"\n",
" return \"{:.2f}, {:.3f}\".format(observed_diff, pvalue)\n",
"\n",
"\n",
"def rename(name):\n",
" return name.replace(\"_field\", \"-field\").replace(\"_\", \" \").capitalize()"
]
},
{
"cell_type": "code",
2019-10-22 10:22:00 +00:00
"execution_count": 20,
2019-10-16 05:28:13 +00:00
"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>Baseline</th>\n",
2019-10-17 17:51:12 +00:00
" <th>Stimulated</th>\n",
2019-10-16 05:28:13 +00:00
" <th>MWU</th>\n",
" <th>PRS</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>Average rate</th>\n",
2019-10-22 10:22:00 +00:00
" <td>8.90 ± 0.67 (129)</td>\n",
" <td>8.39 ± 0.60 (102)</td>\n",
" <td>6514.00, 0.898</td>\n",
" <td>0.38, 0.786</td>\n",
2019-10-16 05:28:13 +00:00
" </tr>\n",
" <tr>\n",
" <th>Gridness</th>\n",
2019-10-22 10:22:00 +00:00
" <td>0.52 ± 0.03 (129)</td>\n",
" <td>0.44 ± 0.04 (102)</td>\n",
" <td>5681.00, 0.075</td>\n",
" <td>0.13, 0.065</td>\n",
2019-10-16 05:28:13 +00:00
" </tr>\n",
" <tr>\n",
" <th>Sparsity</th>\n",
2019-10-22 10:22:00 +00:00
" <td>0.62 ± 0.02 (129)</td>\n",
" <td>0.66 ± 0.02 (102)</td>\n",
" <td>7486.00, 0.072</td>\n",
" <td>0.06, 0.124</td>\n",
2019-10-16 05:28:13 +00:00
" </tr>\n",
" <tr>\n",
" <th>Selectivity</th>\n",
2019-10-22 10:22:00 +00:00
" <td>5.93 ± 0.28 (129)</td>\n",
" <td>5.98 ± 0.37 (102)</td>\n",
" <td>6254.00, 0.520</td>\n",
" <td>0.10, 0.803</td>\n",
2019-10-16 05:28:13 +00:00
" </tr>\n",
" <tr>\n",
" <th>Information specificity</th>\n",
2019-10-22 10:22:00 +00:00
" <td>0.23 ± 0.02 (129)</td>\n",
" <td>0.22 ± 0.02 (102)</td>\n",
" <td>5573.00, 0.046</td>\n",
" <td>0.05, 0.031</td>\n",
2019-10-16 05:28:13 +00:00
" </tr>\n",
" <tr>\n",
" <th>Max rate</th>\n",
2019-10-22 10:22:00 +00:00
" <td>37.44 ± 1.44 (129)</td>\n",
" <td>33.72 ± 1.31 (102)</td>\n",
" <td>5851.00, 0.149</td>\n",
" <td>3.66, 0.072</td>\n",
2019-10-16 05:28:13 +00:00
" </tr>\n",
" <tr>\n",
" <th>Information rate</th>\n",
2019-10-22 10:22:00 +00:00
" <td>1.25 ± 0.05 (129)</td>\n",
" <td>0.96 ± 0.06 (102)</td>\n",
" <td>4646.00, 0.000</td>\n",
" <td>0.29, 0.001</td>\n",
2019-10-16 05:28:13 +00:00
" </tr>\n",
" <tr>\n",
" <th>Interspike interval cv</th>\n",
2019-10-22 10:22:00 +00:00
" <td>2.40 ± 0.07 (129)</td>\n",
" <td>2.22 ± 0.08 (102)</td>\n",
" <td>5516.00, 0.035</td>\n",
" <td>0.14, 0.270</td>\n",
2019-10-16 05:28:13 +00:00
" </tr>\n",
" <tr>\n",
" <th>In-field mean rate</th>\n",
2019-10-22 10:22:00 +00:00
" <td>14.72 ± 0.82 (129)</td>\n",
" <td>12.94 ± 0.71 (102)</td>\n",
" <td>6026.00, 0.273</td>\n",
" <td>0.76, 0.414</td>\n",
2019-10-16 05:28:13 +00:00
" </tr>\n",
" <tr>\n",
" <th>Out-field mean rate</th>\n",
2019-10-22 10:22:00 +00:00
" <td>6.35 ± 0.60 (129)</td>\n",
" <td>6.12 ± 0.53 (102)</td>\n",
" <td>6535.00, 0.931</td>\n",
" <td>0.08, 0.921</td>\n",
2019-10-16 05:28:13 +00:00
" </tr>\n",
" <tr>\n",
" <th>Burst event ratio</th>\n",
2019-10-22 10:22:00 +00:00
" <td>0.21 ± 0.01 (129)</td>\n",
" <td>0.20 ± 0.01 (102)</td>\n",
" <td>5792.00, 0.119</td>\n",
" <td>0.02, 0.071</td>\n",
2019-10-16 05:28:13 +00:00
" </tr>\n",
" <tr>\n",
" <th>Specificity</th>\n",
2019-10-22 10:22:00 +00:00
" <td>0.48 ± 0.02 (129)</td>\n",
" <td>0.46 ± 0.02 (102)</td>\n",
" <td>5962.00, 0.222</td>\n",
" <td>0.06, 0.181</td>\n",
2019-10-16 05:28:13 +00:00
" </tr>\n",
" <tr>\n",
" <th>Speed score</th>\n",
2019-10-22 10:22:00 +00:00
" <td>0.14 ± 0.01 (129)</td>\n",
" <td>0.10 ± 0.01 (102)</td>\n",
" <td>5128.00, 0.004</td>\n",
" <td>0.02, 0.008</td>\n",
2019-10-16 05:28:13 +00:00
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
2019-10-17 17:51:12 +00:00
" Baseline Stimulated \\\n",
2019-10-22 10:22:00 +00:00
"Average rate 8.90 ± 0.67 (129) 8.39 ± 0.60 (102) \n",
"Gridness 0.52 ± 0.03 (129) 0.44 ± 0.04 (102) \n",
"Sparsity 0.62 ± 0.02 (129) 0.66 ± 0.02 (102) \n",
"Selectivity 5.93 ± 0.28 (129) 5.98 ± 0.37 (102) \n",
"Information specificity 0.23 ± 0.02 (129) 0.22 ± 0.02 (102) \n",
"Max rate 37.44 ± 1.44 (129) 33.72 ± 1.31 (102) \n",
"Information rate 1.25 ± 0.05 (129) 0.96 ± 0.06 (102) \n",
"Interspike interval cv 2.40 ± 0.07 (129) 2.22 ± 0.08 (102) \n",
"In-field mean rate 14.72 ± 0.82 (129) 12.94 ± 0.71 (102) \n",
"Out-field mean rate 6.35 ± 0.60 (129) 6.12 ± 0.53 (102) \n",
"Burst event ratio 0.21 ± 0.01 (129) 0.20 ± 0.01 (102) \n",
"Specificity 0.48 ± 0.02 (129) 0.46 ± 0.02 (102) \n",
"Speed score 0.14 ± 0.01 (129) 0.10 ± 0.01 (102) \n",
2019-10-16 05:28:13 +00:00
"\n",
2019-10-22 10:22:00 +00:00
" MWU PRS \n",
"Average rate 6514.00, 0.898 0.38, 0.786 \n",
"Gridness 5681.00, 0.075 0.13, 0.065 \n",
"Sparsity 7486.00, 0.072 0.06, 0.124 \n",
"Selectivity 6254.00, 0.520 0.10, 0.803 \n",
"Information specificity 5573.00, 0.046 0.05, 0.031 \n",
"Max rate 5851.00, 0.149 3.66, 0.072 \n",
"Information rate 4646.00, 0.000 0.29, 0.001 \n",
"Interspike interval cv 5516.00, 0.035 0.14, 0.270 \n",
"In-field mean rate 6026.00, 0.273 0.76, 0.414 \n",
"Out-field mean rate 6535.00, 0.931 0.08, 0.921 \n",
"Burst event ratio 5792.00, 0.119 0.02, 0.071 \n",
"Specificity 5962.00, 0.222 0.06, 0.181 \n",
"Speed score 5128.00, 0.004 0.02, 0.008 "
2019-10-16 05:28:13 +00:00
]
},
2019-10-22 10:22:00 +00:00
"execution_count": 20,
2019-10-16 05:28:13 +00:00
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
2019-10-17 17:51:12 +00:00
"_stim_data = gridcell_sessions.query('stimulated')\n",
"_base_data = gridcell_sessions.query('baseline')\n",
2019-10-16 05:28:13 +00:00
"\n",
"result = pd.DataFrame()\n",
"\n",
"result['Baseline'] = _base_data[columns].agg(summarize)\n",
2019-10-17 17:51:12 +00:00
"result['Stimulated'] = _stim_data[columns].agg(summarize)\n",
"\n",
2019-10-16 05:28:13 +00:00
"\n",
"result.index = map(rename, result.index)\n",
"\n",
"result['MWU'] = list(map(lambda x: MWU(x, _stim_data, _base_data), columns))\n",
"result['PRS'] = list(map(lambda x: PRS(x, _stim_data, _base_data), columns))\n",
"\n",
"result.to_latex(output_path / \"statistics\" / \"statistics.tex\")\n",
"result.to_latex(output_path / \"statistics\" / \"statistics.csv\")\n",
"result"
]
},
{
"cell_type": "code",
2019-10-22 10:22:00 +00:00
"execution_count": 21,
2019-10-16 05:28:13 +00:00
"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>Baseline</th>\n",
2019-10-17 17:51:12 +00:00
" <th>11 Hz</th>\n",
2019-10-16 05:28:13 +00:00
" <th>MWU</th>\n",
" <th>PRS</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>Average rate</th>\n",
2019-10-22 10:22:00 +00:00
" <td>8.96 ± 0.80 (63)</td>\n",
" <td>8.80 ± 0.85 (58)</td>\n",
" <td>1781.00, 0.813</td>\n",
" <td>0.04, 0.969</td>\n",
2019-10-16 05:28:13 +00:00
" </tr>\n",
" <tr>\n",
" <th>Gridness</th>\n",
2019-10-22 10:22:00 +00:00
" <td>0.53 ± 0.05 (63)</td>\n",
" <td>0.41 ± 0.05 (58)</td>\n",
" <td>1459.00, 0.057</td>\n",
" <td>0.21, 0.038</td>\n",
2019-10-16 05:28:13 +00:00
" </tr>\n",
" <tr>\n",
" <th>Sparsity</th>\n",
2019-10-22 10:22:00 +00:00
" <td>0.63 ± 0.02 (63)</td>\n",
" <td>0.67 ± 0.03 (58)</td>\n",
" <td>2138.00, 0.107</td>\n",
" <td>0.07, 0.126</td>\n",
2019-10-16 05:28:13 +00:00
" </tr>\n",
" <tr>\n",
" <th>Selectivity</th>\n",
2019-10-22 10:22:00 +00:00
" <td>5.76 ± 0.40 (63)</td>\n",
" <td>5.69 ± 0.50 (58)</td>\n",
" <td>1687.00, 0.469</td>\n",
" <td>0.00, 0.981</td>\n",
2019-10-16 05:28:13 +00:00
" </tr>\n",
" <tr>\n",
" <th>Information specificity</th>\n",
2019-10-22 10:22:00 +00:00
" <td>0.24 ± 0.03 (63)</td>\n",
" <td>0.21 ± 0.03 (58)</td>\n",
" <td>1452.00, 0.052</td>\n",
" <td>0.06, 0.031</td>\n",
2019-10-16 05:28:13 +00:00
" </tr>\n",
" <tr>\n",
" <th>Max rate</th>\n",
2019-10-22 10:22:00 +00:00
" <td>37.39 ± 1.91 (63)</td>\n",
" <td>33.11 ± 1.85 (58)</td>\n",
" <td>1538.00, 0.134</td>\n",
" <td>4.06, 0.128</td>\n",
2019-10-16 05:28:13 +00:00
" </tr>\n",
" <tr>\n",
" <th>Information rate</th>\n",
2019-10-22 10:22:00 +00:00
" <td>1.31 ± 0.08 (63)</td>\n",
" <td>0.94 ± 0.08 (58)</td>\n",
" <td>1143.00, 0.000</td>\n",
" <td>0.32, 0.003</td>\n",
2019-10-16 05:28:13 +00:00
" </tr>\n",
" <tr>\n",
" <th>Interspike interval cv</th>\n",
2019-10-22 10:22:00 +00:00
" <td>2.39 ± 0.10 (63)</td>\n",
" <td>2.19 ± 0.12 (58)</td>\n",
" <td>1462.00, 0.059</td>\n",
" <td>0.18, 0.135</td>\n",
2019-10-16 05:28:13 +00:00
" </tr>\n",
" <tr>\n",
" <th>In-field mean rate</th>\n",
2019-10-22 10:22:00 +00:00
" <td>14.88 ± 1.05 (63)</td>\n",
" <td>13.27 ± 1.04 (58)</td>\n",
" <td>1633.00, 0.315</td>\n",
" <td>0.77, 0.683</td>\n",
2019-10-16 05:28:13 +00:00
" </tr>\n",
" <tr>\n",
" <th>Out-field mean rate</th>\n",
2019-10-22 10:22:00 +00:00
" <td>6.37 ± 0.67 (63)</td>\n",
" <td>6.57 ± 0.77 (58)</td>\n",
" <td>1795.00, 0.870</td>\n",
" <td>0.47, 0.719</td>\n",
2019-10-16 05:28:13 +00:00
" </tr>\n",
" <tr>\n",
" <th>Burst event ratio</th>\n",
2019-10-22 10:22:00 +00:00
" <td>0.22 ± 0.01 (63)</td>\n",
" <td>0.22 ± 0.01 (58)</td>\n",
" <td>1897.00, 0.718</td>\n",
" <td>0.00, 0.824</td>\n",
2019-10-16 05:28:13 +00:00
" </tr>\n",
" <tr>\n",
" <th>Specificity</th>\n",
2019-10-22 10:22:00 +00:00
" <td>0.47 ± 0.03 (63)</td>\n",
" <td>0.44 ± 0.03 (58)</td>\n",
" <td>1605.00, 0.250</td>\n",
" <td>0.06, 0.398</td>\n",
2019-10-16 05:28:13 +00:00
" </tr>\n",
" <tr>\n",
" <th>Speed score</th>\n",
2019-10-22 10:22:00 +00:00
" <td>0.14 ± 0.01 (63)</td>\n",
" <td>0.11 ± 0.01 (58)</td>\n",
" <td>1378.00, 0.020</td>\n",
" <td>0.04, 0.023</td>\n",
2019-10-16 05:28:13 +00:00
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
2019-10-17 17:51:12 +00:00
" Baseline 11 Hz MWU \\\n",
2019-10-22 10:22:00 +00:00
"Average rate 8.96 ± 0.80 (63) 8.80 ± 0.85 (58) 1781.00, 0.813 \n",
"Gridness 0.53 ± 0.05 (63) 0.41 ± 0.05 (58) 1459.00, 0.057 \n",
"Sparsity 0.63 ± 0.02 (63) 0.67 ± 0.03 (58) 2138.00, 0.107 \n",
"Selectivity 5.76 ± 0.40 (63) 5.69 ± 0.50 (58) 1687.00, 0.469 \n",
"Information specificity 0.24 ± 0.03 (63) 0.21 ± 0.03 (58) 1452.00, 0.052 \n",
"Max rate 37.39 ± 1.91 (63) 33.11 ± 1.85 (58) 1538.00, 0.134 \n",
"Information rate 1.31 ± 0.08 (63) 0.94 ± 0.08 (58) 1143.00, 0.000 \n",
"Interspike interval cv 2.39 ± 0.10 (63) 2.19 ± 0.12 (58) 1462.00, 0.059 \n",
"In-field mean rate 14.88 ± 1.05 (63) 13.27 ± 1.04 (58) 1633.00, 0.315 \n",
"Out-field mean rate 6.37 ± 0.67 (63) 6.57 ± 0.77 (58) 1795.00, 0.870 \n",
"Burst event ratio 0.22 ± 0.01 (63) 0.22 ± 0.01 (58) 1897.00, 0.718 \n",
"Specificity 0.47 ± 0.03 (63) 0.44 ± 0.03 (58) 1605.00, 0.250 \n",
"Speed score 0.14 ± 0.01 (63) 0.11 ± 0.01 (58) 1378.00, 0.020 \n",
2019-10-16 05:28:13 +00:00
"\n",
" PRS \n",
2019-10-22 10:22:00 +00:00
"Average rate 0.04, 0.969 \n",
"Gridness 0.21, 0.038 \n",
"Sparsity 0.07, 0.126 \n",
"Selectivity 0.00, 0.981 \n",
"Information specificity 0.06, 0.031 \n",
"Max rate 4.06, 0.128 \n",
"Information rate 0.32, 0.003 \n",
"Interspike interval cv 0.18, 0.135 \n",
"In-field mean rate 0.77, 0.683 \n",
"Out-field mean rate 0.47, 0.719 \n",
"Burst event ratio 0.00, 0.824 \n",
"Specificity 0.06, 0.398 \n",
"Speed score 0.04, 0.023 "
2019-10-16 05:28:13 +00:00
]
},
2019-10-22 10:22:00 +00:00
"execution_count": 21,
2019-10-16 05:28:13 +00:00
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"_stim_data = stimulated_11\n",
"_base_data = baseline_i\n",
"\n",
"result = pd.DataFrame()\n",
"\n",
"result['Baseline'] = _base_data[columns].agg(summarize)\n",
2019-10-17 17:51:12 +00:00
"result['11 Hz'] = _stim_data[columns].agg(summarize)\n",
"\n",
2019-10-16 05:28:13 +00:00
"\n",
"result.index = map(rename, result.index)\n",
"\n",
"result['MWU'] = list(map(lambda x: MWU(x, _stim_data, _base_data), columns))\n",
"result['PRS'] = list(map(lambda x: PRS(x, _stim_data, _base_data), columns))\n",
"\n",
"\n",
"result.to_latex(output_path / \"statistics\" / \"statistics_11.tex\")\n",
"result.to_latex(output_path / \"statistics\" / \"statistics_11.csv\")\n",
"result"
]
},
{
"cell_type": "code",
2019-10-22 10:22:00 +00:00
"execution_count": 22,
2019-10-16 05:28:13 +00:00
"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>Baseline</th>\n",
2019-10-17 17:51:12 +00:00
" <th>30 Hz</th>\n",
2019-10-16 05:28:13 +00:00
" <th>MWU</th>\n",
" <th>PRS</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>Average rate</th>\n",
2019-10-22 10:22:00 +00:00
" <td>8.29 ± 0.87 (52)</td>\n",
" <td>7.61 ± 0.87 (38)</td>\n",
" <td>958.00, 0.810</td>\n",
" <td>0.27, 0.805</td>\n",
2019-10-16 05:28:13 +00:00
" </tr>\n",
" <tr>\n",
" <th>Gridness</th>\n",
2019-10-22 10:22:00 +00:00
" <td>0.54 ± 0.04 (52)</td>\n",
" <td>0.48 ± 0.06 (38)</td>\n",
" <td>914.00, 0.548</td>\n",
" <td>0.04, 0.608</td>\n",
2019-10-16 05:28:13 +00:00
" </tr>\n",
" <tr>\n",
" <th>Sparsity</th>\n",
2019-10-22 10:22:00 +00:00
" <td>0.63 ± 0.03 (52)</td>\n",
" <td>0.64 ± 0.03 (38)</td>\n",
" <td>1040.00, 0.674</td>\n",
" <td>0.06, 0.401</td>\n",
2019-10-16 05:28:13 +00:00
" </tr>\n",
" <tr>\n",
" <th>Selectivity</th>\n",
2019-10-22 10:22:00 +00:00
" <td>5.96 ± 0.46 (52)</td>\n",
" <td>6.42 ± 0.60 (38)</td>\n",
" <td>1019.00, 0.803</td>\n",
" <td>0.20, 0.850</td>\n",
2019-10-16 05:28:13 +00:00
" </tr>\n",
" <tr>\n",
" <th>Information specificity</th>\n",
2019-10-22 10:22:00 +00:00
" <td>0.21 ± 0.02 (52)</td>\n",
" <td>0.22 ± 0.03 (38)</td>\n",
" <td>950.00, 0.759</td>\n",
" <td>0.04, 0.505</td>\n",
2019-10-16 05:28:13 +00:00
" </tr>\n",
" <tr>\n",
" <th>Max rate</th>\n",
2019-10-22 10:22:00 +00:00
" <td>36.27 ± 2.34 (52)</td>\n",
" <td>33.49 ± 1.89 (38)</td>\n",
" <td>943.00, 0.716</td>\n",
" <td>2.90, 0.558</td>\n",
2019-10-16 05:28:13 +00:00
" </tr>\n",
" <tr>\n",
" <th>Information rate</th>\n",
2019-10-22 10:22:00 +00:00
" <td>1.13 ± 0.08 (52)</td>\n",
" <td>0.98 ± 0.09 (38)</td>\n",
" <td>827.00, 0.190</td>\n",
" <td>0.07, 0.332</td>\n",
2019-10-16 05:28:13 +00:00
" </tr>\n",
" <tr>\n",
" <th>Interspike interval cv</th>\n",
2019-10-22 10:22:00 +00:00
" <td>2.37 ± 0.09 (52)</td>\n",
" <td>2.23 ± 0.11 (38)</td>\n",
" <td>869.00, 0.333</td>\n",
" <td>0.17, 0.470</td>\n",
2019-10-16 05:28:13 +00:00
" </tr>\n",
" <tr>\n",
" <th>In-field mean rate</th>\n",
2019-10-22 10:22:00 +00:00
" <td>13.79 ± 1.12 (52)</td>\n",
" <td>12.21 ± 0.98 (38)</td>\n",
" <td>912.00, 0.537</td>\n",
" <td>1.06, 0.452</td>\n",
2019-10-16 05:28:13 +00:00
" </tr>\n",
" <tr>\n",
" <th>Out-field mean rate</th>\n",
2019-10-22 10:22:00 +00:00
" <td>5.80 ± 0.72 (52)</td>\n",
" <td>5.36 ± 0.73 (38)</td>\n",
" <td>959.00, 0.816</td>\n",
" <td>0.13, 0.916</td>\n",
2019-10-16 05:28:13 +00:00
" </tr>\n",
" <tr>\n",
" <th>Burst event ratio</th>\n",
2019-10-22 10:22:00 +00:00
" <td>0.20 ± 0.01 (52)</td>\n",
" <td>0.16 ± 0.01 (38)</td>\n",
" <td>676.00, 0.011</td>\n",
" <td>0.05, 0.007</td>\n",
2019-10-16 05:28:13 +00:00
" </tr>\n",
" <tr>\n",
" <th>Specificity</th>\n",
2019-10-22 10:22:00 +00:00
" <td>0.47 ± 0.03 (52)</td>\n",
" <td>0.48 ± 0.04 (38)</td>\n",
" <td>976.00, 0.925</td>\n",
" <td>0.00, 0.985</td>\n",
2019-10-16 05:28:13 +00:00
" </tr>\n",
" <tr>\n",
" <th>Speed score</th>\n",
2019-10-22 10:22:00 +00:00
" <td>0.12 ± 0.01 (52)</td>\n",
" <td>0.11 ± 0.01 (38)</td>\n",
" <td>784.00, 0.096</td>\n",
" <td>0.01, 0.241</td>\n",
2019-10-16 05:28:13 +00:00
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
2019-10-17 17:51:12 +00:00
" Baseline 30 Hz MWU \\\n",
2019-10-22 10:22:00 +00:00
"Average rate 8.29 ± 0.87 (52) 7.61 ± 0.87 (38) 958.00, 0.810 \n",
"Gridness 0.54 ± 0.04 (52) 0.48 ± 0.06 (38) 914.00, 0.548 \n",
"Sparsity 0.63 ± 0.03 (52) 0.64 ± 0.03 (38) 1040.00, 0.674 \n",
"Selectivity 5.96 ± 0.46 (52) 6.42 ± 0.60 (38) 1019.00, 0.803 \n",
"Information specificity 0.21 ± 0.02 (52) 0.22 ± 0.03 (38) 950.00, 0.759 \n",
"Max rate 36.27 ± 2.34 (52) 33.49 ± 1.89 (38) 943.00, 0.716 \n",
"Information rate 1.13 ± 0.08 (52) 0.98 ± 0.09 (38) 827.00, 0.190 \n",
"Interspike interval cv 2.37 ± 0.09 (52) 2.23 ± 0.11 (38) 869.00, 0.333 \n",
"In-field mean rate 13.79 ± 1.12 (52) 12.21 ± 0.98 (38) 912.00, 0.537 \n",
"Out-field mean rate 5.80 ± 0.72 (52) 5.36 ± 0.73 (38) 959.00, 0.816 \n",
"Burst event ratio 0.20 ± 0.01 (52) 0.16 ± 0.01 (38) 676.00, 0.011 \n",
"Specificity 0.47 ± 0.03 (52) 0.48 ± 0.04 (38) 976.00, 0.925 \n",
"Speed score 0.12 ± 0.01 (52) 0.11 ± 0.01 (38) 784.00, 0.096 \n",
2019-10-16 05:28:13 +00:00
"\n",
" PRS \n",
2019-10-22 10:22:00 +00:00
"Average rate 0.27, 0.805 \n",
"Gridness 0.04, 0.608 \n",
"Sparsity 0.06, 0.401 \n",
"Selectivity 0.20, 0.850 \n",
"Information specificity 0.04, 0.505 \n",
"Max rate 2.90, 0.558 \n",
"Information rate 0.07, 0.332 \n",
"Interspike interval cv 0.17, 0.470 \n",
"In-field mean rate 1.06, 0.452 \n",
"Out-field mean rate 0.13, 0.916 \n",
"Burst event ratio 0.05, 0.007 \n",
"Specificity 0.00, 0.985 \n",
"Speed score 0.01, 0.241 "
2019-10-16 05:28:13 +00:00
]
},
2019-10-22 10:22:00 +00:00
"execution_count": 22,
2019-10-16 05:28:13 +00:00
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"_stim_data = stimulated_30\n",
"_base_data = baseline_ii\n",
"\n",
"result = pd.DataFrame()\n",
"\n",
"result['Baseline'] = _base_data[columns].agg(summarize)\n",
2019-10-17 17:51:12 +00:00
"result['30 Hz'] = _stim_data[columns].agg(summarize)\n",
2019-10-16 05:28:13 +00:00
"\n",
"result.index = map(rename, result.index)\n",
"\n",
"result['MWU'] = list(map(lambda x: MWU(x, _stim_data, _base_data), columns))\n",
"result['PRS'] = list(map(lambda x: PRS(x, _stim_data, _base_data), columns))\n",
"\n",
"\n",
"result.to_latex(output_path / \"statistics\" / \"statistics_30.tex\")\n",
"result.to_latex(output_path / \"statistics\" / \"statistics_30.csv\")\n",
"result"
]
},
{
"cell_type": "code",
2019-10-22 10:22:00 +00:00
"execution_count": 23,
2019-10-16 05:28:13 +00:00
"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",
2019-10-22 10:22:00 +00:00
" <th>Baseline I</th>\n",
2019-10-17 17:51:12 +00:00
" <th>30 Hz</th>\n",
2019-10-16 05:28:13 +00:00
" <th>MWU</th>\n",
" <th>PRS</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>Average rate</th>\n",
2019-10-22 10:22:00 +00:00
" <td>8.96 ± 0.80 (63)</td>\n",
" <td>7.61 ± 0.87 (38)</td>\n",
" <td>1081.00, 0.418</td>\n",
" <td>0.27, 0.803</td>\n",
2019-10-16 05:28:13 +00:00
" </tr>\n",
" <tr>\n",
" <th>Gridness</th>\n",
2019-10-22 10:22:00 +00:00
" <td>0.53 ± 0.05 (63)</td>\n",
" <td>0.48 ± 0.06 (38)</td>\n",
" <td>1094.00, 0.472</td>\n",
" <td>0.08, 0.363</td>\n",
2019-10-16 05:28:13 +00:00
" </tr>\n",
" <tr>\n",
" <th>Sparsity</th>\n",
2019-10-22 10:22:00 +00:00
" <td>0.63 ± 0.02 (63)</td>\n",
" <td>0.64 ± 0.03 (38)</td>\n",
" <td>1261.00, 0.656</td>\n",
" <td>0.03, 0.641</td>\n",
2019-10-16 05:28:13 +00:00
" </tr>\n",
" <tr>\n",
" <th>Selectivity</th>\n",
2019-10-22 10:22:00 +00:00
" <td>5.76 ± 0.40 (63)</td>\n",
" <td>6.42 ± 0.60 (38)</td>\n",
" <td>1276.00, 0.582</td>\n",
" <td>0.86, 0.283</td>\n",
2019-10-16 05:28:13 +00:00
" </tr>\n",
" <tr>\n",
" <th>Information specificity</th>\n",
2019-10-22 10:22:00 +00:00
" <td>0.24 ± 0.03 (63)</td>\n",
" <td>0.22 ± 0.03 (38)</td>\n",
" <td>1076.00, 0.398</td>\n",
" <td>0.05, 0.161</td>\n",
2019-10-16 05:28:13 +00:00
" </tr>\n",
" <tr>\n",
" <th>Max rate</th>\n",
2019-10-22 10:22:00 +00:00
" <td>37.39 ± 1.91 (63)</td>\n",
" <td>33.49 ± 1.89 (38)</td>\n",
" <td>1027.00, 0.235</td>\n",
" <td>3.99, 0.182</td>\n",
2019-10-16 05:28:13 +00:00
" </tr>\n",
" <tr>\n",
" <th>Information rate</th>\n",
2019-10-22 10:22:00 +00:00
" <td>1.31 ± 0.08 (63)</td>\n",
" <td>0.98 ± 0.09 (38)</td>\n",
" <td>797.00, 0.005</td>\n",
" <td>0.32, 0.045</td>\n",
2019-10-16 05:28:13 +00:00
" </tr>\n",
" <tr>\n",
" <th>Interspike interval cv</th>\n",
2019-10-22 10:22:00 +00:00
" <td>2.39 ± 0.10 (63)</td>\n",
" <td>2.23 ± 0.11 (38)</td>\n",
" <td>1100.00, 0.499</td>\n",
" <td>0.01, 0.993</td>\n",
2019-10-16 05:28:13 +00:00
" </tr>\n",
" <tr>\n",
" <th>In-field mean rate</th>\n",
2019-10-22 10:22:00 +00:00
" <td>14.88 ± 1.05 (63)</td>\n",
" <td>12.21 ± 0.98 (38)</td>\n",
" <td>1018.00, 0.211</td>\n",
" <td>1.74, 0.272</td>\n",
2019-10-16 05:28:13 +00:00
" </tr>\n",
" <tr>\n",
" <th>Out-field mean rate</th>\n",
2019-10-22 10:22:00 +00:00
" <td>6.37 ± 0.67 (63)</td>\n",
" <td>5.36 ± 0.73 (38)</td>\n",
" <td>1079.00, 0.410</td>\n",
" <td>0.51, 0.644</td>\n",
2019-10-16 05:28:13 +00:00
" </tr>\n",
" <tr>\n",
" <th>Burst event ratio</th>\n",
2019-10-22 10:22:00 +00:00
" <td>0.22 ± 0.01 (63)</td>\n",
" <td>0.16 ± 0.01 (38)</td>\n",
" <td>675.00, 0.000</td>\n",
" <td>0.05, 0.006</td>\n",
2019-10-16 05:28:13 +00:00
" </tr>\n",
" <tr>\n",
" <th>Specificity</th>\n",
2019-10-22 10:22:00 +00:00
" <td>0.47 ± 0.03 (63)</td>\n",
" <td>0.48 ± 0.04 (38)</td>\n",
" <td>1206.00, 0.952</td>\n",
" <td>0.01, 0.869</td>\n",
2019-10-16 05:28:13 +00:00
" </tr>\n",
" <tr>\n",
" <th>Speed score</th>\n",
2019-10-22 10:22:00 +00:00
" <td>0.14 ± 0.01 (63)</td>\n",
" <td>0.11 ± 0.01 (38)</td>\n",
" <td>835.00, 0.011</td>\n",
" <td>0.06, 0.005</td>\n",
2019-10-16 05:28:13 +00:00
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
2019-10-22 10:22:00 +00:00
" Baseline I 30 Hz MWU \\\n",
"Average rate 8.96 ± 0.80 (63) 7.61 ± 0.87 (38) 1081.00, 0.418 \n",
"Gridness 0.53 ± 0.05 (63) 0.48 ± 0.06 (38) 1094.00, 0.472 \n",
"Sparsity 0.63 ± 0.02 (63) 0.64 ± 0.03 (38) 1261.00, 0.656 \n",
"Selectivity 5.76 ± 0.40 (63) 6.42 ± 0.60 (38) 1276.00, 0.582 \n",
"Information specificity 0.24 ± 0.03 (63) 0.22 ± 0.03 (38) 1076.00, 0.398 \n",
"Max rate 37.39 ± 1.91 (63) 33.49 ± 1.89 (38) 1027.00, 0.235 \n",
"Information rate 1.31 ± 0.08 (63) 0.98 ± 0.09 (38) 797.00, 0.005 \n",
"Interspike interval cv 2.39 ± 0.10 (63) 2.23 ± 0.11 (38) 1100.00, 0.499 \n",
"In-field mean rate 14.88 ± 1.05 (63) 12.21 ± 0.98 (38) 1018.00, 0.211 \n",
"Out-field mean rate 6.37 ± 0.67 (63) 5.36 ± 0.73 (38) 1079.00, 0.410 \n",
"Burst event ratio 0.22 ± 0.01 (63) 0.16 ± 0.01 (38) 675.00, 0.000 \n",
"Specificity 0.47 ± 0.03 (63) 0.48 ± 0.04 (38) 1206.00, 0.952 \n",
"Speed score 0.14 ± 0.01 (63) 0.11 ± 0.01 (38) 835.00, 0.011 \n",
2019-10-16 05:28:13 +00:00
"\n",
" PRS \n",
2019-10-22 10:22:00 +00:00
"Average rate 0.27, 0.803 \n",
"Gridness 0.08, 0.363 \n",
"Sparsity 0.03, 0.641 \n",
"Selectivity 0.86, 0.283 \n",
"Information specificity 0.05, 0.161 \n",
"Max rate 3.99, 0.182 \n",
"Information rate 0.32, 0.045 \n",
"Interspike interval cv 0.01, 0.993 \n",
"In-field mean rate 1.74, 0.272 \n",
"Out-field mean rate 0.51, 0.644 \n",
"Burst event ratio 0.05, 0.006 \n",
"Specificity 0.01, 0.869 \n",
"Speed score 0.06, 0.005 "
2019-10-16 05:28:13 +00:00
]
},
2019-10-22 10:22:00 +00:00
"execution_count": 23,
2019-10-16 05:28:13 +00:00
"metadata": {},
"output_type": "execute_result"
}
],
2019-10-22 10:22:00 +00:00
"source": [
"_stim_data = stimulated_30\n",
"_base_data = baseline_i\n",
"\n",
"result = pd.DataFrame()\n",
"\n",
"result['Baseline I'] = _base_data[columns].agg(summarize)\n",
"result['30 Hz'] = _stim_data[columns].agg(summarize)\n",
"\n",
"result.index = map(rename, result.index)\n",
"\n",
"result['MWU'] = list(map(lambda x: MWU(x, _stim_data, _base_data), columns))\n",
"result['PRS'] = list(map(lambda x: PRS(x, _stim_data, _base_data), columns))\n",
"\n",
"\n",
"result.to_latex(output_path / \"statistics\" / \"statistics_b_i_30.tex\")\n",
"result.to_latex(output_path / \"statistics\" / \"statistics_b_i_30.csv\")\n",
"result"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
2019-10-16 05:28:13 +00:00
"source": [
"_stim_data = stimulated_30\n",
"_base_data = stimulated_11\n",
"\n",
"result = pd.DataFrame()\n",
"\n",
2019-10-17 17:51:12 +00:00
"result['11 Hz'] = _base_data[columns].agg(summarize)\n",
"result['30 Hz'] = _stim_data[columns].agg(summarize)\n",
"\n",
2019-10-16 05:28:13 +00:00
"\n",
"result.index = map(rename, result.index)\n",
"\n",
"result['MWU'] = list(map(lambda x: MWU(x, _stim_data, _base_data), columns))\n",
"result['PRS'] = list(map(lambda x: PRS(x, _stim_data, _base_data), columns))\n",
"\n",
"\n",
"result.to_latex(output_path / \"statistics\" / \"statistics_11_vs_30.tex\")\n",
"result.to_latex(output_path / \"statistics\" / \"statistics_11_vs_30.csv\")\n",
"result"
]
},
{
"cell_type": "code",
2019-10-22 10:22:00 +00:00
"execution_count": null,
2019-10-16 05:28:13 +00:00
"metadata": {},
2019-10-22 10:22:00 +00:00
"outputs": [],
2019-10-16 05:28:13 +00:00
"source": [
"_stim_data = baseline_i\n",
"_base_data = baseline_ii\n",
"\n",
"result = pd.DataFrame()\n",
"\n",
2019-10-17 17:51:12 +00:00
"result['Baseline I'] = _stim_data[columns].agg(summarize)\n",
"result['Baseline II'] = _base_data[columns].agg(summarize)\n",
2019-10-16 05:28:13 +00:00
"\n",
"result.index = map(rename, result.index)\n",
"\n",
"result['MWU'] = list(map(lambda x: MWU(x, _stim_data, _base_data), columns))\n",
"result['PRS'] = list(map(lambda x: PRS(x, _stim_data, _base_data), columns))\n",
"\n",
"\n",
"result.to_latex(output_path / \"statistics\" / \"statistics_base_i_vs_base_ii.tex\")\n",
"result.to_latex(output_path / \"statistics\" / \"statistics_base_i_vs_base_ii.csv\")\n",
"result"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Violinplot"
]
},
{
"cell_type": "code",
2019-10-22 10:22:00 +00:00
"execution_count": null,
2019-10-16 05:28:13 +00:00
"metadata": {},
"outputs": [],
"source": [
"%matplotlib inline\n",
"plt.rc('axes', titlesize=12)\n",
"plt.rcParams.update({\n",
" 'font.size': 12, \n",
" 'figure.figsize': (1.7, 3), \n",
" 'figure.dpi': 150\n",
"})"
]
},
{
"cell_type": "code",
2019-10-22 10:22:00 +00:00
"execution_count": null,
2019-10-16 05:28:13 +00:00
"metadata": {},
"outputs": [],
"source": [
2019-10-22 10:22:00 +00:00
"# colors = ['#1b9e77','#d95f02','#7570b3','#e7298a']\n",
"# labels = ['Baseline I', '11 Hz', 'Baseline II', '30 Hz']\n",
"\n",
2019-10-16 05:28:13 +00:00
"stuff = {\n",
" '': {\n",
2019-10-17 17:51:12 +00:00
" 'base': gridcell_sessions.query('baseline'),\n",
" 'stim': gridcell_sessions.query('stimulated')\n",
2019-10-16 05:28:13 +00:00
" },\n",
" '_11': {\n",
" 'base': baseline_i,\n",
" 'stim': stimulated_11\n",
" },\n",
" '_30': {\n",
" 'base': baseline_ii,\n",
" 'stim': stimulated_30\n",
" }\n",
2019-10-17 17:51:12 +00:00
"}\n",
"\n",
"label = {\n",
" '': ['Baseline ', ' Stimulated'],\n",
" '_11': ['Baseline I ', ' 11 Hz'],\n",
" '_30': ['Baseline II ', ' 30 Hz']\n",
2019-10-22 10:22:00 +00:00
"}\n",
"\n",
"colors = {\n",
" '': None,\n",
" '_11': ['#1b9e77', '#d95f02'],\n",
" '_30': ['#7570b3', '#e7298a']\n",
2019-10-16 05:28:13 +00:00
"}"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Information rate"
]
},
{
"cell_type": "code",
2019-10-22 10:22:00 +00:00
"execution_count": null,
2019-10-16 05:28:13 +00:00
"metadata": {},
2019-10-22 10:22:00 +00:00
"outputs": [],
2019-10-17 17:51:12 +00:00
"source": [
"for key, data in stuff.items():\n",
" baseline = data['base']['information_specificity'].to_numpy()\n",
" stimulated = data['stim']['information_specificity'].to_numpy()\n",
" print(key)\n",
" plt.figure()\n",
2019-10-22 10:22:00 +00:00
" violinplot(baseline, stimulated, xticks=label[key], colors=colors[key])\n",
2019-10-17 17:51:12 +00:00
" plt.title(\"Spatial information specificity\")\n",
" plt.ylabel(\"bits/spike\")\n",
" plt.ylim(-0.2, 1.6)\n",
"\n",
" plt.savefig(output_path / \"figures\" / f\"information_specificity{key}.svg\", bbox_inches=\"tight\")\n",
" plt.savefig(output_path / \"figures\" / f\"information_specificity{key}.png\", dpi=600, bbox_inches=\"tight\")"
]
},
{
"cell_type": "code",
2019-10-22 10:22:00 +00:00
"execution_count": null,
2019-10-17 17:51:12 +00:00
"metadata": {},
2019-10-22 10:22:00 +00:00
"outputs": [],
2019-10-16 05:28:13 +00:00
"source": [
"\n",
"for key, data in stuff.items():\n",
" baseline = data['base']['information_rate'].to_numpy()\n",
" stimulated = data['stim']['information_rate'].to_numpy()\n",
" print(key)\n",
" plt.figure()\n",
2019-10-22 10:22:00 +00:00
" violinplot(baseline, stimulated, xticks=label[key], colors=colors[key])\n",
2019-10-16 05:28:13 +00:00
" plt.title(\"Spatial information\")\n",
" plt.ylabel(\"bits/s\")\n",
" plt.ylim(-0.2, 4)\n",
"\n",
" plt.savefig(output_path / \"figures\" / f\"spatial_information{key}.svg\", bbox_inches=\"tight\")\n",
" plt.savefig(output_path / \"figures\" / f\"spatial_information{key}.png\", dpi=600, bbox_inches=\"tight\")"
]
},
{
"cell_type": "code",
2019-10-22 10:22:00 +00:00
"execution_count": null,
2019-10-16 05:28:13 +00:00
"metadata": {},
2019-10-22 10:22:00 +00:00
"outputs": [],
2019-10-16 05:28:13 +00:00
"source": [
"for key, data in stuff.items():\n",
" baseline = data['base']['specificity'].to_numpy()\n",
" stimulated = data['stim']['specificity'].to_numpy()\n",
" plt.figure()\n",
2019-10-22 10:22:00 +00:00
" violinplot(baseline, stimulated, xticks=label[key], colors=colors[key])\n",
2019-10-16 05:28:13 +00:00
" plt.title(\"Spatial specificity\")\n",
" plt.ylabel(\"\")\n",
" plt.ylim(-0.02, 1.25)\n",
" plt.savefig(output_path / \"figures\" / f\"specificity{key}.svg\", bbox_inches=\"tight\")\n",
" plt.savefig(output_path / \"figures\" / f\"specificity{key}.png\", dpi=600, bbox_inches=\"tight\")"
]
},
{
"cell_type": "code",
2019-10-22 10:22:00 +00:00
"execution_count": null,
2019-10-16 05:28:13 +00:00
"metadata": {
"scrolled": false
},
2019-10-22 10:22:00 +00:00
"outputs": [],
2019-10-16 05:28:13 +00:00
"source": [
"\n",
"for key, data in stuff.items():\n",
" baseline = data['base']['average_rate'].to_numpy()\n",
" stimulated = data['stim']['average_rate'].to_numpy()\n",
" plt.figure()\n",
2019-10-22 10:22:00 +00:00
" violinplot(baseline, stimulated, xticks=label[key], colors=colors[key])\n",
2019-10-16 05:28:13 +00:00
" plt.title(\"Average rate\")\n",
" plt.ylabel(\"spikes/s\")\n",
" plt.ylim(-0.2, 40)\n",
"\n",
" plt.savefig(output_path / \"figures\" / f\"average_rate{key}.svg\", bbox_inches=\"tight\")\n",
" plt.savefig(output_path / \"figures\" / f\"average_rate{key}.png\", dpi=600, bbox_inches=\"tight\")"
]
},
{
"cell_type": "code",
2019-10-22 10:22:00 +00:00
"execution_count": null,
2019-10-16 05:28:13 +00:00
"metadata": {
"scrolled": false
},
2019-10-22 10:22:00 +00:00
"outputs": [],
2019-10-16 05:28:13 +00:00
"source": [
"for key, data in stuff.items():\n",
" baseline = data['base']['max_rate'].to_numpy()\n",
" stimulated = data['stim']['max_rate'].to_numpy()\n",
" plt.figure()\n",
2019-10-22 10:22:00 +00:00
" violinplot(baseline, stimulated, xticks=label[key], colors=colors[key])\n",
2019-10-16 05:28:13 +00:00
" plt.title(\"Max rate\")\n",
" plt.ylabel(\"spikes/s\")\n",
" # plt.ylim(-0.2, 45)\n",
"\n",
" plt.savefig(output_path / \"figures\" / f\"max_rate{key}.svg\", bbox_inches=\"tight\")\n",
" plt.savefig(output_path / \"figures\" / f\"max_rate{key}.png\", dpi=600, bbox_inches=\"tight\")"
]
},
{
"cell_type": "code",
2019-10-22 10:22:00 +00:00
"execution_count": null,
2019-10-16 05:28:13 +00:00
"metadata": {},
2019-10-22 10:22:00 +00:00
"outputs": [],
2019-10-16 05:28:13 +00:00
"source": [
"\n",
"for key, data in stuff.items():\n",
" baseline = data['base']['interspike_interval_cv'].to_numpy()\n",
" stimulated = data['stim']['interspike_interval_cv'].to_numpy()\n",
" plt.figure()\n",
2019-10-22 10:22:00 +00:00
" violinplot(baseline, stimulated, xticks=label[key], colors=colors[key])\n",
2019-10-16 05:28:13 +00:00
" plt.title(\"ISI CV\")\n",
" plt.ylabel(\"Coefficient of variation\")\n",
" # plt.ylim(0.9, 5)\n",
"\n",
" plt.savefig(output_path / \"figures\" / f\"isi_cv{key}.svg\", bbox_inches=\"tight\")\n",
" plt.savefig(output_path / \"figures\" / f\"isi_cv{key}.png\", dpi=600, bbox_inches=\"tight\")"
]
},
{
"cell_type": "code",
2019-10-22 10:22:00 +00:00
"execution_count": null,
2019-10-16 05:28:13 +00:00
"metadata": {},
2019-10-22 10:22:00 +00:00
"outputs": [],
2019-10-16 05:28:13 +00:00
"source": [
"\n",
"for key, data in stuff.items():\n",
" baseline = data['base']['in_field_mean_rate'].to_numpy()\n",
" stimulated = data['stim']['in_field_mean_rate'].to_numpy()\n",
" plt.figure()\n",
2019-10-22 10:22:00 +00:00
" violinplot(baseline, stimulated, xticks=label[key], colors=colors[key])\n",
2019-10-16 05:28:13 +00:00
" plt.title(\"In-field rate\")\n",
" plt.ylabel(\"spikes/s\")\n",
" # plt.ylim(-0.1, 18)\n",
"\n",
" plt.savefig(output_path / \"figures\" / f\"in_field_mean_rate{key}.svg\", bbox_inches=\"tight\")\n",
" plt.savefig(output_path / \"figures\" / f\"in_field_mean_rate{key}.png\", dpi=600, bbox_inches=\"tight\")"
]
},
{
"cell_type": "code",
2019-10-22 10:22:00 +00:00
"execution_count": null,
2019-10-16 05:28:13 +00:00
"metadata": {},
2019-10-22 10:22:00 +00:00
"outputs": [],
2019-10-16 05:28:13 +00:00
"source": [
"\n",
"for key, data in stuff.items():\n",
" baseline = data['base']['out_field_mean_rate'].to_numpy()\n",
" stimulated = data['stim']['out_field_mean_rate'].to_numpy()\n",
" plt.figure()\n",
2019-10-22 10:22:00 +00:00
" violinplot(baseline, stimulated, xticks=label[key], colors=colors[key])\n",
2019-10-16 05:28:13 +00:00
" plt.title(\"Out-of-field rate\")\n",
" plt.ylabel(\"spikes/s\")\n",
" # plt.ylim(-0.2, 8)\n",
"\n",
" plt.savefig(output_path / \"figures\" / f\"out_field_mean_rate{key}.svg\", bbox_inches=\"tight\")\n",
" plt.savefig(output_path / \"figures\" / f\"out_field_mean_rate{key}.png\", dpi=600, bbox_inches=\"tight\")"
]
},
{
"cell_type": "code",
2019-10-22 10:22:00 +00:00
"execution_count": null,
2019-10-16 05:28:13 +00:00
"metadata": {},
2019-10-22 10:22:00 +00:00
"outputs": [],
2019-10-16 05:28:13 +00:00
"source": [
"for key, data in stuff.items():\n",
" baseline = data['base']['burst_event_ratio'].to_numpy()\n",
" stimulated = data['stim']['burst_event_ratio'].to_numpy()\n",
" plt.figure()\n",
2019-10-22 10:22:00 +00:00
" violinplot(baseline, stimulated, xticks=label[key], colors=colors[key])\n",
2019-10-16 05:28:13 +00:00
" plt.title(\"Bursting ratio\")\n",
" plt.ylabel(\"\")\n",
" # plt.ylim(-0.02, 0.60)\n",
"\n",
" plt.savefig(output_path / \"figures\" / f\"burst_event_ratio{key}.svg\", bbox_inches=\"tight\")\n",
" plt.savefig(output_path / \"figures\" / f\"burst_event_ratio{key}.png\", dpi=600, bbox_inches=\"tight\")"
]
},
{
"cell_type": "code",
2019-10-22 10:22:00 +00:00
"execution_count": null,
2019-10-16 05:28:13 +00:00
"metadata": {},
2019-10-22 10:22:00 +00:00
"outputs": [],
2019-10-16 05:28:13 +00:00
"source": [
"for key, data in stuff.items():\n",
" baseline = data['base']['max_field_mean_rate'].to_numpy()\n",
" stimulated = data['stim']['max_field_mean_rate'].to_numpy()\n",
" plt.figure()\n",
2019-10-22 10:22:00 +00:00
" violinplot(baseline, stimulated, xticks=label[key], colors=colors[key])\n",
2019-10-16 05:28:13 +00:00
" plt.title(\"Mean rate of max field\")\n",
" plt.ylabel(\"(spikes/s)\")\n",
" # plt.ylim(-0.5,25)\n",
"\n",
" plt.savefig(output_path / \"figures\" / f\"max_field_mean_rate{key}.svg\", bbox_inches=\"tight\")\n",
" plt.savefig(output_path / \"figures\" / f\"max_field_mean_rate{key}.png\", dpi=600, bbox_inches=\"tight\")"
]
},
{
"cell_type": "code",
2019-10-22 10:22:00 +00:00
"execution_count": null,
2019-10-16 05:28:13 +00:00
"metadata": {},
2019-10-22 10:22:00 +00:00
"outputs": [],
2019-10-16 05:28:13 +00:00
"source": [
"for key, data in stuff.items():\n",
" baseline = data['base']['bursty_spike_ratio'].to_numpy()\n",
" stimulated = data['stim']['bursty_spike_ratio'].to_numpy()\n",
" plt.figure()\n",
2019-10-22 10:22:00 +00:00
" violinplot(baseline, stimulated, xticks=label[key], colors=colors[key])\n",
2019-10-16 05:28:13 +00:00
" plt.title(\"ratio of spikes per burst\")\n",
" plt.ylabel(\"\")\n",
" # plt.ylim(-0.03,0.9)\n",
"\n",
" plt.savefig(output_path / \"figures\" / f\"bursty_spike_ratio{key}.svg\", bbox_inches=\"tight\")\n",
" plt.savefig(output_path / \"figures\" / f\"bursty_spike_ratio{key}.png\", dpi=600, bbox_inches=\"tight\")"
]
},
{
"cell_type": "code",
2019-10-22 10:22:00 +00:00
"execution_count": null,
2019-10-16 05:28:13 +00:00
"metadata": {},
2019-10-22 10:22:00 +00:00
"outputs": [],
2019-10-16 05:28:13 +00:00
"source": [
"\n",
"for key, data in stuff.items():\n",
" baseline = data['base']['gridness'].to_numpy()\n",
" stimulated = data['stim']['gridness'].to_numpy()\n",
" plt.figure()\n",
2019-10-22 10:22:00 +00:00
" violinplot(baseline, stimulated, xticks=label[key], colors=colors[key])\n",
2019-10-16 05:28:13 +00:00
" plt.title(\"Gridness\")\n",
" plt.ylabel(\"Gridness\")\n",
2019-10-17 17:51:12 +00:00
" plt.ylim(-0.6, 1.5)\n",
2019-10-16 05:28:13 +00:00
"\n",
" plt.savefig(output_path / \"figures\" / f\"gridness{key}.svg\", bbox_inches=\"tight\")\n",
" plt.savefig(output_path / \"figures\" / f\"gridness{key}.png\", dpi=600, bbox_inches=\"tight\")"
]
},
{
"cell_type": "code",
2019-10-22 10:22:00 +00:00
"execution_count": null,
2019-10-16 05:28:13 +00:00
"metadata": {},
2019-10-22 10:22:00 +00:00
"outputs": [],
2019-10-16 05:28:13 +00:00
"source": [
2019-10-17 17:51:12 +00:00
"for key, data in stuff.items(): #TODO narrow broad spiking\n",
2019-10-16 05:28:13 +00:00
" baseline = data['base']['speed_score'].to_numpy()\n",
" stimulated = data['stim']['speed_score'].to_numpy()\n",
" plt.figure()\n",
2019-10-22 10:22:00 +00:00
" violinplot(baseline, stimulated, xticks=label[key], colors=colors[key])\n",
2019-10-16 05:28:13 +00:00
" plt.title(\"Speed score\")\n",
" plt.ylabel(\"Speed score\")\n",
" # plt.ylim(-0.1, 0.5)\n",
"\n",
" plt.savefig(output_path / \"figures\" / f\"speed_score{key}.svg\", bbox_inches=\"tight\")\n",
" plt.savefig(output_path / \"figures\" / f\"speed_score{key}.png\", dpi=600, bbox_inches=\"tight\")"
]
},
2019-10-17 17:51:12 +00:00
{
"cell_type": "code",
2019-10-22 10:22:00 +00:00
"execution_count": null,
2019-10-17 17:51:12 +00:00
"metadata": {
"scrolled": false
},
"outputs": [],
"source": [
"# fig, (ax1, ax2) = plt.subplots(2,1, figsize=(6,6), sharey=True)\n",
"# for key, data in stuff.items():\n",
"# ax1.set_title('Baseline')\n",
"# peak_rate = data['base']['max_rate'].to_numpy()\n",
"# spacing = data['base']['spacing'].to_numpy()\n",
"# ax1.scatter(spacing, peak_rate)\n",
" \n",
"# ax2.set_title('Stim')\n",
"# peak_rate = data['stim']['max_rate'].to_numpy()\n",
"# spacing = data['stim']['spacing'].to_numpy()\n",
"# ax2.scatter(spacing, peak_rate, label=key)\n",
" \n",
"# ax2.legend()"
]
},
2019-10-16 05:28:13 +00:00
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Register in Expipe"
]
},
{
"cell_type": "code",
2019-10-22 10:22:00 +00:00
"execution_count": null,
2019-10-16 05:28:13 +00:00
"metadata": {},
"outputs": [],
"source": [
"action = project.require_action(\"comparisons-gridcells\")"
]
},
{
"cell_type": "code",
2019-10-22 10:22:00 +00:00
"execution_count": null,
2019-10-16 05:28:13 +00:00
"metadata": {},
2019-10-22 10:22:00 +00:00
"outputs": [],
2019-10-16 05:28:13 +00:00
"source": [
"copy_tree(output_path, str(action.data_path()))"
]
},
{
"cell_type": "code",
2019-10-22 10:22:00 +00:00
"execution_count": null,
2019-10-16 05:28:13 +00:00
"metadata": {},
"outputs": [],
"source": [
"septum_mec.analysis.registration.store_notebook(action, \"20_comparisons_gridcells.ipynb\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"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
}