diff --git a/IR_image_tools.py b/IR_image_tools.py index 0ced53ca60917aaf245f4a8d8a7d1036c9bc3d5d..b40f67bec9656a8a220feb8a34a89bc76c78f8d0 100644 --- a/IR_image_tools.py +++ b/IR_image_tools.py @@ -413,13 +413,13 @@ def restore_bad_pixels(frames, bad_pixel, by_list=True, check_neighbours=True, p def generate_new_hot_image(cold,reference_cold,reference_hot): - if cold==None or reference_cold==None or reference_hot==None: + if cold is None or reference_cold is None or reference_hot is None: raise Exception("Cannot Calculate new Hot image, if images are missing!") else: return reference_hot+(cold-reference_cold) def calculate_gain_offset_image_pix(cold_image,hot_image=None,reference_cold=None,reference_hot=None,bose=1): - if hot_image==None: + if hot_image is None: hot_image=generate_new_hot_image(cold_image,reference_cold,reference_hot) if bose>0: print("calculate gain and offset") @@ -432,7 +432,7 @@ def calculate_gain_offset_image_pix(cold_image,hot_image=None,reference_cold=Non return Gain_rel,Offset_rel def calculate_gain_offset_image(cold_image,hot_image=None,reference_cold=None,reference_hot=None,bose=1): - if hot_image==None: + if hot_image is None: hot_image=generate_new_hot_image(cold_image,reference_cold,reference_hot) if bose>0: print("calculate gain and offset") @@ -443,7 +443,11 @@ def calculate_gain_offset_image(cold_image,hot_image=None,reference_cold=None,re # print(cold_image[( np.int( np.shape(hot_image)[0]/2) )-2: (np.int( np.shape(hot_image)[0]/2))+3,np.int((np.shape(hot_image)[1]/2))-2:np.int((np.shape(hot_image)[1]/2))+3 ]) Sh_ref = np.mean( hot_image[( np.int( np.shape(hot_image)[0]/2) )-2: (np.int( np.shape(hot_image)[0]/2))+3,np.int((np.shape(hot_image)[1]/2))-2:np.int((np.shape(hot_image)[1]/2))+3 ]) Sc_ref = np.mean(cold_image[( np.int( np.shape(cold_image)[0]/2) )-2: (np.int( np.shape(cold_image)[0]/2))+3,np.int((np.shape(cold_image)[1]/2))-2:np.int((np.shape(cold_image)[1]/2))+3 ]) - Gain_rel = ( Sh_ref - Sc_ref ) / ( hot_image - cold_image) + difference_image=hot_image - cold_image + indexlist=np.where(difference_image==0) + difference_image[indexlist]=0.001 + Gain_rel = ( Sh_ref - Sc_ref ) / ( difference_image) + Gain_rel[indexlist]=0 Off_h_rel = Sh_ref - hot_image*Gain_rel Off_c_rel = Sc_ref - cold_image*Gain_rel Offset_rel = ( Off_h_rel + Off_c_rel ) /2 diff --git a/downloadversionIRdata.py b/downloadversionIRdata.py index 098d00aa9a12b494dc341db1f7c2302f6fe0604b..339bc805a2fc019ac58be95d9c0e51bdf3c2eb37 100644 --- a/downloadversionIRdata.py +++ b/downloadversionIRdata.py @@ -504,7 +504,7 @@ def download_background_by_times(port,starttime,stoptime,exposure,camera_filter= else: return False,0,0 -def get_NUCed_background_by_times(port,t0,t1,t_exp,cfilter,gain,offset,version=0,plot_it=True): +def get_NUCed_background_by_times(port,t0,t1,t_exp,cfilter,gain,offset,version=0,plot_it=False): "OP1.2b function" exist,btime,backgroundframes=download_calibration_raw_files_by_time(port,t_exp,t0,t1,frametype=1,version=version) camera=portcamdict["OP1.2b"]["AEF"+str(port)] diff --git a/plot_IR_data.py b/plot_IR_data.py index 097703b2a389512251cb78e094b2b2e43468df3a..6547ffe99bfccde627fd6669e8a541549c479298 100644 --- a/plot_IR_data.py +++ b/plot_IR_data.py @@ -15,7 +15,7 @@ if __name__=='__main__': #%% loading data - status,time,images,valid=downIR.get_temp_from_raw_by_program(20,"20171207.006",time_s=3.5,emi=0.8,T_version=2,version=1,threads=8,give_ERROR=False) + status,time,images,valid=downIR.get_temp_from_raw_by_program(20,"20180726.015",time_s=2.5,emi=0.8,T_version=2,version=1,threads=4,give_ERROR=False) print('fertig') #%% plotting data @@ -33,5 +33,5 @@ if __name__=='__main__': labelbottom='off') # labels along the bottom edge are off c_ax = plt.colorbar() c_ax.set_label('T [K]') - plt.savefig('20171207.006 - 2.2s - AEF20IR - in K.png', dpi=300, bbox_inches='tight') + plt.savefig('20180726.015 - 2.2s - AEF20IR - in K.png', dpi=300, bbox_inches='tight') plt.show()