How to use the pulse2percept.effectivecurrent2brightness.pulse2percept function in pulse2percept

To help you get started, we’ve selected a few pulse2percept examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github pulse2percept / pulse2percept / scripts / SingleElectrode.py View on Github external
#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))
        pt.data = pt.data - ca

    inl_r = ec2b.pulse2percept(temporal_model=tm, ecs=ecs, retina=r, 
                               ptrain=[pt], rsample=rsample,  dolayer='INL', dojit=False, engine='serial')
    inl_out.append(np.max(inl_r.data) * scFac)
    
    nfl_r = ec2b.pulse2percept(temporal_model=tm, ecs=ecs, retina=r,  
                               ptrain=[pt], rsample=rsample, dolayer='NFL', dojit=False, engine='serial')
    nfl_out.append(np.max(nfl_r.data) * scFac)
#plt.plot(pt.data)
github pulse2percept / pulse2percept / scripts / SingleElectrode.py View on Github external
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))
        pt.data = pt.data - ca

    inl_r = ec2b.pulse2percept(temporal_model=tm, ecs=ecs, retina=r, 
                               ptrain=[pt], rsample=rsample,  dolayer='INL', dojit=False, engine='serial')
    inl_out.append(np.max(inl_r.data) * scFac)
    
    nfl_r = ec2b.pulse2percept(temporal_model=tm, ecs=ecs, retina=r,  
                               ptrain=[pt], rsample=rsample, dolayer='NFL', dojit=False, engine='serial')
    nfl_out.append(np.max(nfl_r.data) * scFac)
#plt.plot(pt.data)
github pulse2percept / pulse2percept / scripts / Find_INL_NFL_weighting.py View on Github external
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
github pulse2percept / pulse2percept / scripts / Find_INL_NFL_weighting.py View on Github external
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
github pulse2percept / pulse2percept / scripts / CalculateChronaxies.py View on Github external
def findampval(amp, ecs, retina, rsample, whichlayer):                                
    pt=e2cm.Psycho2Pulsetrain(tsample=tm.tsample, current_amplitude=amp,dur=.6, delay=10/1000, 
                              pulse_dur=pd / 1000,interphase_dur=10/1000, freq=2)    
    resp =  ec2b.pulse2percept(tm, ecs,r, [pt], rsample=rsample,  dolayer=whichlayer, dojit=True, engine='serial')   
    return (( (np.max(resp.data)*1000) - 67.89) ** 2)