Commit e93c6d63 authored by Peter Jansweijer's avatar Peter Jansweijer

don't propagate outlier measurements into the mean values

parent dc7c0afb
......@@ -29,6 +29,7 @@ Options:
-name pointer to a "DeltaDelay_meas" file to be taken as input for measurements
-name_ref pointer to a "DeltaDelay_meas" file to be taken as input for measurements on the reference setup
-o <dir> optional directory for output file storage, default: "data/"
-t <number> tolerance [ps], skip outliers that are offset from the mean value
"""
......@@ -106,6 +107,7 @@ Options:
-name pointer to a "DeltaDelay_meas" file to be taken as input for measurements
-name_ref pointer to a "DeltaDelay_meas" file to be taken as input for measurements on the reference setup
-o <dir> optional directory for output file storage, default: "data/"
-t <number> tolerance [ps], skip outliers that are offset from the mean value
"""
if __name__ == "__main__":
......@@ -116,13 +118,16 @@ if __name__ == "__main__":
parser.add_argument("name", help="file containing DeltaDelay_measurement results")
parser.add_argument("nameref", help="file containing DeltaDelay_measurement results from reference setup")
parser.add_argument("-output_dir", default="data")
parser.add_argument("-t", default=200)
args = parser.parse_args()
name = args.name
nameref = args.nameref
tolerance = int(args.t)
print("Used DeltaDelay_meas input file: ",name)
print("Used DeltaDelay_meas reference input file: ",nameref)
print("Output directory: ",args.output_dir)
print("tolerance: " + str(tolerance) + " [ps]")
if os.path.exists(name) == True and os.path.isfile(name) == True:
pass
......@@ -167,13 +172,13 @@ if __name__ == "__main__":
out_file.write("# Difference results for {Delta Delay measurements fiber spool} - {Delta Delay measurements reference setup}\n")
out_file.write("# file: "+name + "\n")
out_file.write("# ref file: "+nameref + "\n")
out_file.write("# tolerance: " + str(tolerance) + " [ps]\n")
out_file.write("# date:"+time.strftime(format("%d %b %Y"),timestamp)+"\n")
out_file.write("# time:"+time.strftime(format("%H:%M:%S"),timestamp)+"\n")
out_file.write("# mean, StdDev, outliers, measurement\n")
measurement_str = ""
first = True
tolerance = 1e-9 # fix tolerance for outliers at 1 ns for the moment.
while 1:
line_meas = meas_out_file.readline()
......@@ -204,7 +209,7 @@ if __name__ == "__main__":
if len(meas_lst) < 3 or len(ref_lst) < 3:
break
meas_diff = float(meas_lst[0]) - float(ref_lst[0])
if abs(meas_diff) < tolerance:
if abs(meas_diff) < tolerance * 1e-12: # tolerance is in [ps]!
meas_std = numpy.sqrt( float(meas_lst[1])**2 + float(ref_lst[1])**2)
measurement_lst. append(meas_diff)
else:
......@@ -215,7 +220,7 @@ if __name__ == "__main__":
# end of files, write last data
save_plot(out_file, name, nameref, measurement_str, measurement_lst, outliers)
meas_out_file.close()
meas_ref_file.close()
out_file.close()
......
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