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

Merge branch 'master' into 'Holgers'

Update changes also in to Holgers Working Branch

See merge request !55
parents 18cddd2c 6e5d4361
...@@ -18,7 +18,7 @@ parameter_file_path = ospath.join(ospath.dirname(__file__), 'data') ...@@ -18,7 +18,7 @@ parameter_file_path = ospath.join(ospath.dirname(__file__), 'data')
try: try:
# import sys # import sys
path=str(repr(__file__)).split("IR_config_constants")[0].split("'")[1]+"download_config" path=str(repr(__file__)).split("IR_da_config_constants")[0].split("'")[1]+"download_config"
cFile=open(path.replace('\\\\',"\\"))#+"upload_config") cFile=open(path.replace('\\\\',"\\"))#+"upload_config")
for line in cFile: for line in cFile:
if line[0:3]!="###": if line[0:3]!="###":
...@@ -441,4 +441,4 @@ c2dict={ ...@@ -441,4 +441,4 @@ c2dict={
c3dict=c2dict.copy() c3dict=c2dict.copy()
exJet=cm.colors.LinearSegmentedColormap('mod_Jet', c2dict, 1024) exJet=cm.colors.LinearSegmentedColormap('mod_Jet', c2dict, 1024)
c3dict['alpha']=((0.0,0.0,0.0),(0.33,0.99,0.99),(1.0,1.0,1.0)) c3dict['alpha']=((0.0,0.0,0.0),(0.33,0.99,0.99),(1.0,1.0,1.0))
exJet_trans=cm.colors.LinearSegmentedColormap('mod_Jet_trans', c3dict, 1024) exJet_trans=cm.colors.LinearSegmentedColormap('mod_Jet_trans', c3dict, 1024)
\ No newline at end of file
### specifications ### ### specifications ###
port="AEF10"
local=True local=True
delayupload=True
starttime="20:00:00"
singleupload=False
use_today=True
upload_only_lattest=False
dates=[[2017,11,9]]
singlelist=[]
### settings ### ### settings ###
logpath="C:\\QIR\\Upload\\"
temppath="C:\\QIR\\Upload\\"
delete_Files=True
rawdata=True
raw1=True
raw2=True
raw_parlog=True
back_parlog=False
background=False
nuc_parlog=False
nuc=False
metastream=True
temperature=False
retry=2 retry=2
### target database (ArchiveDB/Test/Sandbox) ### ### target database (ArchiveDB/Test/Sandbox) ###
archivedb='ArchiveDB' archivedb='ArchiveDB'
### versioning ###
reupload=False
reason=""
...@@ -3228,6 +3228,7 @@ def get_temp_from_raw_by_program_V1(portnr, program, time_window=0, emi=0.8,dive ...@@ -3228,6 +3228,7 @@ def get_temp_from_raw_by_program_V1(portnr, program, time_window=0, emi=0.8,dive
intervalls.append(stoptime) intervalls.append(stoptime)
temperatureimages=[] temperatureimages=[]
times=[] times=[]
error_images=[]
for i in range(nrinterv): for i in range(nrinterv):
raw_dl=download_raw_images_by_times(portnr, intervalls[i], intervalls[i+1], version, intervalSize, testmode=testmode, verbose=verbose-1) raw_dl=download_raw_images_by_times(portnr, intervalls[i], intervalls[i+1], version, intervalSize, testmode=testmode, verbose=verbose-1)
print(datetime.datetime.now(), "get_temp_from_raw_by_program_V1: download of raw images part {0} of {1} finished".format(i+1, nrinterv)) print(datetime.datetime.now(), "get_temp_from_raw_by_program_V1: download of raw images part {0} of {1} finished".format(i+1, nrinterv))
...@@ -3237,10 +3238,14 @@ def get_temp_from_raw_by_program_V1(portnr, program, time_window=0, emi=0.8,dive ...@@ -3237,10 +3238,14 @@ def get_temp_from_raw_by_program_V1(portnr, program, time_window=0, emi=0.8,dive
del raw_dl del raw_dl
# images=images.swapaxes(1,2) # images=images.swapaxes(1,2)
images=[im.swapaxes(0,1) for im in images] images=[im.swapaxes(0,1) for im in images]
success, images=apply_calib_on_raw(images, background, LUT,refT, gain, offset, True, verbose=verbose-1) if give_ERROR:
temperatureimages=temperatureimages+images success, images, images_err=apply_calib_on_raw(images, background, LUT, refT, gain, offset, gain_error, offset_error, True, give_ERROR, verbose=verbose-1)
times=times+time else:
del time, images success, images=apply_calib_on_raw(images, background, LUT, refT, gain, offset, gain_error, offset_error, True, give_ERROR, verbose=verbose-1)
temperatureimages += images
times += time
error_images += images_err
del time, images, images_err
else: else:
# raise Exception("get_temp_from_raw_by_program_V1: cannot download the raw images") # raise Exception("get_temp_from_raw_by_program_V1: cannot download the raw images")
logging.warning("get_temp_from_raw_by_program_V1: cannot download the raw images") logging.warning("get_temp_from_raw_by_program_V1: cannot download the raw images")
...@@ -3561,7 +3566,7 @@ def get_temp_from_raw_by_program(portnr, program, time_window=0, emi=0.8, T_vers ...@@ -3561,7 +3566,7 @@ def get_temp_from_raw_by_program(portnr, program, time_window=0, emi=0.8, T_vers
if toff > 10e6: if toff > 10e6:
print("get_temp_from_raw_by_program: time offset of {0}ns detected, correcting".format(toff)) print("get_temp_from_raw_by_program: time offset of {0}ns detected, correcting".format(toff))
time[:] = time[:]-toff time[:] = time[:]-toff
if give_ERROR: if give_ERROR and not FLIR:
return exist, time, frames, valid, error_images return exist, time, frames, valid, error_images
else: else:
return exist, time, frames, valid return exist, time, frames, valid
...@@ -4015,6 +4020,7 @@ def apply_calib_on_raw(images, background, LUT,refT=28.5, gain=0, offset=0, gain ...@@ -4015,6 +4020,7 @@ def apply_calib_on_raw(images, background, LUT,refT=28.5, gain=0, offset=0, gain
# del raw # del raw
# images=images.swapaxes(1,2) # images=images.swapaxes(1,2)
if type(gain)!=int and type(offset)!=int: if type(gain)!=int and type(offset)!=int:
# images has to be NUCed (e.g. IRcam Caleo image)
if verbose > 0: if verbose > 0:
print(datetime.datetime.now(), "apply_calib_on_raw: NUCing") print(datetime.datetime.now(), "apply_calib_on_raw: NUCing")
# eliminate bad offset and gain points # eliminate bad offset and gain points
...@@ -4027,6 +4033,10 @@ def apply_calib_on_raw(images, background, LUT,refT=28.5, gain=0, offset=0, gain ...@@ -4027,6 +4033,10 @@ def apply_calib_on_raw(images, background, LUT,refT=28.5, gain=0, offset=0, gain
images, error_images=apply_NUC(images, gain, offset, gain_error, offset_error, give_ERROR) images, error_images=apply_NUC(images, gain, offset, gain_error, offset_error, give_ERROR)
else: else:
images=apply_NUC(images, gain, offset) images=apply_NUC(images, gain, offset)
else:
# images does not have to be NUCed (e.g. Infratech image),
# but error propagation requires an initial error image
error_images = np.zeros([len(images)], dtype='uint16')
if verbose > 0: if verbose > 0:
print(datetime.datetime.now(), "apply_calib_on_raw: background treatment") print(datetime.datetime.now(), "apply_calib_on_raw: background treatment")
# if fullbackground: # if fullbackground:
...@@ -4060,7 +4070,7 @@ def apply_calib_on_raw(images, background, LUT,refT=28.5, gain=0, offset=0, gain ...@@ -4060,7 +4070,7 @@ def apply_calib_on_raw(images, background, LUT,refT=28.5, gain=0, offset=0, gain
return True, images return True, images
except Exception as E: except Exception as E:
# raise Warning('apply_calib_on_raw: '+E) # raise Warning('apply_calib_on_raw: '+E)
logging.warning('apply_calib_on_raw: '+E) logging.warning('apply_calib_on_raw: '+str(E))
return False, [0] return False, [0]
...@@ -6792,4 +6802,4 @@ if __name__=='__main__': ...@@ -6792,4 +6802,4 @@ if __name__=='__main__':
# if exist: # if exist:
# print('data of port {0} in program {1}:\n t_preparation {2}ns\n t_start {3}ns\n t_end {4}ns'.format(port, program, t0, t1, t6)) # print('data of port {0} in program {1}:\n t_preparation {2}ns\n t_start {3}ns\n t_end {4}ns'.format(port, program, t0, t1, t6))
\ No newline at end of file
...@@ -11,27 +11,33 @@ loading IR data and printing plots ...@@ -11,27 +11,33 @@ loading IR data and printing plots
import datetime import datetime
import downloadversionIRdata as downIR import downloadversionIRdata as downIR
import matplotlib.pyplot as plt import matplotlib.pyplot as plt
import numpy as np
if __name__ == '__main__': if __name__ == '__main__':
camera = 50
program_str = "20171207.054"
time_window = [0, 1]
T_0 = 273.15 # [K] of 0°C
#%% loading data #%% loading data
print(datetime.datetime.now(), "start") print(datetime.datetime.now(), "start")
status, time, images, valid = downIR.get_temp_from_raw_by_program(51, status, time, images, valid, error_images = downIR.get_temp_from_raw_by_program(camera,
"20171206.045", program_str,
time_window=[1, 1.1], time_window=time_window,
emi=0.8, emi=0.8,
T_version=2, T_version=2,
version=0, version=0,
threads=1, threads=1,
give_ERROR=False, give_ERROR=True,
verbose=5) verbose=5)
print('fertig') print('fertig')
#%% plotting data #%% plotting data
plt.figure() plt.figure()
plt.imshow(images[0], cmap=plt.jet()) plt.imshow(images[50]-T_0, cmap=plt.jet())
plt.clim([280, 630]) plt.clim([0, np.max(images[50])-T_0])
plt.tick_params(axis='both', # changes apply to the x-axis plt.tick_params(axis='both', # changes apply to the x-axis
which='both', # both major and minor ticks are affected which='both', # both major and minor ticks are affected
bottom='off', # ticks along the bottom edge are off bottom='off', # ticks along the bottom edge are off
...@@ -41,6 +47,28 @@ if __name__ == '__main__': ...@@ -41,6 +47,28 @@ if __name__ == '__main__':
labelleft='off', labelleft='off',
labelbottom='off') # labels along the bottom edge are off labelbottom='off') # labels along the bottom edge are off
c_ax = plt.colorbar() c_ax = plt.colorbar()
c_ax.set_label('T [K]') c_ax.set_label('T [°C]')
plt.savefig('20180726.028 - 2.2s - AEF50IR - in K.png', dpi=300, bbox_inches='tight') plt.title('W7-X #{0} - camera AEF{1}'.format(program_str, camera))
save_file_name = '{0} - {1:.1f}s - AEF{2}IR - image.png'.format(program_str, time_window[0]+0.5, camera)
plt.savefig(save_file_name, dpi=300, bbox_inches='tight')
plt.show()
#%% plotting time trace
position = [255,505] # in pixel
plt.figure()
images = np.array(images)
error_images = np.array(error_images)
timetrace = images[:,position[0], position[1]]
timetrace_error = error_images[:,position[0], position[1]]
# plt.plot((time-time[0])/1E9+time_window[0], timetrace-T_0)
plt.errorbar((time-time[0])/1E9+time_window[0], timetrace-T_0, yerr=timetrace_error,
linestyle='', marker='.', markersize=2, color='k', capsize=3, ecolor='r')
plt.xlabel('time [s]')
plt.ylabel('T [°C]')
plt.title('W7-X #{0} - camera AEF{1}'.format(program_str, camera))
save_file_name = '{0} - pixel {1} - AEF{2}IR - timetrace.png'.format(program_str, position, camera)
plt.savefig(save_file_name, dpi=300, bbox_inches='tight')
plt.show() plt.show()
print('max. T: {0:.1f}°C at t={1}ns'.format(np.max(timetrace-T_0), time[np.argmax(timetrace)]))
...@@ -9,7 +9,7 @@ setup( ...@@ -9,7 +9,7 @@ setup(
py_modules = [ py_modules = [
'downloadversionIRdata', 'downloadversionIRdata',
'IR_image_tools', 'IR_image_tools',
'IR_config_constants', 'IR_da_config_constants',
'IR_image_tools', 'IR_image_tools',
'plot_IR_data' , 'plot_IR_data' ,
'Create_HDF5_from_archive_data', 'Create_HDF5_from_archive_data',
......
### specifications ###
port="AEF10"
local=True
delayupload=True
starttime="20:00:00"
singleupload=False
use_today=True
upload_only_lattest=False
dates=[[2017,11,9]]
singlelist=[]
### settings ###
logpath="C:\\QIR\\Upload\\"
temppath="C:\\QIR\\Upload\\"
delete_Files=True
rawdata=True
raw1=True
raw2=True
raw_parlog=True
back_parlog=False
background=False
nuc_parlog=False
nuc=False
metastream=True
temperature=False
retry=2
archivedb=True
### versioning ###
reupload=False
reason=""
Markdown is supported
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