Darkline handling implemented
This commit is contained in:
parent
f06f87d1ed
commit
d8b0e185a1
@ -228,6 +228,10 @@ class buildpanel(tk.Frame):
|
|||||||
|
|
||||||
def jfsAddOns(self,CCDplot):
|
def jfsAddOns(self,CCDplot):
|
||||||
|
|
||||||
|
def darkline():
|
||||||
|
if (self.jf.do_save_darkline(config.rxData16)==1):
|
||||||
|
self.jfsdark_check.config(state=tk.NORMAL)
|
||||||
|
|
||||||
self.jfstitel = tk.Label(self, text=' Photometer ')
|
self.jfstitel = tk.Label(self, text=' Photometer ')
|
||||||
#self.jfstitel.config(font=("Courier",0))
|
#self.jfstitel.config(font=("Courier",0))
|
||||||
self.jfstitel.grid(row=10,column=4,columnspan=2)
|
self.jfstitel.grid(row=10,column=4,columnspan=2)
|
||||||
@ -235,6 +239,10 @@ class buildpanel(tk.Frame):
|
|||||||
self.jfs4cal.grid(row=11,column=4)
|
self.jfs4cal.grid(row=11,column=4)
|
||||||
self.jfs4nm_check = tk.Checkbutton(self,text="[nm] scale on/off",variable=self.jf.nm_checked,command=lambda CCDplot=CCDplot: self.updateplot(CCDplot))
|
self.jfs4nm_check = tk.Checkbutton(self,text="[nm] scale on/off",variable=self.jf.nm_checked,command=lambda CCDplot=CCDplot: self.updateplot(CCDplot))
|
||||||
self.jfs4nm_check.grid(row=12,column=4)
|
self.jfs4nm_check.grid(row=12,column=4)
|
||||||
|
self.jfs4cal = tk.Button(self,text='save Darkline',fg="blue", command= darkline)
|
||||||
|
self.jfs4cal.grid(row=13,column=4)
|
||||||
|
self.jfsdark_check = tk.Checkbutton(self,text="Darkline on/off",variable=self.jf.darkline_checked,state=tk.DISABLED,command=lambda CCDplot=CCDplot: self.updateplot(CCDplot))
|
||||||
|
self.jfsdark_check.grid(row=14,column=4)
|
||||||
|
|
||||||
### Callbacks for traces, buttons, etc ###
|
### Callbacks for traces, buttons, etc ###
|
||||||
def callback(self):
|
def callback(self):
|
||||||
@ -311,10 +319,14 @@ class buildpanel(tk.Frame):
|
|||||||
def updateplot(self, CCDplot):
|
def updateplot(self, CCDplot):
|
||||||
#This subtracts the ADC-pixel from ADC-dark
|
#This subtracts the ADC-pixel from ADC-dark
|
||||||
if (config.datainvert==1):
|
if (config.datainvert==1):
|
||||||
config.pltData16 = (config.rxData16[10]+config.rxData16[11])/2 - config.rxData16
|
if (self.jf.get_darkline_checked()==1):
|
||||||
|
config.pltData16 = self.jf.darkData16 - config.rxData16
|
||||||
|
else:
|
||||||
|
config.pltData16 = (config.rxData16[10]+config.rxData16[11])/2 - config.rxData16
|
||||||
#This subtracts the average difference between even and odd pixels from the even pixels
|
#This subtracts the average difference between even and odd pixels from the even pixels
|
||||||
if (config.balanced==1):
|
if (config.balanced==1):
|
||||||
config.offset = (config.pltData16[18]+config.pltData16[20]+config.pltData16[22]+config.pltData16[24]-config.pltData16[19]-config.pltData16[21]-config.pltData16[23]-config.pltData16[24])/4
|
config.offset = (config.pltData16[18]+config.pltData16[20]+config.pltData16[22]+config.pltData16[24]-config.pltData16[19]-config.pltData16[21]-config.pltData16[23]-config.pltData16[24])/4
|
||||||
|
#print(config.offset)
|
||||||
for i in range (1847):
|
for i in range (1847):
|
||||||
config.pltData16[2*i] = config.pltData16[2*i] - config.offset
|
config.pltData16[2*i] = config.pltData16[2*i] - config.offset
|
||||||
CCDplot.a.clear()
|
CCDplot.a.clear()
|
||||||
|
|||||||
27
JFSphoto.py
27
JFSphoto.py
@ -25,7 +25,11 @@ class Jfsphoto (object):
|
|||||||
########## nm scale checkButton default nm-scale is off
|
########## nm scale checkButton default nm-scale is off
|
||||||
self.nm_checked = tk.IntVar()
|
self.nm_checked = tk.IntVar()
|
||||||
self.nm_checked.set(0)
|
self.nm_checked.set(0)
|
||||||
|
########## darkline
|
||||||
|
self.darkData16 = np.zeros(3694, np.float32)
|
||||||
|
self.darkline_checked = tk.IntVar()
|
||||||
|
self.darkline_checked.set(0)
|
||||||
|
|
||||||
def do_calibrate(self):
|
def do_calibrate(self):
|
||||||
win = tk.Toplevel()
|
win = tk.Toplevel()
|
||||||
win.geometry("450x200+100+100")
|
win.geometry("450x200+100+100")
|
||||||
@ -71,6 +75,27 @@ class Jfsphoto (object):
|
|||||||
win.grab_set()
|
win.grab_set()
|
||||||
win.wait_window()
|
win.wait_window()
|
||||||
|
|
||||||
|
def do_msg(self,txt):
|
||||||
|
self.mroot = tk.Tk()
|
||||||
|
self.mroot.minsize(100,50)
|
||||||
|
self.mroot.title(" Info ")
|
||||||
|
self.label = tk.Label(self.mroot, text=txt,bg="yellow",fg="blue")
|
||||||
|
self.label.pack()
|
||||||
|
self.button = tk.Button(self.mroot, text='OK', width=25, command=self.mroot.destroy)
|
||||||
|
self.button.pack()
|
||||||
|
self.mroot.mainloop()
|
||||||
|
|
||||||
|
def do_save_darkline(self,dark):
|
||||||
|
x = np.min(dark)
|
||||||
|
if (x < 3700):
|
||||||
|
self.do_msg(" This is not a Darkline ")
|
||||||
|
return 0
|
||||||
|
else :
|
||||||
|
self.darkData16 = dark*1.0
|
||||||
|
return 1
|
||||||
|
|
||||||
|
def get_darkline_checked(self):
|
||||||
|
return self.darkline_checked.get()
|
||||||
|
|
||||||
def checkit(self):
|
def checkit(self):
|
||||||
self.nm = int(self.tnm.get())
|
self.nm = int(self.tnm.get())
|
||||||
|
|||||||
@ -2,7 +2,7 @@ import numpy as np
|
|||||||
|
|
||||||
|
|
||||||
#serial definitions
|
#serial definitions
|
||||||
port = 'COM3' #'/dev/ttyACM0'
|
port = 'COM7' #'/dev/ttyACM0'
|
||||||
baudrate = 115200
|
baudrate = 115200
|
||||||
|
|
||||||
#Data as the program handles
|
#Data as the program handles
|
||||||
@ -17,7 +17,7 @@ stopsignal = 0
|
|||||||
#Data arrays for received bytes
|
#Data arrays for received bytes
|
||||||
rxData8 = np.zeros(7388, np.uint8)
|
rxData8 = np.zeros(7388, np.uint8)
|
||||||
rxData16 = np.zeros(3694, np.uint16)
|
rxData16 = np.zeros(3694, np.uint16)
|
||||||
pltData16 = np.zeros(3694, np.uint16)
|
pltData16 = np.zeros(3694, np.float32)
|
||||||
|
|
||||||
#Arrays for data to transmit
|
#Arrays for data to transmit
|
||||||
txsh = np.uint8([0,0,0,0])
|
txsh = np.uint8([0,0,0,0])
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user