39 """A class to calculate run statistics""" 57 """Self descriptive""" 58 self.frame_times_tf.append(value)
61 """Self descriptive""" 62 self.frame_times_no_drawing.append(value)
65 """Self descriptive""" 66 self.frame_times_inner.append(value)
69 """Self descriptive""" 70 self.frame_times_outer.append(value)
73 """Self descriptive""" 77 """Self descriptive""" 81 """Self descriptive""" 85 """Self descriptive""" 89 """Self descriptive""" 93 """Self descriptive""" 98 """Process the statistics of data received up to this point 101 Statistics Summary""" 104 time_end = timeit.default_timer()
108 stat_string +=
"\n" +
'\n' + 8 * (6 *
'-' +
'\t')
110 stat_string +=
"\n" + \
111 'Preparation spent:\t\t%.4g sec' % (
113 stat_string +=
"\n" + \
115 stat_string +=
"\n" + \
116 "Netto time per iteration:\t%.4g sec" % (
119 stat_string +=
"\n" + \
120 "Time in tf per iteration:\t%.4g sec" % (
123 stat_string +=
"\n" + \
124 "Overhead per iteration:\t\t%.4g sec" % (
128 str_to_logging =
"Processing Image Size:\t\t" + \
130 if 'original_image_size' in globals():
131 str_to_logging +=
"\tfrom\t" + \
134 stat_string +=
"\n" + str_to_logging
135 stat_string +=
"\n" +
"Number of frames:\t\t%d" % nCount
137 stat_string +=
"\n" + 8 * (6 *
'-' +
'\t') +
'\n\n' 140 def get_stat_array(a):
141 return (np.around(np.min(a[1:]), decimals=4),
142 np.around(np.mean(a[1:]), decimals=4),
143 np.around(np.max(a[1:]), decimals=4),
144 np.around(np.std(a[1:]), decimals=4))
146 stat_string +=
"\n" + \
147 '\tStatistics:\t| \t Min \t|\t Mean \t|\t Max \t|\t Std \t|' 149 stat_string +=
"\n" +
'\tTf Frames:\t|' + (4 *
'\t %06.4f \t|') % \
152 stat_string +=
"\n" +
'\tProc w/o draw:\t|' + (4 *
'\t %06.4f \t|') % \
155 stat_string +=
"\n" +
'\tDrawing(only):\t|' + (4 *
'\t %06.4f \t|') % \
158 stat_string +=
"\n" +
'\tInner Frames: \t|' + (4 *
'\t %06.4f \t|') % \
161 stat_string +=
"\n" +
'\tOuter Frames: \t|' + (4 *
'\t %06.4f \t|') % \
164 stat_string +=
"\n" + 8 * (6 *
'-' +
'\t') +
'\n\n' 167 calc_fps = float(nCount /
169 stat_string +=
"\n" +
'Estimated process per second rate: %.4g fps' % calc_fps