Skip to content

Commit

Permalink
Recovered non-linearity is now plotted with
Browse files Browse the repository at this point in the history
smaller points.
  • Loading branch information
ycanerol committed May 16, 2017
1 parent 97a9dfb commit 60bf779
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
10 changes: 5 additions & 5 deletions LNP_model
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,20 @@ Created on Tue May 9 18:11:51 2017
import numpy as np
from scipy.stats.mstats import mquantiles

total_frames=100000
total_frames=400000
dt=0.001 # Time step
t=np.arange(0,total_frames*dt,dt) # Time vector
filter_time=.6 # The longest feature RGCs respond to is ~600ms
filter_length=int(filter_time/dt) # Filter is filter_length frames long

cweight=.45 # The weight of combination for the two filters
cweight=.5 # The weight of combination for the two filters

def make_noise(): # Generate gaussian noise for stimulus
return np.random.normal(0,9,total_frames)
#stimulus=make_noise()
stimulus=make_noise()

filter_index1=1 # Change filter type here
filter_index2=4
filter_index2=1

def linear_filter(t,filter_index): # Define filter according to choice
if filter_index==1: f=np.exp(-(t-0.15)**2/0.002)-np.exp(-(t-0.17)**2/0.001)
Expand All @@ -39,7 +39,7 @@ filtered1=np.convolve(filter_kernel1,stimulus,mode='full')[:-filter_length+1]
filtered2=np.convolve(filter_kernel2,stimulus,mode='full')[:-filter_length+1]

k=np.linspace(-30,30,1001)
nlt_index1=2
nlt_index1=1
nlt_index2=5

def nlt(k, nlt_index):
Expand Down
5 changes: 3 additions & 2 deletions plotLNP.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
fontsize='x-small')
plt.grid()
plt.title('Linear transformation')
plt.xlabel('Time [ms]')


plt.subplot(rows,columns,2)
Expand All @@ -43,10 +44,10 @@
plt.plot(k,cweight*nlt(k,nlt_index1)+(1-cweight)*nlt(k,nlt_index2),alpha=.6)

plt.subplot(rows,columns,2)
plt.scatter(logbins,spikecount_in_logbins,alpha=.6)
plt.scatter(logbins,spikecount_in_logbins,s=6,alpha=.6)

plt.subplot(rows,columns,2)
plt.scatter(quantiles,spikecount_in_bins,alpha=.6)
plt.scatter(quantiles,spikecount_in_bins,s=6,alpha=.6)
plt.legend(['Non-linear transformation 1',
'Non-linear transformation 2',
'{}*NLT1+{}*NLT2'.format(cweight,np.round(1-cweight,2)),
Expand Down

0 comments on commit 60bf779

Please sign in to comment.