septum-mec/actions/stimulus-lfp-response-mec-n.../data/20_stimulus-lfp-response-me...

1416 lines
259 KiB
Plaintext
Raw Permalink Normal View History

{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"%load_ext autoreload\n",
"%autoreload 2"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [],
"source": [
"import os\n",
"import expipe\n",
"import pathlib\n",
"import numpy as np\n",
"import spatial_maps.stats as stats\n",
"import septum_mec\n",
"import septum_mec.analysis.data_processing as dp\n",
"import septum_mec.analysis.registration\n",
"import head_direction.head as head\n",
"import spatial_maps as sp\n",
"import speed_cells.speed as spd\n",
"import re\n",
"import joblib\n",
"import multiprocessing\n",
"import shutil\n",
"import psutil\n",
"import pandas as pd\n",
"import matplotlib.pyplot as plt\n",
"import matplotlib\n",
"from distutils.dir_util import copy_tree\n",
"from neo import SpikeTrain\n",
"import scipy\n",
"import seaborn as sns\n",
"from tqdm.notebook import tqdm_notebook as tqdm\n",
"tqdm.pandas()\n",
"\n",
"from spike_statistics.core import permutation_resampling_test\n",
"\n",
"from spikewaveform.core import calculate_waveform_features_from_template, cluster_waveform_features\n",
"\n",
"from septum_mec.analysis.plotting import violinplot, despine"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [],
"source": [
"#############################\n",
"\n",
"perform_zscore = False\n",
"\n",
"if not perform_zscore:\n",
" zscore_str = \"-no-zscore\"\n",
"else:\n",
" zscore_str = \"\"\n",
"\n",
"#################################"
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {},
"outputs": [],
"source": [
"%matplotlib inline\n",
"plt.rc('axes', titlesize=12)\n",
"plt.rcParams.update({\n",
" 'font.size': 12, \n",
" 'figure.figsize': (6, 4), \n",
" 'figure.dpi': 150\n",
"})\n",
"\n",
"output_path = pathlib.Path(\"output\") / (\"stimulus-lfp-response-mec\" + zscore_str)\n",
"(output_path / \"statistics\").mkdir(exist_ok=True, parents=True)\n",
"(output_path / \"figures\").mkdir(exist_ok=True, parents=True)\n",
"output_path.mkdir(exist_ok=True)"
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {},
"outputs": [],
"source": [
"data_loader = dp.Data()\n",
"actions = data_loader.actions\n",
"project = data_loader.project"
]
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {},
"outputs": [],
"source": [
"identify_neurons = actions['identify-neurons']\n",
"sessions = pd.read_csv(identify_neurons.data_path('sessions'))"
]
},
{
"cell_type": "code",
"execution_count": 12,
"metadata": {},
"outputs": [],
"source": [
"lfp_action = actions['stimulus-lfp-response' + zscore_str]\n",
"lfp_results = pd.read_csv(lfp_action.data_path('results'))"
]
},
{
"cell_type": "code",
"execution_count": 13,
"metadata": {},
"outputs": [],
"source": [
"lfp_results = pd.merge(sessions, lfp_results, how='left')"
]
},
{
"cell_type": "code",
"execution_count": 14,
"metadata": {},
"outputs": [],
"source": [
"lfp_results = lfp_results.query('stim_location!=\"ms\"')"
]
},
{
"cell_type": "code",
"execution_count": 15,
"metadata": {},
"outputs": [],
"source": [
"def action_group(row):\n",
" a = int(row.channel_group in [0,1,2,3])\n",
" return f'{row.action}-{a}'\n",
"lfp_results['action_side_a'] = lfp_results.apply(action_group, axis=1)"
]
},
{
"cell_type": "code",
"execution_count": 16,
"metadata": {},
"outputs": [],
"source": [
"lfp_results['stim_strength'] = lfp_results['stim_p_max'] / lfp_results['theta_energy']"
]
},
{
"cell_type": "code",
"execution_count": 17,
"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_side_a</th>\n",
" <th>channel_group</th>\n",
" <th>signal_to_noise</th>\n",
" <th>stim_strength</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>71</th>\n",
" <td>1833-010719-1-0</td>\n",
" <td>7</td>\n",
" <td>0.001902</td>\n",
" <td>NaN</td>\n",
" </tr>\n",
" <tr>\n",
" <th>67</th>\n",
" <td>1833-010719-1-1</td>\n",
" <td>3</td>\n",
" <td>0.003522</td>\n",
" <td>NaN</td>\n",
" </tr>\n",
" <tr>\n",
" <th>583</th>\n",
" <td>1833-020719-1-0</td>\n",
" <td>7</td>\n",
" <td>-0.002942</td>\n",
" <td>NaN</td>\n",
" </tr>\n",
" <tr>\n",
" <th>579</th>\n",
" <td>1833-020719-1-1</td>\n",
" <td>3</td>\n",
" <td>0.012323</td>\n",
" <td>NaN</td>\n",
" </tr>\n",
" <tr>\n",
" <th>375</th>\n",
" <td>1833-020719-3-0</td>\n",
" <td>7</td>\n",
" <td>-0.002042</td>\n",
" <td>NaN</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" action_side_a channel_group signal_to_noise stim_strength\n",
"71 1833-010719-1-0 7 0.001902 NaN\n",
"67 1833-010719-1-1 3 0.003522 NaN\n",
"583 1833-020719-1-0 7 -0.002942 NaN\n",
"579 1833-020719-1-1 3 0.012323 NaN\n",
"375 1833-020719-3-0 7 -0.002042 NaN"
]
},
"execution_count": 17,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# lfp_results_hemisphere = lfp_results.sort_values(\n",
"# by=['action_side_a', 'stim_strength', 'signal_to_noise'], ascending=[True, False, False]\n",
"lfp_results_hemisphere = lfp_results.sort_values(\n",
" by=['action_side_a', 'channel_group'], ascending=[True, False]\n",
").drop_duplicates(subset='action_side_a', keep='first')\n",
"lfp_results_hemisphere.loc[:,['action_side_a','channel_group', 'signal_to_noise', 'stim_strength']].head()"
]
},
{
"cell_type": "code",
"execution_count": 18,
"metadata": {},
"outputs": [],
"source": [
"colors = ['#1b9e77','#d95f02','#7570b3','#e7298a']\n",
"labels = ['Baseline I', '11 Hz', 'Baseline II', '30 Hz']\n",
"# Hz11 means that the baseline session was indeed before an 11 Hz session\n",
"queries = ['baseline and i and Hz11', 'frequency==11', 'baseline and ii and Hz30', 'frequency==30']"
]
},
{
"cell_type": "code",
"execution_count": 19,
"metadata": {},
"outputs": [],
"source": [
"# prepare pairwise comparison: same animal same side same date different sessions"
]
},
{
"cell_type": "code",
"execution_count": 20,
"metadata": {},
"outputs": [],
"source": [
"def make_entity_date_side(row):\n",
" s = row.action_side_a.split('-')\n",
" del s[2]\n",
" return '-'.join(s)"
]
},
{
"cell_type": "code",
"execution_count": 21,
"metadata": {},
"outputs": [],
"source": [
"lfp_results_hemisphere['entity_date_side'] = lfp_results_hemisphere.apply(make_entity_date_side, axis=1)"
]
},
{
"cell_type": "code",
"execution_count": 22,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"/home/mikkel/.virtualenvs/expipe/lib/python3.6/site-packages/numpy/lib/histograms.py:898: RuntimeWarning: invalid value encountered in true_divide\n",
" return n/db/n.sum(), bin_edges\n"
]
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAewAAAFICAYAAACSp82YAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAXEQAAFxEByibzPwAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjIsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8li6FKAAAgAElEQVR4nOzdd5xcVf3/8dembbIJIY0mAQIEPoQuHYFfgl+a0sQIX5AAAQFBAUGkKFWk61eUIigKQUAQkBqKIk0BQaSH8qEmIJ00SDbZJLv7++OcYW9m78zO7s7uzN19Px+PfdyZe88998xMMp85555S09zcjIiIiFS3PpUugIiIiLRNAVtERCQDFLBFREQyQAFbREQkAxSwRUREMkABW0REJAMUsEVERDJAAVtERCQDFLBFREQyQAFbREQkAxSwRUREMkABW0RE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O/fv3Z7nllmPdddflm9/8JuPHj//6v/71LyZPngzAscce+1on37rUcgK8+uqr3HDDDfz73//mww8/ZPHixYwYMYKNN96YiRMnMn78+G/SejhX0dW72lmO5+ISn4cA36Blec2FwGvA3cBl7v5xGa51kZk9TOjlvT2hY9/nwGOE++SPE3ruQ/Gx5RBmPfscWAa4390L/psT6Wpduh62mX2X0JHlMHf/fQfOH0moqexJ6PAxm/Cf7sI4f3Fny/fS2LFj17377rs7m5VIT1S2gF1NzGwEYWgWhLXAjymSdhxhvW2A/WINXqQiuqyGbWabE37NdvT8FQjBeU3CL/8XCEF7L8JUi4e7+1XlKKuIZJ+Z7U/4fngDOM/d5xZI+tXE4+fbyPbguJ1FGW/
"text/plain": [
"<Figure size 525x300 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAewAAAFICAYAAACSp82YAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAXEQAAFxEByibzPwAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjIsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8li6FKAAAgAElEQVR4nO3deZyd4/3/8ddkzyTIRqkgJHxspWov/Qq11VpVWgSh1lpqqaWlihZFf9TWKkXUUluj1hZV1VqrtorwIUisQRYhmWyz/P64rjtzz8nZZubMnLln3s/HYx73uZfrOtc5OTmfc133tdQ0NTUhIiIiXVuvahdARERESlPAFhERyQAFbBERkQxQwBYREckABWwREZEMUMAWERHJAAVsERGRDFDAFhERyQAFbBERkQxQwBYREckABWwREZEMUMAWERHJAAVsERGRDFDAFhERyQAFbOlWzGyDPMcmmFlT/FuxGuXKKc9SZZTKMrNRqX/zq6tdHpFK6FPtAohUgpktB5wLHEMX/VzHHwu/BrYCVq9ycUQkY7rkF5tIG1wCHFrtQpRwC7AdMK3aBRGR7FGTuHQXvatdgDJkoYwi0kUpYIuIiGSAAraIi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067AatpltSugx29b0XyJMjnACYRjL/wi1gL2AJ8zs0EqUU0REJAs6JGCb2VhCU9My7cjmdsK8wY8AI919E0LnntMJMyxdHacuFBER6fYq2kvczAYQAuqZtJy2sLX5jCV08JkL7B87iCQLAVxoZusTxmCeQcuxmCI9zqeffsqMGTNKX1jCOuvo969IV1axgG1mYwi9QlchdBA5Ezic5on3W2N
"text/plain": [
"<Figure size 525x300 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAewAAAFICAYAAACSp82YAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAXEQAAFxEByibzPwAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjIsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8li6FKAAAgAElEQVR4nO3deZwcVbn/8c8wCUwStpCwh5CQIQ9hFVGWC0hANoWALPGKBAlIkM2VRa5w2WQx4E9EiXABJQjIKsoSUBYRBQQRwg5PCJIACRGyISGBbPP745x2KkN3T89MdVfXzPf9evWrurvOqXq6CfP0OXXqnIaWlhZERESkvq2UdQAiIiLSPiVsERGRHFDCFhERyQElbBERkRxQwhYREckBJWwREZEcUMIWERHJASVsERGRHFDCFhERyQElbBERkRxQwhYREckBJWwREZEcUMIWERHJASVsERGRHOiVdQAitWJmW7v7823emwgcGV+u7+6zah5YQrEY642ZbQqcA4wEBgLzgJfdfY8MwxLp9pSwpdszszWA84ATqdN/82a2HvBjYGdgaMbhlGRmGwJPAGsl3l4XeCWbiER6jrr84yWSsp8AR2cdRDtuBPYApmcdSDu+SWuyvh24AvgIWJhZRCI9hBK29ASNWQdQgTzECLBF3C4BjnR3JWqRGtGgMxHpiH5x+66StUhtKWGLSEcU/mYszTQKkR6ooaWlJesYRKrCzM4Bzi6x+xF3H9l2lDjQBJwK7AtsCPwbeBmYCFzn7iX/hzGz3sBYYDSwNeFa73zgOcL13mvdfXG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[
"<Figure size 525x300 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAewAAAFICAYAAACSp82YAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAXEQAAFxEByibzPwAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjIsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8li6FKAAAgAElEQVR4nO3debxd0/3/8dfNIBMhkgYVERI+EkOrran4Cj9TRaiS/qqCGKKKqg6GlqJaNfVHB1pftInqoKgWCS01tShVYgo+ESQIKRJzEpnu74+1trtzcqZ77z7Dvnk/H4/72Gfvvfben3Nzcj9nrb3W2i2tra2IiIhIc+vW6ABERESkMiVsERGRHFDCFhERyQElbBERkRxQwhYREckBJWwREZEcUMIWERHJASVsERGRHFDCFhERyQElbBERkRxQwhYREckBJWwREZEcUMIWERHJASVsERGRHOjR6ACkazCzrdz9iYJtk4HD4+p67j637oGlFIuxWZjZBGBSXD3Y3a9tUBzJ83b/5u57F9m/OnAWcACwPrAQeA0Y4+6z6hVne5jZ2YSYAXZw9wc7cI5ZwIbAve4+ukSZop8vM7sH2AX40N17t/faIgklbOkUM1sTOAc4nib9PJnZusCPgR2BjRocTm6ZWTfgdmCH1ObeQD9gTkOCagL6fEm9NOUfWMmVi4EjGx1EBb8DdgNmNzqQnNuTtmT9BHAmMBfo6+5LGhZV4+nzJXWhhC2d1b3RAVQhDzHmweap19929zsaFkk7uPvZwNk1vIQ+X1IX6nQmItXql3r9YsOiEFlFKWGLSLXSfy+WNiwKkVWUmsSlQwp63ibbkh7GRXvSmtkw4GRgb0IP43eBp4HJwNXu3lp4TOrYnsAEYBywFbA28DbwOHADMMndFxccM5m2XuoAG6ZivNrdJxSUXweYCPwfwOI1lgLzgIeBa4E/lYszK7E39knAgcAIYDmhVnsD8DN3f7fMsf2Bowj3nLckvI8WYD4wDbgRuKba+86pHt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TxMaH5eh9AsnjwB62V3nwng7kvM7D7CeP7dgCcJw8GgfQl7eur1NpTo7BcfK7plO84rUhNNdx9Lcmd5Dc+dHmbz1QplLwLOJ9SWC+9Bl4txROr1IyVLhQlMesfXzfhFt6r3YWafJfXM5lKzyzVKbNVIelLvAfxPfH13QdG74nIn2ob+PebuL7fjcukvgEeVKTeGUAMvpZb/B0Q+ooQtnfVh8iLrptY4JvofcXV3Mys6M5eZfYu2OaYfI8yMVizGYvGlm0E/V2Q/ZrYtoYk50WzDoaC697EJcE3B5mZ8L8nwrm0IM4FB6YS9OnBEfN2e2nUy8cmf4uqBZjahsEwc0/+zCqcq9/kSyUxTfbuWXHot9fpHZvYbYJm7T8vo/EcTOkv1B841s10Ic2HPJsyNfQjwhVh2MXBMkc5DSYwDzew7hDHdC+IMXjcQpp5sAY6LE6n8iZAA1ydM6XkwK06L2b+KTkr1NoW2mcLGmNlfCHO0zyU0L+8FHMbKSWVN2sY1N4vbCf+WyTzb0JagE9OAtwgjApKWj3Yl7OhrhPvfawO/NrNdCWOy3yHchjk1xvABK3ZKTCv3+RLJzCpdwzazm82sI//Jpc3NhLm8IfzxexjI7IlD7v4cYR7pWXHTnoRZoR4kNGkeSEi2bwH7l5gNLd30+aMY4y/j+R8jzBlNPM8RhOT3ICFxH0ZI1rcCV8Zyq7FiE3TDxalij6Xt32J/wr/Dg8BNhIeurA48ROhYl6hHr/d2cff3gXtTm16IteF0meUFZea4e7lbGqWu9RqhdWY24d//MMKwsH8Rprldl/DQmXvKnKbk50skS6t0wgaGjxgxYixhuIV+OvDj7tOuuOKK7ltvvTV9+/ald+/eDB06dOjChQtbDzjggI8ePXj
"text/plain": [
"<Figure size 525x300 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"\n",
"density = True\n",
"cumulative = True\n",
"histtype = 'step'\n",
"lw = 2\n",
"if perform_zscore:\n",
" bins = {\n",
" 'theta_energy': np.arange(0, .7, .03),\n",
" 'theta_peak': np.arange(0, .7, .03),\n",
" 'theta_freq': np.arange(4, 10, .5),\n",
" 'theta_half_width': np.arange(0, 15, .5)\n",
" }\n",
"else:\n",
" bins = {\n",
" 'theta_energy': np.arange(0, .008, .0003),\n",
" 'theta_peak': np.arange(0, .007, .0003),\n",
" 'theta_freq': np.arange(4, 12, .5),\n",
" 'theta_half_width': np.arange(0, 15, .5)\n",
" }\n",
"xlabel = {\n",
" 'theta_energy': 'Theta energy (dB)',\n",
" 'theta_peak': 'Peak PSD (dB/Hz)',\n",
" 'theta_freq': '(Hz)',\n",
" 'theta_half_width': '(Hz)',\n",
"}\n",
"# key = 'theta_energy'\n",
"# key = 'theta_peak'\n",
"results = {}\n",
"for key in bins:\n",
" results[key] = list()\n",
" fig = plt.figure(figsize=(3.5,2))\n",
" plt.suptitle(key)\n",
" legend_lines = []\n",
" for color, query, label in zip(colors, queries, labels):\n",
" values = lfp_results_hemisphere.query(query).loc[:,['entity_date_side', key]]\n",
" results[key].append(values.rename({key: label}, axis=1))\n",
" values[key].hist(\n",
" bins=bins[key], density=density, cumulative=cumulative, lw=lw, \n",
" histtype=histtype, color=color)\n",
" legend_lines.append(matplotlib.lines.Line2D([0], [0], color=color, lw=lw, label=label))\n",
" \n",
" plt.legend(\n",
" handles=legend_lines,\n",
" bbox_to_anchor=(1.04,1), borderaxespad=0, frameon=False)\n",
" plt.tight_layout()\n",
" plt.grid(False)\n",
" plt.xlim(right=bins[key].max() - bins[key].max()*0.025)\n",
" despine()\n",
" plt.xlabel(xlabel[key])\n",
" figname = f'lfp-psd-histogram-{key}'\n",
" fig.savefig(\n",
" output_path / 'figures' / f'{figname}.png', \n",
" bbox_inches='tight', transparent=True)\n",
" fig.savefig(\n",
" output_path / 'figures' / f'{figname}.svg', \n",
" bbox_inches='tight', transparent=True)"
]
},
{
"cell_type": "code",
"execution_count": 23,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAcEAAAFICAYAAAAoBEX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gkXqSTXLUEzu9XMbq13PVYlMWB9g/Cl3ptwp/g/EJZMTCd86TUSJmh8xd29IPuttLWUTiS0Ev/YNTXvGu5+PuE9WE4IDCcT1k/OInQhJ1/u9wNf7ozF3+6+GPg88ER8akdCl+LDhM/gKMJn9yEwyd1v6cC1ZhHW9n1IeL2nEoLiA4Q/gIYS9pBNxksrBbTiRfdT2ls3Ech5EARGjR49el/CX5/6yejH3a+fMWNGvyOPPJItttiCxsZGevfuzaBBgxg7diwnnXQSs2fPXidu+VWY77Ff/epXDWPHjmXAgAH069ePjTfeeOMPP/ywFWg98MADk9soMWvWrNcK826wwQYjADbZZBNLq9f48eOTHVtIS3Peeed98iX729/+9p5Oen/OnzFjRu9JkyZhZgwcOJDevXszZMgQdt11V372s5/xzDPP7BKD1Qp5TzjhhDOT+k2dOvWhtGtUSufuL86dO3eb888/ny984QsMGzaMPn360L9/f8aMGcOkSZOYMWNGf3efknKNqrn7VEIr9zLCTjZLCTvEzAD2c/fjCbM+ofzaR9z9Kdq2v3vW3R+ppS4ixTr1foKxK+QK4Gh3/3U78g8mDM7vT7gNz1uEvyDPd/eHy+WtsvynR48evcX06dMrJxaRYlnuqPMuYXu3P7n7fmXSrU0Yo1wdON3df5JVHSSfOq0laGbbs+J4T6351yWsMTuJsPPEk4S/QA8kLJQ9Mot6ikjnMLPdzeyPZvY/ZrZxmXTb0ba/6RNp6aJDCQFwOWGLPpEO6ZQgaGbjCdPBB1ZIWs5Uwi7
"text/plain": [
"<Figure size 480x300 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAcEAAAFICAYAAAAoBEX4AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAXEQAAFxEByibzPwAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjIsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8li6FKAAAgAElEQVR4nO3deZ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FwjJpY+KXby8q86qZPUpYPSc7Y1DPqdDMqYSl5cYDp8a1V39GGA26BWGt1gmEHmO5a6n63ZS6JN0TNLMbzawr/1n7vPhH4XDCfKj+hNNYvyFMmZgFnEiYI/YasH/RKL8bCSuBQPjk/wDw295pefNz92WEdVCzU4Y7AdcQfrY3E/6YDycMKDmp4NDCG+U2k8IVX5bywWk1mcJgfI/O9V1rFu+k8c90rsu6N3BDfL1LCAF4M2GlmnL0uyl1SToEgfETJkzYm3AqJ7l/7n7lbbfdNvDII49k0qRJDBkyhP79+zN06FAmT57MN7/5TebNm7eeu/+u6Lj5P/3pT9smT57M4MGDGThwIBtuuOGGS5cu7QA6Pve5z2W3UWLu3Ll/Lzx29OjRYwE23nhjK9euadOm7VnwHpUsM2PGjOx2PFx22WVzypXryr9YHwDf/va3Z3SlnLvfdssttww66KCDGDNmDAMGDGDAgAGMGDGCqVOncsYZZ/DII49MfOihh84ZNCjMPtlhhx1+WuvPqie//+J/F1100dHZa02ZMmVQXAy7gw8qDME5FRZCqMjdXyQMKjqKMPhmMaHnN5+wmPnedIZcqeMfBvYhrP25hBDaK+LIVpEP6dfRUfy
"text/plain": [
"<Figure size 480x300 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAcEAAAFICAYAAAAoBEX4AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAXEQAAFxEByibzPwAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjIsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8li6FKAAAgAElEQVR4nO3dedxc4/3/8VdWScSSxB5CFj5ELamtQb9SLVVUKPqtIkKtLVq19suX0KLor9WW1lKEoEWtbbRq+0ZjiVZR6yeCxFZLYo0kEsn9++O6jnsymfWeM/fMPef9fDzux5kz5zrXXDOZnM9c6+nW1taGiIhIFnVvdAFEREQaRUFQREQyS0FQREQyS0FQ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7Uy0wCrsLouJ1a5PijhIV/lwe2rOF1REQkw1IbHRprghu4+505z80k1AQrHh0aF9T9hFBL3dnd7y6SLsn7UHe/ooNlrvvo0EVzXuXDqRPrlr9Iowwa+78aHSpdXmrNoe4+A5iRQlYDaC/XOyXSzSEEwVVSeM26+fS915hz64RGF0MkdYPG/m+jiyBSs2ZcNi13RfgFJdIl/YBlV5A3s2eKHKptpIKIiHRpzbhizOLySZZSv9n+IiJNyMyOMLM2Mzu0yvO+F88b34HX7BnPbTOzsqPyzezQmLapb3LdjDXBuTmP+xRN1X4jznkl0gDg7hsXej7WEEdWXrQUdO9B/1F7dOpLikjr6OhCJGa2DXBe+iXq2po1CH5CuK3KoBLpkr7ALnWz0e69+7HWMX9sdDFEpAuKc6hvocqFSMzsy4RF7JevQ7G6tKYLgu6
"text/plain": [
"<Figure size 480x300 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAcEAAAFICAYAAAAoBEX4AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAXEQAAFxEByibzPwAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjIsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8li6FKAAAgAElEQVR4nO3df7xd053/8Vdyg4QEESKakEgiH9KqapVm8JUpozqUKjolfoShaNW0MyjlWzEtxo+ZL0UboyVoU6RNUb9aPyoahNLE73ySiIimDRKhgojce79/rHXkODm/z7733HvX+/l45LHPOXvttdc55+a+7957rbV7tbe3IyIikqLezW6AiIhIsygERUQkWQpBERFJlkJQRESSpRAUEZFkKQRFRCRZCkEREUmWQlBERJKlEBQRkWQpBEVEJFkKQRERSZZCUEREkqUQFBGRZCkERUQkWQpB6XRm9skSr08xs/b4b0hnt6urKPX5pMrM1jez7Yu8PiLv52VyM9om3Z9CUDqNmW1iZpcDf252W7oiMxttZncDP2p2W7oKM9sHeBr4WrP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f369ePggw/mN7/5DQAzZ878yGD3oUOHsmTJErbddlujxPc1fvx4HnzwwdzTomUuvPBCzjrrLABuuOGGUjPP1CWX90888QTTpk1jzpw5vPrqq6xZs4aBAwey/fbbs++++3LwwQeP7dOnz6LC7efOnct1113HtGnTWLJkCeuvvz7jxo07mnC3hqo+g/y2tLa2cscdd3DPPffw7LPPsmLFCvr06cPWW2/N7rvvzoQJE/ptvfXWU4ApperZY489vlBmX2XH3MWxmv9iZjcB/0qYs3VTwsTmdxPmOM0
"text/plain": [
"<Figure size 480x300 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"\n",
"density = True\n",
"cumulative = True\n",
"histtype = 'step'\n",
"lw = 2\n",
"if perform_zscore:\n",
" bins = {\n",
" 'stim_energy': np.arange(0, .7, .01),\n",
" 'stim_half_width': np.arange(0, 10, .5),\n",
" 'stim_p_max': np.arange(0, 4, .01),\n",
" 'stim_strength': np.arange(0, 160, 1)\n",
" }\n",
"else:\n",
" bins = {\n",
" 'stim_energy': np.arange(0, .008, .0001),\n",
" 'stim_half_width': np.arange(0, 0.5, .001),\n",
" 'stim_p_max': np.arange(0, .06, .0001),\n",
" 'stim_strength': np.arange(0, 160, 1)\n",
" }\n",
"xlabel = {\n",
" 'stim_energy': 'Energy (dB)',\n",
" 'stim_half_width': '(Hz)',\n",
" 'stim_p_max': 'Peak PSD (dB/Hz)',\n",
" 'stim_strength': 'Ratio',\n",
"}\n",
"# key = 'theta_energy'\n",
"# key = 'theta_peak'\n",
"for key in bins:\n",
" results[key] = list()\n",
" fig = plt.figure(figsize=(3.2,2))\n",
" plt.suptitle(key)\n",
" legend_lines = []\n",
" for color, query, label in zip(colors[1::2], queries[1::2], labels[1::2]):\n",
" values = lfp_results_hemisphere.query(query).loc[:,['entity_date_side', key]]\n",
" results[key].append(values.rename({key: label}, axis=1))\n",
" values[key].hist(\n",
" bins=bins[key], density=density, cumulative=cumulative, lw=lw, \n",
" histtype=histtype, color=color)\n",
" legend_lines.append(matplotlib.lines.Line2D([0], [0], color=color, lw=lw, label=label))\n",
" \n",
" plt.legend(\n",
" handles=legend_lines,\n",
" bbox_to_anchor=(1.04,1), borderaxespad=0, frameon=False)\n",
" plt.tight_layout()\n",
" plt.grid(False)\n",
" plt.xlim(right=bins[key].max() - bins[key].max()*0.025)\n",
" despine()\n",
" plt.xlabel(xlabel[key])\n",
" figname = f'lfp-psd-histogram-{key}'\n",
" fig.savefig(\n",
" output_path / 'figures' / f'{figname}.png', \n",
" bbox_inches='tight', transparent=True)\n",
" fig.savefig(\n",
" output_path / 'figures' / f'{figname}.svg', \n",
" bbox_inches='tight', transparent=True)"
]
},
{
"cell_type": "code",
"execution_count": 24,
"metadata": {},
"outputs": [],
"source": [
"from functools import reduce"
]
},
{
"cell_type": "code",
"execution_count": 25,
"metadata": {},
"outputs": [],
"source": [
"for key, val in results.items():\n",
" df = reduce(lambda left,right: pd.merge(left, right, on='entity_date_side', how='outer'), val)\n",
" results[key] = df.drop('entity_date_side',axis=1)"
]
},
{
"cell_type": "code",
"execution_count": 26,
"metadata": {},
"outputs": [],
"source": [
"def summarize(data):\n",
" return \"{:.1e} ± {:.1e} ({})\".format(data.mean(), data.sem(), sum(~np.isnan(data)))\n",
"\n",
"\n",
"def MWU(df, keys):\n",
" '''\n",
" Mann Whitney U\n",
" '''\n",
" Uvalue, pvalue = scipy.stats.mannwhitneyu(\n",
" df[keys[0]].dropna(), \n",
" df[keys[1]].dropna(),\n",
" alternative='two-sided')\n",
"\n",
" return \"{:.2f}, {:.3f}\".format(Uvalue, pvalue)\n",
"\n",
"\n",
"def PRS(df, keys):\n",
" '''\n",
" Permutation ReSampling\n",
" '''\n",
" pvalue, observed_diff, diffs = permutation_resampling(\n",
" df[keys[0]].dropna(), \n",
" df[keys[1]].dropna(), statistic=np.median)\n",
"\n",
" return \"{:.2f}, {:.3f}\".format(observed_diff, pvalue)\n",
"\n",
"\n",
"def wilcoxon(df, keys):\n",
" dff = df.loc[:,keys].dropna()\n",
" if len(dff[keys].dropna()) == 0:\n",
" statistic, pvalue = np.nan, np.nan\n",
" else:\n",
" statistic, pvalue = scipy.stats.wilcoxon(\n",
" dff[keys[0]], \n",
" dff[keys[1]],\n",
" alternative='two-sided')\n",
"\n",
" return \"{:.2f}, {:.3f}, ({})\".format(statistic, pvalue, len(dff))\n",
"\n",
"\n",
"def paired_t(df, keys):\n",
" dff = df.loc[:,[keys[0], keys[1]]].dropna()\n",
" statistic, pvalue = scipy.stats.ttest_rel(\n",
" dff[keys[0]], \n",
" dff[keys[1]])\n",
"\n",
" return \"{:.2f}, {:.3f}\".format(statistic, pvalue)\n",
"\n",
" \n",
"def normality(df, key):\n",
" if len(df[key].dropna()) < 8:\n",
" statistic, pvalue = np.nan, np.nan\n",
" else:\n",
" statistic, pvalue = scipy.stats.normaltest(\n",
" df[key].dropna())\n",
"\n",
" return \"{:.2f}, {:.3f}\".format(statistic, pvalue)\n",
"\n",
"\n",
"def shapiro(df, key):\n",
" if len(df[key].dropna()) < 8:\n",
" statistic, pvalue = np.nan, np.nan\n",
" else:\n",
" statistic, pvalue = scipy.stats.shapiro(\n",
" df[key].dropna())\n",
"\n",
" return \"{:.2f}, {:.3f}\".format(statistic, pvalue)\n",
"\n",
"def rename(name):\n",
" return name.replace(\"_field\", \"-field\").replace(\"_\", \" \").capitalize()"
]
},
{
"cell_type": "code",
"execution_count": 27,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"{'theta_energy': Baseline I 11 Hz Baseline II 30 Hz\n",
" 0 0.003500 NaN NaN NaN\n",
" 1 0.001237 NaN NaN NaN\n",
" 2 0.003269 NaN 0.004628 NaN\n",
" 3 0.001465 NaN 0.002155 NaN\n",
" 4 0.002685 NaN NaN NaN\n",
" 5 0.000772 NaN NaN NaN\n",
" 6 0.002735 NaN 0.002988 NaN\n",
" 7 0.000872 NaN 0.001177 NaN\n",
" 8 0.004156 NaN 0.003132 NaN\n",
" 9 0.001317 NaN 0.001268 NaN\n",
" 10 0.000423 NaN 0.003200 NaN\n",
" 11 0.000957 NaN 0.001153 NaN\n",
" 12 0.002135 NaN 0.001651 NaN\n",
" 13 0.001649 NaN 0.000871 NaN\n",
" 14 0.009256 NaN 0.006838 NaN\n",
" 15 0.003803 NaN 0.003271 NaN\n",
" 16 0.004999 NaN 0.003724 NaN\n",
" 17 0.001193 NaN 0.002239 NaN\n",
" 18 0.004548 0.001780 NaN NaN\n",
" 19 0.004548 0.001093 NaN NaN\n",
" 20 0.002307 0.001479 NaN NaN\n",
" 21 0.002307 0.001122 NaN NaN\n",
" 22 0.002577 NaN 0.002665 NaN\n",
" 23 0.001591 NaN 0.001562 NaN\n",
" 24 0.001850 NaN 0.002546 NaN\n",
" 25 0.001388 NaN 0.001375 NaN\n",
" 26 0.002535 NaN 0.003099 NaN\n",
" 27 0.001129 NaN 0.001638 NaN\n",
" 28 0.001581 NaN 0.001302 NaN\n",
" 29 0.001346 NaN 0.000808 NaN\n",
" 30 0.002590 NaN 0.001583 NaN\n",
" 31 0.001029 NaN 0.000921 NaN\n",
" 32 0.001280 NaN NaN NaN\n",
" 33 0.000644 NaN NaN NaN\n",
" 34 0.002180 NaN NaN NaN\n",
" 35 0.002834 NaN NaN NaN\n",
" 36 0.001891 0.001814 NaN NaN\n",
" 37 0.001891 0.001557 NaN NaN\n",
" 38 0.002443 0.003549 NaN NaN\n",
" 39 0.002443 0.002262 NaN NaN\n",
" 40 0.002762 NaN 0.001113 NaN\n",
" 41 0.002649 NaN 0.003236 NaN\n",
" 42 0.000662 NaN NaN NaN\n",
" 43 0.003067 NaN NaN NaN\n",
" 44 0.001097 NaN 0.000649 NaN\n",
" 45 0.002022 NaN 0.001838 NaN\n",
" 46 0.001199 NaN 0.001475 NaN\n",
" 47 0.004233 NaN 0.001936 NaN\n",
" 48 0.002117 NaN 0.004077 NaN\n",
" 49 0.002906 NaN 0.003994 NaN,\n",
" 'theta_peak': Baseline I 11 Hz Baseline II 30 Hz\n",
" 0 0.003070 NaN NaN NaN\n",
" 1 0.001036 NaN NaN NaN\n",
" 2 0.003435 NaN 0.003384 NaN\n",
" 3 0.001416 NaN 0.001389 NaN\n",
" 4 0.002043 NaN NaN NaN\n",
" 5 0.000472 NaN NaN NaN\n",
" 6 0.002429 NaN 0.003210 NaN\n",
" 7 0.000625 NaN 0.000961 NaN\n",
" 8 0.002038 NaN 0.002704 NaN\n",
" 9 0.000872 NaN 0.001010 NaN\n",
" 10 0.000342 NaN 0.002434 NaN\n",
" 11 0.000640 NaN 0.000825 NaN\n",
" 12 0.001660 NaN 0.001235 NaN\n",
" 13 0.001190 NaN 0.000620 NaN\n",
" 14 0.007286 NaN 0.006490 NaN\n",
" 15 0.002671 NaN 0.002261 NaN\n",
" 16 0.004189 NaN 0.003590 NaN\n",
" 17 0.000846 NaN 0.001383 NaN\n",
" 18 0.003873 0.001374 NaN NaN\n",
" 19 0.003873 0.000699 NaN NaN\n",
" 20 0.001684 0.001046 NaN NaN\n",
" 21 0.001684 0.000645 NaN NaN\n",
" 22 0.002021 NaN 0.001967 NaN\n",
" 23 0.001159 NaN 0.001171 NaN\n",
" 24 0.001540 NaN 0.002067 NaN\n",
" 25 0.001135 NaN 0.001147 NaN\n",
" 26 0.002134 NaN 0.002335 NaN\n",
" 27 0.000959 NaN 0.001139 NaN\n",
" 28 0.001189 NaN 0.000792 NaN\n",
" 29 0.000657 NaN 0.000317 NaN\n",
" 30 0.001134 NaN 0.001158 NaN\n",
" 31 0.000427 NaN 0.000362 NaN\n",
" 32 0.000670 NaN NaN NaN\n",
" 33 0.000301 NaN NaN NaN\n",
" 34 0.001377 NaN NaN NaN\n",
" 35 0.001044 NaN NaN NaN\n",
" 36 0.001698 0.001544 NaN NaN\n",
" 37 0.001698 0.000898 NaN NaN\n",
" 38 0.002605 0.002939 NaN NaN\n",
" 39 0.002605 0.001677 NaN NaN\n",
" 40 0.002632 NaN 0.000722 NaN\n",
" 41 0.002425 NaN 0.003022 NaN\n",
" 42 0.000412 NaN NaN NaN\n",
" 43 0.003115 NaN NaN NaN\n",
" 44 0.000959 NaN 0.000390 NaN\n",
" 45 0.002131 NaN 0.001653 NaN\n",
" 46 0.000515 NaN 0.000891 NaN\n",
" 47 0.002570 NaN 0.001760 NaN\n",
" 48 0.001693 NaN 0.002711 NaN\n",
" 49 0.003029 NaN 0.002933 NaN,\n",
" 'theta_freq': Baseline I 11 Hz Baseline II 30 Hz\n",
" 0 7.4 NaN NaN NaN\n",
" 1 7.4 NaN NaN NaN\n",
" 2 7.8 NaN 7.8 NaN\n",
" 3 7.8 NaN 7.8 NaN\n",
" 4 7.4 NaN NaN NaN\n",
" 5 7.4 NaN NaN NaN\n",
" 6 7.5 NaN 7.8 NaN\n",
" 7 7.5 NaN 7.8 NaN\n",
" 8 7.6 NaN 7.9 NaN\n",
" 9 7.6 NaN 7.9 NaN\n",
" 10 7.4 NaN 7.7 NaN\n",
" 11 7.4 NaN 7.7 NaN\n",
" 12 7.6 NaN 7.6 NaN\n",
" 13 7.5 NaN 7.6 NaN\n",
" 14 8.3 NaN 8.5 NaN\n",
" 15 8.2 NaN 8.5 NaN\n",
" 16 7.9 NaN 8.1 NaN\n",
" 17 7.7 NaN 8.2 NaN\n",
" 18 8.0 8.2 NaN NaN\n",
" 19 8.0 8.2 NaN NaN\n",
" 20 8.0 8.2 NaN NaN\n",
" 21 8.0 8.2 NaN NaN\n",
" 22 8.1 NaN 8.2 NaN\n",
" 23 8.1 NaN 8.2 NaN\n",
" 24 8.0 NaN 8.2 NaN\n",
" 25 8.1 NaN 8.2 NaN\n",
" 26 8.1 NaN 8.2 NaN\n",
" 27 8.1 NaN 8.2 NaN\n",
" 28 8.0 NaN 8.2 NaN\n",
" 29 6.3 NaN 8.3 NaN\n",
" 30 8.2 NaN 8.6 NaN\n",
" 31 6.2 NaN 8.3 NaN\n",
" 32 8.3 NaN NaN NaN\n",
" 33 8.4 NaN NaN NaN\n",
" 34 8.2 NaN NaN NaN\n",
" 35 7.6 NaN NaN NaN\n",
" 36 7.9 7.9 NaN NaN\n",
" 37 7.9 7.9 NaN NaN\n",
" 38 7.9 8.0 NaN NaN\n",
" 39 7.9 7.9 NaN NaN\n",
" 40 7.6 NaN 8.1 NaN\n",
" 41 7.6 NaN 8.1 NaN\n",
" 42 7.4 NaN NaN NaN\n",
" 43 7.6 NaN NaN NaN\n",
" 44 7.7 NaN 7.8 NaN\n",
" 45 7.7 NaN 7.8 NaN\n",
" 46 7.8 NaN 8.0 NaN\n",
" 47 8.0 NaN 8.0 NaN\n",
" 48 7.7 NaN 8.3 NaN\n",
" 49 7.7 NaN 8.0 NaN,\n",
" 'theta_half_width': Baseline I 11 Hz Baseline II 30 Hz\n",
" 0 0.823669 NaN NaN NaN\n",
" 1 0.845791 NaN NaN NaN\n",
" 2 0.577806 NaN 0.959215 NaN\n",
" 3 0.653362 NaN 1.056302 NaN\n",
" 4 1.059779 NaN NaN NaN\n",
" 5 1.147158 NaN NaN NaN\n",
" 6 0.787100 NaN 0.637116 NaN\n",
" 7 0.964045 NaN 0.633677 NaN\n",
" 8 1.285535 NaN 0.760866 NaN\n",
" 9 0.913884 NaN 0.766207 NaN\n",
" 10 0.776057 NaN 0.996439 NaN\n",
" 11 0.928426 NaN 0.941342 NaN\n",
" 12 0.966327 NaN 1.072370 NaN\n",
" 13 0.984655 NaN 1.106900 NaN\n",
" 14 0.960731 NaN 0.738833 NaN\n",
" 15 1.044175 NaN 0.879523 NaN\n",
" 16 0.911633 NaN 0.641326 NaN\n",
" 17 0.953731 NaN 0.744352 NaN\n",
" 18 0.749468 0.930533 NaN NaN\n",
" 19 0.749468 0.935671 NaN NaN\n",
" 20 0.930580 0.969152 NaN NaN\n",
" 21 0.930580 1.049631 NaN NaN\n",
" 22 1.009373 NaN 1.085564 NaN\n",
" 23 1.065057 NaN 0.944394 NaN\n",
" 24 0.831508 NaN 0.910906 NaN\n",
" 25 0.825350 NaN 0.831260 NaN\n",
" 26 0.844569 NaN 0.885471 NaN\n",
" 27 0.720270 NaN 0.915350 NaN\n",
" 28 0.873920 NaN 1.122807 NaN\n",
" 29 NaN NaN 1.657428 NaN\n",
" 30 1.224911 NaN 1.120201 NaN\n",
" 31 6.316287 NaN NaN NaN\n",
" 32 1.015663 NaN NaN NaN\n",
" 33 1.318961 NaN NaN NaN\n",
" 34 1.124338 NaN NaN NaN\n",
" 35 8.080786 NaN NaN NaN\n",
" 36 0.755843 0.620998 NaN NaN\n",
" 37 0.755843 1.215511 NaN NaN\n",
" 38 0.650319 0.620433 NaN NaN\n",
" 39 0.650319 0.745154 NaN NaN\n",
" 40 0.677682 NaN 1.000266 NaN\n",
" 41 0.679729 NaN 0.541226 NaN\n",
" 42 0.945508 NaN NaN NaN\n",
" 43 0.604237 NaN NaN NaN\n",
" 44 0.583246 NaN 0.870935 NaN\n",
" 45 0.560840 NaN 0.754164 NaN\n",
" 46 0.843262 NaN 1.160272 NaN\n",
" 47 0.969953 NaN 0.680846 NaN\n",
" 48 0.823915 NaN 0.979878 NaN\n",
" 49 0.688965 NaN 0.850279 NaN,\n",
" 'stim_energy': 11 Hz 30 Hz\n",
" 0 0.002671 NaN\n",
" 1 0.000532 NaN\n",
" 2 0.000168 NaN\n",
" 3 0.000033 NaN\n",
" 4 0.000513 NaN\n",
" 5 0.002245 NaN\n",
" 6 0.000340 NaN\n",
" 7 0.000240 NaN,\n",
" 'stim_half_width': 11 Hz 30 Hz\n",
" 0 10.318750 NaN\n",
" 1 0.149163 NaN\n",
" 2 0.156917 NaN\n",
" 3 0.271082 NaN\n",
" 4 0.150665 NaN\n",
" 5 6.113351 NaN\n",
" 6 0.655030 NaN\n",
" 7 0.156293 NaN,\n",
" 'stim_p_max': 11 Hz 30 Hz\n",
" 0 0.000105 NaN\n",
" 1 0.004951 NaN\n",
" 2 0.001566 NaN\n",
" 3 0.000206 NaN\n",
" 4 0.004785 NaN\n",
" 5 0.000374 NaN\n",
" 6 0.000814 NaN\n",
" 7 0.002239 NaN,\n",
" 'stim_strength': 11 Hz 30 Hz\n",
" 0 0.059252 NaN\n",
" 1 4.530157 NaN\n",
" 2 1.059344 NaN\n",
" 3 0.183414 NaN\n",
" 4 2.637518 NaN\n",
" 5 0.239875 NaN\n",
" 6 0.229359 NaN\n",
" 7 0.989594 NaN}"
]
},
"execution_count": 27,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"results"
]
},
{
"cell_type": "code",
"execution_count": 28,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"/home/mikkel/.virtualenvs/expipe/lib/python3.6/site-packages/scipy/stats/morestats.py:2863: UserWarning: Sample size too small for normal approximation.\n",
" warnings.warn(\"Sample size too small for normal approximation.\")\n",
"/home/mikkel/.virtualenvs/expipe/lib/python3.6/site-packages/scipy/stats/stats.py:1450: UserWarning: kurtosistest only valid for n>=20 ... continuing anyway, n=8\n",
" \"anyway, n=%i\" % int(n))\n"
]
},
{
"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>Theta energy</th>\n",
" <th>Theta peak</th>\n",
" <th>Theta freq</th>\n",
" <th>Theta half width</th>\n",
" <th>Stim energy</th>\n",
" <th>Stim half width</th>\n",
" <th>Stim p max</th>\n",
" <th>Stim strength</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>11 Hz</th>\n",
" <td>1.8e-03 ± 2.8e-04 (8)</td>\n",
" <td>1.4e-03 ± 2.6e-04 (8)</td>\n",
" <td>8.1e+00 ± 5.3e-02 (8)</td>\n",
" <td>8.9e-01 ± 7.4e-02 (8)</td>\n",
" <td>8.4e-04 ± 3.6e-04 (8)</td>\n",
" <td>2.2e+00 ± 1.4e+00 (8)</td>\n",
" <td>1.9e-03 ± 7.0e-04 (8)</td>\n",
" <td>1.2e+00 ± 5.6e-01 (8)</td>\n",
" </tr>\n",
" <tr>\n",
" <th>30 Hz</th>\n",
" <td>nan ± nan (0)</td>\n",
" <td>nan ± nan (0)</td>\n",
" <td>nan ± nan (0)</td>\n",
" <td>nan ± nan (0)</td>\n",
" <td>nan ± nan (0)</td>\n",
" <td>nan ± nan (0)</td>\n",
" <td>nan ± nan (0)</td>\n",
" <td>nan ± nan (0)</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Baseline I</th>\n",
" <td>2.3e-03 ± 2.1e-04 (50)</td>\n",
" <td>1.8e-03 ± 1.8e-04 (50)</td>\n",
" <td>7.8e+00 ± 5.9e-02 (50)</td>\n",
" <td>1.1e+00 ± 1.8e-01 (49)</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Baseline II</th>\n",
" <td>2.3e-03 ± 2.4e-04 (32)</td>\n",
" <td>1.8e-03 ± 2.3e-04 (32)</td>\n",
" <td>8.1e+00 ± 4.7e-02 (32)</td>\n",
" <td>9.1e-01 ± 3.9e-02 (31)</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Normality 11 Hz</th>\n",
" <td>8.13, 0.017</td>\n",
" <td>6.61, 0.037</td>\n",
" <td>6.30, 0.043</td>\n",
" <td>0.23, 0.890</td>\n",
" <td>3.45, 0.178</td>\n",
" <td>7.42, 0.024</td>\n",
" <td>1.81, 0.405</td>\n",
" <td>6.43, 0.040</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Normality 30 Hz</th>\n",
" <td>nan, nan</td>\n",
" <td>nan, nan</td>\n",
" <td>nan, nan</td>\n",
" <td>nan, nan</td>\n",
" <td>nan, nan</td>\n",
" <td>nan, nan</td>\n",
" <td>nan, nan</td>\n",
" <td>nan, nan</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Normality Baseline I</th>\n",
" <td>41.72, 0.000</td>\n",
" <td>31.09, 0.000</td>\n",
" <td>29.47, 0.000</td>\n",
" <td>81.74, 0.000</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Normality Baseline II</th>\n",
" <td>13.17, 0.001</td>\n",
" <td>20.78, 0.000</td>\n",
" <td>0.96, 0.618</td>\n",
" <td>13.33, 0.001</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Wilcoxon 11 Hz 30 Hz</th>\n",
" <td>nan, nan, (0)</td>\n",
" <td>nan, nan, (0)</td>\n",
" <td>nan, nan, (0)</td>\n",
" <td>nan, nan, (0)</td>\n",
" <td>nan, nan, (0)</td>\n",
" <td>nan, nan, (0)</td>\n",
" <td>nan, nan, (0)</td>\n",
" <td>nan, nan, (0)</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Wilcoxon 11 Hz Baseline II</th>\n",
" <td>nan, nan, (0)</td>\n",
" <td>nan, nan, (0)</td>\n",
" <td>nan, nan, (0)</td>\n",
" <td>nan, nan, (0)</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Wilcoxon Baseline I 11 Hz</th>\n",
" <td>5.00, 0.069, (8)</td>\n",
" <td>2.00, 0.025, (8)</td>\n",
" <td>0.00, 0.034, (8)</td>\n",
" <td>6.00, 0.093, (8)</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Wilcoxon Baseline I 30 Hz</th>\n",
" <td>nan, nan, (0)</td>\n",
" <td>nan, nan, (0)</td>\n",
" <td>nan, nan, (0)</td>\n",
" <td>nan, nan, (0)</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Wilcoxon Baseline I Baseline II</th>\n",
" <td>264.00, 1.000, (32)</td>\n",
" <td>256.00, 0.881, (32)</td>\n",
" <td>0.00, 0.000, (32)</td>\n",
" <td>203.00, 0.544, (30)</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Wilcoxon Baseline II 30 Hz</th>\n",
" <td>nan, nan, (0)</td>\n",
" <td>nan, nan, (0)</td>\n",
" <td>nan, nan, (0)</td>\n",
" <td>nan, nan, (0)</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" Theta energy \\\n",
"11 Hz 1.8e-03 ± 2.8e-04 (8) \n",
"30 Hz nan ± nan (0) \n",
"Baseline I 2.3e-03 ± 2.1e-04 (50) \n",
"Baseline II 2.3e-03 ± 2.4e-04 (32) \n",
"Normality 11 Hz 8.13, 0.017 \n",
"Normality 30 Hz nan, nan \n",
"Normality Baseline I 41.72, 0.000 \n",
"Normality Baseline II 13.17, 0.001 \n",
"Wilcoxon 11 Hz 30 Hz nan, nan, (0) \n",
"Wilcoxon 11 Hz Baseline II nan, nan, (0) \n",
"Wilcoxon Baseline I 11 Hz 5.00, 0.069, (8) \n",
"Wilcoxon Baseline I 30 Hz nan, nan, (0) \n",
"Wilcoxon Baseline I Baseline II 264.00, 1.000, (32) \n",
"Wilcoxon Baseline II 30 Hz nan, nan, (0) \n",
"\n",
" Theta peak \\\n",
"11 Hz 1.4e-03 ± 2.6e-04 (8) \n",
"30 Hz nan ± nan (0) \n",
"Baseline I 1.8e-03 ± 1.8e-04 (50) \n",
"Baseline II 1.8e-03 ± 2.3e-04 (32) \n",
"Normality 11 Hz 6.61, 0.037 \n",
"Normality 30 Hz nan, nan \n",
"Normality Baseline I 31.09, 0.000 \n",
"Normality Baseline II 20.78, 0.000 \n",
"Wilcoxon 11 Hz 30 Hz nan, nan, (0) \n",
"Wilcoxon 11 Hz Baseline II nan, nan, (0) \n",
"Wilcoxon Baseline I 11 Hz 2.00, 0.025, (8) \n",
"Wilcoxon Baseline I 30 Hz nan, nan, (0) \n",
"Wilcoxon Baseline I Baseline II 256.00, 0.881, (32) \n",
"Wilcoxon Baseline II 30 Hz nan, nan, (0) \n",
"\n",
" Theta freq \\\n",
"11 Hz 8.1e+00 ± 5.3e-02 (8) \n",
"30 Hz nan ± nan (0) \n",
"Baseline I 7.8e+00 ± 5.9e-02 (50) \n",
"Baseline II 8.1e+00 ± 4.7e-02 (32) \n",
"Normality 11 Hz 6.30, 0.043 \n",
"Normality 30 Hz nan, nan \n",
"Normality Baseline I 29.47, 0.000 \n",
"Normality Baseline II 0.96, 0.618 \n",
"Wilcoxon 11 Hz 30 Hz nan, nan, (0) \n",
"Wilcoxon 11 Hz Baseline II nan, nan, (0) \n",
"Wilcoxon Baseline I 11 Hz 0.00, 0.034, (8) \n",
"Wilcoxon Baseline I 30 Hz nan, nan, (0) \n",
"Wilcoxon Baseline I Baseline II 0.00, 0.000, (32) \n",
"Wilcoxon Baseline II 30 Hz nan, nan, (0) \n",
"\n",
" Theta half width \\\n",
"11 Hz 8.9e-01 ± 7.4e-02 (8) \n",
"30 Hz nan ± nan (0) \n",
"Baseline I 1.1e+00 ± 1.8e-01 (49) \n",
"Baseline II 9.1e-01 ± 3.9e-02 (31) \n",
"Normality 11 Hz 0.23, 0.890 \n",
"Normality 30 Hz nan, nan \n",
"Normality Baseline I 81.74, 0.000 \n",
"Normality Baseline II 13.33, 0.001 \n",
"Wilcoxon 11 Hz 30 Hz nan, nan, (0) \n",
"Wilcoxon 11 Hz Baseline II nan, nan, (0) \n",
"Wilcoxon Baseline I 11 Hz 6.00, 0.093, (8) \n",
"Wilcoxon Baseline I 30 Hz nan, nan, (0) \n",
"Wilcoxon Baseline I Baseline II 203.00, 0.544, (30) \n",
"Wilcoxon Baseline II 30 Hz nan, nan, (0) \n",
"\n",
" Stim energy Stim half width \\\n",
"11 Hz 8.4e-04 ± 3.6e-04 (8) 2.2e+00 ± 1.4e+00 (8) \n",
"30 Hz nan ± nan (0) nan ± nan (0) \n",
"Baseline I NaN NaN \n",
"Baseline II NaN NaN \n",
"Normality 11 Hz 3.45, 0.178 7.42, 0.024 \n",
"Normality 30 Hz nan, nan nan, nan \n",
"Normality Baseline I NaN NaN \n",
"Normality Baseline II NaN NaN \n",
"Wilcoxon 11 Hz 30 Hz nan, nan, (0) nan, nan, (0) \n",
"Wilcoxon 11 Hz Baseline II NaN NaN \n",
"Wilcoxon Baseline I 11 Hz NaN NaN \n",
"Wilcoxon Baseline I 30 Hz NaN NaN \n",
"Wilcoxon Baseline I Baseline II NaN NaN \n",
"Wilcoxon Baseline II 30 Hz NaN NaN \n",
"\n",
" Stim p max Stim strength \n",
"11 Hz 1.9e-03 ± 7.0e-04 (8) 1.2e+00 ± 5.6e-01 (8) \n",
"30 Hz nan ± nan (0) nan ± nan (0) \n",
"Baseline I NaN NaN \n",
"Baseline II NaN NaN \n",
"Normality 11 Hz 1.81, 0.405 6.43, 0.040 \n",
"Normality 30 Hz nan, nan nan, nan \n",
"Normality Baseline I NaN NaN \n",
"Normality Baseline II NaN NaN \n",
"Wilcoxon 11 Hz 30 Hz nan, nan, (0) nan, nan, (0) \n",
"Wilcoxon 11 Hz Baseline II NaN NaN \n",
"Wilcoxon Baseline I 11 Hz NaN NaN \n",
"Wilcoxon Baseline I 30 Hz NaN NaN \n",
"Wilcoxon Baseline I Baseline II NaN NaN \n",
"Wilcoxon Baseline II 30 Hz NaN NaN "
]
},
"execution_count": 28,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"\n",
"\n",
"stat = pd.DataFrame()\n",
"\n",
"for key, df in results.items():\n",
" Key = rename(key)\n",
" stat[Key] = df.agg(summarize)\n",
" stat[Key] = df.agg(summarize)\n",
"\n",
" for i, c1 in enumerate(df.columns):\n",
" stat.loc[f'Normality {c1}', Key] = normality(df, c1)\n",
"# stat.loc[f'Shapiro {c1}', Key] = shapiro(df, c1)\n",
" for c2 in df.columns[i+1:]:\n",
"# stat.loc[f'MWU {c1} {c2}', Key] = MWU(df, [c1, c2])\n",
"# stat.loc[f'PRS {c1} {c2}', Key] = PRS(df, [c1, c2])\n",
" stat.loc[f'Wilcoxon {c1} {c2}', Key] = wilcoxon(df, [c1, c2])\n",
"# stat.loc[f'Paired T {c1} {c2}', Key] = paired_t(df, [c1, c2])\n",
"\n",
"stat.sort_index()"
]
},
{
"cell_type": "code",
"execution_count": 29,
"metadata": {},
"outputs": [],
"source": [
"stat.to_latex(output_path / \"statistics\" / \"statistics.tex\")\n",
"stat.to_csv(output_path / \"statistics\" / \"statistics.csv\")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Plot PSD"
]
},
{
"cell_type": "code",
"execution_count": 30,
"metadata": {},
"outputs": [],
"source": [
"psd = pd.read_feather(pathlib.Path(\"output\") / (\"stimulus-lfp-response\" + zscore_str) / 'data' / 'psd.feather')\n",
"freqs = pd.read_feather(pathlib.Path(\"output\") / (\"stimulus-lfp-response\" + zscore_str) / 'data' / 'freqs.feather')"
]
},
{
"cell_type": "code",
"execution_count": 31,
"metadata": {},
"outputs": [],
"source": [
"from septum_mec.analysis.plotting import plot_bootstrap_timeseries"
]
},
{
"cell_type": "code",
"execution_count": 32,
"metadata": {},
"outputs": [],
"source": [
"freq = freqs.T.iloc[0].values\n",
"\n",
"mask = (freq < 49)"
]
},
{
"cell_type": "code",
"execution_count": 33,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"/home/mikkel/.virtualenvs/expipe/lib/python3.6/site-packages/numpy/core/fromnumeric.py:3257: RuntimeWarning: Mean of empty slice.\n",
" out=out, **kwargs)\n",
"/home/mikkel/.virtualenvs/expipe/lib/python3.6/site-packages/numpy/core/_methods.py:161: RuntimeWarning: invalid value encountered in double_scalars\n",
" ret = ret.dtype.type(ret / rcount)\n",
"/home/mikkel/.virtualenvs/expipe/lib/python3.6/site-packages/numpy/core/_methods.py:154: RuntimeWarning: invalid value encountered in true_divide\n",
" ret, rcount, out=ret, casting='unsafe', subok=False)\n"
]
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAArsAAAFFCAYAAADsEyV2AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAXEQAAFxEByibzPwAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjIsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8li6FKAAAgAElEQVR4nOzdeZxcVZnw8d+9tVf13umkk85KQm4IkSiIrCIhIhJGRARHUXwFAVl0hE9cMggOg4KADC6oIMwg66iAYQkOOspmAk4iSgghySVbd9Kd7vRee939/eNWV6rS3UnvS+V8+YTurrrLqerqU0+d+5znSI7jIAiCIAiCIAjFSB7vBgiCIAiCIAjCaBHBriAIgiAIglC0RLArCIIgCIIgFC0R7AqCIAiCIAhFSwS7giAIgiAIQtESwa4gCIIgCIJQtESwKwiCIAiCIBQtEewKgiAIgiAIRUsEu4IgCIIgCELREsGuIAiCIAiCULREsCsIgiAIgiAULRHsCoIgCIIgCEVLBLuCIAiCIAhC0RLB7gSlKMrziqI8P97tEARBGAuizxMEYbR4x7sBQr/mL1iwYDHgjHdDBEGYsKTxbsAIEn2eIAiHM6Q+T4zsCoIgCIIgCEVLBLuCIAiCIAhC0RLBriAIgiAIglC0RLArCIIgCIIgFC0R7AqCIAiCIAhFSwS7giAIgiAIQtESwa4gCIIgCIJQtESwKwiCIAiCIBQtEewKE56V6CC56Q/Y6fh4N0UQBEEQhElGrKAmTHjR1/4LW09hdu+j/IzLx7s5giA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/Xq1cN+Pi655BK++MUv5kZgAoEAN954I5IkYZommzZtym371FNP0dDQMGZtE44syYSOoVs4QCZtYNsiDWugJnK/BmPfd4h+bWQcsSO7iqJ8GfgyYAJfUlX1ieztZcADwD8DqxVFmaeqaipvPwV4DPeDwteAn6uq6iiKMg03cP4w8N/Zr0e89mQU09AwTZ2Ux0ulZeDoKQiEe20rSRKrV1zdK42hY83t6M3b8E9fRPUnbhyrpg/baKcxHFyP0rZtkskkDQ0N6LrOww8/TDqd5sYbbyy4BPfrX/8awzD6bVsoFALcy4I9Zs6cidfrJRqNsmrVKi677DIWLVqUu/+6664rPIjs4S9b3QsjK1asKDh/j2AwyDnnnMNDDz3EK6+8wiWXXDL4JyHPsmXLet1WWVlJVVUVHR0dxGKx3O1//vOfh9w2x9QBCcnr67WfIABomolp2gQCXkzT5rzzj2HOnOIoLTXaaQwTul9jeH3HUIxVv1bsjthgF/hm9usPewJdAFVVY4qiXAZ8DJgKfAp4Im+/fwX8wG9UVf1Z3n77FUW5ANgFnK4oykdVVf3zaD+Iia4j3o4v1Y0vHSUdiLglyLQkntIpfW4vSRJhX+FkgJQk4XEs/H3cdyTrrx6lrus888wzfO973+Pxxx/HsixuueWWgm18Ph/RaJSNGzdSX1/P3r17qa+vZ+vWrbS3twPum0yP6upqrrjiCu6//36effZZnn32WWpqajj55JM5/fTTOeOMMwpK50iyl92tccAdbXjppZf6fAw959q1a9ewngugYBQjX8+lOss6kDPZM7oz2LY5jkPXH36EY2pUnf8dJLn3G4pwZLNtB12zME2bsvIApmGTyZj4A0fy2+3ATeR+DYbedwzVWPRrR4Ij8q9PURQ/8DywhMJAFgBVVdOKomwHPgTMydsviDviC/BffezXqSjKU8AVwOeAIzrYNW2LRDrGSY1vUZ7uJubxYegZ7Ex80McSywUPnN/v55//+Z9pa2vj3nvv5cknn+QrX/kK06dPB9yZurfddhtr1qzBMA6Movt8Po499li
"text/plain": [
"<Figure size 750x300 with 2 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"\n",
"fig, axs = plt.subplots(1, 2, sharex=True, sharey=True, figsize=(5,2))\n",
"axs = axs.repeat(2)\n",
"for i, (ax, query) in enumerate(zip(axs.ravel(), queries)):\n",
" selection = [\n",
" f'{r.action}_{r.channel_group}' \n",
" for i, r in lfp_results_hemisphere.query(query).iterrows()]\n",
" values = psd.loc[mask, selection].to_numpy()\n",
" values = 10 * np.log10(values)\n",
" plot_bootstrap_timeseries(freq[mask], values, ax=ax, lw=1, label=labels[i], color=colors[i])\n",
"# ax.set_title(titles[i])\n",
" ax.set_xlabel('Frequency Hz')\n",
" ax.legend(frameon=False)\n",
"axs[0].set_ylabel('PSD (dB/Hz)')\n",
"# axs[0].set_ylim(-31, 1)\n",
"despine()\n",
"\n",
"figname = 'lfp-psd'\n",
"fig.savefig(\n",
" output_path / 'figures' / f'{figname}.png', \n",
" bbox_inches='tight', transparent=True)\n",
"fig.savefig(\n",
" output_path / 'figures' / f'{figname}.svg', \n",
" bbox_inches='tight', transparent=True)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Store results in Expipe action"
]
},
{
"cell_type": "code",
"execution_count": 34,
"metadata": {},
"outputs": [],
"source": [
"action = project.require_action(\"stimulus-lfp-response-mec\" + zscore_str)"
]
},
{
"cell_type": "code",
"execution_count": 35,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"['/media/storage/expipe/septum-mec/actions/stimulus-lfp-response-mec-no-zscore/data/statistics/statistics.tex',\n",
" '/media/storage/expipe/septum-mec/actions/stimulus-lfp-response-mec-no-zscore/data/statistics/statistics.csv',\n",
" '/media/storage/expipe/septum-mec/actions/stimulus-lfp-response-mec-no-zscore/data/figures/lfp-psd-histogram-stim_energy.png',\n",
" '/media/storage/expipe/septum-mec/actions/stimulus-lfp-response-mec-no-zscore/data/figures/lfp-psd-histogram-stim_strength.png',\n",
" '/media/storage/expipe/septum-mec/actions/stimulus-lfp-response-mec-no-zscore/data/figures/lfp-psd.png',\n",
" '/media/storage/expipe/septum-mec/actions/stimulus-lfp-response-mec-no-zscore/data/figures/lfp-psd-histogram-theta_peak.svg',\n",
" '/media/storage/expipe/septum-mec/actions/stimulus-lfp-response-mec-no-zscore/data/figures/lfp-psd-histogram-stim_p_max.png',\n",
" '/media/storage/expipe/septum-mec/actions/stimulus-lfp-response-mec-no-zscore/data/figures/lfp-psd-histogram-theta_freq.png',\n",
" '/media/storage/expipe/septum-mec/actions/stimulus-lfp-response-mec-no-zscore/data/figures/lfp-psd-histogram-theta_energy.svg',\n",
" '/media/storage/expipe/septum-mec/actions/stimulus-lfp-response-mec-no-zscore/data/figures/lfp-psd-histogram-theta_freq.svg',\n",
" '/media/storage/expipe/septum-mec/actions/stimulus-lfp-response-mec-no-zscore/data/figures/lfp-psd-histogram-stim_half_width.png',\n",
" '/media/storage/expipe/septum-mec/actions/stimulus-lfp-response-mec-no-zscore/data/figures/lfp-psd-histogram-stim_half_width.svg',\n",
" '/media/storage/expipe/septum-mec/actions/stimulus-lfp-response-mec-no-zscore/data/figures/lfp-psd-histogram-theta_half_width.svg',\n",
" '/media/storage/expipe/septum-mec/actions/stimulus-lfp-response-mec-no-zscore/data/figures/lfp-psd-histogram-theta_energy.png',\n",
" '/media/storage/expipe/septum-mec/actions/stimulus-lfp-response-mec-no-zscore/data/figures/lfp-psd-histogram-theta_peak.png',\n",
" '/media/storage/expipe/septum-mec/actions/stimulus-lfp-response-mec-no-zscore/data/figures/lfp-psd-histogram-stim_p_max.svg',\n",
" '/media/storage/expipe/septum-mec/actions/stimulus-lfp-response-mec-no-zscore/data/figures/lfp-psd-histogram-theta_half_width.png',\n",
" '/media/storage/expipe/septum-mec/actions/stimulus-lfp-response-mec-no-zscore/data/figures/lfp-psd.svg',\n",
" '/media/storage/expipe/septum-mec/actions/stimulus-lfp-response-mec-no-zscore/data/figures/.ipynb_checkpoints/lfp-psd-histogram-theta_energy-checkpoint.png',\n",
" '/media/storage/expipe/septum-mec/actions/stimulus-lfp-response-mec-no-zscore/data/figures/lfp-psd-histogram-stim_energy.svg',\n",
" '/media/storage/expipe/septum-mec/actions/stimulus-lfp-response-mec-no-zscore/data/figures/lfp-psd-histogram-stim_strength.svg']"
]
},
"execution_count": 35,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"copy_tree(output_path, str(action.data_path()))"
]
},
{
"cell_type": "code",
"execution_count": 48,
"metadata": {},
"outputs": [],
"source": [
"septum_mec.analysis.registration.store_notebook(action, \"20_stimulus-lfp-response-mec.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
}