septum-mec/actions/stimulus-response-fwhm/data/10-calculate-stimulus-respo...

982 lines
210 KiB
Plaintext
Raw Permalink Normal View History

2021-03-10 12:31:15 +00:00
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Compute FWHM of PSTHs for 11 and 30Hz\n",
"\n",
"Only PSTHs with a significance level below 0.05 are used"
]
},
{
"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": [
"/home/mikkel/.virtualenvs/expipe/lib/python3.6/site-packages/ipykernel_launcher.py:21: TqdmDeprecationWarning: This function will be removed in tqdm==5.0.0\n",
"Please use `tqdm.notebook.*` instead of `tqdm._tqdm_notebook.*`\n"
]
}
],
"source": [
"import matplotlib.pyplot as plt\n",
"%matplotlib inline\n",
"import spatial_maps as sp\n",
"import septum_mec.analysis.data_processing as dp\n",
"import septum_mec.analysis.registration\n",
"import expipe\n",
"import os\n",
"import pathlib\n",
"import numpy as np\n",
"import exdir\n",
"import pandas as pd\n",
"import optogenetics as og\n",
"import quantities as pq\n",
"import shutil\n",
"from distutils.dir_util import copy_tree\n",
"import seaborn as sns\n",
"from functools import reduce\n",
"from septum_mec.analysis.stimulus_response import stimulus_response_latency, compute_response\n",
"import scipy.stats\n",
"from tqdm import tqdm_notebook as tqdm\n",
"from tqdm._tqdm_notebook import tqdm_notebook\n",
"from septum_mec.analysis.statistics import load_data_frames, make_paired_tables, make_statistics_table \n",
"tqdm_notebook.pandas()\n",
"\n",
"%matplotlib widget"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
"std_gaussian_kde = 0.04\n",
"window_size = 0.03\n",
"tmin = 0. # delay to compute FWHM after stimulus onset"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [],
"source": [
"data_loader = dp.Data()\n",
"actions = data_loader.actions\n",
"project = data_loader.project"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [],
"source": [
"output = pathlib.Path('output/stimulus-response-fwhm')\n",
"(output / 'data').mkdir(parents=True, exist_ok=True)\n",
"(output / 'figures').mkdir(parents=True, exist_ok=True)\n",
"(output / 'statistics').mkdir(parents=True, exist_ok=True)"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [],
"source": [
"colors = ['#d95f02','#e7298a']\n",
"labels = [\n",
" '11 Hz', \n",
" '30 Hz'\n",
"]\n",
"queries = [\n",
" 'frequency==11 and stim_location==\"ms\"',\n",
" 'frequency==30 and stim_location==\"ms\"']"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Number of sessions above threshold 194\n",
"Number of animals 4\n",
"Number of individual gridcells 139\n",
"Number of gridcell recordings 230\n"
]
}
],
"source": [
"data, labels, colors, queries = load_data_frames(queries, labels, colors)"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [],
"source": [
"# use baseline==False and p_e_peak < 0.05\n",
"session_units_sig = data.query('p_e_peak == p_e_peak')"
]
},
{
"cell_type": "code",
"execution_count": 9,
"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>bs_ctrl</th>\n",
" <th>ns_inhibited</th>\n",
" <th>ns_not_inhibited</th>\n",
" <th>gridcell</th>\n",
" <th>bs_not_gridcell</th>\n",
" <th>label</th>\n",
" <th>label_num</th>\n",
" <th>query</th>\n",
" <th>color</th>\n",
" <th>cell_type</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>13</th>\n",
" <td>1839-120619-4</td>\n",
" <td>False</td>\n",
" <td>1839</td>\n",
" <td>30.0</td>\n",
" <td>False</td>\n",
" <td>True</td>\n",
" <td>4</td>\n",
" <td>ms</td>\n",
" <td>True</td>\n",
" <td>stim ii</td>\n",
" <td>...</td>\n",
" <td>NaN</td>\n",
" <td>False</td>\n",
" <td>False</td>\n",
" <td>False</td>\n",
" <td>True</td>\n",
" <td>30 Hz</td>\n",
" <td>1.0</td>\n",
" <td>frequency==30 and stim_location==\"ms\"</td>\n",
" <td>#e7298a</td>\n",
" <td>bs_not_gridcell</td>\n",
" </tr>\n",
" <tr>\n",
" <th>14</th>\n",
" <td>1839-120619-4</td>\n",
" <td>False</td>\n",
" <td>1839</td>\n",
" <td>30.0</td>\n",
" <td>False</td>\n",
" <td>True</td>\n",
" <td>4</td>\n",
" <td>ms</td>\n",
" <td>True</td>\n",
" <td>stim ii</td>\n",
" <td>...</td>\n",
" <td>NaN</td>\n",
" <td>True</td>\n",
" <td>False</td>\n",
" <td>True</td>\n",
" <td>False</td>\n",
" <td>30 Hz</td>\n",
" <td>1.0</td>\n",
" <td>frequency==30 and stim_location==\"ms\"</td>\n",
" <td>#e7298a</td>\n",
" <td>gridcell</td>\n",
" </tr>\n",
" <tr>\n",
" <th>15</th>\n",
" <td>1839-120619-4</td>\n",
" <td>False</td>\n",
" <td>1839</td>\n",
" <td>30.0</td>\n",
" <td>False</td>\n",
" <td>True</td>\n",
" <td>4</td>\n",
" <td>ms</td>\n",
" <td>True</td>\n",
" <td>stim ii</td>\n",
" <td>...</td>\n",
" <td>NaN</td>\n",
" <td>True</td>\n",
" <td>False</td>\n",
" <td>False</td>\n",
" <td>False</td>\n",
" <td>30 Hz</td>\n",
" <td>1.0</td>\n",
" <td>frequency==30 and stim_location==\"ms\"</td>\n",
" <td>#e7298a</td>\n",
" <td>ns_inhibited</td>\n",
" </tr>\n",
" <tr>\n",
" <th>16</th>\n",
" <td>1839-120619-4</td>\n",
" <td>False</td>\n",
" <td>1839</td>\n",
" <td>30.0</td>\n",
" <td>False</td>\n",
" <td>True</td>\n",
" <td>4</td>\n",
" <td>ms</td>\n",
" <td>True</td>\n",
" <td>stim ii</td>\n",
" <td>...</td>\n",
" <td>NaN</td>\n",
" <td>False</td>\n",
" <td>False</td>\n",
" <td>False</td>\n",
" <td>True</td>\n",
" <td>30 Hz</td>\n",
" <td>1.0</td>\n",
" <td>frequency==30 and stim_location==\"ms\"</td>\n",
" <td>#e7298a</td>\n",
" <td>bs_not_gridcell</td>\n",
" </tr>\n",
" <tr>\n",
" <th>17</th>\n",
" <td>1839-120619-4</td>\n",
" <td>False</td>\n",
" <td>1839</td>\n",
" <td>30.0</td>\n",
" <td>False</td>\n",
" <td>True</td>\n",
" <td>4</td>\n",
" <td>ms</td>\n",
" <td>True</td>\n",
" <td>stim ii</td>\n",
" <td>...</td>\n",
" <td>NaN</td>\n",
" <td>False</td>\n",
" <td>False</td>\n",
" <td>False</td>\n",
" <td>True</td>\n",
" <td>30 Hz</td>\n",
" <td>1.0</td>\n",
" <td>frequency==30 and stim_location==\"ms\"</td>\n",
" <td>#e7298a</td>\n",
" <td>bs_not_gridcell</td>\n",
" </tr>\n",
" <tr>\n",
" <th>...</th>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1279</th>\n",
" <td>1833-010719-2</td>\n",
" <td>False</td>\n",
" <td>1833</td>\n",
" <td>11.0</td>\n",
" <td>True</td>\n",
" <td>False</td>\n",
" <td>2</td>\n",
" <td>ms</td>\n",
" <td>True</td>\n",
" <td>stim i</td>\n",
" <td>...</td>\n",
" <td>NaN</td>\n",
" <td>False</td>\n",
" <td>False</td>\n",
" <td>False</td>\n",
" <td>True</td>\n",
" <td>11 Hz</td>\n",
" <td>0.0</td>\n",
" <td>frequency==11 and stim_location==\"ms\"</td>\n",
" <td>#d95f02</td>\n",
" <td>bs_not_gridcell</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1280</th>\n",
" <td>1833-010719-2</td>\n",
" <td>False</td>\n",
" <td>1833</td>\n",
" <td>11.0</td>\n",
" <td>True</td>\n",
" <td>False</td>\n",
" <td>2</td>\n",
" <td>ms</td>\n",
" <td>True</td>\n",
" <td>stim i</td>\n",
" <td>...</td>\n",
" <td>NaN</td>\n",
" <td>False</td>\n",
" <td>False</td>\n",
" <td>False</td>\n",
" <td>True</td>\n",
" <td>11 Hz</td>\n",
" <td>0.0</td>\n",
" <td>frequency==11 and stim_location==\"ms\"</td>\n",
" <td>#d95f02</td>\n",
" <td>bs_not_gridcell</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1281</th>\n",
" <td>1833-010719-2</td>\n",
" <td>False</td>\n",
" <td>1833</td>\n",
" <td>11.0</td>\n",
" <td>True</td>\n",
" <td>False</td>\n",
" <td>2</td>\n",
" <td>ms</td>\n",
" <td>True</td>\n",
" <td>stim i</td>\n",
" <td>...</td>\n",
" <td>NaN</td>\n",
" <td>False</td>\n",
" <td>False</td>\n",
" <td>False</td>\n",
" <td>True</td>\n",
" <td>11 Hz</td>\n",
" <td>0.0</td>\n",
" <td>frequency==11 and stim_location==\"ms\"</td>\n",
" <td>#d95f02</td>\n",
" <td>bs_not_gridcell</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1282</th>\n",
" <td>1833-010719-2</td>\n",
" <td>False</td>\n",
" <td>1833</td>\n",
" <td>11.0</td>\n",
" <td>True</td>\n",
" <td>False</td>\n",
" <td>2</td>\n",
" <td>ms</td>\n",
" <td>True</td>\n",
" <td>stim i</td>\n",
" <td>...</td>\n",
" <td>NaN</td>\n",
" <td>False</td>\n",
" <td>False</td>\n",
" <td>False</td>\n",
" <td>True</td>\n",
" <td>11 Hz</td>\n",
" <td>0.0</td>\n",
" <td>frequency==11 and stim_location==\"ms\"</td>\n",
" <td>#d95f02</td>\n",
" <td>bs_not_gridcell</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1283</th>\n",
" <td>1833-010719-2</td>\n",
" <td>False</td>\n",
" <td>1833</td>\n",
" <td>11.0</td>\n",
" <td>True</td>\n",
" <td>False</td>\n",
" <td>2</td>\n",
" <td>ms</td>\n",
" <td>True</td>\n",
" <td>stim i</td>\n",
" <td>...</td>\n",
" <td>NaN</td>\n",
" <td>False</td>\n",
" <td>False</td>\n",
" <td>False</td>\n",
" <td>True</td>\n",
" <td>11 Hz</td>\n",
" <td>0.0</td>\n",
" <td>frequency==11 and stim_location==\"ms\"</td>\n",
" <td>#d95f02</td>\n",
" <td>bs_not_gridcell</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"<p>647 rows × 68 columns</p>\n",
"</div>"
],
"text/plain": [
" action baseline entity frequency i ii session \\\n",
"13 1839-120619-4 False 1839 30.0 False True 4 \n",
"14 1839-120619-4 False 1839 30.0 False True 4 \n",
"15 1839-120619-4 False 1839 30.0 False True 4 \n",
"16 1839-120619-4 False 1839 30.0 False True 4 \n",
"17 1839-120619-4 False 1839 30.0 False True 4 \n",
"... ... ... ... ... ... ... ... \n",
"1279 1833-010719-2 False 1833 11.0 True False 2 \n",
"1280 1833-010719-2 False 1833 11.0 True False 2 \n",
"1281 1833-010719-2 False 1833 11.0 True False 2 \n",
"1282 1833-010719-2 False 1833 11.0 True False 2 \n",
"1283 1833-010719-2 False 1833 11.0 True False 2 \n",
"\n",
" stim_location stimulated tag ... bs_ctrl ns_inhibited \\\n",
"13 ms True stim ii ... NaN False \n",
"14 ms True stim ii ... NaN True \n",
"15 ms True stim ii ... NaN True \n",
"16 ms True stim ii ... NaN False \n",
"17 ms True stim ii ... NaN False \n",
"... ... ... ... ... ... ... \n",
"1279 ms True stim i ... NaN False \n",
"1280 ms True stim i ... NaN False \n",
"1281 ms True stim i ... NaN False \n",
"1282 ms True stim i ... NaN False \n",
"1283 ms True stim i ... NaN False \n",
"\n",
" ns_not_inhibited gridcell bs_not_gridcell label label_num \\\n",
"13 False False True 30 Hz 1.0 \n",
"14 False True False 30 Hz 1.0 \n",
"15 False False False 30 Hz 1.0 \n",
"16 False False True 30 Hz 1.0 \n",
"17 False False True 30 Hz 1.0 \n",
"... ... ... ... ... ... \n",
"1279 False False True 11 Hz 0.0 \n",
"1280 False False True 11 Hz 0.0 \n",
"1281 False False True 11 Hz 0.0 \n",
"1282 False False True 11 Hz 0.0 \n",
"1283 False False True 11 Hz 0.0 \n",
"\n",
" query color cell_type \n",
"13 frequency==30 and stim_location==\"ms\" #e7298a bs_not_gridcell \n",
"14 frequency==30 and stim_location==\"ms\" #e7298a gridcell \n",
"15 frequency==30 and stim_location==\"ms\" #e7298a ns_inhibited \n",
"16 frequency==30 and stim_location==\"ms\" #e7298a bs_not_gridcell \n",
"17 frequency==30 and stim_location==\"ms\" #e7298a bs_not_gridcell \n",
"... ... ... ... \n",
"1279 frequency==11 and stim_location==\"ms\" #d95f02 bs_not_gridcell \n",
"1280 frequency==11 and stim_location==\"ms\" #d95f02 bs_not_gridcell \n",
"1281 frequency==11 and stim_location==\"ms\" #d95f02 bs_not_gridcell \n",
"1282 frequency==11 and stim_location==\"ms\" #d95f02 bs_not_gridcell \n",
"1283 frequency==11 and stim_location==\"ms\" #d95f02 bs_not_gridcell \n",
"\n",
"[647 rows x 68 columns]"
]
},
"execution_count": 9,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"session_units_sig"
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {},
"outputs": [],
"source": [
"def compute_fwhm(psth, times, t_min=None):\n",
" \"\"\"\n",
" Compute PSTH. The function handles a single peak or multiple peaks. In the latter case, the peak containing the max peak is used\n",
" \"\"\"\n",
" times_accepted = times > tmin\n",
" max_idx = np.argmax(psth[times_accepted])\n",
" idxs_greater = np.where(psth[times_accepted] > 0.5 * np.ptp(psth[times_accepted]))[0]\n",
" \n",
" if np.all(np.diff(idxs_greater) == 1):\n",
" fwhm = times[times_accepted][idxs_greater[-1]] - times[times_accepted][idxs_greater[0]]\n",
" else:\n",
" # deal with multiple peaks. when multiple peaks are found, the one containing max_idx is used\n",
" diff_splits = np.where((np.diff(idxs_greater) == 1) == False)[0]\n",
" idxs_list = []\n",
" for i, ds in enumerate(diff_splits):\n",
" if i == 0:\n",
" idxs_list.append(idxs_greater[:ds+1])\n",
" elif i < len(diff_splits):\n",
" idxs_list.append(idxs_greater[diff_splits[i-1]+1:ds+1])\n",
" idxs_list.append(idxs_greater[ds+1:])\n",
" \n",
" for idxs in idxs_list:\n",
" if max_idx in idxs:\n",
" fwhm = times[times_accepted][idxs[-1]] - times[times_accepted][idxs[0]]\n",
" \n",
" return fwhm, psth[times_accepted][max_idx]"
]
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {},
"outputs": [],
"source": [
"times = np.arange(-0.005, window_size, 1e-4)\n",
"tmin = 0.005\n",
"psths = []\n",
"def process(row):\n",
" action_id = row['action']\n",
" channel_group = row['channel_group']\n",
" unit_name = row['unit_name']\n",
" name = f'{action_id}_{channel_group}_{unit_name}'\n",
" spike_times = data_loader.spike_train(action_id, channel_group, unit_name)\n",
" \n",
" spike_times = np.array(spike_times)\n",
" \n",
" stim_times = data_loader.stim_times(action_id) \n",
" \n",
" stim_times = np.array(stim_times)\n",
" \n",
" _, spikes, kernel, p_e, p_i = stimulus_response_latency(\n",
" spike_times, stim_times, window_size, std_gaussian_kde)\n",
" \n",
" psths.append(kernel(times))\n",
" fwhm, peak = compute_fwhm(kernel(times), times, tmin)\n",
" return pd.Series({\n",
" 'fwhm': fwhm,\n",
" 'peak': peak\n",
" })"
]
},
{
"cell_type": "code",
"execution_count": 12,
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "f8d93b5929ac48ca88f0b9acd49b97db",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"HBox(children=(IntProgress(value=0, max=647), HTML(value='')))"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"\n"
]
}
],
"source": [
"session_units_sig = session_units_sig.merge(\n",
" session_units_sig.progress_apply(process, axis=1), \n",
" left_index=True, right_index=True)"
]
},
{
"cell_type": "code",
"execution_count": 13,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAX8AAAD4CAYAAAAEhuazAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjIsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8li6FKAAAXTElEQVR4nO3df5Bd5X3f8fe9u5IWgaTYkbBdlx+ZAX/jNIMTYCxjJJAzSoXACRn9kSqpTUNiTFslDi5TbMfEkBbbdeLiHwGXRg6DnYRmElASm1YObWgYsSHVhJDWouRLoXHolOAiDJJAv3b33v5xz0qX5a5+nHu1u4/v+zWj4dznfq/2uYfV5zznOb8a7XYbSdJwac53ByRJc8/wl6QhZPhL0hAy/CVpCBn+kjSEDH9JGkKjJ1IUEauBz2Tmuog4E9gKvAEYAa7JzGci4jrgemASuC0zH4iIlcC9wGnAc8C1mbm/V+3x+rB69er2W9/61hpfUZKG1xNPPLE7M1fNbG8c7zz/iLgJeD/wama+K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4MDPbmfksMBoRq2apVUG6x/3uBEjlqTvtsxI4B3gv8H3A14BmZk7HwD5gBbAceLHrc9PtjR61kqQ5Ujf8XwT+OjMPAxkRB+lM/UxbBrwM7K2WZ7a3erSpUN7eQSpP3WmfR4ArIqIREX8POB34k+pYAMBGYAcwDmyIiGZEnE1n72A38HiPWhXEqR6pbLVG/pn5QERcBuykswHZAvwNsDUiFgNPAvdl5lRE7AAe7aoDuHFmbX9fQ5J0Mmqf6pmZN/VovrxH3a3ArTPanupVq3J0T/W4FyCVx4u8JGkIGf6qxdG+VDbDX31zOyCVx/CXpCFk+EvSEDL
"text/plain": [
"<Figure size 432x288 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"# Quality control\n",
"fig = plt.figure()\n",
"for psth in psths:\n",
" plt.plot(times, psth, color='C0', alpha=0.3)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"keys = [\n",
" 'fwhm',\n",
" 'peak'\n",
"]\n",
"\n",
"results, labels = make_paired_tables(session_units_sig, keys, queries=queries, labels=labels, cell_types=['gridcell', 'ns_inhibited', 'ns_not_inhibited'])"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Plot FWHM grouped by stimulation frequency"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"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",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"def violinplot2(data, xticks, colors):\n",
" pos = [i * 0.6 for i in range(len(data))]\n",
" print(pos)\n",
" violins = plt.violinplot(data, pos, showmeans=True, showextrema=False)\n",
" \n",
" for i, b in enumerate(violins['bodies']):\n",
" b.set_color(colors[i])\n",
" b.set_alpha (0.8)\n",
"\n",
" \n",
"\n",
" # for i, body in enumerate(violins['cbars']):\n",
" # body.set_color('C{}'.format(i))\n",
"\n",
" \n",
"\n",
" for category in ['cbars', 'cmins', 'cmaxes', 'cmedians', 'cmeans']:\n",
" if category in violins:\n",
" violins[category].set_color(['k', 'k'])\n",
" violins[category].set_linewidth(2.0)\n",
" plt.xticks(pos, xticks, rotation=45)\n",
" plt.gca().spines['top'].set_visible(False)\n",
" plt.gca().spines['right'].set_visible(False)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[0.0, 0.6]\n",
"[0.0, 0.6]\n",
"[0.0, 0.6]\n"
]
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAATAAAAHnCAYAAAA/wAFkAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAXEQAAFxEByibzPwAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjIsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8li6FKAAAgAElEQVR4nOy9eZxkRZmv/8TJzNqrt+puZOlm6zGUQXEUZQC9MOM6vxkZ+eHGAI4LOqjAvXgdxWUE5iroHR0V3GdAsBUVAdFhGRVQ9n2naQIa6H2ppbv2XM+J+0ecU5VdXZmVmZVZWVn5Pp9P96nMc84bkZWZ33rfN96IUNZaBEEQGhGv3h0QBEGoFBEwQRAaFhEwQRAaFhEwQRAaFhEwQRAaFhEwQRAaFhEwQRAaFhEwQRAaFhEwQRAaFhEwQRAaFhEwQRAaFhEwQRAaFhEwQRAaFhEwQRAalni9OyAIlaC1PhH4Y/gwYYzJlXjfB4EfA9uMMQfVpndF2z+Rafqttb4S+EfgZ8aY0+e6X42KeGCCIDQs4oEJjcqDwCsBSvW+hIWHCJjQkBhjxoFn690Pob5ICCkIQsMiHpgwZ2itjwY+A/wlsALYBKwFvg4Y4GDgUGPMxryk9seBAPgisBLYAnw0NFkwia+1Phk4GzgKaAUeAS4uoY9HAZ8E3gwcC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tx2V1vpwrfUrwhqtfH6KK2I9DLhaa90dXt+itb4UeCMuzLwsz1YMJ14JXF7sHcaYnSX0Pw38e/jwbK31ueFsALTWntb6E8Al4fnzo3mZTYtSE/qloseCUCeqtRrFucCrwn/Paq2fwo1
"text/plain": [
"<Figure size 255x450 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAATAAAAHnCAYAAAA/wAFkAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAXEQAAFxEByibzPwAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjIsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8li6FKAAAgAElEQVR4nOy9eXwlV3Xv+911Jk3dbbttg/GE7YYNBHDC5BibizMBSR7c8EgCDjYPEsLNgP0uCQHy4MV2HpNfIICBhISLwRgcYmICwRPGA57n2W337m73bPeoVks60pmqat8/dpUkyzrSGap0Bq3v59NdOjpVq/aRdH5nrbXXXltZaxEEQehFvE4PQBAEoVVEwARB6FlEwARB6FlEwARB6FlEwARB6FlEwARB6FlEwARB6FlEwARB6FlEwARB6FlEwARB6FlEwARB6FlEwARB6FlEwARB6FlEwARB6FmynR6AICyE1jru8/Rbxpgb27R1IXABcKcx5sx2r9NabwNOBP7UGPO/mrBX9zVprYeAo40x2xq11ypa67OAW6KHOWOMn/Y900I8MEHoMFrrPwI2Ar/Z6bH0GuKBCd3Ky6Pjjg6O4WvAD4DphOzVe02fBY5N6B4rChEwoSsxxmzogjEcAA4kaK/jr6nfkBBSEISeRTywFYrW+v3At4F/B/4E+ATwh7jk9BRwF/D/G2Nun3fdy4CPAb8OvAgoAVuAa4GvGGP2JTS+5yW8Wx3zPLtHAn8L/HfgeGAMuAP4vDHmgXnnXsgSyX+t9VuB/wd4LeADDwHfMMZcudRrmmM/5pta628CFxljLpxz3QuAvwb+D+DFQABswIW3XzfGlOuM7Szgr4DXA2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"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAATAAAAHnCAYAAAA/wAFkAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAXEQAAFxEByibzPwAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjIsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8li6FKAAAgAElEQVR4nOy9eZxjV3Xv+91HUqmGru62u93YGGxjN94YDAYH8DU2wbkJhnvzIOERZpsHgSSQYN9LBsK9kNgkgOE9RjMEcsNoYojBDoPBYDxj4xEPtIfebffs7nYP1TVXaTpnvz/2VpVcLklHqiOVpFrfz6c+p6RzztpbqtJPa6+99trKWosgCEI3Eix3BwRBEJpFBEwQhK5FBEwQhK5FBEwQhK5FBEwQhK5FBEwQhK5FBEwQhK5FBEwQhK5FBEwQhK5FBEwQhK5FBEwQhK5FBEwQhK5FBEwQhK5FBEwQhK4lvdwdEIQ4aK3TwInGmC0J2DoHuNE/zBhjSku0dxPwCuBjxpgPL+U+rfUJwHZ/ybONMY/FtHUONV6T1voZwIQxZiJu/5pFa30xcBFwmzHm7Fa2JR6Y0PForc8FHgTevtx96Ta01n1a638CtgAblrs/SSMemNAN/G9AJ2jvLuAUgKV6X0vk7cAgcCgBW9Ve09OBf0jAfkciAiasOIwxM8DmDujHrgRtdcRrajcyhBQEoWsRD6wD0Vq/A/gG8B/Au4APAm8EjgemgV8D/68x5lcL7nsO8AHgv+KGDrPANuBnwOeNMQcS6l95I4UB4L8BFwIvAvoAA3wb+KIxprjIvQPAe4A3Ac/19+wBfgl82hjzaMW178C9D2U+pLX+EPAtY8w7ltD/c1gk4K21/ibw/wDvBX4O/CNwLnAUcNA/91FjzI4atk8FPgT8HrAWeAL4KfDPxpgnFlx7E7WD/4HW+gLgL4CNwDhwM+5vf0+911Rhv8yjWmuA3zPG3FRx72nAX/s+Pw2YAu4B/tUYc2WV1xng3qs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x/Xx24vc+klcpv4IbmXBC9rR32XGAq/HeTvTuNc8DnwN9z7dWOPehfwJLoyQwr1/G8snjDH/jFsO9O+4WeDTcPlq9/m2X7zYGlqf5f864AbcMrdTgLtxq0cWXT/ZCpS1tv5VgiAIHYh4YIIgdC0iYIIgdC2SyLoC8Vn5zfCzNlSCqIvW+kW4KgrN8DG/xk/oAUTAVibNljuJtUNOG1hD86+h0ZpcQgcjQXxBELoWiYEJgtC1iIAJgtC1iIAJgtC1iIAJgtC1iIAJgtC1iIC1Ea31j7XWcUqgCIIQA8kDay8nbdy48bm4hbqCIMzTVK038cAEQehaRMAEQehaRMAEQehaRMAEQehaRMAEQehaEpuF9LuRfABXm/1ZuLrdvwE+12z5Eq31cbia3a8GNgAHgeuBS/yuKtXuOxf4S9wu1etwGxs8AHwDuMxvz77wnnOAemV6f2SM+ePGX4kgCK0gEQ/M7w93A3ARcCLwEK6O97nAz7TWFzVhU+O2Vn8Xrub2A7hNBM4H7tVav6rKfZ8GfoHbiGDI96WE2+ziW8AP/cavCynvkrMPuK3KT5K7WguCsESS8sC+hPN27gdea4zZDaC1Ph+3ocTFWuvbjDHXxTGmtU7jdmRZB1wG/IUxZtZv+/Rp4H3A97TWG40xIxX3vQ34a9wOPH8HfN4YE/lzf+L78lrgn3A79VRSFrDPG2M+2egbIAhC+1myB6a1Pgk4D7eB5tvK4gVgjLkM+IR/eHEDZs/D7ZyyC3i3MWbW2ysAF+K2fFoLvH/BfX/nj182xny2LF7+3h/gxA3gAq11dsG9ZQHb1EA/BUFYRpIYQp6P267pdr+110K+4o9n+ZhWHN7hj5d50ZrDx6++6h++pfy
"text/plain": [
"<Figure size 255x450 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"for cell_type, result, in results.items():\n",
" fig = plt.figure()\n",
" violinplot2(\n",
" [result['fwhm']['11 Hz'].dropna().values, result['fwhm']['30 Hz'].dropna().values], \n",
" colors=colors,\n",
" xticks=[\"11 Hz \", \" 30 Hz\"],\n",
" )\n",
" plt.title(cell_type)\n",
" figname = f'{cell_type}-stim-response-fwhm-11-30Hz'\n",
" fig.savefig(\n",
" output / 'figures' / f'{figname}.png', \n",
" bbox_inches='tight', transparent=True)\n",
" fig.savefig(\n",
" output / 'figures' / f'{figname}.svg', \n",
" bbox_inches='tight', transparent=True)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[0.0, 0.6]\n",
"[0.0, 0.6]\n",
"[0.0, 0.6]\n"
]
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAARsAAAHnCAYAAACIfflDAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAXEQAAFxEByibzPwAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjIsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8li6FKAAAgAElEQVR4nOzdeZxkVX3//9e5t6p6X6ZnmGFYh0WObKKIIOCCUdxFTUzcjdG4JdGvJBE3DEaNETXRuEQSo0l+bkEjwQ1BQEFBQFbZz7AOzMbM9PRS+3Lv+f1xbnXX9PTeVXWrqj/PBzxud9ddTk13v/vcs11lrUUIIRrNi7sAQojVQcJGCNEUEjZCiKaQsBFCNIWEjRCiKSRshBBNIWEjhGgKCRshRFNI2AghmkLCRgjRFBI2QoimkLARQjSFhI0QoikkbIQQTZGIuwCi82mtzwJ+FX2aNMZUFnncW4H/BLYZYw5pTOnmvf5ZzFJurfV/AX8KfMcY86Zml6tdSc1GCNEUUrMRzfA74FiAxdZqROeRsBENZ4zJAffHXQ4RL7mNEkI0hdRsxKy01qcA5wHPBA4AtgDfAj4PGOBw4AhjzKM1DabvAULgfGA98DjwjuiUczYQa61fDfwVcBLQBdwKfHoRZTwJ+Evg+cDBQB64DfiaMeZ/Z9m/C3g38DrgOCAFPAb8DPicMWbHQtcUyyc1G7GfqBfoRuCPgX7gbmAd8Cngl0D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ufwg2p6ltdazvP7uaHutMebRmq9/P9q+Rms9Mstx74m2Fxtj8rO8vmpMtdlANF1BbqNEfOpVs/kg8PTo4780xvzfQgcYYx4AvosbUXy
"text/plain": [
"<Figure size 255x450 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAARsAAAHnCAYAAACIfflDAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAXEQAAFxEByibzPwAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjIsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8li6FKAAAgAElEQVR4nOzdd5gkV33v//epDpNnNihrlZDQERKwkkAIWRISyVzA2GAwSQYTLnCxAZMMBoQJBoPIBtvod7HhkowkG0ywBAYJUM45Hu1K2l1tDhM7d1ed3x+nerd3NT09obuqu+b7ep59ama6qvv0zsxnTp2orLUIIUSneXEXQAixPEjYCCEiIWEjhIiEhI0QIhISNkKISEjYCCEiIWEjhIiEhI0QIhISNkKISEjYCCEiIWEjhIiEhI0QIhISNkKISEjYCCEikY67AKL3aa3r65S80Bhz5RKf65PAJ4DrjTHnLPU6rfUG4BjgbcaYf13A8zV9T1rrQeAQY8yG+T7fYmmtzwd+F36aMcbUOv2anSI1GyEWQGv9euBh4AVxl6XXSM1GtMNTwuOmGMvwT8AlQKFNz9fsPf0DcGSbXmNZkbARS2aMeagLyrAb2N3G54v9PSWN3EYJISIhNZseoLV+E/Ad4FLgrcDfAq/GNXzmgRuALxhjrj3gupOADwHPA44AisCjwBXAPxpjdrapfE9oTF1smQ943oOAjwB/AhwFTADXAZ83xtx2wLmfpEXDstb6RcBHgWcANeAO4GJjzGWt3lPD89d9S2v9LeBTxphPNlx3KPAB4I+AYwEfeAh3i/fPxphSk7KdD7wfOAMYA+4Dvgpsm+38XiQ1m96yArgJuBAYBh4AhnA/2L/TWr+0fqLW+izgNuDN7Pvh3QI8Df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4HtwGewNn5pmq6fxGYiH8BmTp/XDnsjxgBvwnoTBexrHgf+Ffs+3TZL36m8GTus9rHv37rGCaXUX2CXJ1yPnSU8H5svtDG890XTrcELs5ivBm7FLrs5C7gfmx0/7fqrViCMMXO3cjgcjibgPByHw9E2nOA4HI624RL/uoAw63gx/LANK7XnREp5IXaV82L4eLhGyNEDOMHpDhZbPmBeOwi0gWEW/xoWWpPG0cG4oLHD4WgbLobjcDjahhMch8PRNpzgOByOtuEEx+FwtA0nOA6Ho204wZkBKeX3pJTzKSfgcDjmicvDmZnT1q1bdzZ2UZ7D4TjMouscOQ/H4XC0DSc4DoejbTjBcTgcbcMJjsPhaBtOcBwOR9twguNwONqGExyHw9E2nOA4HI624QTH4XC0DSc4DoejbTjBcTgcbcMJjsPhaBtOcBwOR9twguNwONqGK0/Ro0zc9SUm7vk6TNmVwx9YzqprPkVsZE1Eljn6GSc4PUr+oe9R2bYRU6sc8bw/vJrylvsYeOEbI7LM0c84welZDCao4w2uRMRTAATje8DoiO1y9DNOcHoWW5RN+Am8UHC059nnxaILtjkcS8IFjXuVQ6IyKYZjpp5zONqLE5xeRRz9pzUNxRF+m41xOCxOcHoU4fnTezLCDakc0eEEp1fxQi9m8rR4+H/hOQ/HEQ1OcHoU4fkIBEfvciMQvpsrcESDE5xexYvZodMRiX/GPuc5wXFEgxOcHsV6MVNiNcYgnIfjiBAnOD2K8BMgBGZqDEcI8OPRGeboa5zg9Cqx+IxDKuEExxERTnB6FCsqApi0lMEYQCBiiYiscvQ7TnB6FBFLHuXhGKNDD8cJjiManOD0KCKWQAjv6DwcIRDxZHS
"text/plain": [
"<Figure size 255x450 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"for cell_type, result, in results.items():\n",
" fig = plt.figure()\n",
" violinplot2(\n",
" [result['peak']['11 Hz'].dropna().values, result['peak']['30 Hz'].dropna().values], \n",
" colors=colors,\n",
" xticks=[\"11 Hz \", \" 30 Hz\"],\n",
" )\n",
" plt.title(cell_type)\n",
" figname = f'{cell_type}-stim-response-peak-11-30Hz'\n",
" fig.savefig(\n",
" output / 'figures' / f'{figname}.png', \n",
" bbox_inches='tight', transparent=True)\n",
" fig.savefig(\n",
" output / 'figures' / f'{figname}.svg', \n",
" bbox_inches='tight', transparent=True)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# stats"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"stats = {}\n",
"for cell_type, result in results.items():\n",
" stats[cell_type], _ = make_statistics_table(result, labels)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"stats['gridcell']"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"for cell_type, stat in stats.items():\n",
" stat.to_latex(output / \"statistics\" / f\"statistics_{cell_type}.tex\")\n",
" stat.to_csv(output / \"statistics\" / f\"statistics_{cell_type}.csv\")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Save to expipe"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"action = project.require_action(\"stimulus-response-fwhm\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"action.modules['parameters'] = {\n",
" 'window_size': window_size,\n",
" 'std_gaussian_kde': std_gaussian_kde,\n",
" 'tmin': tmin\n",
"}"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"action.data['results'] = 'results.csv'\n",
"session_units_sig.to_csv(action.data_path('results'), index=False)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"copy_tree(output, str(action.data_path()))"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"septum_mec.analysis.registration.store_notebook(action, \"10-calculate-stimulus-response-fwhm.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": 4
}