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.

311 lines
46 KiB

{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Separability of phase and orientation"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"**Imports**"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"%matplotlib inline\n",
"\n",
"import sys\n",
"import seaborn as sns\n",
"import sympy as sp\n",
"import numpy as np\n",
"import pandas as pd\n",
"from matplotlib import pyplot as plt\n",
"sys.path.insert(0, './model')\n",
"sys.path.insert(0, './numerical')\n",
"\n",
"from sym_model import *\n",
"from model import decoding\n",
"from model import persistence\n",
"from utils import get_orientation_phase_grid"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"p_func = sp.lambdify(\n",
" (x0, y0, k, sigma, phi_rf, theta_rf, phi_grating, theta_grating, ),\n",
" p, 'numpy')\n"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
"\n",
"n_theta, n_phi = 36, 72\n",
"# n_theta, n_phi = 9, 12\n",
"step_phi, step_theta = 360 // n_phi, 180 // n_theta"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [],
"source": [
"grid = get_orientation_phase_grid(step_phi, step_theta)\n",
"grid = grid.reshape((-1, 2))"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [],
"source": [
"res = (np.abs(p_func(0, 0, 6, 1, 0, 0, grid[:, 1], grid[:, 0])) * 10).reshape((n_phi, n_theta))\n",
"get_res = lambda x, y: (np.abs(p_func(x, y, 6, 1, 0, 0, grid[:, 1], grid[:, 0])) * 10).reshape((n_phi, n_theta))"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [],
"source": [
"def reconstruct(img: np.ndarray):\n",
" x_avg = np.mean(img, axis=0)\n",
" y_avg = np.mean(img, axis=1)\n",
" new_image = np.outer(y_avg, x_avg)\n",
" new_image *= np.sum(img) / np.sum(new_image)\n",
" return new_image"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"<matplotlib.image.AxesImage at 0x7fd0a2f05e40>"
]
},
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAI4AAAD7CAYAAAC8Eqx6AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8rg+JYAAAACXBIWXMAAAsTAAALEwEAmpwYAAAOx0lEQVR4nO3dW6xc113H8e9v5tx8v+RiRbZpgohS9aUOmDRVKwRNU4WCmkqgKAahgiL5BVAiECT0CSQqhZfSPlWKIGCJ0DQkrYiqqm0IqQAJgp0LtLFzcaOE2EriOD6JHdvnOn8eZvus5ZMZe591zhmPZ34fyTpr1uw9e885P+/Za/be/62IwGypGpd6Bezy5OBYEQfHijg4VsTBsSIOjhVZVnAk3SbpJUmHJd23Uitl/U+l3+NIagIvA7cCR4D9wJ6IOLhyq2f9amQZ894EHI6IVwEkPQzcDnQNzpjGY4J1y1ik9dopJo9HxFWL+5cTnO3AG9njI8AnLjTDBOv4hG5ZxiKt1/4lHn29U/9yglOLpL3AXoAJ1q724qxHlrNzfBTYmT3eUfWdJyIeiIjdEbF7lPFlLM76yXKCsx+4XtJ1ksaAO4HHV2a1rN8Vf1RFxJykPwB+ADSBByPihRVbM+try9rHiYjvAd9boXWxy4i/ObYiDo4VcXCsiINjRRwcK+LgWBEHx4o4OFbEwbEiDo4VcXCsiINjRRwcK+LgWBEHx4o4OFbEwbEiDo4VcXCsiINjRRwcK3LR4Eh6UNIxST/J+rZKekLSK9XPLau7mtZv6mxx/h64bVHffcCTEXE98GT12IbIRYMTEf8GnFjUfTuwr2rvA764sqtl/a50H2dbRLxZtd8Ctq3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 432x288 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"plt.imshow(res)"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"<matplotlib.image.AxesImage at 0x7fd0a2ff9ab0>"
]
},
"execution_count": 8,
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAI4AAAD7CAYAAAC8Eqx6AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8rg+JYAAAACXBIWXMAAAsTAAALEwEAmpwYAAAOvklEQVR4nO3da4xc513H8e9vZm++X3Kxojg0QUSp+qYJmDRVKwRNU4WCmkqgKAGhgiLtG0CJQJDQVyBRKbwp7atKFgQsEZqGpBVRVbUNIRUgQbBzgTZ2Lm6UEFtJHMeb2LG91/nzYo73ebyesc8+uzsez/w+krXPPHPOnDO7P585z5xz/kcRgdlyNS72CtilycGxIg6OFXFwrIiDY0UcHCuyouBIul3Sy5IOSnpgtVbK+p9Kv8eR1AReAW4DDgF7gbsjYv/qrZ71q5EVzHszcDAiXgOQ9AhwB9A1OGMajwk2rGCR1msnmDoaEVcs7V9JcK4G3sweHwI+cb4ZJtjAJ3TrChZpvfYv8dgbnfpXEpxaJE0CkwATrF/rxVmPrGTn+DBwTfZ4Z9V3lojYHRG7ImLXKOMrWJz1k5UEZy9wvaTrJI0BdwFPrM5qWb8r/qiKiHlJfwD8AGgCD0XEi6u2ZtbXVrSPExHfA763SutilxB/c2xFHBwr4uBYEQfHijg4VsTBsSIOjhVxcKyIg2NFHBwr4uBYEQfHijg4VsTBsSIOjhVxcKyIg2NFHBwr4uBYEQfHijg4VuSCwZH0kKQjkn6S9W2X9KSkV6uf29Z2Na3f1Nni/D1w+5K+B4CnIuJ64KnqsQ2RCwYnIv4NOLak+w5gT9XeA3xxdVfL+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text/plain": [
"<Figure size 432x288 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"plt.imshow(reconstruct(res))"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {},
"outputs": [],
"source": [
"def separability(img):\n",
" return (np.mean(np.abs(img)) - np.mean(np.abs(img - reconstruct(img)))) / np.mean(np.abs(img))"
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAABkAAAAOCAYAAADaOrdAAAAACXBIWXMAAA7EAAAOxAGVKw4bAAABLklEQVQ4Ea2U+w3BUBTGEQM0bMAGHhvUBtgAa/Q/MQImEDbQDYQNdIM23aB+X3NvQ3Mj5PYkX8+j53Vfp10URctSFEUj5DMYI+fW/gvHf2f8UvgQ7LAlsnURAvgRZGACBuAvIsedgC38okCT8w6fgaTDJwcLsOH/SU7/EHFr/AN4WUCxyNoF6XvpHX08aUH8w5Hjhi2kYNBEkZBk2uo6leeBMfQqoi7rmR16z6sICXsm6beb2Mh2OZr/MPV9V+I6C1vBrjL1KmKuqpK6zsbaEq8ipuUYPjDyO7MriZsoojGkSVGnMYaHVlsv0jeetosqUNcVFEAjpCL0A0oGn1sjsrZqCVaytTUgMaobkR6WHPSC9Ziu/FOSkpCfCDFcI6gidMVoQOZAA3IKNMvKSfACZ3hjjjX0FpgAAAAASUVORK5CYII=",
"text/latex": [
"$\\displaystyle 1.0$"
],
"text/plain": [
"0.9999999999999996"
]
},
"execution_count": 10,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"separability(res)"
]
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"Text(0.5, 0, 'x')"
]
},
"execution_count": 11,
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUg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PVedNmzat8ElChefYqCHDMIx2xDcj+EH6dzWAVenf1Zn3IYYA7J95PyPdNoaqPqmqp6vqXADnpduGKckLEIocYqOGGB9BT3f1W5q33TAMo9Hk9k6qenL6d5aqHpD+da8DiGPfDWCOiMwSkSlIFrxfmm0gIvuIiJNhEYBvT+wy/IQih9iooZMO3W+nNpMEuOCU14+937XCMR3abhiG0WioYaqInCoin0tfJzOfUdVtAD4BYDmSVc2uV9X7ROSzInJq2uztANaKyIMA9gVwSeErIAhFDjFRQ/0DQ7jul0/stF8qcgjyahblbTcMw2g0wcxiEVkC4E8AXJ1u+pSI/KmqBusNqeoyAMsqtp2f+f8GADcUkngCMIXn9tqtu2pn7WYNly1fi5HtO6sLt66xO5aVoTAMo9VgSky8E8BhqrodAETkSgADaKPCc/0DQ/jDS9t22t7dJWOzBt8qZtl9MZPO+geGglVTDcMwaoVdoawXwLPp/1PLEaU8QoXn8kb7kyfJWMebt4qZ2+eINSPoHxjCOdevgRNraHgLzrl+zZjMhmEYsWB8BJcCGBCR76azgdUoyZZfFhMNH90ysn0saihvFbNJMj7XINaM4B9vugeVumm7JtsNwzBiElQEqnoNgCMB3ITEnn+Uql5XtmAxmWj4KLAjamj+3D4cPmvnFcq6KpRDrDIUm3OS1/K2G4ZhTBQ2uP0oJBE+b0//bymY8NE8slFDdzz87E77K5ezZMpQ2CpmhmE0E8zi9V8F8LcABgHcC+BvROQrZQsWEyZ8dPcp1eP8s1FDTGE6pgyFYRhGM8E4i48F8Me
"text/plain": [
"<Figure size 432x288 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"xs = np.linspace(0, 100, 10001)\n",
"data = [separability(get_res(0, x)) for x in xs]\n",
"plt.scatter(xs, data)\n",
"plt.ylabel('Separability score (0-1) at point (0, x)')\n",
"plt.xlabel('x')"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": 14,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"<matplotlib.image.AxesImage at 0x7fd0a1365960>"
]
},
"execution_count": 14,
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAEIAAAD8CAYAAADDlHLtAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8rg+JYAAAACXBIWXMAAAsTAAALEwEAmpwYAAAVQElEQVR4nO2dWYwkyVnHf19EZtbZ3dPXzM7O7npZy9hYQmvwCsuCBxACGV5sS5aFhZAFBhsJSyBhCeMnC154wPgJIS3Ckh+wABkQBiwbsEAcMuBdH4AvWK+9x3h2rp7urq4zM+LjIaOqq3u6q6unq3MHEz8pVVmZUZER/4yojPgq81+iqkTAvNwFuF+IQgSiEIEoRCAKEYhCBM4khIi8SUS+LiLPiMj7F1WolwO513GEiFjgv4EfA14EPge8Q1W/srjiVcdZWsQPAM+o6rOqOgL+CHjzYopVPckZPnsFeGHq/YvAG2Z9IJOa1mmd4ZBno8OdW6q6edS+swgxFyLybuDdAHWavEF+9LwPeSx/px9/7rh9Z+kaV4GHp94/FLYdQFWfVNUnVPWJlNoZDne+nEWIzwGvEpHvEpEM+CngE4spVvXcc9dQ1UJE3gt8GrDAR1T1ywsrWcWc6TtCVT8JfHJBZXlZiSPLQBQiEIUIRCECUYhAFCIQhQhEIQJRiEAUIhCFCEQhAlGIwIlCiMjDIvL3IvIVEfmyiPxy2P5BEbkqIl8My0+ef3HPj3mm4QXwq6r6eRFZAp4Wkb8N+z6sqr99fsWrjhOFUNVrwLWw3hGRr1IGbheDyMKy4gy3OJzqO0JEHgW+D/i3sOm9IvIfIvIREVk99dFPEkHM3ctJ+d2jsHNHqESkDfwp8Cuquisivwf8JqDh9UPAzx3xuf0otrQwzeb+Tu8BmPzI5BU0bBuvj/eNKygGMbIvihFkvM9MCXWUIHvH128uIUQkpRThD1X1z0Lh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228DL99TKAsm3igSiEIEohCBKEQgChGIQgSiEIEoRCAKEYhCBKIQgShEIAoRqPT+CBHpAF8/p+w3gFsnpHnFy+YfcYivH3ejxlkRkafOknfsGoEoRKBqIZ68X/Ou9MvyfiZ2jUAUIlCZEIuyczu3h+1U9dwXSjOebwCPARnwJeC195jXZeD7w/oSpU3ca4EPAu+71zJWZdq3MDs3Vb2mqp8P6x1gIQ/b3bMQwbTvd4GfoDwj7xCR1x6T/Cg7tzMXfpEP2/2fNe07/LAd8HvAK4HXUT6e+aHT5FeVad9V4OGxad8S5clalrVfuteDj/MA/nRZ1qbfT1iWtZ+dfn+/mPZ9ryWJpn3AW6NpHxM7t/uWaNoXiKZ9gTjXCEQhAlGIQBQiEIUIRCECUYhAFCIQhQhEIQJRiEAUIhCFCETTvkA07QtUb9q3SJO+0zLj9+7qTftmme+d2qRvzrRz5FW9aV+jvr/z8C0Jx7WWo25dmDftdLr7xrQv2dADDoPHH2/82YWmnUWlpn2kKXL54v776ad1p835wquM9x1+qnfetIcN/3aPL1qlpn1qDe5CMxT8UKGNKU0vpv2i/JQ1AiH92EdinGycfjrtlBAn+U+NqdS0z9UMO69qBRFKIxzjNPjPBQeQQz1H/HhRRA/61c1KC/t5TixY/o1jqfQ+S1eHO6+R4FooyJQbkE9AE50UvNx4MJ34fYM+taBWp5wDQFyZNri7TRn66dGncopqHUUyJX94VLZcJ1AYpJCyoEm5iFEwWnY4FdQJFAJeyrRJ2J9o6UBixoYb+2mlKJuKJsHNyOiJw5dKhdhsdXjP6/+RXC09l7HnamznDawoK2mflaRP04xIQzMZ+JSez9gt6hPjvlYyopUM70qbq6XnM3aKBjt5A4ClZMByMqBuclJxfGBG2SoVIpOCh7ItnAo9X2PHNamZglQcG+neAbc
"text/plain": [
"<Figure size 432x288 with 3 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"fig, ax = plt.subplots(3, 1)\n",
"\n",
"res2 = (np.abs(p_func(0, 5, 6, 1, 0, 0, grid[:, 1], grid[:, 0])) * 10).reshape((n_phi, n_theta))\n",
"ax[0].imshow(res2)\n",
"ax[1].imshow(reconstruct(res2))\n",
"ax[2].imshow(res2 - reconstruct(res2))"
]
}
],
"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
}