{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "%load_ext autoreload\n", "%autoreload 2" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "14:38:14 [I] klustakwik KlustaKwik2 version 0.2.6\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", "/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", "from matplotlib import colors\n", "import seaborn as sns\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, despine\n", "from spatial_maps.fields import find_peaks, calculate_field_centers, separate_fields_by_laplace\n", "from spike_statistics.core import permutation_resampling\n", "\n", "import speed_cells.speed as spd\n", "from septum_mec.analysis.plotting import plot_bootstrap_timeseries\n", "\n", "from tqdm.notebook import tqdm_notebook as tqdm\n", "tqdm.pandas()" ] }, { "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\") / \"longitudinal-comparisons-speed\"\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": [ "
\n", " | action | \n", "baseline | \n", "entity | \n", "frequency | \n", "i | \n", "ii | \n", "session | \n", "stim_location | \n", "stimulated | \n", "tag | \n", "... | \n", "burst_event_ratio | \n", "bursty_spike_ratio | \n", "gridness | \n", "border_score | \n", "information_rate | \n", "information_specificity | \n", "head_mean_ang | \n", "head_mean_vec_len | \n", "spacing | \n", "orientation | \n", "
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | \n", "1849-060319-3 | \n", "True | \n", "1849 | \n", "NaN | \n", "False | \n", "True | \n", "3 | \n", "NaN | \n", "False | \n", "baseline ii | \n", "... | \n", "0.398230 | \n", "0.678064 | \n", "-0.466923 | \n", "0.029328 | \n", "1.009215 | \n", "0.317256 | \n", "5.438033 | \n", "0.040874 | \n", "0.628784 | \n", "20.224859 | \n", "
1 | \n", "1849-060319-3 | \n", "True | \n", "1849 | \n", "NaN | \n", "False | \n", "True | \n", "3 | \n", "NaN | \n", "False | \n", "baseline ii | \n", "... | \n", "0.138014 | \n", "0.263173 | \n", "-0.666792 | \n", "0.308146 | \n", "0.192524 | \n", "0.033447 | \n", "1.951740 | \n", "0.017289 | \n", "0.789388 | \n", "27.897271 | \n", "
2 | \n", "1849-060319-3 | \n", "True | \n", "1849 | \n", "NaN | \n", "False | \n", "True | \n", "3 | \n", "NaN | \n", "False | \n", "baseline ii | \n", "... | \n", "0.373986 | \n", "0.659259 | \n", "-0.572566 | \n", "0.143252 | \n", "4.745836 | \n", "0.393704 | \n", "4.439721 | \n", "0.124731 | \n", "0.555402 | \n", "28.810794 | \n", "
3 | \n", "1849-060319-3 | \n", "True | \n", "1849 | \n", "NaN | \n", "False | \n", "True | \n", "3 | \n", "NaN | \n", "False | \n", "baseline ii | \n", "... | \n", "0.087413 | \n", "0.179245 | \n", "-0.437492 | \n", "0.268948 | \n", "0.157394 | \n", "0.073553 | \n", "6.215195 | \n", "0.101911 | \n", "0.492250 | \n", "9.462322 | \n", "
4 | \n", "1849-060319-3 | \n", "True | \n", "1849 | \n", "NaN | \n", "False | \n", "True | \n", "3 | \n", "NaN | \n", "False | \n", "baseline ii | \n", "... | \n", "0.248771 | \n", "0.463596 | \n", "-0.085938 | \n", "0.218744 | \n", "0.519153 | \n", "0.032683 | \n", "1.531481 | \n", "0.053810 | \n", "0.559905 | \n", "0.000000 | \n", "
5 rows × 39 columns
\n", "\n", " | border_score | \n", "gridness | \n", "head_mean_ang | \n", "head_mean_vec_len | \n", "information_rate | \n", "speed_score | \n", "action | \n", "channel_group | \n", "unit_name | \n", "
---|---|---|---|---|---|---|---|---|---|
0 | \n", "0.348023 | \n", "0.275109 | \n", "3.012689 | \n", "0.086792 | \n", "0.707197 | \n", "0.149071 | \n", "1833-010719-1 | \n", "0.0 | \n", "127.0 | \n", "
1 | \n", "0.362380 | \n", "0.166475 | \n", "3.133138 | \n", "0.037271 | \n", "0.482486 | \n", "0.132212 | \n", "1833-010719-1 | \n", "0.0 | \n", "161.0 | \n", "
2 | \n", "0.367498 | \n", "0.266865 | \n", "5.586395 | \n", "0.182843 | \n", "0.271188 | \n", "0.062821 | \n", "1833-010719-1 | \n", "0.0 | \n", "191.0 | \n", "
3 | \n", "0.331942 | \n", "0.312155 | \n", "5.955767 | \n", "0.090786 | \n", "0.354018 | \n", "0.052009 | \n", "1833-010719-1 | \n", "0.0 | \n", "223.0 | \n", "
4 | \n", "0.325842 | \n", "0.180495 | \n", "5.262721 | \n", "0.103584 | \n", "0.210427 | \n", "0.094041 | \n", "1833-010719-1 | \n", "0.0 | \n", "225.0 | \n", "
\n", " | action | \n", "baseline | \n", "entity | \n", "frequency | \n", "i | \n", "ii | \n", "session | \n", "stim_location | \n", "stimulated | \n", "tag | \n", "... | \n", "p_e_peak | \n", "t_i_peak | \n", "p_i_peak | \n", "border_score_threshold | \n", "gridness_threshold | \n", "head_mean_ang_threshold | \n", "head_mean_vec_len_threshold | \n", "information_rate_threshold | \n", "speed_score_threshold | \n", "specificity | \n", "
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | \n", "1849-060319-3 | \n", "True | \n", "1849 | \n", "NaN | \n", "False | \n", "True | \n", "3 | \n", "NaN | \n", "False | \n", "baseline ii | \n", "... | \n", "NaN | \n", "NaN | \n", "NaN | \n", "0.332548 | \n", "0.229073 | \n", "6.029431 | \n", "0.205362 | \n", "1.115825 | \n", "0.066736 | \n", "0.451741 | \n", "
1 | \n", "1849-060319-3 | \n", "True | \n", "1849 | \n", "NaN | \n", "False | \n", "True | \n", "3 | \n", "NaN | \n", "False | \n", "baseline ii | \n", "... | \n", "NaN | \n", "NaN | \n", "NaN | \n", "0.354830 | \n", "0.089333 | \n", "6.120055 | \n", "0.073566 | \n", "0.223237 | \n", "0.052594 | \n", "0.098517 | \n", "
2 | \n", "1849-060319-3 | \n", "True | \n", "1849 | \n", "NaN | \n", "False | \n", "True | \n", "3 | \n", "NaN | \n", "False | \n", "baseline ii | \n", "... | \n", "NaN | \n", "NaN | \n", "NaN | \n", "0.264610 | \n", "-0.121081 | \n", "5.759406 | \n", "0.150827 | \n", "4.964984 | \n", "0.027120 | \n", "0.400770 | \n", "
3 | \n", "1849-060319-3 | \n", "True | \n", "1849 | \n", "NaN | \n", "False | \n", "True | \n", "3 | \n", "NaN | \n", "False | \n", "baseline ii | \n", "... | \n", "NaN | \n", "NaN | \n", "NaN | \n", "0.344280 | \n", "0.215829 | \n", "6.033364 | \n", "0.110495 | \n", "0.239996 | \n", "0.054074 | \n", "0.269461 | \n", "
4 | \n", "1849-060319-3 | \n", "True | \n", "1849 | \n", "NaN | \n", "False | \n", "True | \n", "3 | \n", "NaN | \n", "False | \n", "baseline ii | \n", "... | \n", "NaN | \n", "NaN | \n", "NaN | \n", "0.342799 | \n", "0.218967 | \n", "5.768170 | \n", "0.054762 | \n", "0.524990 | \n", "0.144702 | \n", "0.133410 | \n", "
5 rows × 51 columns
\n", "