diff --git a/CCDserial.py b/CCDserial.py index 6f469c4..e7736fa 100644 --- a/CCDserial.py +++ b/CCDserial.py @@ -45,6 +45,9 @@ import time # byte[11]: Continuous flag: 0 equals one acquisition, 1 equals continuous mode # byte[12]: The number of integrations to average def rxtx(panel, SerQueue, progress_var): + + config.still_working = True + print('start rxtx',config.still_working) if (config.AVGn[0] == 0): threadser = threading.Thread(target=rxtxoncethread, args=(panel, SerQueue, progress_var), daemon=True) elif (config.AVGn[0] == 1): @@ -108,6 +111,8 @@ def rxtxoncethread(panel, SerQueue, progress_var): config.rxData16[rxi] = (config.rxData8[2*rxi+1] << 8) + config.rxData8[2*rxi] #plot the new data + config.still_working=False + print('before bupdate.invoke',config.still_working) panel.bupdate.invoke() #hold values for saving data to file as the SHperiod and ICGperiod may be updated after acquisition config.SHsent = config.SHperiod diff --git a/JFSphoto.py b/JFSphoto.py index 401a467..c782185 100644 --- a/JFSphoto.py +++ b/JFSphoto.py @@ -609,6 +609,8 @@ class Jfsphoto (object): def do_methods(self,panel): + self.nofin = True + def get_duration(): if panel.tint.get().split()[4]=='ms': f = float(panel.tint.get().split()[3]) @@ -629,17 +631,21 @@ class Jfsphoto (object): 'size': 8, } - def waitfor(x,name,val,p): + + + def waitfor(): + print('wait',config.still_working) + self.nofin = config.still_working #panel.bcollect.invoke() - print('Working') - self.df['m1'] = config.rxData16 - d = self.df.iloc[p]['darkline'] - b = self.df.iloc[p]['baseline'] - w = self.df.iloc[p]["m1"] - val[3]= np.log10(b/(d-w)) - val[4]= panel.SHvalue.get() - val[5]= panel.ICGvalue.get() - tree.item(x, text=name,values=val) + # print('Working') + # self.df['m1'] = config.rxData16 + # d = self.df.iloc[p]['darkline'] + # b = self.df.iloc[p]['baseline'] + # w = self.df.iloc[p]["m1"] + # val[3]= np.log10(b/(d-w)) + # val[4]= panel.SHvalue.get() + # val[5]= panel.ICGvalue.get() + # tree.item(x, text=name,values=val) def cb1(event): @@ -648,6 +654,7 @@ class Jfsphoto (object): print(f' time {panel.tint.get()} {get_duration()} ms ') def cb(event): + #if self.check_requirement() == True: # get selected and save values name = tree.selection()[0] @@ -663,18 +670,23 @@ class Jfsphoto (object): if tk.messagebox.askokcancel(title='Messurement', message=s): panel.bcollect.invoke() ## 3000 shoud be calculated - panel.after(3000,waitfor(x,name,val,p)) + #panel.after(3000,waitfor(x,name,val,p)) #print(get_duration()) #time.sleep(3) - # self.df['m1'] = config.rxData16 - # d = self.df.iloc[p]['darkline'] - # b = self.df.iloc[p]['baseline'] - # w = self.df.iloc[p]["m1"] - # #print(d,b,w,d-w, np.log10(b/(d-w))) - # val[3]= np.log10(b/(d-w)) - # val[4]= panel.SHvalue.get() - # val[5]= panel.ICGvalue.get() - # tree.item(x, text=name,values=val) + #while config.still_working==True : + while self.nofin == True: + tree.after(1000,waitfor) + + print('get rxData16') + self.df['m1'] = config.rxData16 + d = self.df.iloc[p]['darkline'] + b = self.df.iloc[p]['baseline'] + w = self.df.iloc[p]["m1"] + #print(d,b,w,d-w, np.log10(b/(d-w))) + val[3]= np.log10(b/(d-w)) + val[4]= panel.SHvalue.get() + val[5]= panel.ICGvalue.get() + tree.item(x, text=name,values=val) def cb2(event): diff --git a/config.py b/config.py index 865ae5b..9937875 100644 --- a/config.py +++ b/config.py @@ -33,3 +33,5 @@ balanced = 0 #Photometer status Photometer off photometer = 0 +# wait for data +still_working = True