{ "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": [ "08:31:25 [I] klustakwik KlustaKwik2 version 0.2.6\n" ] } ], "source": [ "import os\n", "import expipe\n", "import pathlib\n", "import numpy as np\n", "import spatial_maps.stats as stats\n", "import septum_mec\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", "from distutils.dir_util import copy_tree\n", "from neo import SpikeTrain\n", "import scipy\n", "\n", "from tqdm.notebook import tqdm_notebook as tqdm\n", "tqdm.pandas()\n", "\n", "from spike_statistics.core import permutation_resampling\n", "\n", "from spikewaveform.core import calculate_waveform_features_from_template, cluster_waveform_features\n", "\n", "from septum_mec.analysis.plotting import violinplot" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [], "source": [ "%matplotlib inline\n", "color_control = '#4393c3'\n", "color_stimulated = '#d6604d'\n", "\n", "color_bs = '#5aae61'\n", "color_ns = '#9970ab'\n", "\n", "figsize_violin = (1.7, 3)\n", "figsize_gen = (4, 3)\n", "\n", "output_path = pathlib.Path(\"output\") / \"waveform-analysis\"\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": 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": [ { "name": "stdout", "output_type": "stream", "text": [ "N cells: 1284\n" ] } ], "source": [ "identify_neurons = actions['identify-neurons']\n", "sessions = pd.read_csv(identify_neurons.data_path('sessions'))\n", "units = pd.read_csv(identify_neurons.data_path('units'))\n", "session_units = pd.merge(sessions, units, on='action')\n", "#########################3\n", "# session_units = session_units.drop_duplicates('unit_id')\n", "#################################\n", "print('N cells:',session_units.shape[0])" ] }, { "cell_type": "code", "execution_count": 6, "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", "date | \n", "entity_date | \n", "Hz11 | \n", "Hz30 | \n", "channel_group | \n", "max_depth_delta | \n", "max_dissimilarity | \n", "unit_id | \n", "unit_idnum | \n", "unit_name | \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", "60319 | \n", "1849-060319 | \n", "False | \n", "True | \n", "1 | \n", "100 | \n", "0.05 | \n", "f129d848-ebee-4555-965f-420e402eb820 | \n", "703 | \n", "104 | \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", "60319 | \n", "1849-060319 | \n", "False | \n", "True | \n", "1 | \n", "100 | \n", "0.05 | \n", "b50f3878-32aa-40e9-8753-9f401ef32a23 | \n", "704 | \n", "108 | \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", "60319 | \n", "1849-060319 | \n", "False | \n", "True | \n", "1 | \n", "100 | \n", "0.05 | \n", "b1626e1a-0469-4ee0-a812-88ee18accd39 | \n", "705 | \n", "85 | \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", "60319 | \n", "1849-060319 | \n", "False | \n", "True | \n", "1 | \n", "100 | \n", "0.05 | \n", "feb62d54-f173-4a3c-939c-8c1465e71b0f | \n", "706 | \n", "94 | \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", "60319 | \n", "1849-060319 | \n", "False | \n", "True | \n", "1 | \n", "100 | \n", "0.05 | \n", "3498a09b-b943-4917-866a-8910dbcfd0cd | \n", "707 | \n", "98 | \n", "