def timing_experiments(TCC_dist, TCC_dls_dist, num_cells, distribution_flname, distance_flname):
num_processes=1
distance_time=[]
distance_time_dls=[]
for num in num_cells:
TCC_dist_short= TCC_dist[0:num, :]
TCC_dls_dist_short= TCC_dls_dist[0:num, :]
dist_flname='timing_exp/'+ distribution_flname + str(num) +'.dat'
dist_dls_flname= 'timing_exp/'+ distribution_flname + '_dls_' + str(num) +'.dat'
distan_flname='timing_exp/'+ distance_flname + str(num) +'.dat'
distan_dls_flname= 'timing_exp/'+ distance_flname + '_dls_' + str(num) +'.dat'
with open(dist_flname , 'wb') as outfile:
pickle.dump(scipy.sparse.csr_matrix(TCC_dist_short.todense()), outfile, pickle.HIGHEST_PROTOCOL)
with open(dist_dls_flname , 'wb') as outfile:
pickle.dump(scipy.sparse.csr_matrix(TCC_dls_dist_short.todense()), outfile, pickle.HIGHEST_PROTOCOL)
t=time()
os.system('python get_pairwise_distances.py '+dist_flname +' '+distan_flname+' '+str(num_processes))
distance_time.append( time() - t )
t=time()
os.system('python get_pairwise_distances.py '+dist_dls_flname +' '+distan_dls_flname+' '+str(num_processes))
distance_time_dls.append( time() - t)
return(distance_time, distance_time_dls)
评论列表
文章目录