PKJ Current parameters tuning

Goal: choose parameters for a random current injected into the PKJ every time step such that the model exhibits ISI distribution statistics that match those described in Hausser and Clark (1997) in the presence of GABA blockers.

  • Hausser and Clark (1997) Figure 1C show that under control conditions, there is a distribution of mean firing rates among PKJ
    • We refer to this as a 'prior distribution' and make no attempt to model it. Instead we model the parameters for a single neuron -- the average neuron -- having mean firing rate described below.
  • Hausser and Clark (1997) report mean firing rates of 54.7 Hz (= 38.8 * 1.41) and CV of .10
  • Hausser and Clark (1997) Figure 2 shows an example ISI histogram of an PKJ that is symmetric (Gaussian looking) with mean firing rate of 40 Hz, CV of .18.
  • We model random currents injected every time step drawn from a gamma distribution with parameters k,theta chosen to match either case.
    • We choose parameters and generate a representative example for display at 40 Hz.
  • We use a grid search over a range of parameters of the probability distribution and measure their effect (mean firing rate and CV) of the neuron's ISI distribution.
    • This grid search is performed in a separate python script to take advantage of parallel processing.
    • The results are loaded in and analyzed using Pandas

In [1]:
%load_ext autoreload
%autoreload 2
import time
import sys
sys.path.append('../../')
from brian import *
from MLI_PKJ_net import *
from statsmodels.tsa.stattools import acf
from pandas import *
set_global_preferences(useweave=True, usenewpropagate=True, usecodegen=True, usecodegenweave=True)
defaultclock.dt = .25*ms


/home/bill/anaconda/lib/python2.7/site-packages/brian/utils/sparse_patch/__init__.py:39: UserWarning: Couldn't find matching sparse matrix patch for scipy version 0.13.3, but in most cases this shouldn't be a problem.
  warnings.warn("Couldn't find matching sparse matrix patch for scipy version %s, but in most cases this shouldn't be a problem." % scipy.__version__)
/home/bill/anaconda/lib/python2.7/site-packages/brian/synapses/spikequeue.py:490: UserWarning: Using C++ SpikeQueue
  warnings.warn('Using C++ SpikeQueue')

Data analysis from current parameter sweep


In [ ]:
# this file is the output of the parameter sweep python script
data_file = '~/data/neuron_models/molecular_layer/PKJ_gamma_current_param_sweep/2013-10-17T13:14:33.097397/results.txt'

In [5]:
with open(data_file) as f:
    results = read_csv(f,delimiter='\t')
target = array([40.,.18])
results['error'] = ((results.ix[:,-2:] - target).abs()/target).sum(axis=1)
results['mean'] = results.ix[:,0] + results.ix[:,1]
results.sort(columns='error')[:5]


Out[5]:
k theta PKJ_mean_firing_rate PKJ_cv error mean
144 0.430303 0.195962 39.166667 0.178643 0.028371 0.626265
146 0.430303 0.200000 40.000000 0.173559 0.035784 0.630303
145 0.430303 0.197981 39.333333 0.174104 0.049422 0.628284
141 0.430303 0.189904 38.166667 0.177427 0.060128 0.620207
142 0.430303 0.191923 38.333333 0.186023 0.075128 0.622226

Run network with parameters


In [12]:
def run_net(T,N_PKJ,k,theta):
    '''
    This function runs a network of N_PKJ PKJs and monitors the results
    '''
    
    reinit()
    reinit_default_clock()
    clear(True)
    
    PKJ = PurkinjeCellGroup(N_PKJ)
    
    @network_operation(Clock(dt=defaultclock.dt))
    def random_current():
        PKJ.I = gamma(k,theta,size=len(PKJ)) * nA
        
    # Monitors
    MS_PKJ = SpikeMonitor(PKJ)
    MR_PKJ = PopulationRateMonitor(PKJ,bin=1*ms)
    MISI_PKJ = ISIHistogramMonitor(PKJ,bins=arange(0,162,2)*ms)
    MV_PKJ = StateMonitor(PKJ,'V',record=0)
    
    run(T*msecond)
    
    return MS_PKJ, MR_PKJ, MISI_PKJ, MV_PKJ

Analsis and Plotting


In [13]:
T = 300000
N_PKJ = 1

# choice of parameters
k, theta = 0.430303,0.195962

# run simulation
MS_PKJ, MR_PKJ, MISI_PKJ, MV_PKJ = run_net(T,N_PKJ,k,theta)


brian.stateupdater: WARNING  Using codegen CStateUpdater

In [21]:
# save monitors for reproducibility
monitors = {'MS_PKJ_iso':MS_PKJ, 'MR_PKJ_iso':MR_PKJ, 'MISI_PKJ_iso':MISI_PKJ, 'MV_PKJ_iso':MV_PKJ}
out_dir = '~/'
for name, mon in monitors.iteritems():
    cPickle.dump(mon, open(out_dir+'%s.pkl'%name,'w'))

In [2]:
load_monitors = False
if load_monitors:
    in_dir = '~/'
    MS_PKJ = cPickle.load(open(in_dir+'MS_PKJ_iso.pkl'))
    MV_PKJ = cPickle.load(open(in_dir+'MV_PKJ_iso.pkl'))
    MISI_PKJ = cPickle.load(open(in_dir+'MISI_PKJ_iso.pkl'))
    MR_PKJ = cPickle.load(open(in_dir+'MR_PKJ_iso.pkl'))

In [3]:
fig = figure(figsize=(25,5), dpi=600)
# Plot trace
ax = fig.add_subplot(131)
MV_PKJ.insert_spikes(MS_PKJ)
ax.plot(MV_PKJ.times[:4000],(MV_PKJ.values[0,:4000]), color='#0B486B')
xlim([-.1,1.])
add_scalebar(ax)
ax.spines['top'].set_visible(False)
ax.spines['right'].set_visible(False)
ax.spines['left'].set_visible(False)
ax.spines['bottom'].set_visible(False)

# Plot ISI
ax = fig.add_subplot(132)
plot_ISI_histogram(MISI_PKJ, MS_PKJ, MR_PKJ, (20,0),(75,MISI_PKJ.count.max()*.7),color='#0B486B',edgecolor='w')
simpleaxis(ax)
xlim([0,150])
tick_params(labelsize=18)

# Plot spike autocorrelation
ax = fig.add_subplot(133)
plot_spike_correlogram(MS_PKJ.spiketimes[0],MS_PKJ.spiketimes[0], bin=1*ms, width=200*ms, ax=ax,color='#0B486B')
simpleaxis(ax)
tick_params(labelsize=18)

tight_layout()
fig.subplots_adjust(wspace=.3)
fig.savefig('PKJ_iso_color.tiff',dpi=600*6.93/25)
fig.savefig('PKJ_iso_color.png',dpi=600*6.93/25)



In [34]:
# statistical tests
from scipy.stats import normaltest, shapiro
isis = diff(MS_PKJ.spiketimes[0])
shapiro(isis[:5000])


Out[34]:
(0.9942054748535156, 2.499767970745581e-13)

In [ ]: