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.

2522 lines
1.2 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": 4,
"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",
"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": "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": "iVBORw0KGgoAAAANSUhEUgAAAYEAAAEWCAYAAACAO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qrgE1T2PaRwLqqWl9VDwMXAUunsB1J0gyZ9B7DPToqyY3AT4H/WlVrgQXAbV19NgAvnmgDSVYAKwD222+/PpWlfviLz30dgHe84agBV9Iuf3xztpo/+9AaUCVb+93zOr8PF79l+34fprretrYFcMvt93LIPntOabv9rOmJqh8nhr8J7F9VhwEfA/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+FZnZFsWkHen09pZR2nzKzzWYWX2zYFWY221tW6Wb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GafV3dNkWLOOb9rEBERqRQzc0BX59zSvYyXAqwA4p1zBZG
"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+k5DC5b0S0l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mRGx07raSsXV1+XlLhVbprH91t73Z3uP30qnLbpwbY32XH3dom42Je0CfAnoI+nfC0b1ANZri8DMzMwqTUv7vu4MdEvn717Qvgw4tLVBmZmZVaIWJeWIeAx4TNKUiJjfxjGZmZlVpJaevv51RJwC/E7SZy5KR8TXWxuYmZlZpWnp6evr058XtVUgZmZmlc59X+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/jTFb5R9grb1L0rMl3WCtfdDovxv8NxUAMEan8dwY85fGmFWSbtZMpdQJTlsPBERSCgAAIIz7JB1jrb3PWnuKZtYO2S1wmwAAzXUaz621XxpN33uUpE9KurGbZ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hzSh6mRhjCwCE0Od11FCNSikgEbfeda+e85Ef6fer7pYknfPWg7TzNpsFbhXgDiPrAJAG4jkApIFKKWDAvnLBb9cnpCTpO5fcoDcd9MiALQKGYWhVDL5GKYdcJeXjs6d6fOucn4y0YxouY37d6rmm57DP9aHaSDUexSTFY1xcfyoT07mNeqiUAhJhrdWyq27RX376p1qy24N14iufELpJgFOMrPsRugMT24W0y/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": "iVBORw0KGgoAAAANSUhEUgAAAmoAAAR8CAYAAAAtjbjDAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8rg+JYAAAACXBIWXMAAAsTAAALEwEAmpwYAAD4kUlEQVR4nOzdd3hcZ5328e8z6rJ6r5Yt997kuMWOnd4TUkgoIYFACBA6LLDAvrCwC0sJnZBAQgqphJBCqu0k7k3u3bJlW5Zs9W5ZdZ73D42C4riozMwZSffnunRZOnPOmd+JbOXWU421FhEREREJPC6nCxARERGRM1NQExEREQlQCmoiIiIiAUpBTURERCRAKaiJiIiIBCgFNREREZEApaAmIiIiEqAU1ERk0DHG3GeMyTfGtBhjHu3FdUeMMZf6sLTT32+EMcYaY4L99Z4iMrDoh4OIDEbHgR8DVwARDtdyRgpnItITalETkUHHWvuCtfZFoOr014wxScaYfxljao0x1caYVcYYlzHmCWA48IoxptEY8x9nuHaxMabYGPOfxphKTwvcx7q9fo0xZqsxpt4Yc8wY84Nur3W1nt1tjCkC3gZWel6u9bznPO/+lxCRgU6/0YnIUPN1oBhI9nw9F7DW2juMMQuBT1trl53j+jQgCcj0XPuaMSbfWrsfOAl8AtgNTAaWGmO2eUJjl4uACYAbSAUOA3HW2nZvPaCIDB5qURORoaYNSAdyrLVt1tpVtvebHn/fWttirV0BvAp8GMBa+661dqe11m2t3QE8TWcw6+4H1tqT1tpT/X0QERn8FNREZKj5OXAQeMsYU2iM+XYvr6+x1p7s9vVRIAPAGDPHGPOOMabCGFMH3Etn61t3x/pauIgMPQpqIjKkWGsbrLVft9bmAtcDXzPGXNL1cg9uEW+MGdbt6+F0Tl4AeAp4Gci21sYCfwLM6SWc5XMRkQ9QUBORQccYE2yMCQeCgCBjTHjXLEtjzLXGmNHGGAPUAR10jhcDKANye/AWPzTGhHrGtF0L/N1zPBqottY2G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XCwY3bsuwi65yVGMSIxkVUGFlyvru5UHOmu5cEzPZnueLjTYxcIxyby7vzygZrSW1J5i9cFKbs3LOucuCwA3zsgk2GV4YWuJn6oTEfEOvwc1Y8wjxphyY8yubseeNcZs83wcMcZs8xwfYYw51e21P/m7Xhla1h6qYmZOHJGh518Q9mwWjE5ifWE1bR1uL1bWdysPVDI5M4akqLA+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/H7ZJwPRIPgEAADhgjLHGmIfn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OVN8P1/vi/g0/c4UF6zN+KqG6nvHpEwM8Rx+kJQKZ9q/r65+d5NeV3R9PeIiuVR1ndgkjvc11pN8yiH5hNSRfMJQxN5Z6fqiwVWVRRN1F3hdXvyVJYL6OKWh6VSNGPTt2OaVJUbzP/ddfqHxTN86IU3FEs9Ddvb6OMW6Kq7VTYErPrbv2sbQusd3+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+NwbO3ECjq9jE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p/RVSeJl23GRs2/E20ec+aEWHojo1fBMJHpH40+lsoT8XvwmJ2SUb8Hj0v01DyAViOlZGY1xdF9I3hcoq9N3OzGCCp6IqMXQriBTwPvBI4AHxBCHCk77GeBFSnlQeCTwCfMf+sB/hT4OSnlLcCbgbakKE+dW+Itv/MYf/3CTDu+/bYgXpbRq4Af74GMPpbKWZm8ta4+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+bmZlZrbdzD7bqT7PzH5qZtkAngYw1Mxqg39D93GVVwK4xTm3xTm3FcAtAD7TK3dGJMZEO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WBS3uWPQcWk8E20/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/Y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aS3K6kowcn0w2jiRLRZJal8QFsLg/fg7Z9pmlhMx14vo40Y0zrOY8DgKaVL4MIp0BXnubTRbC0cV4GR89Fbc3z+aZNruRWZwD152K9+3LFtfPwnh8fGsm235tgByvWhyRqNpCkoO1mPRhMcs
"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_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+3eqwPoBjB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LAvAOwHcuneZu7e5e03084sA1gGYPdRjE0l1ypdIOMqXSBjKlqSL4fjE63QAK919y94FZjYGwG537zKzGQBmAVgfd0OtozOx+vLEp5OdeDM/nebm82MaHbTxeWnmKN5gY+cFc/jtA+h4hp9Sc8dx/Prt0/kpQb9578X8BmJOSerT+XNY+SR/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": 111,
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "62c650b11477402aa0a9dfe412b6209f",
"version_major": 2,
"version_minor": 0
},
"image/png": "iVBORw0KGgoAAAANSUhEUgAAA2AAAAOoCAYAAAC3KZd9AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8rg+JYAAAACXBIWXMAAAsTAAALEwEAmpwYAADmzUlEQVR4nOz9e5xsd1nnfX+vOvS59yk7h50TSSAEgcEIAeVWlFHnFhBG4fFhiKio3EYUbpkZxxFQxMFxZnAGnXFGwfCQCTqIqAGDI45gxEGGYzgYAkkgCQk57Oyd7GOfuw7X80fXlmaz67oqXbVWVVd/3q9Xv7p7/arW+tWqda21fnVYX3N3AQAAAACKVxl2BwAAAABgp2AABgAAAAAlYQAGAAAAACVhAAYAAAAAJWEABgAAAAAlYQAGAAAAACVhAAYAAAAAJWEABgAAAAAlYQAGAAAAACVhAAYAAAAAJWEABgAAAAAlYQAGAAAAACVhAAYAAAAAJWEABgAAAAAlYQAGAAAAACVhAAYAAAAAJWEABgAAAAAlYQA2JszsrWb2+mH3Axg31BZQHOoLKAa1NdoYgI0IM3Mze9xp037VzP5HL/d391e4+6917vdsM7s/WZ6Z2ZvM7Ejn501mZlt/BMBoGkJt/WMz+5CZnTCze7bccWAbGEJ9/YKZ3WpmC2b2FTP7ha33HhhdQ6itf2Fmd5vZSTN70Mx+y8xqW38EiDAA27mukfSDkr5Z0l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WEABgAAAAAlYQAGAAAAACVhAAYAAAAAJenp6vdmdp2k50s67O5P7kz7VUk/Jenhzs1e5+7v77S9VtLLJbUk/Zy7/1W6jHZbleUgT6CdZAk04xA
"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,iVBORw0KGgoAAAANSUhEUgAAA2AAAAOoCAYAAAC3KZd9AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8rg+JYAAAACXBIWXMAAAsTAAALEwEAmpwYAADmzUlEQVR4nOz9e5xsd1nnfX+vOvS59yk7h50TSSAEgcEIAeVWlFHnFhBG4fFhiKio3EYUbpkZxxFQxMFxZnAGnXFGwfCQCTqIqAGDI45gxEGGYzgYAkkgCQk57Oyd7GOfuw7X80fXlmaz67oqXbVWVVd/3q9Xv7p7/arW+tWqda21fnVYX3N3AQAAAACKVxl2BwAAAABgp2AABgAAAAAlYQAGAAAAACVhAAYAAAAAJWEABgAAAAAlYQAGAAAAACVhAAYAAAAAJWEABgAAAAAlYQAGAAAAACVhAAYAAAAAJWEABgAAAAAlYQAGAAAAACVhAAYAAAAAJWEABgAAAAAlYQAGAAAAACVhAAYAAAAAJWEABgAAAAAlYQA2JszsrWb2+mH3Axg31BZQHOoLKAa1NdoYgI0IM3Mze9xp037VzP5HL/d391e4+6917vdsM7s/WZ6Z2ZvM7Ejn501mZlt/BMBoGkJt/WMz+5CZnTCze7bccWAbGEJ9/YKZ3WpmC2b2FTP7ha33HhhdQ6itf2Fmd5vZSTN70Mx+y8xqW38EiDAA27mukfSDkr5Z0lMkvUDSTw+zQ8CYWJJ0nSRODIHBM0k/JmmvpOdIepWZvWS4XQLGwvskPdXdd0l6sjbOD39uuF0aXwzAtolTr16Y2c+b2WEzO2hmP7Gp/Xoz+7dmNivpLyWdb2aL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reset original view', 'home', 'home'), ('Back', 'Back to previous …"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"avg_fr_blur = np.array([scipy.ndimage.gaussian_filter(avg_firing_rates[:, :, i], sigma=2) for i in range(40)])\n",
"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((40, 400))"
]
},
{
"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": 169,
"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",
" ]}, f)"
]
},
{
"cell_type": "code",
"execution_count": 168,
"metadata": {},
"outputs": [],
"source": [
"from decoding import cohomological_parameterization"
]
},
{
"cell_type": "code",
"execution_count": 171,
"metadata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3lpERGRcSymSgMSFUqlUol+/fkhISNC2qdVqJCQkIDw83OBnwsPDdeIBID4+Xie+ukieP38eO3fuhJeX1x1zOXLkCORyOby9vRt5NkRELcOyZctaTJEErODWa3R0NCZNmoT+/fsjNDQU7733HoqKijB58mQAwMSJE9G2bVvExcUBAGbOnIlBgwZhxYoVeOSRR7B+/XocPnwYn376KQBNkRwzZgxSUlKwZcsWVFVVaZ9fenp6QqlUIjExEQcPHsSQIUPg6uqKxMREvPLKK3jqqafQqlUraf4giIhsRL9+/eDo6Ij58+c3+yIJABBW4MMPPxTt27cXSqVShIaGigMHDmi3DRo0SEyaNEkn/rvvvhNdunQRSqVS9OjRQ2zdulW77eLFiwKAwdfu3buFEEIkJyeLsLAw4e7uLhwcHET37t1FbGysKC0trXfOeXl5AoDIy8tr0rkTEdmiS5cuSZ1CkzTkO1zycZS2qiFjcIiIbN3777+PBx54AHfffbfUqZiEzYyjJCIi6xcbG4uXX34ZQ4cORXZ2ttTpWBwLJRG1COXl5UhLSwOKc4CSXABAWloaysvLpU3MytXu3frSSy/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": 7,
"metadata": {},
"outputs": [],
"source": [
"from sklearn.decomposition import PCA\n",
"import seaborn as sns"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"<AxesSubplot:>"
]
},
"execution_count": 8,
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAWgAAAD8CAYAAABaZT40AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8rg+JYAAAACXBIWXMAAAsTAAALEwEAmpwYAAA5hUlEQVR4nO2de5wcZZX3v6fnksnkNoEECCSYAEFkUYREXtRVEbwEZGXXdRWQFbyhuCDgbfGy+IruZ0FcWdlV16xGRRHECJJXwwKLXGQ/ckkCBAi3JNwmhIRLEpJMJslMn/ePqoR2qHO6prtmpmdyvvn0Jz311FPP009VP1X9nPM7R1SVIAiCoPEoDXUHgiAIgmxigg6CIGhQYoIOgiBoUGKCDoIgaFBigg6CIGhQYoIOgiBoUGKCDoIgyIGIzBORtSLygFEuInKpiCwXkaUicni9bcYEHQRBkI+fAnOc8mOBmenrdOAH9TZY1wQtInNE5JH0jnFevZ0JgiBoVFT1NuBFZ5cTgMs04Q6gQ0Sm1NNmc60VRaQJ+B7wTqATuFtEFqjqMqvO9udXmrLF9x3+mcztH9k23uzDtW1bzbKjto/O3H4Im806j+oYs2zfcrdZdn9LW+b2OR1rzTrdXS1m2bKujsztP2/ZYNbZq5T9eQFm6KjM7c2OiFTsIlaUtjml2YxyngWanNY205u5faP2mHXGSJNZds+27HPyF62TzDpe/1qNz7Ude3B7KJtlbdh9327Ua3HGttsYP4AuzS7zntqandJe5zNbeP27+skF3mWYC2/OqaR18v6fJHnq3cFcVZ3bz+b2AZ6u+Lsz3ba6n8fZSc0TNHAEsFxVVwKIyJUkdxBzgg6CIBhUyvYNoJJ0Mu7vhDzg1LPEYd0tgiAIGgMt53sVwypgWsXfU9NtNTPgRkIROV1EFonIoh9ddsVANxcEQfAy5XK+VzEsAD6cenMcCWxQ1ZqX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ySMe/XZUvbu5ZlG5cA/nZ2tpHrgfvsbNCfbt7PLLMSal9bsiXM+zmy7YMNVX/ZMfhsd8pGO88J09uyL6nVTobzN7ba47TRGIwX1bAeAt8cbxt7L97Ykbn9Lexh1vHYu9eWRb8in1zKC06MZs8EZxnv2sX+Gq9xDIhag8FvvTPuhVCckfAIYLmqrgQQkSuBE/jzJNnKyyEvJgDP1NtoPRlVJgBvBU4DUNVtmDbyIAiCISD/8sXpwOkVm+aq6tyKv/cBKp+cOoH/0+cw/xe4QUTOAsYA7+hvd/tSzxP0DOA54CciciiwGDhbVe3HjSAIgsEkpxdHOhnPrbqjz0nAT1X1X9Pl3p+LyCGqtbuS1LMG3QwcDvwgXXPZDGQtnO+Uev+hK6TeQRAMIsUZCVcBlc73U9NtlXwMuApAVf8EtAF2CMoc1DNBdwKdqnpn+vd8kgn7z6iUeh/dHlLvIAgGkeIm6LuBmSIyI7W3nQgs6LPPU8AxACLyGpIJ+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": 112,
"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>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.001840</td>\n",
" <td>0.005584</td>\n",
" <td>-0.001724</td>\n",
" <td>-0.000157</td>\n",
" <td>0.001694</td>\n",
" <td>0.000052</td>\n",
" <td>0.001786</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>0.005321</td>\n",
" <td>-0.001193</td>\n",
" <td>-0.002606</td>\n",
" <td>0.004470</td>\n",
" <td>-0.000058</td>\n",
" <td>-0.000247</td>\n",
" <td>0.001285</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>-0.001154</td>\n",
" <td>0.005865</td>\n",
" <td>-0.001700</td>\n",
" <td>-0.000399</td>\n",
" <td>0.001506</td>\n",
" <td>-0.000039</td>\n",
" <td>0.001431</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>0.005685</td>\n",
" <td>-0.001241</td>\n",
" <td>-0.001995</td>\n",
" <td>0.004183</td>\n",
" <td>0.000222</td>\n",
" <td>-0.000510</td>\n",
" <td>0.000970</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>0.000054</td>\n",
" <td>0.006228</td>\n",
" <td>-0.001699</td>\n",
" <td>-0.000858</td>\n",
" <td>0.001188</td>\n",
" <td>-0.000236</td>\n",
" <td>0.000801</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" 0 1 2 3 4 5 6\n",
"0 -0.001840 0.005584 -0.001724 -0.000157 0.001694 0.000052 0.001786\n",
"1 0.005321 -0.001193 -0.002606 0.004470 -0.000058 -0.000247 0.001285\n",
"2 -0.001154 0.005865 -0.001700 -0.000399 0.001506 -0.000039 0.001431\n",
"3 0.005685 -0.001241 -0.001995 0.004183 0.000222 -0.000510 0.000970\n",
"4 0.000054 0.006228 -0.001699 -0.000858 0.001188 -0.000236 0.000801"
]
},
"execution_count": 112,
"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",
"data_pca.head()"
]
},
{
"cell_type": "code",
"execution_count": 69,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"(400, 50, 7)"
]
},
"execution_count": 69,
"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": 70,
"metadata": {},
"outputs": [],
"source": [
"avg_firing_rates_pca = np.mean(firing_rates_in_trials_pca, axis=1).reshape((20, 20, N_COMP))"
]
},
{
"cell_type": "code",
"execution_count": 113,
"metadata": {},
"outputs": [
{
"ename": "InvalidIndexError",
"evalue": "(slice(None, None, None), slice(None, None, None), 0)",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mInvalidIndexError\u001b[0m Traceback (most recent call last)",
"\u001b[1;32m/home/ennucore/dev/amgen/exp/ProcessExp.ipynb Cell 91\u001b[0m in \u001b[0;36m<cell line: 3>\u001b[0;34m()\u001b[0m\n\u001b[1;32m <a href='vscode-notebook-cell:/home/ennucore/dev/amgen/exp/ProcessExp.ipynb#ch0000089?line=1'>2</a>\u001b[0m fig\u001b[39m.\u001b[39mtight_layout(w_pad\u001b[39m=\u001b[39m\u001b[39m2\u001b[39m)\n\u001b[1;32m <a href='vscode-notebook-cell:/home/ennucore/dev/amgen/exp/ProcessExp.ipynb#ch0000089?line=2'>3</a>\u001b[0m \u001b[39mfor\u001b[39;00m i, ax \u001b[39min\u001b[39;00m \u001b[39menumerate\u001b[39m(axs\u001b[39m.\u001b[39mflatten()[:\u001b[39m7\u001b[39m]):\n\u001b[0;32m----> <a href='vscode-notebook-cell:/home/ennucore/dev/amgen/exp/ProcessExp.ipynb#ch0000089?line=3'>4</a>\u001b[0m ax\u001b[39m.\u001b[39mimshow(data_pca[:, :, i], extent\u001b[39m=\u001b[39m(\u001b[39m0\u001b[39m, \u001b[39m360\u001b[39m, \u001b[39m0\u001b[39m, \u001b[39m180\u001b[39m), aspect\u001b[39m=\u001b[39m\u001b[39m2\u001b[39m)\n\u001b[1;32m <a href='vscode-notebook-cell:/home/ennucore/dev/amgen/exp/ProcessExp.ipynb#ch0000089?line=4'>5</a>\u001b[0m ax\u001b[39m.\u001b[39mset(xlabel\u001b[39m=\u001b[39m\u001b[39m\"\u001b[39m\u001b[39mphase\u001b[39m\u001b[39m\"\u001b[39m, ylabel\u001b[39m=\u001b[39m\u001b[39m\"\u001b[39m\u001b[39morientation\u001b[39m\u001b[39m\"\u001b[39m, title\u001b[39m=\u001b[39m\u001b[39mf\u001b[39m\u001b[39m\"\u001b[39m\u001b[39mUnit \u001b[39m\u001b[39m{\u001b[39;00mi\u001b[39m}\u001b[39;00m\u001b[39m\"\u001b[39m)\n",
"File \u001b[0;32m/usr/lib/python3.10/site-packages/pandas/core/frame.py:3505\u001b[0m, in \u001b[0;36mDataFrame.__getitem__\u001b[0;34m(self, key)\u001b[0m\n\u001b[1;32m 3503\u001b[0m \u001b[39mif\u001b[39;00m \u001b[39mself\u001b[39m\u001b[39m.\u001b[39mcolumns\u001b[39m.\u001b[39mnlevels \u001b[39m>\u001b[39m \u001b[39m1\u001b[39m:\n\u001b[1;32m 3504\u001b[0m \u001b[39mreturn\u001b[39;00m \u001b[39mself\u001b[39m\u001b[39m.\u001b[39m_getitem_multilevel(key)\n\u001b[0;32m-> 3505\u001b[0m indexer \u001b[39m=\u001b[39m \u001b[39mself\u001b[39;49m\u001b[39m.\u001b[39;49mcolumns\u001b[39m.\u001b[39;49mget_loc(key)\n\u001b[1;32m 3506\u001b[0m \u001b[39mif\u001b[39;00m is_integer(indexer):\n\u001b[1;32m 3507\u001b[0m indexer \u001b[39m=\u001b[39m [indexer]\n",
"File \u001b[0;32m/usr/lib/python3.10/site-packages/pandas/core/indexes/range.py:388\u001b[0m, in \u001b[0;36mRangeIndex.get_loc\u001b[0;34m(self, key, method, tolerance)\u001b[0m\n\u001b[1;32m 386\u001b[0m \u001b[39mexcept\u001b[39;00m \u001b[39mValueError\u001b[39;00m \u001b[39mas\u001b[39;00m err:\n\u001b[1;32m 387\u001b[0m \u001b[39mraise\u001b[39;00m \u001b[39mKeyError\u001b[39;00m(key) \u001b[39mfrom\u001b[39;00m \u001b[39merr\u001b[39;00m\n\u001b[0;32m--> 388\u001b[0m \u001b[39mself\u001b[39;49m\u001b[39m.\u001b[39;49m_check_indexing_error(key)\n\u001b[1;32m 389\u001b[0m \u001b[39mraise\u001b[39;00m \u001b[39mKeyError\u001b[39;00m(key)\n\u001b[1;32m 390\u001b[0m \u001b[39mreturn\u001b[39;00m \u001b[39msuper\u001b[39m()\u001b[39m.\u001b[39mget_loc(key, method\u001b[39m=\u001b[39mmethod, tolerance\u001b[39m=\u001b[39mtolerance)\n",
"File \u001b[0;32m/usr/lib/python3.10/site-packages/pandas/core/indexes/base.py:5637\u001b[0m, in \u001b[0;36mIndex._check_indexing_error\u001b[0;34m(self, key)\u001b[0m\n\u001b[1;32m 5633\u001b[0m \u001b[39mdef\u001b[39;00m \u001b[39m_check_indexing_error\u001b[39m(\u001b[39mself\u001b[39m, key):\n\u001b[1;32m 5634\u001b[0m \u001b[39mif\u001b[39;00m \u001b[39mnot\u001b[39;00m is_scalar(key):\n\u001b[1;32m 5635\u001b[0m \u001b[39m# if key is not a scalar, directly raise an error (the code below\u001b[39;00m\n\u001b[1;32m 5636\u001b[0m \u001b[39m# would convert to numpy arrays and raise later any way) - GH29926\u001b[39;00m\n\u001b[0;32m-> 5637\u001b[0m \u001b[39mraise\u001b[39;00m InvalidIndexError(key)\n",
"\u001b[0;31mInvalidIndexError\u001b[0m: (slice(None, None, None), slice(None, None, None), 0)"
]
},
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "c09d95fca9cf47deb73bfbb32c0ea7bf",
"version_major": 2,
"version_minor": 0
},
"image/png": "iVBORw0KGgoAAAANSUhEUgAAA2AAAANgCAYAAABKkgukAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8rg+JYAAAACXBIWXMAAAsTAAALEwEAmpwYAAAssklEQVR4nO3dX4jl93nf8c9jbZVQx3GKtYGgXUUKXdfZOgG7g+ISSFzslpUK2ou0QQLTuggv+aNQSCiouDhBuXJKUwioTRdq5ARiWfFFWcgahaYyAhM5WmNHsWQUNopbrRIqxXF8Y2xZ9NuLOU7Go9ndc8789vmdk3m9YOH8+e7MszO7D/ueM+dMjTECAADAjfeGuQcAAAA4KgQYAABAEwEGAADQRIABAAA0EWAAAABNBBgAAEATAQYAANBEgAEAADQRYAAAAE0EGAAAQJOVA6yqPlJVL1fVF65yf1XVr1XV5ap6pqreefgxgaPO7gHmYv8AU1rnEbBHkpy5xv13JTm1+HUuyX9d430A7PdI7B5gHo/E/gEmsnKAjTGeTPKX1zhyNslvjF1PJfmeqvq+dQcESOweYD72DzClG/EcsFu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qi8leVeSCwc9IXWMcX6MsTPG2Dl+/PgaowBHiN0DzGGy3ZPYP8B6AfZ0klNVdUdV3Zzk3iQXvnXnGOOrY4xbxhi3jzFuT/JUknvGGJcmmRg4quweYA52DzCplQNsjPFakgeSPJ7ki0keG2M8W1UPVdU9Uw8IkNg9wDzsHmBqx9b5TWOMi0ku7rvtQ1c5++513gf
"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,iVBORw0KGgoAAAANSUhEUgAAA2AAAANgCAYAAABKkgukAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8rg+JYAAAACXBIWXMAAAsTAAALEwEAmpwYAAAssklEQVR4nO3dX4jl93nf8c9jbZVQx3GKtYGgXUUKXdfZOgG7g+ISSFzslpUK2ou0QQLTuggv+aNQSCiouDhBuXJKUwioTRdq5ARiWfFFWcgahaYyAhM5WmNHsWQUNopbrRIqxXF8Y2xZ9NuLOU7Go9ndc8789vmdk3m9YOH8+e7MszO7D/ueM+dMjTECAADAjfeGuQcAAAA4KgQYAABAEwEGAADQRIABAAA0EWAAAABNBBgAAEATAQYAANBEgAEAADQRYAAAAE0EGAAAQJOVA6yqPlJVL1fVF65yf1XVr1XV5ap6pqreefgxgaPO7gHmYv8AU1rnEbBHkpy5xv13JTm1+HUuyX9d430A7PdI7B5gHo/E/gEmsnKAjTGeTPKX1zhyNslvjF1PJfmeqvq+dQcESOweYD72DzClG/EcsFuTvLjn+pXFbQA3kt0DzMX+AZZ2bM53XlXnsvtQfd74xjf+o7e97W1zjgMs6bOf/exfjDGOzz3Huuwe2F72DzCHKXfPjQiwl5Kc3HP9xOK21xljnE9yPkl2dnbGpUuXbsA4wNSq6n/PPcMB7B44AuwfYA5T7p4b8S2IF5L8q8UrAr0ryVfHGH9+A94PwF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vas(toolbar=Toolbar(toolitems=[('Home', 'Reset original view', 'home', 'home'), ('Back', 'Back to previous …"
]
},
"metadata": {},
"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": 31,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAABLMAAAQgCAYAAAAdcB6PAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8rg+JYAAAACXBIWXMAAA9hAAAPYQGoP6dpAADC/ElEQVR4nOzdeZwU9Z3/8Xf1OfcMgzDDBAaJJwTxAMWJxiPOiuh64q4aEokSWQ1ggKwHUVSMBmOMogYlGoNmo2JcF7wSNi4K6AooKEaN4oVC1BlUmBnm6umjfn/4o9fRAZn+9HR3Da/n49GPB3T3t/pT1VX1rv5Md5Xjuq4rAAAAAAAAwAN82S4AAAAAAAAA2FU0swAAAAAAAOAZNLMAAAAAAADgGTSzAAAAAAAA4Bk0swAAAAAAAOAZNLMAAAAAAADgGTSzAAAAAAAA4Bk0swAAAAAAAOAZNLMAAAAAAADgGTSzgBzzwx/+UHvuuWe2ywAAeAz5AQDoLrIDXkUzC0jBNddcI8dx9Omnn3b5+PDhw3XMMcek5bVaW1t1zTXXaNmyZbs8JpFI6MYbb9SQIUOUl5enESNG6MEHH0xLPQCA1OV6flx//fU65ZRTVFFRIcdxdM0116SlFgBA6nI5O958801deumlOuigg1RcXKwBAwbopJNO0po1a9JSD7AjNLOAHHP33Xdr/fr1yf+3trZq9uzZ3fowcsUVV+iyyy7TP/3TP+n2229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qXIAQLaQHQCAVJAfAOAt2W+
"text/plain": [
"<Figure size 1200x1300 with 6 Axes>"
]
},
"metadata": {},
"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": 108,
"metadata": {},
"outputs": [
{
"ename": "KeyboardInterrupt",
"evalue": "",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mKeyboardInterrupt\u001b[0m Traceback (most recent call last)",
"\u001b[1;32m/home/ennucore/dev/amgen/exp/ProcessExp.ipynb Cell 96\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#ch0000103?line=0'>1</a>\u001b[0m fr_pca_simpl, inds_simpl \u001b[39m=\u001b[39m top_noise_reduction(pd\u001b[39m.\u001b[39;49mDataFrame(firing_rates_in_trials_pca\u001b[39m.\u001b[39;49mreshape((\u001b[39m400\u001b[39;49m \u001b[39m*\u001b[39;49m \u001b[39m50\u001b[39;49m, \u001b[39m-\u001b[39;49m\u001b[39m1\u001b[39;49m))))\n\u001b[1;32m <a href='vscode-notebook-cell:/home/ennucore/dev/amgen/exp/ProcessExp.ipynb#ch0000103?line=1'>2</a>\u001b[0m fr_pca_simpl_np \u001b[39m=\u001b[39m fr_pca_simpl\u001b[39m.\u001b[39mto_numpy()\n\u001b[1;32m <a href='vscode-notebook-cell:/home/ennucore/dev/amgen/exp/ProcessExp.ipynb#ch0000103?line=2'>3</a>\u001b[0m fr_pca_simpl\u001b[39m.\u001b[39mshape\n",
"\u001b[1;32m/home/ennucore/dev/amgen/exp/ProcessExp.ipynb Cell 96\u001b[0m in \u001b[0;36mtop_noise_reduction\u001b[0;34m(X, n, omega, fraction, plot)\u001b[0m\n\u001b[1;32m <a href='vscode-notebook-cell:/home/ennucore/dev/amgen/exp/ProcessExp.ipynb#ch0000103?line=22'>23</a>\u001b[0m S \u001b[39m=\u001b[39m X\u001b[39m.\u001b[39miloc[inds]\n\u001b[1;32m <a href='vscode-notebook-cell:/home/ennucore/dev/amgen/exp/ProcessExp.ipynb#ch0000103?line=23'>24</a>\u001b[0m sigma \u001b[39m=\u001b[39m X\u001b[39m.\u001b[39mstack()\u001b[39m.\u001b[39mstd()\n\u001b[0;32m---> <a href='vscode-notebook-cell:/home/ennucore/dev/amgen/exp/ProcessExp.ipynb#ch0000103?line=24'>25</a>\u001b[0m c \u001b[39m=\u001b[39m \u001b[39m0.02\u001b[39m\u001b[39m*\u001b[39mnp\u001b[39m.\u001b[39mmax(scipy\u001b[39m.\u001b[39;49mspatial\u001b[39m.\u001b[39;49mdistance\u001b[39m.\u001b[39;49mcdist(X, X, metric\u001b[39m=\u001b[39;49m\u001b[39m'\u001b[39;49m\u001b[39meuclidean\u001b[39;49m\u001b[39m'\u001b[39;49m))\n\u001b[1;32m <a href='vscode-notebook-cell:/home/ennucore/dev/amgen/exp/ProcessExp.ipynb#ch0000103?line=26'>27</a>\u001b[0m iterator \u001b[39m=\u001b[39m trange(\u001b[39m0\u001b[39m, n, position\u001b[39m=\u001b[39m\u001b[39m0\u001b[39m, leave\u001b[39m=\u001b[39m\u001b[39mTrue\u001b[39;00m)\n\u001b[1;32m <a href='vscode-notebook-cell:/home/ennucore/dev/amgen/exp/ProcessExp.ipynb#ch0000103?line=27'>28</a>\u001b[0m iterator\u001b[39m.\u001b[39mset_description(\u001b[39m\"\u001b[39m\u001b[39mTopological noise reduction\u001b[39m\u001b[39m\"\u001b[39m)\n",
"File \u001b[0;32m/usr/lib/python3.10/site-packages/scipy/spatial/distance.py:2947\u001b[0m, in \u001b[0;36mcdist\u001b[0;34m(XA, XB, metric, out, **kwargs)\u001b[0m\n\u001b[1;32m 2945\u001b[0m \u001b[39mif\u001b[39;00m metric_info \u001b[39mis\u001b[39;00m \u001b[39mnot\u001b[39;00m \u001b[39mNone\u001b[39;00m:\n\u001b[1;32m 2946\u001b[0m cdist_fn \u001b[39m=\u001b[39m metric_info\u001b[39m.\u001b[39mcdist_func\n\u001b[0;32m-> 2947\u001b[0m \u001b[39mreturn\u001b[39;00m cdist_fn(XA, XB, out\u001b[39m=\u001b[39;49mout, \u001b[39m*\u001b[39;49m\u001b[39m*\u001b[39;49mkwargs)\n\u001b[1;32m 2948\u001b[0m \u001b[39melif\u001b[39;00m mstr\u001b[39m.\u001b[39mstartswith(\u001b[39m\"\u001b[39m\u001b[39mtest_\u001b[39m\u001b[39m\"\u001b[39m):\n\u001b[1;32m 2949\u001b[0m metric_info \u001b[39m=\u001b[39m _TEST_METRICS\u001b[39m.\u001b[39mget(mstr, \u001b[39mNone\u001b[39;00m)\n",
"\u001b[0;31mKeyboardInterrupt\u001b[0m: "
]
}
],
"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": "code",
"execution_count": 97,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"(926, 2)"
]
},
"execution_count": 97,
"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": 104,
"metadata": {},
"outputs": [],
"source": [
"avg_firing_rates_pca_ = avg_firing_rates_pca.reshape((-1, N_COMP))"
]
},
{
"cell_type": "code",
"execution_count": 106,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAegAAAIICAYAAACl/H0TAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8rg+JYAAAACXBIWXMAAAsTAAALEwEAmpwYAAEAAElEQVR4nOydd1yV1RvAv/eyNyIo4EDFjbj3wr1Ns8zUHJmlZdkvy0zLykptaGlDzZmZpebee29x4VYQEBHZe97x/P64iHBBEEVBe7+fD5+X+77nnPd5z33vec54zvOoRERQUFBQUFBQKFGoi1sABQUFBQUFhdwoClpBQUFBQaEEoihoBQUFBQWFEoiioBUUFBQUFEogioJWUFBQUFAogSgKWkFBQUFBoQSiKGgFBQUFBYUSiKKgFRRKAJUqVcLKygpbW1vKli3L8OHDSUpKAmDHjh20b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5s9fQ3Kuax1cUuicI/6LnBzKLjbFrckJYu9L5Yw5fwf4LtW8LY3VHUsbkmKh/+8glYUZ/Fia274UyhZVP4PjlYKws7c8Kfw9DBV/3eVMyhr0ArPElodHLwOGdqC0/6XiE+B4zeLW4pnm8AouB5e3FIoFAXJ6XD4BogUtySPjaKgC6CojMgUK+5CotNl/cD0eujUAn5vcBh8ZsCs3cUsXAlj5DJo8S0c8c83WXIyNK0NY9/KPKFVOjpZNP4Gan1u6AQ+gMgIqFsFvvq0gLJElLotCrTaR1OyH6+GNj/AZr+sUzcDoGZ5mDu7COV7CjxxBV0SFVNhZCoq6+vnxYr7sgZaRML
"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": 77,
"metadata": {},
"outputs": [],
"source": [
"from umap import UMAP"
]
},
{
"cell_type": "code",
"execution_count": 110,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"/usr/lib/python3.10/site-packages/umap/umap_.py:2344: UserWarning: n_neighbors is larger than the dataset size; truncating to X.shape[0] - 1\n",
" warn(\n",
"/usr/lib/python3.10/site-packages/umap/umap_.py:132: UserWarning: A large number of your vertices were disconnected from the manifold.\n",
"Disconnection_distance = inf has removed 0 edges.\n",
"It has fully disconnected 2 vertices.\n",
"You might consider using find_disconnected_points() to find and remove these points from your data.\n",
"Use umap.utils.disconnected_vertices() to identify them.\n",
" warn(\n"
]
},
{
"ename": "ValueError",
"evalue": "zero-size array to reduction operation maximum which has no identity",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mValueError\u001b[0m Traceback (most recent call last)",
"\u001b[1;32m/home/ennucore/dev/amgen/exp/ProcessExp.ipynb Cell 103\u001b[0m in \u001b[0;36m<cell line: 2>\u001b[0;34m()\u001b[0m\n\u001b[1;32m <a href='vscode-notebook-cell:/home/ennucore/dev/amgen/exp/ProcessExp.ipynb#ch0000106?line=0'>1</a>\u001b[0m ncomp_umap \u001b[39m=\u001b[39m \u001b[39m5\u001b[39m\n\u001b[0;32m----> <a href='vscode-notebook-cell:/home/ennucore/dev/amgen/exp/ProcessExp.ipynb#ch0000106?line=1'>2</a>\u001b[0m embed \u001b[39m=\u001b[39m UMAP(n_components\u001b[39m=\u001b[39;49mncomp_umap, n_neighbors\u001b[39m=\u001b[39;49m\u001b[39m5\u001b[39;49m, metric\u001b[39m=\u001b[39;49m\u001b[39m'\u001b[39;49m\u001b[39meuclidean\u001b[39;49m\u001b[39m'\u001b[39;49m)\u001b[39m.\u001b[39;49mfit_transform(fr_pca_simpl)\n",
"File \u001b[0;32m/usr/lib/python3.10/site-packages/umap/umap_.py:2772\u001b[0m, in \u001b[0;36mUMAP.fit_transform\u001b[0;34m(self, X, y)\u001b[0m\n\u001b[1;32m 2742\u001b[0m \u001b[39mdef\u001b[39;00m \u001b[39mfit_transform\u001b[39m(\u001b[39mself\u001b[39m, X, y\u001b[39m=\u001b[39m\u001b[39mNone\u001b[39;00m):\n\u001b[1;32m 2743\u001b[0m \u001b[39m\"\"\"Fit X into an embedded space and return that transformed\u001b[39;00m\n\u001b[1;32m 2744\u001b[0m \u001b[39m output.\u001b[39;00m\n\u001b[1;32m 2745\u001b[0m \n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 2770\u001b[0m \u001b[39m Local radii of data points in the embedding (log-transformed).\u001b[39;00m\n\u001b[1;32m 2771\u001b[0m \u001b[39m \"\"\"\u001b[39;00m\n\u001b[0;32m-> 2772\u001b[0m \u001b[39mself\u001b[39;49m\u001b[39m.\u001b[39;49mfit(X, y)\n\u001b[1;32m 2773\u001b[0m \u001b[39mif\u001b[39;00m \u001b[39mself\u001b[39m\u001b[39m.\u001b[39mtransform_mode \u001b[39m==\u001b[39m \u001b[39m\"\u001b[39m\u001b[39membedding\u001b[39m\u001b[39m\"\u001b[39m:\n\u001b[1;32m 2774\u001b[0m \u001b[39mif\u001b[39;00m \u001b[39mself\u001b[39m\u001b[39m.\u001b[39moutput_dens:\n",
"File \u001b[0;32m/usr/lib/python3.10/site-packages/umap/umap_.py:2684\u001b[0m, in \u001b[0;36mUMAP.fit\u001b[0;34m(self, X, y)\u001b[0m\n\u001b[1;32m 2681\u001b[0m \u001b[39mprint\u001b[39m(ts(), \u001b[39m\"\u001b[39m\u001b[39mConstruct embedding\u001b[39m\u001b[39m\"\u001b[39m)\n\u001b[1;32m 2683\u001b[0m \u001b[39mif\u001b[39;00m \u001b[39mself\u001b[39m\u001b[39m.\u001b[39mtransform_mode \u001b[39m==\u001b[39m \u001b[39m\"\u001b[39m\u001b[39membedding\u001b[39m\u001b[39m\"\u001b[39m:\n\u001b[0;32m-> 2684\u001b[0m \u001b[39mself\u001b[39m\u001b[39m.\u001b[39membedding_, aux_data \u001b[39m=\u001b[39m \u001b[39mself\u001b[39;49m\u001b[39m.\u001b[39;49m_fit_embed_data(\n\u001b[1;32m 2685\u001b[0m \u001b[39mself\u001b[39;49m\u001b[39m.\u001b[39;49m_raw_data[index],\n\u001b[1;32m 2686\u001b[0m \u001b[39mself\u001b[39;49m\u001b[39m.\u001b[39;49mn_epochs,\n\u001b[1;32m 2687\u001b[0m init,\n\u001b[1;32m 2688\u001b[0m random_state, \u001b[39m# JH why raw data?\u001b[39;49;00m\n\u001b[1;32m 2689\u001b[0m )\n\u001b[1;32m 2690\u001b[0m \u001b[39m# Assign any points that are fully disconnected from our manifold(s) to have embedding\u001b[39;00m\n\u001b[1;32m 2691\u001b[0m \u001b[39m# coordinates of np.nan. These will be filtered by our plotting functions automatically.\u001b[39;00m\n\u001b[1;32m 2692\u001b[0m \u001b[39m# They also prevent users from being deceived a distance query to one of these points.\u001b[39;00m\n\u001b[1;32m 2693\u001b[0m \u001b[39m# Might be worth moving this into simplicial_set_embedding or _fit_embed_data\u001b[39;00m\n\u001b[1;32m 2694\u001b[0m disconnected_vertices \u001b[39m=\u001b[39m np\u001b[39m.\u001b[39marray(\u001b[39mself\u001b[39m\u001b[39m.\u001b[39mgraph_\u001b[39m.\u001b[39msum(axis\u001b[39m=\u001b[39m\u001b[39m1\u001b[39m))\u001b[39m.\u001b[39mflatten() \u001b[39m==\u001b[39m \u001b[39m0\u001b[39m\n",
"File \u001b[0;32m/usr/lib/python3.10/site-packages/umap/umap_.py:2717\u001b[0m, in \u001b[0;36mUMAP._fit_embed_data\u001b[0;34m(self, X, n_epochs, init, random_state)\u001b[0m\n\u001b[1;32m 2713\u001b[0m \u001b[39mdef\u001b[39;00m \u001b[39m_fit_embed_data\u001b[39m(\u001b[39mself\u001b[39m, X, n_epochs, init, random_state):\n\u001b[1;32m 2714\u001b[0m \u001b[39m\"\"\"A method wrapper for simplicial_set_embedding that can be\u001b[39;00m\n\u001b[1;32m 2715\u001b[0m \u001b[39m replaced by subclasses.\u001b[39;00m\n\u001b[1;32m 2716\u001b[0m \u001b[39m \"\"\"\u001b[39;00m\n\u001b[0;32m-> 2717\u001b[0m \u001b[39mreturn\u001b[39;00m simplicial_set_embedding(\n\u001b[1;32m 2718\u001b[0m X,\n\u001b[1;32m 2719\u001b[0m \u001b[39mself\u001b[39;49m\u001b[39m.\u001b[39;49mgraph_,\n\u001b[1;32m 2720\u001b[0m \u001b[39mself\u001b[39;49m\u001b[39m.\u001b[39;49mn_components,\n\u001b[1;32m 2721\u001b[0m \u001b[39mself\u001b[39;49m\u001b[39m.\u001b[39;49m_initial_alpha,\n\u001b[1;32m 2722\u001b[0m \u001b[39mself\u001b[39;49m\u001b[39m.\u001b[39;49m_a,\n\u001b[1;32m 2723\u001b[0m \u001b[39mself\u001b[39;49m\u001b[39m.\u001b[39;49m_b,\n\u001b[1;32m 2724\u001b[0m \u001b[39mself\u001b[39;49m\u001b[39m.\u001b[39;49mrepulsion_strength,\n\u001b[1;32m 2725\u001b[0m \u001b[39mself\u001b[39;49m\u001b[39m.\u001b[39;49mnegative_sample_rate,\n\u001b[1;32m 2726\u001b[0m n_epochs,\n\u001b[1;32m 2727\u001b[0m init,\n\u001b[1;32m 2728\u001b[0m random_state,\n\u001b[1;32m 2729\u001b[0m \u001b[39mself\u001b[39;49m\u001b[39m.\u001b[39;49m_input_distance_func,\n\u001b[1;32m 2730\u001b[0m \u001b[39mself\u001b[39;49m\u001b[39m.\u001b[39;49m_metric_kwds,\n\u001b[1;32m 2731\u001b[0m \u001b[39mself\u001b[39;49m\u001b[39m.\u001b[39;49mdensmap,\n\u001b[1;32m 2732\u001b[0m \u001b[39mself\u001b[39;49m\u001b[39m.\u001b[39;49m_densmap_kwds,\n\u001b[1;32m 2733\u001b[0m \u001b[39mself\u001b[39;49m\u001b[39m.\u001b[39;49moutput_dens,\n\u001b[1;32m 2734\u001b[0m \u001b[39mself\u001b[39;49m\u001b[39m.\u001b[39;49m_output_distance_func,\n\u001b[1;32m 2735\u001b[0m \u001b[39mself\u001b[39;49m\u001b[39m.\u001b[39;49m_output_metric_kwds,\n\u001b[1;32m 2736\u001b[0m \u001b[39mself\u001b[39;49m\u001b[39m.\u001b[39;49moutput_metric \u001b[39min\u001b[39;49;00m (\u001b[39m\"\u001b[39;49m\u001b[39meuclidean\u001b[39;49m\u001b[39m\"\u001b[39;49m, \u001b[39m\"\u001b[39;49m\u001b[39ml2\u001b[39;49m\u001b[39m\"\u001b[39;49m),\n\u001b[1;32m 2737\u001b[0m \u001b[39mself\u001b[39;49m\u001b[39m.\u001b[39;49mrandom_state \u001b[39mis\u001b[39;49;00m \u001b[39mNone\u001b[39;49;00m,\n\u001b[1;32m 2738\u001b[0m \u001b[39mself\u001b[39;49m\u001b[39m.\u001b[39;49mverbose,\n\u001b[1;32m 2739\u001b[0m tqdm_kwds\u001b[39m=\u001b[39;49m\u001b[39mself\u001b[39;49m\u001b[39m.\u001b[39;49mtqdm_kwds,\n\u001b[1;32m 2740\u001b[0m )\n",
"File \u001b[0;32m/usr/lib/python3.10/site-packages/umap/umap_.py:1066\u001b[0m, in \u001b[0;36msimplicial_set_embedding\u001b[0;34m(data, graph, n_components, initial_alpha, a, b, gamma, negative_sample_rate, n_epochs, init, random_state, metric, metric_kwds, densmap, densmap_kwds, output_dens, output_metric, output_metric_kwds, euclidean_output, parallel, verbose, tqdm_kwds)\u001b[0m\n\u001b[1;32m 1063\u001b[0m n_epochs \u001b[39m=\u001b[39m default_epochs\n\u001b[1;32m 1065\u001b[0m \u001b[39mif\u001b[39;00m n_epochs \u001b[39m>\u001b[39m \u001b[39m10\u001b[39m:\n\u001b[0;32m-> 1066\u001b[0m graph\u001b[39m.\u001b[39mdata[graph\u001b[39m.\u001b[39mdata \u001b[39m<\u001b[39m (graph\u001b[39m.\u001b[39;49mdata\u001b[39m.\u001b[39;49mmax() \u001b[39m/\u001b[39m \u001b[39mfloat\u001b[39m(n_epochs))] \u001b[39m=\u001b[39m \u001b[39m0.0\u001b[39m\n\u001b[1;32m 1067\u001b[0m \u001b[39melse\u001b[39;00m:\n\u001b[1;32m 1068\u001b[0m graph\u001b[39m.\u001b[39mdata[graph\u001b[39m.\u001b[39mdata \u001b[39m<\u001b[39m (graph\u001b[39m.\u001b[39mdata\u001b[39m.\u001b[39mmax() \u001b[39m/\u001b[39m \u001b[39mfloat\u001b[39m(default_epochs))] \u001b[39m=\u001b[39m \u001b[39m0.0\u001b[39m\n",
"File \u001b[0;32m/usr/lib/python3.10/site-packages/numpy/core/_methods.py:40\u001b[0m, in \u001b[0;36m_amax\u001b[0;34m(a, axis, out, keepdims, initial, where)\u001b[0m\n\u001b[1;32m 38\u001b[0m \u001b[39mdef\u001b[39;00m \u001b[39m_amax\u001b[39m(a, axis\u001b[39m=\u001b[39m\u001b[39mNone\u001b[39;00m, out\u001b[39m=\u001b[39m\u001b[39mNone\u001b[39;00m, keepdims\u001b[39m=\u001b[39m\u001b[39mFalse\u001b[39;00m,\n\u001b[1;32m 39\u001b[0m initial\u001b[39m=\u001b[39m_NoValue, where\u001b[39m=\u001b[39m\u001b[39mTrue\u001b[39;00m):\n\u001b[0;32m---> 40\u001b[0m \u001b[39mreturn\u001b[39;00m umr_maximum(a, axis, \u001b[39mNone\u001b[39;49;00m, out, keepdims, initial, where)\n",
"\u001b[0;31mValueError\u001b[0m: zero-size array to reduction operation maximum which has no identity"
]
}
],
"source": [
"ncomp_umap = 5\n",
"embed = UMAP(n_components=ncomp_umap, n_neighbors=5, metric='euclidean').fit_transform(fr_pca_simpl)"
]
},
{
"cell_type": "code",
"execution_count": 109,
"metadata": {},
"outputs": [
{
"ename": "ValueError",
"evalue": "'c' argument has 926 elements, which is inconsistent with 'x' and 'y' with size 913.",
"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:284\u001b[0m, in \u001b[0;36m_to_rgba_no_colorcycle\u001b[0;34m(c, alpha)\u001b[0m\n\u001b[1;32m 283\u001b[0m \u001b[39mif\u001b[39;00m \u001b[39mnot\u001b[39;00m np\u001b[39m.\u001b[39miterable(c):\n\u001b[0;32m--> 284\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 285\u001b[0m \u001b[39mif\u001b[39;00m \u001b[39mlen\u001b[39m(c) \u001b[39mnot\u001b[39;00m \u001b[39min\u001b[39;00m [\u001b[39m3\u001b[39m, \u001b[39m4\u001b[39m]:\n",
"\u001b[0;31mValueError\u001b[0m: Invalid RGBA argument: 9.0",
"\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 104\u001b[0m in \u001b[0;36m<cell line: 11>\u001b[0;34m()\u001b[0m\n\u001b[1;32m <a href='vscode-notebook-cell:/home/ennucore/dev/amgen/exp/ProcessExp.ipynb#ch0000107?line=8'>9</a>\u001b[0m fig, ax \u001b[39m=\u001b[39m plt\u001b[39m.\u001b[39msubplots(\u001b[39m1\u001b[39m, \u001b[39m1\u001b[39m, figsize\u001b[39m=\u001b[39m(\u001b[39m8\u001b[39m, \u001b[39m6\u001b[39m))\n\u001b[1;32m <a href='vscode-notebook-cell:/home/ennucore/dev/amgen/exp/ProcessExp.ipynb#ch0000107?line=9'>10</a>\u001b[0m ax \u001b[39m=\u001b[39m fig\u001b[39m.\u001b[39madd_subplot(\u001b[39m1\u001b[39m, \u001b[39m1\u001b[39m, \u001b[39m1\u001b[39m, projection\u001b[39m=\u001b[39m\u001b[39m'\u001b[39m\u001b[39m3d\u001b[39m\u001b[39m'\u001b[39m)\n\u001b[0;32m---> <a href='vscode-notebook-cell:/home/ennucore/dev/amgen/exp/ProcessExp.ipynb#ch0000107?line=10'>11</a>\u001b[0m ax\u001b[39m.\u001b[39;49mscatter3D(x, y, z, c\u001b[39m=\u001b[39;49mparam_corr[:, \u001b[39m0\u001b[39;49m], cmap\u001b[39m=\u001b[39;49m\u001b[39m'\u001b[39;49m\u001b[39mhsv\u001b[39;49m\u001b[39m'\u001b[39;49m)\n\u001b[1;32m <a href='vscode-notebook-cell:/home/ennucore/dev/amgen/exp/ProcessExp.ipynb#ch0000107?line=11'>12</a>\u001b[0m ax\u001b[39m.\u001b[39mset(xlabel\u001b[39m=\u001b[39m\u001b[39m\"\u001b[39m\u001b[39mU0\u001b[39m\u001b[39m\"\u001b[39m, ylabel\u001b[39m=\u001b[39m\u001b[39m\"\u001b[39m\u001b[39mU1\u001b[39m\u001b[39m\"\u001b[39m, zlabel\u001b[39m=\u001b[39m\u001b[39m\"\u001b[39m\u001b[39mU2\u001b[39m\u001b[39m\"\u001b[39m, xticks\u001b[39m=\u001b[39m[], yticks\u001b[39m=\u001b[39m[], zticks\u001b[39m=\u001b[39m[])\n\u001b[1;32m <a href='vscode-notebook-cell:/home/ennucore/dev/amgen/exp/ProcessExp.ipynb#ch0000107?line=12'>13</a>\u001b[0m fig\u001b[39m.\u001b[39msuptitle(\u001b[39m'\u001b[39m\u001b[39mUMAP 3D\u001b[39m\u001b[39m'\u001b[39m)\n",
"File \u001b[0;32m/usr/lib/python3.10/site-packages/mpl_toolkits/mplot3d/axes3d.py:2416\u001b[0m, in \u001b[0;36mAxes3D.scatter\u001b[0;34m(self, xs, ys, zs, zdir, s, c, depthshade, *args, **kwargs)\u001b[0m\n\u001b[1;32m 2413\u001b[0m \u001b[39mif\u001b[39;00m np\u001b[39m.\u001b[39mmay_share_memory(zs_orig, zs): \u001b[39m# Avoid unnecessary copies.\u001b[39;00m\n\u001b[1;32m 2414\u001b[0m zs \u001b[39m=\u001b[39m zs\u001b[39m.\u001b[39mcopy()\n\u001b[0;32m-> 2416\u001b[0m patches \u001b[39m=\u001b[39m \u001b[39msuper\u001b[39;49m()\u001b[39m.\u001b[39;49mscatter(xs, ys, s\u001b[39m=\u001b[39;49ms, c\u001b[39m=\u001b[39;49mc, \u001b[39m*\u001b[39;49margs, \u001b[39m*\u001b[39;49m\u001b[39m*\u001b[39;49mkwargs)\n\u001b[1;32m 2417\u001b[0m art3d\u001b[39m.\u001b[39mpatch_collection_2d_to_3d(patches, zs\u001b[39m=\u001b[39mzs, zdir\u001b[39m=\u001b[39mzdir,\n\u001b[1;32m 2418\u001b[0m depthshade\u001b[39m=\u001b[39mdepthshade)\n\u001b[1;32m 2420\u001b[0m \u001b[39mif\u001b[39;00m \u001b[39mself\u001b[39m\u001b[39m.\u001b[39m_zmargin \u001b[39m<\u001b[39m \u001b[39m0.05\u001b[39m \u001b[39mand\u001b[39;00m xs\u001b[39m.\u001b[39msize \u001b[39m>\u001b[39m \u001b[39m0\u001b[39m:\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:4356\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 4354\u001b[0m \u001b[39melse\u001b[39;00m:\n\u001b[1;32m 4355\u001b[0m \u001b[39mif\u001b[39;00m \u001b[39mnot\u001b[39;00m valid_shape:\n\u001b[0;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[1;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[0;31mValueError\u001b[0m: 'c' argument has 926 elements, which is inconsistent with 'x' and 'y' with size 913."
]
},
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "c30c2e1b938147c8bd27657deb0d3f42",
"version_major": 2,
"version_minor": 0
},
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAkAAAAGwCAYAAABB4NqyAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8rg+JYAAAACXBIWXMAAAsTAAALEwEAmpwYAACwNklEQVR4nOz9eXhjZ33+j99Hi23JtrzJq7zbs9kz9nibSZp+QihLYEomQ0P4hFJSSMN2hRJ+QEtKf6SBT2lpobS0obRAWFpIAlkgAcJAoA2lLDOZMN738b5qt61dOjrfP4bniSRvkn0kHdnv13XlujIzmqPHskfn1nu5b0GSJBAEQRAEQRwmVOk+AEEQBEEQRKohAUQQBEEQxKGDBBBBEARBEIcOEkAEQRAEQRw6SAARBEEQBHHoIAFEEARBEMShgwQQQRAEQRCHDhJABEEQBEEcOkgAEQRBEARx6CABRBAEQRDEoYMEEEEQBEEQhw4SQARBEARBHDpIABEEQRAEceggAUQQBEEQxKGDBBBBEARBEIcOEkAEQRAEQRw6SAARBEEQBHHoIAFEEARBEMShgwQQQRAEQRCHDhJABEEQBEEcOkgAEQRBEARx6CABRBAEQRDEoYMEEEEQBEEQhw4SQARBEARBHDpIABEEQRAEceggAUQQBEEQxKGDBBBBEARBEIcOEkAEQRAEQRw6SAARBEEQBHHoIAFEEARBEMShgwQQQRAEQRCHDhJABEEQBEE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JAgCT7knQUQQyYcEEEEohMhBZ8bi4iLm5uZw8uRJGAyGTX8nGRWg7X6fhNF1dqqECYKAvLw85OXl8QoRS7ofHx+H3+9Hfn4+X7vPycm
"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,iVBORw0KGgoAAAANSUhEUgAAAkAAAAGwCAYAAABB4NqyAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8rg+JYAAAACXBIWXMAAAsTAAALEwEAmpwYAACwNklEQVR4nOz9eXhjZ33+j99Hi23JtrzJq7zbs9kz9nibSZp+QihLYEomQ0P4hFJSSMN2hRJ+QEtKf6SBT2lpobS0obRAWFpIAlkgAcJAoA2lLDOZMN738b5qt61dOjrfP4bniSRvkn0kHdnv13XlujIzmqPHskfn1nu5b0GSJBAEQRAEQRwmVOk+AEEQBEEQRKohAUQQBEEQxKGDBBBBEARBEIcOEkAEQRAEQRw6SAARBEEQBHHoIAFEEARBEMShgwQQQRAEQRCHDhJABEEQBEEcOkgAEQRBEARx6CABRBAEQRDEoYMEEEEQBEEQhw4SQARBEARBHDpIABEEQRAEceggAUQQBEEQxKGDBBBBEARBEIcOEkAEQRAEQRw6SAARBEEQBHHoIAFEEARBEMShgwQQQRAEQRCHDhJABEEQBEEcOkgAEQRBEARx6CABRBAEQRDEoYMEEEEQBEEQhw4SQARBEARBHDpIABEEQRAEceggAUQQBEEQxKGDBBBBEARBEIcOEkAEQRAEQRw6SAARBEEQBHHoIAFEEARBEMShgwQQQRAEQRCHDhJABEEQBEEcOkgAEQRBEARx6CABRBAEQRDEoYMEEEEQBEEQhw4SQARBEARBHDpIABEEQRAEceggAUQQBEEQxKGDBBBBEARBEIcOEkAEQRAEQRw6SAARBEEQBHHoIAFEEARBEMShgwQQQRAEQRCHDhJABEE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zAAAnx8qKCiIEkSsQhYpiGK3zAiCOByQACKIDCbW22djYwODg4Ooq6uDyWRK+HpKqfokgkajQUlJCR/sDoVCcDqdsNvtmJ6ehiAIUYJIrVYDeFkQ+f1++P1+ANfFFasOsS0zgiAOJiSACCIDYd4+4+PjqKmpgVarxezsLJaXl9He3o7c3Nw9XTcTKkC7odFoYDQaYTQaAQDBYBBOpxNWqxXXrl2DWq3eVhCFw2H4fD5+LSaIKOmeIA4eJIAIIsOI9PZxOBwoKyvD4OAgdDodzp49u+82DhNAbJYo09FqtSgtLUVpaSmA6zNBTqcTZrMZk5OT0Gg0XBAZDAYSRARxSCABRBAZRKy3TzAYRG9vL44dO4aysrJ9Xz/SCPGg3tyzsrJQVlbGXy+/3w+Hw4GVlRWMj48jKysrKuk+VhBduXIFR48eRVZWFgkigshgSAARRAYQGWfBbrKTk5PweDzo7OxEUVGRrM91mG7k2dnZqKio4HloPp8PDocDi4uL2NjYQHZ2dpQgkiSJD0yHw2F4vV7+epEgIojMgQQQQSicWG8fn8+HgYEBvgm1k7FhohyEGaD9kpOTg8rKSlRWVgIAT7qfm5uDy+VCIBDA0tISjEYjcnNzo7bMSBARROZAAoggFAyr+rCqDJtbOXHiBIqLi9HX1yerYNlJAB22yhBDp9NBp9OhqqoKkiThpZdeglqtxszMDNxuN/R6Pa8QsZwyYGtBFOlBRIKIINILCSCCUCCx3j6SJGF0dBQ+ny8qzkLuis1212O/f9hv2IIgQKVSobKykge7ejweOBwOTE1NwePxIDc3NyrpPlIQiaKIUCjEr8cEkUajoaR7gkgxJIAIQmHEevu43W4MDAygqqoKJ06ciLpJsjkUuaAW2O5ECkFBEJCbm4vc3FxUV1dDkiS43W44HA5MTk7C6/VGJd2zHDN2nUhBJAgCT7knQUQQyYcEEEEohMhBZ8bi4iLm5uZw8uRJGAyGTX8nGRWg7X6fhNF1dqqECYK
" </div>\n",
" "
],
"text/plain": [
"Canvas(toolbar=Toolbar(toolitems=[('Home', 'Reset original view', 'home', 'home'), ('Back', 'Back to previous …"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"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 = embed[:,0], embed[:,1], embed[:,2]\n",
"\n",
"fig, ax = plt.subplots(1, 1, figsize=(8, 6))\n",
"ax = fig.add_subplot(1, 1, 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",
"fig.suptitle('UMAP 3D')\n",
"plt.show()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"##### Decoding"
]
},
{
"cell_type": "code",
"execution_count": 13,
"metadata": {},
"outputs": [],
"source": [
"import decoding"
]
},
{
"cell_type": "code",
"execution_count": 80,
"metadata": {},
"outputs": [
{
"ename": "NotImplementedError",
"evalue": "Axes3D currently only supports the aspect argument 'auto'. You passed in 'equal'.",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mNotImplementedError\u001b[0m Traceback (most recent call last)",
"\u001b[1;32m/home/ennucore/dev/amgen/exp/ProcessExp.ipynb Cell 103\u001b[0m in \u001b[0;36m<cell line: 2>\u001b[0;34m()\u001b[0m\n\u001b[1;32m <a href='vscode-notebook-cell:/home/ennucore/dev/amgen/exp/ProcessExp.ipynb#ch0000093?line=0'>1</a>\u001b[0m \u001b[39m# param = decoding.cohomological_parameterization(pd.DataFrame(firing_rates_in_trials_pca.reshape((400*50, -1))[::41]))\u001b[39;00m\n\u001b[0;32m----> <a href='vscode-notebook-cell:/home/ennucore/dev/amgen/exp/ProcessExp.ipynb#ch0000093?line=1'>2</a>\u001b[0m param \u001b[39m=\u001b[39m decoding\u001b[39m.\u001b[39;49mcohomological_parameterization(fr_pca_simpl)\n",
"File \u001b[0;32m~/dev/amgen/exp/../model/decoding.py:95\u001b[0m, in \u001b[0;36mcohomological_parameterization\u001b[0;34m(X, cocycle_number, coeff, weighted)\u001b[0m\n\u001b[1;32m 93\u001b[0m idx \u001b[39m=\u001b[39m np\u001b[39m.\u001b[39margsort(dgm1[:, \u001b[39m1\u001b[39m] \u001b[39m-\u001b[39m dgm1[:, \u001b[39m0\u001b[39m])[\u001b[39m-\u001b[39mcocycle_number]\n\u001b[1;32m 94\u001b[0m cocycle \u001b[39m=\u001b[39m cocycles[\u001b[39m1\u001b[39m][idx]\n\u001b[0;32m---> 95\u001b[0m persistence(X, homdim\u001b[39m=\u001b[39;49m\u001b[39m1\u001b[39;49m, coeff\u001b[39m=\u001b[39;49mcoeff, show_largest_homology\u001b[39m=\u001b[39;49m\u001b[39m0\u001b[39;49m,\n\u001b[1;32m 96\u001b[0m Nsubsamples\u001b[39m=\u001b[39;49m\u001b[39m0\u001b[39;49m, save_path\u001b[39m=\u001b[39;49m\u001b[39mNone\u001b[39;49;00m, cycle\u001b[39m=\u001b[39;49midx)\n\u001b[1;32m 97\u001b[0m thresh \u001b[39m=\u001b[39m dgm1[idx, \u001b[39m1\u001b[39m] \u001b[39m-\u001b[39m EPSILON\n\u001b[1;32m 99\u001b[0m \u001b[39m# Compute connectivity\u001b[39;00m\n",
"File \u001b[0;32m~/dev/amgen/exp/../model/decorators.py:19\u001b[0m, in \u001b[0;36mmulti_input.<locals>.wrapper\u001b[0;34m(data, *args, **kwargs)\u001b[0m\n\u001b[1;32m 17\u001b[0m \u001b[39mreturn\u001b[39;00m output_data\n\u001b[1;32m 18\u001b[0m \u001b[39melse\u001b[39;00m:\n\u001b[0;32m---> 19\u001b[0m \u001b[39mreturn\u001b[39;00m f(data, \u001b[39m*\u001b[39;49margs, \u001b[39m*\u001b[39;49m\u001b[39m*\u001b[39;49mkwargs)\n",
"File \u001b[0;32m~/dev/amgen/exp/../model/persistence.py:97\u001b[0m, in \u001b[0;36mpersistence\u001b[0;34m(X, homdim, coeff, threshold, show_largest_homology, distance_matrix, Nsubsamples, alpha, cycle, save_path)\u001b[0m\n\u001b[1;32m 94\u001b[0m result \u001b[39m=\u001b[39m ripser\u001b[39m.\u001b[39mripser(X, maxdim\u001b[39m=\u001b[39mhomdim, coeff\u001b[39m=\u001b[39mcoeff, do_cocycles\u001b[39m=\u001b[39m\u001b[39mTrue\u001b[39;00m,\n\u001b[1;32m 95\u001b[0m distance_matrix\u001b[39m=\u001b[39mdistance_matrix, thresh\u001b[39m=\u001b[39mthreshold)\n\u001b[1;32m 96\u001b[0m diagrams \u001b[39m=\u001b[39m result[\u001b[39m'\u001b[39m\u001b[39mdgms\u001b[39m\u001b[39m'\u001b[39m]\n\u001b[0;32m---> 97\u001b[0m plot_diagrams(diagrams, show\u001b[39m=\u001b[39;49m\u001b[39mFalse\u001b[39;49;00m)\n\u001b[1;32m 98\u001b[0m \u001b[39mif\u001b[39;00m (Nsubsamples\u001b[39m>\u001b[39m\u001b[39m0\u001b[39m):\n\u001b[1;32m 99\u001b[0m conf \u001b[39m=\u001b[39m confidence(X, alpha, Nsubsamples, homdim, \u001b[39m2\u001b[39m)\n",
"File \u001b[0;32m/usr/lib/python3.10/site-packages/persim/visuals.py:157\u001b[0m, in \u001b[0;36mplot_diagrams\u001b[0;34m(diagrams, plot_only, title, xy_range, labels, colormap, size, ax_color, diagonal, lifetime, legend, show, ax)\u001b[0m\n\u001b[1;32m 155\u001b[0m ax\u001b[39m.\u001b[39mset_xlim([x_down, x_up])\n\u001b[1;32m 156\u001b[0m ax\u001b[39m.\u001b[39mset_ylim([y_down, y_up])\n\u001b[0;32m--> 157\u001b[0m ax\u001b[39m.\u001b[39;49mset_aspect(\u001b[39m'\u001b[39;49m\u001b[39mequal\u001b[39;49m\u001b[39m'\u001b[39;49m, \u001b[39m'\u001b[39;49m\u001b[39mbox\u001b[39;49m\u001b[39m'\u001b[39;49m)\n\u001b[1;32m 159\u001b[0m \u001b[39mif\u001b[39;00m title \u001b[39mis\u001b[39;00m \u001b[39mnot\u001b[39;00m \u001b[39mNone\u001b[39;00m:\n\u001b[1;32m 160\u001b[0m ax\u001b[39m.\u001b[39mset_title(title)\n",
"File \u001b[0;32m/usr/lib/python3.10/site-packages/mpl_toolkits/mplot3d/axes3d.py:323\u001b[0m, in \u001b[0;36mAxes3D.set_aspect\u001b[0;34m(self, aspect, adjustable, anchor, share)\u001b[0m\n\u001b[1;32m 270\u001b[0m \u001b[39m\"\"\"\u001b[39;00m\n\u001b[1;32m 271\u001b[0m \u001b[39mSet the aspect ratios.\u001b[39;00m\n\u001b[1;32m 272\u001b[0m \n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 320\u001b[0m \u001b[39mmpl_toolkits.mplot3d.axes3d.Axes3D.set_box_aspect\u001b[39;00m\n\u001b[1;32m 321\u001b[0m \u001b[39m\"\"\"\u001b[39;00m\n\u001b[1;32m 322\u001b[0m \u001b[39mif\u001b[39;00m aspect \u001b[39m!=\u001b[39m \u001b[39m'\u001b[39m\u001b[39mauto\u001b[39m\u001b[39m'\u001b[39m:\n\u001b[0;32m--> 323\u001b[0m \u001b[39mraise\u001b[39;00m \u001b[39mNotImplementedError\u001b[39;00m(\n\u001b[1;32m 324\u001b[0m \u001b[39m\"\u001b[39m\u001b[39mAxes3D currently only supports the aspect argument \u001b[39m\u001b[39m\"\u001b[39m\n\u001b[1;32m 325\u001b[0m \u001b[39mf\u001b[39m\u001b[39m\"\u001b[39m\u001b[39m'\u001b[39m\u001b[39mauto\u001b[39m\u001b[39m'\u001b[39m\u001b[39m. You passed in \u001b[39m\u001b[39m{\u001b[39;00maspect\u001b[39m!r}\u001b[39;00m\u001b[39m.\u001b[39m\u001b[39m\"\u001b[39m\n\u001b[1;32m 326\u001b[0m )\n\u001b[1;32m 328\u001b[0m \u001b[39mif\u001b[39;00m share:\n\u001b[1;32m 329\u001b[0m axes \u001b[39m=\u001b[39m {\u001b[39m*\u001b[39m\u001b[39mself\u001b[39m\u001b[39m.\u001b[39m_shared_x_axes\u001b[39m.\u001b[39mget_siblings(\u001b[39mself\u001b[39m),\n\u001b[1;32m 330\u001b[0m \u001b[39m*\u001b[39m\u001b[39mself\u001b[39m\u001b[39m.\u001b[39m_shared_y_axes\u001b[39m.\u001b[39mget_siblings(\u001b[39mself\u001b[39m),\n\u001b[1;32m 331\u001b[0m \u001b[39m*\u001b[39m\u001b[39mself\u001b[39m\u001b[39m.\u001b[39m_shared_z_axes\u001b[39m.\u001b[39mget_siblings(\u001b[39mself\u001b[39m),\n\u001b[1;32m 332\u001b[0m }\n",
"\u001b[0;31mNotImplementedError\u001b[0m: Axes3D currently only supports the aspect argument 'auto'. You passed in 'equal'."
]
}
],
"source": [
"# param = decoding.cohomological_parameterization(pd.DataFrame(firing_rates_in_trials_pca.reshape((400*50, -1))[::41]))\n",
"param = decoding.cohomological_parameterization(fr_pca_simpl)\n"
]
},
{
"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": 25,
"metadata": {},
"outputs": [
{
"ename": "ValueError",
"evalue": "'c' argument must be a color, a sequence of colors, or a sequence of numbers, not decoding\n0 5.648858e-10\n1 8.865429e-01\n2 8.865876e-01\n3 8.864820e-01\n4 8.867152e-01\n.. ...\n641 8.865732e-01\n642 8.861918e-01\n643 8.865706e-01\n644 8.865345e-01\n645 8.863632e-01\n\n[646 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 98\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, cmap\u001b[39m=\u001b[39;49m\u001b[39m'\u001b[39;49m\u001b[39mRdBu\u001b[39;49m\u001b[39m'\u001b[39;49m)\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 5.648858e-10\n1 8.865429e-01\n2 8.865876e-01\n3 8.864820e-01\n4 8.867152e-01\n.. ...\n641 8.865732e-01\n642 8.861918e-01\n643 8.865706e-01\n644 8.865345e-01\n645 8.863632e-01\n\n[646 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/48QTTzxiT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T0xCc/+cmYOnVqPPjggzFjxoz4y1/+Eqeeeupw7B8AmEAKsizL8llQXV0d559/fqxbty4iIvr6+qKysjKuv/76WL58+RHz169fH9/73vdiz549ccIJJwxpk52dnVFWVhYdHR1RWlo6pPsAAEbXSPz8zuulop6entixY0fU1tb+9w4KC6O2tjZaWloGXfOrX/0qampqYunSpVFeXh5nn312rF69Onp7e496ne7u7ujs7BxwAwDIK1wOHDgQvb29UV5ePmC8vLw82traBl2zd+/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, cmap='RdBu')"
]
},
{
"cell_type": "code",
"execution_count": 67,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"<matplotlib.collections.PathCollection at 0x7fdf498f2080>"
]
},
"execution_count": 67,
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAiQAAAGdCAYAAAAi3mhQAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8rg+JYAAAACXBIWXMAAA9hAAAPYQGoP6dpAAA380lEQVR4nO3dfXxU9Z33//ckkgSEDMSQGzAI4l3TKAhKTK20ahS0F8p297oo1kKpxZVi15rWhVglUrvGrlt/elUKK9vWdq1C6+UdK03XRlGpUSpIawyiYBCKSbgrSQQhMvP9/ZGdMTPJJGcmc+bMmXk9H488HjDzmcl3vnNu3vme7znHY4wxAgAAcFCG0w0AAAAgkAAAAMcRSAAAgOMIJAAAwHEEEgAA4DgCCQAAcByBBAAAOI5AAgAAHHeS0w2wwu/368MPP9SIESPk8Xicbg4AALDAGKPOzk6NGTNGGRn9j4G4IpB8+OGHKikpcboZAAAgBnv27NGpp57ab40rAsmIESMkdX+g3Nxch1sDAACs6OjoUElJSXA/3h9XBJLAYZrc3FwCCQAALmNlugWTWgEAgOMIJAAAwHEEEgAA4DgCCQAAcByBBAAAOI5AAgAAHEcgAQAAjiOQAAAAx7niwmgA3MHnN9rUfEj7Oo+pYESOpk3IU2YG95+S6Jv+2N039L07RB1IXn75Zd13333avHmzWlpa9NRTT2n27Nn9vmbDhg2qqqrS22+/rZKSEt1xxx36+te/HmOTASSjusYWLV/XpJb2Y8HHir05qplVqpllxQ62zHn0TWR29w197x5RH7I5cuSIJk2apBUrVliqb25u1pe+9CVdeuml2rp1q77zne/om9/8pn7/+99H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9m1TSjyDo1rXSpKtn2hxxiT9Lee7ejokNfrVXt7u3Jzcwf1XpE2DoFNZjKfBtaw86Dmrn5twLrHF14U9V96Pr/R53/0woBDvxuXXBbzDsbOvk9E+6Xuz3DXs00hx52LcnN01zXJe0+PnuwMDHWNLap5plFtnV3BxwpHZGn5tWVJu07ZLbBcRjqcGK/lMvC73BYGE7FN6O9QbnGc+t6NIvW91N3/8doXRrP/TquzbAaa+GjkzPX7rZo2IU8jhw3pt2bksCExHS8ODP1G+uSDvfuj3ffcSMTZEnWNLbrp0S29JsG1dhzTTYM8i8ftZwgF+qZnGJGkts6uQfeNm0Uzt2mw7Dp7LcDnN2rYeVDPbN2rhp0HB72dTNQ2IVIveBS/w1nx7hu737u/vpec2xem1SGbaE4DS5ZJPtFK1pyfiEmnM8uKdeP0CVr9SrN6jvt5PNLCSyYMKu37/EZLn3yr35rqJ9+K6SyeRJ0hZNcIjM9vVPWbP/dbU/WbP8flDKePu3y6Z32Tdh08qvGnDNPtV5dqaFbmoN4zgLlNkdkxMpiobUJfh7PiOfJo58imXe+drPvCtAokiTwNzK6bmB0++km/NX87+klMC5GdO1wpMRvmusYWPfxyc68du99ID7/crPPHjYp5JX7t/YOW+v619w/q4jPyo3rvRF3wzq55DK++d0BHu3z91hzt8unV9w7okrNHx/Q7JGnhr/6k55v2Bf//ynvSf762W1eUFmj1vAtjfl8psMN9W60dn55xUZSbrbuu+Wzaz20KjH6FC4wMropx2UlUWJtZVqwvnFVgS5C1c72y871b2z+Oa128pFUgSdRpYHWNLVr29Fva99GnO7CC4UP0g9nnJu1NzOzc4Ur2b5gHGoKUBjfK0LDzoOW6aPvH7g2z3SMw/2/LXy3XxRpIwsNIT8837dPCX/0p5lASeYd7fFA7XOnTw6z9rVujYjzM2lP3/J231db56barcES2ll87uEDl8xt9d4DRr+/+NrbRLzvv4tx
"text/plain": [
"<Figure size 640x480 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"plt.scatter(param_corr[:, 1], 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/f2pSJ1VCRHLhCBEREREpHgMRERERKR4DERERESkeAxEREREpnqyBqHv37lCpVOc8MjMzAQD19fXIz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zV7PM5vN0j6r1YqYmBiv/VqtFpGRkV5tWjrGma9xpvnz58NkMkmPxMTEdugtERER+SpZA5HL5cKgQYPw/PPP49prr8Wjjz6KSZMmYcmSJXKWhTlz5sBms0mPY8eOyVoPERERdSxZA1FcXBxSUlK8tvXr1w9FRe7z+bGxsQCA0tJSrzalpaXSvtjYWJSVlXntb2pqQkVFhVeblo5x5mucSa/Xw2g0ej2IiIgocMkaiG644QYUFBR4bTtw4AC6desGAEhOTkZsbCxycnKk/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
}