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.

663 lines
1.4 MiB

2 years ago
{
"cells": [
{
"cell_type": "code",
"execution_count": 8,
2 years ago
"metadata": {
"pycharm": {
"name": "#%%\n"
}
},
"outputs": [],
"source": [
"%matplotlib inline\n",
2 years ago
"import numpy as np\n",
"import pandas as pd\n",
"import matplotlib\n",
"import matplotlib.pyplot as plt\n",
"import sys\n",
"from tqdm import trange\n",
"sys.path.insert(0, './Persistent_Homology')\n",
2 years ago
"sys.path.insert(0, './model')\n",
2 years ago
"\n",
"from gratings import grating_model, GRATING_PARS, get_locations\n",
"import gratings\n",
"from plotting import plot_data, plot_mean_against_index, show_feature\n",
"from persistence import persistence\n",
"from decoding import cohomological_parameterization, remove_feature\n",
"from noisereduction import PCA_reduction, z_cutoff\n",
"from load import pkl_load, pkl_save\n",
"import ipywidgets as widgets\n",
"import sympy as sp\n",
"\n",
"# matplotlib.use(\"nbagg\")"
]
},
{
"cell_type": "code",
"execution_count": 2,
2 years ago
"metadata": {
"pycharm": {
"name": "#%%\n"
}
},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "3c7716cd8e6c4cd3a0b8f3b51c28b533",
2 years ago
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"interactive(children=(FloatSlider(value=0.0, description='stim_theta', max=180.0, step=5.0), FloatSlider(value…"
]
2 years ago
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"@widgets.interact(\n",
" stim_theta = widgets.FloatSlider(0, min=0, max=180, step=5),\n",
" stim_phi = widgets.FloatSlider(90, min=0, max=360, step=10),\n",
" stim_freq = widgets.FloatSlider(1.5, min=0, max=10, step=0.5),\n",
" RF_theta = widgets.FloatSlider(0, min=0, max=180, step=5),\n",
" RF_phi = widgets.FloatSlider(90, min=0, max=360, step=10),\n",
" RF_freq = widgets.FloatSlider(1.5, min=0, max=10, step=0.5),\n",
" RF_radius = widgets.FloatSlider(0.5, min=0, max=1, step=0.1), \n",
" RF_x = widgets.FloatSlider(0.5, min=-1, max=1, step=0.1),\n",
" RF_y = widgets.FloatSlider(-0.5, min=-1, max=1, step=0.1)\n",
" )\n",
"\n",
"def plot_grating(stim_theta, stim_phi, stim_freq, RF_theta, RF_phi, RF_freq, RF_radius, RF_x, RF_y):\n",
" stim_grating = (stim_theta/180*np.pi, stim_freq, stim_phi/180*np.pi, 1)\n",
" RF_grating = (RF_theta/180*np.pi, RF_freq, RF_phi/180*np.pi, 1)\n",
" stim_grat_image = gratings.grating_image(grating=stim_grating, plot=False)\n",
" RF_grat_image = gratings.grating_image(grating=RF_grating, gabor=True, rf_sigma=RF_radius, center=(RF_y, RF_x), plot=False)\n",
" \n",
" fig, ax = plt.subplots(1,5, figsize=(25,6))\n",
"\n",
" ax[0].imshow(stim_grat_image,\"gray\", vmin = -1, vmax = 1, extent=[-1,1,1,-1]) \n",
" receptive_field = plt.Circle((RF_x, RF_y), RF_radius, color='b', fill=False)\n",
" ax[0].add_patch(receptive_field)\n",
" ax[0].legend([receptive_field], ['receptive field'])\n",
" ax[0].invert_yaxis()\n",
"\n",
" ax[1].imshow(RF_grat_image,\"gray\", vmin = -1, vmax = 1, extent=[-1,1,1,-1]) \n",
" receptive_field = plt.Circle((RF_x, RF_y), RF_radius, color='b', fill=False)\n",
" ax[1].add_patch(receptive_field)\n",
" ax[1].legend([receptive_field], ['receptive field']) \n",
" ax[1].invert_yaxis()\n",
"\n",
" response = gratings.response(RF_grating, stim_grating, rf_sigma=RF_radius, center=(RF_y, RF_x))\n",
" ax[2].axhline(response)\n",
" ax[2].set(ylim=[0,1])\n",
"\n",
" # Nstim = (20, 1, 20, 1)\n",
" # stim_list = gratings.get_locations(Nstim)\n",
" # rates = np.zeros([len(stim_list)])\n",
" # iterator = trange(0, len(stim_list), position=0, leave=True)\n",
" # iterator.set_description(\"Simulating data stim_list\")\n",
" # for i in iterator:\n",
" # rates[i] = response(stim_list[i], RF_grating, rf_sigma=RF_radius, center=(RF_y, RF_x))\n",
"\n",
" fig.show()\n",
"# return fig"
]
},
{
"cell_type": "code",
"execution_count": 9,
2 years ago
"metadata": {
"pycharm": {
"name": "#%%\n"
}
},
"outputs": [],
"source": [
"class simple_cell_model:\n",
" def __init__(self, Nn, Np, deltaT=None, random_focal_points=False):\n",
" self.GRATING_PARS = GRATING_PARS\n",
" self.Nn = Nn\n",
" self.num_units = self.Nn ** 2\n",
" self.Np = Np\n",
" self.deltaT = deltaT\n",
" self.random_focal_points = random_focal_points\n",
" self.Np_dict = {g:self.Np[i] for i, g in enumerate(self.GRATING_PARS)}\n",
"\n",
" self.joint_tuning = np.zeros((self.num_units, self.Np_dict['orientation'], self.Np_dict['phase']))\n",
" self.var_list = ['orientation', 'phase']\n",
" self.axis_dict = {'orientation': 1, 'phase': 2}\n",
" self.marginal_tuning = {var:np.zeros((self.num_units, self.Np_dict[var])) for var in self.Np_dict}\n",
" self.simulate()\n",
"\n",
" stim_vals = np.array(get_locations(Np))\n",
" self.stim_val = {var: np.unique(stim_vals[:, GRATING_PARS.index(var)]) for var in self.var_list}\n",
"\n",
" def save(self, filename):\n",
" pkl_save(filename, self)\n",
"\n",
" def simulate(self):\n",
" x, _ = grating_model(Nn=self.Nn, Np=self.Np, deltaT=self.deltaT, random_focal_points=self.random_focal_points)\n",
" self.joint_tuning = np.array(x).reshape(self.Np_dict['orientation'], self.Np_dict['phase'], self.num_units).transpose((2,0,1))\n",
" for var1, var2 in zip(self.var_list, self.var_list[::-1]):\n",
" self.marginal_tuning[var1] = np.mean(self.joint_tuning, axis=self.axis_dict[var2])\n",
"\n",
" # def marginal_tuning(self, var='orientation'): # add integration range\n",
" # \"\"\"\n",
" # :type label: {'orientation', 'phase'}\n",
" # \"\"\"\n",
"\n",
" def plot_joint_tuning(self):\n",
" fig, ax = plt.subplots(self.Nn, self.Nn, figsize=(self.Nn*4, self.Nn*4))\n",
" for unit_id in range(self.num_units):\n",
" r, c = unit_id//self.Nn, unit_id%self.Nn\n",
" ax0 = ax[r, c]\n",
" ax0.imshow(self.joint_tuning[unit_id], extent=[0, 360, 180, 0], aspect='auto')\n",
" ax0.set(xlabel='phase', ylabel='orientation')\n",
"\n",
" fig.suptitle('joint tuning', weight='bold', y=1.01)\n",
" plt.tight_layout()\n",
" plt.show()\n",
"\n",
" def plot_marginal_tuning(self, var):\n",
" fig, ax = plt.subplots(self.Nn, self.Nn, figsize=(self.Nn*4, self.Nn*4))\n",
" for unit_id in range(self.num_units):\n",
" r, c = unit_id//self.Nn, unit_id%self.Nn\n",
" ax0 = ax[r, c]\n",
" ax0.plot(self.stim_val[var], self.marginal_tuning[var][unit_id])\n",
" ax0.set(xlabel=var)\n",
"\n",
" fig.suptitle(var + ' selectivity', weight='bold', y=1.01)\n",
" plt.tight_layout()\n",
" plt.show()\n",
" \n",
" def plot_all(self):\n",
" self.plot_joint_tuning()\n",
" for var in self.var_list:\n",
" self.plot_marginal_tuning(var=var)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"pycharm": {
"name": "#%%\n"
}
},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"Simulating data points: 76%|███████▌ | 303/400 [01:44<00:40, 2.42it/s]"
]
}
],
"source": [
"# create and save model of simple cell population response to grating stimuli\n",
"Np = (20, 1, 20, 1)\n",
"# Np = (5, 1, 5, 1)\n",
"Nn = 5\n",
"model_center_fp = simple_cell_model(Nn=Nn, Np=Np, deltaT=None, random_focal_points=False)\n",
"model_random_fp = simple_cell_model(Nn=Nn, Np=Np, deltaT=None, random_focal_points=True)\n",
"\n",
"model_center_fp.save('simple_cell_center_fp')\n",
"model_random_fp.save('simple_cell_random_fp')"
]
},
{
"cell_type": "code",
"execution_count": 10,
2 years ago
"metadata": {
"pycharm": {
"name": "#%%\n"
}
},
"outputs": [],
"source": [
"# load model of simple cell population response to grating stimuli\n",
"model_center_fp = pkl_load('simple_cell_center_fp')\n",
"model_random_fp = pkl_load('simple_cell_random_fp')"
]
},
{
"cell_type": "code",
"execution_count": 11,
2 years ago
"metadata": {
"pycharm": {
"name": "#%%\n"
}
},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAABZgAAAWyCAYAAACdmoWUAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8qNh9FAAAACXBIWXMAAAsTAAALEwEAmpwYAAD5EUlEQVR4nOz9f7itZ10f+L8/Z5+T3+SXIRiSaIJGLDj+gMhobdWKjFStYZyxDVM7qVJzaamFalWordb2S6VOx8FOR6cZxaStwiBSSZ1WpVHK2AoY+aFAgKSAEBIIiEhIIMnZ5/7+sVdwJ7PPOeteZz/3Wnut1+u69rXXeva9nvVZ93qe9/Osz1577WqtBQAAAAAAeh1adgEAAAAAABxMGswAAAAAACxEgxkAAAAAgIVoMAMAAAAAsBANZgAAAAAAFqLBDAAAAADAQjSYAQBYGVXVZl9XzDH2xtnYfzh9Zfujqv76rObXLrsWAADYD4eXXQAAAOzyU7Pvn5hj7G8k+XiS18+78llj92uSfEdr7cYTjGuzi1e21t437/rn8I7sPMY79nGdAACwNNVaO/koAABYAyvQYAYAgLXiIzIAAFgZuz8io6oeW1U/W1Xvr6pPVNXrq+qZu8Y+4iMyquofzq6/sqr+VVV9sqruqKqvn/38tdlpLifJzx/v4zV2NZeT5L2zcV+7x/1d8XC9e9T/t6rq3VV1b1X9m6o6bfbzR3xExmy9rareV1V/r6rumX39wK51nldV//dsDn6/qr5vdpuP78OUAwDAKdFgBgBgFR1KcnOS5yT5aJJXJ3lqkv+nqr7qJLf9H5I8PsnbknxekpfOlr8yyQdnl1+TnY+q2OvjNX5q1+Wfn12/s7P+H0vyX7LzkXR/NclfO8n4z03y7Ul+O8ljk/zTqrpq9rN/nuQvZ+djQ34vyT/srAUAACbjM5gBAFhFFyX5iiSfTPLnW2v3VdVHkzw/yXOT/OcT3PbtSZ6R5Iok70lyeVVd1Fr7F1X1Pya5NM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GkzuwWVbtIzIAAAAAADggNJgBAAAAAFiIBjMAAAAAAAvRYAYAAAAAYCEazAAAAAAALESDGQAAAACAhRxedgGn4iPbR3LDnzx+7vGf3D5j7rF3fOrirlre+kfz15EkD917etf4nifqwXP6fm/wwMVnd40//VDf+g+df+7cY+vodte62+GtvvHnnNk1/oGL5h/fO++9ereZ3/vo5XOPPdr65vFNZ97TNT75YOf41dW2q+u5mPJ5eMtZH+oa/5hDn+4af++xjsy8/3Fd637LH13aNf6hT57WNX6lMrOqa/zWuY+Zf/B2X2Zmq28bO/aYvsx88KKz5h770Nl+xz23I0fSLpt/H5v02NW3OXfvu2/qyMxjra/2t5z14a7xZx16sGv8gT7PbB3r7tx3H3xsX2aetkKZ2Y50vlS6vW/4SuvMna7z/YeO9tVykI9dHftWcrDP98/Z6jvPvP/Y/MeHlTvP7Iipqc8z10nv66yehN6kY9fUmfnAY+fPzMl7JAf4PHPK1+bvvv+zu9bde555PF7dAQAAAACwEA1mAAAAAAAWosEMAAAAAMBCNJgBAAAAAFiIBjMAAAAAAAvRYAYAAAAAYCEazAAAAAAALESDGQAAAACAhWgwAwAAAACwEA1mAAAAAAAWMrzBXFWXV9VvVdVtVfX2qnrebPmFVfWaqrp99v2C0bUB60nuAKPJHWA0uQOMJneAhx1ewn0eTfL9rbU3VdVjkvxeVb0myV9Pcktr7cVV9YIkL0jyQyda0YfuPT8vvuUvzX/Px+YfWts1/+Akhx7sG3/aQ13Du3zqcX21PHD+6V3jDz3UOX77vPkHt65VJ30PNce2+m5w7EjH2L5p6Xbah/t213s+9ri5x/76aRd3rfvXtnqfqN/oHL/v9i136qHqei7
2 years ago
"text/plain": [
"<Figure size 1440x1440 with 25 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAABZgAAAWyCAYAAACdmoWUAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMiwgaHR0c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AAAAAAAAAHpCghkAAAAAAAAA0BMSzAAAAAAAAACAnpBgBgAAAAAAAAD0hAQzAAAAAAAAAKAnJJgBAAAAAAAAAD0hwQwAAAAAAAAA6AkJZgAAAAAAAABAT0gwAwAAAAAAAAB6QoIZAAAAAAAAANATEswAAAAAAAAAgJ6QYAYAAAAAAAAA9IQEMwAAAAAAAACgJySYAQAAAAAAAAA9IcEMAAAAAAAAAOgJCWYAAAAAAAAAQE9IMAMAAAAAAAAAekKCGQAAAAAAAADQExLMAAAAAAAAAICepKIewGlcuHDB3XXXXVEPA8ApffrTn77mnFuIehy9IO4Ao4m4AyBsoxp3iDnA6CLuAAjbUXFnpBLMd911lx599NGohwHglMzsa1GPoVfEHWA0EXcAhG1U4w4xBxhdxB0AYTsq7lAiAwAAAAAAAADQExLMAAAAAAAAAICekGAGAAAAAAAAAPSEBDMAAAAAAAAAoCckmAEAAAAAAAAAPSHBDAAAAAAAAADoCQlmAAAAAAAAAEBPSDADAAAAAAAAAHoydglm55z+/gee0Pv//OtRDwVATFzfqukn/v1j+sQX16MeCoCYeOZKWW/7tUf1XGkr6qEAiIk/+kJJP/arn9JuvRn1UADExAc+9bz+/n94IuphAOjC2CWYzUyf/NJ1/flXbkQ9FAAxMZlO6vc+e0WfXb0Z9VAAxMRes6U//NyavrROghlAOG5s1/Wxz5e0urkb9VAAxMTXbmzrw09eVrPloh4KgBO
2 years ago
"text/plain": [
"<Figure size 1440x1440 with 25 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAABZgAAAWyCAYAAACdmoWUAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8qNh9FAAAACXBIWXMAAAsTAAALEwEAmpwYAAEAAElEQVR4nOzdd3iU15k3/u89o957r0gCCVV6dwNMcQHcnY3tVCe7cRJnN5vkt5tNspvN+8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RJJF5B0RKReRMhH5uq2CE5F7EBEjgN8AWAdgNoAHRWT2NY57AsDuCT72OwD2KKWyAOyx/kxERERERORReM5FRPZ23QLzdAYiAKMA/kkplQNgMYCvXO2xROTRFgKoVEpdVEoNA3gRwIarHPdVAK8CaJ7gYzcAeMb6/TMANtohOxERERERkbPjORcR2dVEZjBPeSBSSjUopU5Yv+8BUA4gcdqpicidJAK4PO7nWlwxTohIIoBNAJ6cxGNjlVINgGUsAhBjw8xERERERESugudcRGRXEykwT2cgGn9MGoA5AI5MOiURuTO5ym3qip9/BeDbSinTFB77yS8u8qiIHBORYy0tLZN5KBERERERkSvgORcR2ZXXBI6Z1EAk8vHDRSQIltnNjyuluq/6IiKPAngUAFJSUq4bqrV3CI+/WIwv3jADN2RF4WqvS0QuoRZA8rifkwDUX3HMfAAvWv8/jwKwXkRGr/PYJhGJV0o1iEg8PrrM60NKqacAPAUA8+fPn9QHJZ3MZoWXjl3GmYZuLMuMwvLMKAT6TmRIJyIiW3v/XAveOtOE5VlRuGlWNHy
2 years ago
"text/plain": [
"<Figure size 1440x1440 with 25 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"model_center_fp.plot_all()"
]
},
2 years ago
{
"cell_type": "code",
"execution_count": 6,
"metadata": {
"collapsed": false,
"pycharm": {
"name": "#%%\n"
}
},
2 years ago
"outputs": [
{
"data": {
"application/javascript": "/* Put everything inside the global mpl namespace */\n/* global mpl */\nwindow.mpl = {};\n\nmpl.get_websocket_type = function () {\n if (typeof WebSocket !== 'undefined') {\n return WebSocket;\n } else if (typeof MozWebSocket !== 'undefined') {\n return MozWebSocket;\n } else {\n alert(\n 'Your browser does not have WebSocket support. ' +\n 'Please try Chrome, Safari or Firefox ≥ 6. ' +\n 'Firefox 4 and 5 are also supported but you ' +\n 'have to enable WebSockets in about:config.'\n );\n }\n};\n\nmpl.figure = function (figure_id, websocket, ondownload, parent_element) {\n this.id = figure_id;\n\n this.ws = websocket;\n\n this.supports_binary = this.ws.binaryType !== undefined;\n\n if (!this.supports_binary) {\n var warnings = document.getElementById('mpl-warnings');\n if (warnings) {\n warnings.style.display = 'block';\n warnings.textContent =\n 'This browser does not support binary websocket messages. ' +\n 'Performance may be slow.';\n }\n }\n\n this.imageObj = new Image();\n\n this.context = undefined;\n this.message = undefined;\n this.canvas = undefined;\n this.rubberband_canvas = undefined;\n this.rubberband_context = undefined;\n this.format_dropdown = undefined;\n\n this.image_mode = 'full';\n\n this.root = document.createElement('div');\n this.root.setAttribute('style', 'display: inline-block');\n this._root_extra_style(this.root);\n\n parent_element.appendChild(this.root);\n\n this._init_header(this);\n this._init_canvas(this);\n this._init_toolbar(this);\n\n var fig = this;\n\n this.waiting = false;\n\n this.ws.onopen = function () {\n fig.send_message('supports_binary', { value: fig.supports_binary });\n fig.send_message('send_image_mode', {});\n if (fig.ratio !== 1) {\n fig.send_message('set_device_pixel_ratio', {\n device_pixel_ratio: fig.ratio,\n });\n }\n fig.send_message('refresh', {});\n };\n\n this.imageObj.onload = function () {\n if (fig.image_mode === 'full') {\n // Full images could contain transparency (where diff images\n // almost always do), so we need to clear the canvas so that\n // there is no ghosting.\n fig.context.clearRect(0, 0, fig.canvas.width, fig.canvas.height);\n }\n fig.context.drawImage(fig.imageObj, 0, 0);\n };\n\n this.imageObj.onunload = function () {\n fig.ws.close();\n };\n\n this.ws.onmessage = this._make_on_message_function(this);\n\n this.ondownload = ondownload;\n};\n\nmpl.figure.prototype._init_header = function () {\n var titlebar = document.createElement('div');\n titlebar.classList =\n 'ui-dialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix';\n var titletext = document.createElement('div');\n titletext.classList = 'ui-dialog-title';\n titletext.setAttribute(\n 'style',\n 'width: 100%; text-align: center; padding: 3px;'\n );\n titlebar.appendChild(titletext);\n this.root.appendChild(titlebar);\n this.header = titletext;\n};\n\nmpl.figure.prototype._canvas_extra_style = function (_canvas_div) {};\n\nmpl.figure.prototype._root_extra_style = function (_canvas_div) {};\n\nmpl.figure.prototype._init_canvas = function () {\n var fig = this;\n\n var canvas_div = (this.canvas_div = document.createElement('div'));\n canvas_div.setAttribute(\n 'style',\n 'border: 1px solid #ddd;' +\n 'box-sizing: content-box;' +\n 'clear: both;' +\n 'min-height: 1px;' +\n 'min-width: 1px;' +\n 'outline: 0;' +\n 'overflow: hidden;' +\n 'position: relative;' +\n 'resize: both;'\n );\n\n function on_keyboard_event_closure(name) {\n return function (event) {\n return fig.key
"text/plain": [
"<IPython.core.display.Javascript object>"
]
2 years ago
},
"metadata": {},
"output_type": "display_data"
2 years ago
},
{
"data": {
"text/html": [
"<div id='86a03be2-705e-425c-a9f6-2a238edbaa75'></div>"
],
"text/plain": [
"<IPython.core.display.HTML object>"
]
2 years ago
},
"metadata": {},
2 years ago
"output_type": "display_data"
},
{
"data": {
"text/plain": [
"[<matplotlib.lines.Line2D at 0x7f97d293b6d0>]"
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
2 years ago
}
],
"source": [
"plt.plot(np.mean(model_center_fp.joint_tuning[0], axis=1))"
]
2 years ago
},
2 years ago
{
"cell_type": "code",
"execution_count": 12,
2 years ago
"metadata": {
"pycharm": {
"name": "#%%\n"
}
},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAABZgAAAWyCAYAAACdmoWUAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8qNh9FAAAACXBIWXMAAAsTAAALEwEAmpwYAAEAAElEQVR4nOz9eZykVXn//7+vqup19mEYGGZGBnAAATcYcUvcUaJGiJ/EQDTiEslCVDRRIYkxmi+JZjGaBROiZDCJEFAiJDEqQRFNBERwAYZlZBmGbVhm7Zneqq7fH12Dzfx6ps91T92nqqtfz8djHt1dfdWpU+c+9/u+71M11ebuAgAAAAAAAAAgqtLuDgAAAAAAAAAAZiYWmAEAAAAAAAAAhbDADAAAAAAAAAAohAVmAA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qu/pLsRdMDvjN2IvS//W19POAn4zFLub+7JGTQvX/sOK7ofpPbV6VXPvfz4xdQL3pSw+E6v+/b74hVH/uy/8zufah0YWhtm94wxGh+q/e+1ddkzt9hy/35X/yW8kPcOS7NyTXWm9sAfjgi2L7y4Nnxs4Z7n1j+url0/7o/0Jtf+1rPwjVH/fp9DGXpHf86leTa//mu68Mtf2LJ9wYqq9Y7IXg778v/ZzkJ78Se3Fo5aGPhernnPJQqH79e9LXCp77M3eG2r798qNC9bf+5fu7JncW1A70Fy74heQHqK9O39er9z2SXCtJZ1/xzVD9p3/mFaH6z37lS8m1v/Kud4fa3vCa2DLfL788lms/+JXAHH30iVDbT7xmdah+8fWx7Vpfn74eFM3vV//iGaH6ng2
2 years ago
"text/plain": [
"<Figure size 1440x1440 with 25 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAABZgAAAWxCAYAAAAbDvc6AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8qNh9FAAAACXBIWXMAAAsTAAALEwEAmpwYAAEAAElEQVR4nOzdeZxkdX3v/9enl+qaqq7u6b1n31dZxxEVEaOAQUUBJQGNW0xCSKJRk5ufJje5mphFcs1NzI3KxSVuiYgoikJEJMgiLgwIA8zCLDALs/QyPd1dvVR3dX1+f5xTPTUzPdNbVfX2fj4e86iqU2f5VtNUV33O57y/5u6IiIiIiIiIiIiIiIxXyVQPQERERERERERERERmJhWYRURERERERERERGRCVGAWERERERERERERkQlRgVlEREREREREREREJkQFZhERERERERERERGZEBWYRURERERERERERGRCVGAWERERkXEzs5+YmZvZe6d6LCMxs4+H4/vyVI9lJGa2PByfT5djFGNMIiIiIjL7qMAsIiIiIhNxB/BpYFu+djjRonW2KGpmy3MW/zwc34/yNb7pzMy+HP4MPp6zuIvgZ/DpMe7mtPXN7IVwv7+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DcBG4O1mtvGU1e4Hznf3C4D3AV8It10E/DGw2d3PISgI3ZCz3T+7+wXhv7MWl0VExvh+lF3vZuDenMUp4HXufj5wAXClmb2i4IMWEREREREREZnFxpLBfBGw2933uvsAcBtwde4K7p50dw8fxgm6lbPKgHlmVgbEgEOTH7aIzFGjvh+FPgB8G2jJLvBAMnxYHv7zEbYVERE
2 years ago
"text/plain": [
"<Figure size 1440x1440 with 25 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAABZgAAAWyCAYAAACdmoWUAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8qNh9FAAAACXBIWXMAAAsTAAALEwEAmpwYAAEAAElEQVR4nOzdeXwkd3kn/s+377tbUrduzSHNbc9he7DxbWwOQwi2OcKx8SYhAcwdsskuye4Sslk2IQn5sSEQ48AGwuWAAdvEjo3xNRgfeMYez+HRNfLM6OyW1C31fX9/f1RVq0dqqauqq08979fLL3ukPmosdXfV832+n4dxzkEIIYQQQgghhBBCCCGEKKWr9wEQQgghhBBCCCGEEEIIaU5UYCaEEEIIIYQQQgghhBCiChWYCSGEEEIIIYQQQgghhKhCBWZCCCGEEEIIIYQQQgghqlCBmRBCCCGEEEIIIYQQQogqVGAmhBBCCCGEEEIIIYQQogoVmAkhhBBCSFUxxn6XMcYZY0/V+1i0IP5dOGNsW6M8Ry2OiRBCCCGEkFKowEwIIYQQQkidMMY+LxaGv7XqW/9X/Ccs86Euuj1j7CnxcX9Xq2MlhBBCCCGkFEO9D4AQQgghhBByMc75H1bz9oQQQgghhGiFOpgJIYQQQkhFiuIZPsEYO8sYW2KMfZMxZl11Ux1j7K8ZYyHG2DRj7D8VPcYfM8bGGGMxxliKMfYKY+zdRd9/E2PsmPj9ZcbYS4yxdxZ9/4PifaLi4/wZY6xkMwVjrI0x9iPG2AJjL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BCCCGEEEJkMlRw3ykAA0V/7gcws+o2hwHcyxgDAC+AtzHGspzz++U+Cef8HgD
2 years ago
"text/plain": [
"<Figure size 1440x1440 with 25 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"model_random_fp.plot_all()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"pycharm": {
"name": "#%%\n"
}
},
"outputs": [],
"source": [
"# ## Apply noise reduction\n",
"# # data = PCA_reduction(data, 5)\n",
"# # data = z_cutoff(data,2)\n",
"\n",
"# ## Analyze shape\n",
"# persistence(data,homdim=2,coeff=2)\n",
"# persistence(data,homdim=2,coeff=3)\n",
"\n",
"# ## Decode first parameter\n",
"# decoding1 = cohomological_parameterization(data, coeff=23)\n",
"# show_feature(decoding1)\n",
"# plot_mean_against_index(data,decoding1,\"orientation\")\n",
"# plot_mean_against_index(data,decoding1,\"phase\")\n",
"# # plot_data(data,transformation=\"PCA\", labels=decoding1,\n",
"# # colors=[\"Twilight\",\"Viridis\",\"Twilight\",\"Viridis\",\"Twilight\"])\n",
"\n",
"# ## Decode second parameter\n",
"# # reduced_data = remove_feature(data, decoding1, cut_amplitude=0.5)\n",
"# # decoding2 = cohomological_parameterization(reduced_data, coeff=23)\n",
"# # show_feature(decoding2)\n",
"# # plot_mean_against_index(data,decoding2,\"orientation\")\n",
"# # plot_mean_against_index(data,decoding2,\"phase\")\n",
"# # plot_data(data,transformation=\"PCA\", labels=decoding2,\n",
"# # colors=[\"Twilight\",\"Viridis\",\"Twilight\",\"Viridis\",\"Twilight\"])\n"
]
},
{
"cell_type": "code",
"execution_count": 16,
2 years ago
"metadata": {
"pycharm": {
"name": "#%%\n"
}
},
"outputs": [],
"source": [
"sp.init_printing()\n",
"k, x0, y0, phi, theta, sigma_x, sigma_y, sigma, x, y = sp.symbols(r'k x_0 y_0 \\phi \\theta \\sigma_x \\sigma_y \\sigma x y')"
2 years ago
]
},
{
"cell_type": "code",
"execution_count": 17,
"metadata": {},
"outputs": [],
"source": [
"sigma_x = sigma_y = sigma"
]
},
{
"cell_type": "code",
"execution_count": 14,
2 years ago
"metadata": {
"pycharm": {
"name": "#%%\n"
}
},
"outputs": [],
"source": [
"grating_f = sp.cos(k * (x - x0) * sp.cos(theta) + k * (y - y0) * sp.sin(theta) + phi)"
]
},
{
"cell_type": "code",
"execution_count": 18,
2 years ago
"metadata": {
"pycharm": {
"name": "#%%\n"
}
},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAiYAAAAdCAYAAACe7KcBAAAACXBIWXMAAA7EAAAOxAGVKw4bAAASBElEQVR4Ae2d65UUtxLHhz0bAF4iuDgDDBEYMrBNBIszwIdvfOPYGdhEAHYG2BGAyQDfCFhPBtz/TyPpavqhR79nR3VOj7r1KNVLpZJavXvny5cvu1OAly9fPhadd3Xd1/W1rt+V96fSbJgCR3ZntWKVQJVAlUCVQJVAlUCxBC6LW6zXgEDkK7pXSoDyr647PBfAFDgKuqtVqwSqBKoEqgSqBKoESiRwUVJ55brfBP2za7IPnnNvp8CR21etVyVQJVAlUCVQJVAlUCiBxXdMtNvxt64wQMgiWW3+CSr+rPvvg2dzqzrPdPOTrl91/0tHeRJHs019rhKoEqgSqBI4Hwlo7mBH/oXlmEUwcK38IYth03gOnAbxLf1ZdMdEynkuOT4YI0vh+FXtf1LaOl+ivN9UdqXrY6yPGI5Yu1pWJVAlUCVQJbC8BOSzn+ninOES8LP6Yo7hYgF8o+vvkR3PgXMkSes3l3yZz1uwWGAiAjCqcMeiRUwqQzjYKcFYPuoiyDkC5RHd3lXaClpcRZVFcbh6Na0SqBKoEqgSWF8C8tnfiYpvYn59YiqbQRBzxn31P2ZRPQfOidleBR0B27tmz4sEJuqYrTGU2hkwUK6L1y//6vrSuGi7Ux4RK8GIqaP0R11NIPgxfag+hvRcF0ZlIBOHq77JFL42SdiMRJ0jz6E4h/A/pE3YZ73Pl8AQWafajC3Pp37bNSUH81pFaZe/n4t4+vowMfI5cE5M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3857QNUrdtZfJx62bS+ZrZzhHxzEYi6teIPys711hkuB/f6wNV
2 years ago
"text/latex": [
"$\\displaystyle e^{- 4 \\sigma^{2} k^{2}} \\cos{\\left(\\phi - k \\left(x_{0} \\cos{\\left(\\theta \\right)} + y_{0} \\sin{\\left(\\theta \\right)}\\right) \\right)} \\cosh{\\left(4 \\sigma^{2} k^{2} \\cos{\\left(\\theta \\right)} \\right)}$"
2 years ago
],
"text/plain": [
" 2 2 \n",
" -4⋅\\sigma ⋅k ⎛ 2 \n",
"ℯ ⋅cos(\\phi - k⋅(x₀⋅cos(\\theta) + y₀⋅sin(\\theta)))⋅cosh⎝4⋅\\sigma ⋅\n",
2 years ago
"\n",
" \n",
" 2 ⎞\n",
"k ⋅cos(\\theta)⎠"
2 years ago
]
},
"execution_count": 18,
2 years ago
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# p = sp.cos(phi) * sp.cos(k*x0*sp.cos(theta) + k*y0*sp.sin(theta)) * sp.exp(k**2 * (sigma_x **2 * (1 + sp.cos(theta))**2 + sigma_y**2 * sp.sin(theta) **2) / 2)\n",
"# p = sp.cosh(k**2 * sigma_x**2 * sp.cos(theta)) * sp.exp(k ** 2 * (1 + sp.cos(theta) ** 2) / 2) * sp.cos(phi - k * (x0 * sp.cos(theta) + y0 * sp.sin(theta)))\n",
"\n",
"p = sp.cosh(k ** 2 * sigma ** 2 * sp.cos(theta) * 4) * sp.exp(-4 * k ** 2 * sigma ** 2) * sp.cos(\n",
" phi - k * (x0 * sp.cos(theta) + y0 * sp.sin(theta)))\n",
2 years ago
"p"
]
},
{
"cell_type": "code",
"execution_count": 19,
2 years ago
"metadata": {
"pycharm": {
"name": "#%%\n"
}
},
"outputs": [],
"source": [
"def calc(theta_, phi_, x_=0, y_=0, k_=1, sigma_x_=1, sigma_y_=1):\n",
" theta_ *= np.pi / 180\n",
" phi_ *= np.pi / 180\n",
" return float(p.evalf(subs={x0: x_, y0: y_, k: k_, sigma_x: sigma_x_, sigma_y: sigma_y_, theta: theta_, phi: phi_}))"
]
},
{
"cell_type": "code",
"execution_count": 20,
2 years ago
"metadata": {
"pycharm": {
"name": "#%%\n"
}
},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "0a14dfe20e9f4103b60b4d6afb1c747c",
2 years ago
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"interactive(children=(FloatSlider(value=1.0, description='k', max=2.0), FloatSlider(value=1.0, description='si…"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"%matplotlib inline\n",
"@widgets.interact(\n",
" k = widgets.FloatSlider(1, min=0, max=2, step=0.1),\n",
" sigma_x = widgets.FloatSlider(1, min=0, max=2, step=0.1),\n",
" sigma_y = widgets.FloatSlider(1, min=0, max=2, step=0.1),\n",
"x = widgets.FloatSlider(0, min=0, max=2, step=0.1),\n",
" y = widgets.FloatSlider(0, min=0, max=2, step=0.1),\n",
")\n",
"def plot_analytic(k=1, sigma_x=1, sigma_y=1, x=0, y=0):\n",
" plt.imshow(np.array([[calc(theta, phi, x, y, k, sigma_x, sigma_y) for phi in range(0, 370, 10)] for theta in range(0, 190, 10)]), extent=[0, 360, 180, 0], cmap='viridis')\n",
" plt.xlabel('phase')\n",
" plt.ylabel('orientation')"
]
},
{
"cell_type": "code",
"execution_count": 29,
"metadata": {
"pycharm": {
"name": "#%%\n"
}
},
"outputs": [],
"source": []
2 years ago
},
{
"cell_type": "code",
"execution_count": 21,
2 years ago
"metadata": {
"pycharm": {
"name": "#%%\n"
}
},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "3254ef17dfc4480ea5b148548586e1ce",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"interactive(children=(FloatSlider(value=0.0, description='stim_theta', max=180.0, step=5.0), FloatSlider(value…"
]
},
"metadata": {},
"output_type": "display_data"
}
],
2 years ago
"source": [
"%matplotlib inline\n",
"@widgets.interact(\n",
" stim_theta = widgets.FloatSlider(0, min=0, max=180, step=5),\n",
" stim_phi = widgets.FloatSlider(90, min=0, max=360, step=10),\n",
" stim_freq = widgets.FloatSlider(1.5, min=0, max=10, step=0.5),\n",
"# RF_theta = widgets.FloatSlider(0, min=0, max=180, step=5),\n",
" RF_phi = widgets.FloatSlider(90, min=0, max=360, step=10),\n",
" RF_freq = widgets.FloatSlider(1.5, min=0, max=10, step=0.5),\n",
" RF_radius = widgets.FloatSlider(0.5, min=0, max=1, step=0.1), \n",
" RF_x = widgets.FloatSlider(0.5, min=-1, max=1, step=0.1),\n",
" RF_y = widgets.FloatSlider(-0.5, min=-1, max=1, step=0.1)\n",
" )\n",
"\n",
"def plot_grating(stim_theta, stim_phi, stim_freq, RF_phi, RF_freq, RF_radius, RF_x, RF_y):\n",
" RF_theta = 0\n",
" stim_grating = (stim_theta/180*np.pi, stim_freq, stim_phi/180*np.pi, 1)\n",
" RF_grating = (RF_theta/180*np.pi, RF_freq, RF_phi/180*np.pi, 1)\n",
" stim_grat_image = gratings.grating_image(grating=stim_grating, plot=False)\n",
" RF_grat_image = gratings.grating_image(grating=RF_grating, gabor=True, rf_sigma=RF_radius, center=(RF_y, RF_x), plot=False)\n",
" \n",
" fig, ax = plt.subplots(1,5, figsize=(25,6))\n",
"\n",
" ax[0].imshow(stim_grat_image,\"gray\", vmin = -1, vmax = 1, extent=[-1,1,1,-1]) \n",
" receptive_field = plt.Circle((RF_x, RF_y), RF_radius, color='b', fill=False)\n",
" ax[0].add_patch(receptive_field)\n",
" ax[0].legend([receptive_field], ['receptive field'])\n",
" ax[0].invert_yaxis()\n",
"\n",
" ax[1].imshow(RF_grat_image,\"gray\", vmin = -1, vmax = 1, extent=[-1,1,1,-1]) \n",
" receptive_field = plt.Circle((RF_x, RF_y), RF_radius, color='b', fill=False)\n",
" ax[1].add_patch(receptive_field)\n",
" ax[1].legend([receptive_field], ['receptive field']) \n",
" ax[1].invert_yaxis()\n",
"\n",
" response = gratings.response(RF_grating, stim_grating, rf_sigma=RF_radius, center=(RF_y, RF_x))\n",
" ax[2].axhline(response)\n",
" ax[2].set(ylim=[0,1])\n",
"\n",
" # Nstim = (20, 1, 20, 1)\n",
" # stim_list = gratings.get_locations(Nstim)\n",
" # rates = np.zeros([len(stim_list)])\n",
" # iterator = trange(0, len(stim_list), position=0, leave=True)\n",
" # iterator.set_description(\"Simulating data stim_list\")\n",
" # for i in iterator:\n",
" # rates[i] = response(stim_list[i], RF_grating, rf_sigma=RF_radius, center=(RF_y, RF_x))\n",
"\n",
" plt.show()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"pycharm": {
"name": "#%%\n"
}
},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3.10.5 64-bit",
2 years ago
"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"
},
"vscode": {
"interpreter": {
"hash": "e7370f93d1d0cde622a1f8e1c04877d8463912d04d973331ad4851f04de6915a"
}
2 years ago
}
},
"nbformat": 4,
"nbformat_minor": 2
}