Skip to content

Commit

Permalink
Cosmetic update to match PEP8
Browse files Browse the repository at this point in the history
  • Loading branch information
ycanerol committed May 16, 2017
1 parent 454cf40 commit ab9ab39
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 12 deletions.
8 changes: 4 additions & 4 deletions LNP_model
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,19 @@ Created on Tue May 9 18:11:51 2017
import numpy as np
from scipy.stats.mstats import mquantiles

total_frames=400000
total_frames=10000
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=.5 # The weight of combination for the two filters
cweight=1 # 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_index1=2 # Change filter type here
filter_index2=1

def linear_filter(t,filter_index): # Define filter according to choice
Expand Down
24 changes: 16 additions & 8 deletions stc.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,21 @@
Spike-triggered covariance
"""
from datetime import datetime
execution_timer=datetime.now()

def stc(spikes,stimulus,filter_length):
covariance=np.matrix(np.zeros(filter_length,filter_length))
sta=sta(spikes,stimulus,filter_length)
sta_temp=sta(spikes,stimulus,filter_length)
def stc(spikes,stimulus,filter_length,sta_temp):
covariance=np.matrix(np.zeros((filter_length,filter_length)))

for i in range(filter_length,total_frames):
snippet=stimulus[i:i-filter_length:-1]
# Snippets are inverted before being added
snpta=[snippet-sta]
covariance=covariance+snpta.T*snpta*spikes[i]
return covariance/fil
if spikes[i]!=0:
snippet=stimulus[i:i-filter_length:-1]
# Snippets are inverted before being added
snpta=np.matrix(snippet-sta_temp)
covariance=covariance+(snpta.T*snpta)*spikes[i]
return covariance/(sum(spikes)+filter_length-1)

recovered_stc=stc(spikes,stimulus,filter_length,sta(spikes,stimulus,filter_length))
runtime=str(datetime.now()-execution_timer).split('.')[0]
print('Duration: {}'.format(runtime))

0 comments on commit ab9ab39

Please sign in to comment.