Esempio n. 1
0
plt.colorbar()
plt.scatter(x=center[:,1], y=center[:,0], c='m', s=40)
crd = cse.plot_contours(coo_matrix(Ain[:,::-1]),Cn,thr=0.9)
plt.axis((-0.5,d2-0.5,-0.5,d1-0.5))
plt.gca().invert_yaxis()
pl.show()
  
#%%
t1 = time()
A,b,Cin = cse.update_spatial_components_parallel(Yr, Cin, f_in, Ain, sn=sn, **spatial_params)
t_elSPATIAL = time() - t1
print t_elSPATIAL 
crd = cse.plot_contours(A,Cn,thr=0.9)
#%% update_temporal_components
t1 = time()
C,f,Y_res,S,bl,c1,neurons_sn,g = cse.update_temporal_components_parallel(Yr,A,b,Cin,f_in,bl=None,c1=None,sn=None,g=None,**temporal_params)
t_elTEMPORAL2 = time() - t1
print t_elTEMPORAL2 # took 98 sec   
#%% merge components corresponding to the same neuron
t1 = time()
A_m,C_m,nr_m,merged_ROIs,S_m,bl_m,c1_m,sn_m,g_m=cse.mergeROIS_parallel(Y_res,A,b,C,f,S,sn,temporal_params, spatial_params, bl=bl, c1=c1, sn=neurons_sn, g=g, thr=0.8, mx=50)
t_elMERGE = time() - t1
print t_elMERGE  
#%% view results. Notice that in order to scroll components you need to click on the plot
A_or, C_or, srt = cse.order_components(A_m,C_m)
cse.view_patches(Yr,coo_matrix(A_or),C_or,b,f, d1,d2,secs=0)
#%%
crd = cse.plot_contours(A_m,Cn,thr=0.9)
#%% refine spatial and temporal 
t1 = time()
A2,b2,C2 = cse.update_spatial_components_parallel(Yr, C_m, f, A_m, sn=sn, **spatial_params)
Esempio n. 2
0
 A, b, Cin = cse.update_spatial_components_parallel(Yr,
                                                    Cin,
                                                    f_in,
                                                    Ain,
                                                    sn=sn,
                                                    **spatial_params)
 t_elSPATIAL = time() - t1
 print t_elSPATIAL
 #%% update_temporal_components
 t1 = time()
 C, f, Y_res, S, bl, c1, neurons_sn, g = cse.update_temporal_components_parallel(
     Yr,
     A,
     b,
     Cin,
     f_in,
     bl=None,
     c1=None,
     sn=None,
     g=None,
     **temporal_params)
 t_elTEMPORAL2 = time() - t1
 print t_elTEMPORAL2  # took 98 sec
 #%% merge components corresponding to the same neuron
 t1 = time()
 A_m, C_m, nr_m, merged_ROIs, S_m, bl_m, c1_m, sn_m, g_m = cse.mergeROIS_parallel(
     Y_res,
     A,
     b,
     C,
     f,
Esempio n. 3
0
                    }
    #%% PREPROCESS DATA
    t1 = time()
    Yr,sn,g=cse.preprocess_data(Yr,**preprocess_params)
    Ain, Cin, b_in, f_in, center=cse.initialize_components(Y, **init_params)                                                    
    print time() - t1  
    
      
    #%%
    t1 = time()
    A,b,Cin = cse.update_spatial_components_parallel(Yr, Cin, f_in, Ain, sn=sn, **spatial_params)
    t_elSPATIAL = time() - t1
    print t_elSPATIAL 
    #%% update_temporal_components
    t1 = time()
    C,f,Y_res,S,bl,c1,neurons_sn,g = cse.update_temporal_components_parallel(Yr,A,b,Cin,f_in,bl=None,c1=None,sn=None,g=None,**temporal_params)
    t_elTEMPORAL2 = time() - t1
    print t_elTEMPORAL2 # took 98 sec   
    #%% merge components corresponding to the same neuron
    t1 = time()
    A_m,C_m,nr_m,merged_ROIs,S_m,bl_m,c1_m,sn_m,g_m=cse.mergeROIS_parallel(Y_res,A,b,C,f,S,sn,temporal_params, spatial_params, bl=bl, c1=c1, sn=neurons_sn, g=g, thr=0.8, mx=50)
    t_elMERGE = time() - t1
    print t_elMERGE  
except:
    print 'test failed'
    raise
#%% STOP CLUSTER
finally:
    print "Stopping Cluster...."
    sys.stdout.flush()  
    proc_2=subprocess.Popen(["ipcluster stop"],shell=True)