Skip to content
Snippets Groups Projects
Commit 73409189 authored by Peter Drewelow's avatar Peter Drewelow
Browse files

minor sample plot improvements

parent a4b6ebb4
No related branches found
No related tags found
No related merge requests found
......@@ -15,11 +15,16 @@ import numpy as np
if __name__ == '__main__':
camera = 50
program_str = "20171207.054"
time_window = [0, 1]
camera = 10 # 50
program_str = "20171121.013" # '20171207.054'
# time_window = [0, 1]
time_window = 0 #[0, 15]
T_0 = 273.15 # [K] of 0°C
# position = [255,505] # pixel in AEF50
position = [650,640] # pixel in AEF10
#%% loading data
print(datetime.datetime.now(), "start")
status, time, images, valid, error_images = downIR.get_temp_from_raw_by_program(camera,
......@@ -28,16 +33,25 @@ if __name__ == '__main__':
emi=0.8,
T_version=2,
version=0,
threads=1,
threads=8,
give_ERROR=True,
verbose=5)
print('fertig')
#%% plotting data
i_im = int(len(images)/2)
if len(np.shape(time_window)) == 0:
start_time = 0
else:
start_time = time_window[0]
time_s = start_time + (time-time[0])/1E9
t_im = time_s[i_im]
plt.figure()
plt.imshow(images[50]-T_0, cmap=plt.jet())
plt.clim([0, np.max(images[50])-T_0])
plt.imshow(images[i_im]-T_0, cmap=plt.jet())
plt.clim([0, np.max(images[i_im])-T_0])
plt.plot(position[1], position[0], 'xk', markersize=5)
plt.tick_params(axis='both', # changes apply to the x-axis
which='both', # both major and minor ticks are affected
bottom='off', # ticks along the bottom edge are off
......@@ -48,21 +62,20 @@ if __name__ == '__main__':
labelbottom='off') # labels along the bottom edge are off
c_ax = plt.colorbar()
c_ax.set_label('T [°C]')
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.title('W7-X #{0}\ncamera AEF{1} @ t={2:.2f}s'.format(program_str, camera, t_im))
save_file_name = '{0} - {1:.1f}s - AEF{2}IR - image.png'.format(program_str, t_im, 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,
# plt.plot(time_s, timetrace-T_0)
plt.errorbar(time_s, timetrace-T_0, yerr=timetrace_error,
linestyle='', marker='.', markersize=2, color='k', capsize=3, ecolor='r')
plt.xlabel('time [s]')
plt.ylabel('T [°C]')
......@@ -72,3 +85,7 @@ if __name__ == '__main__':
plt.show()
print('max. T: {0:.1f}°C at t={1}ns'.format(np.max(timetrace-T_0), time[np.argmax(timetrace)]))
save_file_name = '{0} - pixel {1} - AEF{2}IR - timetrace.txt'.format(program_str, position, camera)
save_data = np.array([time, timetrace, timetrace_error]).T
np.savetxt(save_file_name, save_data, fmt='%d ; %.2f ; %.2f', header='time [ns] ; temperature [K] ; temperature uncertainty [K]')
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment