if comm_rank == 0: print 'Begin to locate the signal and calculate SNR... rank:', comm_rank SNR, location = Signal_finding(FFT2nd_sets, ang_min, ang_max, pixel) if comm_rank == 0: print 'Calculation over. rank:', comm_rank time_2 = time.time() consume = time_2 - time_1 if comm_rank == 0: print str(comm_rank) + ' process matrix size: 4096 * ' + str( len(SNR) * 2048 ) + '\ntime is:', consume, 'seconds, ', 'equal', consume / 60., 'minutes.' if comm_rank == 0: print 'start to plot... rank:', comm_rank plot(comm_rank, t_sets, d_sets, re_sets, polar_sets, FFT1st_sets, FFT2nd_sets, plot_proc, freq, f_axis, 2, rad_grid, ang_grid, plot_dir, pixel, ang_min, ang_max) ############################################################################################### #gather the results from all processes ############################################################################################## comm.barrier() combine_SNR = comm.gather(SNR, root=0) combine_SNR = np.array(combine_SNR).reshape(-1) combine_location = comm.gather(location, root=0) combine_location = np.array(combine_location).reshape(-1) if comm_rank == 0: print 'multiprocess plot over....' N_cut = len(combine_SNR) plt.ylabel('SNR')
SNR_l.append(SNR) DM_l.append(DM) if comm_rank == 0 and SHOW == 1: print 'Searching Over. ' time_2 = time.time() consume = time_2 - time_1 if comm_rank == 0 and SHOW == 1: print '\n#############' print 'Process matrix size:', nch, ' * ' + str(t_len) print 'Time cost:', consume, 'seconds, ', 'equal', consume / 60., 'minutes.' print 'Process:', i_ch, ' of ', p_n, ' for total:', p_n * t_len * comm_size, 'samples' print 'Angle range:', angle print 'SNR:', SNR, ';DM: ', DM print '###############\n\nBegin to plot...' plot(comm_rank, t_axis, data, re_data, polar_data, FFT1st_data, FFT2nd_data, plot_proc, freq, f_axis, Rad_rs, Ang_rs, plot_dir, pixel, angle, i_ch, p_n, SNR, DM, A_f) if comm_rank == 0 and SHOW == 1: print 'Plot Over...\n\n' ######################################### # gather the results from all processes # ######################################### SNR_l = np.array(SNR_l) DM_l = np.array(DM_l) comm.barrier() time_e = time.time() if comm_rank == 0 and SHOW == 1: print 'Total consume:', (time_e - time_s) / 60., 'mins' combine_SNR = comm.gather(SNR_l, root=0) combine_SNR = np.array(combine_SNR).reshape(-1) combine_DM = comm.gather(DM_l, root=0) combine_DM = np.array(combine_DM).reshape(-1)