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.
1206 lines
342 KiB
1206 lines
342 KiB
2 years ago
|
{
|
||
|
"cells": [
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"# Experiment: Flashed gratings"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"### Initialization"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"#### Imports"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 1,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"%matplotlib inline\n",
|
||
|
"import numpy as np\n",
|
||
|
"import matplotlib.pyplot as plt\n",
|
||
|
"import pandas as pd\n",
|
||
|
"import scipy\n",
|
||
|
"import scipy.stats as sts\n",
|
||
|
"import pickle as pkl\n",
|
||
|
"import ipywidgets as widgets\n",
|
||
|
"from mpl_toolkits import mplot3d\n",
|
||
|
"from mpl_toolkits.mplot3d import Axes3D\n",
|
||
|
"from scipy import sparse\n",
|
||
|
"from matplotlib import cm\n",
|
||
|
"\n",
|
||
|
"# color maps\n",
|
||
|
"cmap_hot = cm.get_cmap('hot')\n",
|
||
|
"cmap_viridis = cm.get_cmap('viridis')\n",
|
||
|
"cmap_jet = cm.get_cmap('jet')"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 2,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"\n",
|
||
|
"data_folder = \"../data/\"\n",
|
||
|
"stim_file = \"Stiminfo_PVCre_2021_0012_s06_e14.csv\"\n",
|
||
|
"spike_times_file = \"Spiketimes_PVCre_2021_0012_s06_e14.npy\"\n",
|
||
|
"\n",
|
||
|
"key_symbol = {'pair':'$(\\\\theta,\\phi)$', 'orientation':'$\\\\theta$', 'phase':'$\\phi$'}"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"#### Load the stimulus data\n",
|
||
|
"**Stimulus data layout:**\n",
|
||
|
"```\n",
|
||
|
"stim_val = {'pair': [(or1, ph1), (or2, ph2), ...], 'orientation': [...], 'phase': [...]}\n",
|
||
|
"stim_id_trial = {'pair': [id1, id2, ...], 'phase': [..], ...} # corresponding trials\n",
|
||
|
"pair_trial_id[orientation_id][phase_id] = [Trial ids]\n",
|
||
|
"```"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 3,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"# Stimulus DataFrame\n",
|
||
|
"stim = pd.read_csv(data_folder + stim_file)\n",
|
||
|
"num_trial = len(stim)\n",
|
||
|
"stim_val = {}\n",
|
||
|
"trial_stim_id = {}\n",
|
||
|
"# 50 trials per orientation-phase pair\n",
|
||
|
"stim_val['pair'], trial_stim_id['pair'] = np.unique(stim[['grat_orientation', 'grat_phase']], return_inverse=True, axis=0) \n",
|
||
|
"# 1000 trials per orientation\n",
|
||
|
"stim_val['orientation'], trial_stim_id['orientation'] = np.unique(stim['grat_orientation'], return_inverse=True) \n",
|
||
|
"# 1000 trials per phase\n",
|
||
|
"stim_val['phase'], trial_stim_id['phase'] = np.unique(stim['grat_phase'], return_inverse=True) \n",
|
||
|
"key_list = ['pair', 'orientation', 'phase']\n",
|
||
|
"stim_id_trial = {}\n",
|
||
|
"num_stim = {}\n",
|
||
|
"for key in key_list:\n",
|
||
|
" stim_id_trial[key] = [np.where(trial_stim_id[key] == i)[0] for i in range(len(stim_val[key]))]\n",
|
||
|
" num_stim[key] = len(stim_val[key])\n",
|
||
|
"\n",
|
||
|
"def pair_id(i):\n",
|
||
|
" return (int(i//num_stim['orientation']), i%num_stim['orientation'])\n",
|
||
|
"\n",
|
||
|
"trial_pair_id = np.array([pair_id(i) for i in trial_stim_id['pair']], dtype=object)\n",
|
||
|
"pair_val = stim_val['pair'].reshape(num_stim['orientation'], num_stim['phase'],2)\n",
|
||
|
"\n",
|
||
|
"# for each (orientation_id = i, phase_id = j) find the trial indices\n",
|
||
|
"pair_trial_id = np.ndarray((num_stim['orientation'], num_stim['phase']), dtype=object)\n",
|
||
|
"for i in range(num_stim['pair']):\n",
|
||
|
" pair_trial_id[pair_id(i)] = stim_id_trial['pair'][i]"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 4,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
|
"text/html": [
|
||
|
"<div>\n",
|
||
|
"<style scoped>\n",
|
||
|
" .dataframe tbody tr th:only-of-type {\n",
|
||
|
" vertical-align: middle;\n",
|
||
|
" }\n",
|
||
|
"\n",
|
||
|
" .dataframe tbody tr th {\n",
|
||
|
" vertical-align: top;\n",
|
||
|
" }\n",
|
||
|
"\n",
|
||
|
" .dataframe thead th {\n",
|
||
|
" text-align: right;\n",
|
||
|
" }\n",
|
||
|
"</style>\n",
|
||
|
"<table border=\"1\" class=\"dataframe\">\n",
|
||
|
" <thead>\n",
|
||
|
" <tr style=\"text-align: right;\">\n",
|
||
|
" <th></th>\n",
|
||
|
" <th>Unnamed: 0</th>\n",
|
||
|
" <th>grat_orientation</th>\n",
|
||
|
" <th>grat_phase</th>\n",
|
||
|
" <th>stimvals</th>\n",
|
||
|
" <th>stim_ontime</th>\n",
|
||
|
" <th>stim_offtime</th>\n",
|
||
|
" </tr>\n",
|
||
|
" </thead>\n",
|
||
|
" <tbody>\n",
|
||
|
" <tr>\n",
|
||
|
" <th>0</th>\n",
|
||
|
" <td>0</td>\n",
|
||
|
" <td>45.0</td>\n",
|
||
|
" <td>36.0</td>\n",
|
||
|
" <td>102</td>\n",
|
||
|
" <td>2.5005</td>\n",
|
||
|
" <td>2.5839</td>\n",
|
||
|
" </tr>\n",
|
||
|
" <tr>\n",
|
||
|
" <th>1</th>\n",
|
||
|
" <td>1</td>\n",
|
||
|
" <td>0.0</td>\n",
|
||
|
" <td>18.0</td>\n",
|
||
|
" <td>1</td>\n",
|
||
|
" <td>2.6195</td>\n",
|
||
|
" <td>2.7028</td>\n",
|
||
|
" </tr>\n",
|
||
|
" <tr>\n",
|
||
|
" <th>2</th>\n",
|
||
|
" <td>2</td>\n",
|
||
|
" <td>162.0</td>\n",
|
||
|
" <td>288.0</td>\n",
|
||
|
" <td>376</td>\n",
|
||
|
" <td>2.7030</td>\n",
|
||
|
" <td>2.7863</td>\n",
|
||
|
" </tr>\n",
|
||
|
" <tr>\n",
|
||
|
" <th>3</th>\n",
|
||
|
" <td>3</td>\n",
|
||
|
" <td>0.0</td>\n",
|
||
|
" <td>54.0</td>\n",
|
||
|
" <td>3</td>\n",
|
||
|
" <td>2.7865</td>\n",
|
||
|
" <td>2.8699</td>\n",
|
||
|
" </tr>\n",
|
||
|
" <tr>\n",
|
||
|
" <th>4</th>\n",
|
||
|
" <td>4</td>\n",
|
||
|
" <td>108.0</td>\n",
|
||
|
" <td>36.0</td>\n",
|
||
|
" <td>242</td>\n",
|
||
|
" <td>2.8700</td>\n",
|
||
|
" <td>2.9534</td>\n",
|
||
|
" </tr>\n",
|
||
|
" </tbody>\n",
|
||
|
"</table>\n",
|
||
|
"</div>"
|
||
|
],
|
||
|
"text/plain": [
|
||
|
" Unnamed: 0 grat_orientation grat_phase stimvals stim_ontime \\\n",
|
||
|
"0 0 45.0 36.0 102 2.5005 \n",
|
||
|
"1 1 0.0 18.0 1 2.6195 \n",
|
||
|
"2 2 162.0 288.0 376 2.7030 \n",
|
||
|
"3 3 0.0 54.0 3 2.7865 \n",
|
||
|
"4 4 108.0 36.0 242 2.8700 \n",
|
||
|
"\n",
|
||
|
" stim_offtime \n",
|
||
|
"0 2.5839 \n",
|
||
|
"1 2.7028 \n",
|
||
|
"2 2.7863 \n",
|
||
|
"3 2.8699 \n",
|
||
|
"4 2.9534 "
|
||
|
]
|
||
|
},
|
||
|
"execution_count": 4,
|
||
|
"metadata": {},
|
||
|
"output_type": "execute_result"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"stim.head()"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 5,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"name": "stdout",
|
||
|
"output_type": "stream",
|
||
|
"text": [
|
||
|
"pair, orientation, phase\n",
|
||
|
"(400, 2)\n",
|
||
|
"(20,) (20,)\n"
|
||
|
]
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"print(', '.join(stim_val.keys()))\n",
|
||
|
"print(stim_val['pair'].shape)\n",
|
||
|
"print(stim_val['orientation'].shape, stim_val['phase'].shape)"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 6,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"name": "stdout",
|
||
|
"output_type": "stream",
|
||
|
"text": [
|
||
|
"[ 82 482 1021 1421 1821 2183 2645 3045 3445 3643 4357 4757\n",
|
||
|
" 5014 5493 5893 6293 6693 6965 7365 7652 8052 8513 9116 9203\n",
|
||
|
" 9603 10003 10628 10849 11512 11912 12312 12535 12947 13347 13666 14248\n",
|
||
|
" 14682 14857 15257 15657 16393 16793 17193 17262 17906 18146 18546 19050\n",
|
||
|
" 19450 19904]\n"
|
||
|
]
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"print(stim_id_trial['pair'][0])"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 7,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
|
"text/plain": [
|
||
|
"array([ 82, 482, 1021, 1421, 1821, 2183, 2645, 3045, 3445,\n",
|
||
|
" 3643, 4357, 4757, 5014, 5493, 5893, 6293, 6693, 6965,\n",
|
||
|
" 7365, 7652, 8052, 8513, 9116, 9203, 9603, 10003, 10628,\n",
|
||
|
" 10849, 11512, 11912, 12312, 12535, 12947, 13347, 13666, 14248,\n",
|
||
|
" 14682, 14857, 15257, 15657, 16393, 16793, 17193, 17262, 17906,\n",
|
||
|
" 18146, 18546, 19050, 19450, 19904])"
|
||
|
]
|
||
|
},
|
||
|
"execution_count": 7,
|
||
|
"metadata": {},
|
||
|
"output_type": "execute_result"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"pair_trial_id[0][0]"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"**Stimulus data layout:**\n",
|
||
|
"```\n",
|
||
|
"stim_val = {'pair': [(or1, ph1), (or2, ph2), ...], 'orientation': [...], 'phase': [...]}\n",
|
||
|
"stim_id_trial = {'pair': [id1, id2, ...], 'phase': [..], ...} # corresponding trials\n",
|
||
|
"pair_trial_id[orientation_id][phase_id] = [Trial ids]\n",
|
||
|
"```"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"#### Load the spike data and correlations\n",
|
||
|
"```\n",
|
||
|
"Loaded: spike_count_rate, avg_firing_rate, sem_firing_rate, firing_rate, stim_num_trial, C_r_fphi_theta, theta_hist, phase_hist, pair_hist\n",
|
||
|
"Loaded: corr_stim_unit, optimal_avg_firing_rate, stim_hist, stim_hist_caution\n",
|
||
|
"```"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 8,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
|
"text/plain": [
|
||
|
"(40,)"
|
||
|
]
|
||
|
},
|
||
|
"execution_count": 8,
|
||
|
"metadata": {},
|
||
|
"output_type": "execute_result"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"spike_times_file = \"Spiketimes_PVCre_2021_0012_s06_e14.npy\"\n",
|
||
|
"spike_times = np.load(data_folder+spike_times_file, allow_pickle=True)\n",
|
||
|
"active = [len(spike_times[i]) > 0 for i in range(len(spike_times))]\n",
|
||
|
"spike_times = spike_times[np.where(active)]\n",
|
||
|
"num_unit = len(spike_times)\n",
|
||
|
"spike_times.shape"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"**Sort spikes by firing rate**"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 9,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"\n",
|
||
|
"num_spike = list(map(len, spike_times))\n",
|
||
|
"spike_times = spike_times[np.argsort(num_spike)[::-1]]"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"**Load a lot of variables out of a `.pkl` file**"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 10,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"name": "stdout",
|
||
|
"output_type": "stream",
|
||
|
"text": [
|
||
|
"Loaded: spike_count_rate, avg_firing_rate, sem_firing_rate, firing_rate, stim_num_trial, C_r_fphi_theta, theta_hist, phase_hist, pair_hist\n",
|
||
|
"Loaded: corr_stim_unit, optimal_avg_firing_rate, stim_hist, stim_hist_caution\n"
|
||
|
]
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"# yeah...\n",
|
||
|
"files = ['spike_data.pkl', 'corr_data.pkl']\n",
|
||
|
"for file_name in files:\n",
|
||
|
" file = open(file_name, 'rb')\n",
|
||
|
" data = pkl.load(file)\n",
|
||
|
" print('Loaded:', ', '.join(data.keys()))\n",
|
||
|
" for key, value in data.items():\n",
|
||
|
" globals()[key] = value\n",
|
||
|
"\n",
|
||
|
" file.close()"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"#### Spike and stimulus preprocessing\n",
|
||
|
"\n",
|
||
|
"```\n",
|
||
|
"B_stim = {'pair': [mat_stim_1, mat_stim_2, ..], 'orientation': .., ...}\n",
|
||
|
"```\n",
|
||
|
"\n",
|
||
|
"`mat_stim_i` is a matrix of shape `(1, M)` such that `mat[0][t] = 1` if there was stimuli at time $t$ and $0$ if not\n",
|
||
|
"\n",
|
||
|
"```\n",
|
||
|
"B_spike = [unit_1_spikes, unit_2_spikes, ..]\n",
|
||
|
"unit_1_spikes[t] = 1 if there was a spike, 0 if not\n",
|
||
|
"```"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"##### Read the data"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 11,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"# reverse correlation time offset range \n",
|
||
|
"max_delay = 300 # dt\n",
|
||
|
"tau_id_range = np.arange(max_delay)\n",
|
||
|
"\n",
|
||
|
"# experiment duration\n",
|
||
|
"latest_spike_time = max([np.max(s) for s in spike_times if len(s)])\n",
|
||
|
"latest_stim_offtime = list(stim['stim_offtime'])[-1]\n",
|
||
|
"experiment_dur = max([latest_spike_time, latest_stim_offtime])\n",
|
||
|
"\n",
|
||
|
"dt = 0.001 # 1 ms\n",
|
||
|
"exp_time = np.arange(0, experiment_dur, dt)\n",
|
||
|
"M = len(exp_time)"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 12,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"B_stim = {}\n",
|
||
|
"for key in key_list:\n",
|
||
|
" B_stim[key] = []\n",
|
||
|
" for stim_id, trials in enumerate(stim_id_trial[key]):\n",
|
||
|
" B_stim[key].append([])\n",
|
||
|
" s = []\n",
|
||
|
" for trial_id in trials:\n",
|
||
|
" t_on, t_off = stim['stim_ontime'][trial_id], stim['stim_offtime'][trial_id]\n",
|
||
|
" s += list(np.arange(int(t_on//dt), int(t_off//dt)))\n",
|
||
|
"\n",
|
||
|
" B_stim[key][stim_id] = sparse.coo_matrix((np.ones(len(s)), (np.zeros(len(s), dtype=int), s)), shape=(1, M))\n",
|
||
|
"s = spike_times//dt\n",
|
||
|
"B_spike = []\n",
|
||
|
"for unit_id in range(num_unit):\n",
|
||
|
" B_spike.append(sparse.coo_matrix((np.ones(len(s[unit_id])), (np.zeros(len(s[unit_id]), dtype=int), np.int0(s[unit_id]))), shape=(1, M)))"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 13,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"sorted_spike_num = np.sort(num_spike)[::-1]\n",
|
||
|
"cutoff_num_spike = 1000\n",
|
||
|
"num_unit = np.sum(sorted_spike_num > cutoff_num_spike)\n",
|
||
|
"for key in key_list:\n",
|
||
|
" stim_hist[key] = stim_hist[key][:num_unit]"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"##### Some plots"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"This graph shows for unit 0 at a particular moment:\n",
|
||
|
"- One stimulus duration (blue)\n",
|
||
|
"- The second stimulus (red)\n",
|
||
|
"\n",
|
||
|
"And spike events"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "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mCEhSixkCktRihoAktdikIZBkVZI7kox7a8gkxyS5J8kNzeP0rmVLktyaZF2S0/pZuCRp+nrZEzgfWDJJn3+uqsObx5kASeYA5wDHAYcAJyY5ZDrFSpL6a9IQqKqrgE1T2PaRwLqqWl9VDwMXAUunsB1J0gyZ9B7DPToqyY3AT4H/WlVrgQXAbV19NgAvnmgDSVYAKwD222+/PpWlfviLz30dgHe84agBV9Iuf3xztpo/+9AaUCVb+93zOr8PF79l+34fprretrYFcMvt93LIPntOabv9rOmJqh8nhr8J7F9VhwEfA/7fVDZSVSurariqhoeGhvpQliRpMtMOgaq6t6rua6bXAHOTzAc2Avt2dV3YtEmSZolph0CSX0+SZvrIZpt3AtcBByU5IMmuwDJg9XSfT5LUP5OeE0hyIXAMMD/JBuAMYC5AVZ0LnAC8Nclm4EFgWVUVsDnJqcBlwBxgVXOuQJI0S0waAlV14iTLPw58fIJla4A1UytNkjTT/MSwJLWYISBJLWYISFKLGQKS1GKGgCS1mCEgSS1mCEhSixkCktRihoAktZghIEktZghIUosZApLUYoaAJLWYISBJLWYISFKLTRoCSVYluSPJtydY/ntJbkpyc5KvJTmsa9mPmvYbkoz0s3BJ0vT1sidwPrBkG8t/CLy8qg4FzgJWjln+iqo6vKqGp1aiJGmm9HJnsauSLNrG8q91zV5D54bykqQngH6fEzgZuKRrvoAvJbk+yYptrZhkRZKRJCOjo6N9LkuSNJ5J9wR6leQVdELg6K7mo6tqY5KnA5cn+W5VXTXe+lW1kuZQ0vDwcPWrLknSxPqyJ5Dk+cCngKVVdeeW9qra2Py8A/gicGQ/nk+S1B/TDoEk+wFfAP6gqr7X1f7kJE/ZMg0sBsa9wkiSNBiTHg5KciFwDDA
|
||
|
"text/plain": [
|
||
|
"<Figure size 432x288 with 1 Axes>"
|
||
|
]
|
||
|
},
|
||
|
"metadata": {
|
||
|
"needs_background": "light"
|
||
|
},
|
||
|
"output_type": "display_data"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"stim_id = 10\n",
|
||
|
"trial_id = stim_id_trial['phase'][stim_id][0]\n",
|
||
|
"unit_id = 0\n",
|
||
|
"t_on, t_off = stim['stim_ontime'][trial_id], stim['stim_offtime'][trial_id]\n",
|
||
|
"t0, t1 = t_off-0.2, t_off+0.1\n",
|
||
|
"stim_prev_id = trial_stim_id['phase'][trial_id-1]\n",
|
||
|
"t_prev_on, t_prev_off = stim['stim_ontime'][trial_id-1], stim['stim_offtime'][trial_id-1]\n",
|
||
|
"spikes = spike_times[unit_id][np.where((t0 < spike_times[unit_id]) & (spike_times[unit_id] < t1))]\n",
|
||
|
"plt.axvspan(t_on, t_off, color=cmap_jet(1-np.abs(stim_id-10)/10), alpha=0.3)\n",
|
||
|
"plt.axvspan(t_prev_on, t_prev_off, color=cmap_jet(1-np.abs(stim_prev_id-10)/10), alpha=0.3)\n",
|
||
|
"plt.eventplot(spikes)\n",
|
||
|
"plt.xlim([t0, t1])\n",
|
||
|
"plt.title('Spikes for unit 0')\n",
|
||
|
"plt.xlabel('Time')\n",
|
||
|
"plt.show()"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 15,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAfAAAAIUCAYAAADlkX7vAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8rg+JYAAAACXBIWXMAAAsTAAALEwEAmpwYAABGYElEQVR4nO3dd3hUZfrG8e+TDqFX6aGDgCCEqmLvvWLBgoqKrrrquuq667quvaxlV5G1V1Qsa8deUEAISJPepJdQU0h/f3/MgV+MSQhJZs6c5P5cVy5mzpzznuedM8w9p5tzDhEREQmWGL8LEBERkX2nABcREQkgBbiIiEgAKcBFREQCSAEuIiISQApwERGRAFKAS1iZmTOzu/2uQ6QsZvatmX1biekOM7M7zSymx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SN0RP1ir6+bCf1QK75suxM6PXCH1/5UQj+kireze/nHlTKPUvtW0eVHiaPQK/oZIvTj9klv+RWx5xCS3x6FXmz8kd77lktoE/8rQKsS46wEXi2jj3f6/f2gv+j6M+fK2qUkEj2KXTgj3gX46mEiItVF+8BFREQCSAEuIiISQNqELiIiEkBaAxcREQkgBbiIiEgAKcBFREQCSAEuIiISQApwERGRAFKAi4iIBJACXEREJIAU4CIiIgGkABcREQkgBbiIiEgAKcBFREQCSAEuIiISQApwERGRAFKAi4iIBJACXEREJIAU4CIiIgGkABcREQkgBbiIiEgAKcBFREQCSAEuIiISQApwEREJLDNzZtalktNeYGafV3dNkWLOOb9rEBERqRQzc0BX59zSvYyXAqwA4p1zBZG
|
||
|
"text/plain": [
|
||
|
"<Figure size 504x504 with 7 Axes>"
|
||
|
]
|
||
|
},
|
||
|
"metadata": {
|
||
|
"needs_background": "light"
|
||
|
},
|
||
|
"output_type": "display_data"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"from matplotlib import gridspec\n",
|
||
|
"\n",
|
||
|
"fig, ax = plt.subplots(3,1,figsize=(7,7))\n",
|
||
|
"gs0 = gridspec.GridSpec(3, 3, figure=fig, hspace=0, wspace=0)\n",
|
||
|
"\n",
|
||
|
"stim_id = 10\n",
|
||
|
"trial_id = stim_id_trial['phase'][stim_id][0]\n",
|
||
|
"unit_id = 0\n",
|
||
|
"t_on, t_off = stim['stim_ontime'][trial_id], stim['stim_offtime'][trial_id]\n",
|
||
|
"t0, t1 = t_off-0.2, t_off+0.1\n",
|
||
|
"stim_prev_id = trial_stim_id['phase'][trial_id-1]\n",
|
||
|
"t_prev_on, t_prev_off = stim['stim_ontime'][trial_id-1], stim['stim_offtime'][trial_id-1]\n",
|
||
|
"spikes = spike_times[unit_id][np.where((t0 < spike_times[unit_id]) & (spike_times[unit_id] < t1))]\n",
|
||
|
"\n",
|
||
|
"ax0 = fig.add_subplot(gs0[0, :-1])\n",
|
||
|
"ax1 = fig.add_subplot(gs0[1, :-1])\n",
|
||
|
"ax2 = fig.add_subplot(gs0[2, :-1])\n",
|
||
|
"ax3 = fig.add_subplot(gs0[:, -1])\n",
|
||
|
"\n",
|
||
|
"ax0.axvspan(t_on, t_off, color=cmap_jet(1-np.abs(stim_id-10)/10), alpha=0.3, label='preferred')\n",
|
||
|
"ax0.axvspan(t_prev_on, t_prev_off, color=cmap_jet(1-np.abs(stim_prev_id-10)/10), alpha=0.3, label='non-preferred')\n",
|
||
|
"ax0.eventplot(spikes)\n",
|
||
|
"ax0.set_xlim([t0, t1])\n",
|
||
|
"ax0.legend(loc='upper left')\n",
|
||
|
"\n",
|
||
|
"ax1.axvspan(t_on, t_off, color=cmap_jet(1-np.abs(stim_id-10)/10), alpha=0.3)\n",
|
||
|
"ax1.axvspan(t_prev_on, t_prev_off, color=cmap_jet(1-np.abs(stim_prev_id-10)/10), alpha=0.3)\n",
|
||
|
"ax1.eventplot(spikes-0.05)\n",
|
||
|
"ax1.set_xlim([t0, t1])\n",
|
||
|
"\n",
|
||
|
"ax2.axvspan(t_on, t_off, color=cmap_jet(1-np.abs(stim_id-10)/10), alpha=0.3)\n",
|
||
|
"ax2.axvspan(t_prev_on, t_prev_off, color=cmap_jet(1-np.abs(stim_prev_id-10)/10), alpha=0.3)\n",
|
||
|
"ax2.eventplot(spikes-0.15)\n",
|
||
|
"ax2.set_xlim([t0, t1])\n",
|
||
|
"\n",
|
||
|
"ax3.plot(np.sin(np.pi*tau_id_range/300), np.arange(300))\n",
|
||
|
"ax3.set_xticks([])\n",
|
||
|
"ax3.set_yticks([])\n",
|
||
|
"ax3.set_title('reverse correlation')\n",
|
||
|
"# ax2.legend()\n",
|
||
|
"for ax in fig.get_axes():\n",
|
||
|
" ax.tick_params(bottom=False, labelbottom=False, left=False, labelleft=False)\n",
|
||
|
"\n",
|
||
|
"ax2.tick_params(bottom=True, labelbottom=True)\n",
|
||
|
"ax2.set_xlabel('t/s')\n",
|
||
|
"plt.tight_layout()\n",
|
||
|
"fig.suptitle('subspace reverse correlation', size=16, y=1.05)\n",
|
||
|
"plt.show()"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 16,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAeUAAAG5CAYAAACwfCzuAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8rg+JYAAAACXBIWXMAAAsTAAALEwEAmpwYAAA+h0lEQVR4nO3de5xd873/8de7JhFyRyRpEkncpVIhiUQpyqlbnVIHpUhSKtrS8jtOUbQc5RxtlVbr0hASTtzqXrcWx7V1OUmohFBBQshIlNxEyMTn98daM90ZM5M9l73Xmtnv5+OxH7PXd90+a82e/Zm11md9lyICMzMzy97nsg7AzMzMEk7KZmZmOeGkbGZmlhNOymZmZjnhpGxmZpYTTspmZmY54aRsViKS7pc0Pn0/QdKTJVzXZpJWSFqvVOtoYt0rJG1e7vWadUROymZNkLSbpL9KWirpfUl/kTS6mHkjYv+ImFrqGNN1vRkR3SJiTTnWV2/d3SLidQBJUySdX+4YzDqKqqwDMMsrST2Ae4DvAbcAnYEvAx9nGZeZdVw+UjZr3NYAEXFjRKyJiI8i4s8R8QLUnZL+i6TfpUfSL0vau3ZmSY9K+k5DC5b0S0lPSuqZviZLWijpbUnn156GlrSlpMfS5b8n6eZGljdEUkiqKlj3z9L4lkv6s6RNGpn3M6fW02Vtmb6fIukySfemy3pG0hb1p5U0ETgKOC09pf3HdPzp6XYtl/RK4T4ys7U5KZs17u/AGklTJe0vqXcD04wBXgM2Ac4Bbpe0UWMLlPQ5SVcBXwT2iYilwBSgBtgS2BHYB6hN5j8D/gz0BgYCv21G/N8Cvg1sSnKU/x/NmLe+I4D/TOOYC1xQf4KImARMA36RntL+V0nbACcBoyOiO7AvMK8VcZh1aE7KZ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I02cGyhdP1tud9fpb4pu/f4qXFi5jWP8eDcbdHrepOUqxfe25+tpHymZmZjnhpGxmZpYTTspmZmY54aRsZmaWE07KZmZmOeHq6xyrlIrZUuvo29cc5dgXbbEO/85aJi/7rbE4CtvrT9OWsbv62szMzFrNSdnMzCwnnJTNzMxywknZzMwsJ5yUzczMcsLV101oTjVgW1c95qWKslQ6+vZlpTWfWf9Ostdefwd5i9vV12ZmZtZqTspmZmY54aRsZmaWE07KZmZmOZFJUpZ0jaRFkmYXtG0k6UFJr6Y/e2cRm5mZWVYyqb6WtDuwArguIrZP234BvB8RF0o6A+gdEac3tZws+74ud7/UtbKsbizFNuetarNSteT34OrttpHn/Zbn2Jri6utmiojHgffrNR8ETE3fTwUOLmdMZmZmWcvTNeW+EbEwfV8N9M0yGDMzs3LLU1KuE8k59QbPq0uaKGm6pOmLFy8uc2RmZmalk6ek/K6k/gDpz0UNTRQRkyJiVESM6tOnT1kDNDMzK6U8JeW7gfHp+/HAXRnGYmZmVnZZVV/fCOwJbAK8C5wD3AncAmwGzAcOj4j6xWBrybL6ulB7rVC0yuaKayulLD8b7bn6uiqLlUbEkY2M2rusgZiZmeVInk5fm5mZVTQnZTMzs5xwUjYzM8uJTAq92kpeCr3Mag0/90+s/LiGDddPyjWG9e/hIihrV4ot0Gqo6G/6vKQ2N+vPf3su9PKRspmZWU44KZuZmeWEk7KZmVlOOCmbmZnlRKuSsqRdi2kzMzOzdWtV9bWkmRGx07raSsXV1+XlLhVbprH91t73Z3uP30qnLbpwbY32XH3dom42Je0CfAnoI+nfC0b1ANZri8DMzMwqTUv7vu4MdEvn717Qvgw4tLVBmZmZVaIWJeWIeAx4TNKUiJjfxjGZmZlVpJaevv51RJwC/E7SZy5KR8TXWxuYmZlZpWnp6evr058XtVUgZmZmlc59X+eEK1mtrZXqM1Wuz2pHrFp
|
||
|
"text/plain": [
|
||
|
"<Figure size 504x504 with 3 Axes>"
|
||
|
]
|
||
|
},
|
||
|
"metadata": {
|
||
|
"needs_background": "light"
|
||
|
},
|
||
|
"output_type": "display_data"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"# subspace reverese correlation\n",
|
||
|
"stim_id = 13\n",
|
||
|
"ref_trial_id = stim_id_trial['phase'][stim_id][0]\n",
|
||
|
"stim_prev_id = trial_stim_id['phase'][ref_trial_id-1]\n",
|
||
|
"past_trials = 3\n",
|
||
|
"future_trials = 10\n",
|
||
|
"trial_range = np.arange(-past_trials, future_trials+1) + ref_trial_id\n",
|
||
|
"\n",
|
||
|
"units = np.arange(num_unit)\n",
|
||
|
"orientation, phase, t_on = np.array(stim[['grat_orientation', 'grat_phase','stim_ontime']].iloc[trial_range]).T\n",
|
||
|
"spikes = [\n",
|
||
|
" spike_times[unit_id][\n",
|
||
|
" # Where the spike occurs during the stimulus period in one of the right trials\n",
|
||
|
" np.where((t_on[0] < spike_times[unit_id]) & (spike_times[unit_id] < t_on[-1]))\n",
|
||
|
" ]\n",
|
||
|
" for unit_id in units]\n",
|
||
|
"\n",
|
||
|
"fig, ax = plt.subplots(2,1,figsize=(7,7))\n",
|
||
|
"plt.subplots_adjust(hspace=0)\n",
|
||
|
"s = 1\n",
|
||
|
"ax[0].eventplot(spikes, linelength=s, lineoffsets=s)\n",
|
||
|
"\n",
|
||
|
"ref_id = list(trial_range).index(ref_trial_id)\n",
|
||
|
"# ax[0].axvspan(t_on[ref_id], t_on[ref_id]+0.08, color=cmap_jet(1-np.abs(stim_id-10)/10), alpha=0.3)\n",
|
||
|
"# ax[0].axvspan(t_on[ref_id-1], t_on[ref_id-1]+0.08, color=cmap_jet(1-np.abs(stim_prev_id-10)/10), alpha=0.3)\n",
|
||
|
"ax[0].set(ylabel='unit')\n",
|
||
|
"ax[0].invert_yaxis()\n",
|
||
|
"ax[1].step(t_on, phase, 'b', where='post', alpha=0.5, label='phase')\n",
|
||
|
"ax[1].set(xlabel='t / s', xlim=[t_on[0], t_on[-1]], ylim=[0, 360], ylabel='phase')\n",
|
||
|
"ax[1].legend(loc='upper left')\n",
|
||
|
"ax2 = ax[1].twinx()\n",
|
||
|
"ax2.step(t_on, orientation, 'r', where='post', alpha=0.5, label='orientation')\n",
|
||
|
"ax2.set(ylim=[0, 180], ylabel='orientation')\n",
|
||
|
"ax2.legend()\n",
|
||
|
"ax[0].set_title('Spikes in units')\n",
|
||
|
"ax[1].set_title('Phase and orientation')\n",
|
||
|
"\n",
|
||
|
"plt.show()"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 17,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
|
"application/vnd.jupyter.widget-view+json": {
|
||
|
"model_id": "afc70624cbfe4a5f8838bce9ae0c0ebc",
|
||
|
"version_major": 2,
|
||
|
"version_minor": 0
|
||
|
},
|
||
|
"text/plain": [
|
||
|
"interactive(children=(IntSlider(value=0, description='delay/ms', max=299), IntSlider(value=0, description='uni…"
|
||
|
]
|
||
|
},
|
||
|
"metadata": {},
|
||
|
"output_type": "display_data"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"@widgets.interact(key=widgets.RadioButtons(options=key_list[1:],\n",
|
||
|
" description='stimulus:',\n",
|
||
|
" disabled=False), tau_id=widgets.IntSlider(0, min=0, max=max_delay-1, description='delay/ms'), unit_id=widgets.IntSlider(0, min=0, max=num_unit-1))\n",
|
||
|
"\n",
|
||
|
"def PSSH(tau_id, unit_id, key):\n",
|
||
|
" fig, ax = plt.subplots(1, 1, figsize=(7,6))\n",
|
||
|
" prob = stim_hist[key][unit_id, tau_id]\n",
|
||
|
" n = sorted_spike_num[unit_id]\n",
|
||
|
" confidence_interval = np.sqrt(prob/n)\n",
|
||
|
" plt.errorbar(stim_val[key], stim_hist[key][unit_id, tau_id], yerr=confidence_interval)\n",
|
||
|
" ymin = np.min(stim_hist[key][unit_id])*0.95\n",
|
||
|
" ymax = np.max(stim_hist[key][unit_id])*1.05\n",
|
||
|
" ax.set_ylabel('$\\mathcal{P}($'+key_symbol[key]+'$|\\\\tau)$')\n",
|
||
|
" ax.set_xlabel(key_symbol[key])\n",
|
||
|
" plt.ylim([ymin, ymax])\n",
|
||
|
" plt.suptitle('Distribution of stimulus at time $\\\\tau$ before a spike of unit: %d'%unit_id)\n",
|
||
|
" plt.show()"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"##### Problem with the data\n",
|
||
|
"\n",
|
||
|
"The picture a couple of cells below clearly shows that there is a shift in the stimulus presentation times. Let's fix it!"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 18,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"name": "stderr",
|
||
|
"output_type": "stream",
|
||
|
"text": [
|
||
|
"/usr/lib/python3.10/site-packages/pandas/core/roperator.py:13: VisibleDeprecationWarning: Creating an ndarray from ragged nested sequences (which is a list-or-tuple of lists-or-tuples-or ndarrays with different lengths or shapes) is deprecated. If you meant to do this, you must specify 'dtype=object' when creating the ndarray.\n",
|
||
|
" return right - left\n"
|
||
|
]
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"trial_spike_times = np.ndarray((num_unit, num_trial), dtype=object)\n",
|
||
|
"delta_t_on = 0.2 # 200ms\n",
|
||
|
"delta_t_off = 0.3\n",
|
||
|
"for trial_id in range(num_trial):\n",
|
||
|
" t_on, t_off = stim['stim_ontime'][trial_id]-delta_t_on, stim['stim_offtime'][trial_id]+delta_t_off\n",
|
||
|
" for unit_id in range(num_unit):\n",
|
||
|
" trial_spike_times[unit_id, trial_id] = spike_times[unit_id][np.where((spike_times[unit_id] < t_off) & (spike_times[unit_id] > t_on))]\n",
|
||
|
"subseq_trials = 5\n",
|
||
|
"subseq_spike_times = np.ndarray(num_unit, dtype=object)\n",
|
||
|
"for unit_id in range(num_unit):\n",
|
||
|
" subseq_spike_times[unit_id] = [np.concatenate(trial_spike_times[unit_id][i:i+subseq_trials]) for i in range(num_trial-subseq_trials)]\n",
|
||
|
"\n",
|
||
|
"subseq_spike_times_locked = {}\n",
|
||
|
"subseq_spike_times_locked['ontime'] = [subseq_spike_times[unit_id] - stim['stim_ontime'][:-subseq_trials] for unit_id in range(num_unit)]\n",
|
||
|
"subseq_spike_times_locked['offtime'] = [subseq_spike_times[unit_id] - stim['stim_offtime'][:-subseq_trials] for unit_id in range(num_unit)]"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 19,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"time_range = np.arange(0, stim['stim_ontime'].max(), np.array(sorted(np.diff(stim['stim_ontime'], n=1))[10:-10]).mean())"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 20,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
|
"text/plain": [
|
||
|
"((28, 19995), (28, 19995), 0.7671829999999886)"
|
||
|
]
|
||
|
},
|
||
|
"execution_count": 20,
|
||
|
"metadata": {},
|
||
|
"output_type": "execute_result"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"subseq_spike_times_len = len(subseq_spike_times[0])\n",
|
||
|
"subseq_spike_times_locked['ontime'] = np.array(subseq_spike_times_locked['ontime'])\n",
|
||
|
"subseq_spike_times_locked['offtime'] = np.array(subseq_spike_times_locked['offtime'])\n",
|
||
|
"from itertools import chain\n",
|
||
|
"subseq_spike_times_locked['ontime'].shape, subseq_spike_times_locked['offtime'].shape, max(chain(*subseq_spike_times_locked['ontime'].flatten()))"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 21,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAABKUAAAJs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/3+q712rB/HnE9RJtKqVISgGJYaFzDEXITsyknU9CVk+57ACHTlClLPSaS33uPNThez2pkI44YZmWr1ylPRYt7E0FZ4h43nSXwqFVxcYs9XiF6aUa47P4LinaGE9SqgaSUkjZuvutdnn7Kdr7IVvoQ4fvo0dtvyB0kwBnXHRiutiqN1VlF3i+tgnP0AEBHjDNRguxxS4qpcJLtRM/VF0k7tr+DSZpOGwkpWogKYWUFf94fP0NB2r/xVsHag3gVgydGJ8VCUwBGq+ri+CuEmF12zNpt7pQF/Wu3j/k5yquP+Ky8x3y+1pVARRLAqpMDPG8Sh+OHzaUjzVV/276OmW3i4/LtHkvtENCNS4kpWogKYWUHf7JZTr/2lvX375k6SFaOH+jgC0C3Im5E4PphL6Qn6YDM+175qXakRlCBVwxKVWWpOoqcZVC0iT2eF51jH0mH4vvNc1i5yGEjuuAT65iQx8GHUhK1UBSCqljTSkMRQydmGmmz3St6gKoywujXY46WeusNNf428UpRAKDEW9MUvd7VVwsN+Ozgip0bKojhniOMIitcejib63L3+U01xtdX6u4SDiNu56sE8NjivMkpWogKYXUkZTCUPShE+PiIsFlxUUd4y7uur7wG1c91MeOTFmbY64a6uMxLlOWTM3fTkFxke5MDB2UOmKK56luVOFD1YYNZdWnRX2PM0XTThN0/XqpKNvEIovvmT7H+arYnokxxpOUqoGkFFJ19R/u1NM/9MNZ9/3
|
||
|
"text/plain": [
|
||
|
"<Figure size 1440x720 with 3 Axes>"
|
||
|
]
|
||
|
},
|
||
|
"metadata": {
|
||
|
"needs_background": "light"
|
||
|
},
|
||
|
"output_type": "display_data"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"unit_id = 1\n",
|
||
|
"unit_id_2 = 3\n",
|
||
|
"\n",
|
||
|
"fig, ax = plt.subplots(1,3, figsize=(20,10))\n",
|
||
|
"ax[0].plot(np.diff(stim['stim_ontime'], n=2), np.arange(20000-2))\n",
|
||
|
"ax[0].invert_yaxis()\n",
|
||
|
"ax[0].set_xlabel('$\\Delta^2[t_{on}]=\\Delta$ trial duration / s', size=20)\n",
|
||
|
"ax[0].set(ylabel='trials')\n",
|
||
|
"ax[1].eventplot(subseq_spike_times_locked['ontime'][unit_id], lineoffsets=1, linelengths=0.8)\n",
|
||
|
"ax[1].set(title='unit %d'%unit_id, yticks=[], xlabel='t/s (locked to trial onsets)')\n",
|
||
|
"ax[1].invert_yaxis()\n",
|
||
|
"ax[2].eventplot(subseq_spike_times_locked['ontime'][unit_id_2], lineoffsets=1, linelengths=0.8)\n",
|
||
|
"ax[2].set(title='unit %d'%(unit_id_2), yticks=[], xlabel='t/s (locked to trial ends)')\n",
|
||
|
"ax[2].invert_yaxis()\n",
|
||
|
"plt.subplots_adjust(wspace=0)\n",
|
||
|
"plt.show()"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"_Whaaat?_\n",
|
||
|
"\n",
|
||
|
"Ok, we've gotta fix it.\n",
|
||
|
"\n",
|
||
|
"Let's take the \"bad\" times, identify the periods we want to calibrate - and align everything"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 22,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"name": "stdout",
|
||
|
"output_type": "stream",
|
||
|
"text": [
|
||
|
"2280 2286 2291 2292 2295 2298 2301 2307 2377 2378 2380 2383 2386 2464 2467 2469 2472 2475 2478 15300 15306 15312 15315 15316 15318 15327 15329 15333 15336 15338 15342 15344 15348 15349 15402 15403 15405 15408\n"
|
||
|
]
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"stim_2diffs = np.diff(stim['stim_ontime'], n=2)\n",
|
||
|
"print(*[i for i in range(len(stim_2diffs)) if stim_2diffs[i] > 0.01])"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"Periods:\n",
|
||
|
"$[0, 2350)$, $[2350, 15350)$, $[15350, 20000]$"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 23,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"name": "stderr",
|
||
|
"output_type": "stream",
|
||
|
"text": [
|
||
|
"/tmp/ipykernel_4135643/175591453.py:20: DeprecationWarning: Please use `gaussian_filter1d` from the `scipy.ndimage` namespace, the `scipy.ndimage.filters` namespace is deprecated.\n",
|
||
|
" period_1_dist = scipy.ndimage.filters.gaussian_filter1d(period_1_dist, sigma=10)\n",
|
||
|
"/tmp/ipykernel_4135643/175591453.py:21: DeprecationWarning: Please use `gaussian_filter1d` from the `scipy.ndimage` namespace, the `scipy.ndimage.filters` namespace is deprecated.\n",
|
||
|
" period_2_dist = scipy.ndimage.filters.gaussian_filter1d(period_2_dist, sigma=10)\n",
|
||
|
"/tmp/ipykernel_4135643/175591453.py:22: DeprecationWarning: Please use `gaussian_filter1d` from the `scipy.ndimage` namespace, the `scipy.ndimage.filters` namespace is deprecated.\n",
|
||
|
" period_3_dist = scipy.ndimage.filters.gaussian_filter1d(period_3_dist, sigma=10)\n"
|
||
|
]
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"p1, p2 = 2350, 15350\n",
|
||
|
"delta_t = 0.002\n",
|
||
|
"time_range_smoothing = np.arange(0, 0.8, delta_t)\n",
|
||
|
"period_1_dist = np.zeros(len(time_range_smoothing) - 1)\n",
|
||
|
"period_2_dist = np.zeros(len(time_range_smoothing) - 1)\n",
|
||
|
"period_3_dist = np.zeros(len(time_range_smoothing) - 1)\n",
|
||
|
"num_units = subseq_spike_times_locked['ontime'].shape[0]\n",
|
||
|
"for i in range(num_units):\n",
|
||
|
" for j, row in enumerate(subseq_spike_times_locked['ontime'][i]):\n",
|
||
|
" hist = np.histogram(row, bins=time_range_smoothing)[0]\n",
|
||
|
" if j < p1:\n",
|
||
|
" period_1_dist += hist\n",
|
||
|
" elif j < p2:\n",
|
||
|
" period_2_dist += hist\n",
|
||
|
" else:\n",
|
||
|
" period_3_dist += hist\n",
|
||
|
"period_1_dist /= num_units\n",
|
||
|
"period_2_dist /= num_units\n",
|
||
|
"period_3_dist /= num_units\n",
|
||
|
"period_1_dist = scipy.ndimage.filters.gaussian_filter1d(period_1_dist, sigma=10)\n",
|
||
|
"period_2_dist = scipy.ndimage.filters.gaussian_filter1d(period_2_dist, sigma=10)\n",
|
||
|
"period_3_dist = scipy.ndimage.filters.gaussian_filter1d(period_3_dist, sigma=10)"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 24,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
|
"text/plain": [
|
||
|
"[<matplotlib.collections.EventCollection at 0x7f1b53e02f80>]"
|
||
|
]
|
||
|
},
|
||
|
"execution_count": 24,
|
||
|
"metadata": {},
|
||
|
"output_type": "execute_result"
|
||
|
},
|
||
|
{
|
||
|
"data": {
|
||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAmoAAAR8CAYAAAAtjbjDAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8rg+JYAAAACXBIWXMAAAsTAAALEwEAmpwYAAD4kUlEQVR4nOzdd3hcZ5328e8z6rJ6r5Yt997kuMWOnd4TUkgoIYFACBA6LLDAvrCwC0sJnZBAQgqphJBCqu0k7k3u3bJlW5Zs9W5ZdZ73D42C4riozMwZSffnunRZOnPOmd+JbOXWU421FhEREREJPC6nCxARERGRM1NQExEREQlQCmoiIiIiAUpBTURERCRAKaiJiIiIBCgFNREREZEApaAmIiIiEqAU1ERk0DHG3GeMyTfGtBhjHu3FdUeMMZf6sLTT32+EMcYaY4L99Z4iMrDoh4OIDEbHgR8DVwARDtdyRgpnItITalETkUHHWvuCtfZFoOr014wxScaYfxljao0x1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rCIiJIhpWXH9uk9cZChTM2NZEwBBbUNhFaHBLmYMj+v3veaPSmR9YRUdbufHqb2+q3NdtysmpfX4mqz4SCamx7BsT+BNihAROZtAC2of4f2taSeA4dbaGcDXgKeMMWdc3MoYc48xJt8Yk19RETgDuWXgWHuokrwR8X1awuJ0C0YnsbWolkaHF1ndcLiaGdlxhAWfe2P5npg/OomG5nZ2ldR5obL+eXN3KVMyY3vc7dnlonHJbCmq0eK3IjJ
|
||
|
"text/plain": [
|
||
|
"<Figure size 720x1440 with 3 Axes>"
|
||
|
]
|
||
|
},
|
||
|
"metadata": {
|
||
|
"needs_background": "light"
|
||
|
},
|
||
|
"output_type": "display_data"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"fig, ax = plt.subplots(3, 1, figsize=(10,20))\n",
|
||
|
"ax[0].plot(time_range_smoothing[:-1], period_1_dist, label='period 1')\n",
|
||
|
"ax[1].plot(time_range_smoothing[:-1], period_2_dist, label='period 2')\n",
|
||
|
"ax[2].plot(time_range_smoothing[:-1], period_3_dist, label='period 3')\n",
|
||
|
"ax[0].set(xlabel='t/s', ylabel='spike count', title='1st part')\n",
|
||
|
"ax[1].set(xlabel='t/s', ylabel='spike count', title='2nd part')\n",
|
||
|
"ax[2].set(xlabel='t/s', ylabel='spike count', title='3rd part')\n",
|
||
|
"ax[0].eventplot([0.2], linelengths=0.8)\n",
|
||
|
"ax[1].eventplot([0.2], linelengths=0.8)\n",
|
||
|
"ax[2].eventplot([0.2], linelengths=0.8)"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 25,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
|
"text/plain": [
|
||
|
"100"
|
||
|
]
|
||
|
},
|
||
|
"execution_count": 25,
|
||
|
"metadata": {},
|
||
|
"output_type": "execute_result"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"list(time_range_smoothing).index(0.2)"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 26,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"name": "stdout",
|
||
|
"output_type": "stream",
|
||
|
"text": [
|
||
|
"0.2 0.162 0.194\n"
|
||
|
]
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"max_p_1 = time_range_smoothing[np.argmax(period_1_dist[:120])]\n",
|
||
|
"max_p_2 = time_range_smoothing[np.argmax(period_2_dist[:100])]\n",
|
||
|
"max_p_3 = time_range_smoothing[np.argmax(period_3_dist[:120])]\n",
|
||
|
"delta_2 = max_p_1 - max_p_2\n",
|
||
|
"delta_3 = max_p_1 - max_p_3\n",
|
||
|
"print(max_p_1, max_p_2, max_p_3)"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"Now we'll fix the times"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 27,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"t_p1, t_p2 = stim['stim_offtime'][p1], stim['stim_offtime'][p2]\n",
|
||
|
"fix_time = lambda t: t - delta_2 * ((t < t_p2) & (t >= t_p1)) - delta_3 * ((t >= t_p2))"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 28,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
|
"text/plain": [
|
||
|
"0 2.5839\n",
|
||
|
"1 2.7028\n",
|
||
|
"2 2.7863\n",
|
||
|
"3 2.8699\n",
|
||
|
"4 2.9534\n",
|
||
|
" ... \n",
|
||
|
"19990 1671.6389\n",
|
||
|
"19991 1671.7224\n",
|
||
|
"19992 1671.8059\n",
|
||
|
"19993 1671.8894\n",
|
||
|
"19994 1671.9730\n",
|
||
|
"Name: stim_offtime, Length: 19995, dtype: float64"
|
||
|
]
|
||
|
},
|
||
|
"execution_count": 28,
|
||
|
"metadata": {},
|
||
|
"output_type": "execute_result"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"fix_time(stim['stim_offtime'][:-subseq_trials])"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 29,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"name": "stderr",
|
||
|
"output_type": "stream",
|
||
|
"text": [
|
||
|
"/usr/lib/python3.10/site-packages/pandas/core/roperator.py:13: VisibleDeprecationWarning: Creating an ndarray from ragged nested sequences (which is a list-or-tuple of lists-or-tuples-or ndarrays with different lengths or shapes) is deprecated. If you meant to do this, you must specify 'dtype=object' when creating the ndarray.\n",
|
||
|
" return right - left\n"
|
||
|
]
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"subseq_spike_times_locked_2 = {}\n",
|
||
|
"subseq_spike_times_locked_2['ontime'] = [subseq_spike_times[unit_id] - fix_time(stim['stim_ontime'][:-subseq_trials]) for unit_id in range(num_unit)]\n",
|
||
|
"subseq_spike_times_locked_2['offtime'] = [subseq_spike_times[unit_id] - fix_time(stim['stim_offtime'][:-subseq_trials]) for unit_id in range(num_unit)]"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 30,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAABJ8AAAJsCAYAAABTWwL8AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8rg+JYAAAACXBIWXMAAAsTAAALEwEAmpwYAADS4klEQVR4nOzdebwdRZ3//3eRAAFMWAWCGKOIIIugoLgbRBFXnBkHdEbHfRl1dh3FNSAO6Oj81HFU/LqA4z464wYI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9dobOBoakbvvtts/tGyqfwkitEz80XSTmJvm7S0IQdUg+5ZB8QsqKf0C+8YYn6MDF2wVqDeBW6M7KuJHyrjC9p1yoi+5J2xLj9JJUphUW1wZx2ZEO8X2cJinVF6HjeZUUj3Wq8rFn0thejF9l8azstUnGuEOCtH9IPuWQfELKjvjUMp1/3a0bfr506aFaMG/TgC0C3Im1s4LJhLh4b9LRcPWemRQ7K/nPmNrnyyefyhJRXSSnhpjwiDmeV/0+fCUi8+8zSUc8VOedhAxS4+o7n9oAA8mnHJJPSB1rPmEoYuis+Kp+qlN1MdTVRdJuR52s9VaaY/ysqeM7OVN8P1/vi/g0/c4UF6zN+KqG6nvHpEwM8Rx+kJQKZ9q/r65+d5NeV3R9PeIiuVR1ndgkjvc11pN8yiH5hNSRfMJQxN5Z6fqiwVWVRRN1F3hdXvyVJYL6OKWh6VSNGPTt2OaVJUbzP/ddfqHxTN86IU3FEs9Ddvb6OMW6Kq7VTYErPrbv2sbQusd3+VopKF5f5GN8po+xvpiQKup7nCf5lEPyCam65o936Okf/tG
|
||
|
"text/plain": [
|
||
|
"<Figure size 1440x720 with 3 Axes>"
|
||
|
]
|
||
|
},
|
||
|
"metadata": {
|
||
|
"needs_background": "light"
|
||
|
},
|
||
|
"output_type": "display_data"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"unit_id = 1\n",
|
||
|
"\n",
|
||
|
"fig, ax = plt.subplots(1,3, figsize=(20,10))\n",
|
||
|
"ax[0].plot(np.diff(stim['stim_ontime'], n=2), np.arange(20000-2))\n",
|
||
|
"ax[0].invert_yaxis()\n",
|
||
|
"ax[0].set_xlabel('$\\Delta^2[t_{on}]=\\Delta$ trial duration / s', size=20)\n",
|
||
|
"ax[0].set(ylabel='trials')\n",
|
||
|
"ax[1].eventplot(subseq_spike_times_locked_2['ontime'][unit_id], lineoffsets=1, linelengths=0.8)\n",
|
||
|
"ax[1].set(title='unit %d'%unit_id, yticks=[], xlabel='t/s (locked to trial onsets)')\n",
|
||
|
"ax[1].invert_yaxis()\n",
|
||
|
"ax[2].eventplot(subseq_spike_times_locked_2['ontime'][unit_id_2], lineoffsets=1, linelengths=0.8)\n",
|
||
|
"ax[2].set(title='unit %d'%(unit_id_2), yticks=[], xlabel='t/s (locked to trial ends)')\n",
|
||
|
"ax[2].invert_yaxis()\n",
|
||
|
"plt.subplots_adjust(wspace=0)\n",
|
||
|
"plt.show()"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 31,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"s = np.array([np.array(list(map(fix_time, spike_times[unit_id]))) for unit_id in range(len(spike_times))], dtype=object)//dt\n",
|
||
|
"B_spike_fixed = []\n",
|
||
|
"for unit_id in range(num_unit):\n",
|
||
|
" B_spike_fixed.append(sparse.coo_matrix((np.ones(len(s[unit_id])), (np.zeros(len(s[unit_id]), dtype=int), np.int0(s[unit_id]))), shape=(1, M)))"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 32,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"from copy import deepcopy\n",
|
||
|
"B_stim_original = deepcopy(B_stim)"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 33,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"B_stim = {}\n",
|
||
|
"for key in key_list:\n",
|
||
|
" B_stim[key] = []\n",
|
||
|
" for stim_id, trials in enumerate(stim_id_trial[key]):\n",
|
||
|
" B_stim[key].append([])\n",
|
||
|
" s = []\n",
|
||
|
" for trial_id in trials:\n",
|
||
|
" t_on, t_off = fix_time(stim['stim_ontime'][trial_id]), fix_time(stim['stim_offtime'][trial_id])\n",
|
||
|
" s += list(np.arange(int(t_on//dt), int(t_off//dt)))\n",
|
||
|
"\n",
|
||
|
" B_stim[key][stim_id] = sparse.coo_matrix((np.ones(len(s)), (np.zeros(len(s), dtype=int), s)), shape=(1, M))"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"#### Calculate some matrices"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 34,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"get_trial_index = lambda t: fix_time(stim['stim_ontime'][t])//dt"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 35,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"B_spike_smooth = list()\n",
|
||
|
"for unit_id in range(num_unit):\n",
|
||
|
" B_spike_smooth.append(scipy.ndimage.gaussian_filter(B_spike[unit_id].toarray()[0], sigma=50))\n",
|
||
|
"B_spike_smooth = np.array(B_spike_smooth)"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 36,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
|
"text/plain": [
|
||
|
"[<matplotlib.lines.Line2D at 0x7f1b6ae5dcc0>]"
|
||
|
]
|
||
|
},
|
||
|
"execution_count": 36,
|
||
|
"metadata": {},
|
||
|
"output_type": "execute_result"
|
||
|
},
|
||
|
{
|
||
|
"data": {
|
||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAXoAAAD4CAYAAADiry33AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8rg+JYAAAACXBIWXMAAAsTAAALEwEAmpwYAABS2UlEQVR4nO29eZxkZ3nf+31rX3vfZu8ZzUij0YoYLUhgYwgYcEAxBlvg6xDbN8R2+NwbO3ECjq9jE998jG9snASubRJzg1cwYGLZ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+aEWHojo1fBMJHpH40+lsoT8XvwmJ2SUb8Hj0v01DyAViOlZGY1xdF9I3hcoq9N3OzGCCp6IqMXQriBTwPvBI4AHxBCHCk77GeBFSnlQeCTwCfMf+sB/hT4OSnlLcCbgbakKE+dW+Itv/MYf/3CTDu+/bYgXpbRq4Af74GMPpbKWZm8ta4+y+gHAhsjnIUQDIW8fa3RLyWypHNF9o4EGYv4e8optdVshYz+HuCMlPKclDILfB54sOyYB4HPmY+/BLxVCCGAtwMvSSlfBJBSLkkp23LpumPPEAcnInzuiQvt+PbbgkQmj9slLEc9S7rpskafLxRJZAvWZmzYrAqK91FGv57euJAphkK+vtboZ8yZxLuGQ4xFfX1na1FKvYw+0wMWCLuAyyVfXzGfsz1GSpkH1oBR4EZACiEeEUI8J4T4t3ZvIIT4sBDimBDi2MJCc0ORA143bzk8yfGZNT2CrUkSmQJhnxvjGl0i3XQ50Ks7DRUIo37j716402gVyWzBuoAphvvQ6qEUlcGPR/2MR/wsbIeMvkrVTXqLWyB4gDcCP2n+/aNCiLeWHySl/IyU8qiU8uj4+HjTb3bbrkF
|
||
|
"text/plain": [
|
||
|
"<Figure size 432x288 with 1 Axes>"
|
||
|
]
|
||
|
},
|
||
|
"metadata": {
|
||
|
"needs_background": "light"
|
||
|
},
|
||
|
"output_type": "display_data"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"plt.plot(B_spike_smooth[0][:5000]) # ~10 trials"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": null,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": []
|
||
|
}
|
||
|
],
|
||
|
"metadata": {
|
||
|
"kernelspec": {
|
||
|
"display_name": "Python 3.10.5 64-bit",
|
||
|
"language": "python",
|
||
|
"name": "python3"
|
||
|
},
|
||
|
"language_info": {
|
||
|
"codemirror_mode": {
|
||
|
"name": "ipython",
|
||
|
"version": 3
|
||
|
},
|
||
|
"file_extension": ".py",
|
||
|
"mimetype": "text/x-python",
|
||
|
"name": "python",
|
||
|
"nbconvert_exporter": "python",
|
||
|
"pygments_lexer": "ipython3",
|
||
|
"version": "3.10.5"
|
||
|
},
|
||
|
"orig_nbformat": 4,
|
||
|
"vscode": {
|
||
|
"interpreter": {
|
||
|
"hash": "e7370f93d1d0cde622a1f8e1c04877d8463912d04d973331ad4851f04de6915a"
|
||
|
}
|
||
|
}
|
||
|
},
|
||
|
"nbformat": 4,
|
||
|
"nbformat_minor": 2
|
||
|
}
|