Topology in neuroscience
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2599 lines
1.6 MiB

{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Experiment: Flashed gratings"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Initialization"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### Imports"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"%matplotlib inline\n",
"import numpy as np\n",
"import matplotlib.pyplot as plt\n",
"import pandas as pd\n",
"import scipy\n",
"import scipy.stats as sts\n",
"import pickle as pkl\n",
"import ipywidgets as widgets\n",
"from mpl_toolkits import mplot3d\n",
"from mpl_toolkits.mplot3d import Axes3D\n",
"from scipy import sparse\n",
"import sys\n",
"from matplotlib import cm\n",
"sys.path.insert(0, '../model/')\n",
"\n",
"# color maps\n",
"cmap_hot = cm.get_cmap('hot')\n",
"cmap_viridis = cm.get_cmap('viridis')\n",
"cmap_jet = cm.get_cmap('jet')"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"\n",
"data_folder = \"../data/\"\n",
"stim_file = \"Stiminfo_PVCre_2021_0012_s06_e14.csv\"\n",
"spike_times_file = \"Spiketimes_PVCre_2021_0012_s06_e14.npy\"\n",
"\n",
"key_symbol = {'pair':'$(\\\\theta,\\phi)$', 'orientation':'$\\\\theta$', 'phase':'$\\phi$'}"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"dict_keys(['data_folder', 'stim_file', 'spike_times_file', 'key_symbol', 'stim', 'num_trial', 'stim_val', 'trial_stim_id', 'key_list', 'stim_id_trial', 'num_stim', 'key', 'pair_id', 'trial_pair_id', 'pair_val', 'pair_trial_id', 'spike_times', 'num_unit', 'num_spike', 'spike_count_rate', 'avg_firing_rate', 'firing_rate', 'stim_num_trial', 'stim_hist', 'optimal_avg_firing_rate', 'latest_spike_time', 'dt', 'exp_time', 'B_stim', 'trials', 't_on', 't_off', 'B_spike', 'trial_range', 'units', 'orientation', 'phase', 'trial_spike_times', 'delta_t_on', 'delta_t_off', 'subseq_trials', 'subseq_spike_times', 'subseq_spike_times_locked', 'time_range', 'unit_id_2', 'p1', 'p2', 'delta_t', 'time_range_smoothing', 'period_1_dist', 'period_2_dist', 'period_3_dist', 'num_units', 'max_p_1', 'max_p_2', 'max_p_3', 'delta_2', 'delta_3', 't_p1', 't_p2', 'subseq_spike_times_locked_2', 'B_spike_fixed', 'B_stim_original', 'B_spike_smooth', 'B_stim_total', 'R', 'R_pair_smoothed', 'Rp', 'firing_rates_noise_red', 'firing_rates_flat', 'firing_rates_in_trials', 'avg_firing_rates', 'avg_fr_blur', 'avg_firing_rates_pca', 'param_corr', 'avg_firing_rates_pca_', 'embed'])\n"
]
}
],
"source": [
"file = open(\"dump.pkl\", 'rb')\n",
"pair_id = None\n",
"data = pkl.load(file)\n",
"print(data.keys())\n",
"for key, value in data.items():\n",
" globals()[key] = value\n",
"file.close()"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [],
"source": [
"import pickle\n",
"with open('dump.pkl', 'wb') as f:\n",
" pickle.dump({k: globals()[k] for k in [\n",
" 'data_folder', 'stim_file', 'spike_times_file', 'key_symbol', \n",
" 'stim', 'num_trial', 'stim_val', 'trial_stim_id', 'key_list', 'stim_id_trial', 'num_stim', 'key', 'pair_id', 'trial_pair_id', 'pair_val', 'pair_trial_id',\n",
" 'spike_times', 'num_unit', 'num_spike', 'spike_count_rate', 'avg_firing_rate', 'firing_rate', 'stim_num_trial', 'stim_hist', 'optimal_avg_firing_rate',\n",
" 'latest_spike_time', 'dt', 'exp_time', 'B_stim', 'trials', 't_on', 't_off', 'B_spike', 'trial_range', 'units', 'orientation', 'phase', 'trial_spike_times',\n",
" 'delta_t_on', 'delta_t_off', 'subseq_trials', 'subseq_spike_times', 'subseq_spike_times_locked', 'time_range', 'unit_id_2', 'p1', 'p2', 'delta_t', 'time_range_smoothing',\n",
" 'period_1_dist', 'period_2_dist', 'period_3_dist', 'num_units', 'max_p_1', 'max_p_2', 'max_p_3', 'delta_2', 'delta_3', 't_p1', 't_p2', 'subseq_spike_times_locked_2',\n",
" 'B_spike_fixed', 'B_stim_original', 'B_spike_smooth', 'B_stim_total', 'R', 'R_pair_smoothed', 'Rp', 'firing_rates_noise_red', 'firing_rates_flat', 'firing_rates_in_trials', 'avg_firing_rates',\n",
" 'avg_fr_blur', 'avg_firing_rates', 'avg_firing_rates_pca', 'param_corr', 'avg_firing_rates_pca_', 'embed'\n",
" ]}, f)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### Load the stimulus data\n",
"**Stimulus data layout:**\n",
"```\n",
"stim_val = {'pair': [(or1, ph1), (or2, ph2), ...], 'orientation': [...], 'phase': [...]}\n",
"stim_id_trial = {'pair': [id1, id2, ...], 'phase': [..], ...} # corresponding trials\n",
"pair_trial_id[orientation_id][phase_id] = [Trial ids]\n",
"```"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [],
"source": [
"# Stimulus DataFrame\n",
"stim = pd.read_csv(data_folder + stim_file)\n",
"num_trial = len(stim)\n",
"stim_val = {}\n",
"trial_stim_id = {}\n",
"# 50 trials per orientation-phase pair\n",
"stim_val['pair'], trial_stim_id['pair'] = np.unique(stim[['grat_orientation', 'grat_phase']], return_inverse=True, axis=0) \n",
"# 1000 trials per orientation\n",
"stim_val['orientation'], trial_stim_id['orientation'] = np.unique(stim['grat_orientation'], return_inverse=True) \n",
"# 1000 trials per phase\n",
"stim_val['phase'], trial_stim_id['phase'] = np.unique(stim['grat_phase'], return_inverse=True) \n",
"key_list = ['pair', 'orientation', 'phase']\n",
"stim_id_trial = {}\n",
"num_stim = {}\n",
"for key in key_list:\n",
" stim_id_trial[key] = [np.where(trial_stim_id[key] == i)[0] for i in range(len(stim_val[key]))]\n",
" num_stim[key] = len(stim_val[key])\n",
"\n",
"def pair_id(i):\n",
" return (int(i//num_stim['orientation']), i%num_stim['orientation'])\n",
"\n",
"trial_pair_id = np.array([pair_id(i) for i in trial_stim_id['pair']], dtype=object)\n",
"pair_val = stim_val['pair'].reshape(num_stim['orientation'], num_stim['phase'],2)\n",
"\n",
"# for each (orientation_id = i, phase_id = j) find the trial indices\n",
"pair_trial_id = np.ndarray((num_stim['orientation'], num_stim['phase']), dtype=object)\n",
"for i in range(num_stim['pair']):\n",
" pair_trial_id[pair_id(i)] = stim_id_trial['pair'][i]"
]
},
{
"cell_type": "code",
"execution_count": 5,
"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>Unnamed: 0</th>\n",
" <th>grat_orientation</th>\n",
" <th>grat_phase</th>\n",
" <th>stimvals</th>\n",
" <th>stim_ontime</th>\n",
" <th>stim_offtime</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>0</td>\n",
" <td>45.0</td>\n",
" <td>36.0</td>\n",
" <td>102</td>\n",
" <td>2.5005</td>\n",
" <td>2.5839</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>1</td>\n",
" <td>0.0</td>\n",
" <td>18.0</td>\n",
" <td>1</td>\n",
" <td>2.6195</td>\n",
" <td>2.7028</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>2</td>\n",
" <td>162.0</td>\n",
" <td>288.0</td>\n",
" <td>376</td>\n",
" <td>2.7030</td>\n",
" <td>2.7863</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>3</td>\n",
" <td>0.0</td>\n",
" <td>54.0</td>\n",
" <td>3</td>\n",
" <td>2.7865</td>\n",
" <td>2.8699</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>4</td>\n",
" <td>108.0</td>\n",
" <td>36.0</td>\n",
" <td>242</td>\n",
" <td>2.8700</td>\n",
" <td>2.9534</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" Unnamed: 0 grat_orientation grat_phase stimvals stim_ontime \\\n",
"0 0 45.0 36.0 102 2.5005 \n",
"1 1 0.0 18.0 1 2.6195 \n",
"2 2 162.0 288.0 376 2.7030 \n",
"3 3 0.0 54.0 3 2.7865 \n",
"4 4 108.0 36.0 242 2.8700 \n",
"\n",
" stim_offtime \n",
"0 2.5839 \n",
"1 2.7028 \n",
"2 2.7863 \n",
"3 2.8699 \n",
"4 2.9534 "
]
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"stim.head()"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"pair, orientation, phase\n",
"(400, 2)\n",
"(20,) (20,)\n"
]
}
],
"source": [
"print(', '.join(stim_val.keys()))\n",
"print(stim_val['pair'].shape)\n",
"print(stim_val['orientation'].shape, stim_val['phase'].shape)"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[ 82 482 1021 1421 1821 2183 2645 3045 3445 3643 4357 4757\n",
" 5014 5493 5893 6293 6693 6965 7365 7652 8052 8513 9116 9203\n",
" 9603 10003 10628 10849 11512 11912 12312 12535 12947 13347 13666 14248\n",
" 14682 14857 15257 15657 16393 16793 17193 17262 17906 18146 18546 19050\n",
" 19450 19904]\n"
]
}
],
"source": [
"print(stim_id_trial['pair'][0])"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([ 82, 482, 1021, 1421, 1821, 2183, 2645, 3045, 3445,\n",
" 3643, 4357, 4757, 5014, 5493, 5893, 6293, 6693, 6965,\n",
" 7365, 7652, 8052, 8513, 9116, 9203, 9603, 10003, 10628,\n",
" 10849, 11512, 11912, 12312, 12535, 12947, 13347, 13666, 14248,\n",
" 14682, 14857, 15257, 15657, 16393, 16793, 17193, 17262, 17906,\n",
" 18146, 18546, 19050, 19450, 19904])"
]
},
"execution_count": 8,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"pair_trial_id[0][0]"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"**Stimulus data layout:**\n",
"```\n",
"stim_val = {'pair': [(or1, ph1), (or2, ph2), ...], 'orientation': [...], 'phase': [...]}\n",
"stim_id_trial = {'pair': [id1, id2, ...], 'phase': [..], ...} # corresponding trials\n",
"pair_trial_id[orientation_id][phase_id] = [Trial ids]\n",
"```"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### Load the spike data and correlations\n",
"```\n",
"Loaded: spike_count_rate, avg_firing_rate, sem_firing_rate, firing_rate, stim_num_trial, C_r_fphi_theta, theta_hist, phase_hist, pair_hist\n",
"Loaded: corr_stim_unit, optimal_avg_firing_rate, stim_hist, stim_hist_caution\n",
"```"
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"(40,)"
]
},
"execution_count": 9,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"spike_times_file = \"Spiketimes_PVCre_2021_0012_s06_e14.npy\"\n",
"spike_times = np.load(data_folder+spike_times_file, allow_pickle=True)\n",
"active = [len(spike_times[i]) > 0 for i in range(len(spike_times))]\n",
"spike_times = spike_times[np.where(active)]\n",
"num_unit = len(spike_times)\n",
"spike_times.shape"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"**Sort spikes by firing rate**"
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {},
"outputs": [],
"source": [
"\n",
"num_spike = list(map(len, spike_times))\n",
"spike_times = spike_times[np.argsort(num_spike)[::-1]]"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"**Load a lot of variables out of a `.pkl` file**"
]
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Loaded: spike_count_rate, avg_firing_rate, sem_firing_rate, firing_rate, stim_num_trial, C_r_fphi_theta, theta_hist, phase_hist, pair_hist\n",
"Loaded: corr_stim_unit, optimal_avg_firing_rate, stim_hist, stim_hist_caution\n"
]
}
],
"source": [
"# yeah...\n",
"files = ['spike_data.pkl', 'corr_data.pkl']\n",
"for file_name in files:\n",
" file = open(file_name, 'rb')\n",
" data = pkl.load(file)\n",
" print('Loaded:', ', '.join(data.keys()))\n",
" for key, value in data.items():\n",
" globals()[key] = value\n",
"\n",
" file.close()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### Spike and stimulus preprocessing\n",
"\n",
"```\n",
"B_stim = {'pair': [mat_stim_1, mat_stim_2, ..], 'orientation': .., ...}\n",
"```\n",
"\n",
"`mat_stim_i` is a matrix of shape `(1, M)` such that `mat[0][t] = 1` if there was stimuli at time $t$ and $0$ if not\n",
"\n",
"```\n",
"B_spike = [unit_1_spikes, unit_2_spikes, ..]\n",
"unit_1_spikes[t] = 1 if there was a spike, 0 if not\n",
"```"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"##### Read the data"
]
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {},
"outputs": [],
"source": [
"# reverse correlation time offset range \n",
"max_delay = 300 # dt\n",
"tau_id_range = np.arange(max_delay)\n",
"\n",
"# experiment duration\n",
"latest_spike_time = max([np.max(s) for s in spike_times if len(s)])\n",
"latest_stim_offtime = list(stim['stim_offtime'])[-1]\n",
"experiment_dur = max([latest_spike_time, latest_stim_offtime])\n",
"\n",
"dt = 0.001 # 1 ms\n",
"exp_time = np.arange(0, experiment_dur, dt)\n",
"M = len(exp_time)"
]
},
{
"cell_type": "code",
"execution_count": 12,
"metadata": {},
"outputs": [],
"source": [
"B_stim = {}\n",
"for key in key_list:\n",
" B_stim[key] = []\n",
" for stim_id, trials in enumerate(stim_id_trial[key]):\n",
" B_stim[key].append([])\n",
" s = []\n",
" for trial_id in trials:\n",
" t_on, t_off = stim['stim_ontime'][trial_id], stim['stim_offtime'][trial_id]\n",
" s += list(np.arange(int(t_on//dt), int(t_off//dt)))\n",
"\n",
" B_stim[key][stim_id] = sparse.coo_matrix((np.ones(len(s)), (np.zeros(len(s), dtype=int), s)), shape=(1, M))\n",
"s = spike_times//dt\n",
"B_spike = []\n",
"for unit_id in range(num_unit):\n",
" B_spike.append(sparse.coo_matrix((np.ones(len(s[unit_id])), (np.zeros(len(s[unit_id]), dtype=int), np.int0(s[unit_id]))), shape=(1, M)))"
]
},
{
"cell_type": "code",
"execution_count": 13,
"metadata": {},
"outputs": [],
"source": [
"sorted_spike_num = np.sort(num_spike)[::-1]\n",
"cutoff_num_spike = 1000\n",
"num_unit = np.sum(sorted_spike_num > cutoff_num_spike)\n",
"for key in key_list:\n",
" stim_hist[key] = stim_hist[key][:num_unit]"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"##### Some plots"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"This graph shows for unit 0 at a particular moment:\n",
"- One stimulus duration (blue)\n",
"- The second stimulus (red)\n",
"\n",
"And spike events"
]
},
{
"cell_type": "code",
"execution_count": 14,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAYEAAAEWCAYAAACAOivfAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8rg+JYAAAACXBIWXMAAAsTAAALEwEAmpwYAAAZJUlEQVR4nO3df5xddX3n8de7IcAqIsGMFhMgiNSCIqAjSmUV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/7fVDZSVSurariqhoeGhvpQliRpMtMOgaq6t6rua6bXAHOTzAc2Avt2dV3YtEmSZolph0CSX0+SZvrIZpt3AtcBByU5IMmuwDJg9XSfT5LUP5OeE0hyIXAMMD/JBuAMYC5AVZ0LnAC8Nclm4EFgWVUVsDnJqcBlwBxgVXOuQJI0S0waAlV14iTLPw58fIJla4A1UytNkjTT/MSwJLWYISBJLWYISFKLGQKS1GKGgCS1mCEgSS1mCEhSixkCktRihoAktZghIEktZghIUosZApLUYoaAJLWYISBJLWYISFKLTRoCSVYluSPJtydY/ntJbkpyc5KvJTmsa9mPmvYbkoz0s3BJ0vT1sidwPrBkG8t/CLy8qg4FzgJWjln+iqo6vKqGp1aiJGmm9HJnsauSLNrG8q91zV5D54bykqQngH6fEzgZuKRrvoAvJbk+yYptrZhkRZKRJCOjo6N9LkuSNJ5J9wR6leQVdELg6K7mo6tqY5KnA5cn+W5VXTXe+lW1kuZQ0vDwcPWrLknSxPqyJ5Dk+cCngKVVdeeW9qra2Py8A/gicGQ/nk+S1B/TDoEk+wFfAP6gqr7X1f7kJE/ZMg0sBsa9wkiSNBiTHg5KciFwDDA
"text/plain": [
"<Figure size 432x288 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"stim_id = 10\n",
"trial_id = stim_id_trial['phase'][stim_id][0]\n",
"unit_id = 0\n",
"t_on, t_off = stim['stim_ontime'][trial_id], stim['stim_offtime'][trial_id]\n",
"t0, t1 = t_off-0.2, t_off+0.1\n",
"stim_prev_id = trial_stim_id['phase'][trial_id-1]\n",
"t_prev_on, t_prev_off = stim['stim_ontime'][trial_id-1], stim['stim_offtime'][trial_id-1]\n",
"spikes = spike_times[unit_id][np.where((t0 < spike_times[unit_id]) & (spike_times[unit_id] < t1))]\n",
"plt.axvspan(t_on, t_off, color=cmap_jet(1-np.abs(stim_id-10)/10), alpha=0.3)\n",
"plt.axvspan(t_prev_on, t_prev_off, color=cmap_jet(1-np.abs(stim_prev_id-10)/10), alpha=0.3)\n",
"plt.eventplot(spikes)\n",
"plt.xlim([t0, t1])\n",
"plt.title('Spikes for unit 0')\n",
"plt.xlabel('Time')\n",
"plt.show()"
]
},
{
"cell_type": "code",
"execution_count": 15,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAfAAAAIUCAYAAADlkX7vAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8rg+JYAAAACXBIWXMAAAsTAAALEwEAmpwYAABGYElEQVR4nO3dd3hUZfrG8e+TDqFX6aGDgCCEqmLvvWLBgoqKrrrquuq667quvaxlV5G1V1Qsa8deUEAISJPepJdQU0h/f3/MgV+MSQhJZs6c5P5cVy5mzpzznuedM8w9p5tzDhEREQmWGL8LEBERkX2nABcREQkgBbiIiEgAKcBFREQCSAEuIiISQApwERGRAFKAS1iZmTOzu/2uQ6QsZvatmX1biekOM7M7zSymxPAU73N/SXXVKFIaBbiISOUcBvyd33+PrgeGAh9HuiCpXeL8LkCktjCzROdcrt91AJhZLGDOuQK/a6msst5Pv/vm1TTVj3lL7aI1cPkdM+tmZu+Z2SYzyzGzVWY2wczivNcv8TYRppSY7k4zK+3SfmZmt5vZGjPbZWbfm1m/EiMca2aTzWyHmWWa2SIzu6Nk22bWx8y+MbNsM1tvZncV34RpZklm9qiZzfPa2WBmH5pZj1KK6mhmr3jj5JrZcjN7vMQ4h5rZV2aWYWZZZvaZmfWuwHv4otffoV6/dgEPeq81N7OnzWytN9+FZnZFsWkHen09pZR2nzKzzWYWX2zYFWY221tW6Wb2nJk1KTGdM7N7zOxWM1sB5AF9zKyemf3bW8a53jL/svj7ZWZxZnabV2euma0zs0fMLKkC70Ocmd1iZvO9+jab2cQS7Xf3Pm/bvc/HVDM7rkQ7u5d/b28ZZAJvldc377V9Xn4V+QyZ2Z2E1r4B8r0anPdaqZvQzWxkieX0ipm1Kj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7sGeN87+vstQmuULYFhhAL4X2W+kWV7lFA4TfJqXEToh0oP4BDn3Km7R3TO7TSz9wkdld0KGF28IefcMjN7APiPmXUnFIY5QDtCu0Ge9bZslMnMphA60n0uoR9ChxLa6vKSN49vzWw8oX3g/yJ05H4RoQO1TgBucc4tLq1t59w3ZvYO8C8za0fo8xNPaFl/7Jz71ns/LgG+MLO/E/pcXA10I7TLoFKquPwq+hma7/17k5l9ChQ659JKqaXQQqdEjjOzVwltRWkD3EPoyP/nK9tPqeX8PopOf9H1R2jf4UvAYkIH/GwlFAzHlhivF6E1h0xCp4jdSNlHod9D6DSlNYQCZhLFjl4mdDDb+4TCO5fQvsIJQPdi49zptdUb+IbQj4INhE6xiSk2Xgyh03/WefV/BxxIaG3sxRK1dSZ0sFS6V9cyShyR7dX2EaFNuTleO28AQ/fyPr4IrCnjtcaEgmv3OcubvPfkj6WMe6LX798ckV5inAsJHRSY5S2PBcB/gLYllsPdpUz7APAzodO3sggF+XUlxokhtMl/tvce7PAeP1hWTcWmjSN0RP1ir6+bCf1QK75suxM6PXCH1/5UQj+kireze/nHlTKPUvtW0eVHiaPQK/oZIvTj9klv+RWx5xCS3x6FXmz8kd77lktoE/8rQKsS46wEXi2jj3f6/f2gv+j6M+fK2qUkEj2KXTgj3gX46mEiItVF+8BFREQCSAEuIiISQNqELiIiEkBaAxcREQkgBbiIiEgAKcBFREQCSAEuIiISQApwERGRAFKAi4iIBJACXEREJIAU4CIiIgGkABcREQkgBbiIiEgAKcBFREQCSAEuIiISQApwERGRAFKAi4iIBJACXEREJIAU4CIiIgGkABcREQkgBbiIiEgAKcBFREQCSAEuIiISQApwEREJLDNzZtalktNeYGafV3dNkWLOOb9rEBERqRQzc0BX59zSvYyXAqwA4p1zBZG
"text/plain": [
"<Figure size 504x504 with 7 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"from matplotlib import gridspec\n",
"\n",
"fig, ax = plt.subplots(3,1,figsize=(7,7))\n",
"gs0 = gridspec.GridSpec(3, 3, figure=fig, hspace=0, wspace=0)\n",
"\n",
"stim_id = 10\n",
"trial_id = stim_id_trial['phase'][stim_id][0]\n",
"unit_id = 0\n",
"t_on, t_off = stim['stim_ontime'][trial_id], stim['stim_offtime'][trial_id]\n",
"t0, t1 = t_off-0.2, t_off+0.1\n",
"stim_prev_id = trial_stim_id['phase'][trial_id-1]\n",
"t_prev_on, t_prev_off = stim['stim_ontime'][trial_id-1], stim['stim_offtime'][trial_id-1]\n",
"spikes = spike_times[unit_id][np.where((t0 < spike_times[unit_id]) & (spike_times[unit_id] < t1))]\n",
"\n",
"ax0 = fig.add_subplot(gs0[0, :-1])\n",
"ax1 = fig.add_subplot(gs0[1, :-1])\n",
"ax2 = fig.add_subplot(gs0[2, :-1])\n",
"ax3 = fig.add_subplot(gs0[:, -1])\n",
"\n",
"ax0.axvspan(t_on, t_off, color=cmap_jet(1-np.abs(stim_id-10)/10), alpha=0.3, label='preferred')\n",
"ax0.axvspan(t_prev_on, t_prev_off, color=cmap_jet(1-np.abs(stim_prev_id-10)/10), alpha=0.3, label='non-preferred')\n",
"ax0.eventplot(spikes)\n",
"ax0.set_xlim([t0, t1])\n",
"ax0.legend(loc='upper left')\n",
"\n",
"ax1.axvspan(t_on, t_off, color=cmap_jet(1-np.abs(stim_id-10)/10), alpha=0.3)\n",
"ax1.axvspan(t_prev_on, t_prev_off, color=cmap_jet(1-np.abs(stim_prev_id-10)/10), alpha=0.3)\n",
"ax1.eventplot(spikes-0.05)\n",
"ax1.set_xlim([t0, t1])\n",
"\n",
"ax2.axvspan(t_on, t_off, color=cmap_jet(1-np.abs(stim_id-10)/10), alpha=0.3)\n",
"ax2.axvspan(t_prev_on, t_prev_off, color=cmap_jet(1-np.abs(stim_prev_id-10)/10), alpha=0.3)\n",
"ax2.eventplot(spikes-0.15)\n",
"ax2.set_xlim([t0, t1])\n",
"\n",
"ax3.plot(np.sin(np.pi*tau_id_range/300), np.arange(300))\n",
"ax3.set_xticks([])\n",
"ax3.set_yticks([])\n",
"ax3.set_title('reverse correlation')\n",
"# ax2.legend()\n",
"for ax in fig.get_axes():\n",
" ax.tick_params(bottom=False, labelbottom=False, left=False, labelleft=False)\n",
"\n",
"ax2.tick_params(bottom=True, labelbottom=True)\n",
"ax2.set_xlabel('t/s')\n",
"plt.tight_layout()\n",
"fig.suptitle('subspace reverse correlation', size=16, y=1.05)\n",
"plt.show()"
]
},
{
"cell_type": "code",
"execution_count": 16,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAeUAAAG5CAYAAACwfCzuAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8rg+JYAAAACXBIWXMAAAsTAAALEwEAmpwYAAA+h0lEQVR4nO3de5xd873/8de7JhFyRyRpEkncpVIhiUQpyqlbnVIHpUhSKtrS8jtOUbQc5RxtlVbr0hASTtzqXrcWx7V1OUmohFBBQshIlNxEyMTn98daM90ZM5M9l73Xmtnv5+OxH7PXd90+a82e/Zm11md9lyICMzMzy97nsg7AzMzMEk7KZmZmOeGkbGZmlhNOymZmZjnhpGxmZpYTTspmZmY54aRsViKS7pc0Pn0/QdKTJVzXZpJWSFqvVOtoYt0rJG1e7vWadUROymZNkLSbpL9KWirpfUl/kTS6mHkjYv+ImFrqGNN1vRkR3SJiTTnWV2/d3SLidQBJUySdX+4YzDqKqqwDMMsrST2Ae4DvAbcAnYEvAx9nGZeZdVw+UjZr3NYAEXFjRKyJiI8i4s8R8QLUnZL+i6TfpUfSL0vau3ZmSY9K+k5DC5b0S0lPSuqZviZLWijpbUnn156GlrSlpMfS5b8n6eZGljdEUkiqKlj3z9L4lkv6s6RNGpn3M6fW02Vtmb6fIukySfemy3pG0hb1p5U0ETgKOC09pf3HdPzp6XYtl/RK4T4ys7U5KZs17u/AGklTJe0vqXcD04wBXgM2Ac4Bbpe0UWMLlPQ5SV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VUgZmZmlc59X+eEK1mtrZXqM1Wuz2pHrFp
"text/plain": [
"<Figure size 504x504 with 3 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"# subspace reverese correlation\n",
"stim_id = 13\n",
"ref_trial_id = stim_id_trial['phase'][stim_id][0]\n",
"stim_prev_id = trial_stim_id['phase'][ref_trial_id-1]\n",
"past_trials = 3\n",
"future_trials = 10\n",
"trial_range = np.arange(-past_trials, future_trials+1) + ref_trial_id\n",
"\n",
"units = np.arange(num_unit)\n",
"orientation, phase, t_on = np.array(stim[['grat_orientation', 'grat_phase','stim_ontime']].iloc[trial_range]).T\n",
"spikes = [\n",
" spike_times[unit_id][\n",
" # Where the spike occurs during the stimulus period in one of the right trials\n",
" np.where((t_on[0] < spike_times[unit_id]) & (spike_times[unit_id] < t_on[-1]))\n",
" ]\n",
" for unit_id in units]\n",
"\n",
"fig, ax = plt.subplots(2,1,figsize=(7,7))\n",
"plt.subplots_adjust(hspace=0)\n",
"s = 1\n",
"ax[0].eventplot(spikes, linelength=s, lineoffsets=s)\n",
"\n",
"ref_id = list(trial_range).index(ref_trial_id)\n",
"# ax[0].axvspan(t_on[ref_id], t_on[ref_id]+0.08, color=cmap_jet(1-np.abs(stim_id-10)/10), alpha=0.3)\n",
"# ax[0].axvspan(t_on[ref_id-1], t_on[ref_id-1]+0.08, color=cmap_jet(1-np.abs(stim_prev_id-10)/10), alpha=0.3)\n",
"ax[0].set(ylabel='unit')\n",
"ax[0].invert_yaxis()\n",
"ax[1].step(t_on, phase, 'b', where='post', alpha=0.5, label='phase')\n",
"ax[1].set(xlabel='t / s', xlim=[t_on[0], t_on[-1]], ylim=[0, 360], ylabel='phase')\n",
"ax[1].legend(loc='upper left')\n",
"ax2 = ax[1].twinx()\n",
"ax2.step(t_on, orientation, 'r', where='post', alpha=0.5, label='orientation')\n",
"ax2.set(ylim=[0, 180], ylabel='orientation')\n",
"ax2.legend()\n",
"ax[0].set_title('Spikes in units')\n",
"ax[1].set_title('Phase and orientation')\n",
"\n",
"plt.show()"
]
},
{
"cell_type": "code",
"execution_count": 17,
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "afc70624cbfe4a5f8838bce9ae0c0ebc",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"interactive(children=(IntSlider(value=0, description='delay/ms', max=299), IntSlider(value=0, description='uni…"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"@widgets.interact(key=widgets.RadioButtons(options=key_list[1:],\n",
" description='stimulus:',\n",
" disabled=False), tau_id=widgets.IntSlider(0, min=0, max=max_delay-1, description='delay/ms'), unit_id=widgets.IntSlider(0, min=0, max=num_unit-1))\n",
"\n",
"def PSSH(tau_id, unit_id, key):\n",
" fig, ax = plt.subplots(1, 1, figsize=(7,6))\n",
" prob = stim_hist[key][unit_id, tau_id]\n",
" n = sorted_spike_num[unit_id]\n",
" confidence_interval = np.sqrt(prob/n)\n",
" plt.errorbar(stim_val[key], stim_hist[key][unit_id, tau_id], yerr=confidence_interval)\n",
" ymin = np.min(stim_hist[key][unit_id])*0.95\n",
" ymax = np.max(stim_hist[key][unit_id])*1.05\n",
" ax.set_ylabel('$\\mathcal{P}($'+key_symbol[key]+'$|\\\\tau)$')\n",
" ax.set_xlabel(key_symbol[key])\n",
" plt.ylim([ymin, ymax])\n",
" plt.suptitle('Distribution of stimulus at time $\\\\tau$ before a spike of unit: %d'%unit_id)\n",
" plt.show()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"##### Problem with the data\n",
"\n",
"The picture a couple of cells below clearly shows that there is a shift in the stimulus presentation times. Let's fix it!"
]
},
{
"cell_type": "code",
"execution_count": 18,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"/usr/lib/python3.10/site-packages/pandas/core/roperator.py:13: VisibleDeprecationWarning: Creating an ndarray from ragged nested sequences (which is a list-or-tuple of lists-or-tuples-or ndarrays with different lengths or shapes) is deprecated. If you meant to do this, you must specify 'dtype=object' when creating the ndarray.\n",
" return right - left\n"
]
}
],
"source": [
"trial_spike_times = np.ndarray((num_unit, num_trial), dtype=object)\n",
"delta_t_on = 0.2 # 200ms\n",
"delta_t_off = 0.3\n",
"for trial_id in range(num_trial):\n",
" t_on, t_off = stim['stim_ontime'][trial_id]-delta_t_on, stim['stim_offtime'][trial_id]+delta_t_off\n",
" for unit_id in range(num_unit):\n",
" trial_spike_times[unit_id, trial_id] = spike_times[unit_id][np.where((spike_times[unit_id] < t_off) & (spike_times[unit_id] > t_on))]\n",
"subseq_trials = 5\n",
"subseq_spike_times = np.ndarray(num_unit, dtype=object)\n",
"for unit_id in range(num_unit):\n",
" subseq_spike_times[unit_id] = [np.concatenate(trial_spike_times[unit_id][i:i+subseq_trials]) for i in range(num_trial-subseq_trials)]\n",
"\n",
"subseq_spike_times_locked = {}\n",
"subseq_spike_times_locked['ontime'] = [subseq_spike_times[unit_id] - stim['stim_ontime'][:-subseq_trials] for unit_id in range(num_unit)]\n",
"subseq_spike_times_locked['offtime'] = [subseq_spike_times[unit_id] - stim['stim_offtime'][:-subseq_trials] for unit_id in range(num_unit)]"
]
},
{
"cell_type": "code",
"execution_count": 19,
"metadata": {},
"outputs": [],
"source": [
"time_range = np.arange(0, stim['stim_ontime'].max(), np.array(sorted(np.diff(stim['stim_ontime'], n=1))[10:-10]).mean())"
]
},
{
"cell_type": "code",
"execution_count": 20,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"((28, 19995), (28, 19995), 0.7671829999999886)"
]
},
"execution_count": 20,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"subseq_spike_times_len = len(subseq_spike_times[0])\n",
"subseq_spike_times_locked['ontime'] = np.array(subseq_spike_times_locked['ontime'])\n",
"subseq_spike_times_locked['offtime'] = np.array(subseq_spike_times_locked['offtime'])\n",
"from itertools import chain\n",
"subseq_spike_times_locked['ontime'].shape, subseq_spike_times_locked['offtime'].shape, max(chain(*subseq_spike_times_locked['ontime'].flatten()))"
]
},
{
"cell_type": "code",
"execution_count": 21,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAABKUAAAJsCAYAAAAsihANAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8rg+JYAAAACXBIWXMAAAsTAAALEwEAmpwYAADTXElEQVR4nOzdefwdVX3/8fdJAgQwYRUIIkYRQRZBQZG6BVHEFdta0FbrvlTtrhVcA2JBq/2ptSrWBax7tXUDBEEQ0SAICkgEZYsCEWRNILIknN8f3zthvpOZe2fmzlnmzOv5ePAg937vcu58536+cz7nc84x1loBAAAAAAAAPs0J3QAAAAAAAAAMD0kpAAAAAAAAeEdSCgAAAAAAAN6RlAIAAAAAAIB3JKUAAAAAAADgHUkpAAAAAAAAeEdSCgAAIDLGmE8aY94Vuh0AgOkQz4HxjLU2dBsAAABQwRizRNIXrLU7jXnMQZLeLelxkm6z1i720jgAQG014/k/SvpbSdtKulPSVyW91Vq71kcbAd+olAIAAOi/uyR9VtJbQzcEADCVb0t6nLV2oaS9JO0j6e/CNglwh6QUAACAA8YYa4x5ZO72icaYY0f/XmKMuc4Y88/GmJuMMSuNMa8sPtYYs7mkUyXtaIy5c/TfjsX3staeb639b0lXe/hoADAonuP5Vdba27OnS7pf0iOLjwNSQVIKAAAgjB0kbSHpIZJeLek/jTFb5R9grb1L0rMl3WCtfdDovxv8NxUAMEan8dwY85fGmFWSbtZMpdQJTlsPBERSCgAAIIz7JB1jrb3PWnuKZtYO2S1wmwAAzXUaz621XxpN33uUpE9KurGbZgLxISkFAAAQxi2FhWvXSHpQqMYAAFpzEs+ttb+RdJmkj0/7WkCsSEoBAAC4sUbSZrnbO7R8HbZKBoCwQsbzeZJ2afl+QPRISgEAALjxC0l/aYyZa4w5VNLTWr7OjZK2McZsUfUAY8wcY8x8SRvN3DTzjTEbt3w/AMBsv5C/eP4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iUAhJhrdWyq27RX376p1qy24N14iufELpJgFOMrPsRugMT24W0y/bE9lljEfIcbDIFNntsJnuO74XO+4h4HheX37lxC4y7XvA8hL62uwt9/uxl8Tx/3+q712rB/HnE9RJtKqVISgGJYaFzDEXITsyknU9CVk+57ACHTlClLPSaS33uPNThez2pkI44YZmWr1ylPRYt7E0FZ4h43nSXwqFVxcYs9XiF6aUa47P4LinaGE9SqgaSUkjZuvutdnn7Kdr7IVvoQ4fvo0dtvyB0kwBnXHRiutiqN1VlF3i+tgnP0AEBHjDNRguxxS4qpcJLtRM/VF0k7tr+DSZpOGwkpWogKYWUFf94fP0NB2r/xVsHag3gVgydGJ8VCUwBGq+ri+CuEmF12zNpt7pQF/Wu3j/k5yquP+Ky8x3y+1pVARRLAqpMDPG8Sh+OHzaUjzVV/276OmW3i4/LtHkvtENCNS4kpWogKYWUHf7JZTr/2lvX375k6SFaOH+jgC0C3Im5E4PphL6Qn6YDM+175qXakRlCBVwxKVWWpOoqcZVC0iT2eF51jH0mH4vvNc1i5yGEjuuAT65iQx8GHUhK1UBSCqljTSkMRQydmGmmz3St6gKoywujXY46WeusNNf428UpRAKDEW9MUvd7VVwsN+Ozgip0bKojhniOMIitcejib63L3+U01xtdX6u4SDiNu56sE8NjivMkpWogKYXUkZTCUPShE+PiIsFlxUUd4y7uur7wG1c91MeOTFmbY64a6uMxLlOWTM3fTkFxke5MDB2UOmKK56luVOFD1YYNZdWnRX2PM0XTThN0/XqpKNvEIovvmT7H+arYnokxxpOUqoGkFFJ19R/u1NM/9MNZ9/3
"text/plain": [
"<Figure size 1440x720 with 3 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"unit_id = 1\n",
"unit_id_2 = 3\n",
"\n",
"fig, ax = plt.subplots(1,3, figsize=(20,10))\n",
"ax[0].plot(np.diff(stim['stim_ontime'], n=2), np.arange(20000-2))\n",
"ax[0].invert_yaxis()\n",
"ax[0].set_xlabel('$\\Delta^2[t_{on}]=\\Delta$ trial duration / s', size=20)\n",
"ax[0].set(ylabel='trials')\n",
"ax[1].eventplot(subseq_spike_times_locked['ontime'][unit_id], lineoffsets=1, linelengths=0.8)\n",
"ax[1].set(title='unit %d'%unit_id, yticks=[], xlabel='t/s (locked to trial onsets)')\n",
"ax[1].invert_yaxis()\n",
"ax[2].eventplot(subseq_spike_times_locked['ontime'][unit_id_2], lineoffsets=1, linelengths=0.8)\n",
"ax[2].set(title='unit %d'%(unit_id_2), yticks=[], xlabel='t/s (locked to trial ends)')\n",
"ax[2].invert_yaxis()\n",
"plt.subplots_adjust(wspace=0)\n",
"plt.show()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"_Whaaat?_\n",
"\n",
"Ok, we've gotta fix it.\n",
"\n",
"Let's take the \"bad\" times, identify the periods we want to calibrate - and align everything"
]
},
{
"cell_type": "code",
"execution_count": 22,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"2280 2286 2291 2292 2295 2298 2301 2307 2377 2378 2380 2383 2386 2464 2467 2469 2472 2475 2478 15300 15306 15312 15315 15316 15318 15327 15329 15333 15336 15338 15342 15344 15348 15349 15402 15403 15405 15408\n"
]
}
],
"source": [
"stim_2diffs = np.diff(stim['stim_ontime'], n=2)\n",
"print(*[i for i in range(len(stim_2diffs)) if stim_2diffs[i] > 0.01])"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Periods:\n",
"$[0, 2350)$, $[2350, 15350)$, $[15350, 20000]$"
]
},
{
"cell_type": "code",
"execution_count": 23,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"/tmp/ipykernel_4135643/175591453.py:20: DeprecationWarning: Please use `gaussian_filter1d` from the `scipy.ndimage` namespace, the `scipy.ndimage.filters` namespace is deprecated.\n",
" period_1_dist = scipy.ndimage.filters.gaussian_filter1d(period_1_dist, sigma=10)\n",
"/tmp/ipykernel_4135643/175591453.py:21: DeprecationWarning: Please use `gaussian_filter1d` from the `scipy.ndimage` namespace, the `scipy.ndimage.filters` namespace is deprecated.\n",
" period_2_dist = scipy.ndimage.filters.gaussian_filter1d(period_2_dist, sigma=10)\n",
"/tmp/ipykernel_4135643/175591453.py:22: DeprecationWarning: Please use `gaussian_filter1d` from the `scipy.ndimage` namespace, the `scipy.ndimage.filters` namespace is deprecated.\n",
" period_3_dist = scipy.ndimage.filters.gaussian_filter1d(period_3_dist, sigma=10)\n"
]
}
],
"source": [
"p1, p2 = 2350, 15350\n",
"delta_t = 0.002\n",
"time_range_smoothing = np.arange(0, 0.8, delta_t)\n",
"period_1_dist = np.zeros(len(time_range_smoothing) - 1)\n",
"period_2_dist = np.zeros(len(time_range_smoothing) - 1)\n",
"period_3_dist = np.zeros(len(time_range_smoothing) - 1)\n",
"num_units = subseq_spike_times_locked['ontime'].shape[0]\n",
"for i in range(num_units):\n",
" for j, row in enumerate(subseq_spike_times_locked['ontime'][i]):\n",
" hist = np.histogram(row, bins=time_range_smoothing)[0]\n",
" if j < p1:\n",
" period_1_dist += hist\n",
" elif j < p2:\n",
" period_2_dist += hist\n",
" else:\n",
" period_3_dist += hist\n",
"period_1_dist /= num_units\n",
"period_2_dist /= num_units\n",
"period_3_dist /= num_units\n",
"period_1_dist = scipy.ndimage.filters.gaussian_filter1d(period_1_dist, sigma=10)\n",
"period_2_dist = scipy.ndimage.filters.gaussian_filter1d(period_2_dist, sigma=10)\n",
"period_3_dist = scipy.ndimage.filters.gaussian_filter1d(period_3_dist, sigma=10)"
]
},
{
"cell_type": "code",
"execution_count": 24,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"[<matplotlib.collections.EventCollection at 0x7f1b53e02f80>]"
]
},
"execution_count": 24,
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAmoAAAR8CAYAAAAtjbjDAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMiwgaHR0cHM6Ly9tYXRwbG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5ifWE1bR1uL1bWdysPVDI5M4akqLA+32PJ+GRO1DVTEEAL+r64tQRr4eaZWec9NykqjDm5CSwNoJZOEZGecKJF7VHgyu4HrLW3WWunW2unA/8AXuj28qGu16y19/qvTBlqapta2XOivsfrjJ3NhaOTaGxpZ/uxWu8U1g8NzW1sKaph0Zjkft2n67/J2oOV3ijLK17dcYKZw+PITojs0fmXTUjlYHkjhytP+rgyERHv8XtQs9auBM64VLjpHL39YeBpvxYlAqwvrMZamDeqb92eXeaNSsSYziUxnLa+sJp2t2XR2P4FteyESIYnRLLmUGBMKCiqamLPiXquntLzJVQu9SxNEojLp4iInE2gjVFbCJRZawu6HRtpjNlqjFlhjFnoVGEy+K0vrCIiJIhpWXH9uk9cZChTM2NZEwBBbUNhFaHBLmYMj+v3veaPSmR9YRUdbufHqb2+q3NdtysmpfX4mqz4SCamx7BsT+BNihAROZtAC2of4f2taSeA4dbaGcDXgKeMMWdc3MoYc48xJt8Yk19RETgDuWXgWHuokrwR8X1awuJ0C0YnsbWolkaHF1ndcLiaGdlxhAWfe2P5npg/OomG5nZ2ldR5obL+eXN3KVMyY3vc7dnlonHJbCmq0eK3IjJ
"text/plain": [
"<Figure size 720x1440 with 3 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"fig, ax = plt.subplots(3, 1, figsize=(10,20))\n",
"ax[0].plot(time_range_smoothing[:-1], period_1_dist, label='period 1')\n",
"ax[1].plot(time_range_smoothing[:-1], period_2_dist, label='period 2')\n",
"ax[2].plot(time_range_smoothing[:-1], period_3_dist, label='period 3')\n",
"ax[0].set(xlabel='t/s', ylabel='spike count', title='1st part')\n",
"ax[1].set(xlabel='t/s', ylabel='spike count', title='2nd part')\n",
"ax[2].set(xlabel='t/s', ylabel='spike count', title='3rd part')\n",
"ax[0].eventplot([0.2], linelengths=0.8)\n",
"ax[1].eventplot([0.2], linelengths=0.8)\n",
"ax[2].eventplot([0.2], linelengths=0.8)"
]
},
{
"cell_type": "code",
"execution_count": 25,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"100"
]
},
"execution_count": 25,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"list(time_range_smoothing).index(0.2)"
]
},
{
"cell_type": "code",
"execution_count": 26,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"0.2 0.162 0.194\n"
]
}
],
"source": [
"max_p_1 = time_range_smoothing[np.argmax(period_1_dist[:120])]\n",
"max_p_2 = time_range_smoothing[np.argmax(period_2_dist[:100])]\n",
"max_p_3 = time_range_smoothing[np.argmax(period_3_dist[:120])]\n",
"delta_2 = max_p_1 - max_p_2\n",
"delta_3 = max_p_1 - max_p_3\n",
"print(max_p_1, max_p_2, max_p_3)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Now we'll fix the times"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [],
"source": [
"t_p1, t_p2 = stim['stim_offtime'][p1], stim['stim_offtime'][p2]\n",
"fix_time = lambda t: t - delta_2 * ((t < t_p2) & (t >= t_p1)) - delta_3 * ((t >= t_p2))"
]
},
{
"cell_type": "code",
"execution_count": 28,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0 2.5839\n",
"1 2.7028\n",
"2 2.7863\n",
"3 2.8699\n",
"4 2.9534\n",
" ... \n",
"19990 1671.6389\n",
"19991 1671.7224\n",
"19992 1671.8059\n",
"19993 1671.8894\n",
"19994 1671.9730\n",
"Name: stim_offtime, Length: 19995, dtype: float64"
]
},
"execution_count": 28,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"fix_time(stim['stim_offtime'][:-subseq_trials])"
]
},
{
"cell_type": "code",
"execution_count": 29,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"/usr/lib/python3.10/site-packages/pandas/core/roperator.py:13: VisibleDeprecationWarning: Creating an ndarray from ragged nested sequences (which is a list-or-tuple of lists-or-tuples-or ndarrays with different lengths or shapes) is deprecated. If you meant to do this, you must specify 'dtype=object' when creating the ndarray.\n",
" return right - left\n"
]
}
],
"source": [
"subseq_spike_times_locked_2 = {}\n",
"subseq_spike_times_locked_2['ontime'] = [subseq_spike_times[unit_id] - fix_time(stim['stim_ontime'][:-subseq_trials]) for unit_id in range(num_unit)]\n",
"subseq_spike_times_locked_2['offtime'] = [subseq_spike_times[unit_id] - fix_time(stim['stim_offtime'][:-subseq_trials]) for unit_id in range(num_unit)]"
]
},
{
"cell_type": "code",
"execution_count": 30,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAABJ8AAAJsCAYAAABTWwL8AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8rg+JYAAAACXBIWXMAAAsTAAALEwEAmpwYAADS4klEQVR4nOzdebwdRZ3//3eRAAFMWAWCGKOIIIugoLgbRBFXnBkHdEbHfRl1dh3FNSAO6Oj81HFU/LqA4z464wYIgiCiQTYFJIKyRYEosplACJBQvz/u6dC3092n+5yupatfz8eDB7lnrdO3z+d2fepTVcZaKwAAAAAAAMCFTUI3AAAAAAAAAOki+QQAAAAAAABnSD4BAAAAAADAGZJPAAAAAAAAcIbkEwAAAAAAAJwh+QQAAAAAAABnSD4BAABExhjzKWPMu0O3AwAwHeI5MMNYa0O3AQAAABWMMUskfdFau2vNYw6W9B5Jj5F0m7V2sZfGAQAaaxjP/0nS30naQdIdkr4m6a3W2nU+2gi4QuUTAABA/90p6XOS3hq6IQCAqXxH0mOstQsk7SNpP0l/H7ZJwPRIPgEAADhgjLHGmIfnfj7RGHPs6N9LjDHXG2P+xRhzkzFmpTHmlcXHGmO2knSqpF2MMXeM/tul+F7W2vOttf8t6RoPHw0ABsVzPL/aWnt79nRJ90l6ePFxQN+QfAIAAAhjZ0lbS3qQpFdL+i9jzLb5B1hr75T0bEk3WmsfMPrvRv9NBQDU6DSeG2P+yh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kq7VTYErPrbv2sbQusd3+VopKF5f5GN8po+xvpiQKup7nCf5lEPyCam65o936Okf/tG
"text/plain": [
"<Figure size 1440x720 with 3 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"unit_id = 1\n",
"\n",
"fig, ax = plt.subplots(1,3, figsize=(20,10))\n",
"ax[0].plot(np.diff(stim['stim_ontime'], n=2), np.arange(20000-2))\n",
"ax[0].invert_yaxis()\n",
"ax[0].set_xlabel('$\\Delta^2[t_{on}]=\\Delta$ trial duration / s', size=20)\n",
"ax[0].set(ylabel='trials')\n",
"ax[1].eventplot(subseq_spike_times_locked_2['ontime'][unit_id], lineoffsets=1, linelengths=0.8)\n",
"ax[1].set(title='unit %d'%unit_id, yticks=[], xlabel='t/s (locked to trial onsets)')\n",
"ax[1].invert_yaxis()\n",
"ax[2].eventplot(subseq_spike_times_locked_2['ontime'][unit_id_2], lineoffsets=1, linelengths=0.8)\n",
"ax[2].set(title='unit %d'%(unit_id_2), yticks=[], xlabel='t/s (locked to trial ends)')\n",
"ax[2].invert_yaxis()\n",
"plt.subplots_adjust(wspace=0)\n",
"plt.show()"
]
},
{
"cell_type": "code",
"execution_count": 31,
"metadata": {},
"outputs": [],
"source": [
"s = np.array([np.array(list(map(fix_time, spike_times[unit_id]))) for unit_id in range(len(spike_times))], dtype=object)//dt\n",
"B_spike_fixed = []\n",
"for unit_id in range(num_unit):\n",
" B_spike_fixed.append(sparse.coo_matrix((np.ones(len(s[unit_id])), (np.zeros(len(s[unit_id]), dtype=int), np.int0(s[unit_id]))), shape=(1, M)))"
]
},
{
"cell_type": "code",
"execution_count": 32,
"metadata": {},
"outputs": [],
"source": [
"from copy import deepcopy\n",
"B_stim_original = deepcopy(B_stim)"
]
},
{
"cell_type": "code",
"execution_count": 33,
"metadata": {},
"outputs": [],
"source": [
"B_stim = {}\n",
"for key in key_list:\n",
" B_stim[key] = []\n",
" for stim_id, trials in enumerate(stim_id_trial[key]):\n",
" B_stim[key].append([])\n",
" s = []\n",
" for trial_id in trials:\n",
" t_on, t_off = fix_time(stim['stim_ontime'][trial_id]), fix_time(stim['stim_offtime'][trial_id])\n",
" s += list(np.arange(int(t_on//dt), int(t_off//dt)))\n",
"\n",
" B_stim[key][stim_id] = sparse.coo_matrix((np.ones(len(s)), (np.zeros(len(s), dtype=int), s)), shape=(1, M))"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### Calculate some matrices"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [],
"source": [
"get_trial_index = lambda t: fix_time(stim['stim_ontime'][t])//dt"
]
},
{
"cell_type": "code",
"execution_count": 43,
"metadata": {},
"outputs": [],
"source": [
"B_spike_smooth = list()\n",
"for unit_id in range(len(B_spike)):\n",
" B_spike_smooth.append(scipy.ndimage.gaussian_filter(B_spike[unit_id].toarray()[0], sigma=50))\n",
"B_spike_smooth = np.array(B_spike_smooth)"
]
},
{
"cell_type": "code",
"execution_count": 36,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"[<matplotlib.lines.Line2D at 0x7f1b6ae5dcc0>]"
]
},
"execution_count": 36,
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAXoAAAD4CAYAAADiry33AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8rg+JYAAAACXBIWXMAAAsTAAALEwEAmpwYAABS2UlEQVR4nO29eZxkZ3nf+31rX3vfZu8ZzUij0YoYLUhgYwgYcEAxBlvg6xDbN8R2+NwbO3ECjq9jE998jG9snASubRJzg1cwYGLZgGVACIMkJI3WmZE0mn3p6Z7eu7r27b1/nPOerq46VXWqpraufr+fz3ymuupM13t6qp/znN/7PL9HSCnRaDQaTf/i6vYCNBqNRtNedKDXaDSaPkcHeo1Go+lzdKDXaDSaPkcHeo1Go+lzPN1eQDljY2Nyenq628vQ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YgXpbRq4Af74GMPpbKWZm8ta4+y+gHAhsjnIUQDIW8fa3RLyWypHNF9o4EGYv4e8optdVshYz+HuCMlPKclDILfB54sOyYB4HPmY+/BLxVCCGAtwMvSSlfBJBSLkkp23LpumPPEAcnInzuiQvt+PbbgkQmj9slLEc9S7rpskafLxRJZAvWZmzYrAqK91FGv57euJAphkK+vtboZ8yZxLuGQ4xFfX1na1FKvYw+0wMWCLuAyyVfXzGfsz1GSpkH1oBR4EZACiEeEUI8J4T4t3ZvIIT4sBDimBDi2MJCc0ORA143bzk8yfGZNT2CrUkSmQJhnxvjGl0i3XQ50Ks7DRUIo37j716402gVyWzBuoAphvvQ6qEUlcGPR/2MR/wsbIeMvkrVTXqLWyB4gDcCP2n+/aNCiLeWHySl/IyU8qiU8uj4+HjTb3bbrkF
"text/plain": [
"<Figure size 432x288 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"plt.plot(B_spike_smooth[0][:5000]) # ~10 trials"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"##### Reverse correlation\n",
"\n",
"TL;DR: We find the reverse correlation matrices. When we plot them they look meh, but if we plot them smoothed, they look awesome. However, we shouldn't use this smoothing when decoding parameters because it uses our (parameter-defined) notion of distance between points."
]
},
{
"cell_type": "code",
"execution_count": 42,
"metadata": {},
"outputs": [],
"source": [
"B_stim_total = np.sum(B_stim['phase'])"
]
},
{
"cell_type": "code",
"execution_count": 100,
"metadata": {},
"outputs": [],
"source": [
"R = dict()\n",
"for key in key_list:\n",
" R[key] = list()\n",
" for i in range(len(B_stim[key])):\n",
" item = []\n",
" for u in range(len(B_spike_smooth)):\n",
" item.append(B_stim[key][i].dot(np.roll(B_spike_smooth[u], 80)))\n",
" R[key].append(item)\n",
" R[key] = np.array(R[key])"
]
},
{
"cell_type": "code",
"execution_count": 104,
"metadata": {},
"outputs": [],
"source": [
"R['pair'] = R['pair'].reshape((20, 20, 40))\n",
"Rp = R['pair']"
]
},
{
"cell_type": "code",
"execution_count": 102,
"metadata": {},
"outputs": [],
"source": [
"R_pair_smoothed = np.array([scipy.ndimage.gaussian_filter(R['pair'][:, :, i], sigma=2) for i in range(40)])"
]
},
{
"cell_type": "code",
"execution_count": 103,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAA14AAAOUCAYAAACyq+IgAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8rg+JYAAAACXBIWXMAAAsTAAALEwEAmpwYAAEAAElEQVR4nOzdd5xcZdk+8Ove3muSTe+VBAghJITeuzSRIk1BQZFXbPhir6++4g95RQVEjUFEihRBOtJrIAkhJKT3uptke2/P74890SVkrrO7mWd3Zuf6fj75ZHfuPTPPnDnXOfNMObc55yAiIiIiIiL+JPX1AERERERERPo7TbxEREREREQ808RLRERERETEM028REREREREPNPES0RERERExDNNvERERERERDzTxCuBmdmdZva9vh6HSH+kfIn4oWyJ+KN8+aWJVxwzM2dm4/e67Idm9teuLO+c+4Jz7ifBcseZ2ZaQ2zMz+4WZ7Q7+/cLMrOf3QCR29UG+jjezl8ysysw29HjgIjGuD7J1o5ktNbMaM1tvZjf2fPQisa0P8vVVM1tnZtVmts3MbjWzlJ7fg/5NEy/pjmsAnAvgYAAHAfgEgGv7ckAi/UgdgLkA9KRQJLoMwBUACgGcBuB6M7u4b4ck0m88DmCGcy4PwDR0PEf8ct8OKXZp4tWP7Xmlwsy+bmZlZrbdzD7bqT7PzH5qZtkAngYw1Mxqg39D93GVVwK4xTm3xTm3FcAtAD7TK3dGJMZEO1/OuXecc/cAWNeLd0Mk5njI1s3OuUXOuVbn3EoAjwE4svfukUjs8JCvtc65yj2LA2gHMH7vv5MOmnj1f4MB5AMYBuBqAL8zs8LOf+CcqwNwOoBtzrmc4N+2fVzXVADvd/r9/eAykUQVzXyJyH94yVbw8fijASzzM2yRuBDVfJnZp82sG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w5zLnXJNzbnfw80IAawFM7O2xicQ75UvEH+VLxA9lSxJFX7zjdRKAFc65LXsuMLOBAMqdc21mNhbABADrwq4od0objnkg8umcH7qjgC4/ZD0/VfrKc/mpJK2Zn+6zK80xGucOofX6wSGnOp/F31JPDuljsPUUfjpftPPT6aaV81PhZm3kt7/mu/yUxcPvD99Es27gpxRuDDnt/8FzttL68t2DQ8cQQ6KWr+bWFGzcWRixvvXlEXR5y+enzN39AT9dfMtg/qJla3b4i5rrPxW5lwsAjJvKT4lfMpP3Knlj6QQ+gJAhPrSCn3L/pJPeo/WH35jFbyDkpbXMsvDX3g7MCcnHrBJaf+2Zg2m9LT2uXpyOWr7ggCRyDNk5ne8bqyfw41fuWr7v3Hwiv/4hb4Y06QKwewq/jfIp/PiQE9IoYOBj/HTy5X/m+/aKhXx8LSP4PiprGT9dfM1ZfP+Q+3J4r6HSWXz7bxvEzwt+1/v81OfteeRxTIqp7EUvWwa45Mj37d4nj6WLZ47lz1ta3uKni88o5+u1enT4fvcn591H6z9achatN5aHtIMIeW6IkDPe/+lD3opk4IxSWt+ew9fhPWtCjm1p4afkt3y+/5i/jLecSrqB72MLcnmroUjPTH2eTv4+AG8BmGRmW8zs6qB0MT76VjIAHANgSXAK0YcAfME5xxvwiCQw5UvEH+VLxA9lSxKdz7MaXhLh8s/s47KHATzsaywi/Y3yJeKP8iXih7Ilia6vzmooIiIiIiKSMDTxEhERERER8UwTLxEREREREc808RIREREREfFMEy8RERERERHP+qKPV9TsrsrFvCdPiFhPLeB9CqpG87ufVM97MWRt5/PWhkHhPTJ2Tef1cX/nfQLWDeR9QjJ383Vw1VVP0fqf/nwGrTcM4b0USt7hvWBS3uWPQcWk8E20/NlRtJ525G5a3/at8bS+67IEfX2iIQkpS3MilvOOKKOLjy/
"text/plain": [
"<Figure size 864x936 with 16 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"fig, axs = plt.subplots(4, 4, figsize=(12, 13))\n",
"fig.tight_layout(w_pad=2)\n",
"for i, ax in enumerate(axs.flatten()):\n",
" ax.imshow(R['pair'][:, :, i], extent=(0, 360, 0, 180), aspect=2)\n",
" ax.set(xlabel=\"phase\", ylabel=\"orientation\", title=f\"Unit {i}\")"
]
},
{
"cell_type": "code",
"execution_count": 98,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAA14AAAOUCAYAAACyq+IgAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8rg+JYAAAACXBIWXMAAAsTAAALEwEAmpwYAADnrklEQVR4nOz9eZxtd13n+78/e6r5TDknycnESSAECBciRJCr2LR2t4jYgj8vDY2KikYUrvZtmxZUxIttd+u96q/tq2D8QQdtRZChoW1sRUTQK4NhCmEIJCGQhJNzkjPWvKfP74/aBysnZ38+u4Zv1a7ar+fjUY+qWt+99v7utdZnrfXdw3qbuwsAAAAAUE5luzsAAAAAALsdAy8AAAAAKIyBFwAAAAAUxsALAAAAAApj4AUAAAAAhTHwAgAAAIDCGHiNMDN7g5m9Zrv7AexG1BdQBrUFlEN9lcXAawczMzezx5w37ZfM7L8OMr+7v8zdf7k337PM7L7k8czMftXMTvR+ftXMbP3PABhe21Bf/9jMPmBmZ8zsnnV3HBhy21BbrzSz281s1sy+bGavXH/vgeG2DfX1f5jZ3WZ21sy+Zma/aWa19T+D3Y2BF9biJknPk/RkSU+S9N2Sfnw7OwTsIvOS3iSJk0Jgc5mkH5S0X9KzJb3CzF64vV0Cdo33SHqKu++R9EStnCP+1PZ2aXgx8NrFzr1SYWY/Y2bHzeyomf3wqvZbzOzfmdmUpD+TdJmZzfV+LrvAXb5E0q+7+33ufr+kX5f0Q1vyZIAhs9n15e4fc/c/kHT3Fj4NYOgUqK1fc/dPuHvb3e+Q9G5J37x1zwgYHgXq6y53P31udkldSY85/3ZYwcBr97tU0l5Jl0t6qaTfNrP9q2/g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
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"fig, axs = plt.subplots(4, 4, figsize=(12, 13))\n",
"fig.tight_layout(w_pad=2)\n",
"for i, ax in enumerate(axs.flatten()):\n",
" ax.imshow(R_pair_smoothed[i], extent=(0, 360, 0, 180), aspect=2)\n",
" ax.set(xlabel=\"phase\", ylabel=\"orientation\", title=f\"Unit {i}\")"
]
},
{
"cell_type": "code",
"execution_count": 113,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"Topological noise reduction: 100%|██████████| 100/100 [01:57<00:00, 1.18s/it]\n"
]
}
],
"source": [
"res = top_noise_reduction(pd.DataFrame(Rp.reshape((400, 40)))).to_numpy()"
]
},
{
"cell_type": "code",
"execution_count": 121,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"128.81601674915015"
]
},
"execution_count": 121,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"res[0][0]"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"##### Intermission: save variables to a file"
]
},
{
"cell_type": "code",
"execution_count": 132,
"metadata": {},
"outputs": [],
"source": [
"import pickle\n",
"with open('dump.pkl', 'wb') as f:\n",
" pickle.dump({k: globals()[k] for k in [\n",
" 'data_folder', 'stim_file', 'spike_times_file', 'key_symbol', \n",
" 'stim', 'num_trial', 'stim_val', 'trial_stim_id', 'key_list', 'stim_id_trial', 'num_stim', 'key', 'pair_id', 'trial_pair_id', 'pair_val', 'pair_trial_id',\n",
" 'spike_times', 'num_unit', 'num_spike', 'spike_count_rate', 'avg_firing_rate', 'firing_rate', 'stim_num_trial', 'stim_hist', 'optimal_avg_firing_rate',\n",
" 'latest_spike_time', 'dt', 'exp_time', 'B_stim', 'trials', 't_on', 't_off', 'B_spike', 'trial_range', 'units', 'orientation', 'phase', 'trial_spike_times',\n",
" 'delta_t_on', 'delta_t_off', 'subseq_trials', 'subseq_spike_times', 'subseq_spike_times_locked', 'time_range', 'unit_id_2', 'p1', 'p2', 'delta_t', 'time_range_smoothing',\n",
" 'period_1_dist', 'period_2_dist', 'period_3_dist', 'num_units', 'max_p_1', 'max_p_2', 'max_p_3', 'delta_2', 'delta_3', 't_p1', 't_p2', 'subseq_spike_times_locked_2',\n",
" 'B_spike_fixed', 'B_stim_original', 'B_spike_smooth', 'B_stim_total', 'R', 'R_pair_smoothed', 'Rp'\n",
" ]}, f)"
]
},
{
"cell_type": "code",
"execution_count": 12,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"dict_keys(['data_folder', 'stim_file', 'spike_times_file', 'key_symbol', 'stim', 'num_trial', 'stim_val', 'trial_stim_id', 'key_list', 'stim_id_trial', 'num_stim', 'key', 'pair_id', 'trial_pair_id', 'pair_val', 'pair_trial_id', 'spike_times', 'num_unit', 'num_spike', 'spike_count_rate', 'avg_firing_rate', 'firing_rate', 'stim_num_trial', 'stim_hist', 'optimal_avg_firing_rate', 'latest_spike_time', 'dt', 'exp_time', 'B_stim', 'trials', 't_on', 't_off', 'B_spike', 'trial_range', 'units', 'orientation', 'phase', 'trial_spike_times', 'delta_t_on', 'delta_t_off', 'subseq_trials', 'subseq_spike_times', 'subseq_spike_times_locked', 'time_range', 'unit_id_2', 'p1', 'p2', 'delta_t', 'time_range_smoothing', 'period_1_dist', 'period_2_dist', 'period_3_dist', 'num_units', 'max_p_1', 'max_p_2', 'max_p_3', 'delta_2', 'delta_3', 't_p1', 't_p2', 'subseq_spike_times_locked_2', 'B_spike_fixed', 'B_stim_original', 'B_spike_smooth', 'B_stim_total', 'R', 'R_pair_smoothed', 'Rp', 'firing_rates_noise_red', 'firing_rates_flat', 'firing_rates_in_trials', 'avg_firing_rates'])\n"
]
}
],
"source": [
"file = open(\"dump.pkl\", 'rb')\n",
"data = pkl.load(file)\n",
"print(data.keys())\n",
"for key, value in data.items():\n",
" globals()[key] = value\n",
"file.close()"
]
},
{
"cell_type": "code",
"execution_count": 131,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"__name__ __doc__ __package__ __loader__ __spec__ __builtin__ __builtins__ _ih _oh _dh In Out get_ipython exit quit _ __ ___ os sys __vsc_ipynb_file__ _i _ii _iii _i1 np plt pd scipy sts pkl widgets mplot3d Axes3D sparse cm cmap_hot cmap_viridis cmap_jet _i2 data_folder stim_file spike_times_file key_symbol _i3 stim num_trial stim_val trial_stim_id key_list stim_id_trial num_stim key pair_id trial_pair_id pair_val pair_trial_id i _i4 _4 _i5 _i6 _i7 _7 _i8 spike_times active num_unit _8 _i9 num_spike _i10 files file_name file data value spike_count_rate avg_firing_rate sem_firing_rate firing_rate stim_num_trial C_r_fphi_theta theta_hist phase_hist pair_hist corr_stim_unit optimal_avg_firing_rate stim_hist stim_hist_caution _i11 max_delay tau_id_range latest_spike_time latest_stim_offtime experiment_dur dt exp_time M _i12 B_stim stim_id trials s trial_id t_on t_off B_spike unit_id _i13 sorted_spike_num cutoff_num_spike _i14 t0 t1 stim_prev_id t_prev_on t_prev_off spikes _i15 gridspec fig ax gs0 ax0 ax1 ax2 ax3 _i16 ref_trial_id past_trials future_trials trial_range units orientation phase ref_id _i17 PSSH _i18 trial_spike_times delta_t_on delta_t_off subseq_trials subseq_spike_times subseq_spike_times_locked _i19 time_range _i20 subseq_spike_times_len chain _20 _i21 unit_id_2 _i22 stim_2diffs _i23 p1 p2 delta_t time_range_smoothing period_1_dist period_2_dist period_3_dist num_units j row hist _i24 _24 _i25 _25 _i26 max_p_1 max_p_2 max_p_3 delta_2 delta_3 _i27 t_p1 t_p2 fix_time _i28 _28 _i29 subseq_spike_times_locked_2 _i30 _i31 B_spike_fixed _i32 deepcopy B_stim_original _i33 _i34 get_trial_index _i35 B_spike_smooth _i36 _36 _i37 _37 _i38 _38 _i39 _39 _i40 _40 _i41 _41 _i42 B_stim_total _i43 _i44 R _i45 item u _i46 _i47 _i48 _i49 _i50 _i51 _51 _i52 _52 _i53 _53 _i54 _54 _i55 _i56 _56 _i57 _57 _i58 _58 _i59 _59 _i60 _60 _i61 _61 _i62 _62 _i63 _63 _i64 _64 _i65 _65 _i66 _66 _i67 R_pair_smoothed _i68 axs _i69 _i70 _i71 _i72 _i73 _i74 _i75 _i76 _i77 _i78 _i79 _i80 _i81 _i82 _i83 _i84 _i85 _i86 _i87 _i88 _i89 _i90 _i91 _i92 _i93 _i94 _i95 _i96 _i97 _i98 _i99 _i100 R1 item1 _i101 _i102 _i103 _i104 Rp _i105 _i106 _i107 _i108 _i109 top_noise_reduction _i110 _i111 _i112 _i113 res _i114 _114 _i115 _115 _i116 _116 _i117 _117 _i118 _118 _i119 _i120 _120 _i121 _121 _i122 pickle _i123 f _i124 _i125 _i126 _i127 _i128 _128 _i129 _129 _i130 _130 _i131\n"
]
}
],
"source": [
"print(*globals().keys())"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"##### Forward correlation"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": []
},
{
"cell_type": "code",
"execution_count": 17,
"metadata": {},
"outputs": [],
"source": [
"firing_rates_in_trials = [] # by pair, then by trial, then by neuron\n",
"firing_rates_flat = []\n",
"\n",
"for trial_ids in stim_id_trial['pair']:\n",
" row = []\n",
" for trial_id in trial_ids:\n",
" ind = round(get_trial_index(trial_id))\n",
" rr = []\n",
" for u in range(len(B_spike_smooth)):\n",
" rr.append(np.mean(B_spike_smooth[u][ind + 50:ind + 90]))\n",
" row.append(np.array(rr))\n",
" firing_rates_flat.append(np.array(rr))\n",
" firing_rates_in_trials.append(np.array(row))"
]
},
{
"cell_type": "code",
"execution_count": 18,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"(400, (50, 40))"
]
},
"execution_count": 18,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"firing_rates_flat = np.array(firing_rates_flat)\n",
"len(firing_rates_in_trials), firing_rates_in_trials[0].shape"
]
},
{
"cell_type": "code",
"execution_count": 19,
"metadata": {},
"outputs": [],
"source": [
"avg_firing_rates = np.array([np.mean(fr_pair, axis=0) for fr_pair in firing_rates_in_trials]).reshape((20, 20, 40))"
]
},
{
"cell_type": "code",
"execution_count": 20,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAA14AAAOUCAYAAACyq+IgAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8rg+JYAAAACXBIWXMAAAsTAAALEwEAmpwYAAEAAElEQVR4nOzdd3hc5Zk28PtR75Zkucjdxg0wYJoNoQQCoYeSsATSICGQxqZudlM3fbNhN8mXTsiGGBJCSCihBEILJXQM2MbgbtxtyZat3qXn+0PHiTCe+0iyXmlGc/+uy5el80x5Z+bc55x3ZnQec3eIiIiIiIhIOBnDPQAREREREZGRThMvERERERGRwDTxEhERERERCUwTLxERERERkcA08RIREREREQlMEy8REREREZHANPFKY2Z2nZl9dbjHITISKV8iYShbIuEoX2Fp4pXCzMzNbOY+y75uZr/ry/Xd/aPu/q3oeqeY2ZaY+zMz+56Z1UT/vmdmNvBHIJK8hiFfp5rZo2ZWZ2YbBjxwkSQ3DNn6vJktN7MGM3vdzD4/8NGLJLdhyNdnzGy9mdWb2TYz+6GZZQ38EYxsmnhJf1wN4EIARwA4HMA7AHxkOAckMoI0AbgBgA4KRQaXAfgAgDIAZwG4xswuHd4hiYwYdwM4yt1LAMxDzzHiJ4d3SMlLE68RbO87FWb2OTOrNrPtZvbBXvVFZvZtMysEcD+ACWbWGP2bsJ+bvBzA9919i7tvBfB9AFcMyYMRSTKDnS93f97dfwtg/RA+DJGkEyBb17r7S+7e6e6rANwF4IShe0QiySNAvta5e+3eqwPoBjBz38tJD028Rr7xAEYBmAjgSgA/M7Oy3hdw9yYAZwPY5u5F0b9t+7mtQwEs7fX70miZSLoazHyJyD8FyVb09fiTALwaZtgiKWFQ82Vm7zGzegC70POJ1y+Djj6FaeI18nUA+Ka7d7j7fQAaAcwZ4G0VAajr9XsdgCL9nZekscHMl4j8U6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y2nbSfwOtpzGz2fdWRB/yvCS1TG9lHJ4vXoBP2Xo+Kf5/ceuqENr0PJl3bwPTsVynp+aQ/ipXGsO5U2uGmbx081nlsTkF0DGBn5K3pyYsz1XHcPbGbTFnPK78nh+KvZNr/JGIJ/+xG20/oPreb4PeRc/1fSez0ykdQD42HseofVv/c/7+Q0s4NvJjefzU4LjJV4eYoOWL2TwHoHtFXy7VHUc365NeIJvO2sP4qdSLtwev+09/t1LaX3dXw+m9cYZMY2wtvNTrWfEtBLZczR/DgvXxvTRjDnlddvxvJ1DxtISWgcAn8q3YxntfDv63Orp/A5Sp0vXoGVrTHEDPn5i4u3WX/6D/wlZzcE8WzkxPSiz1/D9zrp3x/d3K+Fnc0fHKXW0vruAb1e7dvIeeg+28dPFVz7As7PnXY203lrF962LXngLrZe/ENMkE0DB+btofdc23uqkIXEnhp4x/HpgH6yGPJ38LQCeATDHzLaY2ZVR6VK88aNkADgZwLLoFKK3Afiou+8ONTaRVKd8iYSjfImEoWxJugt5VsPLEiy/Yj/Lbgdwe6ixiIw0ypdIOMqXSBjKlqS74TqroYiIiIiISNrQxEtERERERCQwTbxEREREREQC08RLREREREQkME28REREREREAhuOPl6DJqMDKNqceO7YzluAIGsn72NSxlvgoHU0f/qax/PrAwBi2gAUbeO9VLKaeC+GjtN5r4e8+3ifkbZy3gRkT0wrw9w9vJ7dxOudBfFNSNrKeN1inuPZN/J+EzuPie/FMhJltgMlpGNKVy5/3yavhj/xjZP5azvuSX77xRvj142aebyeW8fztfsQfh8H3VhF61t38z5ZmQt5AL7xxAW0nlPGn+NvTrq
"text/plain": [
"<Figure size 864x936 with 16 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"fig, axs = plt.subplots(4, 4, figsize=(12, 13))\n",
"fig.tight_layout(w_pad=2)\n",
"for i, ax in enumerate(axs.flatten()):\n",
" ax.imshow(avg_firing_rates[:, :, i], extent=(0, 360, 0, 180), aspect=2)\n",
" ax.set(xlabel=\"phase\", ylabel=\"orientation\", title=f\"Unit {i}\")"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [],
"source": [
"G_PAD = 5\n",
"\n",
"def gauss(img):\n",
" img_vpad = np.concatenate((img[-G_PAD:][::-1, ::-1], img, img[:G_PAD][::-1, ::-1]))\n",
" # pad horizontally too\n",
" img_vhpad = np.concatenate((img_vpad[:, :G_PAD][::-1], img_vpad, img_vpad[:, -G_PAD:][::-1]), axis=1)\n",
" return scipy.ndimage.gaussian_filter(img_vhpad, sigma=2, mode='wrap')[G_PAD:-G_PAD, G_PAD:-G_PAD]"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"(20, 20)"
]
},
"execution_count": 8,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"avg_fr_blur = np.array([gauss(avg_firing_rates[:, :, i]) for i in range(40)])\n",
"gauss(avg_firing_rates[:, :, 0]).shape"
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAA14AAAOUCAYAAACyq+IgAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8rg+JYAAAACXBIWXMAAAsTAAALEwEAmpwYAADqeklEQVR4nOzde5xsd1nn++9Tl75f9jXJzo0kEILAwQgMyCgOozNHRBzAw4sBUVEZI6McnRmHEVTEw4zO6Bn1jDMKxhdM0EFEuQgqjjKIMiogAWIIkEASQrJz2TvZ177X7Tl/dG1sdnY9T3V3/bqruz/v16tf3b1+tWr9atV61lq/uqyvubsAAAAAAOVUtrsDAAAAALDbMfACAAAAgMIYeAEAAABAYQy8AAAAAKAwBl4AAAAAUBgDLwAAAAAojIHXHmZmbzaz1293P4DdiPoCyqC2gHKor7IYeO1gZuZm9rjzpv2smf2PfuZ391e5+7/vzvccMzuaLM/M7B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a8FZyAMtk226aYbf5fDVPssI6ScxeltPVSjbfLAupneyCvJ6tw7i50syzhrJjoLU2d4wN45J2a+m1Te2zvZ/cymK8zxo5m7SfiRdfW9hcvqmUZ7DK4j42JpJzyyQfbmYkztl67MQjYftjRuP2S2rxShyzeMM+0Z4K2yWpmexg7qkdCNurtfiJytp74R0vAAAAACiMgRcAAAAAFMbACwAAAAAKY+AFAAAAAIUx8AIAAACAwhh4AQAAAEBhDLwAAAAAoLBiOV5m9lZJz5d03N2f3J32s5J+UNLD3Zv9pLt/oNv2OkmvlNSW9KPu/qfpQjzOwKgtxhk41VOL8WOYj9u
"text/plain": [
"<Figure size 864x936 with 16 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"fig, axs = plt.subplots(4, 4, figsize=(12, 13))\n",
"fig.tight_layout(w_pad=2)\n",
"for i, ax in enumerate(axs.flatten()):\n",
" ax.imshow(avg_fr_blur[i], extent=(0, 360, 0, 180), aspect=2)\n",
" ax.set(xlabel=\"phase\", ylabel=\"orientation\", title=f\"Unit {i}\")\n",
"avg_fr_blur = avg_fr_blur.swapaxes(0, 2).reshape((400, 40))"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"##### Topological noise reduction (not used)"
]
},
{
"cell_type": "code",
"execution_count": 109,
"metadata": {},
"outputs": [],
"source": [
"import sys\n",
"sys.path.insert(0, '../model')\n",
"from noisereduction import top_noise_reduction"
]
},
{
"cell_type": "code",
"execution_count": 149,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"Topological noise reduction: 100%|██████████| 100/100 [31:33<00:00, 18.93s/it]\n"
]
}
],
"source": [
"firing_rates_noise_red = top_noise_reduction(pd.DataFrame(firing_rates_flat[::5]))"
]
},
{
"cell_type": "code",
"execution_count": 150,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"(400, 40)"
]
},
"execution_count": 150,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"firing_rates_noise_red.shape"
]
},
{
"cell_type": "code",
"execution_count": 151,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"Topological noise reduction: 100%|██████████| 100/100 [3:44:17<00:00, 134.57s/it] \n"
]
}
],
"source": [
"firing_rates_noise_red = top_noise_reduction(pd.DataFrame(firing_rates_flat))"
]
},
{
"cell_type": "code",
"execution_count": 166,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"(2000, 40)"
]
},
"execution_count": 166,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"firing_rates_noise_red = firing_rates_noise_red.to_numpy()\n",
"firing_rates_noise_red.shape"
]
},
{
"cell_type": "code",
"execution_count": 167,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"False"
]
},
"execution_count": 167,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"firing_rates_noise_red[0] in firing_rates_flat"
]
},
{
"cell_type": "code",
"execution_count": 168,
"metadata": {},
"outputs": [],
"source": [
"from decoding import cohomological_parameterization"
]
},
{
"cell_type": "code",
"execution_count": 171,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAcoAAAGwCAYAAAApJSV7AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8rg+JYAAAACXBIWXMAAA9hAAAPYQGoP6dpAABi/0lEQVR4nO3deVxU9foH8M/MwAw7CMqmCOaeC7iB9KvcKKxuimmaWZp51W5WFpVbLtkNMLdWy5st1r2ZZpmV272IlpooCrivmVvKIiD7znx/f4wMjDODLDNzZuDzfr3mFfM9z5zzHI15POd8F5kQQoCIiIgMkkudABERkTVjoSQiIqoDCyUREVEdWCiJiIjqwEJJRERUBxZKIiKiOrBQEhER1cFO6gRslVqtxvXr1+Hq6gqZTCZ1OkRE1ABCCBQUFMDf3x9yed3XjCyUjXT9+nUEBARInQYRETXB1atX0a5duzpjWCgbyd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zYyjJCIi6xcbG4uXX34ZQ4cORXZ2ttTpWBwLJRG1COXl5UhLSwOKc4CSXABAWloaysvLpU3MytXu3frSSy/Vq3NkcyN5Zx4iInMrLy/H46MexYlD+7B7ghztPexxpc0QDFmegp69emPjxo1QKpVSp2l1WtIQkLqwUBJRs5ednY0Th/bizxslGPKVDF9HOWLi+z/iz5sCkMmRnZ0NPz8/qdO0KiySNXjrlYiaPT+nKuyeoMBdrWT486bAvV8W48+bAne1kmN3wk4Wydt89dVXLJK1sFASUfMnk6O9uxxfRzn
"text/plain": [
"<Figure size 640x480 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Decoding... done\n"
]
}
],
"source": [
"param = cohomological_parameterization(pd.DataFrame(firing_rates_noise_red[::5, ::5]))"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"##### PCA"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [],
"source": [
"from sklearn.decomposition import PCA\n",
"import seaborn as sns"
]
},
{
"cell_type": "code",
"execution_count": 19,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"<AxesSubplot:>"
]
},
"execution_count": 19,
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAWgAAAD8CAYAAABaZT40AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8rg+JYAAAACXBIWXMAAAsTAAALEwEAmpwYAAA5hUlEQVR4nO2de5wcZZX3v6fnksnkNoEECCSYAEFkUYREXtRVEbwEZGXXdRWQFbyhuCDgbfGy+IruZ0FcWdlV16xGRRHECJJXwwKLXGQ/ckkCBAi3JNwmhIRLEpJMJslMn/ePqoR2qHO6prtmpmdyvvn0Jz311FPP009VP1X9nPM7R1SVIAiCoPEoDXUHgiAIgmxigg6CIGhQYoIOgiBoUGKCD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W3nQgs6LPPU8AxACLyGpIJ+rl6ul9PTsJnReRpEXm1qj6SdmyZV2ffsm3Y2VTOXr6e5cT29RK5WvGbPUWgZwj80uJvmGXzX5ddb5LxmQC6y3ac3p/ck62SW1+yE5ve2mQnIp0q2Qq0w+gw64xT+9691FCENjkxkD3F2BixL8NNmm2UGu3U8Qx+mw0jYYehggP46ku2cXuG0Y9laserFmecHil5Y5g9kbQ6MZ89w51lJPTOlfdE19SIXrtajFJRVXtE5EzgeqAJmKeqD4rIBcAiVV0AfA74LxE5l8RgeJpqfR2o14vjLODy9I6yEvhInccLgiAojp7ipN6quhBY2Gfb+RXvl5EEkSuMuiZoVb0XmF1MV4IgCAompN5BEAQNyq4s9RaRc0XkQRF5QESuEDEWO4MgCIYC1XyvBqWejCr7AJ8BZqvqISQL5ycW1bEgCIK62cX
"text/plain": [
"<Figure size 432x288 with 2 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"fr_df = pd.DataFrame(firing_rates_flat)\n",
"sns.heatmap(fr_df.corr())"
]
},
{
"cell_type": "code",
"execution_count": 20,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"(400, 40)"
]
},
"execution_count": 20,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"avg_fr_blur.shape"
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"(400, 7)\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>0</th>\n",
" <th>1</th>\n",
" <th>2</th>\n",
" <th>3</th>\n",
" <th>4</th>\n",
" <th>5</th>\n",
" <th>6</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>-0.000578</td>\n",
" <td>-0.000424</td>\n",
" <td>-0.000689</td>\n",
" <td>0.000034</td>\n",
" <td>-0.000342</td>\n",
" <td>-0.000145</td>\n",
" <td>-0.000016</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>-0.000181</td>\n",
" <td>-0.000554</td>\n",
" <td>-0.000777</td>\n",
" <td>0.000153</td>\n",
" <td>-0.000264</td>\n",
" <td>-0.000231</td>\n",
" <td>0.000029</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>0.000059</td>\n",
" <td>-0.000686</td>\n",
" <td>-0.000693</td>\n",
" <td>0.000247</td>\n",
" <td>-0.000197</td>\n",
" <td>-0.000266</td>\n",
" <td>0.000044</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>0.000138</td>\n",
" <td>-0.000856</td>\n",
" <td>-0.000464</td>\n",
" <td>0.000301</td>\n",
" <td>-0.000142</td>\n",
" <td>-0.000259</td>\n",
" <td>0.000039</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>0.000134</td>\n",
" <td>-0.001063</td>\n",
" <td>-0.000163</td>\n",
" <td>0.000324</td>\n",
" <td>-0.000106</td>\n",
" <td>-0.000209</td>\n",
" <td>0.000031</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" 0 1 2 3 4 5 6\n",
"0 -0.000578 -0.000424 -0.000689 0.000034 -0.000342 -0.000145 -0.000016\n",
"1 -0.000181 -0.000554 -0.000777 0.000153 -0.000264 -0.000231 0.000029\n",
"2 0.000059 -0.000686 -0.000693 0.000247 -0.000197 -0.000266 0.000044\n",
"3 0.000138 -0.000856 -0.000464 0.000301 -0.000142 -0.000259 0.000039\n",
"4 0.000134 -0.001063 -0.000163 0.000324 -0.000106 -0.000209 0.000031"
]
},
"execution_count": 10,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"N_COMP = 7\n",
"pca = PCA(n_components=N_COMP)\n",
"pca.fit(avg_fr_blur)\n",
"data_pca = pca.transform(avg_fr_blur)\n",
"data_pca = pd.DataFrame(data_pca)\n",
"print(data_pca.shape)\n",
"data_pca.head()"
]
},
{
"cell_type": "code",
"execution_count": 22,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"(400, 50, 7)"
]
},
"execution_count": 22,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"firing_rates_in_trials_pca = []\n",
"for trials in firing_rates_in_trials:\n",
" firing_rates_in_trials_pca.append(pca.transform(pd.DataFrame(trials)))\n",
"firing_rates_in_trials_pca = np.array(firing_rates_in_trials_pca)\n",
"firing_rates_in_trials_pca.shape"
]
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {},
"outputs": [],
"source": [
"avg_firing_rates_pca = data_pca.to_numpy().reshape((20, 20, N_COMP))# np.mean(firing_rates_in_trials_pca, axis=1).reshape((20, 20, N_COMP))"
]
},
{
"cell_type": "code",
"execution_count": 24,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAA2EAAALUCAYAAACCfDpNAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8rg+JYAAAACXBIWXMAAAsTAAALEwEAmpwYAAByE0lEQVR4nO3de7xkd1nn++9Tt33ve9JJuluSQAgEhmuIcfCC4IwB0WTm8OIEZYyYMaNGBeWg4A1HxRFmjghzBI1DTHAwgAFNxmFmxACDjhAMCZeEENMGSLrTSSd93de6PuePWg07O929f8/uWmvtrvq8X69+9a61n/rtX61a61vr2av2KnN3AQAAAACKUSl7AgAAAAAwSmjCAAAAAKBANGEAAAAAUCCaMAAAAAAoEE0YAAAAABSIJgwAAAAACkQThnXHzP7QzH6t7H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q6L8Je7qk7zKz283sf5vZi7LlOyQ9tKxuT7YMAAaF/AFQBrIHwJPk+XbEE/28LZIulfQiSR82s9D5UTO7RtI1klTdsmnQ8wMwvAaaP43JzQOfIIChNNDsqW3bOPAJAihe0WfC9kj6qPd9TlJP0jZJeyXtWla3M1v2JO5+nbtf7O4XV6encp8wgKEx0PypjZM/AJIM9thnA9kDDIOim7C/lPS9kmRmT5fUkPS4pFslXWlmY2Z2nqQLJH2u4LkBGG5/KfIHQPH+UmQPgBVyezuimd0k6SWStpnZHklvlXS9pOuzS7e2JF3l7i7pHjP7sKSvSOpIujbl6kAAcDzkD4AykD0AUuXWhLn7a07wrdeeoP5tkt6W13wAjA7yB0AZyB4AqYp+OyIAAAAAjDSaMAAAAAAoEE0YAAAAABSIJgwAAAA
"text/plain": [
"<Figure size 864x864 with 6 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"\n",
"fig, axs = plt.subplots(2, 3, figsize=(12, 12))\n",
"fig.tight_layout(w_pad=2)\n",
"for i, ax in enumerate(axs.flatten()[:7]):\n",
" ax.imshow(avg_firing_rates_pca[:, :, i], extent=(0, 360, 0, 180), aspect=2)\n",
" ax.set(xlabel=\"phase\", ylabel=\"orientation\", title=f\"Unit {i}\")"
]
},
{
"cell_type": "code",
"execution_count": 12,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAA2EAAAL4CAYAAADyEv8AAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8rg+JYAAAACXBIWXMAAAsTAAALEwEAmpwYAABw60lEQVR4nO3de7wldXnn+++zLvvadxoQaRSIiEGPVyQ4jomRzBGNCcwcXx5MMiGGhElCLmYcE83NTBIz0ZkTo3PUhIwEzBjUoAlMxpnEoI6TE0URbyAaO4jS2NBA3/dtXeo5f6xqstl09/49u1f9avdan/fr1a/eq9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9Mknvd/cld/+GpJ2SLqqqbwBGG/kHQB3IPQBS5f5N2FMlvcjMbjOz/2Vmzy+nnynpvmVxu8ppADAs5B8AdSD3AHicKr+OeKz32ybpYknPl/RBMzs30oCZXS3paklqb9w69A4CGFlDzT9TzeB3eAGMq6HmnpnTY1/7ArA+5T4TtkvSh33gMxr8pGS7Bl+WPGtZ3A4d4wuU7n6tu1/o7hc2Z2Yr7zCAkTHU/DPRnK68wwBGwlBzz+TWqco7DKB6uYuwv5T0vZJkZk+VNCHpYUm3SLrCzCbN7BxJ50n6TOa+ARhtfynyD4D8/lLkHgArVPZ1RDO7UdKLJW03s12S3iTpOknXlZdu7Ui60t1d0l1m9kFJX5HUk3TNsK8OBGB8kH8A1IHcAyBVZUWYu7/6GE/9yDHi3yzpzVX1B8D4IP8AqAO5B0Cq3F9HBAAAAICxRhEGAAAAABlRhAEAAABARhRhAAAAAJBR7ps
"text/plain": [
"<Figure size 864x936 with 6 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"\n",
"fig, axs = plt.subplots(2, 3, figsize=(12, 13))\n",
"fig.tight_layout(w_pad=2)\n",
"for i, ax in enumerate(axs.flatten()):\n",
" ax.imshow(scipy.ndimage.gaussian_filter(avg_firing_rates_pca[:, :, i], sigma=2), extent=(0, 360, 0, 180), aspect=2)\n",
" ax.set(xlabel=\"phase\", ylabel=\"orientation\", title=f\"Unit {i}\")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"##### Point Cloud Simplification"
]
},
{
"cell_type": "code",
"execution_count": 52,
"metadata": {},
"outputs": [],
"source": [
"def radial_distance(X, eps, random_state=None):\n",
" \"\"\"\n",
" point cloud simplification using radial distance (euclidean metric). \n",
" Start with the first point in in X and mark it as a key point. All consecutive points that have a distance less than a predetermined distance eps to the key point are removed. The first point that have a distance greater than eps to the key point is marked as the new key point. The process repeates itself from this new key point, and continues until it reaches the end of the point cloud.\n",
" \n",
" Parameters\n",
" ----------\n",
" X: pandas DataFrame (n_datapoints, n_features):\n",
"\n",
" eps: max radial distance - cutoff distance\n",
"\n",
" random_state: seed of random generator used for choosing the inital point\n",
"\n",
" Returns\n",
" -------\n",
" X.iloc[ind_reduced]: dataframe with chosen datapoints \n",
" \"\"\"\n",
" if random_state is not None:\n",
" np.random.seed(random_state)\n",
" \n",
" ix0 = np.random.choice(X.shape[0])\n",
" x0 = X.iloc[ix0]\n",
" xt = x0\n",
" ixt = ix0\n",
" X_temp = X\n",
" ind_reduced = [ix0]\n",
"\n",
" while True:\n",
" dist = np.linalg.norm(X_temp.to_numpy() - xt.to_numpy(), axis=1)\n",
" cond = dist < eps\n",
"\n",
" X_temp = X_temp.drop(X_temp.index[np.where(cond)])\n",
" if len(X_temp)==0:\n",
" break\n",
"\n",
" where_not_cond = np.where(np.logical_not(cond))\n",
" w = np.argmin(dist[where_not_cond]) \n",
" ixt = X_temp.index[w]\n",
" xt = X.iloc[ixt]\n",
" ind_reduced.append(ixt)\n",
"\n",
" return X.iloc[ind_reduced], ind_reduced \n"
]
},
{
"cell_type": "code",
"execution_count": 107,
"metadata": {},
"outputs": [],
"source": [
"from tqdm import trange\n",
"from noisereduction import compute_gradient\n",
"def top_noise_reduction(X, n=100, omega=0.2, fraction=0.1, plot=False):\n",
" \"\"\"\n",
" Topological denoising algorithm as in arxiv:0910.5947\n",
" \n",
" Parameters\n",
" ----------\n",
" X: dataframe(n_datapoints, n_features):\n",
" Dataframe containing the data\n",
" n: int, optional, default 100\n",
" Number of iterations\n",
" omega: float, optional, default 0.2\n",
" Strength of the repulsive force between datapoints\n",
" fraction: float between 0 and 1, optional, default 0.1\n",
" The fraction of datapoints from which the denoised dataset is\n",
" constructed\n",
" plot: bool, optional, default False\n",
" When true plot the dataset and homology each iteration\n",
" \"\"\"\n",
" N = X.shape[0]\n",
" inds = np.random.choice(N, round(fraction*N), replace=False)\n",
" S = X.iloc[inds]\n",
" sigma = X.stack().std()\n",
" c = 0.02*np.max(scipy.spatial.distance.cdist(X, X, metric='euclidean'))\n",
" \n",
" iterator = trange(0, n, position=0, leave=True)\n",
" iterator.set_description(\"Topological noise reduction\")\n",
" for i in iterator:\n",
" gradF = compute_gradient(S.to_numpy(), X.to_numpy(), sigma, omega)\n",
" \n",
" if i == 0:\n",
" maxgradF = np.max(np.sqrt(np.square(gradF).sum(axis=1)))\n",
" S = S + c* gradF/maxgradF\n",
" \n",
" if plot:\n",
" fig = pyplot.figure()\n",
" ax = Axes3D(fig)\n",
" ax.scatter(X[0],X[1],X[2],alpha=0.1)\n",
" ax.scatter(S[0],S[1],S[2])\n",
" pyplot.show()\n",
" return S, inds"
]
},
{
"cell_type": "code",
"execution_count": 127,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"(414, 7)"
]
},
"execution_count": 127,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"fr_pca_simpl, inds_simpl = radial_distance(pd.DataFrame(firing_rates_in_trials_pca.reshape((400 * 50, -1))), 0.025)\n",
"fr_pca_simpl.shape"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"##### Plots"
]
},
{
"cell_type": "code",
"execution_count": 12,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"(400, 2)"
]
},
"execution_count": 12,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"param_corr = stim_val['pair'] # [np.array(inds_simpl) // 50]\n",
"param_corr.shape"
]
},
{
"cell_type": "code",
"execution_count": 13,
"metadata": {},
"outputs": [],
"source": [
"avg_firing_rates_pca_ = avg_firing_rates_pca.reshape((-1, N_COMP))"
]
},
{
"cell_type": "code",
"execution_count": 41,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAegAAAIICAYAAACl/H0TAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8rg+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nGYze+jOIN7iSd7l2et2Pv9GFrKGGfxDaYoxmXk8Sk/ac+t56/XiYVJIYiBD6cg9JBLPTjZRj9yqujiOksAxqtDiapzCZTGQe3ifb4glmXhq0ZxeWPGiJZ3zLJ9CDCfYTE06YMl+lpj8lznAP5SgFqHkjo3+KqMJZwdOvCnLndxKA9bwKwAVqcZkVlGWSngj3qAnPbibngzhFGd4kG6EEnJV+vyvEdBxqTb+3HSc3k3LUyTIl+4Ny7DjRALdG5Zh5rZTAAT4eudZ1uTKIcQ2plCephSjGgAvcS/h7CWZbQzBCDxixcodWQIYoDBFeYPPmc4ExjGE2tTJ3leLytSiMvs4Qn1q0Jz62fs+ZiXFCKQTNdjOaTpQ7T//QN3ICT5gKZ/ShaoUvaA6VShHA2rwLH3xwos2NMu3rBDTmUAtGlCbRgxnDAC++NKcEpSlEks5kqveeO4ikp28yVG88CGchTSmH174XNqJXkECCaAwe7ERQC1aEUQlujKUb9nGITYzisewkM4hltOYfkzjKXYwjaf5h2q0ud7dN7lKJBDHTCZyM434njupQiueZVmucu3pSSUKkcAuWtIk1/3ThNt
"text/plain": [
"<Figure size 576x576 with 15 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"%matplotlib inline\n",
"ncomp_disp = 5\n",
"fig = plt.figure(figsize=(8,8))\n",
"for j in range(ncomp_disp):\n",
" for i in range(j+1):\n",
" ax = fig.add_subplot(ncomp_disp,ncomp_disp, j + ncomp_disp*i + 1)\n",
" if i == j:\n",
" ax.scatter(\n",
" # param_corr[:, 0],\n",
" stim_val['pair'].reshape((-1, 2))[:, 0],\n",
" avg_firing_rates_pca_[:, i], s=1)\n",
" ax.set(xlabel='stim', ylabel='PC%d'%i)\n",
" else:\n",
" ax.scatter(avg_firing_rates_pca_[:, j], avg_firing_rates_pca_[:, i], s=1, c=stim_val['pair'].reshape((-1, 2))[:, 0], cmap='hsv')\n",
" \n",
" ax.set(xticks=[], yticks=[])\n",
" \n",
" if i==0 and j>0:\n",
" ax.set(xlabel='PC%d'%j)\n",
" ax.xaxis.set_label_position('top') \n",
"\n",
" if j==ncomp_disp-1 and i<ncomp_disp-1:\n",
" ax.set(ylabel='PC%d'%i)\n",
" ax.yaxis.set_label_position('right') \n",
"\n",
"fig.set_facecolor('white')\n",
"fig.suptitle('PCA')\n",
"plt.show()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"##### UMAP"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [],
"source": [
"from umap import UMAP"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [],
"source": [
"ncomp_umap = 4\n",
"embed = UMAP(n_components=ncomp_umap, n_neighbors=30, metric='euclidean').fit_transform(avg_firing_rates_pca_)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"param_corr[:, 0].max()"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "723e6a2e25e34392954a050ad7ba10a6",
"version_major": 2,
"version_minor": 0
},
"image/png": "iVBORw0KGgoAAAANSUhEUgAABaAAAALQCAYAAABmJdeHAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8rg+JYAAAACXBIWXMAAAsTAAALEwEAmpwYAAEAAElEQVR4nOzdd5hcV33/8fe5d8pW7UqrXmzLstxtMDbGxvQeSggtoQUISSiBQIAkPwiBAAmBEBICKRBCr6GFbnCCMQaMjY1xt5F7kSWrrdqWafee3x+zK0vyyiq7s/X98qPH2tk7d87MjmbP+dxzzjfEGJEkSZIkSZIkaaIlU90ASZIkSZIkSdLsZAAtSZIkSZIkSWoJA2hJkiRJkiRJUksYQEuSJEmSJEmSWsIAWpIkSZIkSZLUEgbQkiRJkiRJkqSWMICWJEmSJEmSJLWEAbQkSZIkSZIkqSUMoCVJkiRJkiRJLWE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FqtkiQJaZqSJAkhhKluliRJ0qyW5znVapVCobCnDyZJ0lxgAC1Jc0ij0aDRaFCpVPbcFkKgWCzuMxgykJYkSZoYMcZ9+mCj/awkSR7QB5MkaTYygJakOWDvgU8IgTRNiTESQiDGSK1Wo1qtAvcPhorFImmaEkIwkJYkSToCo/2sPM8B9vStYox7VqXt3wczkJYkzTYG0JI0y+V5Tr1eJ8/zMcPk0UB61N6BdAiBJEkoFAoG0pIkSYdh9OL/6EX/ve3fnxorkE7TdE//q1Ao2P+SJM1YBtCSNEvFGMmyjHq9DnDIs2j2DqRjjADUajVqtdqe8+wdSDs7R5Ik6X77rzwb7SuN9qvGMlYgnef5PtumjQbSozOkDaQlSTOFAbQkzUIxRur1OlmWjWv
"text/html": [
"\n",
" <div style=\"display: inline-block;\">\n",
" <div class=\"jupyter-widgets widget-label\" style=\"text-align: center;\">\n",
" Figure\n",
" </div>\n",
" <img src='data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAABaAAAALQCAYAAABmJdeHAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8rg+JYAAAACXBIWXMAAAsTAAALEwEAmpwYAAEAAElEQVR4nOzdd5hcV33/8fe5d8pW7UqrXmzLstxtMDbGxvQeSggtoQUISSiBQIAkPwiBAAmBEBICKRBCr6GFbnCCMQaMjY1xt5F7kSWrrdqWafee3x+zK0vyyiq7s/X98qPH2tk7d87MjmbP+dxzzjfEGJEkSZIkSZIkaaIlU90ASZIkSZIkSdLsZAAtSZIkSZIkSWoJA2hJkiRJkiRJUksYQEuSJEmSJEmSWsIAWpIkSZIkSZLUEgbQkiRJkiRJkqSWMICWJEmSJEmSJLWEAbQkSZIkSZIkqSUMoCVJkiRJkiRJLWEALUmSJEmSJElqCQNoSZIkSZIkSVJLGEBLkiRJkiRJklrCAFqSJEmSJEmS1BIG0JIkSZIkSZKkljCAliRJ0owXQoghhOP2u+1d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Cj/awkSR7QB5MkaTYygJakOWDvgU8IgTRNiTESQiDGSK1Wo1qtAvcPhorFImmaEkIwkJYkSToCo/2sPM8B9vStYox7VqXt3wczkJYkzTYG0JI0y+V5Tr1eJ8/zMcPk0UB61N6BdAiBJEkoFAoG0pIkSYdh9OL/6EX/ve3fnxorkE7TdE//q1Ao2P+SJM1YBtCSNEvFGMmyjHq9DnDIs2j2DqRjjADUajVqtdqe8+wdSDs7R5Ik6X77rzwb7SuN9qvGMlYgnef5Ptu
" </div>\n",
" "
],
"text/plain": [
"Canvas(toolbar=Toolbar(toolitems=[('Home', 'Reset original view', 'home', 'home'), ('Back', 'Back to previous …"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"Unhandled message type set_device_pixel_ratio. {'device_pixel_ratio': 0.8333333134651184, 'type': 'set_device_pixel_ratio'}\n",
"Unhandled message type set_device_pixel_ratio. {'device_pixel_ratio': 0.8333333134651184, 'type': 'set_device_pixel_ratio'}\n"
]
}
],
"source": [
"from mpl_toolkits import mplot3d\n",
"from mpl_toolkits.mplot3d import Axes3D\n",
"\n",
"%matplotlib inline\n",
"%matplotlib widget\n",
"\n",
"x, y, z, u = embed[:,0], embed[:,1], embed[:,2], embed[:,3] \n",
"\n",
"fig, ax = plt.subplots(1, 1, figsize=(20, 10))\n",
"# ax.scatter3D(x, y, z, c=np.array([param_corr[:, 0] / 180, [0] * param_corr.shape[0], param_corr[:, 1] / 360]).swapaxes(0, 1))\n",
"ax = fig.add_subplot(1, 2, 1, projection='3d')\n",
"ax.scatter3D(x, y, z, c=param_corr[:, 0], cmap=\"hsv\")\n",
"ax.set(xlabel=\"U0\", ylabel=\"U1\", zlabel=\"U2\", xticks=[], yticks=[], zticks=[])\n",
"ax = fig.add_subplot(1, 2, 2, projection='3d')\n",
"ax.scatter3D(x, y, z, c=param_corr[:, 1], cmap=\"hsv\")\n",
"ax.set(xlabel=\"U0\", ylabel=\"U1\", zlabel=\"U2\", xticks=[], yticks=[], zticks=[])\n",
"# ax = fig.add_subplot(2, 2, 3, projection='3d')\n",
"# ax.scatter3D(x, y, u, c=param_corr[:, 0], cmap=\"hsv\")\n",
"# ax.set(xlabel=\"U0\", ylabel=\"U1\", zlabel=\"U3\", xticks=[], yticks=[], zticks=[])\n",
"# ax = fig.add_subplot(2, 2, 4, projection='3d')\n",
"# ax.scatter3D(x, y, u, c=param_corr[:, 1], cmap=\"hsv\")\n",
"# ax.set(xlabel=\"U0\", ylabel=\"U1\", zlabel=\"U3\", xticks=[], yticks=[], zticks=[])\n",
"fig.suptitle('UMAP 3D')\n",
"plt.show()"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "cc2c2edbd8b8491ca20366c9839f92dc",
"version_major": 2,
"version_minor": 0
},
"image/png": "iVBORw0KGgoAAAANSUhEUgAABaAAAALQCAYAAABmJdeHAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8rg+JYAAAACXBIWXMAAAsTAAALEwEAmpwYAAEAAElEQVR4nOzdd3xkV3n/8c85905Rr9u77XXv3TRjTDMYYkOAYAglhBZIQhKSAEmAJOQXEhJSCIFQTYcQTDcYY2xccMEd2+u+9va+klajafee5/fHSNqm3ZV2Narfd14bLOnOzJ3RjOac75zzPM7MEBEREREREREREREZb36yT0BEREREREREREREZiYF0CIiIiIiIiIiIiJSFwqgRURERERERERERKQuFECLiIiIiIiIiIiISF0ogBYRERERERERERGRulAALSIiIiIiIiIiIiJ1oQBaREREREREREREROpCAbSIiIiIiIiIiIiI1IUCaBERERERERERERGpCwXQIiIiIiIiIiIiIlIXCqBFREREREREREREpC4UQIuIiIiIiIiIiIhIXSiAFhEREREREREREZG6UAAtIiIiIiIiIiIiInWhAFpEREREpj3nnDnnjtnnex92zn118L+fO3jMd/c55rTB79+wz/edc+5J59x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1oQBaREREREREREREROpCAbSIiIiIiIiIiIiI1IUCaBERERERERERERGpCwXQIiIiIiIiIiIiIlIXCqBFREREREREREREpC4UQIuIiIiIiIiIiIhIXSiAFhEREREREREREZG6UAAtIiIiIiIiIiIiInWhAFpERERERERERERE6kIBtIiIiIiIiIiIiIjUhQJoEREREREREREREakLBdAiIiIiIiIiIiIiUhcKoEVERERERERERESkLhRAi4iIiIiIiIiIiEhdKIAWERERERERERERkbpQAC0iIiIiIiIiIiIidaEAWkRERERERERERETqQgG0iIiIiIiIiIiIiNSFAmgRERERERERERERqQsF0CIiIiIiIiIiIiJSFwqgRURERERERERERKQuFECLiIiIiIiIiIiISF0ogBYRERERERERERGRulAALSIiIiIiIiIiIiJ1oQBaREREREREREREROpCAbSIiIiIiIiIiIiI1IUCaBERERERERERERGpCwXQIiIiIiIiIiIiIlIXCqBFREREREREREREpC4UQIuIiIiIiIiIiIhIXSiAFhEREREREREREZG6UAAtIiIiIiIiIiIiInWhAFpERERERERERERE6kIBtIiIiIiIiIiIiIjUhQJoEREREREREREREakLBdAiIiIiIiIiIiIiUhcKoEVERERERERERESkLhRAi4iIiIiIiIiIiEhdKIAWERERERERERERkbpQAC0iIiIiIiIiIiIidaEAWkRERERERERERETqQgG0iIiIiIiIiIiIiNSFAmgRERERERERERERqQsF0CIiIiIiIiIiIiJSFwqgRURERERERERERKQuFECLiIiIiIiIiIiISF0ogBYRERERERERERGRulAALSIiIiIiIiIiIiJ1oQBaREREREREREREROpCAbSIiIiIiIiIiIiI1IUCaJkUzrkvOOe2OOceOMDPnXPuP51zjzvn7nfOnTnR5ygiIiIiIiIiIiJHRgG0TJYrgRcf5OeXACsH/70N+NQEnJOIiIiIiIiIiIiMIwXQMinM7EZgx0EO+S3gy1ZzG9DunFswMWcnIiIiIiIiIiIi40EBtExVi4C1e3y9bvB7IiIiIiIiIiIiMk3Ek30CIkfKOfc2amU6aGpqOuv444+f5DMSEREREREREZk57rrrrm1mNmeyz0OmJwXQMlWtB5bs8fXiwe/tx8w+A3wG4Oyzz7Y777yz/mcnIiIiIiIiIjJLOOeenuxzkOlLJThkqvoB8AZXcz7Qa2YbJ/ukREREREREREREZPS0AlomhXPuG8BzgW7n3DrgQ0AGwMw+DVwNvAR4HBgA3jw5ZyoiIiIiIiIiIiKHSwG0TAoze+0hfm7AuybodERERERERERERKQOVIJDREREREREREREROpCAbSIiIiIiIiIiIiI1IUCaBERERERERERERGpCwXQIiIiIiIiIiIiIlIXCqBFREREREREREREpC4UQIuIiIiIiIiIiIhIXSiAFhEREREREREREZG6UAAtIiIiIiIiIiIiInWhAFpERERERERERERE6kIBtIiIiIiIiIiIiIjUhQJoEREREREREREREakLBdAiIiIiIiIiIiIiUhcKoEVERERERERERESkLhRAi4iIiIiIiIiIiEhdODOb7HMQGU96QouIiIiIiIiIjCPn3F1mdvZkn4dMT1oBLSIiIiIiIiIiIiJ1oQBaREREREREREREROpCAbSIiIiIiIiIiIiI1IUCaBERERERERERERGpCwXQIiIiIiIiIiIiIlIXCqBFREREREREREREpC4UQIuIiIiIiIiIiIhIXSiAFhEREREREREREZG6UAAtIiIiIiIiIiIiInWhAFpERERERERERERE6kIBtIiIiIiIiIiIiIjUhQJoEREREREREREREakLBdAiIiIiIiIiIiIiUhcKoEVERERERERERESkLhRAi4iIiIiIiIiIiEhdKIAWERERERERERERkbpQAC0iIiIiIiIiIiIidaEAWkRERERERERERETqQgG0iIiIiIiIiIiIiNSFAmgRERERERERERERqQsF0CIiIiIiIiIiIiJSFwqgRURERERERERERKQuFECLiIiIiIiIiIiISF0ogBYRERERERERERGRulAALSIiIiIiIiIiIiJ1oQBaREREREREREREROpCAbSIiIiIiIiIiIiI1IUCaBERERERERERERGpCwXQIiIiIiIiIiIiIlIXCqBFREREREREREREpC4UQIuIiIiIiIiIiIhIXSiAFhEREREREREREZG6UAAtIiIiIiI
"text/html": [
"\n",
" <div style=\"display: inline-block;\">\n",
" <div class=\"jupyter-widgets widget-label\" style=\"text-align: center;\">\n",
" Figure\n",
" </div>\n",
" <img src='data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAABaAAAALQCAYAAABmJdeHAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8rg+JYAAAACXBIWXMAAAsTAAALEwEAmpwYAAEAAElEQVR4nOzdd3xkV3n/8c85905Rr9u77XXv3TRjTDMYYkOAYAglhBZIQhKSAEmAJOQXEhJSCIFQTYcQTDcYY2xccMEd2+u+9va+klajafee5/fHSNqm3ZV2Narfd14bLOnOzJ3RjOac75zzPM7MEBEREREREREREREZb36yT0BEREREREREREREZiYF0CIiIiIiIiIiIiJSFwqgRURERERERERERKQuFECLiIiIiIiIiIiISF0ogBYRERERERERERGRulAALSIiIiIiIiIiIiJ1oQBaREREREREREREROpCAbSIiIiIiIiIiIiI1IUCaBERERERERERERGpCwXQIiIiIiIiIiIiIlIXCqBFREREREREREREpC4UQIuIiIiIiIiIiIhIXSiAFhEREREREREREZG6UAAtIiIiIiIiIiIiInWhAFpEREREpj3nnDnnjtnnex92zn118L+fO3jMd/c55rTB79+wz/edc+5J59xDI9zWDc65knOu3zm3zTl3lXNuwQHO65+dc2udc33Ouaedcx/Y42fLB2+7f/DfZufcj5xzLziCh0JEREREZEpRAC0iIiIis8VW4ALnXNce33sj8OgIxz4HmAsc5Zw7Z4Sfv9vMmoFjgXbg3w5wm58HjjezVuAZwOucc6/Y55j2wes6DbgW+K5z7k2ju0siIiIiIlObAmgRERERmS0qwPeA3wFwzkXAa4CvjXDsG4HvA1cP/veIzGwH8B3g5AP8/BEzK+zxrQAcc4BjN5nZfwAfBv7JOaexuoiIiIhMexrUioiIiMhs8mXgDYP//SLgAWDDngc45xqB36YWTH8N+B3nXHakK3POdQOvBO450A06597nnOsH1gFNwNcPcY5XUVt9fdyh7oyIiIiIyFSnAFpEREREZg0z+xXQ6Zw7jloQ/eURDnsFUAZ+BvwYyAAv3eeY/3TO9QD3ARuBPz3IbX4UaAHOBL4C9B7iNIcC8c5DHCciIiIiMuUpgBYRERGRmSClFhTvKQNURzj2K8C7gYuA747w8zcC/2tmiZmVqJXY2LcMxx+ZWbuZLTKz15nZ1oOdnNXcAxSBvz3EfVk0+L87DnGciIiIiMiUF0/2CYiIiIiIjIM1wHJg1R7fW8HIDQa/AjwOfNnMBpxzwz9wzi0Gngec65x75eC3G4G8c67bzLYd4XnGwNGHOOZyYAvwyBHeloiIiIjIpNMKaBERERGZCb4F/LVzbrFzzjvnng+8DPi/fQ80s9XAhcBfjXA9v0sttD4OOH3w37HU6je/diwnNHgeb3fOdbiac4F3Adcd4Ph5zrl3Ax8C3m9mYSy3JyIiIiIyFWkFtIiIiIjMBH83+O9moAN4AnidmT0w0sFmdvMBrueNwCfNbNOe33TOfXrwZ58Y43ldDvwjkKVW2/kTI1xHj6stwy4AdwKvMrOfjvF2RERERESmJGdmk30OIiIiIiIiIiIiIjIDqQSHiIiIiIiIiIiIiNSFAmgRERERERERERERqQsF0CIiIiIiIiIiIiJSFwqgRURERERERERERKQuFECLiIiIiIiIiIiISF0ogBYRERERERERERGRulAALSIiIiIiIiIiIiJ1oQBaREREREREREREROpCAbSIiIiIiIiIiIiI1IUCaBERERERERERERGpCwXQIiIiIiIiIiIiIlIXCqBFREREREREREREpC4UQIuIiIiIiIiIiIhIXSiAFhEREREREREREZG6UAAtIiIiIiIiIiIiInWhAFpERERERERERERE6kIBtIiIiIiIiIiIiIjUhQJoEREREREREREREakLBdAiIiIiIiIiIiIiUhcKoEVERERERERERESkLhRAi4iIiIiIiIiIiEhdKIAWERERERERERERkbpQAC0iIiIiIiIiIiIidaEAWkRERERERERERETqQgG0iIiIiIiIiIiIiNSFAmgRERERERERERERqQsF0CIiIiIiIiIiIiJSFwqgRURERERERERERKQuFECLiIiIiIiIiIiISF0ogBYRERERERERERGRulAALSIiIiIiIiIiIiJ1oQBaREREREREREREROpCAbSIiIiIiIiIiIiI1IUCaBERERERERERERGpCwXQIiIiIiIiIiIiIlIXCqBFREREREREREREpC4UQIuIiIiIiIiIiIhIXSiAFhEREREREREREZG6UAAtIiIiIiIiIiIiInWhAFpERERERERERERE6kIBtIiIiIiIiIiIiIjUhQJoEREREREREREREakLBdAiIiIiIiIiIiIiUhcKoEVERERERERERESkLhRAi4iIiIiIiIiIiEhdKIAWERERERERERERkbpQAC0iIiIiIiIiIiIidaEAWkRERERERERERETqQgG0iIiIiIiIiIiIiNSFAmgRERERERERERERqQsF0CIiIiIiIiIiIiJSFwqgRURERERERERERKQuFECLiIiIiIiIiIiISF0ogBYRERERERERERGRulAALSIiIiIiIiIiIiJ1oQBaREREREREREREROpCAbSIiIiIiIiIiIiI1IUCaJkUzrkvOOe2OOceOMDPnXPuP51zjzvn7nfOnTnR5ygiIiIiIiIiIiJHRgG0TJYrgRcf5OeXACsH/70N+NQEnJOIiIiIiIiIiIiMIwXQMinM7EZgx0EO+S3gy1ZzG9DunFswMWcnIiIiIiIiIiIi40EBtExVi4C1e3y9bvB7IiIiIiIiIiIiMk3Ek30CIkfKOfc2amU6aGpqOuv444+f5DMSEREREREREZk57rrrrm1mNmeyz0OmJwXQMlWtB5bs8fXiwe/tx8w+A3wG4Oyzz7Y777yz/mcnIiIiIiIiIjJLOOeenuxzkOlLJThkqvoB8AZXcz7Qa2YbJ/ukREREREREREREZPS0AlomhXPuG8BzgW7n3DrgQ0AGwMw+DVwNvAR4HBgA3jw5ZyoiIiIiIiIiIiKHSwG0TAoze+0hfm7AuybodERERERERERERKQOVIJDREREREREREREROpCAbSIiIiIiIiIiIiI1IUCaBERERERERERERGpCwXQIiIiIiIiIiIiIlIXCqBFREREREREREREpC4UQIuIiIiIiIiIiIhIXSiAFhEREREREREREZG6UAAtIiIiIiIiIiIiInWhAFpERERERERERERE6kIBtIiIiIiIiIiIiIjUhQJoEREREREREREREakLBdAiIiIiIiIiIiIiUhcKoEVERERERERERESkLhRAi4iIiIiIiIiIiEhdODOb7HMQGU96QouIiIiIiIiIjCPn3F1mdvZkn4dMT1oBLSIiIiIiIiIiIiJ1oQBaREREREREREREROpCAbSIiIiIiIiIiIiI1IUCaBERERERERERERGpCwXQIiIiIiIiIiIiIlIXCqBFREREREREREREpC4UQIuIiIiIiIiIiIhIXSiAFhEREREREREREZG6UAAtIiIiIiIiIiIiInWhAFpERERERERERERE6kIBtIiIiIiIiIiIiIjUhQJoEREREREREREREakLBdAiIiIiIiIiIiIiUhcKoEVERERERERERESkLhRAi4iIiIiIiIiIiEhdKIAWERERERERERERkbpQAC0iIiIiIiIiIiIidaEAWkRERERERERERETqQgG0iIiIiIiIiIiIiNSFAmgRERERERERERERqQsF0CIiIiIiIiIiIiJSFwqgRURERERERERERKQuFECLiIiIiIiIiIiISF0ogBYRERERERERERGRulAALSIiIiIiIiIiIiJ1oQBaREREREREREREROpCAbSIiIiIiIiIiIiI1IUCaBERERERERERERGpCwXQIiIiIiIiIiIiIlIXCqBFREREREREREREpC4UQIuIiIiIiIi
" </div>\n",
" "
],
"text/plain": [
"Canvas(toolbar=Toolbar(toolitems=[('Home', 'Reset original view', 'home', 'home'), ('Back', 'Back to previous …"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"Unhandled message type set_device_pixel_ratio. {'device_pixel_ratio': 0.8333333134651184, 'type': 'set_device_pixel_ratio'}\n",
"Unhandled message type set_device_pixel_ratio. {'device_pixel_ratio': 0.8333333134651184, 'type': 'set_device_pixel_ratio'}\n"
]
}
],
"source": [
"fig, ax = plt.subplots(1, 1, figsize=(20, 10))\n",
"# ax.scatter3D(x, y, z, c=np.array([param_corr[:, 0] / 180, [0] * param_corr.shape[0], param_corr[:, 1] / 360]).swapaxes(0, 1))\n",
"ax = fig.add_subplot(1, 2, 1, projection='3d')\n",
"ax.scatter3D(x, y, u, c=param_corr[:, 0], cmap=\"hsv\")\n",
"ax.set(xlabel=\"U0\", ylabel=\"U1\", zlabel=\"U3\", xticks=[], yticks=[], zticks=[])\n",
"ax = fig.add_subplot(1, 2, 2, projection='3d')\n",
"ax.scatter3D(x, y, u, c=param_corr[:, 1], cmap=\"hsv\")\n",
"ax.set(xlabel=\"U0\", ylabel=\"U1\", zlabel=\"U3\", xticks=[], yticks=[], zticks=[])\n",
"\n",
"fig.suptitle('UMAP 3D')\n",
"plt.show()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"##### Decoding"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [],
"source": [
"import decoding"
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAbgAAAGwCAYAAADbmXDeAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8rg+JYAAAACXBIWXMAAA9hAAAPYQGoP6dpAABQVUlEQVR4nO3deXhTZdoG8DtJ27TpEmihe1lKkb0tIEtxoZUii4JlQB2dgYLiCs4gbuCMAvop6iigAsMgKuLKjgqIQqEii7KUVUCBAkmhC5TuLV2S8/1xaNq0SdckJ8v9u65cQ968J3maqbl7Tt5FJgiCACIiIicjl7oAIiIia2DAERGRU2LAERGRU2LAERGRU2LAERGRU2LAERGRU2LAERGRU3KTugBb0+v1uHLlCnx9fSGTyaQuh4iImkkQBBQVFSE0NBRyufnzNJcLuCtXriAiIkLqMoiIqJW0Wi3Cw8PNPu5yAefr6wtAfGP8/PwkroaIiJoiIyMD99xzDy5evIgOHTpAo9EYPs/NcbmAq74s6efnx4AjInIQHh4eqKysRGRkJL7//nv06tWr0a+ZXC7giIjI8URFRSE1NRVKpRJqtbpJx3AUJRER2SWtVovt27cb7kdFRTVrDAUDjoiI7I5Wq0V8fDzuvfdeo5BrDgYcERHZlepwS09PR3h4OLp3796i52HAERGR3agdbpGRkUhNTW3x1C4GHBER2QVLhhvAgCMiIjuQk5Nj0XADJA64+fPnY8CAAfD19UVgYCCSk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TNfVznJcoiYgkpNFocPv
"text/plain": [
"<Figure size 640x480 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Decoding... done\n"
]
}
],
"source": [
"# param = decoding.cohomological_parameterization(pd.DataFrame(firing_rates_in_trials_pca.reshape((400*50, -1))[::41]))\n",
"param = decoding.cohomological_parameterization(pd.DataFrame(embed))\n"
]
},
{
"cell_type": "code",
"execution_count": 15,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"pandas.core.frame.DataFrame"
]
},
"execution_count": 15,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"type(param)"
]
},
{
"cell_type": "code",
"execution_count": 63,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"(788,)"
]
},
"execution_count": 63,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"param_corr[:, 0].shape"
]
},
{
"cell_type": "code",
"execution_count": 12,
"metadata": {},
"outputs": [
{
"ename": "ValueError",
"evalue": "'c' argument must be a color, a sequence of colors, or a sequence of numbers, not decoding\n0 0.728825\n1 0.728807\n2 0.728802\n3 0.729053\n4 0.729382\n.. ...\n395 0.988458\n396 0.917262\n397 0.913100\n398 0.974053\n399 0.055629\n\n[400 rows x 1 columns]",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mValueError\u001b[0m Traceback (most recent call last)",
"File \u001b[0;32m/usr/lib/python3.10/site-packages/matplotlib/axes/_axes.py:4350\u001b[0m, in \u001b[0;36mAxes._parse_scatter_color_args\u001b[0;34m(c, edgecolors, kwargs, xsize, get_next_color_func)\u001b[0m\n\u001b[1;32m 4349\u001b[0m \u001b[39mtry\u001b[39;00m: \u001b[39m# Is 'c' acceptable as PathCollection facecolors?\u001b[39;00m\n\u001b[0;32m-> 4350\u001b[0m colors \u001b[39m=\u001b[39m mcolors\u001b[39m.\u001b[39;49mto_rgba_array(c)\n\u001b[1;32m 4351\u001b[0m \u001b[39mexcept\u001b[39;00m (\u001b[39mTypeError\u001b[39;00m, \u001b[39mValueError\u001b[39;00m) \u001b[39mas\u001b[39;00m err:\n",
"File \u001b[0;32m/usr/lib/python3.10/site-packages/matplotlib/colors.py:385\u001b[0m, in \u001b[0;36mto_rgba_array\u001b[0;34m(c, alpha)\u001b[0m\n\u001b[1;32m 384\u001b[0m \u001b[39melse\u001b[39;00m:\n\u001b[0;32m--> 385\u001b[0m rgba \u001b[39m=\u001b[39m np\u001b[39m.\u001b[39marray([to_rgba(cc) \u001b[39mfor\u001b[39;00m cc \u001b[39min\u001b[39;00m c])\n\u001b[1;32m 387\u001b[0m \u001b[39mif\u001b[39;00m alpha \u001b[39mis\u001b[39;00m \u001b[39mnot\u001b[39;00m \u001b[39mNone\u001b[39;00m:\n",
"File \u001b[0;32m/usr/lib/python3.10/site-packages/matplotlib/colors.py:385\u001b[0m, in \u001b[0;36m<listcomp>\u001b[0;34m(.0)\u001b[0m\n\u001b[1;32m 384\u001b[0m \u001b[39melse\u001b[39;00m:\n\u001b[0;32m--> 385\u001b[0m rgba \u001b[39m=\u001b[39m np\u001b[39m.\u001b[39marray([to_rgba(cc) \u001b[39mfor\u001b[39;00m cc \u001b[39min\u001b[39;00m c])\n\u001b[1;32m 387\u001b[0m \u001b[39mif\u001b[39;00m alpha \u001b[39mis\u001b[39;00m \u001b[39mnot\u001b[39;00m \u001b[39mNone\u001b[39;00m:\n",
"File \u001b[0;32m/usr/lib/python3.10/site-packages/matplotlib/colors.py:206\u001b[0m, in \u001b[0;36mto_rgba\u001b[0;34m(c, alpha)\u001b[0m\n\u001b[1;32m 205\u001b[0m \u001b[39mif\u001b[39;00m rgba \u001b[39mis\u001b[39;00m \u001b[39mNone\u001b[39;00m: \u001b[39m# Suppress exception chaining of cache lookup failure.\u001b[39;00m\n\u001b[0;32m--> 206\u001b[0m rgba \u001b[39m=\u001b[39m _to_rgba_no_colorcycle(c, alpha)\n\u001b[1;32m 207\u001b[0m \u001b[39mtry\u001b[39;00m:\n",
"File \u001b[0;32m/usr/lib/python3.10/site-packages/matplotlib/colors.py:277\u001b[0m, in \u001b[0;36m_to_rgba_no_colorcycle\u001b[0;34m(c, alpha)\u001b[0m\n\u001b[1;32m 276\u001b[0m \u001b[39mreturn\u001b[39;00m c, c, c, alpha \u001b[39mif\u001b[39;00m alpha \u001b[39mis\u001b[39;00m \u001b[39mnot\u001b[39;00m \u001b[39mNone\u001b[39;00m \u001b[39melse\u001b[39;00m \u001b[39m1.\u001b[39m\n\u001b[0;32m--> 277\u001b[0m \u001b[39mraise\u001b[39;00m \u001b[39mValueError\u001b[39;00m(\u001b[39mf\u001b[39m\u001b[39m\"\u001b[39m\u001b[39mInvalid RGBA argument: \u001b[39m\u001b[39m{\u001b[39;00morig_c\u001b[39m!r}\u001b[39;00m\u001b[39m\"\u001b[39m)\n\u001b[1;32m 278\u001b[0m \u001b[39m# turn 2-D array into 1-D array\u001b[39;00m\n",
"\u001b[0;31mValueError\u001b[0m: Invalid RGBA argument: 'decoding'",
"\nThe above exception was the direct cause of the following exception:\n",
"\u001b[0;31mValueError\u001b[0m Traceback (most recent call last)",
"\u001b[1;32m/home/ennucore/dev/amgen/exp/ProcessExp.ipynb Cell 115\u001b[0m in \u001b[0;36m<cell line: 1>\u001b[0;34m()\u001b[0m\n\u001b[0;32m----> <a href='vscode-notebook-cell:/home/ennucore/dev/amgen/exp/ProcessExp.ipynb#ch0000097?line=0'>1</a>\u001b[0m plt\u001b[39m.\u001b[39;49mscatter(param_corr[:, \u001b[39m0\u001b[39;49m], param_corr[:, \u001b[39m1\u001b[39;49m], c\u001b[39m=\u001b[39;49mparam)\n",
"File \u001b[0;32m/usr/lib/python3.10/site-packages/matplotlib/pyplot.py:3068\u001b[0m, in \u001b[0;36mscatter\u001b[0;34m(x, y, s, c, marker, cmap, norm, vmin, vmax, alpha, linewidths, edgecolors, plotnonfinite, data, **kwargs)\u001b[0m\n\u001b[1;32m 3063\u001b[0m \u001b[39m@_copy_docstring_and_deprecators\u001b[39m(Axes\u001b[39m.\u001b[39mscatter)\n\u001b[1;32m 3064\u001b[0m \u001b[39mdef\u001b[39;00m \u001b[39mscatter\u001b[39m(\n\u001b[1;32m 3065\u001b[0m x, y, s\u001b[39m=\u001b[39m\u001b[39mNone\u001b[39;00m, c\u001b[39m=\u001b[39m\u001b[39mNone\u001b[39;00m, marker\u001b[39m=\u001b[39m\u001b[39mNone\u001b[39;00m, cmap\u001b[39m=\u001b[39m\u001b[39mNone\u001b[39;00m, norm\u001b[39m=\u001b[39m\u001b[39mNone\u001b[39;00m,\n\u001b[1;32m 3066\u001b[0m vmin\u001b[39m=\u001b[39m\u001b[39mNone\u001b[39;00m, vmax\u001b[39m=\u001b[39m\u001b[39mNone\u001b[39;00m, alpha\u001b[39m=\u001b[39m\u001b[39mNone\u001b[39;00m, linewidths\u001b[39m=\u001b[39m\u001b[39mNone\u001b[39;00m, \u001b[39m*\u001b[39m,\n\u001b[1;32m 3067\u001b[0m edgecolors\u001b[39m=\u001b[39m\u001b[39mNone\u001b[39;00m, plotnonfinite\u001b[39m=\u001b[39m\u001b[39mFalse\u001b[39;00m, data\u001b[39m=\u001b[39m\u001b[39mNone\u001b[39;00m, \u001b[39m*\u001b[39m\u001b[39m*\u001b[39mkwargs):\n\u001b[0;32m-> 3068\u001b[0m __ret \u001b[39m=\u001b[39m gca()\u001b[39m.\u001b[39;49mscatter(\n\u001b[1;32m 3069\u001b[0m x, y, s\u001b[39m=\u001b[39;49ms, c\u001b[39m=\u001b[39;49mc, marker\u001b[39m=\u001b[39;49mmarker, cmap\u001b[39m=\u001b[39;49mcmap, norm\u001b[39m=\u001b[39;49mnorm,\n\u001b[1;32m 3070\u001b[0m vmin\u001b[39m=\u001b[39;49mvmin, vmax\u001b[39m=\u001b[39;49mvmax, alpha\u001b[39m=\u001b[39;49malpha, linewidths\u001b[39m=\u001b[39;49mlinewidths,\n\u001b[1;32m 3071\u001b[0m edgecolors\u001b[39m=\u001b[39;49medgecolors, plotnonfinite\u001b[39m=\u001b[39;49mplotnonfinite,\n\u001b[1;32m 3072\u001b[0m \u001b[39m*\u001b[39;49m\u001b[39m*\u001b[39;49m({\u001b[39m\"\u001b[39;49m\u001b[39mdata\u001b[39;49m\u001b[39m\"\u001b[39;49m: data} \u001b[39mif\u001b[39;49;00m data \u001b[39mis\u001b[39;49;00m \u001b[39mnot\u001b[39;49;00m \u001b[39mNone\u001b[39;49;00m \u001b[39melse\u001b[39;49;00m {}), \u001b[39m*\u001b[39;49m\u001b[39m*\u001b[39;49mkwargs)\n\u001b[1;32m 3073\u001b[0m sci(__ret)\n\u001b[1;32m 3074\u001b[0m \u001b[39mreturn\u001b[39;00m __ret\n",
"File \u001b[0;32m/usr/lib/python3.10/site-packages/matplotlib/__init__.py:1361\u001b[0m, in \u001b[0;36m_preprocess_data.<locals>.inner\u001b[0;34m(ax, data, *args, **kwargs)\u001b[0m\n\u001b[1;32m 1358\u001b[0m \u001b[39m@functools\u001b[39m\u001b[39m.\u001b[39mwraps(func)\n\u001b[1;32m 1359\u001b[0m \u001b[39mdef\u001b[39;00m \u001b[39minner\u001b[39m(ax, \u001b[39m*\u001b[39margs, data\u001b[39m=\u001b[39m\u001b[39mNone\u001b[39;00m, \u001b[39m*\u001b[39m\u001b[39m*\u001b[39mkwargs):\n\u001b[1;32m 1360\u001b[0m \u001b[39mif\u001b[39;00m data \u001b[39mis\u001b[39;00m \u001b[39mNone\u001b[39;00m:\n\u001b[0;32m-> 1361\u001b[0m \u001b[39mreturn\u001b[39;00m func(ax, \u001b[39m*\u001b[39;49m\u001b[39mmap\u001b[39;49m(sanitize_sequence, args), \u001b[39m*\u001b[39;49m\u001b[39m*\u001b[39;49mkwargs)\n\u001b[1;32m 1363\u001b[0m bound \u001b[39m=\u001b[39m new_sig\u001b[39m.\u001b[39mbind(ax, \u001b[39m*\u001b[39margs, \u001b[39m*\u001b[39m\u001b[39m*\u001b[39mkwargs)\n\u001b[1;32m 1364\u001b[0m auto_label \u001b[39m=\u001b[39m (bound\u001b[39m.\u001b[39marguments\u001b[39m.\u001b[39mget(label_namer)\n\u001b[1;32m 1365\u001b[0m \u001b[39mor\u001b[39;00m bound\u001b[39m.\u001b[39mkwargs\u001b[39m.\u001b[39mget(label_namer))\n",
"File \u001b[0;32m/usr/lib/python3.10/site-packages/matplotlib/axes/_axes.py:4516\u001b[0m, in \u001b[0;36mAxes.scatter\u001b[0;34m(self, x, y, s, c, marker, cmap, norm, vmin, vmax, alpha, linewidths, edgecolors, plotnonfinite, **kwargs)\u001b[0m\n\u001b[1;32m 4513\u001b[0m \u001b[39mif\u001b[39;00m edgecolors \u001b[39mis\u001b[39;00m \u001b[39mNone\u001b[39;00m:\n\u001b[1;32m 4514\u001b[0m orig_edgecolor \u001b[39m=\u001b[39m kwargs\u001b[39m.\u001b[39mget(\u001b[39m'\u001b[39m\u001b[39medgecolor\u001b[39m\u001b[39m'\u001b[39m, \u001b[39mNone\u001b[39;00m)\n\u001b[1;32m 4515\u001b[0m c, colors, edgecolors \u001b[39m=\u001b[39m \\\n\u001b[0;32m-> 4516\u001b[0m \u001b[39mself\u001b[39;49m\u001b[39m.\u001b[39;49m_parse_scatter_color_args(\n\u001b[1;32m 4517\u001b[0m c, edgecolors, kwargs, x\u001b[39m.\u001b[39;49msize,\n\u001b[1;32m 4518\u001b[0m get_next_color_func\u001b[39m=\u001b[39;49m\u001b[39mself\u001b[39;49m\u001b[39m.\u001b[39;49m_get_patches_for_fill\u001b[39m.\u001b[39;49mget_next_color)\n\u001b[1;32m 4520\u001b[0m \u001b[39mif\u001b[39;00m plotnonfinite \u001b[39mand\u001b[39;00m colors \u001b[39mis\u001b[39;00m \u001b[39mNone\u001b[39;00m:\n\u001b[1;32m 4521\u001b[0m c \u001b[39m=\u001b[39m np\u001b[39m.\u001b[39mma\u001b[39m.\u001b[39mmasked_invalid(c)\n",
"File \u001b[0;32m/usr/lib/python3.10/site-packages/matplotlib/axes/_axes.py:4359\u001b[0m, in \u001b[0;36mAxes._parse_scatter_color_args\u001b[0;34m(c, edgecolors, kwargs, xsize, get_next_color_func)\u001b[0m\n\u001b[1;32m 4356\u001b[0m \u001b[39mraise\u001b[39;00m invalid_shape_exception(c\u001b[39m.\u001b[39msize, xsize) \u001b[39mfrom\u001b[39;00m \u001b[39merr\u001b[39;00m\n\u001b[1;32m 4357\u001b[0m \u001b[39m# Both the mapping *and* the RGBA conversion failed: pretty\u001b[39;00m\n\u001b[1;32m 4358\u001b[0m \u001b[39m# severe failure => one may appreciate a verbose feedback.\u001b[39;00m\n\u001b[0;32m-> 4359\u001b[0m \u001b[39mraise\u001b[39;00m \u001b[39mValueError\u001b[39;00m(\n\u001b[1;32m 4360\u001b[0m \u001b[39mf\u001b[39m\u001b[39m\"\u001b[39m\u001b[39m'\u001b[39m\u001b[39mc\u001b[39m\u001b[39m'\u001b[39m\u001b[39m argument must be a color, a sequence of colors, \u001b[39m\u001b[39m\"\u001b[39m\n\u001b[1;32m 4361\u001b[0m \u001b[39mf\u001b[39m\u001b[39m\"\u001b[39m\u001b[39mor a sequence of numbers, not \u001b[39m\u001b[39m{\u001b[39;00mc\u001b[39m}\u001b[39;00m\u001b[39m\"\u001b[39m) \u001b[39mfrom\u001b[39;00m \u001b[39merr\u001b[39;00m\n\u001b[1;32m 4362\u001b[0m \u001b[39melse\u001b[39;00m:\n\u001b[1;32m 4363\u001b[0m \u001b[39mif\u001b[39;00m \u001b[39mlen\u001b[39m(colors) \u001b[39mnot\u001b[39;00m \u001b[39min\u001b[39;00m (\u001b[39m0\u001b[39m, \u001b[39m1\u001b[39m, xsize):\n\u001b[1;32m 4364\u001b[0m \u001b[39m# NB: remember that a single color is also acceptable.\u001b[39;00m\n\u001b[1;32m 4365\u001b[0m \u001b[39m# Besides *colors* will be an empty array if c == 'none'.\u001b[39;00m\n",
"\u001b[0;31mValueError\u001b[0m: 'c' argument must be a color, a sequence of colors, or a sequence of numbers, not decoding\n0 0.728825\n1 0.728807\n2 0.728802\n3 0.729053\n4 0.729382\n.. ...\n395 0.988458\n396 0.917262\n397 0.913100\n398 0.974053\n399 0.055629\n\n[400 rows x 1 columns]"
]
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAi4AAAGiCAYAAADA0E3hAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8rg+JYAAAACXBIWXMAAA9hAAAPYQGoP6dpAAAcw0lEQVR4nO3db2zdVf3A8U/b0VsItEzn2m0WKyiiAhturBYkiKk2gUz3wDjBbHPhj+AkuEZlY7CK6DoRyKIrLkwQH6ibEDDGLUOsLgapWdjWBGSDwMBNYwsT184iLWu/vweG+qvrYLf0z077eiX3wY7n3O+5Hkbf3H8tyLIsCwCABBSO9QYAAI6VcAEAkiFcAIBkCBcAIBnCBQBIhnABAJIhXACAZAgXACAZwgUASIZwAQCSkXe4/OEPf4h58+bF9OnTo6CgIH75y1++5Zpt27bFRz7ykcjlcvG+970v7r///iFsFQCY6PIOl66urpg5c2Y0NTUd0/wXXnghLrvssrjkkkuitbU1vvrVr8ZVV10VjzzySN6bBQAmtoK380sWCwoK4uGHH4758+cfdc6NN94Ymzdvjqeeeqp/7POf/3wcPHgwtm7dOtRLAwAT0KSRvkBLS0vU1tYOGKurq4uvfvWrR13T3d0d3d3d/X/u6+uLV155Jd75zndGQUHBSG0VABhGWZbFoUOHYvr06VFYODxvqx3xcGlra4vy8vIBY+Xl5dHZ2Rn//ve/48QTTzxiTWNjY9x6660jvTUAYBTs378/3v3udw/LfY14uAzFihUror6+vv/PHR0dcdppp8X+/fujtLR0DHcGAByrzs7OqKysjFNOOWXY7nPEw6WioiLa29sHjLW3t0dpaemgz7ZERORyucjlckeMl5aWChcASMxwvs1jxL/HpaamJpqbmweMPfroo1FTUzPSlwYAxpm8w+Vf//pXtLa2Rmtra0T85+POra2tsW/fvoj4z8s8ixYt6p9/7bXXxt69e+Mb3/hG7NmzJ+6+++74xS9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+/eePDBB6O3tze2bNkSt9xyS9x5553x7W9/+6jXaWxsjLKysv5bZWVlPtsEAMapEf9UUV9fX0ydOjXuueeemD17dixYsCBWrlwZ69evP+qaFStWREdHR/9t//79I71NACABeb05d8qUKVFUVBTt7e0Dxtvb26OiomLQNdOmTYsTTjghioqK+sc++MEPRltbW/T09ERxcfERa3K5XORyuXy2BgBMAHk941JcXByzZ8+O5ubm/rG+vr5obm6OmpqaQddceOGF8dxzz0VfX1//2LPPPhvTpk0bNFoAAI4m75eK6uvrY8OGDfGTn/wkdu/eHdddd110dXXFkiVLIiJi0aJFsWLFiv751113Xbzyyitxww03xLPPPhubN2+O1atXx9KlS4fvUQAAE0Le3+OyYMGCePnll2PVqlXR1tYWs2bNiq1bt/a/YXffvn1RWPjfHqqsrIxHHnkkli1bFueee27MmDEjbrjhhrjxxhuH71EAABNC3t/jMhZ8jwsApGfMv8cFAGAsCRcAIBnCBQBIhnABAJIhXACAZAgXACAZwgUASIZwAQCSIVwAgGQIFwAgGcIFAEiGcAEAkiFcAIBkCBcAIBnCBQBIhnABAJIhXACAZAgXACAZwgUASIZwAQCSIVwAgGQIFwAgGcIFAEiGcAEAkiFcAIBkCBcAIBnCBQBIhnABAJIhXACAZAgXACAZwgUASIZwAQCSIVwAgGQIFwAgGcIFAEiGcAEAkiFcAIBkCBcAIBnCBQBIhnABAJIhXACAZAgXACAZwgUASIZwAQCSIVwAgGQIFwAgGcIFAEiGcAEAkiFcAIBkCBcAIBn
"text/plain": [
"<Figure size 640x480 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"plt.scatter(param_corr[:, 0], param_corr[:, 1], c=param)"
]
},
{
"cell_type": "code",
"execution_count": 14,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"<matplotlib.collections.PathCollection at 0x7f35ae6ef310>"
]
},
"execution_count": 14,
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAiQAAAGdC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Czo4AQHPbhZC83RQMJiRERKQ70UWnh05+i76e6pK64tQQOX4WtRIREelEdNGp6Iu6yPFHa1ErExIiItKd6IRB9EVd5Pjdu/0Gwt1+iYiINCA6YXBf1P2VkZgQ3EVd5PhjzCbMzglcEDs7Jy2iurQCTEiIiMgAootOY8wmlMzKChhTMitL9UVdZMLjdEnY/nnggtjtn9tCsqlbMFQlJGvXrkVGRgbi4+ORl5eHioqKgPFr1qzBlVdeiQEDBiA9PR2PP/442tsjqxiHiIjkE110CgCF2WkoyErp9XsFWSlBLcvtnvD4249XbcLTV30KELpN3YKhOCHZsmULioqKUFJSgsrKSuTk5GDGjBmor6/vNf6NN97AsmXLUFJSgiNHjmDjxo3YsmULnnzyyaAHT0RE+tB6x1zfXWyDjetN6a5q7K7u/dq0u7oepbuqVR8b6Ep41t03CVafeg+rJR7r7pukOuGJ1lU2ihujrV69GgsXLsSCBQsAAOvXr8fOnTuxadMmLFu2rEf8gQMHcN111+Gee+4BAGRkZGDu3Ln4+OOPgxw6ERHpQUTzr3qZiYbcOF+dF114dX9twJhX99fiiVvGIraf+uqFwuw0TM+yatqplatsZOjs7MShQ4dQUFDw3QHMZhQUFKC8vLzX51x77bU4dOiQ57bO8ePHsWvXLsycOdPvz+no6EBLS4vXFxER6U9U86/qMw5N43z99sAJSH1M4khSV1ywYswm5I8ZhtsnjED+mGF
"text/plain": [
"<Figure size 640x480 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"plt.scatter(param_corr[:, 0], param)"
]
},
{
"cell_type": "code",
"execution_count": 36,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"/usr/lib/python3.10/site-packages/seaborn/distributions.py:2619: FutureWarning: `distplot` is a deprecated function and will be removed in a future version. Please adapt your code to use either `displot` (a figure-level function with similar flexibility) or `histplot` (an axes-level function for histograms).\n",
" warnings.warn(msg, FutureWarning)\n"
]
},
{
"data": {
"text/plain": [
"<AxesSubplot:ylabel='Density'>"
]
},
"execution_count": 36,
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAkQAAAGdCAYAAADzOWwgAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8rg+JYAAAACXBIWXMAAA9hAAAPYQGoP6dpAABJKklEQVR4nO3de1xUdf4/8NdcmBluMwjCAAFK3im1NMPZbmvxFY22i7qb5aaV2epi39Svaf62r7XWZlvfMruotZXYt+zifs1KSyO8VeKNQk0TbyQmDKDIDNcBZj6/P4Y5OooXEDgzc17Px2MewjmfOfP+qDO8+JzP5xyVEEKAiIiISMHUchdAREREJDcGIiIiIlI8BiIiIiJSPAYiIiIiUjwGIiIiIlI8BiIiIiJSPAYiIiIiUjwGIiIiIlI8rdwF+AOXy4Xi4mKEh4dDpVLJXQ4RERFdAiEEqqqqEB8fD7X6wmNADESXoLi4GImJiXKXQURERG1w7NgxJCQkXLANA9ElCA8PB+D+CzUajTJXQ0RERJfCbrcjMTFR+jl+IQxEl8BzmsxoNDIQERER+ZlLme7CSdVERESkeAxEREREpHgMRERERKR4DERERESkeAxEREREpHgMRERERKR4DERERESkeAxEREREpHgMRERERKR4DERERESkeAxEREREpHgMRERERKR4DERERESkeAxEREREpHhauQsgIpLb8m1FF9x/f2pSJ1VCRHLhCBEREREpHgMRERERKR4DERERESkeAxEREREpnqyBqHv37lCpVOc8MjMzAQD19fXIzMxEVFQUwsLCMHr0aJSWlnodo6ioCBkZGQgJCUFMTAyeeOIJNDU1ebXZuHEjBg0aBL1ej549eyIrK6uzukhERER+QNZAtGPHDpSUlEiP7OxsAMAf//hHAMD06dPx5ZdfYsWKFdi0aROKi4sxatQo6flOpxMZGRloaGjAli1bsGzZMmRlZWHu3LlSm8LCQmRkZGDYsGHIz8/HtGnT8Mgjj2DdunWd21kiIiLyWSohhJC7CI9p06Zh9erVOHjwIOx2O6Kjo7F8+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ycnKk/Xa7Hdu2bYPFYgEAWCwWVFZWIi8vT2qzfv16uFwupKamSm02b96MxsZGqU12djb69OnjtaKNiIiIlEnWQDR9+nRs3boVzz//PA4dOoTly5fj7bffRmZmJgBApVJh2rRpeO655/DFF19gz549GD9+POLj43H33XcDcI8ojRgxApMmTcL27dvxww8/YOrUqRg7dizi4+MBAPfffz90Oh0mTpyIvXv34pNPPsHChQsxY8YMubpOREREPkQr54sPGTIEn332GebMmYN58+YhOTkZr776KsaNGye1mTVrFmpqavDoo4+isrISN954I9auXQuDwSC1+fDDDzF16lTcdtttUKvVGD16NF577TVpv8lkwjfffIPMzEwMHjwYXbt2xdy5c72uVURERETKJet1iPwFr0NEFNh4HSKiwOQ31yEiIiIi8gUMRERERKR4DERERESkeAxEREREpHgMRERERKR4DERERESkeAxEREREpHgMRERERKR4DERERESkeAxEREREpHgMRERERKR4DERERESkeAxEREREpHgMRERERKR4DERERESkeAxEREREpHgMRERERKR4DERERESkeAxEREREpHgMRERERKR4DERERESkeAxEREREpHgMRERERKR4DERERESkeAxEREREpHgMRERERKR4DERERESkeAxEREREpHgMRERERKR4DERERESkeAxEREREpHgMRERERKR4DERERESkeAxEREREpHgMRERERKR4DERERESkeAxEREREpHgMRERERKR4sgaiZ555BiqVyuvRt29faX99fT0yMzMRFRWFsLA
"text/plain": [
"<Figure size 640x480 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"sns.distplot(param.clip(0.885, 0.888))"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3.10.5 64-bit",
"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.10.5"
},
"orig_nbformat": 4,
"vscode": {
"interpreter": {
"hash": "e7370f93d1d0cde622a1f8e1c04877d8463912d04d973331ad4851f04de6915a"
}
}
},
"nbformat": 4,
"nbformat_minor": 2
}