Commit 08307ab1 authored by Holger Niemann's avatar Holger Niemann
Browse files

some changes back to old get program

parent 782d0a01
...@@ -217,7 +217,7 @@ def correct_images(images,badpixels): ...@@ -217,7 +217,7 @@ def correct_images(images,badpixels):
if type(badpixels)!=int: if type(badpixels)!=int:
if type(images) == list: if type(images) == list:
# return corrected images also as list of 2D arrays # return corrected images also as list of 2D arrays
images = restore_bad_pixels(images, np.invert(badpixels==1)).astype(np.float32) images = restore_bad_pixels(images, np.invert(badpixels==1))#.astype(np.float32)
images = list(images) images = list(images)
else: else:
# keep shape # keep shape
......
...@@ -375,13 +375,13 @@ def download_raw_images_by_times(port,starttime,stoptime,version=0,intervalSize= ...@@ -375,13 +375,13 @@ def download_raw_images_by_times(port,starttime,stoptime,version=0,intervalSize=
if fastDL: if fastDL:
def download_raw_images_by_program_via_png(port,program,time_s=0,version=0,threads=1, verbose=0): def download_raw_images_by_program_via_png(port,program,time_s=0,version=0,threads=1, verbose=0):
# prog=AKF_1.get_program_from_PID(program) prog=AKF_1.get_program_from_PID(program)
try: # try:
t_program = AKF_2.get_program_from_to(program) # t_program = AKF_2.get_program_from_to(program)
prog =AKF_2.get_program_list(t_program[0], t_program[1]) # prog =AKF_2.get_program_list(t_program[0], t_program[1])
# if prog[0]: if prog[0]:
starttime=prog[0]['trigger']['1'][0] starttime=prog[1]['trigger']['1'][0]
stoptime=prog[0]['trigger']['6'][0] stoptime=prog[1]['trigger']['6'][0]
success=True success=True
OP=get_OP_by_time(starttime) OP=get_OP_by_time(starttime)
Cam=portcamdict[OP]['AEF'+str(port)] Cam=portcamdict[OP]['AEF'+str(port)]
...@@ -465,8 +465,8 @@ if fastDL: ...@@ -465,8 +465,8 @@ if fastDL:
times=times+resultdict[order.index(i)][2] times=times+resultdict[order.index(i)][2]
del resultdict del resultdict
return success,np.array(times),images return success,np.array(times),images
except Exception as E: # except Exception as E:
raise Exception(E) # raise Exception(E)
def download_raw_images_png_by_times_thread(port,times,out_q,threadnumber,version=0): def download_raw_images_png_by_times_thread(port,times,out_q,threadnumber,version=0):
...@@ -593,15 +593,15 @@ def download_raw_parlog_by_times(port,starttime,stoptime,version=0): ...@@ -593,15 +593,15 @@ def download_raw_parlog_by_times(port,starttime,stoptime,version=0):
def get_INFRATEC_filter_by_program(program,version=0): def get_INFRATEC_filter_by_program(program,version=0):
# prog=AKF_1.get_program_from_PID(program) prog=AKF_1.get_program_from_PID(program)
try: # try:
t_program = AKF_2.get_program_from_to(program) # t_program = AKF_2.get_program_from_to(program)
prog =AKF_2.get_program_list(t_program[0], t_program[1]) # prog =AKF_2.get_program_list(t_program[0], t_program[1])
# if prog[0]: if prog[0]:
starttime=prog[0]['trigger']['1'][0] starttime=prog[1]['trigger']['1'][0]
stoptime=prog[0]['trigger']['6'][0] stoptime=prog[1]['trigger']['6'][0]
return get_INFRATEC_filter_by_times(starttime,stoptime,50,version) return get_INFRATEC_filter_by_times(starttime,stoptime,50,version)
except: else:#except:
print("cannot find the program") print("cannot find the program")
return False,0,0 return False,0,0
...@@ -679,15 +679,15 @@ def get_camera_temp_by_times(port,starttime,stoptime,version=0): ...@@ -679,15 +679,15 @@ def get_camera_temp_by_times(port,starttime,stoptime,version=0):
return AKF_1.read_restdb(larchivepath+"DATASTREAM/V"+str(version)+"/1/cameratempetarure/_signal.json?from="+str(starttime)+"&upto="+str(stoptime)) return AKF_1.read_restdb(larchivepath+"DATASTREAM/V"+str(version)+"/1/cameratempetarure/_signal.json?from="+str(starttime)+"&upto="+str(stoptime))
def get_sensor_temp_by_program(port,program,version=0): def get_sensor_temp_by_program(port,program,version=0):
# prog=AKF_1.get_program_from_PID(program) prog=AKF_1.get_program_from_PID(program)
try: # try:
t_program = AKF_2.get_program_from_to(program) # t_program = AKF_2.get_program_from_to(program)
prog =AKF_2.get_program_list(t_program[0], t_program[1]) # prog =AKF_2.get_program_list(t_program[0], t_program[1])
# if prog[0]: if prog[0]:
starttime=prog[0]['trigger']['1'][0] starttime=prog[1]['trigger']['1'][0]
stoptime=prog[0]['trigger']['6'][0] stoptime=prog[1]['trigger']['6'][0]
return get_sensor_temp_by_times(port,starttime,stoptime,version) return get_sensor_temp_by_times(port,starttime,stoptime,version)
except: else:#except:
print("cannot find the program") print("cannot find the program")
return False,0,0 return False,0,0
...@@ -1332,145 +1332,148 @@ def apply_NUC(images,gain,offset,gain_error=0,offset_error=0,give_error=False): ...@@ -1332,145 +1332,148 @@ def apply_NUC(images,gain,offset,gain_error=0,offset_error=0,give_error=False):
return 0 return 0
def get_calib_data(port,program,emissivity=0.8,Temp_V=2,version=0,back_emissivity=0.8, verbose=0): def get_calib_data(port,program,emissivity=0.8,Temp_V=2,version=0,back_emissivity=0.8, verbose=0):
# prog=AKF_1.get_program_from_PID(program) prog=AKF_1.get_program_from_PID(program)
try: # try:
t_program = AKF_2.get_program_from_to(program) # t_program = AKF_2.get_program_from_to(program)
prog =AKF_2.get_program_list(t_program[0], t_program[1]) # prog =AKF_2.get_program_list(t_program[0], t_program[1])
# if prog[0]: if prog[0]:
t0=prog[0]['trigger']['0'][0] t0=prog[1]['trigger']['0'][0]
t1=prog[0]['trigger']['1'][0] t1=prog[1]['trigger']['1'][0]
t6=prog[0]['trigger']['6'][0] t6=prog[1]['trigger']['6'][0]
OP=get_OP_by_program(program) # except Exception as E:
Camera=portcamdict[OP]['AEF'+str(port)] # print("Warning: Program was not found: ",E)
if Camera.split("_")[0]=="Infratec": # return 0,0,0,0,0,0,0,0,0,0
cf=get_INFRATEC_filter_by_program(program,version) OP=get_OP_by_program(program)
if cf[0]: Camera=portcamdict[OP]['AEF'+str(port)]
cfilter=cf[2] if Camera.split("_")[0]=="Infratec":
else: cf=get_INFRATEC_filter_by_program(program,version)
cfilter=-1 if cf[0]:
raise Exception("Filter not found for INFRATEC Camera") cfilter=cf[2]
else: else:
cfilter=0 cfilter=-1
expo_DL=get_exposure_by_times(port,t1,t6,version) raise Exception("Filter not found for INFRATEC Camera")
if expo_DL[0]: else:
t_exp=int(expo_DL[2][0]) cfilter=0
del expo_DL expo_DL=get_exposure_by_times(port,t1,t6,version)
time=int(TimeToNs([2017,9,26],[8,0,0,0])) if expo_DL[0]:
LUT_DL=download_LUT(port,time,t_exp,emissivity,cfilter,version, verbose=verbose-1) t_exp=int(expo_DL[2][0])
if LUT_DL[0]: del expo_DL
LUT=LUT_DL[1] time=int(TimeToNs([2017,9,26],[8,0,0,0]))
del LUT_DL LUT_DL=download_LUT(port,time,t_exp,emissivity,cfilter,version, verbose=verbose-1)
back_DL=download_background_by_times(port,t0,t1,t_exp,cfilter,version) if LUT_DL[0]:
if back_DL[0]: LUT=LUT_DL[1]
background=back_DL[2] del LUT_DL
if Temp_V==1: back_DL=download_background_by_times(port,t0,t1,t_exp,cfilter,version)
if verbose>0: if back_DL[0]:
print('use temperature calibration version 1') background=back_DL[2]
backtime=back_DL[1] if Temp_V==1:
backtime=backtime.tolist() if verbose>0:
divertorpart="all" print('use temperature calibration version 1')
TCT_dl=get_average_divertor_TC_for_camtemp(port,int(backtime-2e9),int(backtime+2e9),divertorpart) backtime=back_DL[1]
backtime=backtime.tolist()
divertorpart="all"
TCT_dl=get_average_divertor_TC_for_camtemp(port,int(backtime-2e9),int(backtime+2e9),divertorpart)
if TCT_dl[0]:
refT=np.average(TCT_dl[2])
else:
TCT_dl=get_average_divertor_TC_for_camtemp(port,int(backtime-6e9),int(backtime+6e9),divertorpart)
if TCT_dl[0]: if TCT_dl[0]:
refT=np.average(TCT_dl[2]) refT=np.average(TCT_dl[2])
else: else:
TCT_dl=get_average_divertor_TC_for_camtemp(port,int(backtime-6e9),int(backtime+6e9),divertorpart) raise Exception("Unable to find thermocouple data")
if TCT_dl[0]: elif Temp_V==2:
refT=np.average(TCT_dl[2]) if verbose>0:
else: print('use temperature calibration version 2')
raise Exception("Unable to find thermocouple data") frame=background.copy()
elif Temp_V==2: background=get_average_background_recangle(port,background)
if verbose>0: refT=28.5
print('use temperature calibration version 2') elif Temp_V==3:
frame=background.copy() if verbose>0:
background=get_average_background_recangle(port,background) print('use temperature calibration version 3')
refT=28.5 frame=background.copy()
elif Temp_V==3: background=get_average_background_recangle(port,background)
if verbose>0: refT=28.5
print('use temperature calibration version 3')
frame=background.copy()
background=get_average_background_recangle(port,background)
refT=28.5
# back_off=estimate_offset(port,program) # back_off=estimate_offset(port,program)
# background=(background-back_off)/(back_emissivity)+back_off # background=(background-back_off)/(back_emissivity)+back_off
else: else:
raise Exception("Unknown temperature calibration method") raise Exception("Unknown temperature calibration method")
if cfilter==0 and not Camera.split("_")[0]=="Infratec": if cfilter==0 and not Camera.split("_")[0]=="Infratec":
if (port == 31) or (port == 21 and float(program[4:]) > 1110): if (port == 31) or (port == 21 and float(program[4:]) > 1110):
print("rebuilding coldframe") print("rebuilding coldframe")
#use any way the rebuilt coldframe. #use any way the rebuilt coldframe.
sT = get_sensor_temp_by_program(port, program)[2][0] sT = get_sensor_temp_by_program(port, program)[2][0]
coldref, hotref = IR_tools.load_ref_images('AEF' + str(port), t_exp) coldref, hotref = IR_tools.load_ref_images('AEF' + str(port), t_exp)
filestring = 'AEF' + str(port) + '_et' + str(t_exp) filestring = 'AEF' + str(port) + '_et' + str(t_exp)
amap = np.load(join(IRCamColdframes_fittingpath, filestring + '_a.npy')) amap = np.load(join(IRCamColdframes_fittingpath, filestring + '_a.npy'))
bmap = np.load(join(IRCamColdframes_fittingpath, filestring + '_b.npy')) bmap = np.load(join(IRCamColdframes_fittingpath, filestring + '_b.npy'))
cirebuild = IR_tools.reconstruct_coldframe(t_exp, sT, amap, bmap, coldref) cirebuild = IR_tools.reconstruct_coldframe(t_exp, sT, amap, bmap, coldref)
gain, offset = IR_tools.calculate_gain_offset_image(cirebuild, None, coldref, hotref) gain, offset = IR_tools.calculate_gain_offset_image(cirebuild, None, coldref, hotref)
gain[gain == np.inf] = 0 gain[gain == np.inf] = 0
offset[offset == np.inf] = 0 offset[offset == np.inf] = 0
badpixels=find_badpixels(port,gain,offset,niterations=10,tolerance=10) badpixels=find_badpixels(port,gain,offset,niterations=10,tolerance=10)
gain_error=0 gain_error=0
offset_error=0 offset_error=0
exist,time,frames=download_raw_images_by_times(port,t1,int(t1+0.02*1e9),version) exist,time,frames=download_raw_images_by_times(port,t1,int(t1+0.02*1e9),version)
if exist: if exist:
frames=[im.swapaxes(0,1) for im in frames] frames=[im.swapaxes(0,1) for im in frames]
bim=apply_NUC([frames[0]],gain,offset) bim=apply_NUC([frames[0]],gain,offset)
background=get_average_background_recangle(port,bim[0]) background=get_average_background_recangle(port,bim[0])
else:
raise Exception("cannot find the first frame of the discharge, reconstruction failed")
elif (port == 11) or (port == 21):
coldref, hotref = IR_tools.load_ref_images('AEF' + str(port), t_exp)
NUC_DL=download_NUC_by_times(port,t0,t1,t_exp,version)
if NUC_DL[0]==False:
raise Exception("NUC was not found")
else:
ci = NUC_DL[1][2]
gain, offset = IR_tools.calculate_gain_offset_image(ci, None, coldref, hotref)
gain[gain == np.inf] = 0
offset[offset == np.inf] = 0
badpixels=find_badpixels(port,gain,offset,niterations=10,tolerance=10)
gain_error=0
offset_error=0
exist,time,frames=download_raw_images_by_times(port,t1,int(t1+0.02*1e9),version)
if exist:
frames=[im.swapaxes(0,1) for im in frames]
bim=apply_NUC([frames[0]],gain,offset)
background=get_average_background_recangle(port,bim[0])
else:
raise Exception("background wrong due to wrong NUC, firstframe not found, reconstruction failed")
else: else:
NUC_DL=download_NUC_by_times(port,t0,t1,t_exp,version) raise Exception("cannot find the first frame of the discharge, reconstruction failed")
if NUC_DL[0]==False: elif (port == 11) or (port == 21):
raise Exception("NUC was not found") coldref, hotref = IR_tools.load_ref_images('AEF' + str(port), t_exp)
else: NUC_DL=download_NUC_by_times(port,t0,t1,t_exp,version)
gain=np.array(NUC_DL[1][0]) if NUC_DL[0]==False:
offset=np.array(NUC_DL[1][1]) raise Exception("NUC was not found")
offset[offset<-1e300]=0 else:
gain_error=np.array(NUC_DL[1][4]) ci = NUC_DL[1][2]
offset_error=np.array(NUC_DL[1][5]) gain, offset = IR_tools.calculate_gain_offset_image(ci, None, coldref, hotref)
badpixels=np.array(NUC_DL[1][3],dtype=np.ubyte) gain[gain == np.inf] = 0
if np.max(badpixels)==0: offset[offset == np.inf] = 0
if verbose>0: badpixels=find_badpixels(port,gain,offset,niterations=10,tolerance=10)
print(datetime.datetime.now(),"Scanning for bad pixel")
# initial list from config files
init_bp_list = IR_tools.read_bad_pixels_from_file(port, program=program)
# find more bad pixel
badpixels = find_badpixels(port, gain, offset, init_bp_list=init_bp_list, niterations=10, tolerance=10, verbose=verbose-1)
else:
gain=0
offset=0
badpixels=find_badpixels(port,frame-background,offset,niterations=10,tolerance=10,plot_it=False)#find_badpixels(port,gain,offset)
gain_error=0 gain_error=0
offset_error=0 offset_error=0
exist,time,frames=download_raw_images_by_times(port,t1,int(t1+0.02*1e9),version)
if exist:
frames=[im.swapaxes(0,1) for im in frames]
bim=apply_NUC([frames[0]],gain,offset)
background=get_average_background_recangle(port,bim[0])
else:
raise Exception("background wrong due to wrong NUC, firstframe not found, reconstruction failed")
else:
NUC_DL=download_NUC_by_times(port,t0,t1,t_exp,version)
if NUC_DL[0]==False:
raise Exception("NUC was not found")
else:
gain=np.array(NUC_DL[1][0])
offset=np.array(NUC_DL[1][1])
offset[offset<-1e300]=0
gain_error=np.array(NUC_DL[1][4])
offset_error=np.array(NUC_DL[1][5])
badpixels=np.array(NUC_DL[1][3],dtype=np.ubyte)
if np.max(badpixels)==0:
if verbose>0:
print(datetime.datetime.now(),"Scanning for bad pixel")
# initial list from config files
init_bp_list = IR_tools.read_bad_pixels_from_file(port, program=program)
# find more bad pixel
badpixels = find_badpixels(port, gain, offset, init_bp_list=init_bp_list, niterations=10, tolerance=10, verbose=verbose-1)
else: else:
raise Exception("no background image found") gain=0
offset=0
badpixels=find_badpixels(port,frame-background,offset,niterations=10,tolerance=10,plot_it=False)#find_badpixels(port,gain,offset)
gain_error=0
offset_error=0
else: else:
raise Exception("no LUT found") raise Exception("no background image found")
else: else:
raise Exception("no exposure time found") raise Exception("no LUT found")
return background,LUT,refT,gain,offset,badpixels,t_exp,cfilter,gain_error,offset_error else:
except: raise Exception("no exposure time found")
print("Warning: Program was not found") return background,LUT,refT,gain,offset,badpixels,t_exp,cfilter,gain_error,offset_error
return 0,0,0,0,0,0,0,0,0,0 # except Exception as E:
# print("Warning: Program was not found: ",E)
# return 0,0,0,0,0,0,0,0,0,0
def find_badpixels(port, gain, offset, init_bp_list=None, niterations=3, def find_badpixels(port, gain, offset, init_bp_list=None, niterations=3,
tolerance=10, plot_it=False, verbose=0): tolerance=10, plot_it=False, verbose=0):
...@@ -1607,122 +1610,56 @@ if __name__=='__main__': ...@@ -1607,122 +1610,56 @@ if __name__=='__main__':
print("local function calling") print("local function calling")
# #
# #status,time,images,valid=get_temp_from_raw_by_program_V1(51,"20171018.019",time_s=0,emi=0.8,divertorpart="all",version=1) # #status,time,images,valid=get_temp_from_raw_by_program_V1(51,"20171018.019",time_s=0,emi=0.8,divertorpart="all",version=1)
## status1,time1,images1,valid1=get_temp_from_raw_by_program_V1(41,"20171024.016",time_s=[0.75,0.99],emi=0.8,version=1) # status1,time1,images1,valid1=get_temp_from_raw_by_program_V1(41,"20171024.016",time_s=[0.75,0.99],emi=0.8,version=1)
## exist,time1,frames=download_raw_images_by_program_via_png(41,"20171024.016",time_s=[0.75,0.99],version=1,threads=1) ## exist,time1,frames=download_raw_images_by_program_via_png(41,"20171024.016",time_s=[0.75,0.99],version=1,threads=1)
# import h5py as h5 port=51
# # prog="20171108.015"
# for prog in ["20171108.015"]:#"20171109.010","20170926.009","20171207.009"]: # prog="20171025.030"
# for port in [20,21]: prog="20171012.035"
# try: status,time,images,valid=get_temp_from_raw_by_program(port,prog,time_s=[0,1],emi=0.82,T_version=2,version=0,threads=1,give_ERROR=False,use_firstframe_as_background=True)
# texp=get_exposure_by_program(port,prog)
# except: # bla=get_exposure_by_program(port,prog)
# texp=[False] # status2,time2,images2=download_raw_images_by_program_via_png(port,prog,time_s=[0,0.2],threads=1)
# if texp[0]: import holn.functions as fu
# texp=texp[2][0] import h5py as h5
# background=download_background_by_program(port,prog,texp) szene=h5.File("X:\\E4 Diagnostics\\QIR\Calibrations\\scene_models\\AEF"+str(port)+"\\AEF"+str(port)+"_scene_model.h5")
# Xloc=np.asarray(szene['x'])
# if background[0]: Yloc=np.asarray(szene['y'])
# Zloc=np.asarray(szene['z'])
## btest=check_backgroundframe(background[2]) CAD=np.asarray(szene['CAD'])
## if not btest[0]: plt.figure()#
# plt.figure() plt.imshow(CAD,cmap='gray')
# plt.imshow(background[2],vmin=np.mean(background[2])-200,vmax=np.mean(background[2])+200) plt.imshow(images[-1],vmin=300,vmax=750,cmap=fu.exJet_trans)
## plt.colorbar() cb=plt.colorbar()
# plt.title(prog+" "+str(port)) cb.set_label("temperature K", rotation=270,labelpad=26,fontsize=26)
cb.ax.tick_params(labelsize=26)
# cold=download_NUC_by_program(port,prog,texp)
# if cold[0]:
# if port==11:
# portnr=21
# elif port==21:
# portnr=11
# else:
# portnr=port
# camera=portcamdict['OP1.2a']['AEF'+str(portnr)]
# path="\\\\sv-e4-fs-1\\E4-Mitarbeiter\\E4 Diagnostics\\QIR\\Calibrations\\IRCamReferenceImages\\"
## path="\\\\sv-e4-fs-1\\E4-Mitarbeiter\\E4 Diagnostics\\QIR\\Software\\QI-RealTime\\v1.0.1\\QIR-IrAnalysis\\release\\Config\\Thermal calibration\\"
# file=h5.File(path+"IRCAM_"+camera.split("_")[2]+"\\"+camera+"_nuc_reference_cold_"+str(int(texp))+"us.h5",'r')
## file=h5.File(path+camera+"\\"+camera+"_nuc_reference_cold_"+str(int(texp))+"us.h5",'r')
# refframe=np.array(file[camera+"_nuc_reference_cold_"+str(int(texp))+"us.h5"])
## ctest=check_coldframe_by_refframe(cold[1][2],refframe,plot_it=False)
# references=[]
# shapi=np.shape(refframe)
# for i in [int(shapi[1]//4),int(shapi[1]//2),int(shapi[1]//4*3)]:
# dataline=refframe[0:shapi[0],i]
# references.append(dataline-np.mean(dataline))
# ctest=IR_tools.check_coldframe(cold[1][2],references,plot_it=True)
# print(ctest,port,prog)
# if not ctest[0]:
# bla=np.array(cold[1][2])-np.array(refframe)
# print(np.mean(bla),np.max(bla),np.min(bla),np.std(bla),(np.max(bla)-np.min(bla))/np.mean(bla),port)
# dataset=[]
# threshold=100
# shapi=np.shape(bla)
# plt.figure()
# for i in [int(shapi[1]//4),int(shapi[1]//2),int(shapi[1]//4*3)]:
# referenceline=bla[0:shapi[0],i]
# meanref=referenceline-np.mean(referenceline)
# dataset.append(meanref)#np.max(meanref[100:-99])-np.min(meanref[100:-99]))
## plt.plot(meanref,label=str(i))
# for j in range(len(dataset)):
# if j==0:
# plt.plot(dataset[j]-dataset[-1],label=str(j))
# else:
# plt.plot(dataset[j]-dataset[j-1],label=str(j))
# plt.title(prog+"_AEF"+str(port))
# if np.mean(dataset)>threshold:
# valid=False
# else:
# valid=True
# print(valid,np.mean(dataset))#,np.mean(dataset[0]-dataset[-1]),np.mean(dataset[1]-dataset[0]),np.mean(dataset[2]-dataset[1]))
# plt.figure()
# plt.imshow(cold[1][2],vmin=np.mean(cold[1][2])-500,vmax=np.mean(cold[1][2])+500)
# plt.colorbar()
# plt.title(prog+" "+str(port))
# plt.figure()
# plt.imshow(bla,vmin=np.mean(bla)-100,vmax=np.mean(bla)+100)
# plt.colorbar()
# plt.figure()
# plt.imshow(refframe,vmin=np.mean(refframe)-100,vmax=np.mean(refframe)+100)
# plt.colorbar()
# plt.title("referenceframe "+str(port))
port=20
prog="20171108.015"
# status,time,images,valid=get_temp_from_raw_by_program(port,prog,time_s=[0,0.2],emi=0.82,T_version=2,version=0,threads=1,give_ERROR=False,use_firstframe_as_background=True)
bla=get_exposure_by_program(port,prog)
status2,time2,images2=download_raw_images_by_program_via_png(port,prog,time_s=[0,0.2],threads=1)
# plt.figure()
# plt.imshow(images[0],vmin=300,vmax=400)
# plt.colorbar()
# tmax=[] # tmax=[]
# port=20 # port=20
NUCblock=download_NUC_by_program(port,prog,bla[2][0]) # NUCblock=download_NUC_by_program(port,prog,bla[2][0])
background,LUT,refT,gain,offset,badpixels,t_exp,cfilter,gain_error,offset_error=get_calib_data(port,prog) # background,LUT,refT,gain,offset,badpixels,t_exp,cfilter,gain_error,offset_error=get_calib_data(port,prog)
refcoldhot=IR_tools.load_ref_images("AEF"+str(port),bla[2][0]) # refcoldhot=IR_tools.load_ref_images("AEF"+str(port),bla[2][0])
recal_gain_offset=IR_tools.calculate_gain_offset_image_pix(NUCblock[1][2].copy(),None,refcoldhot[0].copy(),refcoldhot[1].copy()) # recal_gain_offset=IR_tools.calculate_gain_offset_image_pix(NUCblock[1][2].copy(),None,refcoldhot[0].copy(),refcoldhot[1].copy())
plt.figure() # plt.figure()
plt.imshow(NUCblock[1][0]-recal_gain_offset[0]) # plt.imshow(NUCblock[1][0]-recal_gain_offset[0])
plt.title("gain") # plt.title("gain")
plt.figure() # plt.figure()
plt.imshow(NUCblock[1][1]-recal_gain_offset[1]) # plt.imshow(NUCblock[1][1]-recal_gain_offset[1])
plt.title("offset") # plt.title("offset")
# ima1=apply_NUC(images2.copy(),NUCblock[1][0],NUCblock[1][1]) # ima1=apply_NUC(images2.copy(),NUCblock[1][0],NUCblock[1][1])
# ima2=apply_NUC(images2.copy(),recal_gain_offset[0],recal_gain_offset[1]) # ima2=apply_NUC(images2.copy(),recal_gain_offset[0],recal_gain_offset[1])
ima1=apply_calib_on_raw(images2.copy(),background,LUT,gain=NUCblock[1][0],offset=NUCblock[1][1]) # ima1=apply_calib_on_raw(images2.copy(),background,LUT,gain=NUCblock[1][0],offset=NUCblock[1][1])
ima2=apply_calib_on_raw(images2.copy(),background,LUT,gain=recal_gain_offset[0],offset=recal_gain_offset[1]) # ima2=apply_calib_on_raw(images2.copy(),background,LUT,gain=recal_gain_offset[0],offset=recal_gain_offset[1])
#
plt.figure() # plt.figure()
plt.imshow(ima1[0],vmin=300,vmax=400) # plt.imshow(ima1[0],vmin=300,vmax=400)
plt.colorbar() # plt.colorbar()
plt.title("aleix nuc") # plt.title("aleix nuc")
#
plt.figure() # plt.figure()
plt.imshow(ima2[0],vmin=300,vmax=400) # plt.imshow(ima2[0],vmin=300,vmax=400)
plt.colorbar() # plt.colorbar()
plt.title("adnan nuc") # plt.title("adnan nuc")
# for i in range(len(images)): # for i in range(len(images)):
# tmax.append(np.max(images[i])) # tmax.append(np.max(images[i]))
# plt.figure() # plt.figure()
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment