Modelling the response of the retinal cells to the stimuli
# of the jupyter notebook, but not needed in the source code
from theonerig.core import *
from theonerig.processing import *
from theonerig.utils import *
from theonerig.plotting import *
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import axes3d
x = np.linspace(-10,10,100)
plt.figure()
plt.plot(x, sigmoid(x, sigma=1, amp=1, x0=0, y0=0), label="sigma:1 amp:1 x0:0 y0:0")
plt.plot(x, sigmoid(x, sigma=2, amp=1, x0=0, y0=0), label="sigma:2 amp:1 x0:0 y0:0")
plt.plot(x, sigmoid(x, sigma=1, amp=2, x0=0, y0=0), label="sigma:1 amp:2 x0:0 y0:0")
plt.plot(x, sigmoid(x, sigma=1, amp=1, x0=2, y0=0), label="sigma:1 amp:1 x0:2 y0:0")
plt.plot(x, sigmoid(x, sigma=1, amp=1, x0=0, y0=1), label="sigma:1 amp:1 x0:0 y0:1")
_ = plt.legend()
x = np.linspace(-10,10,100)
plt.figure()
plt.plot(x, gaussian(x, sigma=1, amp=1, x0=0, y0=0), label="sigma:1 amp:1 x0:0 y0:0")
plt.plot(x, gaussian(x, sigma=2, amp=1, x0=0, y0=0), label="sigma:2 amp:1 x0:0 y0:0")
plt.plot(x, gaussian(x, sigma=1, amp=2, x0=0, y0=0), label="sigma:1 amp:2 x0:0 y0:0")
plt.plot(x, gaussian(x, sigma=1, amp=1, x0=2, y0=0), label="sigma:1 amp:1 x0:2 y0:0")
plt.plot(x, gaussian(x, sigma=1, amp=1, x0=0, y0=1), label="sigma:1 amp:1 x0:0 y0:1")
_ = plt.legend()
x = np.linspace(-10,10,100)
plt.figure()
plt.plot(x, sum_of_gaussian(x, sigma_1=1, amp_1=1, x0_1=0,
sigma_2=2, amp_2=-0.5, x0_2=0, y0=0), label="sigma_1:1 amp_1:1 x0_1:0 sigma_2:2 amp_2:-0.5 x0_2:0")
plt.plot(x, sum_of_gaussian(x, sigma_1=1, amp_1=1, x0_1=0,
sigma_2=2, amp_2=-0.5, x0_2=-2, y0=0), label="sigma_1:1 amp_1:1 x0_1:0 sigma_2:2 amp_2:-0.5 x0_2:-2")
_ = plt.legend()
x,y = np.meshgrid(np.linspace(-10,10,100),np.linspace(-10,10,100))
fig = plt.figure(figsize=(10,4))
ax = fig.add_subplot(121, projection='3d')
z = gaussian_2D((x,y), sigma_x=1, sigma_z=1, amp=1, theta=0, x0=0, z0=0, y0=0).reshape(100,100)
ax.plot_wireframe(x, y, z, rstride=4, cstride=4, label="sigma:1 amp:1")
_ = ax.legend()
ax = fig.add_subplot(122, projection='3d')
z = gaussian_2D((x,y), sigma_x=2, sigma_z=2, amp=1, theta=0, x0=0, z0=0, y0=0).reshape(100,100)
ax.plot_wireframe(x, y, z, rstride=4, cstride=4, label="sigma:2 amp:1", color='r')
_ = ax.legend()
x,y = np.meshgrid(np.linspace(-10,10,100),np.linspace(-10,10,100))
fig = plt.figure(figsize=(5,4))
ax = fig.add_subplot(111, projection='3d')
z = sum_of_2D_gaussian((x,y), sigma_x_1=1, sigma_z_1=1, amp_1=1, theta_1=0, x0_1=0, z0_1=0,
sigma_x_2=2, sigma_z_2=2, amp_2=-0.5, theta_2=0, x0_2=0, z0_2=0, y0=0).reshape(100,100)
ax.plot_wireframe(x, y, z, rstride=3, cstride=3, label="sigma:1 amp:1")
_ = ax.legend()
x = np.linspace(0,10,100)
plt.figure()
plt.plot(x, exponential_decay(x, tau=1, baseline=0, amplitude=1), label="tau:1 baseline:0 amp:1")
plt.plot(x, exponential_decay(x, tau=2, baseline=0, amplitude=1), label="tau:2 baseline:0 amp:1")
plt.plot(x, exponential_decay(x, tau=1, baseline=.5, amplitude=1), label="tau:1 baseline:0.5 amp:1")
plt.plot(x, exponential_decay(x, tau=1, baseline=0, amplitude=2), label="tau:1 baseline:0 amp:2")
_ = plt.legend()
x = np.linspace(0,5,100)
plt.figure(figsize=(10,4))
plt.subplot(1,2,1)
plt.plot(x, sin_exponent(x, amp=1, phi=0, freq=0.5, exp=1), label="freq:0.5 exp:1")
plt.plot(x, sin_exponent(x, amp=1, phi=0, freq=0.5, exp=2), label="freq:0.5 exp:2")
_ = plt.legend()
plt.subplot(1,2,2)
plt.plot(x, sin_exponent(x, amp=1, phi=0, freq=0.5, exp=2), label= "phi:0 freq:1 exp:2")
plt.plot(x, sin_exponent(x, amp=1, phi=0, freq=0.5, exp=8), label= "phi:0 freq:1 exp:8")
plt.plot(x, sin_exponent(x, amp=1, phi=np.pi, freq=0.5, exp=8), label="phi:3.14 freq:1 exp:8")
_ = plt.legend()
x = np.linspace(0,10,200)
plt.figure()
plt.plot(x, sinexp_sigm(x, sigma=1, x0=4, y0=0, amp=1, phi=0, freq=1, exp=2), label="phi=0")
plt.plot(x, sinexp_sigm(x, sigma=1, x0=4, y0=0, amp=1, phi=np.pi, freq=1, exp=2), label="phi=3.14")
_ = plt.legend()