Commit a9fa7d73 authored by Holger Niemann's avatar Holger Niemann
Browse files

implement OP1.2b conversion into download, bug fixing in upload, a timevector error was inside

parent 2b574e87
...@@ -439,8 +439,8 @@ def calculate_gain_offset_image(cold_image,hot_image=None,reference_cold=None,re ...@@ -439,8 +439,8 @@ def calculate_gain_offset_image(cold_image,hot_image=None,reference_cold=None,re
# Sh_ref = hot_image[ ( np.int( np.shape(hot_image)[0] /2 ) ) ][np.int( (np.shape(hot_image)[1] /2 ) ) ] # Sh_ref = hot_image[ ( np.int( np.shape(hot_image)[0] /2 ) ) ][np.int( (np.shape(hot_image)[1] /2 ) ) ]
# Sc_ref = cold_image[ ( np.int( (np.shape(cold_image)[0]) /2 ) ) ][( np.int( (np.shape(cold_image)[1]) /2 ) ) ] # Sc_ref = cold_image[ ( np.int( (np.shape(cold_image)[0]) /2 ) ) ][( np.int( (np.shape(cold_image)[1]) /2 ) ) ]
print(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 ]) # print(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 ])
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 ]) # 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 ]) 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 ]) 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) Gain_rel = ( Sh_ref - Sc_ref ) / ( hot_image - cold_image)
......
...@@ -154,7 +154,9 @@ for date in dates: ...@@ -154,7 +154,9 @@ for date in dates:
path = rawdatapath.format(pc_list[i],date) path = rawdatapath.format(pc_list[i],date)
print(datetime.datetime.now(),"Starting Upload for "+ports[i],date) print(datetime.datetime.now(),"Starting Upload for "+ports[i],date)
f_success.write(ports[i]+" \n") f_success.write(ports[i]+" \n")
f_success.flush()
f_success.write("program folder meta1 meta2 raw1 raw2 \n") f_success.write("program folder meta1 meta2 raw1 raw2 \n")
f_success.flush()
# foutf.write(datetime.datetime.now(),"Starting Upload for "+ports[i],date,"\n") # foutf.write(datetime.datetime.now(),"Starting Upload for "+ports[i],date,"\n")
# find all programs of this date on this PC # find all programs of this date on this PC
programtimes = [] programtimes = []
...@@ -374,31 +376,31 @@ for date in dates: ...@@ -374,31 +376,31 @@ for date in dates:
framenumber1=np.asarray(attri1['frame_number']) framenumber1=np.asarray(attri1['frame_number'])
framenumber2=np.asarray(attri2['frame_number']) framenumber2=np.asarray(attri2['frame_number'])
try: try:
ftype1=np.asarray(attri1['frame_type']) frametype1=np.asarray(attri1['frame_type'])
frametype1=[] # frametype1=[]
for ele in ftype1: # for ele in ftype1:
if ele == "nuc": # if ele == "nuc":
frametype1.append(0) # frametype1.append(0)
elif ele == "background": # elif ele == "background":
frametype1.append(1) # frametype1.append(1)
elif ele == "discharge": # elif ele == "discharge":
frametype1.append(2) # frametype1.append(2)
else: # else:
frametype1.append(-1) # frametype1.append(-1)
except: except:
frametype1=np.zeros((len(framenumber1)))-1 frametype1=np.zeros((len(framenumber1)))-1
try: try:
ftype2=np.asarray(attri2['frame_type']) frametype2=np.asarray(attri2['frame_type'])
frametype2=[] # frametype2=[]
for ele in ftype2: # for ele in ftype2:
if ele == "nuc": # if ele == "nuc":
frametype2.append(0) # frametype2.append(0)
elif ele == "background": # elif ele == "background":
frametype2.append(1) # frametype2.append(1)
elif ele == "discharge": # elif ele == "discharge":
frametype2.append(2) # frametype2.append(2)
else: # else:
frametype2.append(-1) # frametype2.append(-1)
except: except:
frametype2=np.zeros((len(framenumber2)))-1 frametype2=np.zeros((len(framenumber2)))-1
wrong1,correction_list1=IRup.check_timevector_framenumbers(time1,framenumber1) wrong1,correction_list1=IRup.check_timevector_framenumbers(time1,framenumber1)
...@@ -436,6 +438,8 @@ for date in dates: ...@@ -436,6 +438,8 @@ for date in dates:
print(datetime.datetime.now()," regenerate timevectors") print(datetime.datetime.now()," regenerate timevectors")
time1=IRup.regenerate_timevector(time1,0,t2,0) time1=IRup.regenerate_timevector(time1,0,t2,0)
time2,Program=IRup.regenerate_timevector(time2,1,t2,toff,True) time2,Program=IRup.regenerate_timevector(time2,1,t2,toff,True)
time1_0=IRup.regenerate_timevector(time1_0,0,t2,0)
time2_0=IRup.regenerate_timevector(time2_0,0,t2,0)
else: else:
correction_list1=[] correction_list1=[]
correction_list2=[] correction_list2=[]
...@@ -534,6 +538,7 @@ for date in dates: ...@@ -534,6 +538,7 @@ for date in dates:
rawres1=0 rawres1=0
rawres2=0 rawres2=0
f_success.write(Program+" "+str(prog_time)+" "+str(metares1)+" "+str(metares2)+" "+str(rawres1)+" "+str(rawres2)+" \n") f_success.write(Program+" "+str(prog_time)+" "+str(metares1)+" "+str(metares2)+" "+str(rawres1)+" "+str(rawres2)+" \n")
f_success.flush()
# foutf.write(datetime.datetime.now(),"raw upload deactivated","\n") # foutf.write(datetime.datetime.now(),"raw upload deactivated","\n")
else:#folder is empty else:#folder is empty
print("no files in",prog_time) print("no files in",prog_time)
......
This diff is collapsed.
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