In [2]:

    %matplotlib inline
    import matplotlib.pyplot as plt
    import matplotlib.cm as cmaps
    import numpy as np

In [3]:

    a = np.linspace(0,1,100)

# Subtractive inhibitionÂ¶

$O = E - k$

In [6]:

    f,ax = plt.subplots()
    print (plt.get_cmap().name)

    plt.register_cmap(name='viridis', cmap=cmaps.viridis)
    plt.set_cmap(cmaps.viridis)

    plt.set_cmap("gray")
    print (plt.get_cmap().name)
    ax.plot(a, a)
    ax.plot(a, a - 0.2, '--', label="$O = E - 0.2$")
    ax.plot(a, a - 0.4, '--', label="$O = E - 0.4$")
    ax.plot(a, a - 0.6, '--', label="$O = E - 0.6$")
    ax.plot(a, a - 0.8, '--', label="$O = E - 0.8$")
    ax.set_xlabel("E")
    ax.set_ylabel("O")
    ax.set_ylim(ymin=0)
    ax.set_xlim(xmin=0)
    ax.set_title("Subtractive Inhibition")
    ax.legend()
    f.show()

    viridis
    gray

    /usr/local/lib/python2.7/dist-packages/matplotlib/figure.py:402: UserWarning: matplotlib is currently using a non-GUI backend, so cannot show the figure
      "matplotlib is currently using a non-GUI backend, "

# Divisive inhibitionÂ¶

$O = E - k \times E$

In [7]:

    f,ax = plt.subplots()
    ax.plot(a, a)
    ax.plot(a, a*0.8, '--', label="$O = E - E \\times 0.2$")
    ax.plot(a, a*0.6, '--', label="$O = E - E \\times 0.4$")
    ax.plot(a, a*0.4, '--', label="$O = E - E \\times 0.6$")
    ax.plot(a, a*0.2, '--', label="$O = E - E \\times 0.8$")
    ax.set_xlabel("E")
    ax.set_ylabel("O")
    ax.legend()
    ax.set_title("Divisive Inhibition")
    f.show()

# Divisive normalizationÂ¶

$O = E - \frac{E}{E+(l/k)}*E$

In [8]:

    f,ax = plt.subplots()
    ax.plot(a, a)
    #ax.plot(a, 0.8*a/(a+0.2), '--')
    ax.plot(a, 0.4*a/(0.8*a+0.4), '--', label="$O = E - \\frac{0.8.E}{0.8.E+0.4}*E$")
    ax.plot(a, 0.6*a/(0.8*a+0.6), '--', label="$O = E - \\frac{0.8.E}{0.8.E+0.6}*E$")
    ax.plot(a, 0.4*a/(0.2*a+0.4), '--', label="$O = E - \\frac{0.2.E}{0.2.E+0.4}*E$")
    ax.plot(a, 0.6*a/(0.2*a+0.6), '--', label="$O = E - \\frac{0.2.E}{0.2.E+0.6}*E$")
    ax.set_xlabel("E")
    ax.set_ylabel("O")
    ax.legend()
    ax.set_title("Divisive Normalization")
    f.show()

In [8]:

    f,ax = plt.subplots()
    ax.plot(a, a)
    #ax.plot(a, 0.8*a/(a+0.2), '--')
    ax.plot(a, 0.4*a/(0.8*a+0.4), '--', label="$O = E - \\frac{0.8.E}{0.8.E+0.4}*E$")
    ax.plot(a, 0.6*a/(0.8*a+0.6), '--', label="$O = E - \\frac{0.8.E}{0.8.E+0.6}*E$")
    ax.plot(a, 0.4*a/(0.2*a+0.4), '--', label="$O = E - \\frac{0.2.E}{0.2.E+0.4}*E$")
    ax.plot(a, 0.6*a/(0.2*a+0.6), '--', label="$O = E - \\frac{0.2.E}{0.2.E+0.6}*E$")
    ax.set_xlabel("E")
    ax.set_ylabel("O")
    ax.legend()
    ax.set_title("Divisive Normalization")
    f.show()