Loading bin/dlog-viewer +9 −10 Changes for bin/dlog-viewer: 9 added lines, 10 removed lines. Original line number Original line Diff line number Diff line Loading @@ -63,6 +63,7 @@ class DLog: with open(filename, "rb") as f: with open(filename, "rb") as f: if ".xz" in filename: if ".xz" in filename: import lzma import lzma f = lzma.open(f) f = lzma.open(f) while line != "</dlog>\n": while line != "</dlog>\n": Loading Loading @@ -98,11 +99,6 @@ class DLog: 0, self.observed_duration, num=int(len(raw_data) / (4 * num_channels)) 0, self.observed_duration, num=int(len(raw_data) / (4 * num_channels)) ) ) if int(self.observed_duration) != self.planned_duration: self.duration_deviates = True else: self.duration_deviates = False self.data = np.ndarray( self.data = np.ndarray( shape=(num_channels, int(len(raw_data) / (4 * num_channels))), shape=(num_channels, int(len(raw_data) / (4 * num_channels))), dtype=np.float32, dtype=np.float32, Loading Loading @@ -137,6 +133,9 @@ class DLog: return True return True return False return False def observed_duration_equals_expectation(self): return int(self.observed_duration) == self.planned_duration def all_data_slots_have_power(self): def all_data_slots_have_power(self): for slot in range(4): for slot in range(4): if self.slot_has_data(slot) and not self.slot_has_power(slot): if self.slot_has_data(slot) and not self.slot_has_power(slot): Loading @@ -145,16 +144,16 @@ class DLog: def print_stats(dlog): def print_stats(dlog): if dlog.duration_deviates: if dlog.observed_duration_equals_expectation(): print( print( "Measurement duration: {:f} of {:d} seconds at {:f} µs per sample".format( "Measurement duration: {:d} seconds at {:f} µs per sample".format( dlog.observed_duration, dlog.planned_duration, dlog.interval * 1000000 dlog.planned_duration, dlog.interval * 1000000 ) ) ) ) else: else: print( print( "Measurement duration: {:d} seconds at {:f} µs per sample".format( "Measurement duration: {:f} of {:d} seconds at {:f} µs per sample".format( dlog.planned_duration, dlog.interval * 1000000 dlog.observed_duration, dlog.planned_duration, dlog.interval * 1000000 ) ) ) ) Loading Loading
bin/dlog-viewer +9 −10 Changes for bin/dlog-viewer: 9 added lines, 10 removed lines. Original line number Original line Diff line number Diff line Loading @@ -63,6 +63,7 @@ class DLog: with open(filename, "rb") as f: with open(filename, "rb") as f: if ".xz" in filename: if ".xz" in filename: import lzma import lzma f = lzma.open(f) f = lzma.open(f) while line != "</dlog>\n": while line != "</dlog>\n": Loading Loading @@ -98,11 +99,6 @@ class DLog: 0, self.observed_duration, num=int(len(raw_data) / (4 * num_channels)) 0, self.observed_duration, num=int(len(raw_data) / (4 * num_channels)) ) ) if int(self.observed_duration) != self.planned_duration: self.duration_deviates = True else: self.duration_deviates = False self.data = np.ndarray( self.data = np.ndarray( shape=(num_channels, int(len(raw_data) / (4 * num_channels))), shape=(num_channels, int(len(raw_data) / (4 * num_channels))), dtype=np.float32, dtype=np.float32, Loading Loading @@ -137,6 +133,9 @@ class DLog: return True return True return False return False def observed_duration_equals_expectation(self): return int(self.observed_duration) == self.planned_duration def all_data_slots_have_power(self): def all_data_slots_have_power(self): for slot in range(4): for slot in range(4): if self.slot_has_data(slot) and not self.slot_has_power(slot): if self.slot_has_data(slot) and not self.slot_has_power(slot): Loading @@ -145,16 +144,16 @@ class DLog: def print_stats(dlog): def print_stats(dlog): if dlog.duration_deviates: if dlog.observed_duration_equals_expectation(): print( print( "Measurement duration: {:f} of {:d} seconds at {:f} µs per sample".format( "Measurement duration: {:d} seconds at {:f} µs per sample".format( dlog.observed_duration, dlog.planned_duration, dlog.interval * 1000000 dlog.planned_duration, dlog.interval * 1000000 ) ) ) ) else: else: print( print( "Measurement duration: {:d} seconds at {:f} µs per sample".format( "Measurement duration: {:f} of {:d} seconds at {:f} µs per sample".format( dlog.planned_duration, dlog.interval * 1000000 dlog.observed_duration, dlog.planned_duration, dlog.interval * 1000000 ) ) ) ) Loading