Making the Mehaffey&Doupe-like plasticity plot


In [ ]:
%matplotlib inline
import matplotlib.pyplot as plt
import seaborn as sns
sns.set_style('white')

from matplotlib.ticker import AutoMinorLocator

# comment out the next line if not working on a retina-display computer
import IPython
IPython.display.set_matplotlib_formats('retina')

In [ ]:
import numpy as np

In [ ]:
def single_spike_effect(lags, tau1=80.0, tau2=40.0):
    """ Calculate weight change from single spikes with given lag(s). """
    lags = np.asarray(lags)
    pos_mask = (lags >= 0)
    neg_mask = np.logical_not(pos_mask)
    
    result = np.zeros(lags.shape)
    result[pos_mask] = -np.exp(-lags[pos_mask]/40.0)/240.0
    result[neg_mask] = np.exp(lags[neg_mask]/80.0)/120.0 - np.exp(lags[neg_mask]/40.0)/80.0
    
    return result

In [ ]:
lag_values = np.arange(-600.0, 600.0, 1.0)
delta_w_values = 1 + 30.0*sum(single_spike_effect(lag_values + delta) for delta in range(0, 12, 2))

In [ ]:
plt.figure(figsize=(3.0, 2.41))

plt.axhline(1, ls='--', color=[0.5, 0.5, 0.5], lw=1, dashes=[4, 1])
plt.axvline(0, ls='--', color=[0.695, 0.695, 0.695], lw=1, dashes=[4, 1])

plt.plot(lag_values, delta_w_values, 'k', lw=1)
plt.ylim(0.2, 1.701)
plt.xlim(-600, 600)

ax = plt.gca()
ax.spines['right'].set_color('none')
ax.spines['top'].set_color('none')

ax.spines['bottom'].set_linewidth(0.75)
ax.spines['left'].set_linewidth(0.75)

plt.minorticks_on()

ax.xaxis.set_tick_params(direction='out', length=4, top='off', which='major', labelsize=8, width=0.75)
ax.yaxis.set_tick_params(direction='out', length=4, right='off', which='major', labelsize=8, width=0.75)

ax.xaxis.set_tick_params(direction='out', length=2.5, top='off', which='minor', width=0.75)
ax.yaxis.set_tick_params(direction='out', length=2.5, right='off', which='minor', width=0.75)

ax.xaxis.set_minor_locator(AutoMinorLocator(2))
ax.yaxis.set_minor_locator(AutoMinorLocator(2))

plt.xlabel('Lag (ms)', fontsize=8)
plt.ylabel('Synaptic strength (normalized)', fontsize=8)

plt.savefig('figs/simulated_mehaffey_plasticity.pdf', bbox_inches='tight')