How to use the pulse2percept.electrode2currentmap.Psycho2Pulsetrain 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 / 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)
github pulse2percept / pulse2percept / scripts / SingleElectrode.py View on Github external
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))
        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
pt=[]
inl_out=[]
nfl_out=[]

modelver='Krishnan' 


#for d in [.1, .2, .45, .75, 1., 2., 4., 8., 16., 32.]:
tm = ec2b.TemporalModel() 
rsample=int(np.round((1/tm.tsample) / 60 )) # resampling of the output to fps
# at 0 off the retinal surface a 0.45 pulse in the nfl gives a response of 1

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

pt_01=e2cm.Psycho2Pulsetrain(tsample=tm.tsample, current_amplitude=120,dur=.6, delay=10/1000, pulse_dur=.1/1000.,interphase_dur=10/1000, freq=2)
pt_2=e2cm.Psycho2Pulsetrain(tsample=tm.tsample, current_amplitude=120, dur=.6, delay=10/1000, pulse_dur=2/1000.,interphase_dur=10/1000, freq=2) 
#def pulse2percept(tm, ecs, retina, ptrain, rsample, dolayer,
#                  engine='joblib', dojit=True, n_jobs=-1, tol=.05):
                            

#inl_r = ec2b.pulse2percept(tm, ecs, r, [pt_2], rsample=rsample, dolayer='INL', dojit=False, engine='serial')
#

comparenflinl(.636, ecs, r, [pt_2], [pt_01], rsample, False, 'serial')
#myout=minimize(comparenflinl, x0, args=(ecs, r, [pt_2], [pt_01], rsample, False, 'serial', ))
github pulse2percept / pulse2percept / scripts / Find_INL_NFL_weighting.py View on Github external
fps=30
pt=[]
inl_out=[]
nfl_out=[]

modelver='Krishnan' 


#for d in [.1, .2, .45, .75, 1., 2., 4., 8., 16., 32.]:
tm = ec2b.TemporalModel() 
rsample=int(np.round((1/tm.tsample) / 60 )) # resampling of the output to fps
# at 0 off the retinal surface a 0.45 pulse in the nfl gives a response of 1

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

pt_01=e2cm.Psycho2Pulsetrain(tsample=tm.tsample, current_amplitude=120,dur=.6, delay=10/1000, pulse_dur=.1/1000.,interphase_dur=10/1000, freq=2)
pt_2=e2cm.Psycho2Pulsetrain(tsample=tm.tsample, current_amplitude=120, dur=.6, delay=10/1000, pulse_dur=2/1000.,interphase_dur=10/1000, freq=2) 
#def pulse2percept(tm, ecs, retina, ptrain, rsample, dolayer,
#                  engine='joblib', dojit=True, n_jobs=-1, tol=.05):
                            

#inl_r = ec2b.pulse2percept(tm, ecs, r, [pt_2], rsample=rsample, dolayer='INL', dojit=False, engine='serial')
#

comparenflinl(.636, ecs, r, [pt_2], [pt_01], rsample, False, 'serial')
#myout=minimize(comparenflinl, x0, args=(ecs, r, [pt_2], [pt_01], rsample, False, 'serial', ))
github pulse2percept / pulse2percept / pulse2percept / electrode2currentmap.py View on Github external
pulses = []
    for m in magn:
        if coding == 'amplitude':
            # Map magnitude to amplitude
            amp = m
            freq = const_freq
        elif coding == 'frequency':
            # Map magnitude to frequency
            amp = const_amp
            freq = m
        else:
            e_s = "Acceptable values for `coding` are 'amplitude' or"
            e_s += "'frequency'."
            raise ValueError(e_s)

        pt = Psycho2Pulsetrain(tsample, freq=freq, amp=amp, dur=dur,
                               pulse_dur=pulsedur,
                               interphase_dur=interphasedur,
                               pulsetype=pulsetype)
        pulses.append(pt)

    return pulses