Esempio n. 1
0
 def parfor_calc_pixel(arr, idx, r, ecs_list, pt, tm, rs, dojit=False):
     sr = ec2b.calc_pixel(idx[1], idx[0], r, ecs_list, pt, tm, rs,
                          dojit)
     return sr.data
 def parfor_calc_pixel(arr, idx, r, ecs_list, pt, tm, rs, dojit=False):            
     sr=ec2b.calc_pixel(idx[1], idx[0], r, ecs_list, pt, tm, rs, dojit)           
     return sr.data        
Esempio n. 3
0
                                                interphase_dur=.5 / 1000.,
                                                tsample=.1 / 1000.)
            else:
                ptrain = e2cm.Psycho2Pulsetrain(current_amplitude=0,
                                                dur=0.25,
                                                pulse_dur=.5 / 1000.,
                                                interphase_dur=.5 / 1000.,
                                                tsample=.1 / 1000.)
            pt.append(ptrain)

        [ecs_list, cs_list] = r.electrode_ecs(e_all)
        tm1 = ec2b.TemporalModel()

        rs = 1 / (fps * pt[0].tsample)

        sr_tmp = ec2b.calc_pixel(0, 0, r, ecs_list, pt, tm1, rs, dojit=False)
        brightness_movie = np.zeros(
            (r.gridx.shape[0], r.gridx.shape[1], sr_tmp.shape[0]))

        #brightness_movie = np.zeros((4, 4, sr_tmp.shape[0]))
        def parfor_calc_pixel(arr, idx, r, ecs_list, pt, tm, rs, dojit=False):
            sr = ec2b.calc_pixel(idx[1], idx[0], r, ecs_list, pt, tm, rs,
                                 dojit)
            return sr.data

        brightness_movie = utils.parfor(brightness_movie,
                                        parfor_calc_pixel,
                                        r,
                                        ecs_list,
                                        pt,
                                        tm1,
        for ct, rf in enumerate(e_rf):
            if ct==ee:           
                ptrain=e2cm.Psycho2Pulsetrain(current_amplitude=3, dur=0.25, pulse_dur=.5/1000., 
                                               interphase_dur=.5/1000., tsample=.1/1000.)
            else:
                ptrain=e2cm.Psycho2Pulsetrain(current_amplitude=0, dur=0.25, pulse_dur=.5/1000., 
                                               interphase_dur=.5/1000., tsample=.1/1000.)
            pt.append(ptrain) 
            
            
        [ecs_list, cs_list]  = r.electrode_ecs(e_all)    
        tm1 = ec2b.TemporalModel()

        rs=1/(fps*pt[0].tsample)  
                
        sr_tmp=ec2b.calc_pixel(0, 0, r, ecs_list, pt, tm1, rs, dojit=False) 
        brightness_movie = np.zeros((r.gridx.shape[0], r.gridx.shape[1], sr_tmp.shape[0]))
       
        #brightness_movie = np.zeros((4, 4, sr_tmp.shape[0]))          
        def parfor_calc_pixel(arr, idx, r, ecs_list, pt, tm, rs, dojit=False):            
            sr=ec2b.calc_pixel(idx[1], idx[0], r, ecs_list, pt, tm, rs, dojit)           
            return sr.data        

        brightness_movie = utils.parfor(brightness_movie, parfor_calc_pixel, r, ecs_list, pt, tm1, rs, dojit=False, n_jobs=12, axis=-1)        

      #  brightnessmovie[yy, xx, :] = sr_rs
        filename='SE_' + retinaname + '_E' + str(ee)      
        np.save(filename, brightness_movie) 
        scipy.misc.imsave(filename +'.jpg', brightness_movie[:, :, 10])
   
     #   moviefilename='singleelectrode_' + retinaname + str(ee)