baseline absorbance eingefügt output bandwidth now oriented on Lamp
This commit is contained in:
parent
d8b0e185a1
commit
d9a8a0e286
114
CCDpanelsetup.py
114
CCDpanelsetup.py
@ -231,7 +231,12 @@ class buildpanel(tk.Frame):
|
|||||||
def darkline():
|
def darkline():
|
||||||
if (self.jf.do_save_darkline(config.rxData16)==1):
|
if (self.jf.do_save_darkline(config.rxData16)==1):
|
||||||
self.jfsdark_check.config(state=tk.NORMAL)
|
self.jfsdark_check.config(state=tk.NORMAL)
|
||||||
|
def baseline():
|
||||||
|
if (self.jf.get_darkline_checked() == 1):
|
||||||
|
base = self.jf.darkData16-config.rxData16
|
||||||
|
if (self.jf.do_save_baseline(base)==1):
|
||||||
|
self.jfsbase_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)
|
||||||
@ -239,11 +244,14 @@ 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.jfsdark = tk.Button(self,text='save Darkline',fg="blue", command= darkline)
|
||||||
self.jfs4cal.grid(row=13,column=4)
|
self.jfsdark.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 = 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)
|
self.jfsdark_check.grid(row=14,column=4)
|
||||||
|
self.jfsbase = tk.Button(self,text='save Baseline',fg="blue", command= baseline)
|
||||||
|
self.jfsbase.grid(row=15,column=4)
|
||||||
|
self.jfsbase_check = tk.Checkbutton(self,text="Baseline on/off",variable=self.jf.baseline_checked,state=tk.DISABLED,command=lambda CCDplot=CCDplot: self.updateplot(CCDplot))
|
||||||
|
self.jfsbase_check.grid(row=16,column=4)
|
||||||
### Callbacks for traces, buttons, etc ###
|
### Callbacks for traces, buttons, etc ###
|
||||||
def callback(self):
|
def callback(self):
|
||||||
self.bopen.config(state=tk.DISABLED)
|
self.bopen.config(state=tk.DISABLED)
|
||||||
@ -317,44 +325,72 @@ class buildpanel(tk.Frame):
|
|||||||
|
|
||||||
|
|
||||||
def updateplot(self, CCDplot):
|
def updateplot(self, CCDplot):
|
||||||
#This subtracts the ADC-pixel from ADC-dark
|
|
||||||
if (config.datainvert==1):
|
|
||||||
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
|
|
||||||
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
|
|
||||||
#print(config.offset)
|
|
||||||
for i in range (1847):
|
|
||||||
config.pltData16[2*i] = config.pltData16[2*i] - config.offset
|
|
||||||
CCDplot.a.clear()
|
CCDplot.a.clear()
|
||||||
#plot intensities
|
# Photometer Job Baseline is the Intensity of the Lamp
|
||||||
if (config.datainvert == 1):
|
# baseline start and baseline end depends on the spektral range of the Lamp
|
||||||
## make max visible
|
# the actuel input is lower due to the absorption of the liquid
|
||||||
up = np.max(config.pltData16) + 50
|
if (self.jf.get_baseline_checked()==1):
|
||||||
if (self.jf.get_nm_checked()==1):
|
config.pltBaseData16 = self.jf.baseData16
|
||||||
CCDplot.a.plot(self.jf.get_nm_scale(),config.pltData16)
|
config.pltData16 = self.jf.darkData16 - config.rxData16
|
||||||
CCDplot.a.axis([self.jf.nm_left,self.jf.nm_right,-10,up])
|
for i in range(0,3694):
|
||||||
CCDplot.a.set_xlabel(" [nm] ")
|
if (config.pltBaseData16[i] == 0):
|
||||||
|
config.pltData16[i] = 1
|
||||||
else:
|
else:
|
||||||
CCDplot.a.plot(config.pltData16)
|
config.pltData16[i] = (config.pltData16[i] / config.pltBaseData16[i])
|
||||||
CCDplot.a.axis([0,3694,-10,4095])
|
config.pltData16 = 100*config.pltData16
|
||||||
CCDplot.a.set_xlabel("Pixelnumber")
|
|
||||||
|
up = np.max(config.pltData16) + 50
|
||||||
|
if (self.jf.get_nm_checked()==1):
|
||||||
|
CCDplot.a.plot(self.jf.get_nm_scale(),config.pltData16)
|
||||||
|
CCDplot.a.axis([self.jf.nm_left,self.jf.nm_right,-10,up])
|
||||||
|
CCDplot.a.set_xlim([self.jf.nm_left+self.jf.baseline_start*self.jf.nm_step, self.jf.nm_left+self.jf.baseline_end*self.jf.nm_step])
|
||||||
|
CCDplot.a.set_xlabel(" [nm] ")
|
||||||
|
else:
|
||||||
|
CCDplot.a.plot(config.pltData16)
|
||||||
|
CCDplot.a.axis([0,3694,-10,up])
|
||||||
|
CCDplot.a.set_xlim([self.jf.baseline_start, self.jf.baseline_end])
|
||||||
|
CCDplot.a.set_xlabel("Pixelnumber")
|
||||||
CCDplot.a.set_ylabel("Intensity")
|
CCDplot.a.set_ylabel("Intensity")
|
||||||
|
else:
|
||||||
else:
|
#This subtracts the ADC-pixel from ADC-dark
|
||||||
if (self.jf.get_nm_checked()==1):
|
if (config.datainvert==1):
|
||||||
CCDplot.a.plot(self.jf.get_nm_scale(),config.rxData16)
|
if (self.jf.get_darkline_checked()==1):
|
||||||
CCDplot.a.axis([self.jf.nm_left,self.jf.nm_right,-10,4095])
|
config.pltData16 = self.jf.darkData16 - config.rxData16
|
||||||
CCDplot.a.set_xlabel(" [nm] ")
|
else:
|
||||||
else:
|
config.pltData16 = (config.rxData16[10]+config.rxData16[11])/2 - config.rxData16
|
||||||
CCDplot.a.plot(config.rxData16)
|
#This subtracts the average difference between even and odd pixels from the even pixels
|
||||||
CCDplot.a.axis([0,3694,-10,4095])
|
if (config.balanced==1):
|
||||||
CCDplot.a.set_xlabel("Pixelnumber")
|
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
|
||||||
CCDplot.a.set_ylabel("ADCcount")
|
#print(config.offset)
|
||||||
#plot raw data
|
for i in range (1847):
|
||||||
|
config.pltData16[2*i] = config.pltData16[2*i] - config.offset
|
||||||
|
|
||||||
|
#CCDplot.a.clear()
|
||||||
|
#plot intensities
|
||||||
|
if (config.datainvert == 1):
|
||||||
|
## make max visible
|
||||||
|
up = np.max(config.pltData16) + 50
|
||||||
|
if (self.jf.get_nm_checked()==1):
|
||||||
|
CCDplot.a.plot(self.jf.get_nm_scale(),config.pltData16)
|
||||||
|
CCDplot.a.axis([self.jf.nm_left,self.jf.nm_right,-10,up])
|
||||||
|
CCDplot.a.set_xlabel(" [nm] ")
|
||||||
|
else:
|
||||||
|
CCDplot.a.plot(config.pltData16)
|
||||||
|
CCDplot.a.axis([0,3694,-10,4095])
|
||||||
|
CCDplot.a.set_xlabel("Pixelnumber")
|
||||||
|
CCDplot.a.set_ylabel("Intensity")
|
||||||
|
|
||||||
|
else:
|
||||||
|
if (self.jf.get_nm_checked()==1):
|
||||||
|
CCDplot.a.plot(self.jf.get_nm_scale(),config.rxData16)
|
||||||
|
CCDplot.a.axis([self.jf.nm_left,self.jf.nm_right,-10,4095])
|
||||||
|
CCDplot.a.set_xlabel(" [nm] ")
|
||||||
|
else:
|
||||||
|
CCDplot.a.plot(config.rxData16)
|
||||||
|
CCDplot.a.axis([0,3694,-10,4095])
|
||||||
|
CCDplot.a.set_xlabel("Pixelnumber")
|
||||||
|
CCDplot.a.set_ylabel("ADCcount")
|
||||||
|
#plot raw data
|
||||||
|
|
||||||
CCDplot.canvas.draw()
|
CCDplot.canvas.draw()
|
||||||
|
|
||||||
|
|||||||
40
JFSphoto.py
40
JFSphoto.py
@ -29,7 +29,13 @@ class Jfsphoto (object):
|
|||||||
self.darkData16 = np.zeros(3694, np.float32)
|
self.darkData16 = np.zeros(3694, np.float32)
|
||||||
self.darkline_checked = tk.IntVar()
|
self.darkline_checked = tk.IntVar()
|
||||||
self.darkline_checked.set(0)
|
self.darkline_checked.set(0)
|
||||||
|
########## baseline of the lightsource
|
||||||
|
self.baseData16 = np.zeros(3694, np.float32)
|
||||||
|
self.baseline_checked = tk.IntVar()
|
||||||
|
self.baseline_checked.set(0)
|
||||||
|
self.baseline_start=0
|
||||||
|
self.baseline_end=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")
|
||||||
@ -85,6 +91,7 @@ class Jfsphoto (object):
|
|||||||
self.button.pack()
|
self.button.pack()
|
||||||
self.mroot.mainloop()
|
self.mroot.mainloop()
|
||||||
|
|
||||||
|
############ Darkline
|
||||||
def do_save_darkline(self,dark):
|
def do_save_darkline(self,dark):
|
||||||
x = np.min(dark)
|
x = np.min(dark)
|
||||||
if (x < 3700):
|
if (x < 3700):
|
||||||
@ -97,6 +104,37 @@ class Jfsphoto (object):
|
|||||||
def get_darkline_checked(self):
|
def get_darkline_checked(self):
|
||||||
return self.darkline_checked.get()
|
return self.darkline_checked.get()
|
||||||
|
|
||||||
|
############ Baseline depends on the capacity of the light source block spektralrange if the intensity is to low
|
||||||
|
def do_save_baseline(self,base):
|
||||||
|
### no margin at all
|
||||||
|
doIt = True
|
||||||
|
#### no left margin
|
||||||
|
left = True
|
||||||
|
x = np.max(base)
|
||||||
|
if (x < 500):
|
||||||
|
self.do_msg(" This is not a Baseine \n Is the Lightsouce switch on ? ")
|
||||||
|
return 0
|
||||||
|
else:
|
||||||
|
for i in range(0,3694):
|
||||||
|
if (base[i] < 200) :
|
||||||
|
if doIt:
|
||||||
|
if left:
|
||||||
|
self.baseline_start = i
|
||||||
|
else:
|
||||||
|
self.baseline_end = i
|
||||||
|
doIt = False
|
||||||
|
self.baseData16[i] = 0
|
||||||
|
else:
|
||||||
|
if (base[i] > 300):
|
||||||
|
left = False
|
||||||
|
self.baseData16[i] = base[i]*1.0
|
||||||
|
print(self.baseline_start," ",self.baseline_end)
|
||||||
|
return 1
|
||||||
|
|
||||||
|
def get_baseline_checked(self):
|
||||||
|
return self.baseline_checked.get()
|
||||||
|
|
||||||
|
############ Calibration and Load/Save Configuration Part 2
|
||||||
def checkit(self):
|
def checkit(self):
|
||||||
self.nm = int(self.tnm.get())
|
self.nm = int(self.tnm.get())
|
||||||
self.nmi = int(self.tnmi.get())
|
self.nmi = int(self.tnmi.get())
|
||||||
|
|||||||
@ -10,7 +10,7 @@ SHperiod = np.uint32(200)
|
|||||||
ICGperiod = np.uint32(100000)
|
ICGperiod = np.uint32(100000)
|
||||||
AVGn = np.uint8([0,1])
|
AVGn = np.uint8([0,1])
|
||||||
MCLK = 2000000
|
MCLK = 2000000
|
||||||
SHsent = np.uint32(200)
|
SHsent = np.uint32(50)
|
||||||
ICGsent = np.uint32(100000)
|
ICGsent = np.uint32(100000)
|
||||||
stopsignal = 0
|
stopsignal = 0
|
||||||
|
|
||||||
@ -18,6 +18,8 @@ stopsignal = 0
|
|||||||
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.float32)
|
pltData16 = np.zeros(3694, np.float32)
|
||||||
|
pltBaseData16 = 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