Commit 88389282 authored by Peter Jansweijer's avatar Peter Jansweijer

added stddev per wavelength for averaged reference and measurement to result file.

added Sellmeier fits in one plot.
parent 25d3335e
...@@ -458,6 +458,7 @@ def analyze_plot(insitu_file, analyse_single, x, y, name, tolerance, use_itu_cha ...@@ -458,6 +458,7 @@ def analyze_plot(insitu_file, analyse_single, x, y, name, tolerance, use_itu_cha
returns: returns:
tangent_array -- <numpy.array> keep tangent values in an array in case multiple files are processed tangent_array -- <numpy.array> keep tangent values in an array in case multiple files are processed
temperature_array -- <numpy.array> keep temperature values in an array in case multiple files are processed temperature_array -- <numpy.array> keep temperature values in an array in case multiple files are processed
ly -- <numpy.array> Sellmeier fitted values
result_line -- <string> summary line to be added to the result_file result_line -- <string> summary line to be added to the result_file
""" """
...@@ -868,7 +869,7 @@ def analyze_plot(insitu_file, analyse_single, x, y, name, tolerance, use_itu_cha ...@@ -868,7 +869,7 @@ def analyze_plot(insitu_file, analyse_single, x, y, name, tolerance, use_itu_cha
print("file probably only contains measurements for a single wavelength") print("file probably only contains measurements for a single wavelength")
#continue #continue
return(tangent_array, temperature_array, result_line) return(tangent_array, temperature_array, ly, result_line)
########################################################################### ###########################################################################
# #
...@@ -986,6 +987,11 @@ if __name__ == "__main__": ...@@ -986,6 +987,11 @@ if __name__ == "__main__":
print (insitu_file + ": wrong file type") print (insitu_file + ": wrong file type")
continue continue
fig_sell_fits = plt.figure("Sellmeier fits")
axs = fig_sell_fits.add_subplot(111)
axs.set_title("Sellmeier fits")
axs.set_xlabel('Wavelength [nm]')
if measurementfile == True: if measurementfile == True:
print(insitu_file) print(insitu_file)
crtt_array = dict_to_narray(crtt_data) crtt_array = dict_to_narray(crtt_data)
...@@ -1009,11 +1015,17 @@ if __name__ == "__main__": ...@@ -1009,11 +1015,17 @@ if __name__ == "__main__":
t = crtt_array["temp"] t = crtt_array["temp"]
tangent_array, temperature_array, result_line = analyze_plot(insitu_file, analyse_single, x, y, name, tolerance, use_itu_channels, ref_name, fixed_itu_channel, tangent_array, temperature_array) tangent_array, temperature_array, sellmeier_fit, result_line = analyze_plot(insitu_file, analyse_single, x, y, name, tolerance, use_itu_channels, ref_name, fixed_itu_channel, tangent_array, temperature_array)
if not(analyse_single): if not(analyse_single):
numb_of_meas = numb_of_meas + 1 numb_of_meas = numb_of_meas + 1
result_file.write(result_line) result_file.write(result_line)
fixed_lambda = itu_conv.itu_2_wavelength(fixed_itu_channel)
axs.axvline(fixed_lambda*1e9, color='red')
axs.plot(x, sellmeier_fit)
plt.draw()
# After scanning all files in a directory (i.e. not a single file) # After scanning all files in a directory (i.e. not a single file)
# => add statistics: # => add statistics:
if not(analyse_single): if not(analyse_single):
...@@ -1054,6 +1066,17 @@ if __name__ == "__main__": ...@@ -1054,6 +1066,17 @@ if __name__ == "__main__":
t = temp_array t = temp_array
tangent_array, temperature_array, result_line = analyze_plot(insitu_file, analyse_single, x, y, name, tolerance, use_itu_channels, ref_name, fixed_itu_channel, tangent_array, temperature_array) tangent_array, temperature_array, sellmeier_fit, result_line = analyze_plot(insitu_file, analyse_single, x, y, name, tolerance, use_itu_channels, ref_name, fixed_itu_channel, tangent_array, temperature_array)
result_file.write("\n")
result_file.write("Wavelength, Mean_CRTT, StdDev for CRTT per Averaged Wavelength for Reference setup\n")
for i in range(len(x)):
result_file.write(str(x[i]) + ", " + str(ref_crtt_array[i]) + ", " + str(ref_crtt_array_std[i]) + "\n")
result_file.write("\n")
result_file.write("Wavelength, Mean CRTT, StdDev for CRTT per Averaged Wavelength for Measurement setup\n")
for i in range(len(x)):
result_file.write(str(x[i]) + ", " + str(crtt_array[i]) + ", " + str(crtt_array_std[i]) + "\n")
sys.exit() sys.exit()
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