def gui_main_image(): nSSU = myglobals.nSSU SensorGroup = init_sensors(nSSU) nSource = myglobals.nSource SourceGroup = init_sources(nSource) CU = [0] CU[0] = LCEngine() CU[0].SensorGroup = SensorGroup CU[0].source = SourceGroup[0] CU[0].update_pairwise_distance() clusterConfig = np.array([1, 1]) ClusterGroup = create_clusters(clusterConfig) CU[0].Clust = ClusterGroup[0] globalEngine = GCEngine() globalEngine.assign_LCE(CU) globalEngine.SourceGroup = SourceGroup[0] globalEngine.ClusterGroup = ClusterGroup # globalEngine.initialize_database() # try: # ================================= map = globalEngine.get_heat_map() globalEngine.Data.add_new_frame(map) Img0 = globalEngine.Data.get_background() plt.figure(2) plt.imshow(Img0, interpolation='nearest') # nn=nn+1 plt.pause(0.3) except: pass
def sequential_power(): N = 1 M = 256 def receive_power0(): fre0 = 0 raw_data0 = np.zeros((N, 1024)) for ii in range(0, N): samples0 = sdr0.read_samples(56 * 1024) # 256 p_density0, fre0 = selfpsd( samples0, NFFT=1024, Fs=sdr0.sample_rate, Fc=sdr0.center_freq) # get psd using own function raw_data0[ii, :] = p_density0 re_pow0, new_psd0, f_new0 = received_power2(raw_data0, fre0, 1, M) myglobals.power_threads[0].append(re_pow0) myglobals.psd_threads[0].append(new_psd0) myglobals.fre_threads[0].append(f_new0) # myglobals.power_threads[0]=re_pow0 # myglobals.psd_threads[0]=new_psd0 # myglobals.fre_threads[0]=f_new0 # print('nothing0') def receive_power1(): fre1 = 0 raw_data1 = np.zeros((N, 1024)) for ii in range(0, N): samples1 = sdr1.read_samples(56 * 1024) # 256 p_density1, fre1 = selfpsd( samples1, NFFT=1024, Fs=sdr1.sample_rate, Fc=sdr1.center_freq) # get psd using own function raw_data1[ii, :] = p_density1 re_pow1, new_psd1, f_new1 = received_power2(raw_data1, fre1, 1, M) myglobals.power_threads[1].append(re_pow1) myglobals.psd_threads[1].append(new_psd1) myglobals.fre_threads[1].append(f_new1) # myglobals.power_threads[1]=re_pow1 # myglobals.psd_threads[1]=new_psd1 # myglobals.fre_threads[1]=f_new1 # print('nothing1') def receive_power2(): fre2 = 0 raw_data2 = np.zeros((N, 1024)) for ii in range(0, N): samples2 = sdr2.read_samples(56 * 1024) # 256 p_density2, fre2 = selfpsd( samples2, NFFT=1024, Fs=sdr2.sample_rate, Fc=sdr2.center_freq) # get psd using own function raw_data2[ii, :] = p_density2 re_pow2, new_psd2, f_new2 = received_power2(raw_data2, fre2, 1, M) myglobals.power_threads[2].append(re_pow2) myglobals.psd_threads[2].append(new_psd2) myglobals.fre_threads[2].append(f_new2) # myglobals.power_threads[2]=re_pow2 # myglobals.psd_threads[2]=new_psd2 # myglobals.fre_threads[2]=f_new2 # print('nothing2') def receive_power3(): fre3 = 0 raw_data3 = np.zeros((N, 1024)) for ii in range(0, N): samples3 = sdr3.read_samples(56 * 1024) # 256 p_density3, fre3 = selfpsd( samples3, NFFT=1024, Fs=sdr3.sample_rate, Fc=sdr3.center_freq) # get psd using own function raw_data3[ii, :] = p_density3 re_pow3, new_psd3, f_new3 = received_power2(raw_data3, fre3, 1, M) myglobals.power_threads[3].append(re_pow3) myglobals.psd_threads[3].append(new_psd3) myglobals.fre_threads[3].append(f_new3) # myglobals.power_threads[3]=re_pow3 # myglobals.psd_threads[3]=new_psd3 # myglobals.fre_threads[3]=f_new3 # print('nothing3') def receive_power4(): fre4 = 0 raw_data4 = np.zeros((N, 1024)) for ii in range(0, N): samples4 = sdr4.read_samples(56 * 1024) # 256 p_density4, fre4 = selfpsd( samples4, NFFT=1024, Fs=sdr4.sample_rate, Fc=sdr4.center_freq) # get psd using own function raw_data4[ii, :] = p_density4 re_pow4, new_psd4, f_new4 = received_power2(raw_data4, fre4, 1, M) myglobals.power_threads[4].append(re_pow4) myglobals.psd_threads[4].append(new_psd4) myglobals.fre_threads[4].append(f_new4) # myglobals.power_threads[4]=re_pow4 # myglobals.psd_threads[4]=new_psd4 # myglobals.fre_threads[4]=f_new4 # print('nothing4') def receive_power5(): fre5 = 0 raw_data5 = np.zeros((N, 1024)) for ii in range(0, N): samples5 = sdr5.read_samples(56 * 1024) # 256 p_density5, fre5 = selfpsd( samples5, NFFT=1024, Fs=sdr5.sample_rate, Fc=sdr5.center_freq) # get psd using own function raw_data5[ii, :] = p_density5 re_pow5, new_psd5, f_new5 = received_power2(raw_data5, fre5, 1, M) myglobals.power_threads[5].append(re_pow5) myglobals.psd_threads[5].append(new_psd5) myglobals.fre_threads[5].append(f_new5) # myglobals.power_threads[5]=re_pow5 # myglobals.psd_threads[5]=new_psd5 # myglobals.fre_threads[5]=f_new5 # print('nothing5') def receive_power6(): fre6 = 0 raw_data6 = np.zeros((N, 1024)) for ii in range(0, N): samples6 = sdr6.read_samples(56 * 1024) # 256 p_density6, fre6 = selfpsd( samples6, NFFT=1024, Fs=sdr6.sample_rate, Fc=sdr6.center_freq) # get psd using own function raw_data6[ii, :] = p_density6 re_pow6, new_psd6, f_new6 = received_power2(raw_data6, fre6, 1, M) myglobals.power_threads[6].append(re_pow6) myglobals.psd_threads[6].append(new_psd6) myglobals.fre_threads[6].append(f_new6) # myglobals.power_threads[6]=re_pow6 # myglobals.psd_threads[6]=new_psd6 # myglobals.fre_threads[6]=f_new6 # print('nothing6') # if __name__ == '__main__': globalEngine = GCEngine() CU = [0] CU[0] = LCEngine() clusterConfig = np.array([1, 1]) ClusterGroup = create_clusters(clusterConfig) CU[0].Clust = ClusterGroup[0] globalEngine.ClusterGroup = ClusterGroup # globalEngine.initialize_database() # nSSU = myglobals.nSSU SensorGroup = init_sensors(nSSU) CU[0].SensorGroup = SensorGroup CU[0].update_pairwise_distance() globalEngine.assign_LCE(CU) receive_power0() receive_power1() receive_power2() receive_power3() receive_power4() receive_power5() receive_power6()
def clickMe1(): print('imaging...') global CUaction CUaction.Hold = 0 CUaction.Start = 1 CUaction.Quit = 0 #------------------------------------------------------ read input from gui myglobals.area_size = np.array([x.get(), y.get()]) myglobals.PixelResolution = r.get() myglobals.nSSU = num.get() myglobals.center_freq = fc.get() myglobals.sample_rate = fb.get() if myglobals.nSSU == 0: myglobals.nSSU = 16 myglobals.area_size = np.array([10, 10]) myglobals.PixelResolution = 0.5 myglobals.center_freq = 434 * 1e6 myglobals.sample_rate = 1e6 #----- clusterConfig = np.array([1, 1]) ClusterGroup = create_clusters(clusterConfig) CU[0].Clust = ClusterGroup[0] globalEngine.ClusterGroup = ClusterGroup # globalEngine.initialize_database() # nSSU = myglobals.nSSU SensorGroup = init_sensors(nSSU) CU[0].SensorGroup = SensorGroup CU[0].update_pairwise_distance() globalEngine.assign_LCE(CU) #----- def kriging_image(): start = time.time() NNN = 100 ima = NNN flag = 0 while ima: # ima=ima+1 ima = ima - 1 #print('ima:',ima) globalEngine.update_sensorloc() #globalEngine.LCEGroup[0].update_pairwise_distance() if CUaction.Quit == 1: #myglobals.senpow = [] break elif CUaction.Hold == 1: #myglobals.senpow = [] break elif CUaction.Start == 1: # ----------------------------------------------------------generate model # =================================get data for image try: sequential_power() map = globalEngine.get_heat_map() #globalEngine.Data.add_new_frame(map) #Img0 = globalEngine.Data.get_background() Img0 = map Img0 = Img0.T loc_sen = globalEngine.SensorLoc # ------------------------------------------------- fig.clf() axis1 = fig.add_subplot(111) pic = axis1.imshow(Img0, origin='lower', interpolation='nearest', vmin=-50, vmax=-10) fig.colorbar(pic) #-------------------------------------------------- axis1.scatter(loc_sen[:, 0].T / myglobals.PixelResolution, loc_sen[:, 1].T / myglobals.PixelResolution, color='b') #axis1.scatter(globalEngine.SourceGroup.Loc[1] / myglobals.PixelResolution, globalEngine.SourceGroup.Loc[0] / myglobals.PixelResolution, color='r') axis1.set_title('Radio Environment Map') axis1.set_xlabel('X[pixel]') axis1.set_ylabel('Y[pixel]') axis1.set_xlim(0, 2 * myglobals.area_size[0] - 1) axis1.set_ylim(0, 2 * myglobals.area_size[1] - 1) axis0.draw() flag = flag + 1 # ------------------ # print(Img0[2*y0-1,2*x0-1]) # print(myglobals.power_threads[myglobals.nSSU][-1]) # ------------------ except: pass sensingtime0 = (time.time() - start) print('average time0', sensingtime0 / flag) # start = time.time() print('flag', flag) #plt.pause(0.2) # ---------------------------------------------------------- w = threading.Thread(name='worker', target=kriging_image) w.start()
def clickMe1(): print('imaging...') global CUaction CUaction.Hold = 0 CUaction.Start = 1 CUaction.Quit = 0 # read input from gui myglobals.nSSU = num.get() myglobals.loc_source = [x.get(), y.get()] if myglobals.nSSU == 0: myglobals.nSSU = 30 myglobals.loc_source = [5, 2.4] #----- CU = [0] CU[0] = LCEngine() clusterConfig = np.array([1, 1]) ClusterGroup = create_clusters(clusterConfig) CU[0].Clust = ClusterGroup[0] globalEngine = GCEngine() globalEngine.ClusterGroup = ClusterGroup # globalEngine.initialize_database() # nSSU = myglobals.nSSU SensorGroup = init_sensors(nSSU) nSource = myglobals.nSource SourceGroup = init_sources(nSource) CU[0].SensorGroup = SensorGroup CU[0].source = SourceGroup[0] CU[0].update_pairwise_distance() globalEngine.assign_LCE(CU) globalEngine.SourceGroup = SourceGroup[0] #----- def receive_sen_power(): rece = 1 while rece: rece = rece + 1 print('receive:', rece) if CUaction.Quit == 1: myglobals.senpow = [] break elif CUaction.Hold == 1: myglobals.senpow = [] break elif CUaction.Start == 1: # ----------------------------------------------------------generate model globalEngine.LCEGroup[0].updata_source_loc() globalEngine.updata_sourceloc() prx = globalEngine.LCEGroup[0].receive_senpow() myglobals.senpow.append(prx) time.sleep(1) def kriging_image(): ima = 1 while ima: ima = ima + 1 print('ima:', ima) if CUaction.Quit == 1: myglobals.senpow = [] break elif CUaction.Hold == 1: myglobals.senpow = [] break elif CUaction.Start == 1: # ----------------------------------------------------------generate model try: # =================================get data for image map = globalEngine.get_heat_map() globalEngine.Data.add_new_frame(map) Img0 = globalEngine.Data.get_background() loc_sen = globalEngine.SensorLoc # ------------------------------------------------- fig.clf() axis1 = fig.add_subplot(131) pic = axis1.imshow(Img0, origin='lower', interpolation='nearest') fig.colorbar(pic) axis1.set_title('Radio Environment Map') axis1.set_xlabel('X[pixel]') axis1.set_ylabel('Y[pixel]') # print('---------------------------------') # axis0.draw() # ------------------------------------------------- axis2 = fig.add_subplot(133) axis2.scatter(loc_sen[:, 1].T / myglobals.PixelResolution, loc_sen[:, 0].T / myglobals.PixelResolution, color='b') axis2.scatter(globalEngine.SourceGroup.Loc[1] / myglobals.PixelResolution, globalEngine.SourceGroup.Loc[0] / myglobals.PixelResolution, color='r') # loes = np.argwhere(Img0 == np.max(Img0))[0] # print('estimate source location',loes) # axis2.scatter(loes[1],loes[0],color='g') axis2.set_title('Simulation Environment') axis2.set_xlabel('X[pixel]') axis2.set_ylabel('Y[pixel]') axis2.set_xlim(0, 10) axis2.set_ylim(0, 20) axis0.draw() #plt.pause(0.2) except: pass # ---------------------------------------------------------- t = threading.Thread(name='receive senpow', target=receive_sen_power) w = threading.Thread(name='worker', target=kriging_image) t.start() w.start() print('over')
from SSN_modul import myglobals from SSN_modul.Init_sensors import init_sensors from SSN_modul.LCEngine import LCEngine from SSN_modul.init_Sources import init_sources from SSN_modul.Create_clusters import create_clusters from SSN_modul.GCEngine import GCEngine #================================= #nn=0 # allow_key_commands = 1 # while allow_key_commands:#nn<3: sources_loc=[[3,4],[5,2.5],[8,1]] #myglobals.loc_source=sources_loc[nn] myglobals.loc_source = sources_loc[0] nSSU = myglobals.nSSU nSource = myglobals.nSource SensorGroup = init_sensors(nSSU) SourceGroup = init_sources(nSource) CU = [0] CU[0] = LCEngine() CU[0].SensorGroup = SensorGroup CU[0].source = SourceGroup[0] CU[0].update_pairwise_distance() clusterConfig = np.array([1, 1]) ClusterGroup = create_clusters(clusterConfig) CU[0].Clust = ClusterGroup[0] globalEngine = GCEngine() globalEngine.assign_LCE(CU) globalEngine.SourceGroup = SourceGroup[0]
def clickMe1(): print('imaging...') global CUaction CUaction.Hold = 0 CUaction.Start = 1 CUaction.Quit = 0 #------------------------------------------------------ read input from gui myglobals.area_size = np.array([x.get(), y.get()]) myglobals.PixelResolution = r.get() myglobals.nSSU = num.get() myglobals.center_freq = fc.get() myglobals.sample_rate = fb.get() if myglobals.nSSU == 0: myglobals.nSSU = 12 myglobals.area_size = np.array([5, 10]) myglobals.PixelResolution = 0.5 myglobals.center_freq = 434 * 1e6 myglobals.sample_rate = 1e6 #----- clusterConfig = np.array([1, 1]) ClusterGroup = create_clusters(clusterConfig) CU[0].Clust = ClusterGroup[0] globalEngine.ClusterGroup = ClusterGroup # globalEngine.initialize_database() # nSSU = myglobals.nSSU SensorGroup = init_sensors(nSSU) CU[0].SensorGroup = SensorGroup CU[0].update_pairwise_distance() globalEngine.assign_LCE(CU) #----- def kriging_image(): ima = 1 start = time.time() NN = 1000 ima = NN flag = 0 while ima: ima = ima - 1 #ima=ima+1 globalEngine.update_sensorloc() #globalEngine.LCEGroup[0].update_pairwise_distance() if CUaction.Quit == 1: #myglobals.senpow = [] break elif CUaction.Hold == 1: #myglobals.senpow = [] break elif CUaction.Start == 1: # ----------------------------------------------------------generate model #try: # =================================get data for image map = globalEngine.get_heat_map() ##globalEngine.Data.add_new_frame(map) ##Img0 = globalEngine.Data.get_background() Img0 = map # for krige #Img0=Img0.T # for self kriging and nearest # ----------------------------------------------------- # to compare difference # for transmitter location error '''test=200 loc_err=[] x0 = 3 y0 = 4 while (np.max(Img0)-np.min(Img0)>4) and (test): test=test-1 lo1=np.argwhere(Img0==np.max(Img0)) d=np.sqrt((0.5*lo1[0][0]+0.5-y0)**2+(0.5*lo1[0][1]+0.5-x0)**2) loc_err.append(d) if len(loc_err)==200: print(len(loc_err)) print('loc_err',sum(loc_err)/len(loc_err))''' # for sensor power error test = 200 pow_err1 = [] #pow_err2 = [] while (np.max(Img0) - np.min(Img0) > 4) and (test): test = test - 1 #print('SU22',Img0[8,3],Img0[8,4],Img0[8,5]) e1 = abs(Img0[8, 5] - myglobals.power_threads[12][-1]) #e2=abs(Img0[1,1] - myglobals.power_threads[13][-1]) pow_err1.append(e1) #pow_err2.append(e2) if test == 0: #hist1, bin_edges1 = np.histogram(pow_err1, bins='auto', density=False) #hist2, bin_edges2 = np.histogram(pow_err2, bins='auto', density=False) #err22 = sum(np.array(hist1[0:len(bin_edges1) - 1]) * np.array(bin_edges1[0:len(bin_edges1) - 1])) / ( #sum(np.array(hist1))) #err23 = sum(np.array(hist2[0:len(bin_edges2) - 1]) * np.array(bin_edges2[0:len(bin_edges2) - 1])) / ( #sum(np.array(hist2))) err22 = sum(np.array(pow_err1)) / len(pow_err1) #err23=sum(np.array(pow_err2))/len(pow_err2) print('sen22', err22) #print('sen23', err23) # ------------------------------------------------- loc_sen = globalEngine.SensorLoc fig.clf() axis1 = fig.add_subplot(111) pic = axis1.imshow(Img0, origin='lower', interpolation='nearest', vmin=-50, vmax=-10) fig.colorbar(pic) #-------------------------------------------------- axis1.scatter(loc_sen[:, 0].T / myglobals.PixelResolution, loc_sen[:, 1].T / myglobals.PixelResolution, color='b') #axis1.scatter(globalEngine.SourceGroup.Loc[1] / myglobals.PixelResolution, globalEngine.SourceGroup.Loc[0] / myglobals.PixelResolution, color='r') axis1.set_title('Radio Environment Map') axis1.set_xlabel('X[pixel]') axis1.set_ylabel('Y[pixel]') axis1.set_xlim(0, 2 * myglobals.area_size[0]) axis1.set_ylim(0, 2 * myglobals.area_size[1]) axis0.draw() ## to measure tran-rem time #max_value = np.max(np.max(map)) #if max_value > -38.5: # print('end time', time.gmtime()) # flag = flag + 1 #------------------ #print(Img0[2*y0-1,2*x0-1]) #print(myglobals.power_threads[myglobals.nSSU][-1]) #------------------ #except: #pass sensingtime0 = (time.time() - start) print('average time0', sensingtime0 / flag) #start = time.time() print('flag', flag) # ---------------------------------------------------------- w = threading.Thread(name='worker', target=kriging_image) w.start()
def clickMe1(): global CUaction CUaction.Hold = 0 CUaction.Start = 1 CUaction.Quit = 0 # read input from gui myglobals.nSSU = num.get() myglobals.loc_source = [x.get(), y.get()] if myglobals.nSSU == 0: myglobals.nSSU = 30 myglobals.loc_source = [5, 2.4] #----- CU = [0] CU[0] = LCEngine() clusterConfig = np.array([1, 1]) ClusterGroup = create_clusters(clusterConfig) CU[0].Clust = ClusterGroup[0] globalEngine = GCEngine() globalEngine.ClusterGroup = ClusterGroup # globalEngine.initialize_database() # nSSU = myglobals.nSSU SensorGroup = init_sensors(nSSU) nSource = myglobals.nSource SourceGroup = init_sources(nSource) CU[0].SensorGroup = SensorGroup CU[0].source = SourceGroup[0] CU[0].update_pairwise_distance() globalEngine.assign_LCE(CU) globalEngine.SourceGroup = SourceGroup[0] #----- command = 1 while command: print(command) command = command + 1 if CUaction.Quit == 1: break elif CUaction.Hold == 1: break elif CUaction.Start == 1: print('imaging...') # ----------------------------------------------------------generate model globalEngine.LCEGroup[0].updata_source_loc() globalEngine.updata_sourceloc() print('sensorlocation', globalEngine.SourceGroup.Loc) try: # =================================get data for image map = globalEngine.get_heat_map() globalEngine.Data.add_new_frame(map) Img0 = globalEngine.Data.get_background() loc_sen = globalEngine.SensorLoc #------------------------------------------------- fig.clf() axis1 = fig.add_subplot(131) pic = axis1.imshow(Img0, origin='lower', interpolation='nearest') fig.colorbar(pic) axis1.set_title('Radio Environment Map') axis1.set_xlabel('X[pixel]') axis1.set_ylabel('Y[pixel]') #------------------------------------------------- axis2 = fig.add_subplot(133) axis2.scatter(loc_sen[:, 1].T / myglobals.PixelResolution, loc_sen[:, 0].T / myglobals.PixelResolution) axis2.scatter( globalEngine.SourceGroup.Loc[1] / myglobals.PixelResolution, globalEngine.SourceGroup.Loc[0] / myglobals.PixelResolution) axis2.set_title('Simulation Environment') axis2.set_xlabel('X[pixel]') axis2.set_ylabel('Y[pixel]') axis2.set_xlim(0, 10) axis2.set_ylim(0, 20) axis0.draw() plt.pause(0.2) except: pass
def clickMe1(): print('imaging...') global CUaction CUaction.Hold = 0 CUaction.Start = 1 CUaction.Quit = 0 #------------------------------------------------------ read input from gui myglobals.area_size = np.array([x.get(), y.get()]) myglobals.PixelResolution = r.get() myglobals.nSSU = num.get() myglobals.center_freq = fc.get() myglobals.sample_rate = fb.get() if myglobals.nSSU == 0: myglobals.nSSU = 12 myglobals.area_size = np.array([5, 9.4]) myglobals.PixelResolution = 0.5 myglobals.center_freq = 434 * 1e6 myglobals.sample_rate = 1e6 #----- clusterConfig = np.array([1, 1]) ClusterGroup = create_clusters(clusterConfig) CU[0].Clust = ClusterGroup[0] globalEngine.ClusterGroup = ClusterGroup # globalEngine.initialize_database() # nSSU = myglobals.nSSU SensorGroup = init_sensors(nSSU) CU[0].SensorGroup = SensorGroup CU[0].update_pairwise_distance() globalEngine.assign_LCE(CU) #----- def kriging_image(): ima = 1 start = time.time() NN = 100 ima = NN flag = 0 while ima: ima = ima - 1 #ima=ima+1 globalEngine.update_sensorloc() #globalEngine.LCEGroup[0].update_pairwise_distance() if CUaction.Quit == 1: #myglobals.senpow = [] break elif CUaction.Hold == 1: #myglobals.senpow = [] break elif CUaction.Start == 1: # ----------------------------------------------------------generate model try: # =================================get data for image map = globalEngine.get_heat_map() ##globalEngine.Data.add_new_frame(map) ##Img0 = globalEngine.Data.get_background() Img0 = map # for krige #Img0=Img0.T # for self kriging and nearest # to compare difference #print(np.max(Img0)) #if np.max(Img0)-np.min(Img0)>1: #lo1=np.argwhere(Img0==np.max(Img0)) #d=np.sqrt((0.5*lo1[0][0]-3.5)**2+(0.5*lo1[0][1]-2.5)**2) #print('dis',d) #print('sen22',abs(Img0[7,5]-myglobals.power_threads[12][-1])) # 22 #print('sen23',abs(Img0[1,1]-myglobals.power_threads[13][-1])) # 23 loc_sen = globalEngine.SensorLoc # ------------------------------------------------- fig.clf() axis1 = fig.add_subplot(111) pic = axis1.imshow(Img0, origin='lower', interpolation='nearest', vmin=-50, vmax=-10) fig.colorbar(pic) #-------------------------------------------------- axis1.scatter(loc_sen[:, 0].T / myglobals.PixelResolution, loc_sen[:, 1].T / myglobals.PixelResolution, color='b') #axis1.scatter(globalEngine.SourceGroup.Loc[1] / myglobals.PixelResolution, globalEngine.SourceGroup.Loc[0] / myglobals.PixelResolution, color='r') axis1.set_title('Radio Environment Map') axis1.set_xlabel('X[pixel]') axis1.set_ylabel('Y[pixel]') axis1.set_xlim(0, 2 * myglobals.area_size[0]) axis1.set_ylim(0, 2 * myglobals.area_size[1]) axis0.draw() ## to measure tran-rem time #max_value = np.max(np.max(map)) #if max_value > -38.5: # print('end time', time.gmtime()) # flag = flag + 1 #------------------ #print(Img0[2*y0-1,2*x0-1]) #print(myglobals.power_threads[myglobals.nSSU][-1]) #------------------ except: pass sensingtime0 = (time.time() - start) print('average time0', sensingtime0 / flag) #start = time.time() print('flag', flag) # ---------------------------------------------------------- w = threading.Thread(name='worker', target=kriging_image) w.start()