def comparenflinl(ll, ecs, retina, pt_inl, pt_nfl, rsample, dolayer, engine='joblib', dojit=True, n_jobs=-1, tol=.05):    
    tm = ec2b.TemporalModel(lweight=ll)                             
    inl_r =  ec2b.pulse2percept(tm, ecs,r, pt_inl, rsample=rsample,  dolayer='INL', dojit=False, engine='serial')
    
    nfl_r =  ec2b.pulse2percept(tm, ecs, r, pt_nfl, rsample=rsample, dolayer='NFL', dojit=False, engine='serial')
    print(ll)
    print(np.max(inl_r.data))
    print(np.max(nfl_r.data))
    return (np.max(10*inl_r.data)-np.max(10*nfl_r.data)) ** 2
                xlo=-500,
                xhi=500,
                axon_lambda=8)

# the effective current spread that incorporates axonal stimulation

myout = []
d = .1
fps = 30
pt = []
inl_out = []
nfl_out = []

modelver = 'Krishnan'

tm = ec2b.TemporalModel(lweight=(1 / (3.16 * (10**6))))
#for d in [.1, .2, .45, .75, 1., 2., 4., 8., 16., 32.]:
scFac = 2.41 * (10**3)
# at 0 off the retinal surface a 0.45 pulse in the nfl gives a response of 1
for d in [.1, .45, 1., 2., 4., 8., 16.]:
    [ecs, cs] = r.electrode_ecs(e_all)
    rsample = int(np.round(
        (1 / tm.tsample) / 30))  # resampling of the output to fps
    pt = e2cm.Psycho2Pulsetrain(tsample=tm.tsample,
                                current_amplitude=100,
                                dur=.6,
                                pulse_dur=d / 1000.,
                                interphase_dur=.45 / 1000,
                                freq=2)
    if modelver == 'Krishnan':
        ca = tm.tsample * np.cumsum(np.maximum(0, pt.data))
Example #3
0
retinaname = '1700by2900L80S150'
r = e2cm.Retina(axon_map=None,
                sampling=150,
                ylo=-1700,
                yhi=1700,
                xlo=-2900,
                xhi=2900,
                axon_lambda=8)

e_rf = []
for e in e_all.electrodes:
    e_rf.append(e2cm.receptive_field(e, r.gridx, r.gridy, e_spacing))

[ecs, cs] = r.electrode_ecs(e_all, integrationtype='maxrule')

tm = ec2b.TemporalModel()

# create movie
# original screen was [52.74, 63.32]  visual angle, res=[768 ,1024] # resolution of screen
# pixperdeg=degscreen/res
# no need to simulate the whole movie, just match it to the electrode array, xhi+xlo/294 (microns per degree)

degscreen = [10.32 + 5, 17.2 + 5]  # match to array visual angle,
res = [e_rf[0].shape[0], e_rf[1].shape[1]]  # resolution of screen
fps = 30
# the bar is 1.4 inches in width at 12 inches,
# corresponds to 6.67 degrees visual angle
bar_width = 6.77
[X, Y] = np.meshgrid(np.linspace(-degscreen[1] / 2, degscreen[1] / 2, res[1]),
                     np.linspace(-degscreen[0] / 2, degscreen[0] / 2, res[0]))