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.

2363 lines
15 MiB

{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"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",
"cmap_hot = cm.get_cmap('hot')\n",
"cmap_viridis = cm.get_cmap('viridis')\n",
"\n",
"execfile('Stimulus.py')\n",
"data_folder = \"Data/\"\n",
"\n",
"stim_file = \"Stiminfo_PVCre_2021_0012_s06_e14.csv\"\n",
"stim = pd.read_csv(data_folder+stim_file)\n",
"\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",
"\n",
"num_unit = len(spike_times)\n",
"num_trial = len(stim)\n",
"\n",
"# sort by firing rate\n",
"\n",
"num_spike = list(map(len, spike_times))\n",
"# num_spike = np.array([len(spike_times[i]) for i in range(len(spike_times))])\n",
"spike_times = spike_times[np.argsort(num_spike)[::-1]]\n",
"execfile('load.py')\n",
"\n",
"max_delay = 300 # dt\n",
"tau_id_range = np.arange(max_delay)\n",
"\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",
"s = 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",
" s[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([sts.zscore(stim_hist['pair'][unit_id]).reshape((len(tau_id_range), num_stim['orientation'], num_stim['phase'])) for unit_id in range(num_unit)])"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"import numpy as np\n",
"import matplotlib.pyplot as plt\n",
"import pandas as pd\n",
"import scipy.stats as sts\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",
"spike_times = np.load(data_folder+spike_times_file, allow_pickle=True)\n",
"stim = pd.read_csv(data_folder+stim_file)\n",
"# execfile('load.py')"
]
},
{
"cell_type": "code",
"execution_count": 3,
"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": [
"orientation selectivity index (OSI)\n",
"\n",
"# $\\frac{R_{pref} - R_{orth}}{R_{pref} + R_{orth}}$"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Stimulus-triggered average response (tuning curve)"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAiEAAAEjCAYAAADkN9ERAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/YYfK9AAAACXBIWXMAAAsTAAALEwEAmpwYAABiFElEQVR4nO3deXicZ3Xw/++ZGWnG2ndLXiRbtuPYWbxiOyEJhCUJaSGsZQkpbUl4C6ENJaVvC31poS0/CgW60dKUpEAxpaGkLUtCEkIghMR2bCfed3m3rF0arTOamfv3x/M88liekWbVzEjnc126Is2me2Jp5ujc5z5HjDEopZRSSs00V64XoJRSSqm5SYMQpZRSSuWEBiFKKaWUygkNQpRSSimVExqEKKWUUionNAhRSimlVE5oEKKUyjgR+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HUqp2e1gux+RS1NzY1m9oILe4eBE76K5ToOQPNI3EqS6pBiRSwVNKxrKqCktLvimZbtO9/G+f93Gl546wt1f3zajgUiHf3ImxAryNBuilMqkgxf8LK0tpaTYE/c2Tr3IwfaBmVpWXtMgJI/0DAUnjuc6RIRXLaku+BMy29p6CIQiRAyMhyJsa5u55+Nsx0Qf0QWdpKuUyqxDF/2smmIrBuDqJj0hE23aIEREFovIsyJyUEQOiMgD9uV/LiLnReQV++POOPc/JSL77NvszPQTmE16h4NU2ydjom1eWsu5vlHO94/mYFWZsaW1FifB43a72GIfP54Jnf4A5T7PxF8nE5kQLU5VSmXIwOg4Z3tH456McZR5PSypLeGABiFAYpmQEPCgMWY1sAW
"text/plain": [
"<Figure size 648x288 with 2 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"unit_id = 1\n",
"fig, ax = plt.subplots(1,2, figsize=(9,4))\n",
"for i, key in enumerate(key_list[1:]):\n",
" ax[i].plot(stim_val[key], avg_firing_rate[key][unit_id], '.-')\n",
" ax[i].set_xlabel(key)\n",
" # ax[i].set_xticks(np.arange(20)[::5])\n",
" # ax[i].set_xticklabels(stim_val[key][::5])\n",
"\n",
"fig.suptitle('unit '+ \"%d\"%unit_id)\n",
"\n",
"plt.show()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Orientation Tuning"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAABJMAAAi7CAYAAADiLJGrAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/YYfK9AAAACXBIWXMAAAsTAAALEwEAmpwYAAEAAElEQVR4nOzddXicZdbH8e+JN1JNm7q7S2pAcXdY3LU47C6LrsDyrrC4S4FSAUqRAgVKcSlUU3f3pqm3cb3fP2Za0jZJJ8lI5Pe5rl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0wT+OH4e97w/l73ZOmmV2inUH5rOOR74eAE5+UV0SYrnuUv7Ui82kn9+voQh//mev3+6iJVp6SGLz98ycwtYvzOL2et3haT9jbuyuOKN6eQVFNGtWQKtGsQyf9Nevlq01e9t5eYXqkglUsyizXtZuHkvaftyQh2KiIgEWaiPuYurKrGomCR+U9439aH75xUU8ddPFvLQhIUM7ZDIZ3ccQ+ekhBLv26phLO8PH8KfT+nMFwtSOfP5KcxYs7PSz0GkJisscuQVFPn1MUf+to4vF6TSqkEd6sdGcX6/Fnxy+9FMvPNoTu/ZjPEpGznl2V+44o3pTF60lYJC/7YfLHkFRTzzzXIWbdnH1n05/OFVT/76ecX2oBVcNu/J5vI3ppOZV8g7Nw0mNiqCxPgoOifF89TXy/362m7bl8O8TXv515dLq11BKTO3gPxq+j6TquuTuZv4w6tTycorZP3OLC0IIiIiflNVikPlFRHqAEQAtqfncvu7s5m1bje3HNee+0/rSniYlXmfiPA
"text/plain": [
"<Figure size 1440x2880 with 40 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"key = 'orientation'\n",
"fig, ax = plt.subplots(10, 4, figsize=(5*4, 10*4))\n",
"for unit_id in range(40):\n",
" ax[unit_id//4, unit_id%4].errorbar(stim_val[key], avg_firing_rate[key][unit_id], yerr=sem_firing_rate[key][unit_id])\n",
" ax[unit_id//4, unit_id%4].set_xlabel(key)\n",
" ax[unit_id//4, unit_id%4].set_ylabel('avg firing rate / Hz')\n",
" ax[unit_id//4, unit_id%4].set_ylim([0,np.max(avg_firing_rate[key][unit_id])+1])\n",
"\n",
"ax[0,0].set_title('firing rate (Hz) vs. orientation')\n",
"\n",
"plt.show()\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Phase Tuning"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAABJIAAAi7CAYAAAAN7vqVAAAAOXRFWHRTb2Z0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l4yjmX6z2mpHwlIjVYUApJAGYWbmbz8Vw4TXbOzfDu+oeZLTSz58wsOljxSOgVFBahyd5FRKQ6MU/XozeAZc65Z4vt+gy4ynv7KuDTEk7/FjjFzOqZWT3gFO82qQFUeJJKpCMwxMxmmNkvZtavtAPNbISZzTaz2WlpaUEMUURCKWiFJOdcoXOuF55P1/qbWTfgQaAz0A+ozx8nnQSUoKqj1amZzN2Uzub0nFCHIiJS7TnnSNmdza69eaEOpSY4GrgCOMHM5nu/TgeeAk42s1XASd77mFmymb0O4J1k+wlglvfr8f0Tb4uIBFEEnvdmA4G/AO9b8fG5xTjnRjvnkp1zyUlJVXqucKlhVLyvmKCv2uacSzezn4BhzrlnvJtzzexN4N5SztFcANWIc47HPl+Kc7B1zz52782jXq2oUIclIlJtfbN4G5vTcwgzSNmdTfN6caEOqdpyzk0BSnzDBZxYwvGzgeuL3R8DjAlMdCIiPkkBPnKeoQMzzawISAT0ib6IAEHqkWRmSWZW13s7FjgZWF5srgADzgUWByMeCa0fl6fy26odNEyIpsjB61PWhjokEZFqKzMnn0c/X0JMpOdf/iOfLtGwYhEROZxPgOMBzKwjEAXsCGVAIlK5BGtoWxPgJzNbiKer9mTn3BfAeDNbBCzCU+X+e5DikRDJLSjkiS+W0i6pFq0
"text/plain": [
"<Figure size 1440x2880 with 40 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"key = 'phase'\n",
"fig, ax = plt.subplots(10, 4, figsize=(5*4, 10*4))\n",
"for unit_id in range(40):\n",
" ax[unit_id//4, unit_id%4].errorbar(stim_val[key], avg_firing_rate[key][unit_id], yerr=sem_firing_rate[key][unit_id])\n",
" ax[unit_id//4, unit_id%4].set_xlabel(key) \n",
" ax[unit_id//4, unit_id%4].set_ylabel('avg firing rate / Hz')\n",
" ax[unit_id//4, unit_id%4].set_ylim([0,np.max(avg_firing_rate[key][unit_id])+1])\n",
"\n",
"ax[0,0].set_title('firing rate (Hz) vs. phase')\n",
"plt.show()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"2D Tuning"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"avg_firing_rate_pair = avg_firing_rate['pair'].reshape((num_unit, num_stim['orientation'], num_stim['phase']))"
]
},
{
"cell_type": "code",
"execution_count": 21,
"metadata": {},
"outputs": [],
"source": [
"# normalize\n",
"import scipy.stats as sts\n",
"avg_firing_rate_pair_normalized = sts.zscore(avg_firing_rate_pair.reshape(num_unit, 20*20), axis = 1).reshape(num_unit, 20, 20)"
]
},
{
"cell_type": "code",
"execution_count": 22,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAABGEAAAirCAYAAAD1Q8+UAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/YYfK9AAAACXBIWXMAAAsTAAALEwEAmpwYAAEAAElEQVR4nOz9Xch1S9cmBl2jaq772fvd7/d1f18Q0e4GBQVJwKP2BzwwqGiMwXigoBKIYIg5EKMQfwKiEH/AE7s98KTR1qBBhRzlIBACkjORdCCIIkIjQroRxHxNYn/vfu57zVnDg/FT16g51/08e7/v3u/z9F4F617rXmvOqpr1M+oa1xg1SlQVz/RMz/RMz/RMz/RMz/RMz/RMz/RMz/RMz/TTpvb7rsAzPdMzPdMzPdMzPdMzPdMzPdMzPdMzPdMvIT1JmGd6pmd6pmd6pmd6pmd6pmd6pmd6pmd6pp8hPUmYZ3qmZ3qmZ3qmZ3qmZ3qmZ3qmZ3qmZ3qmnyE9SZhneqZneqZneqZneqZneqZneqZneqZneqafIT1JmGd6pmd6pmd6pmd6pmd6pmd6pmd6pmd6pp8hbb/vCvwc6WX7lX7z4c8CEEDoBwEgAs3PgIr4+7xG/bfyPyf1nxWQ4e9q7/7H7515q6Dmveb5IHG9zvfzSVdi/w6rS9SL6xqXoFF9mv1vNwHSFCKK1hRdB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VLJIxT1aYktNrKnF2DHJmVO91rFE5MgjW0j5/EjGPfj+pC+u2K14kdn/ieni2pibi5wtcpHmmZIxKuWnX3PSb0nuxJajI7xA/P8gaI7RHBuwvmf3X+KEU2OETNRCnK24iLdKrUY
"text/plain": [
"<Figure size 1440x2880 with 40 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"fig, ax = plt.subplots(10, 4, figsize=(5*4, 10*4))\n",
"for unit_id in range(40):\n",
" ax[unit_id//4, unit_id%4].imshow(avg_firing_rate_pair_normalized[unit_id], interpolation='gaussian')\n",
"\n",
" ax[unit_id//4, unit_id%4].set_xticks(np.arange(20)[::5])\n",
" ax[unit_id//4, unit_id%4].set_xticklabels(stim_val['phase'][::5])\n",
" ax[unit_id//4, unit_id%4].set_yticks(np.arange(20)[::5])\n",
" ax[unit_id//4, unit_id%4].set_yticklabels(stim_val['orientation'][::5])\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": [
"Orientation tuning with fixed phase"
]
},
{
"cell_type": "code",
"execution_count": 23,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAXIAAAD4CAYAAADxeG0DAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/YYfK9AAAACXBIWXMAAAsTAAALEwEAmpwYAAEAAElEQVR4nOydd3gc5bX/P7O9apt6L5YsW+7dNFMMBEwvSegQ0kh+KeSmJzc3uWk3gTRCGkkIJPQABgzGYGyKwU22bEsu6r2X3dX2OvP7Y1QtyZaLzDV3v8/DYzHzzsy7uzNnzvs933OOIEkSCSSQQAIJnL1QfNgTSCCBBBJI4NSQMOQJJJBAAmc5EoY8gQQSSOAsR8KQJ5BAAgmc5Ug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Ztt1ZCefOaaXSQwczhZQ/4ScBGAIAglgAboP01z+sghFOqkr+/NM3vR4RorKWMeaks2RP0QdJ3ZuZwCJEni7Zpe/vB2PaJ4ci+gwcFB3n333RkP5kW7/XyQq0MtCKyxmycdU2zUUesPjZuLJi+JSKcPKXpqRtTnq0GrTUettp7wsTbbaqJRJ35/3SnN4X8jAq5B9vziGYLume2T+mFiOvLDp4EdwGxBENoFQbgXeBQoHJIkPgPcJSVC3lOisekhKqu+iCie/kp3U2K4BvnR1AqcNQHPw50e7vj7bu75RzkPvFHD4a6TexArKip4++236e+fWV8j2h1gm0PJaqsRs0o56ZgSgxZvXKQnMpphq801y4lBp9gxyOevPmFvfBg26zBP/tGru9L+egXpriw63zjwYU9lxjAd1cotkiRlSJKkliQpW5Kkv0uSFJEk6XZJkuZJkrREkqStZ2KyZyvkh0MkGDyD/HR
"text/plain": [
"<Figure size 432x288 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"plt.plot(stim_val['orientation'], avg_firing_rate_pair[5, :, :])\n",
"plt.show()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Klein bottle"
]
},
{
"cell_type": "code",
"execution_count": 24,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAABD4AAAiaCAYAAAByesZZAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/YYfK9AAAACXBIWXMAAAsTAAALEwEAmpwYAAEAAElEQVR4nOz9zY4kS7ImiH0iqmbuEZl5TtW5dftOzzR7iNmyQYCbId+AwACz4kNwRWBIgq9BvgH33M2GK75BD7gjZjPgkGw02TN9q07VycwIdzdTFeFCflTNI07d5iKbJy9cgciIjHA3N1MzFRX55JNPSFXxGI/xGI/xGI/xGI/xGI/xGI/xGI/xGI/xj3Hw/79P4DEe4zEe4zEe4zEe4zEe4zEe4z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de0ecyHivfo+F2+L+ZVdGSpI0sRAcg9uqfIhHRsZLLQADUWghZ6M+eJ4BHAnSDuLICR2eQ4Zs59DCFIZzRhvLYFn9sTTrzjSzvj0iyo0u4BFQMqGPPtCGMccGZl6PT/t6mIYVAC8Jjnjqa5medWiWwxin1PyDHukSh0RoQf47c/FOkwU6fhGPe3a+M+26EEkLMOgoEWxYGHTFmz16mMv+P+mZszAol+03hOM1syGwFkwDEj7UwAF0FbDIS0EzXAURdFqQpisXOasq+McV0AAAFUCCKMXRibVDApNqnYejHHIkCPfpcJ0ZiXu7mOa3U7fwhG5mxRBCN53f7FZHM9Z0XdBuZaZoImG8/XLZG/10/RN8O3GQc62uEZDE2mhV2fTnaFWUCLQE7qjglBVkU/KbCIbdIAetHcfKXG/Z7sss9364xdCrZeIMq49YqtFbTGA/S4Y7nlNf9
"text/plain": [
"<Figure size 1440x2880 with 40 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"# klein bottle symmetry\n",
"\n",
"fig, ax = plt.subplots(10, 4, figsize=(5*4, 10*4))\n",
"klein_bottle_rate = np.zeros((num_unit, 40, 40))\n",
"for unit_id in range(40):\n",
" x = np.hstack((avg_firing_rate_pair_normalized[unit_id], avg_firing_rate_pair_normalized[unit_id]))\n",
" klein_bottle_rate[unit_id] = np.vstack((x, x[:,::-1]))\n",
" ax[unit_id//4, unit_id%4].imshow(klein_bottle_rate[unit_id], interpolation='gaussian')\n",
" ax[unit_id//4, unit_id%4].plot()\n",
" # ax[unit_id//4, unit_id%4].set_xticks(np.arange(40)[::5])\n",
" # ax[unit_id//4, unit_id%4].set_xticklabels(np.concatenate((stim_val['phase'][::5],stim_val['phase'][::5])))\n",
" # ax[unit_id//4, unit_id%4].set_yticks(np.arange(40)[::5])\n",
" # ax[unit_id//4, unit_id%4].set_yticklabels(stim_val['orientation'][::5])\n",
" ax[unit_id//4, unit_id%4].set_xticks([])\n",
" ax[unit_id//4, unit_id%4].set_yticks([])\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(19.5*np.ones(40), np.arange(40), 'r', linewidth=0.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": "code",
"execution_count": 41,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"[<matplotlib.lines.Line2D at 0x2498c2e3160>]"
]
},
"execution_count": 41,
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAXAAAAD4CAYAAAD1jb0+AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/YYfK9AAAACXBIWXMAAAsTAAALEwEAmpwYAAAqdUlEQVR4nO3deXxU9b3/8ddnMtn3IRsJhIR9kzUJiuBSFXdRa6tWW2trsa29tv21tb3XW71t7+1i7a615VqtS7VaLWCtGty4ssgSCFvYEiABAtn3PZN8f39ksBESCJnJnFk+z8cjj0xmTuZ8GCbvnHzO93y/YoxBKaWU/7FZXYBSSqnh0QBXSik/pQGulFJ+SgNcKaX8lAa4Ukr5Kbs3d5aUlGSysrK8uUullPJ7W7durTHGJJ96v1cDPCsri4KCAm/uUiml/J6IlA10v7ZQlFLKT2mAK6WUn9IAV0opP6UBrpRSfkoDXCml/JQGuFJK+SkNcKWU8lNeHQeuvM/Z08ua/dUY4PJpKYiI1SUppTxEAzxAVTV38NLmo7yw+QgnGjsAuDVnLD+6cSZhdv3DS6lAoAEeQIwxbDxUx/ObysjfXYGz17BoYhIPXz+D3eWNPPZ+CYdqWnjizvkkxYRbXa5Syk0a4AGgqaObv289xvObjlBS1UJ8ZCh3LczijgWZjE+OAeCqmWlMSo3hgVd2svSx9Tx5Vw7TRsdZXLlSyh0a4H6s6H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ianxjA+OcbqUoJOXpaDTmcvu8p1oWMVPDTAPaSutYvNh+u0fWKRHF3oWAUhDXAPeWdPJb0GDXCLJMeGMz4pWk9kqqCiAe4h+UUVZCR
"text/plain": [
"<Figure size 432x288 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"plt.plot(np.mean(avg_firing_rate_pair[17], axis=0))"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Orientation loop"
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {},
"outputs": [],
"source": [
"x = np.copy(stim_val['pair'])\n",
"s_id = []\n",
"y = np.copy(x)\n",
"s = []\n",
"for i in range(len(x)):\n",
" if x[i,1] > 180:\n",
" y[i] = np.array([x[i,0] + 180, 360 - x[i,1]])\n",
" \n",
" elif x[i,1] == 180:\n",
" s.append(np.array([x[i,0] + 180, 360 - x[i,1]]))\n",
" s_id.append(i)\n",
"\n",
"stim_val_or_loop = np.concatenate((y, np.array(s)))\n",
"# avg_firing_or_loop = avg_firing_rate['pair'][:, list(range(len(y))) + s_id]\n",
"\n",
"arg = np.lexsort((stim_val_or_loop[:,1],stim_val_or_loop[:,0]))\n",
"stim_val_orientation_loop = {}\n",
"stim_val_orientation_loop['pair'] = stim_val_or_loop[arg]\n",
"# # for unit_id in range(num_unit):\n",
"# # avg_firing_or_loop[unit_id] = avg_firing_or_loop[unit_id, arg].reshape(40, 1)\n",
"stim_val_orientation_loop['orientation'] = np.unique(stim_val_orientation_loop['pair'][:,0])\n",
"stim_val_orientation_loop['phase'] = np.unique(stim_val_orientation_loop['pair'][:,1])\n",
"# np.all(stim_val['pair'][np.lexsort((stim_val['pair'][:,1], stim_val['pair'][:,0]))] == stim_val['pair'])"
]
},
{
"cell_type": "code",
"execution_count": 26,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAABGYAAAitCAYAAADBxjfwAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliI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ZBrjEGFTd/DROMWQR6nXQUKGHpFOwV+JEJAJrp2GRZTPKU4jSSDscgDxD5FfWyYXAfGnu2Qr20lTw+UiBdHFeMVchoAO86gTtFYWMrI0PLvhbGgBnAobB00zLGmJQW1ZcnD1aXFzNGv2g88lMBRZ4xNzDz+PadsG8de2+47g2fbB2fXDZ88/qEj7brsKZpV7zadlyo46nN3yaATBOLGWAyAgD4Vn86+DAPeh/I86LLV76K7Vu+s2G5Ls01/STuV1p6Pe7Ge8cSzTJ+TuYNJlGIVA6WsUEiFCg/Iaaxmsk0LMcwQGxWAdqXR8dKsiKJFnzTaiZY7tFa/mDVw2PybLsUlniC18QGYoNkEufx/uDNQ5WkNpQAlfutLTqOySwvYYLOAjyFhsUA+TX+EZ8N/SBuXdJv4+cce2a8a6Rt1kdmNYNhCSiKkVnJNERrmaBUcSng3gTrH/RekOdFr77tq6WcUOm2CoiM/qaSS/y1dzXQPfD9I4PEp4qX0709OMPyLABF+k95jeatMpFm2WL6Fu5lrwQ25LF0tApfhlXpH9ASx+dtv7wslmk7+Ya1b+GVxJ3CanTfhzVxN6uZscq8d3LKJOpCH7VDXsX32wQS6BuBmshzfNsRA9hHObgD1OCUZYJZUFed90HvJXle9PSjvopvfdfSiUe8LCOd6hscw/L7mkwam+GdPrNqwFw8JwSAJoyIJJ8t1jLe8iODEb6MOp+aTqnxJjg
"text/plain": [
"<Figure size 1440x2880 with 40 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"fig, ax = plt.subplots(10, 4, figsize=(5*4, 10*4))\n",
"avg_firing_rate_orientaion_loop = np.zeros((num_unit, 40, 10))\n",
"for unit_id in range(40):\n",
" avg_firing_rate_orientaion_loop[unit_id] = np.vstack((avg_firing_rate_pair[unit_id, :, :10], avg_firing_rate_pair[unit_id, :, 10:]))\n",
" ax[unit_id//4, unit_id%4].imshow(avg_firing_rate_orientaion_loop[unit_id], interpolation='gaussian', aspect=0.25)\n",
" ax[unit_id//4, unit_id%4].set_xticks(np.arange(10)[::3])\n",
" ax[unit_id//4, unit_id%4].set_xticklabels(stim_val_orientation_loop['phase'][::3])\n",
" ax[unit_id//4, unit_id%4].set_yticks(np.arange(40)[::5])\n",
" ax[unit_id//4, unit_id%4].set_yticklabels(stim_val_orientation_loop['orientation'][::5])\n",
" # ax[unit_id//4, unit_id%4].set_xticks([])\n",
" # ax[unit_id//4, unit_id%4].set_yticks([])\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": "code",
"execution_count": 27,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAABJwAAAmVCAYAAACI9qXUAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/YYfK9AAAACXBIWXMAAAsTAAALEwEAmpwYAAEAAElEQVR4nOydd3xkV3n+n3f6SNPUu1bbi7c3ew2u2GDAYDqYQCChBNKAkJCQEEggIQkhEEgjJDbmB8am2MbUgDHG677eXW/vu9Kqa0Zlep85vz/uvaORNDOa3vR+Px99Vppy75F25sy5z3ne5yUhBBiGYRiGYRiGYRiGYRimWKgqPQCGYRiGYRiGYRiGYRimvmDBiWEYhmEYhmEYhmEYhikqLDgxDMMwDMMwDMMwDMMwRYUFJ4ZhGIZhGIZhGIZhGKaosODEMAzDMAzDMAzDMAzDFBUWnBiGYRiGYRiGYRiGYZiiwoJTmSCijUR0jIg8RPTHRPQ1IvrrDI+/gYjOl3OMpYSI9ER0hoi6inCs1xHRd4sxrlJCRH9JRP9b6XEAABH1E5GXiNSVHgvDMAzDMAzDMAxT/5AQotJjWBEQ0T0A3EKIj1V6LLlCRDcD+LYQoreAY/wRgGuEEB+Sf74PwKgQ4lNJjxkAMAhAK4SILnO8UwDeKYQ4ke+YaoVc/i5JzxkC8H4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TNbc+8wgwrE4AMDuqY2dYIZhGIbJhEP+PGs1VbfgRFJI0z0AzgohvlTp8TBMoSjvvUkXb2LWCR8F8Asi+iIkU8P1lR0Ow5SPC1NSabDdE8KMN4SWKl9TlBN2ODFZ4Q5G8J3nh3HLRmlXdIodTnnhC0UrPQSGYRgmiWlvCFo1wWrUVnooy/EyAO8GcKu
"text/plain": [
"<Figure size 1440x3168 with 40 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"fig, ax = plt.subplots(10,4, figsize=(4*5, 11*4))\n",
"for unit_id in range(num_unit):\n",
" ax[unit_id//4, unit_id%4].plot(stim_val_orientation_loop['orientation'], np.mean(avg_firing_rate_orientaion_loop[unit_id], axis=1))\n",
" ax[unit_id//4, unit_id%4].set_xlabel('orientation')\n",
" ax[unit_id//4, unit_id%4].set_ylabel('avg firing rate / Hz')\n",
"\n",
"ax[0,0].set_title('firing rate (Hz) vs. orientation')\n",
"plt.show()"
]
},
{
"cell_type": "code",
"execution_count": 28,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAABJUAAAmVCAYAAAB0444eAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/YYfK9AAAACXBIWXMAAAsTAAALEwEAmpwYAAEAAElEQVR4nOydd3hkV3n/P++Mpqj3stoiba+2d73rdcNgG2wMAdshhG4gwTEQQmj5JYEQaighhBZIwISOaQHTTAd3e1127fV6e5V2V72NZqQZTT2/P+69ozYzmhmNNDPa83kePSvNvXfmSNo5Ovd7vu/3FaUUGo1Go9FoNBqNRqPRaDQaTSbY8j0AjUaj0Wg0Go1Go9FoNBpN8aFFJY1Go9FoNBqNRqPRaDQaTcZoUUmj0Wg0Go1Go9FoNBqNRpMxWlTSaDQajUaj0Wg0Go1Go9FkjBaVNBqNRqPRaDQajUaj0Wg0GaNFJY1Go9FoN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PXKqU6s3jUDUajUaj0WgWTlQSkZcA/UqpfUlO+W/gQaXUQ0mOtymldgGvAT4nImuTvM4dpvi0d2BgYP4D12g0FypB4Hql1CXAduAmEbkCQER2AbV5HJtGo7lwuBpj0+16Edlvfrw434PSaDQajUajScRCBnVfDdxsLoTcQJWIfFcp9ToR+SDQCLw52cVKqS7z39Micj9GUOWpBOfdCdwJsGvXLpXz70Kj0VwQmCW5lhPJYX4os9nAf2AI3H+ep+FpNJoLBKXUw0DyJG7jnPbFGY1Go9FoNBpNahbMqaSUeq9SaoW58HkVcK8pKN0OvBB4tVJqVlkcgIjUiojL/LwBQ6A6vFBj1Wg0GjC6VYrIfqAf+INS6nHg74B
"text/plain": [
"<Figure size 1440x3168 with 40 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"fig, ax = plt.subplots(10,4, figsize=(4*5, 11*4))\n",
"for unit_id in range(num_unit):\n",
" ax[unit_id//4, unit_id%4].plot(stim_val_orientation_loop['orientation'], np.mean(avg_firing_rate_orientaion_loop[unit_id][:, :5], axis=1))\n",
" ax[unit_id//4, unit_id%4].set_xlabel('orientation')\n",
" ax[unit_id//4, unit_id%4].set_ylabel('avg firing rate / Hz')\n",
"\n",
"ax[0,0].set_title('firing rate (Hz) vs. orientation')\n",
"plt.show()"
]
},
{
"cell_type": "code",
"execution_count": 29,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAABJUAAAmVCAYAAAB0444eAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/YYfK9AAAACXBIWXMAAAsTAAALEwEAmpwYAAEAAElEQVR4nOy9d3ikV3n3/7mnaWYkjbq2Sdvs9bqt264rGGPTCcXUBBJiEohTeBNC8r5JSH4pJCGVdEgIAQIBAgab3g244rq73vV6bW+xdldt1TXSaHo5vz+e5xmNpKnSVOl8rmuvlW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qNBqNRqPRaDQaTVFoUWkDcdeTg5wYC9R6GBpN3aOU8gP3AbcCFwKnReQs4BWR0zUcmkajWSUPnZrkz755nEg8WeuhaOqcLz0xyNBMqNbD0Gg0Gk0VGJ+P8KmHz6CUqvVQGhYtKm0Q7jsxwe/fc4xPPjRQ66FoNHWJiPSISLv5tQd4BXBIKbVZKbVTKbUTCCmlLqzhMDUazSp5atDPZx45i90mtR6Kpo4Zm4vwB189xj2Hh2s9FI1Go9FUgX/7ySn+4tvPcm5abyasFi0qbQBCsQT/39eeAeDMVLDGo9Fo6pYtwH0i8jTwJEam0rdrPCaNRlMmApE4Hqcdp10vfTS5OT46B8B8OFHjkWg0Go2m0kQTSb511IhNPTutr5NXi6PWA9BUnn/50SlG/GEu3eJjQItKGk1WlFJPA1cXOKalSsPRaDRlJhBJ0OrWyx5Nfo6PzgMwH4nXeCQajUajqTQ/fm6CubAx3w/qsudVo7fr1jnHR+f45MNn+NkD/bzp6m3MBGP4Q7FaD0uj0Wg0mqoyH4nj8zhrPQxNnbP
"text/plain": [
"<Figure size 1440x3168 with 40 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"fig, ax = plt.subplots(10,4, figsize=(4*5, 11*4))\n",
"for unit_id in range(num_unit):\n",
" ax[unit_id//4, unit_id%4].plot(stim_val_orientation_loop['orientation'], np.mean(avg_firing_rate_orientaion_loop[unit_id][:, 5:], axis=1))\n",
" ax[unit_id//4, unit_id%4].set_xlabel('orientation')\n",
" ax[unit_id//4, unit_id%4].set_ylabel('avg firing rate / Hz')\n",
"\n",
"ax[0,0].set_title('firing rate (Hz) vs. orientation')\n",
"plt.show()"
]
},
{
"cell_type": "code",
"execution_count": 30,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAABJwAAAmVCAYAAACI9qXUAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMSwgaHR0cHM6Ly9tYXR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d7KvtZF9tO/vqOthf10nzkb6P7HfSjETyMhM8FKVS7uf2hJOIhAPrgTD79Z8zxtwlIo8DeUA/sAW4yRjTP8Lxg8Bu+7eHjTGfck/k3q+rb4CDjUcID7ZgtRqCgsTTISnl80QkCei3J5smAedgKxj+LnA58BTwOeBlz0WpXKG4pp2efit7qttYOi3e0+EopZTyoIKKFgCe316pCacA1tM/SGlD50eSS/vrOqlq7T66T2SohVkp0Zw7bwqzpkQzJyWa5Jhwzv7tOjYfataEkwoonpjhNNTxqVNEQoAPROTfwOPAZ+z7PAFcD/xlhOO77Utb1DGKazowBrr7B6lt72Fq3CRPh6SUP0gF/ikiFmzLkJ8xxrwmIkXAUyLy/4AdwEOeDFI5V1t3/9Gbx62HmjXhpJRSAaxvwMqe6nYAXtlZzQ8+MZewYIuHo1KuNGg1lDcd+V9iqa6dfbUdlDV1HV0WF2IRspOiyMuM59op05iTEs2sKdGkxU0a8cH/7CnRfHiwiZvPyHH3j6OUx7g94WRsC58/1vHJGPP60D4isgXbEhU1DkU17Udfl9R3asJJKScwxuwCloyw/SC2ek7KD+0dNp5uLWvmpjXZHoxGKaWUJ+2tbadvwMoVy9J5dlsl7+6t5/w
"text/plain": [
"<Figure size 1440x3168 with 40 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"fig, ax = plt.subplots(10,4, figsize=(4*5, 11*4))\n",
"for unit_id in range(num_unit):\n",
" ax[unit_id//4, unit_id%4].plot(stim_val_orientation_loop['phase'][:-1], np.mean(avg_firing_rate_orientaion_loop[unit_id], axis=0))\n",
" ax[unit_id//4, unit_id%4].set_xlabel('phase')\n",
" ax[unit_id//4, unit_id%4].set_ylabel('avg firing rate / Hz')\n",
"\n",
"ax[0,0].set_title('firing rate (Hz) vs. phase')\n",
"plt.show()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Preferred stimulus"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [
{
"ename": "NameError",
"evalue": "name 'avg_firing_rate_orientaion_loop' is not defined",
"output_type": "error",
"traceback": [
"\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[1;31mNameError\u001b[0m Traceback (most recent call last)",
"\u001b[1;32mc:\\Users\\arash\\Documents\\Uni\\Research Project (Topology)\\staticgrating-phasefreq-topology\\02_Tuning_Curves_Receptive_Fields.ipynb Cell 35'\u001b[0m in \u001b[0;36m<cell line: 3>\u001b[1;34m()\u001b[0m\n\u001b[0;32m <a href='vscode-notebook-cell:/c%3A/Users/arash/Documents/Uni/Research%20Project%20%28Topology%29/staticgrating-phasefreq-topology/02_Tuning_Curves_Receptive_Fields.ipynb#ch0000034?line=1'>2</a>\u001b[0m R_pref \u001b[39m=\u001b[39m np\u001b[39m.\u001b[39mzeros(num_unit)\n\u001b[0;32m <a href='vscode-notebook-cell:/c%3A/Users/arash/Documents/Uni/Research%20Project%20%28Topology%29/staticgrating-phasefreq-topology/02_Tuning_Curves_Receptive_Fields.ipynb#ch0000034?line=2'>3</a>\u001b[0m \u001b[39mfor\u001b[39;00m unit_id \u001b[39min\u001b[39;00m \u001b[39mrange\u001b[39m(num_unit):\n\u001b[1;32m----> <a href='vscode-notebook-cell:/c%3A/Users/arash/Documents/Uni/Research%20Project%20%28Topology%29/staticgrating-phasefreq-topology/02_Tuning_Curves_Receptive_Fields.ipynb#ch0000034?line=3'>4</a>\u001b[0m R_pref[unit_id] \u001b[39m=\u001b[39m np\u001b[39m.\u001b[39margmax(avg_firing_rate_orientaion_loop[unit_id], axis\u001b[39m=\u001b[39m\u001b[39m0\u001b[39m)\n",
"\u001b[1;31mNameError\u001b[0m: name 'avg_firing_rate_orientaion_loop' is not defined"
]
}
],
"source": [
"# orientation\n",
"R_pref = np.zeros(num_unit)\n",
"for unit_id in range(num_unit):\n",
" R_pref[unit_id] = np.argmax(avg_firing_rate_orientaion_loop[unit_id], axis=0)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Fisher Information"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# tuning index f'(s)**2/f(s)\n",
"def FisherInfo(stim, tuning_curve, variance, dim_stim = 1): # lower bound for fisher information\n",
" if dim_stim == 1:\n",
"\n",
" diff = np.diff(tuning_curve)/np.diff(stim)\n",
" return diff**2/(variance[:-1] + np.diff(variance)/2)\n",
"\n",
" elif dim_stim == 2:\n",
" diff = []\n",
" for i in range(2):\n",
" tuning_diff = np.diff(tuning_curve, axis=i)\n",
" dim = np.size(tuning_curve, axis=i)\n",
" stim_diff = np.diff(stim[i])\n",
" diff.append([tuning_diff[j] for j in range(dim)])\n",
"\n",
" Jacobian = np.array([diff[0][:,:-1], diff[1][:-1,:]])\n",
" Jacobian = np.transpose(Jacobian, (1,2,0))\n",
" return np.einsum('ijk,ijl->ijkl', Jacobian, Jacobian)/variance[:-1,:-1]\n",
"\n",
"a = np.arange(20).reshape(4,5)\n",
"a\n",
"diff = [np.diff(a, axis=i) for i in range(2)]\n",
"\n",
"[np.diff(a, axis=i) for i in range(2)]\n",
"Jacobian = np.array([diff[0][:,:-1], diff[1][:-1,:]])\n",
"Jacobian = np.transpose(Jacobian, (1,2,0))\n",
"np.einsum('ijk,ijl->ijkl', Jacobian, Jacobian)\n",
"\n",
"diff\n",
"FisherInfo(stim = np.arange(20).reshape(4,5), tuning_curve=a, variance=np.ones((4,5)), dim_stim = 2)\n",
"Jacobian[0,0]"
]
},
{
"cell_type": "code",
"execution_count": 17,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Help on function take_along_axis in module numpy:\n",
"\n",
"take_along_axis(arr, indices, axis)\n",
" Take values from the input array by matching 1d index and data slices.\n",
" \n",
" This iterates over matching 1d slices oriented along the specified axis in\n",
" the index and data arrays, and uses the former to look up values in the\n",
" latter. These slices can be different lengths.\n",
" \n",
" Functions returning an index along an axis, like `argsort` and\n",
" `argpartition`, produce suitable indices for this function.\n",
" \n",
" .. versionadded:: 1.15.0\n",
" \n",
" Parameters\n",
" ----------\n",
" arr : ndarray (Ni..., M, Nk...)\n",
" Source array\n",
" indices : ndarray (Ni..., J, Nk...)\n",
" Indices to take along each 1d slice of `arr`. This must match the\n",
" dimension of arr, but dimensions Ni and Nj only need to broadcast\n",
" against `arr`.\n",
" axis : int\n",
" The axis to take 1d slices along. If axis is None, the input array is\n",
" treated as if it had first been flattened to 1d, for consistency with\n",
" `sort` and `argsort`.\n",
" \n",
" Returns\n",
" -------\n",
" out: ndarray (Ni..., J, Nk...)\n",
" The indexed result.\n",
" \n",
" Notes\n",
" -----\n",
" This is equivalent to (but faster than) the following use of `ndindex` and\n",
" `s_`, which sets each of ``ii`` and ``kk`` to a tuple of indices::\n",
" \n",
" Ni, M, Nk = a.shape[:axis], a.shape[axis], a.shape[axis+1:]\n",
" J = indices.shape[axis] # Need not equal M\n",
" out = np.empty(Ni + (J,) + Nk)\n",
" \n",
" for ii in ndindex(Ni):\n",
" for kk in ndindex(Nk):\n",
" a_1d = a [ii + s_[:,] + kk]\n",
" indices_1d = indices[ii + s_[:,] + kk]\n",
" out_1d = out [ii + s_[:,] + kk]\n",
" for j in range(J):\n",
" out_1d[j] = a_1d[indices_1d[j]]\n",
" \n",
" Equivalently, eliminating the inner loop, the last two lines would be::\n",
" \n",
" out_1d[:] = a_1d[indices_1d]\n",
" \n",
" See Also\n",
" --------\n",
" take : Take along an axis, using the same indices for every 1d slice\n",
" put_along_axis :\n",
" Put values into the destination array by matching 1d index and data slices\n",
" \n",
" Examples\n",
" --------\n",
" \n",
" For this sample array\n",
" \n",
" >>> a = np.array([[10, 30, 20], [60, 40, 50]])\n",
" \n",
" We can sort either by using sort directly, or argsort and this function\n",
" \n",
" >>> np.sort(a, axis=1)\n",
" array([[10, 20, 30],\n",
" [40, 50, 60]])\n",
" >>> ai = np.argsort(a, axis=1); ai\n",
" array([[0, 2, 1],\n",
" [1, 2, 0]])\n",
" >>> np.take_along_axis(a, ai, axis=1)\n",
" array([[10, 20, 30],\n",
" [40, 50, 60]])\n",
" \n",
" The same works for max and min, if you expand the dimensions:\n",
" \n",
" >>> np.expand_dims(np.max(a, axis=1), axis=1)\n",
" array([[30],\n",
" [60]])\n",
" >>> ai = np.expand_dims(np.argmax(a, axis=1), axis=1)\n",
" >>> ai\n",
" array([[1],\n",
" [0]])\n",
" >>> np.take_along_axis(a, ai, axis=1)\n",
" array([[30],\n",
" [60]])\n",
" \n",
" If we want to get the max and min at the same time, we can stack the\n",
" indices first\n",
" \n",
" >>> ai_min = np.expand_dims(np.argmin(a, axis=1), axis=1)\n",
" >>> ai_max = np.expand_dims(np.argmax(a, axis=1), axis=1)\n",
" >>> ai = np.concatenate([ai_min, ai_max], axis=1)\n",
" >>> ai\n",
" array([[0, 1],\n",
" [1, 0]])\n",
" >>> np.take_along_axis(a, ai, axis=1)\n",
" array([[10, 30],\n",
" [40, 60]])\n",
"\n"
]
}
],
"source": [
"help(np.take_along_axis)"
]
},
{
"cell_type": "code",
"execution_count": 16,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"C:\\Users\\arash\\AppData\\Local\\Temp\\ipykernel_14200\\163951748.py:2: 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",
" np.array([np.diff(avg_firing_rate_pair_normalized, axis=i) for i in range(1,3)])\n"
]
},
{
"ename": "ValueError",
"evalue": "could not broadcast input array from shape (40,19,20) into shape (40,)",
"output_type": "error",
"traceback": [
"\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[1;31mValueError\u001b[0m Traceback (most recent call last)",
"\u001b[1;32mc:\\Users\\arash\\Documents\\Uni\\Research Project (Topology)\\staticgrating-phasefreq-topology\\Tuning_Curves.ipynb Cell 37'\u001b[0m in \u001b[0;36m<cell line: 2>\u001b[1;34m()\u001b[0m\n\u001b[0;32m <a href='vscode-notebook-cell:/c%3A/Users/arash/Documents/Uni/Research%20Project%20%28Topology%29/staticgrating-phasefreq-topology/Tuning_Curves.ipynb#ch0000036?line=0'>1</a>\u001b[0m \u001b[39m#\u001b[39;00m\n\u001b[1;32m----> <a href='vscode-notebook-cell:/c%3A/Users/arash/Documents/Uni/Research%20Project%20%28Topology%29/staticgrating-phasefreq-topology/Tuning_Curves.ipynb#ch0000036?line=1'>2</a>\u001b[0m np\u001b[39m.\u001b[39;49marray([np\u001b[39m.\u001b[39;49mdiff(avg_firing_rate_pair_normalized, axis\u001b[39m=\u001b[39;49mi) \u001b[39mfor\u001b[39;49;00m i \u001b[39min\u001b[39;49;00m \u001b[39mrange\u001b[39;49m(\u001b[39m1\u001b[39;49m,\u001b[39m3\u001b[39;49m)])\n",
"\u001b[1;31mValueError\u001b[0m: could not broadcast input array from shape (40,19,20) into shape (40,)"
]
}
],
"source": [
"#\n",
"np.array([np.diff(avg_firing_rate_pair_normalized, axis=1)[:,:,:-1], np.diff(avg_firing_rate_pair_normalized, axis=1)[:,:,:-1]]"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"$ r_{est}(t) = r_0 + \\int d\\tau \\left[D_{\\phi}(\\tau)e^{i\\phi(t-\\tau)} + D_{\\theta}(\\tau)\\theta(t-\\tau)\\right] $"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### assume instantaneous phase response\n",
"$ r_{est}(t) = f_{\\phi}(\\phi(t)) + \\int d\\tau D_{\\theta}(\\tau)\\theta(t-\\tau) $\n",
"\n",
"find $D_{\\theta}(\\tau)$ that minimizes the difference between the estimate of firing rate and the actual firing rate.\n",
"\n",
"$ E = \\int dt |{r_{est}(t) - r(t)}|^2 = \\int dt \\left|f_{\\phi}(\\phi(t)) + \\int d\\tau D_{\\theta}(\\tau)\\theta(t-\\tau) - r(t)\\right|^2 \\\\ = \\int dt \\left| D(t)*\\theta(t) - \\left[r(t)-f_{\\phi}(\\phi(t))\\right]\\right|^2 $\n",
"\n",
"$ \\delta E = 2\\int dt \\left(D(t)*\\theta(t) - \\left[r(t)-f_{\\phi}(\\phi(t))\\right]\\right) (\\int d\\tau \\delta D(\\tau) \\theta(t-\\tau) ) = 2\\int d\\tau \\int dt \\left( D(t)*\\theta(t) - \\left[r(t)-f_{\\phi}(\\phi(t))\\right]\\right) \\theta(t-\\tau) \\delta D(\\tau) = 0 \\\\ \\Longleftrightarrow \\int dt \\left( D(t)*\\theta(t) - \\left[r(t)-f_{\\phi}(\\phi(t))\\right]\\right) \\theta(t-\\tau) = 0 \\Rightarrow \\int dt \\left( \\int ds D(s)\\theta(t-s) - \\left[r(t)-f_{\\phi}(\\phi(t))\\right]\\right) \\theta(t-\\tau) = \\int ds D(s) \\int dt \\theta(t-s)\\theta(t-\\tau) - \\int dt \\left[r(t)-f_{\\phi}(\\phi(t))\\right] \\theta(t-\\tau) = \\int ds D(s) C_{\\theta, \\theta}(\\tau-s) - C_{r-f_{\\phi},\\theta}(-\\tau) = 0 \\Rightarrow D(\\tau) * C_{\\theta, \\theta}(\\tau) = C_{r-f_{\\phi},\\theta}(-\\tau)$\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Time difference histogram"
]
},
{
"cell_type": "code",
"execution_count": 19,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAABJUAAAYjCAYAAABOOA6fAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/YYfK9AAAACXBIWXMAAAsTAAALEwEAmpwYAAEAAElEQVR4nOzddXxf1f3H8eeNNmmkaVN3p0WKtEBxdxiMDRkwGGyDGRMmv/mYMxe2MTYGY2PAGO7uLqVG3TVt08Y9ub8/7k2apHEpY+T1fbT5yr33e7527jnv8/m8P0EYhvroo48++uijjz766KOPPvroo48++uijMyS82w3oo48++uijjz766KOPPvroo48++ujjvUefqNRHH3300UcfffTRRx999NFHH3300Uen6ROV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tt+5icNglI9w3VgFN5Hm6QlMrT9eeJ/FRvKoxSE/ZstTM4cSHENL2zt+rFr6/jefA4YGB2vjz7er2xW7iuiyIAMSR0SlCDNEOnxOanCtpY3CkO2Px2lvuWeTPGb1LV+3q5TY75rGm7P8B1jnCGh0SSxUq3/84bPetUgqb5m7ybpVN1lhHQ5UuQpV9BsjJGonxm+Y5ormwhKNercaY3R+ru62QJfUsJOYXxkB3SADUrdYY0HrHOPtR6y3kIFDYJSpmSnGmVcByOzqhTFbWzh/F2+ltJoYhOqi0XCna95ezxJb5y69dfl3LWuQ0/dQJFq2+L0ssmNJpR18Wsa5khJ9SmD/afHD1bsKijB8I904nmXecTRSq2TZpj0VqLmP20PpWrcYCmiNMj/m85jm/n
"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",
"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(X, Y, stim_hist[key][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",
"\n",
"plt.show()"
]
},
{
"cell_type": "code",
"execution_count": 18,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAABYcAAAYkCAYAAACx6LAyAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/YYfK9AAAACXBIWXMAAAsTAAALEwEAmpwYAAEAAElEQVR4nOzdd3iUVfbA8e+d9B7SCGkkEFqA0EIvgtiwoSIglsVe1ra67q7u7s9Vt6lrXctaUcQGIiIq2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tXcHtNZGpdSpCbMLMO/UhBnYprVeRv2EeYFlwlxI/QIy1E+Yn1JK1QFmzpwwL1BKvQTkAbd02IcSTuFUNO7Cu8bauSdCCCGE6My01suB5Y2OPd7g62pgZhP3fQ58fpY2j1E/FxZCCCGEEKLN7L44DDJhFkIIIYQQQgghhBCiJSTYTViTI6SVEEIIIYQQQgghhBBCCNHBZHFYCCGEEEIIIUSHk8LLQgghhP3J4rAQQgghhBBCCCGEEEJ0QbI4LIQQQgghhBBCCKeilLpEKXVQKZWqlHq0ifMeSqmFlvOblVKxluOxSqkqpVSK5dcbDe75ydLmqXNh52pLCCE6A1kcFkKILsgWk+kG9y5TSu3pgI8hhBBCCCG6IKWUC/AaMA1IAOYopRIaXXYbUKS1jgdeBJ5pcC5Naz3U8uvuRvfd0OBcbgvaEqJTO1lazf6cUqrrTPbuirARWRwWogNU1hrJLKwkq6iSr3Yel4FV2JUtJ9NKqWuActv1XgghhOhaJC+vEE0aBaRqrY9orWuBT4Hpja6ZDsy3fL0YmKqUUm18njXbEsK
"text/plain": [
"<Figure size 1728x2016 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=(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]/s[unit_id, 0]))\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",
"\n",
"plt.show()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"subspace reverse correlation on orientation only is equivalent to integrating over phase for subspace reverse correlation on pair stimuli"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# np.mean(stim_hist['pair'][0,30].reshape(20,20), axis=1)/stim_hist['orientation'][0,30] # proportional to integration"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# SNR"
]
},
{
"cell_type": "code",
"execution_count": 213,
"metadata": {},
"outputs": [],
"source": [
"snr = {}\n",
"for key in key_list:\n",
" snr[key] = np.mean(stim_hist[key], axis=2)/np.std(stim_hist['phase'], axis=2)"
]
},
{
"cell_type": "code",
"execution_count": 214,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAABBwAAAEvCAYAAADmTdKhAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/YYfK9AAAACXBIWXMAAAsTAAALEwEAmpwYAADM+ElEQVR4nOz9e5Ak2Z7XB3683DPCMzKiK7qzblXfmtszfWfuPJgdJLTqBSTQarQyaUFiJa2ZDIHWFkYrcfVYyQwJGZpFixiQZIYtIKEFLWIw0PASAr0WxPKUlgEDCZZ7tbMCzYvLTI/6Tt2umqru6BvRkRGR7un7h/vP/ee/OO4RWZVZlVH5+1pHu/t5+3l8zqlfHnePiqLA5XK5XC6Xy+VyuVwul+sqdedVF8DlcrlcLpfL5XK5XC7X6yc3OLhcLpfL5XK5XC6Xy+W6crnBweVyuVwul8vlcrlcLteVyw0OLpfL5XK5XC6Xy+Vyua5cbnBwuVwul8vlcrlcLpfLdeVyg4PL5XK5XC6Xy+VyuVyu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piZeJ+EfjdRVH8taIo8qIofj+wrtIU/d+LonhU8fi/Bn5OV0GKovhyURR/teLu+5QGjD5OX+Y+AP6roij+P0VRZMAf7iuLy+VyHZi21r6V+znwm4qiOC+K4k8BC+DbAYqi+MGiKP5Gxff/EfgjNMw9pzQ0fKHi+5eLovh6tcvhHwF+dVEUnxZF8QT49ykNui5Xr/wZddfrpA/U+U9RbtsdUQLxF1H+dQtgEkVRXBRFviMNl8vlel31EPigKIoL5fZTlH8Ng34WfhPwK6Mo+leU26BKU/ShOl8av5aiKPo24N8D3gNGlGuTL++6gUq77iNUlvGeabtcLtdN19batzp/Vhl
"text/plain": [
"<Figure size 1296x360 with 3 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"# SNR imshow\n",
"\n",
"%matplotlib inline\n",
"\n",
"fig, ax = plt.subplots(1,3,figsize=(18, 5))\n",
"for i, key in enumerate(key_list):\n",
" ax[i].imshow(snr[key], aspect=6)\n",
" # ax[unit_id//4, unit_id%4].plot(stim_hist_KL_div[key][unit_id], label='Entropy of stimulus distribution')\n",
" # ax[unit_id//4, unit_id%4].plot(var_tuning[key][unit_id], label='variance: equivalent to square of euclidean distance from uniform distribution')\n",
"\n",
" ax[i].set_ylabel('unit')\n",
" ax[i].set_xlabel('$\\\\tau/(ms)$')\n",
" ax[i].set_title(key)\n",
" # ax[].legend(loc=(1.5,1.2))\n",
"\n",
"plt.suptitle('SNR')\n",
"plt.show()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Optimal Time\n",
"## Tuning score"
]
},
{
"cell_type": "code",
"execution_count": 20,
"metadata": {},
"outputs": [],
"source": [
"from scipy.stats import zscore\n",
"from matplotlib import cm\n",
"from matplotlib import gridspec\n",
"import scipy.signal as signal"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### filter to find max score and argmax (optimal time)"
]
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "i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YWEnVLVkZtOnafRFZDJmyNQxVa2bwnnBDP/qiJlhN0hVN6WV7zXXXMPGjRszLnEKtGrVCoDQ0FC35JfdhIaGJuiQ17FlkYgti0RsWSQiIv+mHSt10tO8MxXjICk1OmDG2NYAhmB8p1gsFovFC0mzpq+qq0Wk8hWidAWmOb5J1olIsIiUcWYWpsqlSz7s2AE+Pmbz9U3cT+k4f34oWPBKOVosFoslLdzRpl+OpA6YDjphVzT6//5bgHr1MnahatXgnnvgmWcgKCijYlosFoslWztyRWQIpgmIwoUr8cQTvxMXB3FxQlwcqErCset+XBycP+/Htm3BjBxZjG++OcP7728lIMC4AwkPDwdybpt+REREjpXd3diySMSWRSK2LNyHO4z+IZJ63StPKl71VHUCMAGgZs2aOnJkepwOJmXWLOjTpwjLlrVg9GgTFhwcDJBjO3psJ1UitiwSsWWRiC0L9+GOcfrzgHscj4g3AmfSas/PCr17w6BBMHYsHLlqV7FYLJbcSZpGX0RmYLze1RSRg2LWGB0qIkOdKD9ilu/bhXGL+9BVk9bhuefg0iX4+uurfSWLxWLJXaRn9E7fNM4r8LDbJEoHNWtC06YwcyY8+WR2XtlisVhyNjnWDUOnThAWBqdOeVoSi8ViyTnkWKPfujWogu3Qt1gslvSTY43+DTdAQACsW+dpSSwWiyXnkGONfkAA1K0Lmzd7WhKLxWLJOeRYow/QsKE1+haLxZIRcrzRP3nSDN+0WCwWS9rkaKNfx5nQe+GCZ+WwWCyWnEKONvrXXmt+IyM9K4fFYrHkFHK00S9
"text/plain": [
"<Figure size 432x288 with 2 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"# test filter\n",
"from scipy.signal import butter, lfilter, freqz, filtfilt\n",
"\n",
"def butter_lowpass(cutoff, fs, order=5):\n",
" nyq = 0.5 * fs\n",
" normal_cutoff = cutoff / nyq\n",
" b, a = butter(order, normal_cutoff, btype='low', analog=False)\n",
" return b, a\n",
"\n",
"def butter_lowpass_filter(data, cutoff, fs, order=5, no_lag=True):\n",
" b, a = butter_lowpass(cutoff, fs, order=order)\n",
" if no_lag:\n",
" y = filtfilt(b, a, data)\n",
" else:\n",
" y = lfilter(b, a, data)\n",
"\n",
" return y\n",
"\n",
"\n",
"# Setting standard filter requirements.\n",
"order = 6\n",
"fs = 1000 # Hz - 1ms time resolution \n",
"cutoff = 30 # Hz - 50ms ~ trial time\n",
"# 80 ms noise of tuning score; since we expect tuning score to vary with time order of 80 ms, this local measure of noise might be useful\n",
"\n",
"b, a = butter_lowpass(cutoff, fs, order)\n",
"\n",
"# Plotting the frequency response.\n",
"w, h = freqz(b, a, worN=8000)\n",
"plt.subplot(2, 1, 1)\n",
"plt.plot(0.5*fs*w/np.pi, np.abs(h), 'b')\n",
"plt.plot(cutoff, 0.5*np.sqrt(2), 'ko')\n",
"plt.axvline(cutoff, color='k')\n",
"plt.xlim(0, 0.5*fs)\n",
"plt.title(\"Lowpass Filter Frequency Response\")\n",
"plt.xlabel('Frequency [Hz]')\n",
"plt.grid()\n",
"\n",
"\n",
"# Creating the data for filteration\n",
"n = len(tau_id_range)\n",
"dt = 0.001\n",
"T = n*dt # value taken in seconds\n",
"# n = int(T * fs) # indicates total samples\n",
"t = np.linspace(0, T, n, endpoint=False)\n",
"\n",
"data = np.sin(1.2*2*np.pi*t) + 1.5*np.cos(9*2*np.pi*t) + 0.5*np.sin(50.0*2*np.pi*t)\n",
"# data = tuning_score['pair']['var']['z'][0]\n",
"\n",
"# Filtering and plotting\n",
"y = butter_lowpass_filter(data, cutoff, fs, order, no_lag=True)\n",
"\n",
"plt.subplot(2, 1, 2)\n",
"plt.plot(t, data, 'b-', label='data')\n",
"plt.plot(t, y, 'g-', linewidth=2, label='filtered data')\n",
"plt.xlabel('Time [sec]')\n",
"plt.grid()\n",
"plt.legend()\n",
"\n",
"plt.subplots_adjust(hspace=0.35)\n",
"plt.show()"
]
},
{
"cell_type": "code",
"execution_count": 21,
"metadata": {},
"outputs": [],
"source": [
"def KL_div_unif(p):\n",
" n = len(p) + 1\n",
" p_non = 0\n",
" s_non = 0\n",
"\n",
" if np.sum(p)<1:\n",
" p_non = 1-np.sum(p)\n",
" if p_non > 0:\n",
" s_non = -p_non * np.log10(p_non)\n",
"\n",
" nonzero_id = np.where(p != 0)\n",
" p_nonzero = p[nonzero_id]\n",
" if np.any(p_nonzero<=0):\n",
" print('negative probability')\n",
"\n",
" if p_non >1 or np.any(p_nonzero>1):\n",
" print('probability greater than one')\n",
" \n",
" s_stim = -p_nonzero * np.log10(p_nonzero)\n",
" s = np.sum(s_stim) + s_non\n",
" if s<0:\n",
" print('negative entropy')\n",
"\n",
" \n",
" return np.log10(n) - s\n",
"\n",
"def mod_depth(p):\n",
" return np.max(p) - np.min(p)\n",
"\n",
"\n",
"def sparsity(p):\n",
" return 1 - len(p) * np.sum(p)**2/np.sum(p**2)\n",
"\n",
"# def half_BW(p): # The bandwidth is a local measure of selectivity around the peak of the tuning curve.\n",
"# half_height = np.min(np.log10(p))\n",
"# np.min(p, key=lambda x:(x-))\n",
"# return 1/2\n",
"\n",
"def filt(p_series):\n",
" # filter tuning score\n",
" q = np.ndarray(p_series.shape)\n",
" for unit_id in range(len(p_series)):\n",
" q[unit_id] = butter_lowpass_filter(p_series[unit_id], cutoff, fs, order, no_lag=True)\n",
"\n",
" return q"
]
},
{
"cell_type": "code",
"execution_count": 22,
"metadata": {},
"outputs": [],
"source": [
"score_key_list = ['kl', 'var', 'sparsity']\n",
"score_key_method = {'kl':KL_div_unif, 'var':np.var, 'mod_depth':mod_depth, 'sparsity':sparsity}\n",
"\n",
"score_processing_list = ['raw','z','z_filt']\n",
"score_processing_method = {'raw':lambda x:x, 'z': lambda x:zscore(x, axis=1), 'z_filt': filt}\n",
"tuning_score = {}\n",
"\n",
"for key in key_list:\n",
" tuning_score[key] = {}\n",
" for score_key in score_key_list:\n",
" tuning_score[key][score_key] = {}\n",
" for score_processing in score_processing_list:\n",
" tuning_score[key][score_key][score_processing] = np.zeros((num_unit, len(tau_id_range)))\n",
"\n",
" for unit_id in range(num_unit):\n",
" for tau_id in tau_id_range:\n",
" tuning_score[key][score_key]['raw'][unit_id, tau_id] = score_key_method[score_key](stim_hist[key][unit_id, tau_id])\n",
" # tuning_score['var'][key][unit_id, tau_id] = np.var(stim_hist[key][unit_id, tau_id])\n",
" # tuning_score['kl'][key][unit_id, tau_id] = KL_div_unif(stim_hist[key][unit_id, tau_id])\n",
"\n",
"# normalize KL div for each unit\n",
"\n",
"for key in key_list:\n",
" for score_key in score_key_list:\n",
" for i, score_processing in enumerate(score_processing_list[1:]):\n",
" # tuning_score[key][score_key][score_processing] = (score_processing_method[score_processing])(tuning_score[key][score_key][score_processing_list[i-1]])\n",
" tuning_score[key]['kl']['z'] = zscore(tuning_score[key]['kl']['raw'], axis=1)\n",
" tuning_score[key]['var']['z'] = zscore(tuning_score[key]['var']['raw'], axis=1)\n",
" # tuning_score[key]['mod_depth']['z'] = zscore(tuning_score[key]['mod_depth']['raw'], axis=1)\n",
" tuning_score[key]['sparsity']['z'] = zscore(tuning_score[key]['sparsity']['raw'], axis=1)\n",
"\n",
"\n",
"# filter tuning score\n",
"for key in key_list:\n",
" for score_key in score_key_list:\n",
" for i, score_processing in enumerate(score_processing_list[1:]):\n",
" tuning_score[key][score_key]['z_filt'] = np.ndarray((num_unit, len(tau_id_range)))\n",
" for unit_id in range(num_unit):\n",
" tuning_score[key][score_key]['z_filt'][unit_id] = butter_lowpass_filter(tuning_score[key][score_key]['z'][unit_id], cutoff, fs, order, no_lag=True)\n",
"\n",
"# tuning_score = {}\n",
"# for key in key_list:\n",
"# tuning_score[key] = np.max(tuning_score['kl'][key], axis=1)\n",
"\n",
"# unit_tuning_order = np.argsort(tuning_score['pair'])[::-1]\n"
]
},
{
"cell_type": "code",
"execution_count": 23,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAABB4AAAGyCAYAAABDQAcBAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zL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RVYB24C8Ukob4C/091z9CIlxUsoSQHWgJSnTMnxJGdnmkOq+by2lLPkGr0X5SKnEg/IxGiiEyCOEyEFKdnYtKfOT44Bw/fYx2RmgoijKe+IMKW/AhgshjPTLr7UC1rzEsQuA/kKIKiKFhb5YmdVLHPsEsBdC2KTaZgVEAtFCiGLAgEyOKfAWrkNRFOVDl9mz74tYAaFSynghRGVSavoAIISoJ4QorS8aGUnK1AudlNKflFo6vwshrIUQGiFEQSHEy06LU/7DVOJB+RitIuWm6AN4AxOBPwAzIBg4DXhkV3CKoijvCyllIikf0JuRcn+cC3wqpbz5EseeB74gpVBvGCkFG3u/5HlvkjKf2EdfMd0FGEbKg28UKUmN9A/OY4Fl+vad39R1KIqifAQye/Z9ka+A8UKIKGA0sC7VPidgAylJhxvAEVKmX0DKyAdjwIuUe/8GwPn/vwTlYyekVCPKlY+HEOI+8LmUcn92x6IoiqIoiqIob5N69lU+FGrEg6IoiqIoiqIoiqIob41KPCiKoiiKoiiKoiiK8taoqRaKoiiKoiiKoiiKorw1asSDoiiKoiiKoiiKoihvjUo8KIqiKIqiKIqiKIry1hhmdwCvwsHBQbq6umZ3GIqiKGlcuHAhWErpmN1xvAvqPqwoyvtK3YsVRVGyV1b34Q8q8eDq6sr58+ezOwxFUZQ0hBA
"text/plain": [
"<Figure size 1296x360 with 4 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"# KL div comparison across units\n",
"%matplotlib inline\n",
"score_key = 'kl'\n",
"score_processing = 'z_filt'\n",
"fig, ax = plt.subplots(1,3,figsize=(18, 5))\n",
"for i, key in enumerate(key_list):\n",
" for unit_id in range(num_unit):\n",
" im = ax[i].plot(tuning_score[key][score_key][score_processing][unit_id], c=cmap_hot(sorted_spike_num[unit_id]/np.max(sorted_spike_num)))\n",
" # ax[i].plot(tuning_score[key][score_key][unit_id],)\n",
"\n",
" # ax[unit_id//4, unit_id%4].plot(tuning_score[key][score_key][unit_id], label='Entropy of stimulus distribution')\n",
" # ax[unit_id//4, unit_id%4].plot(var_tuning[key][unit_id], label='variance: equivalent to square of euclidean distance from uniform distribution')\n",
"\n",
" ax[i].set_ylabel('tuning score')\n",
" ax[i].set_xlabel('$\\\\tau/(ms)$')\n",
" # ax[i].set_ylim([0,1])\n",
" ax[i].set_title(key)\n",
" # ax[].legend(loc=(1.5,1.2))\n",
"\n",
"cbar_ax = fig.add_axes([0.3, -0.1, 0.5, 0.1])\n",
"fig.colorbar(cm.ScalarMappable(cmap=cmap_hot), cax=cbar_ax, orientation='horizontal', label='spike count')\n",
"plt.suptitle('tuning score: ' + score_key)\n",
"plt.show()"
]
},
{
"cell_type": "code",
"execution_count": 24,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAABEkAAALFCAYAAAA/R73UAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/YYfK9AAAACXBIWXMAAAsTAAALEwEAmpwYAAEAAElEQVR4nOz9e5wk2XbXh353RWRGVj66cqr6dM/pMzPnLQmJh3yvLMAXDLa5GDBcdG0jA8IgDJYFxhdssDEYbBkQGF9zdbExlsRL2OL5wVcYuIBBNkIWbzAyAiHBkXSO5pw+0326erI6s7LyEZHhP/ZeEWvv3JFVPTM6M929f/2Jjqh47njk2nv/9m+tZeq6JiEhISEhISEhISEhISEhIeFFx9G7XYCEhISEhISEhISEhISEhISE9wISSZKQkJCQkJCQkJCQkJCQkJBAIkkSEhISEhISEhISEhISEhISgESSJCQkJCQkJCQkJCQkJCQkJACJJElISEhISEhISEhISEhISEgAEkmSkJCQkJCQkJCQkJCQkJCQACSSJCEhISEhIeEdgjGmNsZ8zC1/ozHmN7/D5/9qY8x3vZPnPHCt14wxC2NM9vm4XkJCQkJCQsJ7A/m7XYCEhISEhISE5w91XX/t5/N6xpgPAT8E9Oq6Lt/u+eq6/mFg/HbPk5CQkJCQkPBsISl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+KXqnOE1/wt3D18KfAz4APCfys7OCP2kA/eAMebIGPP7gB8L/PS6ri8O7S+o6/q/dKNnY+BHAZ8D/sSB/b8a+COAHPftB/b9T4D/DfhVbt9fdZMyJSQkJLxVGGN+lLFk+MwY84+MMf8Pte1bjDH
"text/plain": [
"<Figure size 1296x720 with 9 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"# normalized tuning score imshow\n",
"\n",
"%matplotlib inline\n",
"fig, ax = plt.subplots(3,3,figsize=(18, 10))\n",
"plt.set_cmap('jet')\n",
"score_mode = 'z_filt'\n",
"\n",
"for j, score_key in enumerate(score_key_list):\n",
" for i, key in enumerate(key_list):\n",
" ax[j, i].imshow(tuning_score[key][score_key][score_mode], aspect=8)\n",
" # ax[j, i].imshow(stim_hist_KL_div_norm[key], aspect=6)\n",
"\n",
" ax[j, i].set_ylabel('unit')\n",
" ax[j, i].set_xlabel('$\\\\tau/(ms)$')\n",
" ax[j, i].set_title(key)\n",
" ax[j, i].set_title(key + ' score: ' + score_key + '_'+ score_mode)\n",
" # ax[].legend(loc=(1.5,1.2))\n",
"\n",
"plt.suptitle('normalized tuning score')\n",
"plt.tight_layout()\n",
"plt.show()"
]
},
{
"cell_type": "code",
"execution_count": 27,
"metadata": {},
"outputs": [],
"source": [
"# all local maxima tuning score across time delay\n",
"\n",
"def local_max(y):\n",
" # returns local maxima \n",
" arg_locmax = np.where((y[1:-1] >= y[:-2]) & (y[1:-1] >= y[2:]))\n",
" sort_argmax = arg_locmax[0][np.argsort(y[arg_locmax])[::-1]]\n",
" return np.array([sort_argmax, y[sort_argmax]])\n",
"\n",
"max_tuning_score = {}\n",
"for key in key_list:\n",
" max_tuning_score[key] = {}\n",
" for score_key in score_key_list:\n",
" max_tuning_score[key][score_key] = {}\n",
" for score_processing in score_processing_list:\n",
" max_tuning_score[key][score_key][score_processing] = np.ndarray(num_unit, dtype=object)\n",
" for unit_id in range(num_unit):\n",
" max_tuning_score[key][score_key][score_processing][unit_id] = local_max(tuning_score[key][score_key][score_processing][unit_id])\n",
"\n",
"optimal_time = {}\n",
"for key in key_list:\n",
" optimal_time[key] = {}\n",
" for score_key in score_key_list:\n",
" optimal_time[key][score_key]= {}\n",
" for score_processing in score_processing_list:\n",
" optimal_time[key][score_key][score_processing] = pd.DataFrame([max_tuning_score[key][score_key][score_processing][unit_id][:,0] for unit_id in range(num_unit)], columns=['optimal_time', 'max_tuning_score']).astype({'optimal_time':int})\n",
" first_argmax = [np.argmin(max_tuning_score[key][score_key][score_processing][unit_id][0,:]) for unit_id in range(num_unit)]\n",
" optimal_time[key][score_key][score_processing]['first_argmax'] = [int(max_tuning_score[key][score_key][score_processing][unit_id][0, first_argmax[unit_id]]) for unit_id in range(num_unit)]\n",
" optimal_time[key][score_key][score_processing]['first_max'] = [max_tuning_score[key][score_key][score_processing][unit_id][1, first_argmax[unit_id]] for unit_id in range(num_unit)]"
]
},
{
"cell_type": "code",
"execution_count": 35,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"C:\\Users\\arash\\AppData\\Local\\Temp\\ipykernel_25088\\1394730034.py:14: DeprecationWarning: In future, it will be an error for 'np.bool_' scalars to be interpreted as an index\n",
" w_mode = ['optimal_time', 'first_argmax'][winner_mode[unit_id]]\n",
"C:\\Users\\arash\\AppData\\Local\\Temp\\ipykernel_25088\\1394730034.py:15: SettingWithCopyWarning: \n",
"A value is trying to be set on a copy of a slice from a DataFrame\n",
"\n",
"See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
" optimal_time['pair'][score_key][score_processing]['opt_time'][unit_id] = int(optimal_time['pair'][score_key][score_processing][w_mode][unit_id])\n"
]
}
],
"source": [
"# optimal time: trade off between first maximum and global maximum\n",
"\n",
"alpha_first = 8\n",
"\n",
"for score_key in score_key_list:\n",
" for score_processing in score_processing_list:\n",
" optimal_time['pair'][score_key][score_processing]['max_score'] = optimal_time['pair'][score_key][score_processing]['max_tuning_score'] - alpha_first * (optimal_time['pair'][score_key][score_processing]['optimal_time'])/300\n",
" optimal_time['pair'][score_key][score_processing]['first_score'] = optimal_time['pair'][score_key][score_processing]['first_max'] - alpha_first * (optimal_time['pair'][score_key][score_processing]['first_argmax'])/300\n",
"\n",
" # optimal_time['pair'][score_key][score_processing]['opt_time'] = np.zeros(num_unit, dtype=int)\n",
" winner_mode = optimal_time['pair'][score_key][score_processing]['first_score'] > optimal_time['pair'][score_key][score_processing]['max_score']\n",
" optimal_time['pair'][score_key][score_processing]['opt_time'] = np.zeros(num_unit, dtype=int)\n",
" for unit_id in range(num_unit):\n",
" w_mode = ['optimal_time', 'first_argmax'][winner_mode[unit_id]]\n",
" optimal_time['pair'][score_key][score_processing]['opt_time'][unit_id] = int(optimal_time['pair'][score_key][score_processing][w_mode][unit_id])"
]
},
{
"cell_type": "code",
"execution_count": 29,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAABI4AAAdyCAYAAADw06RmAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/YYfK9AAAACXBIWXMAAAsTAAALEwEAmpwYAAEAAElEQVR4nOzdd3gU1dvG8e9JJaGEFnrvIEWKFCmiiGJDQCzYQATFir1h770i4k9FVOyKUhRFFEREEZDee+89kL7n/WM2vjFukoVkM5Pk/lzXXtkyO/PsJHtn5tkzs8Zai4iIiIiIiIiISFZhbhcgIiIiIiIiIiLepMaRiIiIiIiIiIgEpMaRiIiIiIiIiIgEpMaRiIiIiIiIiIgEpMaRiIiIiIiIiIgEpMaRiIiIiIiIiIgEFOF2ASKZzZ8/v1JERMS7QHPU2MyJD1ialpY2pG3btrvdLkakqFEWBU1ZJBJiyqOgKItEQkxZFJQim0VqHImnREREvFulSpWm8fHxB8LCwqzb9XiVz+cze/bsabZz5853gd5u1yNS1CiLgqMsEgk95VHul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kxxozZktMkbdq0SRwxYkTNG264ofqFF154qFevXgkAAwcO3A8wdOjQ/Q8++GBNgA0bNkT16dOnxp49eyJTUlLCatasmZwxn169eh0sVaqUBejUqdPRF198serWrVujLrvssgMtWrRIDrTsDIMGDTrwwgsvVE1OTt46evToipdffvnevL50ETlByiJlkYhXuJBHyiIR+Q9lUbHLIo04EsmiZcuWyX///ffyFi1aJD700EPV77rrrqoAYWH//3YxxliAm2++udaNN964e/Xq1ctHjhy5KTk5+Z+JSpYs6cu4PmzYsP0TJkxYGxMT4zv//PMbTpw4sXRONZQuXdrXtWvXw5988knZiRMnlh86dOj+fH+hIuJpyiIR8QJlkYh4gbLIXRpxJN6Vy6fxobJx48bISpUqpd144437y5Url/7ee+9VBPjwww/LP/300zvfe++9cq1btz4KcOTIkfBatWqlAowdO7ZCdvNcvnx5VNOmTZNPOumk3Zs3b45auHBhTO/evY9kPB4XF5eekJAQnvk5w4YN23vRRRc1OOWUUxLi4+PTQ/NqRSRXyiJlkYhXuJBHyiIR+Q9lUbHLIjWORLKYP39+zP33318jLCyMiIgIO2rUqE0DBgyof+DAgfBGjRo1i4qKsp999tl6gBEjRmwfMGBA/bi4uLQuXboc2bx5c3SgeY4bN678F198USEiIsLGx8enPvHEEzsyP96+ffvE8PBw27hx42aXX3753kceeWR3165dj5UsWTL9mmuuKTZDIEXk/ymLRMQLlEUi4gXKIncZa63bNYj8Y9GiRRtbtWrluTdh9erVW8ybN29F1apV0wpqmRs3bozs3r1743Xr1i0NDw8POM2iRYsqtmrVqk5B1SRSXCiL/p+ySMRdXswjZZFI8aMschTXLNI5jkQ8aOTIkRU6duzY9OGHH96WXSCJiISaskhEvEBZJCJeUJyzSCOOxFO82Mn2sqLYzRbxAmXR8VEWiYSO8ih4yiKR0FEWBa8oZpFGHImIiIiIiIiISEBqHInX+Hw+n3G7iMLAv558uU4oIidCWRQkZZFIyCmPgqAsEgk5ZVEQimoWqXEkXrN0z549cQqlnPl8PrNnz544YKnbtYgUUcqiICiLRAqE8igXyiKRAqEsykVRzqIItwsQySwtLW3Izp073925c2dz1NjMiQ9YmpaWNsTtQkSKImVR0JRFIiGmPAqKskgkxJRFQSmyWaSTY4uIiIiIiIiISEDqFIqIiIiIiIiISEBqHImIiIiIiIiISEBqHImIiIiIiIiISEBqHImIiIiIiIiISEB
"text/plain": [
"<Figure size 1440x2520 with 28 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"%matplotlib inline\n",
"\n",
"key = 'pair'\n",
"score_processing = 'z_filt'\n",
"opt_time_mode = 'optimal_time'\n",
"row_num = 7\n",
"fig = plt.figure(figsize=(4*5, row_num*5))\n",
"gs0 = gridspec.GridSpec(row_num, 4, figure=fig)\n",
"color_list = ['b','g','r']\n",
"for unit_id in range(num_unit):\n",
" r = unit_id//4\n",
" c = unit_id%4\n",
"\n",
" gs00 = gridspec.GridSpecFromSubplotSpec(2, 1, subplot_spec=gs0[r, c], hspace=0)\n",
" \n",
" ax0 = fig.add_subplot(gs00[0, :])\n",
" for i, score_key in enumerate(score_key_list):\n",
" ax0.plot(tuning_score[key][score_key][score_processing][unit_id], label=score_key, color=color_list[i]) # 'zscore KL divergence of stimulus distribution from uniform distribution'\n",
" ax0.vlines(optimal_time[key][score_key][score_processing][opt_time_mode][unit_id], -4, 4, color=color_list[i])\n",
"\n",
" # ax0.plot(tuning_score[key]['var_z_filt'][unit_id], label='var' , color='r') # label='zscore variance: equivalent to square of euclidean distance from uniform distribution'\n",
" # ax0.plot(tuning_score[key]['mod_depth_z_filt'][unit_id], label='mod depth', color='g')\n",
" # ax0.plot(tuning_score[key]['sparsity_z_filt'][unit_id], label='sparsity', color='k')\n",
" # ax0.plot(tuning_score[key]['var_z'][unit_id], color='r')\n",
"\n",
" # ax0.vlines(optimal_time[key]['var_z_filt']['first_argmax'][unit_id], -4, 4, color='r')\n",
" # ax0.vlines(optimal_time[key]['mod_depth_z_filt']['first_argmax'][unit_id], -4, 4, color='r')\n",
" # ax0.vlines(optimal_time[key]['sparsity_z_filt']['first_argmax'][unit_id], -4, 4, color='r')\n",
"\n",
" ax0.set_ylabel('tuning score')\n",
" ax0.set_xlabel('$\\\\tau/(ms)$')\n",
" ax0.set_title('unit %d'%unit_id + ', spike num: %d'%sorted_spike_num[unit_id])\n",
"\n",
" # ax0.set_ylim([0,1])\n",
" ax0.legend(loc=(.5,1.2))\n",
"\n",
"plt.show()"
]
},
{
"cell_type": "code",
"execution_count": 41,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAABQgAAALICAYAAAAzLx1UAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/YYfK9AAAACXBIWXMAAAsTAAALEwEAmpwYAABzLUlEQVR4nOzdf9xldV3v/dcbxExBsWZShBkGjTR/kHgm0LQO1l0CotR9vA3smFg6R9QSj578UUeJY49jdUuhJDgmKgcUTEnJsLL7WKgpx2FCENAOIRx+TDJCMvwqHfzcf+w1tr28fuxrX9e69l57vZ6Px/W49l5r7bU/iz3s97U+67vWSlUhSZIkSZIkqZ/2mnQBkiRJkiRJkibHBqEkSZIkSZLUYzYIJUmSJEmSpB6zQShJkiRJkiT1mA1CSZIkSZIkqcdsEEqSJEmSJEk9ZoNQ6qAkn0jyoknXIUnqviRnJ/mvk64DIMlPJvnKpOuQJHVTkqOS3DzpOqQuSlVNugZJkiR1XJKjgPOq6qBlvKaAQ6vqurbqkiT1xzhZJGnAEYTSjEnygEnXIEnqhiR7T7oGSZIkTZ4NQmmCktyQ5A1Jrknyz0nem+RBSR6e5ONJdjbTP57koKHX/U2SlzSPT0ry2SR/kOR24NRJbY8kaTok+dEmK76R5Ookz22mvy/JWUkuSXIP8Mxm2luGXntckiua1/5dksOG5t2Q5LVJrkxyZ5ILm9x6CPAJ4FFJ7m5+HpXkiCSfa9a1I8mZSR7YrOvSZrVfbJb/xbmnhi20HUPb8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tOoNCkiRJkiSpO2wQSpp6Np0lSZKmm3+vSVK3eRdjSZIkSZIkqcdsEEqSJEmSJEk95inGkiRJkmaOp7xKkjQ6G4TSPPyDUpIkrQX/5pCkbvF7W7NqpAZhkmc
"text/plain": [
"<Figure size 1296x720 with 9 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"# compare units based on tuning score\n",
"%matplotlib inline\n",
"\n",
"score_processing = 'z_filt'\n",
"fig, ax = plt.subplots(3,3,figsize=(18, 10))\n",
"for i, key in enumerate(key_list):\n",
" for j, score_key in enumerate(score_key_list):\n",
" ax[j, i].bar(range(num_unit), [tuning_score[key][score_key][score_processing][unit_id,int(optimal_time[key][score_key][score_processing]['optimal_time'][unit_id])] for unit_id in range(num_unit)]) #/np.max(max_tuning_score[key][score_key][score_processing]))\n",
" # ax[unit_id//4, unit_id%4].plot(stim_hist_KL_div[key][unit_id], label='Entropy of stimulus distribution')\n",
" # ax[unit_id//4, unit_id%4].plot(var_tuning[key][unit_id], label='variance: equivalent to square of euclidean distance from uniform distribution')\n",
"\n",
" ax[j, i].set_ylabel('relative tuning score')\n",
" ax[j, i].set_xlabel('$unit$')\n",
" # ax[j, i].set_ylim([0,1])\n",
" ax[j, i].set_title(key)\n",
" # ax[].legend(loc=(1.5,1.2))\n",
"\n",
"plt.tight_layout()\n",
"plt.show()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# # reoder based on tuning score\n",
"# unit_tuning_order = np.argsort(tuning_score['orientation'])[::-1]\n",
"# unit_tuning2rate_order = np.argsort(unit_tuning_order)\n",
"\n",
"# def reorder_unitsO(unit_tuning_order):\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]"
]
},
{
"cell_type": "code",
"execution_count": 42,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAABZgAAAm9CAYAAACrbF01AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/YYfK9AAAACXBIWXMAAAsTAAALEwEAmpwYAAEAAElEQVR4nOzdd7wcd3X//+dn++1dvVmyLUvutmxjY0w1vZgeQkIIkIQAIZUUUr5JICQkIYEk5EcgJEAoCb2bajBgjHuXbdnqXbq97d06vz9mdH0lXVVLbuzrPvZxd6d+ZnbnzGfO55z3CVEUadCgQYMGDRo0aNCgQYMGDRo0aNCgQYMGDY6V1KPdgAYNGjRo0KBBgwYNGjRo0KBBgwYNGjRo8Pik4WBu0KBBgwYNGjRo0KBBgwYNGjRo0KBBgwbHRcPB3KBBgwYNGjRo0KBBgwYNGjRo0KBBgwYNjouGg7lBgwYNGjRo0KBBgwYNGjRo0KBBgwYNGhwXDQdzgwYNGjRo0KBBgwYNGjRo0KBBgwYNGjQ4LhoO5gYNGjRo0KBBgwYNGjRo0KBBgwYNGjRocFw0HMwNjokQwodCCH/+aLfjcIQQ3hlC+M/k/bIQQhRCyDza7WrQoEGDE83jxCa/NoTwnRmfoxDCqY9mmxo0aNDgZNCwyQ0aNGjw2KFhkxs0eGRpOJgbHBNRFL05iqJ3QQjhaSGEbYdbPsS8N4QwkLzeG0IIJ7mN74mi6E0ncx+PJsl5r4cQxme8fmXG/LeFEG4OIZRCCB+bZf3mEMK/hxD6QwgjIYQfzZh39QHbLYcQ7pox/wchhL0hhNEQwh0hhJec9ANu0KDBITkOm/z05DoeCSFseoTa+Kkoip79SOzr0SCEsDqxuUPJ63shhNUz5h/2PhhCeFEI4e7E5v505rrJ/N8NIexK7O5/h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ue67QYMGx8eJtMkPtx1LsSCKoqlZbNR7oygajKJoC97v8Db5leIO+/OiKLoxmfZm/G0URfcm0bzvwXmHis5I+KsoiopRFN0h7jSeewzH869RFO1OIhp+jBuiKLotiqIpfMn+NvmcKIo+fbiNRVHUKX7AeRtumzHrcPfB7+GpSeRITtxxz4lTBQ+1LrENXpS8f7Y4ZfDp4nP+xqM49gYNGhw/J8sm/6X42ey/j7DczHY0bPJhCCGcg79waFmoWfu6h9neYnF69V/MMvt+7ME7QgjZEMKzxUEszbMs26BBgxPHCbXJURR9OglwOx0fwu5jaEfDJh8738IfhxDakkj1N5jdbl6Oufj8jGljYrmMn6Akzuz79SSamYfni2pwHDQczA1mYyB6SAYBJsUX5/EwjvYZn9sxPuOiPxxvFBv2+0IIN4UQXnjA/K0z3m8WO0wPxTvwwSiKZgr7LxVr9AwnkWf3itM25h5iGw/3vMy8ORVn+XxU24qiaFcUp0PXoyjaKI6GPlQU8oEUxTe/dyfpKtfiB2IHxTRJ9PQ8+xvwmW2oRHH64LNDCC8+yn03aNDg+DiRNvnh8IfiqIIbQwj3hBAOjLw4Fpv8O/hskk2yj6X4wAybPJjsb+FhtjNTy+1RsckzSSJkPoRPhBD2pecd8j4YRdF94vS9f8NOcVrfWmw7zLrEHepi8v7vo0SmQ/ww8vxjbXeDBg2OiRNuk0MIbxM7O1+QBD0cDQ2bfBgSR8XV+O0oin48y/zD9nUPwfvFjqyRA2dEUVQRZ0a+QHwefl+cfXnYomINGjR42JyUfnIURQ+Isx/+/ShXadjk4+PtyfYeEMtEfcbsdvNX8IUoisZnTHsjflUclZwTZ4d/PTwkf/JwfFENjoOGg/nnk0n7jwrNO87tHM2FeY/9R8rOdZSpf1EUPRBF0WvEGjrvxecPkIKYqf27RFxo6VA8G392gBzEVvGoYOeMVyEZpTtWJpyYc3o8RI7+Wp4tnW+27/FX8MU
"text/plain": [
"<Figure size 1440x2520 with 84 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"# selectivity time course and optimal delay\n",
"key = 'pair'\n",
"score_key = 'var'\n",
"score_processing = 'z_filt'\n",
"opt_time = optimal_time['pair'][score_key][score_processing]['optimal_time']\n",
"\n",
"%matplotlib inline\n",
"\n",
"pair_optimal_time = True # bool\n",
"opt_time_mode = ['optimal_time', 'first_argmax', 'opt_time'][0]\n",
"\n",
"row_num = 7\n",
"\n",
"fig = plt.figure(figsize=(4*5, row_num*5))\n",
"gs0 = gridspec.GridSpec(row_num, 4, figure=fig)\n",
"\n",
"X, Y = {}, {}\n",
"for key in key_list[1:]:\n",
" X[key], Y[key] = np.meshgrid(stim_val[key], -tau_id_range)\n",
"\n",
"plt.set_cmap('jet')\n",
"for unit_id in range(num_unit):\n",
" r = unit_id//4\n",
" c = unit_id%4\n",
"\n",
" gs00 = gridspec.GridSpecFromSubplotSpec(3, 1, subplot_spec=gs0[r, c], hspace=0)\n",
"\n",
" key = 'phase'\n",
" ax0 = fig.add_subplot(gs00[0, :])\n",
" ax0.contour(Y[key], X[key], stim_hist[key][unit_id])\n",
" # ax0.set_ylabel(key_symbol[key]+'/degrees')\n",
" ax0.set_ylabel(key)\n",
" ax0.set_title('unit %d'%unit_id + ', spike num: %d'%sorted_spike_num[unit_id])\n",
" plt.setp(ax0.get_xticklabels(), visible=False)\n",
"\n",
" # t0 = -optimal_time[[key, 'pair'][pair_optimal_time]][score_key][score_processing][opt_time_mode][unit_id]\n",
" t0 = -optimal_time[key][score_key][score_processing]['optimal_time'][unit_id]\n",
" ax0.vlines(t0, 0, max(stim_val[key]), color='b')\n",
" ax0.axvspan(t0-15, t0+15, alpha=0.1, color='b')\n",
"\n",
" key = 'orientation'\n",
" ax1 = fig.add_subplot(gs00[1, :], sharex=ax0)\n",
" ax1.contour(Y[key], X[key], stim_hist[key][unit_id])\n",
" # ax1.set_ylabel(key_symbol[key]+'/degrees')\n",
" ax1.set_ylabel(key)\n",
" ax1.set_xlabel('$\\\\tau/(ms)$')\n",
" \n",
" plt.subplots_adjust(hspace=0)\n",
"\n",
" # t0 = -optimal_time[[key, 'pair'][pair_optimal_time]][score_key][score_processing][opt_time_mode][unit_id]\n",
" t0 = -optimal_time[key][score_key][score_processing]['optimal_time'][unit_id]\n",
" ax1.vlines(t0, 0, max(stim_val[key]), color='r')\n",
" ax1.axvspan(t0-15, t0+15, alpha=0.1, color='r')\n",
"\n",
" key = 'pair'\n",
" ax2 = fig.add_subplot(gs00[2, :])\n",
" ax2.plot(-tau_id_range, tuning_score['orientation'][score_key][score_processing][unit_id], label='orientation', color='r', alpha=0.5) # 'zscore KL divergence of stimulus distribution from uniform distribution'\n",
" ax2.plot(-tau_id_range, tuning_score['phase'][score_key][score_processing][unit_id], label='phase', color='b', alpha=0.5) # 'zscore KL divergence of stimulus distribution from uniform distribution'\n",
" ax2.plot(-tau_id_range, tuning_score[key][score_key][score_processing][unit_id], label='joint', color='k', alpha=0.5) # 'zscore KL divergence of stimulus distribution from uniform distribution'\n",
"\n",
" ax2.vlines(-optimal_time[key][score_key][score_processing][opt_time_mode][unit_id], -4, 4, color='k')\n",
" ax2.legend(loc=(.5,-1.2))\n",
"\n",
"\n",
"\n",
"plt.tight_layout()\n",
"plt.show()"
]
},
{
"cell_type": "code",
"execution_count": 48,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAY4AAAEWCAYAAABxMXBSAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/YYfK9AAAACXBIWXMAAAsTAAALEwEAmpwYAAAlTklEQVR4nO3de9wWdZ3/8dc7EDziAcgUJCgxF7VIEe2guZouVoqVx3U9rb9ot6zc0sKtNbV2V3fbytQOmGfNEx6iFSWPHUwJJFLRJVFJQfKAimcU/fz++H6vHC6um3sG7rnv65b38/G4HtfMd2a+85nrgutzz/c78x1FBGZmZmW9racDMDOz3sWJw8zMKnHiMDOzSpw4zMysEicOMzOr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vG6Htv3/FM/3mP7Nutt6kwcq+udEbFQ0ruAWyTdAywpu3FETAImAYwZMyZqitHMbI1TZ1PVQmCLwvzQXFZKRCzM7w8BtwHvBxYDG0lqJLxKdZqZ2eqrM3HMAEbmq6D6AQcDUzrZBgBJG0vqn6cHAR8C7ouIAG4FGldgHQH8vMsjNzOzDtWWOHI/xDHANOB+4IqImCPpFEn7AkjaUdIC4ADgJ5Lm5M3/Bpgp6Y+kRHFqRNyXl30N+LKkeaQ+j3PqOgYzM1tRrX0cETEVmNpUdmJhegapual5u98B23VQ50OkK7bMzKwH+M5xMzOrxInDzMwqceIwM7NKnDjMzKwSJw4zM6vEicPMzCpx4jAzs0qcOMzMrBInDjMzq8SJw8zMKnHiMDOzSpw4zMysEicOMzOrxInDzMwqceIwM7NKnDjMzKwSJw4zM6uk08Qh6UuSBig5R9IsSXt1R3B
"text/plain": [
"<Figure size 432x288 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"# optimal delay histogram\n",
"h, tau = np.histogram(optimal_time['pair']['var']['z_filt']['opt_time'])\n",
"bin_size = np.diff(tau[:2])\n",
"plt.bar(tau[:-1]+bin_size/2, h/40, width=bin_size)\n",
"plt.xlabel('optimal time delay / (ms)')\n",
"plt.ylabel('percentage of units')\n",
"plt.title('Optimal delay histogram')\n",
"plt.show()"
]
},
{
"cell_type": "code",
"execution_count": 48,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([ 6, 1, 23, 16, 10, 7, 21, 24, 0, 11, 18, 19, 22, 8, 25, 13, 15,\n",
" 12, 5, 4, 27, 26, 14, 17, 2, 9, 3, 20], dtype=int64)"
]
},
"execution_count": 48,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"np.argsort(np.max(var_tuning['pair'], axis=1))"
]
},
{
"cell_type": "code",
"execution_count": 49,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([ 6, 1, 23, 16, 10, 7, 21, 24, 0, 11, 18, 19, 22, 8, 25, 13, 15,\n",
" 12, 5, 4, 27, 26, 14, 17, 2, 9, 3, 20], dtype=int64)"
]
},
"execution_count": 49,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"np.argsort(np.max(var_tuning['pair'], axis=1))"
]
},
{
"cell_type": "code",
"execution_count": 118,
"metadata": {},
"outputs": [
{
"ename": "NameError",
"evalue": "name 'var_tuning' is not defined",
"output_type": "error",
"traceback": [
"\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[1;31mNameError\u001b[0m Traceback (most recent call last)",
"\u001b[1;32mc:\\Users\\arash\\Documents\\Uni\\Research Project (Topology)\\staticgrating-phasefreq-topology\\02_Tuning_Curves_Receptive_Fields.ipynb Cell 66'\u001b[0m in \u001b[0;36m<cell line: 6>\u001b[1;34m()\u001b[0m\n\u001b[0;32m <a href='vscode-notebook-cell:/c%3A/Users/arash/Documents/Uni/Research%20Project%20%28Topology%29/staticgrating-phasefreq-topology/02_Tuning_Curves_Receptive_Fields.ipynb#ch0000082?line=4'>5</a>\u001b[0m fig, ax \u001b[39m=\u001b[39m plt\u001b[39m.\u001b[39msubplots(\u001b[39m1\u001b[39m,\u001b[39m3\u001b[39m,figsize\u001b[39m=\u001b[39m(\u001b[39m18\u001b[39m, \u001b[39m5\u001b[39m))\n\u001b[0;32m <a href='vscode-notebook-cell:/c%3A/Users/arash/Documents/Uni/Research%20Project%20%28Topology%29/staticgrating-phasefreq-topology/02_Tuning_Curves_Receptive_Fields.ipynb#ch0000082?line=5'>6</a>\u001b[0m \u001b[39mfor\u001b[39;00m i, key \u001b[39min\u001b[39;00m \u001b[39menumerate\u001b[39m(key_list):\n\u001b[1;32m----> <a href='vscode-notebook-cell:/c%3A/Users/arash/Documents/Uni/Research%20Project%20%28Topology%29/staticgrating-phasefreq-topology/02_Tuning_Curves_Receptive_Fields.ipynb#ch0000082?line=6'>7</a>\u001b[0m ax[i]\u001b[39m.\u001b[39mimshow(zscore(var_tuning[key]\u001b[39m.\u001b[39mreshape(\u001b[39m-\u001b[39m\u001b[39m1\u001b[39m))\u001b[39m.\u001b[39mreshape(num_unit,\u001b[39m300\u001b[39m)[np\u001b[39m.\u001b[39margsort(np\u001b[39m.\u001b[39mmax(var_tuning[key], axis\u001b[39m=\u001b[39m\u001b[39m1\u001b[39m))], aspect\u001b[39m=\u001b[39m\u001b[39m7\u001b[39m) \u001b[39m# ax[unit_id//4, unit_id%4].plot(stim_hist_entropy[key][unit_id], label='Entropy of stimulus distribution')\u001b[39;00m\n\u001b[0;32m <a href='vscode-notebook-cell:/c%3A/Users/arash/Documents/Uni/Research%20Project%20%28Topology%29/staticgrating-phasefreq-topology/02_Tuning_Curves_Receptive_Fields.ipynb#ch0000082?line=7'>8</a>\u001b[0m \u001b[39m# ax[unit_id//4, unit_id%4].plot(var_tuning[key][unit_id], label='variance: equivalent to square of euclidean distance from uniform distribution')\u001b[39;00m\n\u001b[0;32m <a href='vscode-notebook-cell:/c%3A/Users/arash/Documents/Uni/Research%20Project%20%28Topology%29/staticgrating-phasefreq-topology/02_Tuning_Curves_Receptive_Fields.ipynb#ch0000082?line=9'>10</a>\u001b[0m ax[i]\u001b[39m.\u001b[39mset_ylabel(\u001b[39m'\u001b[39m\u001b[39munit\u001b[39m\u001b[39m'\u001b[39m)\n",
"\u001b[1;31mNameError\u001b[0m: name 'var_tuning' is not defined"
]
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAABBkAAAEzCAYAAAB0cNsFAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/YYfK9AAAACXBIWXMAAAsTAAALEwEAmpwYAAAU70lEQVR4nO3dX6ik93kf8O9jqUqo6zgl2kDQSpFC5TqLU7B7EC6BxsVukXyhvUgaJDD5g7BIWoVCQkHFxTXKlRuaQkBtslCjJBDLii/CQhQETWQEJnK1xo5iychsFDdaxVQbx9GNsWXRpxdnXM6ud31e7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xwPaRwwCbJ4sBFti3ZOju15M8kOSJJF9M8lh3P1dVD1XV3eseEGDbyWGAzZPFAMtcv2RRdz+e5PGLjn34Mmvfc/VjAbCXHAbYPFkMsL+rvvAjAAAAQKJkAAAAAIYoGQAAAIARSgYAAABghJIBAAAAGKFkAAAAAEYoGQAAAIARSgYAAABghJIBAAAAGKFkAAAAAEYoGQAAAIARSgYAAABghJIBAAAAGKFkAAAAAEYoGQAAAIARSgYAAABghJIBAAAAGKFkAAAAAEYoGQAAAIARSgYAAABghJIBAAAAGKFkAAAAAEYoGQAAAIARSgYAAABghJIBAAAAGKFkAAAAAEYoGQAAAIARSgYAAABghJIBAAAAGKFkAAAAAEYoGQAAAIARSgYAAABghJIBAAAAGKFkAAAAAEYoGQAAAIARSgYAAABghJIBAAAAGKFkAAAAAEYoGQAAAIARSgYAAABghJIBAAAAGKFkAAAAAEYoGQAAAIARSgYAAAB
"text/plain": [
"<Figure size 1296x360 with 3 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"# entropy imshow\n",
"\n",
"%matplotlib inline\n",
"\n",
"fig, ax = plt.subplots(1,3,figsize=(18, 5))\n",
"for i, key in enumerate(key_list):\n",
" ax[i].imshow(zscore(var_tuning[key].reshape(-1)).reshape(num_unit,300)[np.argsort(np.max(var_tuning[key], axis=1))], aspect=7) # ax[unit_id//4, unit_id%4].plot(stim_hist_entropy[key][unit_id], label='Entropy of stimulus distribution')\n",
" # ax[unit_id//4, unit_id%4].plot(var_tuning[key][unit_id], label='variance: equivalent to square of euclidean distance from uniform distribution')\n",
"\n",
" ax[i].set_ylabel('unit')\n",
" ax[i].set_xlabel('$\\\\tau/(ms)$')\n",
" ax[i].set_title(key)\n",
" # ax[].legend(loc=(1.5,1.2))\n",
"\n",
"plt.suptitle('normalized KL div from uniform dist')\n",
"plt.show()\n",
"\n",
"\n"
]
},
{
"cell_type": "code",
"execution_count": 53,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "i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A8MAKeAPMkSb4W+K3PeNx3AAPg/xJs/z7gw0mS/B+SJOnY//9lkiRfZ60u/irw7UmS9G1Mht/0lPP8DQzh8geB767r+lK1u8SQGFmSJL8fuPGMbZfjVxhrkT7mvj4rvg94KUmS/zBJkjxJklGSJJ+0+/4k8B3iBpIkyfuSJPnVb6HuiIiIiIiICItIOERERERERHwFUdf19wO/DxMH4U1MVodvvvagt4bfhZntn2GCS373Mx73LcA3Ao9VporfYN0gfolt4wOMW8J/gYmvAPDbMa4JD4E/B/zZ605i4yD8VYwlwl9Uu/42Jmjjj2PcMpZc40LRgv/OHvdFTEyLf/KsB9pr/MXAr8Jcx08Av9Du/qPAXwP+TpIkM1vvJ9vqiYiIiIiIiLgeSV1/OVacEREREREREREREREREREREVcRLRwiIiIiIiIiIiIiIiIiIiKeOyLhEBERERERERERERERERER8dwRCYeIiIiIiIiIiIiIiIiIiIjnjkg4REREREREREREREREREREPHdEwiEiIiIiIiIiIiIiIiIiIuK5IxIOERERERERERERERERERERzx2RcIiIiIiIiIiIiIiIiIiIiHjuiIRDRERERERERERERERERETEc0ckHCIiIiIiIiIiIiIiIiIiIp47IuEQERERERERERERERERERHx3BEJh4iIiIiIiIiIiIiIiIiIiOeOSDhEREREREREREREREREREQ8d0TCISIiIiIiIiIiIiIiIiIi4rkjEg4RERERERERERERERERERHPHZFwiIiIiIiIiIiIiIiIiIiIeO6IhENERERERERERERERERERMRzRyQcIiIiIiIiIiIiIiIiIiIinjsi4RAREREREREREREREREREfHcEQmHiIiIiIiIiIiIiIiIiIiI545IOERERERERERERERERERERDx3RMIhIiIiIiIiIiIiIiIiIiLiuSMSDhEREREREREREREREREREc8dkXCIiIiIiIiIiIiIiIiIiIh47oiEQ0RERERERERERERERERExHNHJBwiIiIiIiIiIiIiIiIiIiKeOyLhEBERERERERERERERERER8dwRCYeIiIiIiIiIiIiIiIiIiIjnjkg4REREREREREREREREREREPHdEwiEiIiIiIiIiIiIiIiIiIuK5IxIOERERERERERERERERERERzx2RcIiIiIiIiIiIiIiIiIiIiHjuiIRDRERERERERERERERERETEc0ckHCIiIiIiIiIiIiIiIiIiIp47IuEQERERERERERERERERERHx3BEJh4iIiIiIiIiIiIiIiIiIiOeOSDhEREREREREREREREREREQ8d0TCISIiIiIiIiIiIiIiIiIi4rkjEg4RERERERERERERERERERHPHZFwiIiIiIiIiIiIiIiIiIiIeO6IhENERERERERERERERERERMRzRyQcIiIiIiIiIiIiIiIiIiIinjsi4RAREREREREREREREREREfHcEQmHiIiIiIiIiIiIiIiIiIiI545IOERERERERERERERERERERDx3RMIhIiIiIiIiIiIiIiIiIiLiuSMSDhEREREREREREREREREREc8dkXCIiIiIiIiIiIiIiIiIiIh47oiEQ0RERERERERERERERERExHNHJBwiIiIiIiIiIiIiIiIiIiKeOyLhEPGeRpIkfzNJkt/0TrcjIiIi4qsZSZL8ySRJft873Q6AJEl+fpIkn3un2xERERHx1YgkSX5BkiRvvNPtiIgQJHVdv9NtiIiIiIiIiHgPIEmSXwB8Z13Xr7yFY2rgQ3Vdv/6ValdERETEuwVvR85GRHwlES0cIiK2IEmS7J1uQ0RERMQ
"text/plain": [
"<Figure size 1296x360 with 3 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"# entropy imshow\n",
"\n",
"%matplotlib inline\n",
"\n",
"fig, ax = plt.subplots(1,3,figsize=(18, 5))\n",
"for i, key in enumerate(key_list):\n",
" ax[i].imshow(zscore(var_tuning[key], axis=1), aspect=7)\n",
" # ax[unit_id//4, unit_id%4].plot(stim_hist_entropy[key][unit_id], label='Entropy of stimulus distribution')\n",
" # ax[unit_id//4, unit_id%4].plot(var_tuning[key][unit_id], label='variance: equivalent to square of euclidean distance from uniform distribution')\n",
"\n",
" ax[i].set_ylabel('unit')\n",
" ax[i].set_xlabel('$\\\\tau/(ms)$')\n",
" ax[i].set_title(key)\n",
" # ax[].legend(loc=(1.5,1.2))\n",
"\n",
"plt.suptitle('normalized variance')\n",
"plt.show()\n",
"\n",
"\n",
"\n"
]
},
{
"cell_type": "code",
"execution_count": 117,
"metadata": {},
"outputs": [
{
"ename": "NameError",
"evalue": "name 'stim_hist_KL_div_norm' is not defined",
"output_type": "error",
"traceback": [
"\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[1;31mNameError\u001b[0m Traceback (most recent call last)",
"\u001b[1;32mc:\\Users\\arash\\Documents\\Uni\\Research Project (Topology)\\staticgrating-phasefreq-topology\\02_Tuning_Curves_Receptive_Fields.ipynb Cell 68'\u001b[0m in \u001b[0;36m<cell line: 7>\u001b[1;34m()\u001b[0m\n\u001b[0;32m <a href='vscode-notebook-cell:/c%3A/Users/arash/Documents/Uni/Research%20Project%20%28Topology%29/staticgrating-phasefreq-topology/02_Tuning_Curves_Receptive_Fields.ipynb#ch0000084?line=4'>5</a>\u001b[0m optimal_time \u001b[39m=\u001b[39m {}\n\u001b[0;32m <a href='vscode-notebook-cell:/c%3A/Users/arash/Documents/Uni/Research%20Project%20%28Topology%29/staticgrating-phasefreq-topology/02_Tuning_Curves_Receptive_Fields.ipynb#ch0000084?line=6'>7</a>\u001b[0m \u001b[39mfor\u001b[39;00m i, key \u001b[39min\u001b[39;00m \u001b[39menumerate\u001b[39m(key_list): \n\u001b[1;32m----> <a href='vscode-notebook-cell:/c%3A/Users/arash/Documents/Uni/Research%20Project%20%28Topology%29/staticgrating-phasefreq-topology/02_Tuning_Curves_Receptive_Fields.ipynb#ch0000084?line=7'>8</a>\u001b[0m optimal_time[key] \u001b[39m=\u001b[39m {\u001b[39m'\u001b[39m\u001b[39mkl\u001b[39m\u001b[39m'\u001b[39m:np\u001b[39m.\u001b[39margmax(stim_hist_KL_div_norm[key], axis\u001b[39m=\u001b[39m\u001b[39m1\u001b[39m), \u001b[39m'\u001b[39m\u001b[39mvar\u001b[39m\u001b[39m'\u001b[39m:np\u001b[39m.\u001b[39margmax(var_tuning[key], axis\u001b[39m=\u001b[39m\u001b[39m1\u001b[39m)}\n\u001b[0;32m <a href='vscode-notebook-cell:/c%3A/Users/arash/Documents/Uni/Research%20Project%20%28Topology%29/staticgrating-phasefreq-topology/02_Tuning_Curves_Receptive_Fields.ipynb#ch0000084?line=8'>9</a>\u001b[0m optimal_time_order[key] \u001b[39m=\u001b[39m {\u001b[39m'\u001b[39m\u001b[39mkl\u001b[39m\u001b[39m'\u001b[39m:np\u001b[39m.\u001b[39margsort(np\u001b[39m.\u001b[39margmax(stim_hist_KL_div_norm[key], axis\u001b[39m=\u001b[39m\u001b[39m1\u001b[39m)), \u001b[39m'\u001b[39m\u001b[39mvar\u001b[39m\u001b[39m'\u001b[39m:np\u001b[39m.\u001b[39margsort(np\u001b[39m.\u001b[39margmax(var_tuning[key], axis\u001b[39m=\u001b[39m\u001b[39m1\u001b[39m))}\n\u001b[0;32m <a href='vscode-notebook-cell:/c%3A/Users/arash/Documents/Uni/Research%20Project%20%28Topology%29/staticgrating-phasefreq-topology/02_Tuning_Curves_Receptive_Fields.ipynb#ch0000084?line=10'>11</a>\u001b[0m fig, ax \u001b[39m=\u001b[39m plt\u001b[39m.\u001b[39msubplots(\u001b[39m3\u001b[39m,\u001b[39m3\u001b[39m,figsize\u001b[39m=\u001b[39m(\u001b[39m18\u001b[39m, \u001b[39m13\u001b[39m))\n",
"\u001b[1;31mNameError\u001b[0m: name 'stim_hist_KL_div_norm' is not defined"
]
}
],
"source": [
"# entropy imshow\n",
"\n",
"%matplotlib inline\n",
"optimal_time_order = {}\n",
"optimal_time = {}\n",
"\n",
"for i, key in enumerate(key_list): \n",
" optimal_time[key] = {'kl':np.argmax(stim_hist_KL_div_norm[key], axis=1), 'var':np.argmax(var_tuning[key], axis=1)}\n",
" optimal_time_order[key] = {'kl':np.argsort(np.argmax(stim_hist_KL_div_norm[key], axis=1)), 'var':np.argsort(np.argmax(var_tuning[key], axis=1))}\n",
"\n",
"fig, ax = plt.subplots(3,3,figsize=(18, 13))\n",
"\n",
"tuning = 'var'\n",
"for i, order_key in enumerate(key_list):\n",
" for j, key in enumerate(key_list):\n",
" # order_key = 'orientation' # key\n",
" ax[i, j].imshow(stim_hist_KL_div_norm[key][optimal_time_order[order_key][tuning]], aspect=7)\n",
" # ax[unit_id//4, unit_id%4].plot(stim_hist_entropy[key][unit_id], label='Entropy of stimulus distribution')\n",
" # ax[unit_id//4, unit_id%4].plot(var_tuning[key][unit_id], label='variance: equivalent to square of euclidean distance from uniform distribution')\n",
"\n",
" ax[i, j].set_ylabel('unit')\n",
" ax[i, j].set_xlabel('$\\\\tau/(ms)$')\n",
" ax[i, j].set_title(key + ': sorted by '+order_key)\n",
" # ax[].legend(loc=(1.5,1.2))\n",
"\n",
" \n",
"plt.suptitle('normalized KL div from uniform dist')\n",
"plt.show()"
]
},
{
"cell_type": "code",
"execution_count": 261,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAABIQAAALiCAYAAACorw1LAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/YYfK9AAAACXBIWXMAAAsTAAALEwEAmpwYAAA3J0lEQVR4nO3de7BlZX0n/O8v3Win0BiUDvIC7en4Ei6hI2BzcdDMyVgaIlZQxiiSaJOYtKNSMVWpmXScmthFsNLvxJiUKTWBAsGIUYKCTKAmUWKXmhhjNyF2Q4eIzCE21dwJwRii4PP+0buZDvblXPY++5zzfD5Vp/baz1prr985LJfnfPu5VGstAAAAAPTj+8ZdAAAAAADzSyAEAAAA0BmBEAAAAEBnBEIAAAAAnREIAQAAAHRGIAQAAADQmeXjLiBJDj/88DYxMTHuMgAAAACWjK1btz7YWlu5r30LIhCamJjIli1bxl0GAAAAwJJRVXfvb58hYwAAAACdEQgBAAAAdEYgBAAAANCZBTGHEAAAALA0fec738nOnTvz+OOPj7uUJWvFihU5+uijc8ghh0z7HIEQAAAAMDI7d+7Ms5/97ExMTKSqxl3OktNay0MPPZSdO3dm9erV0z7PkDEAAABgZB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9tTU1IgrG5+DBkKtta8mOWUf7XclOX0f7Y8n+ZmhVLfUbHzONI55dPR1AAAAAF2b1ipjAAAAAIvRxMREtm/fPu4yFhyBEAAAAEBnBEIAAAAAnREIAQAAAHRGIAQAAADQGYEQAAAA0L1XvepV+ad/+qdZnXv99dfn9ttvn/Fxv/Ebv5HPfvazs7rmXB102XkAAACAodn4nCF/3qNzOr21ltZabrrppll/xvXXX59Xv/rVOfHEE2d03MUXXzzra86VHkIAAADAkva+970vJ510Uk466aT83u/9XqampnLcccflzW9+c0466aR84xvfyMTERB588MEkyUc/+tGcfvrpOfnkk/PWt741Tz75ZJLkWc96Vv77f//vedGLXpQzzzwz9913X/7qr/4qN9xwQ/7rf/2vOfnkk/P1r389l112WU477bS86EUvyn/+z/853/rWt/Z53IUXXphrr702SXLzzTfnlFNOyZo1a/ILv/AL+bd/+7ckycTERN797nfn1FNPzZo1a/L3f//3Q/mZCIQAAACAJWvr1q358Ic/nC9/+cv567/+61x22WV55JFH8rWvfS1vf/vbc9ttt+UFL3jBU8fv2LEjn/jEJ/KXf/mXufXWW7Ns2bJcffXVSZJ/+Zd/yZlnnpm/+7u/y4//+I/nsssuy3/4D/8hP/3TP53f/u3fzq233poXvvCFOe+88/KVr3wlf/d3f5cTTjghl19++T6P2+Pxxx/PhRdemE984hPZtm1bnnjiiXzoQx96av/hhx+eW265JW9729vy3ve+dyg/F4EQAAAAsGR98YtfzGtf+9oceuihedaznpXzzjsvX/jCF/KCF7wgZ5555vccf/PNN2fr1q057bTTcvLJJ+fmm2/OXXfdlSR5xjOekVe/+tVJkhe/+MWZmpra5zW3b9+el73sZVmzZk2uvvrq3HbbbQes8Y477sjq1avzIz/yI0mSdevW5fOf//xT+88777yDXnOmzCEEAAAAdOfQQw/dZ3trLevWrctv/dZvfc++Qw45JFWVJFm2bFmeeOKJfX7GhRdemOuvvz4vetGLcuWVV2bz5s1zqvWZz3zmQa85U3oIAQAAAEvWy172slx//fX51re+lX/5l3/Jddddl5e97GX7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t37rt+bvmxkSQ8YAAACAJe0f//Ef86UvfSlJ8rGPfSwvfelL93vso48+mqOOOip
"text/plain": [
"<Figure size 1440x936 with 2 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"fig, ax = plt.subplots(2,1, figsize=(20,13))\n",
"opt_time_arr = np.array([optimal_time_order[key] for key in key_list])\n",
"\n",
"for i, key in enumerate(key_list):\n",
" ax[0].bar(np.arange(num_unit)+i/5, optimal_time[key], width=1/4, label=key)\n",
" # ax[0].scatter(np.arange(num_unit), optimal_time_order[key], label=key)\n",
"\n",
"ax[1].bar(range(num_unit), np.mean(opt_time_arr, axis=0), yerr = np.std(opt_time_arr, axis=0), label=key)\n",
"\n",
"ax[0].legend()\n",
"plt.show()"
]
},
{
"cell_type": "code",
"execution_count": 176,
"metadata": {},
"outputs": [],
"source": [
"import scipy.signal as signal\n",
"\n",
"def local_max(y):\n",
" # returns local maxima \n",
" arg_locmax = np.where((y[1:-1] >= y[:-2]) & (y[1:-1] >= y[2:]))\n",
" sort_argmax = arg_locmax[0][np.argsort(y[arg_locmax])[::-1]]\n",
" return y[sort_argmax], sort_argmax"
]
},
{
"cell_type": "code",
"execution_count": 184,
"metadata": {},
"outputs": [],
"source": [
"tuning_max = {}\n",
"for key in key_list:\n",
" time_diff = np.zeros(num_unit)\n",
" tuning_max[key] = np.ndarray(num_unit, dtype=object)\n",
"\n",
" for unit_id in range(num_unit):\n",
" y = var_tuning_norm[key][unit_id]\n",
" y_filtered = signal.convolve(y, np.ones(50)/50, mode='same')\n",
" tuning_max[key][unit_id] = local_max(y_filtered)\n",
" if not len(tuning_max[key][unit_id][1]):\n",
" print('no local maxima for the variance of stimulus distribution for unit:')\n",
" print(unit_id)\n",
"\n",
" \n",
" # time_diff[unit_id] = np.diff(tuning_max[key][unit_id][1][:2])[0]"
]
},
{
"cell_type": "code",
"execution_count": 202,
"metadata": {},
"outputs": [],
"source": [
"t_peak = np.zeros(num_unit)\n",
"t_peak = np.array([tuning_max['pair'][unit_id][1][0] for unit_id in range(num_unit)])"
]
},
{
"cell_type": "code",
"execution_count": 205,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"[<matplotlib.lines.Line2D at 0x22382828d30>]"
]
},
"execution_count": 205,
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAXcAAAD4CAYAAAAXUaZHAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/YYfK9AAAACXBIWXMAAAsTAAALEwEAmpwYAAA6Z0lEQVR4nO3deXicV3U/8O+ZXdLMaCSN1pFseZEsy7txVmxDNiCB1kmgaSgPJNA2lF9oWfq0LC1NaEnhaVkKLU0hJJCWAqGNQ0xIIRBCEiexE++7ZEeLtY6k0TKjGc1+f3/MvNJI1mi2d7Z3zud5/Fh+NcudTHR059xzzyUhBBhjjCmLKt8DYIwxJj8O7owxpkAc3BljTIE4uDPGmAJxcGeMMQXS5HsAAGC1WkVra2u+h8EYY0Xl6NGjE0KI2uW+VxDBvbW1FUeOHMn3MBhjrKgQUX+873FahjHGFIiDO2OMKRAHd8YYUyAO7owxpkAc3BljTIE4uDPGmAJxcGeMMQXi4F6ipj1+HDg5nO9hMMayhIN7ifrfo4P4ix8fx5jTm++hMMaygIN7iRqZiQT1MZcvzyNhjGUDB/cSZY/O2CdmObgzpkQc3EvUmDMS1Cdm/XkeCWMsGzi4lyi7i2fujCkZB/cSJIRYSMtwzp0xReLgXoJcviC8gTAAnrkzplQc3EtQbPmjw805d8aUiIN7CbJHF1PNBg3GOS3DmCJxcC9BUr69s8nM1TKMKRQH9xIkzdw3NVVi0u1DKCzyPCLGmNw4uJcgu9MLk16DVdXlCAtgysOzd8aUhoN7CRpzeVFn1qPGqAPAFTOMKREH9xJkd/pQbzbAatQDACZcPHNnTGk4uJegMZd3cXDnmTtjisPBvcREdqf6UGfSo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axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"plt.plot(t_peak[unit_tuning_order])"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Time diff"
]
},
{
"cell_type": "code",
"execution_count": 153,
"metadata": {},
"outputs": [],
"source": [
"t_peak = np.zeros((2, num_unit))\n",
"for i in range(2):\n",
" t_peak[i] = [var_max['pair'][unit_id][1][i] for unit_id in range(num_unit)]"
]
},
{
"cell_type": "code",
"execution_count": 154,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAArkAAAEvCAYAAABBidl3AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/YYfK9AAAACXBIWXMAAAsTAAALEwEAmpwYAAARm0lEQVR4nO3db4hl93kf8O8TSflTW9RNNTHC8nbdJASMIZYYRMDGNCpxbSnELfSFA0nTNrBvmiBDSpAJheSdUqhJCqawtd24jRMTaosGK3atNjLGEMvdlWVFf+zGdbfEQsmuCamlN3YlP30xV3Sj7mrvzN57z86znw9c9s6ds3O/D2fmx5czZ86p7g4AAEzyXUsHAACATVNyAQAYR8kFAGAcJRcAgHGUXAAAxlFyAQAY58ZtfNFbbrmlT548uY0vDbBVZ8+e/UZ37y2dY5es2cBx9Upr9lZK7smTJ3PmzJltfGmAraqq/7V0hl2zZgPH1Sut2U5XAABgHCUXAIBxlFwAAMZRcgEAGEfJBQBgHCUXAIBxlFwAAMZZ6zq5VfWaJB9I8qYkneSfdvcfbTEXAEdUVeeSPJfkxSQvdPf+sokAdm/dm0H8ZpJPdfc/rKrvTvLXtpgJgKv34939jaVDACzliiW3qv56krcl+cdJ0t3fTvLt7cYCAICjW+ec3DckuZDk31XVF6vqA1X1qi3nAuDoOsmnq+psVZ1aOgzAEtY5XeHGJHck+cXufqSqfjPJfUn+xcUbrRbSU0ly4sSJTefcuJP3PbjT9zt3/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BHueAYAwDhKLgAA4yi5AACMo+QCADCOkgsAwDhKLgAA4yi5AACMo+QCADCOkgsAwDhKLgAA4yi5AACMo+QCADCOkgsAwDhKLgAA4yi5AACMo+QCADCOkgswSFW9vqoerqqnqurJqrp36UwAS7hx6QAAbNQLSX6pux+tqpuTnK2qh7r7qaWDAeySI7kAg3T3s9396Or5c0meTvK6ZVMB7J6SCzBUVZ1McnuSRxaOArBzTlcAGKiqXp3kY0ne093fvMTnTyU5lSQnTpzYcbpr38n7Htzp+527/56dvh/H066/L487R3IBhqmqm3JQcD/S3R+/1Dbdfbq797t7f29vb7cBAXZAyQUYpKoqyQeTPN3d71s6D8BSlFyAWd6S5GeT3FVVj60edy8dCmDXnJMLMEh3fy5JLZ0DYGmO5AIAMI6SCwDAOEouAADjKLkAAIyj5AIAMI6SCwDAOEouAADjKLkAAIyj5AIAMM4VS25Vvb6qHq6qp6rqyaq6dxfBAADgqNa5re8LSX6pux+tqpuTnK2qh7r7qS1nAwCAI7nikdzufra7H109fy7J00let+1gAABwVIc6J7eqTia5PckjW0kDAAAbsHbJrapXJ/lYkvd09zcv8flTVXWmqs5cuHBhkxkBAOBQ1iq5VXVTDgruR7r745faprtPd/d+d+/v7e1tMiMAABzKOldXqCQfTPJ0d79v+5EAAODqrHMk9y1JfjbJXVX12Opx95ZzAQDAkV3xEmLd/bkktYMsAACwEe54BgDAOEouAADjKLkAAIyj5AIAMI6SCwDAOEouAADjKLkAAIyj5AIAMI6SCwDAOEouAADjKLkAAIyj5AIAMI6SCwDAOEouAADjKLkAAIyj5AIAMI6SCwDAOEouAADjKLkAAIyj5AIAMI6SCwDAOEouAADjKLkAAIyj5AIAMI6SCwDAOEouwDBV9aGqOl9VTyydBWApSi7APL+V5B1LhwBYkpILMEx3fzbJXyydA2BJSi4AAOMouQDXoao6VVVnqurMhQsXlo4DsHFKLsB1qLtPd/d+d+/v7e0tHQdg45RcAADGUXIBhqmq303yR0l+pKq+XlU/v3Q
"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",
"for i in range(2):\n",
" ax[i].hist(t_peak[i])"
]
},
{
"cell_type": "code",
"execution_count": 155,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAXAAAAD4CAYAAAD1jb0+AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/YYfK9AAAACXBIWXMAAAsTAAALEwEAmpwYAAAL90lEQVR4nO3dUYiddXrH8e+vxt2LVag2QwhWGlekkJtGGaywIlu23Wp6Eb0p68U2F0L2QkFhe5HdvVgv3VJdKCxCxLBpsS4FFYVu27UiyEJrO5GsRoPV3WapISYjQrU3bdWnF/OmOwxzMpM558zJM/P9wHDOec975jx/3+TLmXfOiakqJEn9/NqsB5AkbYwBl6SmDLgkNWXAJakpAy5JTe3YzCfbuXNn7dmzZzOfUpLaO378+AdVNbdy+6YGfM+ePSwsLGzmU0pSe0l+udp2T6FIUlMGXJKaMuCS1JQBl6SmDLgkNWXAJakpAy5JTRlwSWrKgEtSU5v6Scxx7Dn8t+ve9/QjfzTFSSTp8uArcElqyoBLUlMGXJKaMuCS1JQBl6SmDLgkNWXAJakpAy5JTRlwSWrKgEtSUwZckpoy4JLUlAGXpKYMuCQ1ZcAlqSkDLklNGXBJasqAS1JTawY8yfVJXk7yVpI3kzw4bH84yZkkJ4av/dMfV5J0wXr+n5ifAN+sqteSXA0cT/LicN/3q+rPpzeeJGmUNQNeVWeBs8P1j5OcAq6b9mCSpIu7pHPgSfYANwOvDpseSPJ6kqNJrhnxmENJFpIsLC4ujjetJOn/rTvgSa4CngEeqqqPgMeBG4F9LL1Cf3S1x1XVkaqar6r5ubm58SeWJAHrDHiSK1mK91NV9SxAVZ2rqk+r6jPgCeDW6Y0pSVppPe9CCfA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1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"bin_size = 10\n",
"t_bins = np.arange(0, 250+bin_size, bin_size)\n",
"time_diff_hist, edges = np.histogram(np.abs(time_diff), t_bins)\n",
"bins = edges[:-1] + np.diff(edges[:2])\n",
"plt.bar(bins, time_diff_hist, width=0.9*bin_size)\n",
"plt.show()"
]
},
{
"cell_type": "code",
"execution_count": 156,
"metadata": {},
"outputs": [
{
"ename": "NameError",
"evalue": "name 'argmax' is not defined",
"output_type": "error",
"traceback": [
"\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[1;31mNameError\u001b[0m Traceback (most recent call last)",
"\u001b[1;32mc:\\Users\\arash\\Documents\\Uni\\Research Project (Topology)\\staticgrating-phasefreq-topology\\02_Tuning_Curves_Receptive_Fields.ipynb Cell 89'\u001b[0m in \u001b[0;36m<cell line: 3>\u001b[1;34m()\u001b[0m\n\u001b[0;32m <a href='vscode-notebook-cell:/c%3A/Users/arash/Documents/Uni/Research%20Project%20%28Topology%29/staticgrating-phasefreq-topology/02_Tuning_Curves_Receptive_Fields.ipynb#ch0000090?line=0'>1</a>\u001b[0m plt\u001b[39m.\u001b[39mplot(y)\n\u001b[0;32m <a href='vscode-notebook-cell:/c%3A/Users/arash/Documents/Uni/Research%20Project%20%28Topology%29/staticgrating-phasefreq-topology/02_Tuning_Curves_Receptive_Fields.ipynb#ch0000090?line=1'>2</a>\u001b[0m plt\u001b[39m.\u001b[39mplot(y_filtered)\n\u001b[1;32m----> <a href='vscode-notebook-cell:/c%3A/Users/arash/Documents/Uni/Research%20Project%20%28Topology%29/staticgrating-phasefreq-topology/02_Tuning_Curves_Receptive_Fields.ipynb#ch0000090?line=2'>3</a>\u001b[0m plt\u001b[39m.\u001b[39mscatter(argmax[:\u001b[39m2\u001b[39m], y_max)\n",
"\u001b[1;31mNameError\u001b[0m: name 'argmax' is not defined"
]
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEU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qGhoc931hRBeQRJ6D17ZkU9tczt3XdSl7/mx96AyBy7+xuB7tvRk9peg/CgU7uz1MKUUUcF+0kIXQlxAEno36lva+cumEyweH33ugsxb/gDhKTBppesvOvVm8As2Wul9iA62SUIfRo+tP8YXntlOYVUTDa0dZocjRL9JQu/Gnz/OpbKxje8uzzi7sXAnFG6HhV8D6zBMI28Lhmmr4NBb0NL7qkRRwX5USsllWBRVN/Gnj3LYmlvJkt98xNWPf4pDFhQRHkIS+nma2+y8uDWPlTMTmJ4UfnbH1j+Cf7gxU+JwmfVF4+Hoobd7PUxa6MPniY05KBRP3zWHm2cnUVDVxJ7CarPDEqJfJKGfZ+PRMpra7Nw6L/nsxtoiOPouzLm77+lxhyJxNkRN6LO3S3SwjcqGNrx0HW7T5Fc28s9dRXxhQQpXTYnjJ9dPxteqeO9AqdmhCdEvktDP8+7+U0QH21iQ1mUx587eJ3PvHd6LKwUzboX8LVCd3+Nh0cF+tNkd1LVIfdeV/m/dMXwsiq8uTQcg1N+XxeOjeXd/CS3tMtWCcH+S0Lto63DwcXY5y6eOwWpx9mLpaINdL8LEZRCR2vsJXGHaLcafB17v8ZDOvuiVUnZxmY+yy3hn3ykeujT9nCUGv7xkHKV1Lfxl0wkToxOifyShd7GvqIbmdjuLx8ec3Xj0HWgsg3n3j0wQEamQutgYwNRDSSUq2JgoTPqiu4bWml+tPUJ6TBBfvSz9nH0Xj49mxdQ4nv4kl7YOh0kRCtE/ktC72JpTiVKwcFyXybh2PgsRYyH98pELZMatRn/3U7u73S2jRV1
"text/plain": [
"<Figure size 432x288 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"plt.plot(y)\n",
"plt.plot(y_filtered)\n",
"plt.scatter(argmax[:2], y_max)"
]
},
{
"cell_type": "code",
"execution_count": 157,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"c:\\Users\\arash\\AppData\\Local\\Programs\\Python\\Python38\\lib\\site-packages\\matplotlib\\cbook\\__init__.py:1298: ComplexWarning: Casting complex values to real discards the imaginary part\n",
" return np.asarray(x, float)\n"
]
},
{
"data": {
"text/plain": [
"[<matplotlib.lines.Line2D at 0x223fd80cf40>]"
]
},
"execution_count": 157,
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAXcAAAD4CAYAAAAXUaZHAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/YYfK9AAAACXBIWXMAAAsTAAALEwEAmpwYAAAhP0lEQVR4nO3deXRcZ53m8e/vVpVK+y7LtizZju3EcZzEzjghG3QWAkmYaSd9mHRghoSe9DEzJDRM02dOaKA7fXqY6Z4ZoA/LQIeTDCZDkxgIxM1JM4QkhzWbnDiL7ZjIsY1ly9Zm7SotVe/8UVdybbI2F9IVz+ccnbr13ltVv6srPbp6671vmXMOERFZWryFLkBERM49hbuIyBKkcBcRWYIU7iIiS5DCXURkCQovdAEAtbW1bs2aNQtdhohIoOzZs6fTOVeXa92iCPc1a9bQ3Ny80GWIiASKmR2dap26ZUREliCFu4jIEqRwFxFZghTuIiJLkMJdRGQJmjbczazQzF40s1fNbJ+Z/Y3fvtbMXjCzFjN7zMwK/Paof7/FX78mz/sgIiIZZnLmPgLc4Jy7FNgC3GxmVwJ/D3zRObceOA3c429/D3Dab/+iv52IiPwOTRvuLmnAvxvxvxxwA/A9v30ncJu/vN2/j7/+RjOzc1VwqoMn+/n8Tw7SOTCSj6cXEQmsGfW5m1nIzPYC7cBTwCGgxzk37m/SCjT4yw3AMQB/fS9Qk+M5d5hZs5k1d3R0zKn4t9r7+fIzLXQPjs7p8SIiS9WMwt05F3fObQFWAVcAG+f7ws65B51z25xz2+rqcl49Oy3P/4dAnzciIpJuVqNlnHM9wLPAVUClmU1MX7AKOO4vHwcaAfz1FUDXuSg200RfT0LpLiKSZiajZerMrNJfLgJuA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lqAK+ZR37Q0cZiISLb59LnfZ2av+d02VX5bA3AsZZtWvy2v1C0jIpJuruH+NWAdsAVoAz4/2ycwsx1m1mxmzR0dHXMswx8to2wXEUkzp3B3zp1yzsWdcwngG5zpejkONKZsuspvy/UcDzrntjnnttXV1c2lDEDdMiIiucwp3M1sRcrd24GJkTS7gTvNLGpma4ENwIvzK3G6WtQtIyKSKTzdBmb2HeA6oNbMWoG/Bq4zsy0kO0SOAB8BcM7tM7NdwH5gHLjXORfPS+UT9aHRMiIimaYNd+fcB3I0P3SW7T8HfG4+Rc2GumVERLIF/gpV1C0jIpIl8OGuqWVERLIFPtw9zecuIpIl8OFuBonEQlchIrK4BD/c0Zm7iEim4Ie7Jg4TEcmyBMJdn8QkIpIp+OEOaLiMiEi64Ie7umVERLIEPtx1haqISLbAh7smDhMRyRb8cEfdMiIimYIf7uqWERHJsgTCHZxO3UVE0gQ/3FG3jIhIpsCHuyYOExHJFvhw18RhIiLZgh/umjhMRCRL8MNdV6iKiGRRuIuILEHBD3d1y4iIZJk23M3sYTNrN7M3UtqqzewpM3vLv63y283MvmRmLWb2mpldls/iATxPZ+4iIplmcub+TeDmjLb7gaedcxuAp/37ALcAG/yvHcDXzk2ZUzNMc8uIiGSYNtydcz8HujOatwM7/eWdwG0p7d9ySc8DlWa24hzVmpOZZnMXEck01z73eudcm798Eqj3lxuAYynbtfptWcxsh5k1m1lzR0fHHMvw55ZRuouIpJn3G6ouObHLrOPVOfegc26bc25bXV3dnF8/Of2A0l1EJNVcw/3URHeLf9vutx8HGlO2W+W35Y26ZUREss013HcDd/vLdwNPpLTf5Y+auRLoTem+yQtP3TIiIlnC021gZt8BrgNqzawV+Gvg74BdZnYPcBS4w9/8SeBWoAUYAv4kDzWn14c+iUlEJNO04e6c+8A
"text/plain": [
"<Figure size 432x288 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"y = var_tuning['phase'][0]/np.mean(var_tuning['phase'][0])\n",
"plt.plot(np.fft.fft(y))\n"
]
},
{
"cell_type": "code",
"execution_count": 158,
"metadata": {},
"outputs": [],
"source": [
"y_filtered = signal.convolve(y, np.ones(50)/50, mode='same')"
]
},
{
"cell_type": "code",
"execution_count": 159,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"<matplotlib.legend.Legend at 0x223fdc008e0>"
]
},
"execution_count": 159,
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAXQAAAD4CAYAAAD8Zh1EAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/YYfK9AAAACXBIWXMAAAsTAAALEwEAmpwYAABP+UlEQVR4nO29d3wc1dX//7676r1LtiRbbnLFDeEKLrjQAiRA6J1QQkkgCQ+QPE8gJN9fSOAJhADhoQUIvePQbbAxbrjgXmTLtmTLsnrvZe/vjzujXUm7al5pi+/79dJrZmdmd85odz975txzzxFSSjQajUbj+1g8bYBGo9Fo3IMWdI1Go/ETtKBrNBqNn6AFXaPRaPwELegajUbjJwR46sQJCQkyIyPDU6fXaDQan2TLli2lUspEZ/s8JugZGRls3rzZU6fXaDQan0QIkedqnw65aDQajZ+gBV2j0Wj8BC3oGo1G4yd4LIau0Wg0LS0t5Ofn09jY6GlTvI6QkBDS0tIIDAzs9XO0oGs0Go+Rn59PZGQkGRkZCCE8bY7XIKWkrKyM/Px8RowY0evn6ZCLRqPxGI2NjcTHx2sx74QQgvj4+D7fuWhB12g0HkWLuXP683/Rgq7RuKJoD+z/0tNWaDS9Rgu6RuOM+nL452x441JPW6IZBJ588knGjx9PbGwsjzzyCAAPPfQQjz32GAAvv/wyBQUFA3Lu3NxcJk2a5JbX0oOiGo0zVj9mX2+ohNAYT1miGQSeeeYZVqxYQVpamtP9L7/8MpMmTWLo0KG9fs3W1lYCAgZXYrWHrvEtWhrgH1lwYAVsewOqB8ZromSvfb3yyMC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1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"plt.plot(y_filtered, label='filtered')\n",
"plt.plot(y)\n",
"plt.legend()"
]
},
{
"cell_type": "code",
"execution_count": 160,
"metadata": {},
"outputs": [],
"source": [
"def local_max(y):\n",
" arg_locmax = np.where((y[1:-1] > y[:-2]) & (y[1:-1] > y[2:]))\n",
" return y[arg_locmax], arg_locmax"
]
},
{
"cell_type": "code",
"execution_count": 161,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"(array([0.97644136, 1.34344875, 1.35522203, 0.98133749, 0.98127211]),\n",
" (array([ 47, 130, 140, 249, 251], dtype=int64),))"
]
},
"execution_count": 161,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"local_max(y_filtered)"
]
},
{
"cell_type": "code",
"execution_count": 162,
"metadata": {},
"outputs": [],
"source": [
"data = y"
]
},
{
"cell_type": "code",
"execution_count": 49,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAX0AAAEWCAYAAACKSkfIAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/YYfK9AAAACXBIWXMAAAsTAAALEwEAmpwYAABFtklEQVR4nO3dd3wU1RbA8d9Jr/QiHaQpNUq1UC0ISlFRQIoggqhYnygK8ngqihVRUEFBQFFUlCIiiJpIU5rSe1Mp0kKABNLv+2MmsMQAKZvMbvZ8P5/9ZHbKnXPvbs7O3pm9I8YYlFJK+QY/pwNQSilVcDTpK6WUD9Gkr5RSPkSTvlJK+RBN+kop5UM06SullA/RpK/ynYh8LyL32tN9RWSp0zEp5as06RcwEdkrIjc6HUd+EJEpIpIsIvEuj27GmPbGmKkX2MaISA03x2FEJMElhjh3lu8NRKS1iKTb9T8lIttEpJ/TcSnnadJX7vaaMSbC5fFFfu1IRAIusrihSwzFcrhtYXHAGBMBFAGeAD4Ukdo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C0KHz++aXXVUopdWnZuWTzc6y78JQSkX1Yt+ALBDDGfIA1YmQHrNEQT2Pdhs8tgoKgfXtYsABq1XJXqUop5buyc/VOj0ssN8DDbosok2uugRkzoEoVCA6+9PpKKaUuzOOHYWja1Pp76pSzcSilVGHg8Um/Th3r7+nTF19PKaXUpXl80i9SBMqWhTNnnI5EKaW8n8cnfYCaNTXpK6WUO3hF0q9RQ5O+Ukq5g1ck/YoVITkZ9H4vSimVN16R9MuXt/6mpDgbh1JKeTuvSPoVKlh/k5KcjUMppbydVyT9jCN
"text/plain": [
"<Figure size 432x288 with 2 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"import numpy as np\n",
"from scipy.signal import butter, lfilter, freqz, filtfilt\n",
"import matplotlib.pyplot as plt\n",
"\n",
"\n",
"def butter_lowpass(cutoff, fs, order=5):\n",
" nyq = 0.5 * fs\n",
" normal_cutoff = cutoff / nyq\n",
" b, a = butter(order, normal_cutoff, btype='low', analog=False)\n",
" return b, a\n",
"\n",
"def butter_lowpass_filter(data, cutoff, fs, order=5, no_lag=True):\n",
" b, a = butter_lowpass(cutoff, fs, order=order)\n",
" if no_lag:\n",
" y = filtfilt(b, a, data)\n",
" else:\n",
" y = lfilter(b, a, data)\n",
"\n",
" return y\n",
"\n",
"\n",
"# Setting standard filter requirements.\n",
"order = 6\n",
"fs = 1000 # Hz - 1ms time resolution \n",
"cutoff = 20 # Hz - 50ms ~ trial time\n",
"\n",
"b, a = butter_lowpass(cutoff, fs, order)\n",
"\n",
"# Plotting the frequency response.\n",
"w, h = freqz(b, a, worN=8000)\n",
"plt.subplot(2, 1, 1)\n",
"plt.plot(0.5*fs*w/np.pi, np.abs(h), 'b')\n",
"plt.plot(cutoff, 0.5*np.sqrt(2), 'ko')\n",
"plt.axvline(cutoff, color='k')\n",
"plt.xlim(0, 0.5*fs)\n",
"plt.title(\"Lowpass Filter Frequency Response\")\n",
"plt.xlabel('Frequency [Hz]')\n",
"plt.grid()\n",
"\n",
"\n",
"# Creating the data for filteration\n",
"n = len(tau_id_range)\n",
"dt = 0.001\n",
"T = n*dt # value taken in seconds\n",
"# n = int(T * fs) # indicates total samples\n",
"t = np.linspace(0, T, n, endpoint=False)\n",
"\n",
"# data = np.sin(1.2*2*np.pi*t) + 1.5*np.cos(9*2*np.pi*t) + 0.5*np.sin(50.0*2*np.pi*t)\n",
"data = tuning_score['pair']['var_z'][0]\n",
"\n",
"# Filtering and plotting\n",
"y = butter_lowpass_filter(data, cutoff, fs, order, no_lag=True)\n",
"\n",
"plt.subplot(2, 1, 2)\n",
"plt.plot(t, data, 'b-', label='data')\n",
"plt.plot(t, y, 'g-', linewidth=2, label='filtered data')\n",
"plt.xlabel('Time [sec]')\n",
"plt.grid()\n",
"plt.legend()\n",
"\n",
"plt.subplots_adjust(hspace=0.35)\n",
"plt.show()"
]
},
{
"cell_type": "code",
"execution_count": 50,
"metadata": {},
"outputs": [],
"source": [
"for key in key_list:\n",
" for score_key in score_key_list[2:]:\n",
" tuning_score[key][score_key+'_filt'] = np.ndarray((num_unit, len(tau_id_range)))\n",
" for unit_id in range(num_unit):\n",
" tuning_score[key][score_key+'_filt'][unit_id] = butter_lowpass_filter(tuning_score[key][score_key][unit_id], cutoff, fs, order, no_lag=True)"
]
},
{
"cell_type": "code",
"execution_count": 54,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"dict_keys(['kl', 'var', 'kl_z', 'var_z', 'kl_z_filt', 'var_z_filt'])"
]
},
"execution_count": 54,
"metadata": {},
"output_type": "execute_result"
}
],
"source": []
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [],
"source": [
"from scipy.optimize import curve_fit\n",
"\n",
"def gauss(x,mu,sigma,A):\n",
" return A*np.exp(-(x-mu)**2/2/sigma**2)\n",
"\n",
"def bimodal_gaussian(x, mu1, mu2, A1, A2, sigma1,sigma2, c):\n",
" return c + gauss(x,mu1,sigma1,A1)+gauss(x,mu2,sigma2,A2)\n",
"\n",
"def von_mises(x, mu, A, sigma):\n",
" return A * np.exp(np.cos(x-mu)/sigma**2)"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [
{
"ename": "NameError",
"evalue": "name 'var_tuning' is not defined",
"output_type": "error",
"traceback": [
"\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[1;31mNameError\u001b[0m Traceback (most recent call last)",
"\u001b[1;32mc:\\Users\\arash\\Documents\\Uni\\Research Project (Topology)\\staticgrating-phasefreq-topology\\02_Tuning_Curves_Receptive_Fields.ipynb Cell 31'\u001b[0m in \u001b[0;36m<cell line: 4>\u001b[1;34m()\u001b[0m\n\u001b[0;32m <a href='vscode-notebook-cell:/c%3A/Users/arash/Documents/Uni/Research%20Project%20%28Topology%29/staticgrating-phasefreq-topology/02_Tuning_Curves_Receptive_Fields.ipynb#ch0000030?line=1'>2</a>\u001b[0m expected \u001b[39m=\u001b[39m (\u001b[39m30\u001b[39m,\u001b[39m140\u001b[39m,\u001b[39m1\u001b[39m,\u001b[39m1\u001b[39m,\u001b[39m30\u001b[39m,\u001b[39m30\u001b[39m,\u001b[39m0.2\u001b[39m)\n\u001b[0;32m <a href='vscode-notebook-cell:/c%3A/Users/arash/Documents/Uni/Research%20Project%20%28Topology%29/staticgrating-phasefreq-topology/02_Tuning_Curves_Receptive_Fields.ipynb#ch0000030?line=2'>3</a>\u001b[0m x \u001b[39m=\u001b[39m tau_id_range\n\u001b[1;32m----> <a href='vscode-notebook-cell:/c%3A/Users/arash/Documents/Uni/Research%20Project%20%28Topology%29/staticgrating-phasefreq-topology/02_Tuning_Curves_Receptive_Fields.ipynb#ch0000030?line=3'>4</a>\u001b[0m y \u001b[39m=\u001b[39m var_tuning[\u001b[39m'\u001b[39m\u001b[39mphase\u001b[39m\u001b[39m'\u001b[39m][\u001b[39m0\u001b[39m]\u001b[39m/\u001b[39mnp\u001b[39m.\u001b[39mmean(var_tuning[\u001b[39m'\u001b[39m\u001b[39mphase\u001b[39m\u001b[39m'\u001b[39m][\u001b[39m0\u001b[39m])\n\u001b[0;32m <a href='vscode-notebook-cell:/c%3A/Users/arash/Documents/Uni/Research%20Project%20%28Topology%29/staticgrating-phasefreq-topology/02_Tuning_Curves_Receptive_Fields.ipynb#ch0000030?line=4'>5</a>\u001b[0m params,cov\u001b[39m=\u001b[39mcurve_fit(bimodal_gaussian,x, y, expected)\n\u001b[0;32m <a href='vscode-notebook-cell:/c%3A/Users/arash/Documents/Uni/Research%20Project%20%28Topology%29/staticgrating-phasefreq-topology/02_Tuning_Curves_Receptive_Fields.ipynb#ch0000030?line=5'>6</a>\u001b[0m sigma\u001b[39m=\u001b[39mnp\u001b[39m.\u001b[39msqrt(np\u001b[39m.\u001b[39mdiag(cov))\n",
"\u001b[1;31mNameError\u001b[0m: name 'var_tuning' is not defined"
]
}
],
"source": [
"\n",
"# expected=(0.2, 30,30,1.3,140,30,3) #c, mu1, sigma1, A1, mu2, sigma2, A2\n",
"expected = (30,140,1,1,30,30,0.2)\n",
"x = tau_id_range\n",
"y = var_tuning['phase'][0]/np.mean(var_tuning['phase'][0])\n",
"params,cov=curve_fit(bimodal_gaussian,x, y, expected)\n",
"sigma=np.sqrt(np.diag(cov))\n",
"plt.plot(x, bimodal_gaussian(x,*params), color='red', lw=3, label='fitted model')\n",
"plt.plot(x, bimodal_gaussian(x,*expected), color='g', lw=3, label='initial model')\n",
"\n",
"plt.plot(x, y)\n",
"plt.legend()\n",
"print(params, '\\n', sigma)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"def tuning_index(tuning_curve):\n",
" return np.std(tuning_curve)/np.mean(tuning_curve)\n",
"\n",
"def selectivity_index(tuning_curve):\n",
" pref = np.argmax(tuning_curve)\n",
" return \n",
"\n",
"def unimodal_periodic_fit(tuning_curve):\n",
" \n",
"\n",
" return "
]
}
],
"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
}