{ "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:00:33 [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 import tqdm_notebook as tqdm\n", "from tqdm._tqdm_notebook import tqdm_notebook\n", "tqdm_notebook.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": null, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "N cells: 1298\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('all_non_identified_units'))\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": null, "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", "channel_group | \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", "1 | \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", "1 | \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", "1 | \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", "1 | \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", "1 | \n", "98 | \n", "