Skip to content
Snippets Groups Projects
Commit 06f941f1 authored by Aaron Viets's avatar Aaron Viets
Browse files

gstlal-calibration: improved latency plotting script

parent 80bd7e8f
No related branches found
No related tags found
No related merge requests found
Pipeline #51906 failed
......@@ -7,7 +7,7 @@ import time
import matplotlib
matplotlib.rcParams['font.family'] = 'Times New Roman'
matplotlib.rcParams['font.size'] = 16
matplotlib.rcParams['legend.fontsize'] = 14
matplotlib.rcParams['legend.fontsize'] = 12
matplotlib.rcParams['mathtext.default'] = 'regular'
matplotlib.use('Agg')
import matplotlib.pyplot as plt
......@@ -51,10 +51,18 @@ common_dt = long_dt
while common_dt % short_dt:
common_dt = common_dt + long_dt
# Number of sample of input and output corresponding to least common multiple sample period
# Number of samples of input and output corresponding to least common multiple sample period
in_step = round(common_dt / in_dt)
out_step = round(common_dt / out_dt)
# Sometimes the incoming data has dropouts... we need to deal with this :(
for i in range(0, len(intimes)):
j = 1
while j < len(intimes[i]):
if round((intimes[i][j][0] - intimes[i][j - 1][0]) / in_dt) > 1:
intimes[i] = numpy.insert(intimes[i], j, [intimes[i][j - 1][0] + in_dt, intimes[i][j - 1][1] + in_dt], axis = 0)
j = j + 1
# Find a start time that is not before any of the data sets start and an end time that is not after any of the data sets end
t_start = intimes[0][0][0]
t_end = intimes[0][-1][0]
......@@ -99,33 +107,31 @@ for i in range(0, len(intimes)):
latency[i].append(outtimes[i][outtimes_start_index + j * out_step][1] - intimes[i][intimes_start_index + j * in_step][1])
# Make the plot
colors = ['purple', 'b', 'c', 'g', 'y', 'r']
markersize = 200.0 * numpy.sqrt(len(intimes[0]))
markersize = min(markersize, 10.0)
markersize = max(markersize, 0.2)
plt.figure(figsize = (10, 5))
colors = ['b', 'c', 'g', 'm', 'y', 'r']
markersize = 150.0 / numpy.sqrt(len(intimes[0]))
markersize = min(markersize, 8.0)
markersize = max(markersize, 1.0)
plt.figure(figsize = (10, 6))
if len(labels[0]):
plt.plot(gps_time, latency[0], colors[0], linestyle = 'None', marker = '.', markersize = markersize, label = labels[0])
leg = plt.legend(fancybox = True, loc = 'upper right', markerscale = 4.0 / markersize, numpoints = 3)
leg.get_frame().set_alpha(0.8)
else:
plt.plot(gps_time, latency[0], colors[0], linestyle = 'None', marker = '.', markersize = markersize)
if len(options.plot_title):
plt.title(options.plot_title)
plt.ylabel('Latency [s]')
plt.xlabel('Time in %s since %s UTC' % (t_unit, time.strftime("%b %d %Y %H:%M:%S", time.gmtime(t_start + 315964782))))
plt.ylim(0, 15)
plt.ylim(0, 8)
plt.grid(True, which = "both", linestyle = ':', linewidth = 0.3, color = 'black')
if len(labels[0]):
leg = plt.legend(fancybox = True, loc = 'upper right')
leg.get_frame().set_alpha(0.8)
for i in range(1, len(intimes)):
if len(labels) > 1:
plt.plot(gps_time, latency[i], colors[i % len(colors)], linestyle = 'None', marker = '.', markersize = markersize, label = labels[i])
leg = plt.legend(fancybox = True, loc = 'upper right', markerscale = 4.0 / markersize, numpoints = 3)
leg.get_frame().set_alpha(0.8)
else:
plt.plot(gps_time, latency[i], colors[i % len(colors)], linestyle = 'None', marker = '.', markersize = markersize)
if len(options.labels):
leg = plt.legend(fancybox = True, loc = 'upper right')
leg.get_frame().set_alpha(0.8)
# Save the plot to a file
plt.savefig('%s_%d-%d.png' % (options.plot_filename_prefix, int(t_start), int(dur)))
......
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