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.

1816 lines
7.2 MiB

{
"cells": [
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"stim_data.pkl\n",
"dict_keys(['stim_val', 'trial_stim_id', 'key_list', 'num_trial', 'trial_pair_id', 'pair_val', 'pair_trial_id', 'stim_id_trial', 'num_stim'])\n",
"spike_data.pkl\n",
"dict_keys(['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",
"corr_data.pkl\n",
"dict_keys(['corr_stim_unit', 'optimal_avg_firing_rate', 'stim_hist', 'stim_hist_caution'])\n"
]
}
],
"source": [
"# load data\n",
"\n",
"import numpy as np\n",
"import matplotlib.pyplot as plt\n",
"import pandas as pd\n",
"import scipy.stats as sts\n",
"import pickle\n",
"import ipywidgets as widgets\n",
"from mpl_toolkits import mplot3d\n",
"from mpl_toolkits.mplot3d import Axes3D\n",
"from scipy import sparse\n",
"from matplotlib import cm\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')\n",
"\n",
"# load and process stimuli\n",
"execfile('Stimulus.py')\n",
"data_folder = \"../data/\"\n",
"stim_file = \"Stiminfo_PVCre_2021_0012_s06_e14.csv\"\n",
"stim = pd.read_csv(data_folder+stim_file)\n",
"num_trial = len(stim)\n",
"\n",
"# load and process spikes\n",
"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",
"\n",
"\n",
"# sort by firing rate\n",
"num_spike = list(map(len, spike_times))\n",
"spike_times = spike_times[np.argsort(num_spike)[::-1]]\n",
"execfile('load.py')\n",
"\n",
"# 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)\n",
"\n",
"# binary spike and stimulus trains\n",
"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)))\n",
"\n",
"# histogram error bars: num spikes\n",
"# spike_count = np.zeros((num_unit, 2))\n",
"# for unit_id in range(num_unit):\n",
"# # print(\"unit: %d\"%unit_id)\n",
"# a = np.zeros(len(tau_id_range))\n",
"# for tau_id in tau_id_range:\n",
"# a[tau_id] = np.sum(B_spike[unit_id].col >= tau_id)\n",
" \n",
"# spike_count[unit_id] = [np.mean(a), np.std(a)]\n",
"\n",
"key_symbol = {'pair':'$(\\\\theta,\\phi)$', 'orientation':'$\\\\theta$', 'phase':'$\\phi$'}\n",
"\n",
"# 2D tuning\n",
"avg_firing_rate_pair = np.array([\n",
" sts.zscore(stim_hist['pair'][unit_id]).reshape((len(tau_id_range), num_stim['orientation'], num_stim['phase'])) \n",
" for unit_id in range(num_unit)])\n",
"\n",
"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]\n",
"\n"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
"# # tuning score\n",
"\n",
"# 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]\n",
" \n",
"# from scipy.stats import zscore\n",
"\n",
"# var_tuning = {}\n",
"# stim_hist_KL_div = {}\n",
"# for key in key_list:\n",
"# var_tuning[key] = np.zeros((num_unit, len(tau_id_range)))\n",
"# stim_hist_KL_div[key] = np.zeros((num_unit, len(tau_id_range)))\n",
"\n",
"# for unit_id in range(num_unit):\n",
"# var_tuning[key][unit_id] = zscore(np.var(stim_hist[key][unit_id], axis=1))\n",
"# for tau_id in tau_id_range:\n",
"# p_non = (1-np.sum(stim_hist[key][unit_id, tau_id]))\n",
"# s_non = 0\n",
"# if p_non > 0:\n",
"# s_non = -p_non * np.log10(p_non)\n",
" \n",
"# nonzero_id = np.where(stim_hist[key][unit_id, tau_id] != 0)\n",
"# p_stim = stim_hist[key][unit_id, tau_id, nonzero_id]\n",
"# if np.any(p_stim<=0):\n",
"# print('p_stim')\n",
"\n",
"# if p_non >1 or np.any(p_stim>1):\n",
"# print('wrong')\n",
" \n",
"# s_stim = -p_stim * np.log10(p_stim)\n",
"# ent = np.sum(s_stim) + s_non\n",
"# if ent<0:\n",
"# print('negative stim_hist_KL_div')\n",
"# # if kl < 0:\n",
"# # print(unit_id, tau_id, stim_id)\n",
"# stim_hist_KL_div[key][unit_id, tau_id] = np.log10(num_stim[key]+1) - ent # KL div\n",
"\n",
"# # normalize KL div for each unit\n",
"\n",
"# stim_hist_KL_div_norm = {}\n",
"# for key in key_list:\n",
"# stim_hist_KL_div_norm[key] = zscore(stim_hist_KL_div[key], axis=1)\n",
" \n",
"# tuning_score = {}\n",
"# for key in key_list:\n",
"# tuning_score[key] = np.max(stim_hist_KL_div[key], axis=1)\n",
" \n",
"# unit_tuning_order = np.argsort(tuning_score['pair'])[::-1]\n",
"# unit_tuning2rate_order = np.argsort(unit_tuning_order)\n",
"\n",
"# snr = {}\n",
"# for key in key_list:\n",
"# snr[key] = np.mean(stim_hist[key], axis=2)/np.std(stim_hist['phase'], axis=2)\n"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAYEAAAD4CAYAAAAKA1qZAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8rg+JYAAAACXBIWXMAAAsTAAALEwEAmpwYAAATjUlEQVR4nO3dfZBd9X3f8fenQkDiJ4S1TT0SQrKrTk2CDe5G2LVr44ktRNIgd4InIk/ExaOUQuPGbaZQd6DFk5k0zOSZGDSJBrtTA7UTt+qMbKzG2CRxwFqwDEYOZi07RSpTNghDbFyw8Ld/3IPnsuxqr/be1V30e79m7uw5v4d7v7+5y3507jmXk6pCktSmvzPuAiRJ42MISFLDDAFJapghIEkNMwQkqWEnjbuAuaxevbrWr18/7jKe55vfhe96IdVxVU99m5d896lxl9GUFStXcuppp427DC3CPffc8zdVNXGs85ZlCKxfv56pqalxl/E8H/oGrD113FW05S9u/xzvOf3JcZfRlCcPHuRHL7983GVoEZL89WLm+XGQJDXMEJCkhhkCktQwQ0CSGmYISFLDFgyBJGckuSPJ/iQPJHnfHGOS5HeTTCe5L8kb+vouTfJQ97h01AuQJC3eIJeIHgH+TVXdm+RlwD1J9lTV/r4xFwIbu8d5w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ctbc04FrgUmggHu6uY+PpHpJ0lAGORLYBExX1YGqega4Fdg64PNfAOypqsPdH/49wJbFlSpJGrVBbi+5Bni4b/8gcN4c434qyVuBrwK/UlUPzzN3zVwvkmQ7sB1g3bp1A5Sl4+V9737TuEto0vVn18KDxuC2X1rc78Ni5y3lc42ypherUZ0Y/p/A+qp6Hb1/7X/4WJ+gqnZU1WRVTU5MTIyoLEnS0QwSAoeAM/r213Z
"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.show()"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAfAAAAIUCAYAAADlkX7vAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8rg+JYAAAACXBIWXMAAAsTAAALEwEAmpwYAABGYElEQVR4nO3dd3hUZfrG8e+TDqFX6aGDgCCEqmLvvWLBgoqKrrrquuq667quvaxlV5G1V1Qsa8deUEAISJPepJdQU0h/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FS6V9cyShyR7dX2EaFNuTleO28AQ/fyPr4IrCnjtcaEgmv3OcubvPfkj6WMe6LX798ckV5inAsJHRSY5S2PBcB/gLYllsPdpUz7APAzodO3sggF+XUlxokhtMl/tvce7PAeP1hWTcWmjSN0RP1ir6+bCf1QK75suxM6PXCH1/5UQj+kireze/nHlTKPUvtW0eVHiaPQK/oZIvTj9klv+RWx5xCS3x6FXmz8kd77lktoE/8rQKsS46wEXi2jj3f6/f2gv+j6M+fK2qUkEj2KXTgj3gX46mEiItVF+8BFREQCSAEuIiISQNqELiIiEkBaAxcREQkgBbiIiEgAKcBFREQCSAEuIiISQApwERGRAFKAi4iIBJACXEREJIAU4CIiIgGkABcREQkgBbiIiEgAKcBFREQCSAEuIiISQApwERGRAFKAi4iIBJACXEREJIAU4CIiIgGkABcREQkgBbiIiEgAKcBFREQCSAEuIiISQApwEREJLDNzZtalktNeYGafV3dNkWLOOb9rEBERqRQzc0BX59zSvYyXAqwA4p1zBZG
"text/plain": [
"<Figure size 504x504 with 7 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"from matplotlib import gridspec\n",
"\n",
"fig, ax = plt.subplots(3,1,figsize=(7,7))\n",
"gs0 = gridspec.GridSpec(3, 3, figure=fig, hspace=0, wspace=0)\n",
"\n",
"stim_id = 10\n",
"trial_id = stim_id_trial['phase'][stim_id][0]\n",
"unit_id = 0\n",
"t_on, t_off = stim['stim_ontime'][trial_id], stim['stim_offtime'][trial_id]\n",
"t0, t1 = t_off-0.2, t_off+0.1\n",
"stim_prev_id = trial_stim_id['phase'][trial_id-1]\n",
"t_prev_on, t_prev_off = stim['stim_ontime'][trial_id-1], stim['stim_offtime'][trial_id-1]\n",
"spikes = spike_times[unit_id][np.where((t0 < spike_times[unit_id]) & (spike_times[unit_id] < t1))]\n",
"\n",
"ax0 = fig.add_subplot(gs0[0, :-1])\n",
"ax1 = fig.add_subplot(gs0[1, :-1])\n",
"ax2 = fig.add_subplot(gs0[2, :-1])\n",
"ax3 = fig.add_subplot(gs0[:, -1])\n",
"\n",
"ax0.axvspan(t_on, t_off, color=cmap_jet(1-np.abs(stim_id-10)/10), alpha=0.3, label='preferred')\n",
"ax0.axvspan(t_prev_on, t_prev_off, color=cmap_jet(1-np.abs(stim_prev_id-10)/10), alpha=0.3, label='non-preferred')\n",
"ax0.eventplot(spikes)\n",
"ax0.set_xlim([t0, t1])\n",
"ax0.legend(loc='upper left')\n",
"\n",
"ax1.axvspan(t_on, t_off, color=cmap_jet(1-np.abs(stim_id-10)/10), alpha=0.3)\n",
"ax1.axvspan(t_prev_on, t_prev_off, color=cmap_jet(1-np.abs(stim_prev_id-10)/10), alpha=0.3)\n",
"ax1.eventplot(spikes-0.05)\n",
"ax1.set_xlim([t0, t1])\n",
"\n",
"ax2.axvspan(t_on, t_off, color=cmap_jet(1-np.abs(stim_id-10)/10), alpha=0.3)\n",
"ax2.axvspan(t_prev_on, t_prev_off, color=cmap_jet(1-np.abs(stim_prev_id-10)/10), alpha=0.3)\n",
"ax2.eventplot(spikes-0.15)\n",
"ax2.set_xlim([t0, t1])\n",
"\n",
"ax3.plot(np.sin(np.pi*tau_id_range/300), np.arange(300))\n",
"ax3.set_xticks([])\n",
"ax3.set_yticks([])\n",
"ax3.set_title('reverse correlation')\n",
"# ax2.legend()\n",
"for ax in fig.get_axes():\n",
" ax.tick_params(bottom=False, labelbottom=False, left=False, labelleft=False)\n",
"\n",
"ax2.tick_params(bottom=True, labelbottom=True)\n",
"ax2.set_xlabel('t/s')\n",
"plt.tight_layout()\n",
"fig.suptitle('subspace reverse correlation', size=16, y=1.05)\n",
"plt.show()\n"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [],
"source": [
"# # subspace reverese correlation\n",
"# fig, ax = plt.subplots(2,1,figsize=(7,7))\n",
"# stim_id = 13\n",
"# trial_id = stim_id_trial['phase'][stim_id][0]-3\n",
"# stim_id = trial_stim_id['phase'][trial_id]\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.5, t_off+0.5\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((t_off-0.5 < spike_times[unit_id]) & (spike_times[unit_id] < t_off+0.2))]\n",
"# ax[0].axvspan(t_on, t_off, color=cmap_jet(1-np.abs(stim_id-10)/10), alpha=0.3)\n",
"# ax[0].axvspan(t_prev_on, t_prev_off, color=cmap_jet(1-np.abs(stim_prev_id-10)/10), alpha=0.3)\n",
"# ax[0].eventplot(spikes)\n",
"# ax[0].set_xlim([t0, t1])\n",
"# ax[1].plot(np.arange(t0, t1, dt), step_stim[int(t0//dt): int(t1//dt)])\n",
"# # ax[1].plot(np.arange(t0, t1), step_stim[int(t0//dt): int(t1//dt)])\n",
"\n",
"# ax[1].set(ylabel='phase', xlabel='time')\n",
"# plt.show()"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAeUAAAGpCAYAAACzqi51AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8rg+JYAAAACXBIWXMAAAsTAAALEwEAmpwYAAAzVElEQVR4nO3deZwV9ZX//9c7NgZFBVQUBpiAcWVA2QQMJm6TuIRvMI4xGhNATchiHJ3xoVHHqJPE35iJ0ejEDUXBDG7jFidxTJTRGBOXATSCEEeiqO3QQlQQ19jk/P6oanNterndfW9V3b7v5+PRj771qapb51Z339NV99QpRQRmZmaWvw/lHYCZmZklnJTNzMwKwknZzMysIJyUzczMCsJJ2czMrCAa8g6gJ7bffvsYMWJE3mGYmVmBLF68+I8RMSjvOLqjppPyiBEjWLRoUd5hmJlZgUh6P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lqdcP1OWNAIYBzwK7BgRq9NZTSSnt9taZ7akRZIWrV27NptAzczMMpBbUpa0FXAbcEpEvF46L5IPutv8sDsi5kTExIiYOGjQoAwiNTMzy0YuSVlSH5KEvCAibk+HX5Y0JJ0/BFiTR2xmZmZ5yaP6WiSfGb8aEaeUjP8AeCUiLpB0BrBtRJze0XPVS/W19T55V6eaVUsRfrdrufq6IYdtTgW+BCyV9EQ6dhZwAXCLpBOA54GjcojNzMwsN5kn5Yh4CFA7sw/KMhYzM7MicUcvMzOzgnBSNjMzKwgnZTMzs4LIvPq6klx9bWZmrdV
"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 = [spike_times[unit_id][np.where((t_on[0] < spike_times[unit_id]) & (spike_times[unit_id] < t_on[-1]))] 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",
"\n",
"plt.show()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Phase reference changes with orientation"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [],
"source": [
"from tqdm import trange\n",
"import sys\n",
"sys.path.insert(0, './Persistent_Homology')\n",
"sys.path.insert(0, '../numerical')\n",
"\n",
"import gratings\n",
"import decorator"
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "7dc1b6ee06bf4540a417ab8eadea52f6",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"interactive(children=(FloatSlider(value=0.0, description='stim_theta', max=180.0, step=5.0), FloatSlider(value…"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"%matplotlib inline\n",
"@widgets.interact(\n",
" stim_theta = widgets.FloatSlider(0, min=0, max=180, step=5),\n",
" stim_phi = widgets.FloatSlider(90, min=0, max=360, step=10),\n",
" stim_freq = widgets.FloatSlider(1.5, min=0, max=10, step=0.5),\n",
" RF_theta = widgets.FloatSlider(0, min=0, max=180, step=5),\n",
" RF_phi = widgets.FloatSlider(90, min=0, max=360, step=10),\n",
" RF_freq = widgets.FloatSlider(1.5, min=0, max=10, step=0.5),\n",
" RF_radius = widgets.FloatSlider(0.5, min=0, max=1, step=0.1), \n",
" RF_x = widgets.FloatSlider(0.5, min=-1, max=1, step=0.1),\n",
" RF_y = widgets.FloatSlider(-0.5, min=-1, max=1, step=0.1)\n",
" )\n",
"\n",
"def plot_grating(stim_theta, stim_phi, stim_freq, RF_theta, RF_phi, RF_freq, RF_radius, RF_x, RF_y):\n",
" stim_grating = (stim_theta/180*np.pi, stim_freq, stim_phi/180*np.pi, 1)\n",
" RF_grating = (RF_theta/180*np.pi, RF_freq, RF_phi/180*np.pi, 1)\n",
" stim_grat_image = gratings.grating_image(grating=stim_grating, plot=False)\n",
" RF_grat_image = gratings.grating_image(grating=RF_grating, gabor=True, rf_sigma=RF_radius, center=(RF_y, RF_x), plot=False)\n",
" \n",
" fig, ax = plt.subplots(1,5, figsize=(25,6))\n",
"\n",
" ax[0].imshow(stim_grat_image,\"gray\", vmin = -1, vmax = 1, extent=[-1,1,1,-1]) \n",
" receptive_field = plt.Circle((RF_x, RF_y), RF_radius, color='b', fill=False)\n",
" ax[0].add_patch(receptive_field)\n",
" ax[0].legend([receptive_field], ['receptive field'])\n",
" ax[0].invert_yaxis()\n",
"\n",
" ax[1].imshow(RF_grat_image,\"gray\", vmin = -1, vmax = 1, extent=[-1,1,1,-1]) \n",
" receptive_field = plt.Circle((RF_x, RF_y), RF_radius, color='b', fill=False)\n",
" ax[1].add_patch(receptive_field)\n",
" ax[1].legend([receptive_field], ['receptive field']) \n",
" ax[1].invert_yaxis()\n",
"\n",
" response = gratings.response(RF_grating, stim_grating, rf_sigma=RF_radius, center=(RF_y, RF_x))\n",
" ax[2].axhline(response)\n",
" ax[2].set(ylim=[0,1])\n",
"\n",
" # Nstim = (20, 1, 20, 1)\n",
" # stim_list = gratings.get_locations(Nstim)\n",
" # rates = np.zeros([len(stim_list)])\n",
" # iterator = trange(0, len(stim_list), position=0, leave=True)\n",
" # iterator.set_description(\"Simulating data stim_list\")\n",
" # for i in iterator:\n",
" # rates[i] = response(stim_list[i], RF_grating, rf_sigma=RF_radius, center=(RF_y, RF_x))\n",
"\n",
" plt.show()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Stimulus pair sequence (History or change dependence)"
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {},
"outputs": [
{
"ename": "SyntaxError",
"evalue": "incomplete input (619742353.py, line 2)",
"output_type": "error",
"traceback": [
"\u001b[0;36m Input \u001b[0;32mIn [9]\u001b[0;36m\u001b[0m\n\u001b[0;31m \u001b[0m\n\u001b[0m ^\u001b[0m\n\u001b[0;31mSyntaxError\u001b[0m\u001b[0;31m:\u001b[0m incomplete input\n"
]
}
],
"source": [
"def coarse_grain(stim_range):\n",
" "
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# # sort by tuning score\n",
"# for key in key_list:\n",
"\n",
"# stim_hist[key] = stim_hist[key][unit_tuning_order]\n",
"# stim_hist_KL_div[key] = stim_hist_KL_div[key][unit_tuning_order]\n",
"# stim_hist_KL_div_norm[key] = stim_hist_KL_div_norm[key][unit_tuning_order]\n",
"# tuning_score[key] = tuning_score[key][unit_tuning_order]\n",
"# var_tuning[key] = var_tuning[key][unit_tuning_order]\n",
"# snr[key] = snr[key][unit_tuning_order]\n",
"\n",
"# s = s[:num_unit][unit_tuning_order]"
]
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "dd669e607c4e4619b78a3e04b7d0599f",
"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": [
"%matplotlib inline\n",
"\n",
"@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": "code",
"execution_count": null,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAABrYAAAfYCAYAAABrHO3jAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8rg+JYAAAACXBIWXMAAAsTAAALEwEAmpwYAAEAAElEQVR4nOzdd3hcZ5n+8ftRL1a3XGTZsh33xCWxcXpI7xBKAglZEiAhsBAIsAsbloVfKAsL7AKBhYVAgNASILRAKmmkFztx7LjGvVcVq7d5fn+cI2WsSLKsMppjfT/XNZdnzpyZec+MPPec87zve8zdBQAAAAAAAAAAACS7lOFuAAAAAAAAAAAAANAXFLYAAAAAAAAAAAAQCRS2AAAAAAAAAAAAEAkUtgAAAAAAAAAAABAJFLYAAAAAAAAAAAAQCRS2AAAAAAAAAAAAEAkUtnBUMbMfmtnnh7sdvTGzfzezn4TXJ5uZm1nacLcLAJBYEcmsq83sobjbbmbThrNNAIDEI7MAAFFBZgEjA4UtHFXc/cPu/mVJMrMzzWx7b+tb4OtmdiC8fN3MbIjb+FV3v34oX2M4he97zMzq4i7Xxt1/o5ktMbNmM/t5N4/PMbMfmNl+M6sxsyfi7ru/y/O2mNmKuPsfM7N9ZnbQzF4xs8uGfIMBoJ/6kVlnhd9zNWa2OUFt/LW7n5+I1xoOZjYnzKSq8PKwmc2Ju7/X3wlm9hYzezXMpGfiHxve/0kz2x3m0k/NLLPL/TeZ2SYzqzez1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7Nks7p0oGv9ycns3oU9tB/WNKXPTjvZnf6uq8U7xxJ3zSz3WbWcUD02Y4ppjw
"text/plain": [
"<Figure size 1728x2016 with 28 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"%matplotlib inline\n",
"\n",
"tau_id = 100\n",
"key = 'orientation'\n",
"fig, ax = plt.subplots(7,4,figsize=(6*4, 7*4))\n",
"X, Y = np.meshgrid(stim_val[key], tau_id_range)\n",
"plt.set_cmap('jet')\n",
"for unit_id in range(num_unit):\n",
" ax[unit_id//4, unit_id%4].errorbar(stim_val[key], stim_hist[key][unit_id, tau_id], yerr=np.sqrt(stim_hist[key][unit_id, tau_id]/sorted_spike_num[unit_id]))\n",
" ax[unit_id//4, unit_id%4].set_xlabel(key_symbol[key]+'/degrees')\n",
" ax[unit_id//4, unit_id%4].set_ylabel('$\\\\tau/(ms)$')\n",
" ymin = np.min(stim_hist[key][unit_id])*0.95\n",
" ymax = np.max(stim_hist[key][unit_id])*1.05\n",
" ax[unit_id//4, unit_id%4].set_ylabel('$\\mathcal{P}($'+key_symbol[key]+'$|\\\\tau)$')\n",
" ax[unit_id//4, unit_id%4].set_xlabel(key_symbol[key])\n",
" # ax[unit_id//4, unit_id%4].set_ylim([ymin, ymax])\n",
" ax[unit_id//4, unit_id%4].set_ylim([0, 0.1])\n",
" ax[unit_id//4, unit_id%4].set_title('unit %d'%unit_id + ', spike num: %d'%sorted_spike_num[unit_id])\n",
"\n",
"plt.tight_layout()\n",
"plt.show()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAABrYAAAfYCAYAAABrHO3jAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8rg+JYAAAACXBIWXMAAAsTAAALEwEAmpwYAAEAAElEQVR4nOzdd5xddZn48c8zNTPpv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haU/BgYtZHgJvy1sUNRgPfbhSzNubvN3w/22nc13qHxKzG8hqd3wN+FhEN3Vjs83dCSuk5sm4u/gdYRdb9xbPA8v2sC9mF2K78+VdT3h0i2UXsKw623JLUilo9ZkXENWRJlkvzynotYczaj/wG4J3Ah1NK9zczf7/XSvvwLbIbxFuazkgp1ZD1JHIp2efwr2S9lSxvuqwktaM2uc5KKT1P1hr2uy1cxZh1aD6Ub+95su6Kf03zceUq4Pcppe2Npr0beCdZK6wyst6mbo8Xupk8nHu9KiAmttQZ7WTvLP2QQ9xOS05Ys9m75sLxtLCLjJTS8ymlN5H14foV4HdNutxrPLbTKLIB6vfl5cCnm3S7t4yslkafRo9uea2Jg7WD1vlMD0Wi5eea5rq9aO44XgXc3CSwNaeEJoMfS1Ira8+YdcjySgfvTSkNI6uR/d1o1Gc9BxezrgReHREfbjRtGfC+JjGrIqX00CEUtyNjVlH+3g0Xivv9nZBS+l1KaUpKqT9ZTcExwOP7WXdNSmkDWe33avY+7l5oSWpr7Rqz8pt71wIXNqnAt/+NG7P2Ka+hfw/whZSNu9mcll4rNXYh8F8RsToiGm6IPtzQxVTKxjI+L6XUP6V0EXAU8Ni+NiZ
"text/plain": [
"<Figure size 1728x2016 with 28 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"%matplotlib inline\n",
"\n",
"key = 'phase'\n",
"fig, ax = plt.subplots(7,4,figsize=(6*4, 7*4))\n",
"X, Y = np.meshgrid(stim_val[key], tau_id_range)\n",
"plt.set_cmap('jet')\n",
"tau_id = 60\n",
"for unit_id in range(num_unit):\n",
" ax[unit_id//4, unit_id%4].errorbar(stim_val[key], stim_hist[key][unit_id, tau_id], yerr=np.sqrt(stim_hist[key][unit_id, tau_id]/sorted_spike_num[unit_id]))\n",
" ax[unit_id//4, unit_id%4].set_xlabel(key_symbol[key]+'/degrees')\n",
" ax[unit_id//4, unit_id%4].set_ylabel('$\\\\tau/(ms)$')\n",
" ymin = np.min(stim_hist[key][unit_id])*0.95\n",
" ymax = np.max(stim_hist[key][unit_id])*1.05\n",
" ax[unit_id//4, unit_id%4].set_ylabel('$\\mathcal{P}($'+key_symbol[key]+'$|\\\\tau)$')\n",
" ax[unit_id//4, unit_id%4].set_xlabel(key_symbol[key])\n",
" ax[unit_id//4, unit_id%4].set_ylim([0, 0.1])\n",
" ax[unit_id//4, unit_id%4].set_title('unit %d'%unit_id + ', spike num: %d'%sorted_spike_num[unit_id])\n",
"\n",
"plt.tight_layout()\n",
"plt.show()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"\n",
"# @widgets.interact(key=widgets.RadioButtons(options=key_list[1:],\n",
"# description='stimulus:',\n",
"# disabled=False), unit_id=widgets.IntSlider(0, min=0, max=num_unit-1))\n",
"\n",
"# def tuning_curve_time_evolution(unit_id, key):\n",
"# fig, ax = plt.subplots(1,1)\n",
"# from matplotlib import cm\n",
"# cmap = cm.get_cmap('hot')\n",
"\n",
"# for tau_id in tau_id_range:\n",
"# ax.plot(stim_val[key], stim_hist[key][unit_id, tau_id], c=cmap(tau_id))\n",
"# ax.set_xlabel(key_symbol[key])\n",
"# ax.set_ylabel('$P($'+key_symbol[key]+'$|\\\\tau)$')\n",
"\n",
"# plt.show()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "7ce2a8b3870146d5bd0e02729e847d48",
"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": [
"\n",
"@widgets.interact(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 TwoDimTuning(tau_id, unit_id):\n",
" min_2d = np.min(avg_firing_rate_pair[unit_id])\n",
" max_2d = np.max(avg_firing_rate_pair[unit_id])\n",
" fig, ax = plt.subplots(1, 1, figsize=(6,6))\n",
" im = ax.imshow(avg_firing_rate_pair[unit_id, tau_id], interpolation='None', cmap='jet', vmin=min_2d, vmax=max_2d)\n",
"\n",
" ax.set_xticks(np.arange(20)[::5])\n",
" ax.set_xticklabels(stim_val['phase'][::5])\n",
" ax.set_yticks(np.arange(20)[::5])\n",
" ax.set_yticklabels(stim_val['orientation'][::5])\n",
" ax.set_xlabel('phase')\n",
" ax.set_ylabel('orientation')\n",
" plt.show()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "ef75a02b1b8049439d355eb5d141b772",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"interactive(children=(IntSlider(value=0, description='stim_id', max=19), IntSlider(value=0, description='unit_…"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"@widgets.interact(key=widgets.RadioButtons(\n",
" options=key_list[1:],\n",
" description='stimulus:',\n",
" disabled=False),\n",
" stim_id=widgets.IntSlider(0, min=0, max=19), \n",
" unit_id=widgets.IntSlider(0, min=0, max=num_unit-1))\n",
"\n",
"def PSSH(stim_id, unit_id, key):\n",
" ymin = np.min(stim_hist[key][unit_id])*0.95\n",
" ymax = np.max(stim_hist[key][unit_id])*1.05\n",
"\n",
" fig, ax = plt.subplots(1, 1, figsize=(7,6))\n",
" ax.errorbar(tau_id_range, stim_hist[key][unit_id, :, stim_id], yerr=np.sqrt(stim_hist[key][unit_id, :, stim_id]/sorted_spike_num[unit_id]), \n",
" label=key_symbol[key]+'=%d'%stim_val[key][stim_id]+'$^\\circ$')\n",
" ax.set_ylim([ymin, ymax])\n",
" ax.set_ylabel('$\\mathcal{P}($'+key_symbol[key]+'$|\\\\tau)$')\n",
" ax.set_xlabel('$\\\\tau/ms$')\n",
" ax.legend()\n",
" plt.show()\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "d181fa482d184dfab8e3f309e9d36bae",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"interactive(children=(IntSlider(value=0, description='phi', max=19), IntSlider(value=0, description='theta', m…"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"%matplotlib inline\n",
"\n",
"key = 'pair'\n",
"@widgets.interact(phi=widgets.IntSlider(0, min=0, max=19), theta=widgets.IntSlider(0, min=0, max=19), unit_id=widgets.IntSlider(0, min=0, max=num_unit-1))\n",
"\n",
"def PSSH(phi, theta, unit_id):\n",
" ymin = np.min(stim_hist[key][unit_id])*0.95\n",
" ymax = np.max(stim_hist[key][unit_id])*1.05\n",
"\n",
" stim_id = int(20*theta + phi)\n",
" fig, ax = plt.subplots(1, 1, figsize=(7,6))\n",
" ax.errorbar(tau_id_range, stim_hist[key][unit_id, :, stim_id], yerr=np.sqrt(stim_hist[key][unit_id, :, stim_id]/sorted_spike_num[unit_id]),\n",
" label=key_symbol[key]+'=(%d'%stim_val['orientation'][theta]+'$^\\circ$,%d'%stim_val['phase'][phi]+'$^\\circ)$')\n",
" ax.set_ylim([ymin, ymax])\n",
" ax.set_ylabel('$\\mathcal{P}((\\\\theta, \\phi)|\\\\tau)$')\n",
" ax.set_xlabel('$\\\\tau/ms$')\n",
" ax.legend()\n",
" plt.show()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAABZgAAAXgCAYAAADc3CxoAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/YYfK9AAAACXBIWXMAAAsTAAALEwEAmpwYAAEAAElEQVR4nOzdd7ydVZX/8fc+t/eSm0oaSUgghN47CCooFuyiIyq2sTuOjmVso6Pjb+xjF7EjViyAivROCJ2EFNJ7cnN7PW3//nhOLjfhppIAmvPJ67xyz1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O8361jxRg3xCQcOh9jXC5RQ+9Ihbw9/ZIH3+cKoSq34CaJg2KIgnp6nG2N9/A2ZGISPvi8EMKLd/PcRYoU2Tv2pU1+KnxYoiiYG0KYH0LYXnWxJzb5/fh1IZpkK1Pw9WE2ua1wvoN2cpzhedyeEZs8nII65rv4aQhha2jeDp+DMcaFktC9b2K9JKRvAdbsZF+SznR/4e//FwtpOiQDkRfsabuLFCmyR+xzmxxCeLfE2fnCguhhdyja5J1QcFL8Be+LMd42wvqd9nV3wNckTqzO7VfEGDOSyMgXSu7DByXRlzstKFakSJF9wn7pK8cYl0giIL69m7sU7fLe8d7C8ZZIUkX90si28xL8LsbYM2zZpXiTRJVcLokQvzo8kf7kqfijiuwmRQfzgU2fbWeExu3lcXbnRznftrNkR9nN0L8Y45IY42sl+XO+iN9ulwpieO7fyZJCSzviefjP7dJBrJbMCDYOe1UWZuj2lF775p7uDdHu/6ZHCucb6XO8BL/fzniPRKntipwUKVJkj3k6bfJeU5jcemuMcYJEwfXtMCwfnj2zya/ES0MI7xu
"text/plain": [
"<Figure size 1440x1512 with 28 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"# %matplotlib inline\n",
"# %matplotlib widget\n",
"# @widgets.interact(key=widgets.RadioButtons(\n",
"# options=key_list[1:],\n",
"# description='stimulus:',\n",
"# disabled=False),\n",
"# unit_id=widgets.IntSlider(0, min=0, max=num_unit-1))\n",
"\n",
"# def contour_plot(key, unit_id):\n",
"# fig = plt.figure(figsize=(8,8))\n",
"# # ax = plt.axes(projection='3d', [0,0,0])\n",
"# ax = plt.axes()\n",
"# X, Y = np.meshgrid(np.arange(20), tau_id_range)\n",
"# ax.contour(X, Y, stim_hist[key][unit_id], cmap='jet')\n",
"# ax.set_xlabel(key_symbol[key])\n",
"# ax.set_ylabel('$\\\\tau$')\n",
"# # ax.set_zlabel('$\\mathcal{P}($'+key_symbol[key]+'$|\\\\tau)$')\n",
"# plt.show()\n",
"\n",
"%matplotlib inline\n",
"\n",
"key = 'orientation'\n",
"fig, ax = plt.subplots(7,4,figsize=(4*5, 7*3))\n",
"X, Y = np.meshgrid(stim_val[key], -tau_id_range)\n",
"plt.set_cmap('jet')\n",
"for unit_id in range(num_unit):\n",
" ax[unit_id//4, unit_id%4].contour(Y, X, stim_hist[key][unit_id])\n",
" ax[unit_id//4, unit_id%4].set_ylabel(key_symbol[key]+'/degrees')\n",
" ax[unit_id//4, unit_id%4].set_xlabel('$\\\\tau/(ms)$')\n",
" ax[unit_id//4, unit_id%4].set_title('unit %d'%unit_id + ', spike num: %d'%sorted_spike_num[unit_id])\n",
"\n",
"plt.tight_layout()\n",
"plt.show()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"[<matplotlib.lines.Line2D at 0x22095f8cee0>]"
]
},
"execution_count": 75,
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAYIAAAD4CAYAAADhNOGaAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/YYfK9AAAACXBIWXMAAAsTAAALEwEAmpwYAAA7pElEQVR4nO3deXxU15Xg8d/RhpDQvrFIIJAAid1Yxqw2RtjxGhIviTNJhyR23EnaM53OdDLuSSdOO8kk6XTi7p5xJ+3Y7riz2Y6XNsSOF7BZbGzMYnYhECAJ7UILEhJa684f9QoXoiRVqV5VSaXz/Xz0oerVrXqXklRH7957zhVjDEoppcaviFB3QCmlVGhpIFBKqXFOA4FSSo1zGgiUUmqc00CglFLjXFSoOzAS6enpJjc3N9TdUEqpMWXfvn3njDEZA4+PyUCQm5vL3r17Q90NpZQaU0SkwtNxHRpSSqlxTgOBUkqNcxoIlFJqnNNAoJRS45wGAqWUGuc0ECil1DingUAppcY5DQRKBcnxujZ2nmwMdTeUuoIGAqWC5H89f4iv/XY/ff2OUHdF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2tlDW1ffFfsU+yp+QhSfXT6D147Ucba5k30VLVQ0dXq1Of1IrcxL53Rjx7AJbUrZxe9AYI35Pwi8DpQAzxljjorIIyLycavZk0CaiJQB3wBcS0wfBPKB74rIAevLnkXZalxzVR31Z2jI5Qsrc4mMEJ585wwv7K8iLiaSWxZM9vt1B7My3ypLrauHVJBE2fEixphXgVcHHPuu2+0u4B4Pz/sB8AM7+qCUuwofqo4OJysxljsWT+W5vWe
"text/plain": [
"<Figure size 432x288 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"# plt.imshow((np.log10(stim_hist['pair'][unit_id]*num_stim[key])[60]).reshape(20,20))\n",
"plt.plot(np.log10(stim_hist['phase'][unit_id]*num_stim[key])[60])"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"[<matplotlib.lines.Line2D at 0x22096143a60>]"
]
},
"execution_count": 76,
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAYYAAAD4CAYAAADo30HgAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/YYfK9AAAACXBIWXMAAAsTAAALEwEAmpwYAABp/0lEQVR4nO29eZgcV3nv/32rqrtnH42k0S5ZkiUvkhdsHGMMGIgJNoRgIEBsEq6T6xtCMJeQBHLtkB8XuHEukAAJAYeYJZDAxRgDQQRjNhtjwDveF8ljW5YlS5rRMvv0UlXn90ed99Sp6qrunp7u6W7pfJ5Hj3qqq2uv8553JyEEDAaDwWBgrFYfgMFgMBjaCyMYDAaDwRDBCAaDwWAwRDCCwWAwGAwRjGAwGAwGQwSn1QfQCJYvXy42btzY6sMwGAyGjuK+++47JIQYji8/JgTDxo0bce+997b6MAwGg6GjIKJnk5YbU5LBYDAYIhjBYDAYDIYIRjAYDAaDIYIRDAaDwWCIY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llY+3NRKqodfjBwCAKwcyAGIXr8nR6MaQ8kTRmMwtAXt6HxedBqlMbCPYVb6GHqk87mWbbLGUGjBjFzXGFzfh2MFqdtZx0qolWR8DPPhtl1BYMTWFUGkUb4UCv6J2ag/oeT5yBuNwdAGGMEAYHyuqAbDuMYwW3Rx59OHa9oOz65nynwMtZuSWiEYQh9DoDHY8lrkHFurrmp8DPVw7+6jAMJnI69pBHHtsOj5KHmiI0q1G6LctmsMtz4x2urDaBhGMCDQGIZ6g2iguKP4uw88j8s+f2dEq0gj9DHETElVXnQhBA7PBFnTrTAlRYro+aEpKWtbWj+GqEnJUBscusyagK4xxMNV+fk
"text/plain": [
"<Figure size 432x288 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"plt.plot(-np.mean(np.log10(stim_hist['phase'][unit_id]*num_stim[key]), axis=1))"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAVgAAAENCAYAAABKL30EAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/YYfK9AAAACXBIWXMAAAsTAAALEwEAmpwYAACg70lEQVR4nOzdd5xcVfnH8feZ7TU9ISSEBAhdamjSm4h0EGkqTREEKyoqioj4ExRBVFSQokjvRHrvvSM9EALpfbO9zfn9cWc3u8luMltS2c++5jVz75x77pnZmWeee87zfJ8QY9RHH3300Ufvk1rRA+ijjz76WF3pM7B99NFHH8uIPgPbRx999LGM6DOwffTRRx/LiD4D20cfffSxjOgzsH300Ucfy4g+A9tHH32sNoQQvhhCeC+EMCGE8NMOnt8lhPBKCKEphPDlRZ5rDiG8lrmN75Xx9MXB9tFHH6sDIYQcvI+9MRkv4qgY49tt2oxGOX6E8THGW9o8VxVjLO3NMeX2Zmd99NFHH13h1yE8lm3bX8W421KabIsJMcaPIIRwAw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Var0utdsZ3tDl5KPP0mTH5srH4cp8UvzzJK2hhz/Ntg+itpNDzSl2ffahQkCsP4gvrQeM6qpb+LK13h/Dp8sYPICvrAOl+3PWj3QmvnD3nxuKGv346jbEqO+2+iOfx9PUearZtnBVBcb5JBuhJdNNw2sYY3uD7qPrOkzsIsycKPktij73JjMn9bMTBapSkYQm5nyKBP/u7DdXV9a+Hirn7LNWcl0wcPHIpUY0mHbL/R0W9j8+7x9Besdzs4XJx7wkihfm31vT6YT1v5
"text/plain": [
"<Figure size 360x288 with 2 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"%matplotlib inline\n",
"\n",
"key = 'phase'\n",
"unit_id = 5\n",
"fig, ax = plt.subplots(1,1,figsize=(5, 4))\n",
"X, Y = np.meshgrid(stim_val[key], -tau_id_range)\n",
"plt.set_cmap('jet')\n",
"im = ax.contour(Y, X, np.log10(stim_hist[key][unit_id]*num_stim[key]))\n",
"ax.set_ylabel(key_symbol[key]+'/degrees')\n",
"ax.set_xlabel('$\\\\tau/(ms)$')\n",
"fig.colorbar(im)\n",
"\n",
"plt.show()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAABJkAAAYiCAYAAACfWD20AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/YYfK9AAAACXBIWXMAAAsTAAALEwEAmpwYAAEAAElEQVR4nOzddZxd5bk+/O/ae4+7xF2JQYAEDQ7FpbSUlhpVqJy6n/7qtKeUU3entBQopZTi7h6SQJS4y0Qm47N1vX+snclMMlGgct655pNPZpY+e+21nvXc13Pd1x2EYagPfehDH/rQhz70oQ996EMf+tCHPvShD314JYj9qxvQhz70oQ996EMf+tCHPvShD33oQx/60If/fPSRTH3oQx/60Ic+9KEPfehDH/rQhz70oQ99eMXoI5n60Ic+9K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/wBhlpYvk3mRmtsI9kw33uxCcL7fK1G336e4yxXqHKLFOkWqnOgrXetm+YXl7nG2nys3yNOuttaTAjEVhqow1DaLFapwim/ukUDLScvJafCStFYvu1VKi3Eu1GGbzebabrk6E033YZWGd+27RrP7LHebJWCQckcY4CTDLbRFRs50g9Qp8Zz1CIxRbbVmyzR6UYOxahyqnz+ZZ0sv8U1CILOLbKK/Um80QaNO1Yqda4xGnZ61zhg1xqkFGzOcs5q1nQxOcMMQTiqLJpF2vHp+to1ZnXyrP/17YUAeaWN+kg/X7r7u0xv5/jZuGsuYA3tt7Bcu8Tc5OZk8uZSUVaHQKNVe0mCMtN87X90BigdgjSc84zuO9AE5OfNdL20
"text/plain": [
"<Figure size 1440x2016 with 28 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"%matplotlib inline\n",
"\n",
"key = 'orientation'\n",
"fig, ax = plt.subplots(7,4,figsize=(5*4, 7*4))\n",
"X, Y = np.meshgrid(stim_val[key], -tau_id_range)\n",
"plt.set_cmap('jet')\n",
"for unit_id in range(num_unit):\n",
" ax[unit_id//4, unit_id%4].contour(Y, X, stim_hist[key][unit_id])\n",
" ax[unit_id//4, unit_id%4].set_ylabel(key_symbol[key]+'/degrees')\n",
" ax[unit_id//4, unit_id%4].set_xlabel('$\\\\tau/(ms)$')\n",
"\n",
"plt.show()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"var_tuning = {}\n",
"for key in key_list:\n",
" var_tuning[key] = np.zeros((num_unit, len(tau_id_range)))\n",
" for unit_id in range(num_unit):\n",
" var_tuning[key][unit_id] = np.var(stim_hist[key][unit_id], axis=1)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAABKgAAAbsCAYAAAAzi6t2AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMSwgaHR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AJrzaRx3+6h8Dd/gBPsyswMxW9vIepUCemWWHLdvg9znXD/Z8aqAHOkj3A+8zs5PMLA34Um8b9vP73AgsNrPl5hVg/+oA3/8e4JN4QaU/hS0fzOeXiffZV/k1mb4SWuFnwK30gy3NeL/Ljp6bIROoAer8LKuPDPAYQjYA7zSzeL+214CGBzrnOvDqM33XvAL58eYVQw99bzvwCpT3ZCS+GyF/xPtbWO6/99eBNf4wu/68DLQBn/D/Lt5K12HAg/m+9/l7cM4V4w0f/B3wZ9fDsGQREZGgKUAlIiLj3T10Kxjs1+T5BF4gohIvU2XVQBv0s1y+g3cDWgosBV4cRJ/ejVd75w28Yu2f8ttdB3wQr5h1JbCLXop8O+cq8IqYfwZvyNHngOucc0cH0Y978AIXx/CKUb+r7807/RdwKl7dmweBv4StSwa+iZcBcwSvCPUX/HV34n3Oj5lZLbAar5j8CZxzb+AFB/b4w58m4918b8Qruv4YcN8A+zsozrmH8QpsP433O1jtr+qt/lFvv88dwO3AE3g1yl7oZf/u/ogXyHmq2+9zwJ8f8H0gFe/3sBp4JGxdHF4R+MN4v/sL6T3w9Fm870ctXkBlsJ/5J/FqP1Xh1XP62yD2/SywGS/wcgwvEy/OHzJ7B/Ci/7fRpWbTCH03Qm09gReg/DNeRtQcvBpPA9m3BW+
"text/plain": [
"<Figure size 1440x2016 with 28 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"%matplotlib inline\n",
"\n",
"key = 'phase'\n",
"fig, ax = plt.subplots(7,4,figsize=(5*4, 7*4))\n",
"for unit_id in range(num_unit):\n",
" ax[unit_id//4, unit_id%4].plot(var_tuning[key][unit_id])\n",
" ax[unit_id//4, unit_id%4].set_ylabel('variance')\n",
" ax[unit_id//4, unit_id%4].set_xlabel('$\\\\tau/(ms)$')\n",
"\n",
"fig.suptitle('variance of phase tuning curve as a function of delay')\n",
"\n",
"plt.show()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [
{
"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HoRnK/X0Dce4bYYOdYRvu5TtXnsBnAbBGxWQJLcwDsTfL5LdA+OzsszzUcBXBIKbU4if2M+j4opZpE5BUAb4aWkfV/SY6PiIgoJcxUIiKijFBKtQN4Flq/nkNKqV36Qy4AbgDtAEJ6w9zLEu4ksSJoJ5jtgNb0G1pGRjJjaoHWp+S3ojWodoqI0WfoDwA+JiJniKZIRK42+kLFeQTACSLyLtEaK78DwHJoZTJjjSEM4B4AN4tIiR4M+Cy0zINk/Ed/7ev18Tv1xr3Lknz+cWh9Zwwl0Poo9ehlNN8cY/vJ/F7GGtteaNlEV+u9br4G7bMz2V4BEAbwSf39vBax5ZTx/gjg8yJyqv5ZWaR/7wCwGcC79EyTK5BcKeHfof0OfByxJUxGNsrl+v48ojW+npVgH6P+XojI2yzP69a3jcTvBNrnwQ+tZ08htB5CqdgMrZ9apYjUA/hMCs+9DcAHROQSEbGJyEwRWao/NlWfw7XQAoNf1H+3LoRW1vr3JJ9/D4Av6/PLLGg9mQzrAPSL1qi9QH9PTxSR0xLsJ5n34W/QMtBOAnBfkuMjIiJKCYNKRESUSXdBu9JunijrfXs+De3kqxvaFfl/J7tDpdROaP1SXoF2onkSgJdSGNP10LIadkNrGP4Zfb/roWVy/Fof137oDYQTjKETWm+jz0E76fsigNcrpTqSHMOnoGV0HATwIrSfz5+SeaL+87sMWh+WZmhlPT9E8sGWbwH4q15+83YAPwdQAC3b41UMz7b6BYC3iraa1S8x3Li/lwR+AOBr+tg+r5TqBfAJaEGcJv11jo22g/FQSgWgZXx8CEAPtF4
"text/plain": [
"<Figure size 1440x2016 with 28 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"%matplotlib inline\n",
"\n",
"key = 'orientation'\n",
"fig, ax = plt.subplots(7,4,figsize=(5*4, 7*4))\n",
"for unit_id in range(num_unit):\n",
" ax[unit_id//4, unit_id%4].plot(var_tuning[key][unit_id])\n",
" ax[unit_id//4, unit_id%4].set_ylabel('variance')\n",
" ax[unit_id//4, unit_id%4].set_xlabel('$\\\\tau/(ms)$')\n",
"\n",
"fig.suptitle('variance of orientation tuning curve as a function of delay')\n",
"plt.show()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "cd2dd687bbc2413ba4501eaf2ed7ae31",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"interactive(children=(IntSlider(value=0, description='delay/ms', max=299), Output()), _dom_classes=('widget-in…"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"%matplotlib inline\n",
"@widgets.interact(tau_id = widgets.IntSlider(0, min=0, max=max_delay-1, description='delay/ms'))\n",
"\n",
"def TwoDimTuning(tau_id):\n",
" unit_selection = [0,1,2,3]\n",
"\n",
" fig, ax = plt.subplots(1, 4, figsize=(5*4, 1*4))\n",
" for i, unit_id in enumerate(unit_selection):\n",
" ax[i].imshow(avg_firing_rate_pair[unit_id, tau_id], interpolation='None', cmap='jet')\n",
"\n",
" ax[i].set_xticks(np.arange(20)[::5])\n",
" ax[i].set_xticklabels(stim_val['phase'][::5])\n",
" ax[i].set_yticks(np.arange(20)[::5])\n",
" ax[i].set_yticklabels(stim_val['orientation'][::5])\n",
" ax[i].set_xlabel('phase')\n",
" ax[i].set_ylabel('orientation')\n",
" ax[i].set_title('delay:%d'%tau_id +' unit %d'%unit_id + ', spike num: %d'%sorted_spike_num[unit_id])\n",
" \n",
" plt.show()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Klein bottle symmetry: Continuity at parametrization boundary?"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "c8d97450e868410781bdc602a3922fbb",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"interactive(children=(IntSlider(value=0, description='delay/ms', max=299), IntSlider(value=10, description='ph…"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"# klein bottle symmetry\n",
"\n",
"%matplotlib inline\n",
"\n",
"@widgets.interact(tau_id=widgets.IntSlider(0, min=0, max=len(tau_id_range)-1, description='delay/ms'), phase_ref = widgets.IntSlider(10, min=0, max=19, description='phase reference'))\n",
"\n",
"def klein_bottle(tau_id, phase_ref):\n",
" unit_selection = [0,1,2,3]\n",
" klein_bottle_rate = np.zeros((num_unit, 40, 40))\n",
"\n",
" fig, ax = plt.subplots(1, 4, figsize=(5*4, 1*4))\n",
" for i, unit_id in enumerate(unit_selection):\n",
" x = np.hstack((avg_firing_rate_pair[unit_id,tau_id], avg_firing_rate_pair[unit_id,tau_id]))\n",
" y = np.hstack((x[:,phase_ref:], x[:, :phase_ref]))\n",
" klein_bottle_rate[unit_id] = np.vstack((x, y[:,::-1]))\n",
" ax[i].imshow(klein_bottle_rate[unit_id], interpolation='None', cmap='jet')\n",
" ax[i].set_xticks([])\n",
" ax[i].set_yticks([])\n",
" ax[i].plot(np.arange(40), 19.5*np.ones(40), 'r', linewidth=0.5)\n",
" ax[i].plot(19.5*np.ones(40), np.arange(40), 'r', linewidth=0.5)\n",
"\n",
" ax[i].set_xlabel('phase')\n",
" ax[i].set_ylabel('orientation')\n",
" \n",
" plt.show()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"stim_val_2cycle = {}\n",
"x = np.copy(stim_val['orientation'])\n",
"y = np.concatenate((x, x+180))\n",
"stim_val_2cycle['orientation'] = np.concatenate((y,y))\n",
"\n",
"x = np.copy(stim_val['phase'])\n",
"stim_val_2cycle['phase'] = np.concatenate((x, x))\n",
"\n",
"for key in key_list[1:]:\n",
" stim_val_2cycle[key] = list(map(int, stim_val_2cycle[key]))"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "36851f4d840c4816981f92436e99252e",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"interactive(children=(RadioButtons(description='grid', options=('ON', 'OFF'), value='ON'), RadioButtons(descri…"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"# klein bottle symmetry\n",
"\n",
" \n",
"@widgets.interact(grid=widgets.RadioButtons(options=['ON', 'OFF'], disabled=False), tau_id=widgets.IntSlider(60, min=0, max=len(tau_id_range)-1, description='delay/ms'), \n",
"phase_ref = widgets.IntSlider(10, min=0, max=19, description='phase reference'),\n",
"ticks = widgets.RadioButtons(options=['ON', 'OFF'], disabled=False))\n",
"\n",
"def klein_bottle(grid, ticks, phase_ref, tau_id):\n",
" klein_bottle_rate = np.zeros((num_unit, 80, 40))\n",
"\n",
" fig, ax = plt.subplots(10, 4, figsize=(5*4, 10*4))\n",
" for unit_id in range(num_unit):\n",
" x = np.hstack((avg_firing_rate_pair[unit_id,tau_id], avg_firing_rate_pair[unit_id,tau_id]))\n",
" y = np.hstack((x[:,phase_ref:], x[:, :phase_ref]))\n",
" z = np.vstack((x, y[:,::-1]))\n",
" klein_bottle_rate[unit_id] = np.vstack((z,z))\n",
" ax[unit_id//4, unit_id%4].imshow(klein_bottle_rate[unit_id], interpolation='None', cmap='jet', aspect=0.5)\n",
" ax[unit_id//4, unit_id%4].set_xticks([])\n",
" ax[unit_id//4, unit_id%4].set_yticks([])\n",
" \n",
" if grid=='ON':\n",
" ax[unit_id//4, unit_id%4].plot(np.arange(40), 19.5*np.ones(40), 'r', linewidth=0.5)\n",
" ax[unit_id//4, unit_id%4].plot(np.arange(40), (19.5 + 20)*np.ones(40), 'r', linewidth=0.5)\n",
" ax[unit_id//4, unit_id%4].plot(np.arange(40), (19.5 + 40)*np.ones(40), 'r', linewidth=0.5)\n",
" ax[unit_id//4, unit_id%4].plot(19.5*np.ones(80), np.arange(80), 'r', linewidth=0.5)\n",
" ax[unit_id//4, unit_id%4].plot((19.5 + 10)*np.ones(80), np.arange(80), 'r', linewidth=0.5)\n",
" ax[unit_id//4, unit_id%4].plot((19.5 - 10)*np.ones(80), np.arange(80), 'r', linewidth=0.5)\n",
"\n",
" if ticks=='ON':\n",
" ax[unit_id//4, unit_id%4].set_xticks(np.arange(40)[::5])\n",
" ax[unit_id//4, unit_id%4].set_yticks(np.arange(80)[::10])\n",
" \n",
" ax[unit_id//4, unit_id%4].set_yticklabels(stim_val_2cycle['orientation'][::10])\n",
" ax[unit_id//4, unit_id%4].set_xticklabels(stim_val_2cycle['phase'][::5])\n",
"\n",
" ax[unit_id//4, unit_id%4].set_xlabel('phase')\n",
" ax[unit_id//4, unit_id%4].set_ylabel('orientation')\n",
" \n",
" plt.show()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"So we see that a phase reference shift of 180 is necessary.\n",
"\n",
"$\\theta \\rightarrow \\theta + \\pi$\n",
"\n",
"$\\phi \\rightarrow \\pi -\\phi$\n",
"\n",
"or equivalently\n",
"\n",
"$\\phi - \\frac{\\pi}{2} \\rightarrow \\frac{\\pi}{2} - \\phi$\n",
"\n",
"which means that the proper phase reference that is maintained is at $\\pi/2$\n",
"\n",
"i.e. at $\\phi=\\pi/2$ the orientation loop is of period $180$ degrees instead of $360$ degrees. So at $\\phi=0$ the center of rotation is on the border (exactly in the middle of contrast extrema) between black and white stripes.\n",
"\n",
"Another transformation (?)\n",
"\n",
"$\\theta \\rightarrow \\pi - \\theta$ (But this is clearly wrong)\n",
"\n",
"$\\phi \\rightarrow \\phi - \\pi$\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# # relabelling\n",
"# param = np.arange(400).reshape(20,20)\n",
"# phase_ref = 10\n",
"# x = param[:, :phase_ref]\n",
"# y = param[:, phase_ref:]\n",
"# reparam = np.vstack((x, y[:,::-1]))\n",
"# stim_val_reparam = {}\n",
"# stim_val_reparam['phase'] = stim_val['phase'][:phase_ref]/2\n",
"# stim_val_reparam['orientation'] = np.concatenate((stim_val['orientation'], stim_val['orientation']+180))\n",
"\n",
"\n",
"# stim_val_reparam['pair'] = stim_val['pair'][reparam]\n",
"\n",
"# stim_val_reparam['pair'] = stim_val['pair']\n",
"# for x in stim_val['pair']:\n",
"# if x[1]>= 180:\n",
"# x[0] += 180\n",
"# x[1] = phase_ref - x[1]\n",
"\n",
"# stim_val['pair'][reparam]\n",
"# stim_val['pair'].shape\n",
"# plt.imshow(reparam%20)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Dimensionality Reduction"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import sys\n",
"sys.path.insert(0, './Persistent_Homology')\n",
"\n",
"from gratings import grating_model\n",
"from plotting import plot_data, plot_mean_against_index, show_feature\n",
"from persistence import persistence\n",
"from decoding import cohomological_parameterization, remove_feature\n",
"from noisereduction import PCA_reduction, z_cutoff, density_filtration\n",
"from sklearn.decomposition import PCA \n",
"\n",
"# relabelling\n",
"param = np.arange(400).reshape(20,20)\n",
"phase_ref = 10\n",
"x = param[:phase_ref]\n",
"reparam = np.vstack((x, x[:,::-1]))\n",
"stim_val_reparam = {}\n",
"stim_val_reparam['phase'] = stim_val['phase'][:phase_ref]\n",
"stim_val_reparam['orientation'] = np.concatenate((stim_val['orientation'], stim_val['orientation']+180))"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAYgAAAEWCAYAAAB8LwAVAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/YYfK9AAAACXBIWXMAAAsTAAALEwEAmpwYAAAs7klEQVR4nO3deZgcZbn+8e+dDZKwBJIggSyDRNTIGhIWZUc5CSIcFQSMBxAleiSKoggKRxaNCOKK/hQU0AMB5SBKFAQV2VwIWSRAWANkYw1hiSRISPL8/nirnc6ku6d6Mj3dM31/rquurq6ut+rpSaefrno3RQRmZmZt9ap3AGZm1picIMzMrCQnCDMzK8kJwszMSnKCMDOzkpwgzMysJCcIswYn6QRJf6l3HNZ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gNTCF9sT8EXBsR8ySdJ+nw7FjjJS0BjgIukTQvK/si8FVSkpkJnJdtaxiuqDaznq7dSmpSc9ObgRGSpgHvIjVNbVdE3ATc1GbbV4rWZ5JuH5UqezlweZ7z1IOvIMysp8vTiumPkuYAe5FuLZ0SES/UPLIGt9NOMGAAzJ8PS5dCF9aRm5l1ibyD9W0MvAQsB8ZI2q92IXUPffrA+PFpfcaM+sZiZlYL7V5BSLoAOBqYR2uHtgDurGFc3cJee8Edd6R6iMMaouGvmVnnyVMH8Z/AW3N2jmsqHvrbzHqyPLeYngD61jqQ7qiQIO65B9asqW8sZmadLU+CWAncK+kSSd8vLLUOrDvYeuvUae7VV6FvX2hpgWnT6h2VmVnnyHOLaTr5O7g1lWnT4KWX0noELFwIkyen55Mm1S8uM7POoIiyk8Z1K+PGjYtZs2Z16TlbWlJSaGv
"text/plain": [
"<Figure size 432x288 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
},
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "c54a07c1ee6b4cf9ae61f78044c1ddc0",
"version_major": 2,
"version_minor": 0
},
"image/png": "iVBORw0KGgoAAAANSUhEUgAABIAAAAGwCAYAAADR6h5QAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/YYfK9AAAACXBIWXMAAAsTAAALEwEAmpwYAAEAAElEQVR4nOzdeXyj61nY/d/9aJcs77s9M56ZM9uZmXNm8czJyUYWshIIIWkCBAqUNi0v0EBpgfdtWVMaCEuTppCStkBLgbZAA2kSyH6yn+RsGdvj8Xhsj/fxKsmWrF3P/f4hPzqyLNuSLa9zfT8ff86xJT3PI9mj69J1X/d9K601QgghhBBCCCGEEOLoMvb7AoQQQgghhBBCCCHE7pICkBBCCCGEEEIIIcQRJwUgIYQQQgghhBBCiCNOCkBCCCGEEEIIIYQQR5wUgIQQQgghhBBCCCGOOCkAC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jTIO9w2y8/zbtdbPFvkqJ0HaqMPGA6SspGnVuzd4/FbdOZPANMWf+zLQW9qlCiGE2AMfBLqVUj9SeINSylBKvXH12x8gu37Nd5Htzsj/6mGTaWBa67slxi0r3q27ltXjbDe2fhNoVkq9Mu+5eVefy1c3uu5NVOo6nwFeV7DxwdsKHnOX7Lp6XRvkAIuU75pSKtf1pZR6GdmiyLfKPI6HvILI6tS379/ozqtT1P/l6mMeXf3x54GLwO0iz62cAa5S8xjIvub5Rba3kS38WYXSzwOPAONFrklyGCEqTDqAhBBHxa8An1ZK/THwP8muffM+4D9rrSc3XgJhLa11SCn1q8CHVkezvky2WH4WeLXWujBZ3OxYSaXUfeC
"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,iVBORw0KGgoAAAANSUhEUgAABIAAAAGwCAYAAADR6h5QAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/YYfK9AAAACXBIWXMAAAsTAAALEwEAmpwYAAEAAElEQVR4nOzdeXyj61nY/d/9aJcs77s9M56ZM9uZmXNm8czJyUYWshIIIWkCBAqUNi0v0EBpgfdtWVMaCEuTppCStkBLgbZAA2kSyH6yn+RsGdvj8Xhsj/fxKsmWrF3P/f4hPzqyLNuSLa9zfT8ff86xJT3PI9mj69J1X/d9K601QgghhBBCCCGEEOLoMvb7AoQQQgghhBBCCCHE7pICkBBCCCGEEEIIIcQRJwUgIYQQQgghhBBCiCNOCkBCCCGEEEIIIYQQR5wUgIQQQgghhBBCCCGOOCkACSGEEEIIIYQQQhxxUgASQgghhBBCCCGEOOKkACSEEEIIIYQQQghxxEkBSAghhBBCCCGEEOKIkwKQEEIIIYQQQgghxBEnBSAhhBBCCCGEEEKII04KQEIIIYQQQgghhBBHnBSAhBBCCCGEEEIIIY44KQ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Vefy1c3uu5NVOo6nwFeV7DxwdsKHnOX7Lp6XRvkAIuU75pSKtf1pZR6GdmiyLfKPI6HvILI6tS379/ozqtT1P/l6mMeXf3x54GLwO0iz62cAa5S8xjIvub5Rba3kS38WYXSzwOPAONFrklyGCEqTDqAhBBHxa8An1ZK/THwP8muffM+4D9rrSc3XgJhLa11SCn
" </div>\n",
" "
],
"text/plain": [
"Canvas(toolbar=Toolbar(toolitems=[('Home', 'Reset original view', 'home', 'home'), ('Back', 'Back to previous …"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"tau_id = 60\n",
"Z = sts.zscore(stim_hist['pair'][:, tau_id, :].T, axis=0)\n",
"# Z = Z[:, np.logical_not(np.isnan(Z[0]))]\n",
"# n_components = len(Z[0])\n",
"n_components = 20\n",
"pca = PCA(n_components)\n",
"X = pca.fit_transform(Z)\n",
"%matplotlib inline\n",
"PC_values = np.arange(n_components)\n",
"plt.plot(PC_values, pca.explained_variance_ratio_, 'o-', linewidth=2, color='blue')\n",
"plt.title('Scree Plot')\n",
"plt.xticks(np.arange(20))\n",
"plt.xlabel('Principal Component')\n",
"plt.ylabel('Variance Explained')\n",
"plt.show()\n",
"from mpl_toolkits import mplot3d\n",
"from mpl_toolkits.mplot3d import Axes3D\n",
"\n",
"%matplotlib inline\n",
"%matplotlib widget\n",
"fig, ax = plt.subplots(1, 2, figsize=(16, 6))\n",
"ax[0] = fig.add_subplot(1, 2, 1, projection='3d')\n",
"x, y, z = X[:,0], X[:,1], X[:,2]\n",
"ax[0].scatter3D(x, y, z, c=stim_val['pair'][:,0])\n",
"ax[0].set_title(\"orientation\", pad=25, size=15)\n",
"ax[0].set_xlabel(\"X\") \n",
"ax[0].set_ylabel(\"Y\") \n",
"ax[0].set_zlabel(\"Z\")\n",
"\n",
"ax[1] = fig.add_subplot(1, 2, 2, projection='3d')\n",
"x, y, z = X[:,0], X[:,1], X[:,2]\n",
"ax[1].scatter3D(x, y, z, c=stim_val['pair'][:,1])\n",
"ax[1].set_title(\"PCA - color code: phase label\", pad=25, size=15)\n",
"ax[1].set_xlabel(\"X\") \n",
"ax[1].set_ylabel(\"Y\") \n",
"ax[1].set_zlabel(\"Z\")\n",
"plt.show()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# PCA"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAtwAAAK6CAYAAAAKBIsuAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/YYfK9AAAACXBIWXMAAAsTAAALEwEAmpwYAAEAAElEQVR4nOydd3gURRvAf3MtvXdIgEAoofdeRTpSBEREKQKCIvaun12xoNhBsYAFFBBpUqUjvffeCRBCernL3e18f+yRwu0loSPc73nuSW52dnbudm72nXfeIqSUuHHjxo0bN27cuHHj5vqgu9kdcOPGjRs3bty4cePmdsYtcLtx48aNGzdu3Lhxcx1xC9xu3Lhx48aNGzdu3FxH3AK3Gzdu3Lhx48aNGzfXEbfA7caNGzdu3Lhx48bNdcQtcLtx48aNGzdu3Lhxcx0x3OwOXIoQoiPwOaAHvpdSfnDJcQ/gZ6AecAHoK6U8VmSbhlCJqZxTuXfVjBL3K/uYn2Z5aLlEpzIDNs26pfed0W483LkoM9hbs6pvTrZ2GxpYvLRv7zkincrOn4nQbsT546nYNMJJVhDadRNctOGhUabXKMs8hjQnuWj82hAaGirLlSt3PS/h5gaxefPmJCll2PVo2z1Obi/cY8VNSXCPEzclpaixcksJ3EIIPfA10A44BWwUQsyWUu4pUG0IkCKljBNC3A98CPQtsmFTOai8yam4+qYVJe7bhsGtNMvv/elzp7IQLmjWfb/5O9qNj3QuWt2vimbV5ru2aLehwZHqoZrlY3jaqWzce89oN/KVi8bPWp3LPjFq133TRRvlNMoCNcrm1HfRwLWjXLlybNrkPEbc/PcQQhy/Xm27x8nthXusuCkJ7nHipqQU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rSvA1qePJIGDWrPM8/vh+du3KZNy4+GvbSTeXjacevG9QvO577tkOgNXq7M1ZK159ufnv8NFHx/jss5P4+ekZOLDkmulrhb9JfVbdCpG5buQOrVvgduPmNiHEC86WILrIoWOqicGQ+8BwmTNAu3YhvPdeBXr1csctu5U5ckI1+RnaF4xXofQb00p9AXTpEsq771bg/vudHbfd3Hg6l4esJ7SPbd4Jew9D/+7Xxq568uTqV9+Im1uGJ58sQ0iIkR49bs48/l17+O4GXi8pGabMgQE9IeAmWp7dGQK3DvB0Ln554OtOZaMXvq3ZRIcOCzXLT2qkh/+W4Zp191evrFlef/wmp7KH+EWz7h6qOpWNMT+nWZcqGuFIAH51/jKmN+6tWdX6j/bo7DR6hlPZ/NR7ta8Xp12MTaNMK6LJbZoQxqrA5kxo6HfjQgLm5EieGy2YtRjiykLbZtr1FmyFXSfh2XsKP7C9vfW88so1iu3k5pqhKBKrFTw81Jv1ysfwx99QLho6tVbrfLcYAryhr4t7Xhx+fgZefbX4e59hg0NmqON7Zddxk8/Rc/DdP/BMVwgLKPl5A56FPYegWT2IdX5EXTZ9+kSQkyORUiJcSPCHcsBbB6VuDV9aN5dgNktMJtDpBOXKefHaa5dnBnI1nLFApgIVvQqXZ5lh9F9wX1OoeYW7cCXhm1/hjc/U/0cNvH7XKY5bQKHvxs2dydjT0GQb/HT2yttISof3/oRjicXXnTDBire3mbtr2xn9AjQvYivtiZ/g+V/gTIr2cYtF8tdfdjIz5ZV13M01pWPHXPz9zSQnq/fj9SfgveegdWP1eK4Vhn+nvlyxaDss3Zn//lgiJGfkv8/JkcyYYScnp+h7PvgA1N0CG9Kv9NO4ucgPS+GDmfDXBvX92bOSv/+2I2XR92Dcu/DFG+qC63I5fBbSsgqXbdqk4O1t5n//09KSQI4dKm6EhlsLl289Cr//qzrJubl5JCZK/P3N9OiRe1Ou32QbVNoImZcoz+askbz3lZ3
"text/plain": [
"<Figure size 864x864 with 25 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"%matplotlib inline\n",
"ncomp = 5\n",
"X_reduced = X[:,:ncomp]\n",
"# xmin, xmax = -2*np.std(X_reduced)+np.mean(X_reduced), 2*np.std(X_reduced)+np.mean(X_reduced)\n",
"fig = plt.figure(figsize=(12,12))\n",
"for i in range(ncomp):\n",
" for j in range(ncomp):\n",
" ax = plt.subplot(ncomp,ncomp, j + ncomp*i + 1)\n",
" if i==j:\n",
" ax.imshow(X_reduced[:,i].reshape(20,20), interpolation='None', cmap='jet')\n",
" ax.set_xticks(np.arange(20)[::5])\n",
" ax.set_xticklabels(stim_val['phase'][::5])\n",
" ax.set_yticks(np.arange(20)[::5])\n",
" ax.set_yticklabels(stim_val['orientation'][::5])\n",
" ax.set_xlabel('phase')\n",
" ax.set_ylabel('orientation')\n",
"\n",
" else:\n",
" ax.scatter(X_reduced[:,j], X_reduced[:,i], s=1, c=stim_val['pair'][:,1], cmap='jet')\n",
" # ax.set_xlim([xmin, xmax])\n",
" ax.set_xticks([])\n",
"\n",
" # ax.set_ylim([xmin, xmax])\n",
" ax.set_yticks([])\n",
" \n",
"# fig.suptitle('n_neighbors: %d'%n_neighbors)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"embed = {5:np.load('embed3d_n_neighbors5.npy'), 20:np.load('embed3d_n_neighbors20.npy'), 50:np.load('embed3d_n_neighbors50.npy')}"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"def show_umap(embed, n_neighbors):\n",
" %matplotlib inline\n",
" ncomp = embed.shape[1]\n",
" # xmin, xmax = -2*np.std(embed)+np.mean(embed), 2*np.std(embed)+np.mean(embed)\n",
" fig = plt.figure(figsize=(12,12))\n",
" for i in range(ncomp):\n",
" for j in range(ncomp):\n",
" ax = plt.subplot(ncomp,ncomp, j + ncomp*i + 1)\n",
" if i==j:\n",
" ax.imshow(embed[:,i].reshape(20,20), interpolation='None', cmap='jet')\n",
" ax.set_xticks(np.arange(20)[::5])\n",
" ax.set_xticklabels(stim_val['phase'][::5])\n",
" ax.set_yticks(np.arange(20)[::5])\n",
" ax.set_yticklabels(stim_val['orientation'][::5])\n",
" ax.set_xlabel('phase')\n",
" ax.set_ylabel('orientation')\n",
"\n",
" else:\n",
" ax.scatter(embed[:,j], embed[:,i], s=1, c=stim_val['pair'][:,1], cmap='jet')\n",
" # ax.set_xlim([xmin, xmax])\n",
" ax.set_xticks([])\n",
"\n",
" # ax.set_ylim([xmin, xmax])\n",
" ax.set_yticks([])\n",
" \n",
" fig.suptitle('n_neighbors: %d'%n_neighbors)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"n_neighbors. This parameter controls how UMAP balances local versus global structure in the data. It does this by constraining the size of the local neighborhood UMAP will look at when attempting to learn the manifold structure of the data."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAtwAAAMQCAYAAAAU9LISAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/YYfK9AAAACXBIWXMAAAsTAAALEwEAmpwYAAEAAElEQVR4nOzddZxVxfvA8c/c2u5ld4mFpbu7Q0RpBERESkIF8ye2KIjJ18LAQgVFTBQBQaVEEKS7u2OL7bg1vz/uSu29sMBelnjer9d9wc6dM2duP+ecmWeU1hohhBBCCCGEdxiKugNCCCGEEELcyCTgFkIIIYQQwosk4BZCCCGEEMKLJOAWQgghhBDCiyTgFkIIIYQQwosk4BZCCCGEEMKLJOAWQojrhFKqpVJqZwHrtlFKHbnA/VOUUq8UXu+EEEJ4IgG3EEJcJ7TWS7XWlYu6H4VJKTVYKeVQSmWcdWtT1P0SQojCZCrqDgghhLh+KaUUoLTWzito5l+tdYvC6pMQQlxr5Ay3EEJcJqXUAaXUE0qpTUqpVKXUD0op34ts00YpdUQpNUopFa+UOq6Uuves+32UUm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olfzk1yZhG3b2LpsFcbBXTGaoVnedIKJE1fz7rsrqFAhnG2ZNXCsMEFsKYjzYy/eOQNzSjvZre00MnhKLSO84Yh2kKKd1DC4ybBzFZQs6UOp9lU4kuNHxO9ZHI4F//2aDX85KV5ckZ29k1deWcqEXVZ+/+x2WoScu/0BMtlKGuX22Dg1/3caDRmMycenSB6L8I4tThuhykAp5eHH4jqwPQtu3wyvxsGmpfDNEritNqzaqMk87MRcvTQ+Pcw8FhrMjClbeeWVpVi
"text/plain": [
"<Figure size 864x864 with 25 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"n_neighbors = 5\n",
"show_umap(embed[n_neighbors], n_neighbors=n_neighbors)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAtwAAAMQCAYAAAAU9LISAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/YYfK9AAAACXBIWXMAAAsTAAALEwEAmpwYAAEAAElEQVR4nOzdd3gUxRvA8e9cS++NFCCE3nuVLkgXLFhpIhYUsaH+FMWu2BuCggXFgoooIIrSe++9hQRIAum9XZnfHxcgIXsQIJcEmM/z5IGbm92dXO723p2deUdIKVEURVEURVEUxTl0ld0ARVEURVEURbmWqYBbURRFURRFUZxIBdyKoiiKoiiK4kQq4FYURVEURVEUJ1IBt6IoiqIoiqI4kQq4FUVRFEVRFMWJVMCtKIpSRQkhugghDpaxbnchxMkLPD9TCPFG+bVOURRFKSsVcCuKolRRUsrVUsr6ld2O8iSEGCmE2CqEyBRCnBRCvCuEMBR73l8I8YcQIkcIESuEuKcy26soilIeVMCtKIqilJmwu5LvDnfgCSAQaA/cCEwo9vznQCEQAtwLTBNCNL6C4ymKolQ6FXAriqKUkRAiRggxQQixSwiRIYT4RQjhepFtuhf15D4thEgUQiQIIe4r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XPkjX4HPSLg1OouhljSmrLDRaSIkakwuV7RlSRvW874W9+fC6IMQmwcRD4P3CDiRDKtkIfdbM3jekglA3gWucaxWybtfShavhqVrYbbG/CNFuZAMaeP8kO2tWPi8qGt19gL7e8tmk6SmS178AG57x35OOBRvr/Pwzlzuft7AtOOF5BdW8C9
"text/plain": [
"<Figure size 864x864 with 25 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"n_neighbors = 20\n",
"show_umap(embed[n_neighbors], n_neighbors=n_neighbors)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAtwAAAMQCAYAAAAU9LISAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/YYfK9AAAACXBIWXMAAAsTAAALEwEAmpwYAAEAAElEQVR4nOzdd3RURRvA4d9syab3kARCCL2H3nsTkCrVDogVsX9ix4KKvaAoigVEBUSkIwrSe+819AAhkN6zZb4/doGE7CYbyJIA85yzBzJ779zZZPfue+fOvCOklCiKoiiKoiiK4hqa0m6AoiiKoiiKotzKVMCtKIqiKIqiKC6kAm5FURRFURRFcSEVcCuKoiiKoiiKC6mAW1EURVEURVFcSAXciqIoiqIoiuJCKuBWFEUpo4QQ7YQQh5zctqMQIraQ56cIId4tudYpiqIozlIBt6IoShklpVwjpaxZ2u0oSUKI4UIIsxAiPc+jY57no4QQK4QQmUKIg0KIrqXXWkVRlJKhAm5FURTFacLqer87NkgpvfM8VuZ5bjqwAwgCXgP+FEKEXOfxFEVRSpUKuBVFUZwkhDghhPifEGK3ECJFCDFTCOFexD4dhRCxQogXhBDxQohzQogReZ43CCE+EUKcEkKcF0JMEkJ45N03z7aNhRA7hBBpQohZtuO/e9Xx7B7HJlgIsdS2/yohRKU8+7UWQmyxva4tQojWeZ5bKYR4TwixDsgEqth6qo/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/cmRG481sFs+cJ2dCZJdHRzvV0dntCfslK1zsG19+8X+dob
"text/plain": [
"<Figure size 864x864 with 25 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"n_neighbors = 50\n",
"show_umap(embed[n_neighbors], n_neighbors=n_neighbors)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Cohomological Decoding on UMAP"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAQMAAAEGCAYAAABhHPB4AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/YYfK9AAAACXBIWXMAAAsTAAALEwEAmpwYAAAk90lEQVR4nO3deXwV9b3/8dcnCySEIEtYggkSkEUKGCHqBTeqQAmC94pcFQWlVamiVSqt29V7tRX91atXqlaFVqQoalFcWESLEPUEEAwSQYKIIkusSNi3sCT5/P44CZyEkPXMmXMmn+fjkUfPnFm+n7bJm5nvzHy/oqoYY0yU2wUYY8KDhYExBrAwMMaUsjAwxgAWBsaYUjFuFxAoKSlJO3bs6HYZxnjOgQMH2LhxI8eOHduhqq0r2yaswqBjx47k5OS4XYYxnuLz+cjMzKRTp06sX79+86m2s8sEYzysLAhSUlLIysqqclsLA2M8asuWLeWCIDk5ucrtLQyM8agOHTrwpz/9qUZBAA73GYjIJmA/UAwUqWqGk+0ZYyA7O5uEhATOOeccbr/99hrvF4oOxJ+r6o4QtGNMg1fWR5Ceno7P50NEaryvXSYY4xFlQZCamsqbb75ZqyAA58NAgX+KyEoRGVfZBiIyTkRyRCSnoKDA4XKM8abAIFi8eHGN+ggqcvoy4UJV/UFE2gALReRrVf00cANVnQpMBcjIyKjT+9Trt+1n/MyV5O8uZFjv9jwxsjfRUbVLRWMi2XPPPVevIACQUI1nICIPAwdU9clTbZOYmKh9+/Yt993VV1/N+PHjOX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with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAbgAAAGwCAYAAADbmXDeAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/YYfK9AAAACXBIWXMAAA9hAAAPYQGoP6dpAABLuUlEQVR4nO3deXxTVf7/8Vfa0paWtlCwC6UIBWSHggiCo7SCIqgIo446joAj6ig4Kq44jut3RB1FR8GVnyKi44KKCogCUhgERSirLCIFGpZS1pa20C3390ckJTRdSXKT9P18PPLQnJybfG5L8u69Ofcci2EYBiIiIgEmyOwCREREPEEBJyIiAUkBJyIiAUkBJyIiAUkBJyIiAUkBJyIiAUkBJyIiASnE7AK8zWazsXfvXqKiorBYLGaXIyIidWQYBseOHaNly5YEBVV9nNbgAm7v3r0kJyebXYaIiJwhq9VKq1atqny8wQVcVFQUYP/BREdHm1yNiIjUxu7du7n88svZuXMnrVu3Jjs72/F5XpUGF3AnT0tGR0cr4ERE/ERoaCilpaWkpKTw9ddf07Vr1xq/ZmpwASciIv6nffv2ZGRkEBYWRkxMTK220ShKERHxSVarlQULFjjut2/fvk5jKBRwIiLic6xWK2lpaVxxxRVOIVcXCjgREfEpJ8MtKyuLVq1a0alTp3o9jwJORER8xqnhlpKSQkZGRr0v7VLAiYiIT3BnuIECTkREfEBubq5bww10mYCIiPiA5s2bM2DAAAC3hBso4ERExAcEBwczffp0Dh06RFxcnFueU6coRUTEFFarlYceeojy8nLAHnLuCjfQEZyIiJjg1AElAM8995zbX0NHcCIi4lWnj5YcP368R15HR3Aelpl9hOW/HSQxpjHDuifSODTY7JJEREzj7ksBqqOA86Bn5m3mraVZjvuvfL+NT2/vT1x0uIlViYiYw5vhBg044AoLCwkOrnw0FRwcTHh4uFO/qgQFBdG4cWOXfbfnFvDGwk0VnS0Wdh2C1zK288TwrhQVFWEYhsvntVgsRE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x/6mnnuK7774jKyuLzMxM/vKXv7Br1y7Gjh1rxi6IeNbmr6DseOX29Z94vxbxeSUlJQwePFjh9jtTA+71118nLy+PtLQ0EhMTHbePP/7Y0Sc7O5t9+/Y57h85coRbb72Vzp07M2zYMPLz81m+fDldunQxYxdEPMviM+PAxA+EhobyxBNPcM455zT4cAMfGmTiLbX9clLEJxQehJd7QGmhc/v1H0Kny82pSXxeSUkJoaGhZpfhMbX9HNefhyK+LLIF3PgJnNXZfj+iBVz2rMJNHKxWK8OGDWPv3r2OtkAOt7rwiVGUIlKNNn+AcT9C0WEIi4ZgvW3F7tQBJWPHjmXevHlml+RT9E4R8RcR1c/wIw3L6aMl33zzTbNL8jk6RSki4md0KUDtKOBERPyIwq32FHAiIn7k9ttvV7jVkgJORMSPTJs2jaFDhyrcakGDTEREfFxxcbFjTt2WLVtqtGQt6QhORMSHWa1WunfvzgcffGB2KX5HASci4qNODijZtm0bTz75pNPSX1IzBZyIiA86fbTkokWLtPRXHSngRER8jC4FcA8FnIiID1G4uY8CTkTEh8yYMUPh5ia6TEBExIc88sgjgH2xZ4XbmdF6cCIiJtu3bx+xsbEaRFJLWg9ORMQPZGdn84c//IFrrrlGlwG4mU5RioiYJDs7m/T0dLKysgA4fPgwiYmJJlcVOHQEJyJiglPD7eSAEoWbeyngRES8zFW4aUCJ+yngRES8SOHmPQo4EREv2rNnD7m5uQo3L9AgExERL+rfvz/fffcdrVq1Urh5mAJORMTDrFYrR44coUe
"text/plain": [
"<Figure size 640x480 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAbgAAAGwCAYAAADbmXDeAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/YYfK9AAAACXBIWXMAAA9hAAAPYQGoP6dpAABMGklEQVR4nO3dd3iT5f4G8DtJm3SntNBdRikWKaOsQnG0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RUBKVSicLCQvj4+IhdDlF9Wg1woxDw8BO7ErJxtQeUJCcnY/PmzWKXZBVN/R7nERyRrZHKGG7UqLqjJb/66iuxS7I5DDgiIjvDqQBNw4AjIrIjDLemY8AREdmRZ599luHWRAw4IiI7snjxYiQnJzPcmoBrURIR2biKigooFAoAQEhIiNOMlmwtHsEREdkwtVqNHj164LvvvhO7FLvDgCMislE1A0rOnj2L2bNno6KiQuyS7ApPURLZqnPbgGM/AZDolvHqnCh2RWRFdUdLbt++XX+akpqGAUdki/74Cvj1tVv3j/2oW8ar/1Pi1URWw6kA5sFTlES2proSSPmgfnvKB4Cm2vr1kFUx3MyHAUdka8qv6W51lebp1qgkh7Z8+XKGm5nwFCWRrfEMAHw7ANcvGbb7R3KNSifw+uuvAwDGjRvHcGslHsER2RqpFEj+CJDV2vJEpgCGfQhITGyKSnYtOztbP0JSIpHgjTfeYLiZAY/giGxR1DBgymHgxFoAEqD73wBlmNhVkQWoVCokJiaiW7d
"text/plain": [
"<Figure size 640x480 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"%matplotlib inline\n",
"persistence(pd.DataFrame(embed[5]),homdim=1,coeff=2)\n",
"persistence(pd.DataFrame(embed[20]),homdim=1,coeff=2)\n",
"persistence(pd.DataFrame(embed[50]),homdim=1,coeff=2)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"file = open('decoding50.pkl', 'rb')\n",
"decoding50 = pickle.load(file)\n",
"file.close()\n",
"\n",
"decoding50['phase'] = stim_val['pair'][decoding50.index][:,1]\n",
"decoding50['orientation'] = stim_val['pair'][decoding50.index][:,0]\n",
"def phasor_avg(x, period):\n",
" return np.angle(np.sum(np.exp(2*np.pi*1j*x/period)))*180/np.pi + 180\n",
"\n",
"statistic, bin_edges, bin_number = sts.binned_statistic(decoding50['decoding'], decoding50['phase'], lambda x:phasor_avg(x, period=360), 20)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([137.14126279, 220.09508264, 175.41479907, 153. ,\n",
" 162. , 112.86104702, 95.45882883, 66.83662297,\n",
" 29.00746987, 354.46203037, 12.11351122, 5.80639544,\n",
" 354.02211424, 234. , 342. , 314.12816312,\n",
" 272.63321064, 229.74777269, 207.23795075, 212.06151078])"
]
},
"execution_count": 113,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"statistic"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([0, 3, 6, 9])"
]
},
"execution_count": 114,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"np.arange(10)[::3]"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([ 0., 54., 108., 162., 216., 270., 324.])"
]
},
"execution_count": 115,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"stim_val['phase'][::3]"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAtMAAAE9CAYAAADJUu5eAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/YYfK9AAAACXBIWXMAAAsTAAALEwEAmpwYAABH70lEQVR4nO3dfZxcZX3//9dnxwEmimwikS9ZEkBKl4IRglsTpTeC2qAWSYNaUqm2PyrfVq1a7X5LrL+KigVN1aqt2niLohG5cY2I5ksBtaYmunETIkoqIBAGlChZvMkCw+7n+8c5s5mdPTNz5ubMmZv38/GYR3bOXOecz3Xm7Mm151zX5zJ3R0RERERE6jeQdgAiIiIiIt1KjWkRERERkQapMS0iIiIi0iA1pkVEREREGqTGtIiIiIhIg9SYFhERERFp0BPSDqAZRx55pB933HFphyEi0pAdO3b83N0Xpx1Hu+iaLSLdrNI1u6sb08cddxzj4+NphyEi0hAzuyftGNpJ12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7j5pZjngBQSDCm8BXgp8AXgV8OVwlc3h+++En9/s3TyjjIiIiEgXUDfL5iTZZ/po4Iqw3/QA8EV3v97Mfgh8wcwuBSaAT4TlPwF81szuAB4Czk8wNhERERGRpiXWmHb3W4EVEcvvIug/Xb78EeBlScUjIiKVmdlhwLeAQwn+b7jG3d9mZscTPEl8CsGA8j9398fM7FDgM8AzCbrk/am7351K8CIiKeqrGRA1w09zxibyXLL5NianCrHKZ8yYdmfAYKZGh53BXJZLXnKKvg+R9BTnBvi
"text/plain": [
"<Figure size 864x360 with 2 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"fig, ax = plt.subplots(1,2, figsize=(12,5))\n",
"ax[0].scatter(decoding50['decoding'], stim_val['pair'][decoding50.index][:,1])\n",
"ax[0].set_xlabel('decoded parameter')\n",
"ax[0].set_ylabel('actual parameter')\n",
"\n",
"ax[1].scatter(bin_edges[:-1], statistic)\n",
"ax[1].set_ylabel('avg. actual phase')\n",
"ax[1].set_xlabel('decoded parameter')\n",
"plt.show()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAARMAAAEGCAYAAABGsnGQAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/YYfK9AAAACXBIWXMAAAsTAAALEwEAmpwYAAAXbklEQVR4nO3de7QcVZXH8e+PhyAIBEQCAQQHEYkMRow8FBSUQUAUH4AgKiiugIKCj+WAujSiM4PjyGOMAlEwQQFlqSjEqERGBlEEksgj4TFijEMSJIPy1oAJe/6oc2PT6b731L1V/crvs9ZdXXXqdNXu3MumuurUPooIzMzGap1uB2Bmg8HJxMwq4WRiZpVwMjGzSjiZmFkl1ut2AFWSNgoYl9k7tx/Aw6Vjqda4En0f7oH99oJxJfo+XFMMfUQT8vrFYiIeVKtNA5VMij+gK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vmt4BjIuII2uOrTRpQsCUzN79VJG8F2ItE0MJZYberygxnL423f5b6LbpRCxTqy0540x2i4iJDes/l3RnNYGZ2aDIuQA7X9LeQyuS9gLm1heSmfWjnDOTlwO/kvS/af35wD2S7qAYKuJ5iM0sK5kcXHsUZtb3cm4N/6ETgZhZf8u5ZmJmNiInEzOrhJOJmVWi7TUTSY8xzBO9EbFpLRGZWV9qm0wiYhOA9IzM/cA3KeqZHMvYnho2swGUM5z+toh46UhtvaDccHorZcOp+X1XlOhbxmEl9vuzEvstVSE/N4ZeeASiDu2H0+dcM3lC0rGS1pW0jqRjaahSb2YGecnkHRRlAh5IP0emNjOz1XIGrS2mKAJtZtZWTkHpF0m6VtKCtL67pE+N9D4zW7vkfM35GnAGRe1
"text/plain": [
"<Figure size 432x288 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"hist2d, xbin, ybin = np.histogram2d(decoding50['decoding'], stim_val['pair'][decoding50.index][:,1], bins=20)\n",
"fig, ax = plt.subplots(1,1)\n",
"ax.imshow(hist2d)\n",
"ax.set_xlabel('phase label')\n",
"ax.set_ylabel('decoded parameter')\n",
"# ax.set_xticklabels\n",
"# ax.set_yticks(xbin[:-1])\n",
"ax.invert_yaxis()\n",
"plt.show()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## UMAP fixed $\\phi$"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# fix phase at 90\n",
"phase_id = 5\n",
"phase_sec_id = stim_val['pair'][:,1] == stim_val['phase'][phase_id]"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## UMAP fixed $\\phi^\\prime$"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"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
}