Print power values of all nodes, including missing ones
This commit is contained in:
parent
5b07b407de
commit
277b3e936e
1 changed files with 11 additions and 6 deletions
|
@ -143,7 +143,7 @@ class Power:
|
|||
return _body
|
||||
|
||||
def summarize_time(self, ts):
|
||||
return ts, ""
|
||||
return Power.to_csv((ts, ""))
|
||||
|
||||
@staticmethod
|
||||
def summarize_values(df):
|
||||
|
@ -152,16 +152,21 @@ class Power:
|
|||
min, max = values.min(), values.max()
|
||||
avg, stddev = values.mean(), values.std()
|
||||
median = np.median(values)
|
||||
return head, avg, median, min, max, stddev
|
||||
return Power.to_csv((head, avg, median, min, max, stddev))
|
||||
|
||||
def summarize_epoch(self, epoch):
|
||||
ts, values = epoch
|
||||
return self.summarize_time(ts) \
|
||||
+ self.summarize_values(values) \
|
||||
+ self.all_values(values)
|
||||
return self.summarize_time(ts), \
|
||||
self.summarize_values(values), \
|
||||
self.all_values(values)
|
||||
|
||||
def all_values(self, values):
|
||||
return tuple(values['power'].tolist())
|
||||
# reindex frame to get all nodes; introduces gaps
|
||||
values = values[['node', 'power']].set_index('node').reindex(self.nodes)
|
||||
# hack to_csv() to transpose array
|
||||
csv = values.to_csv(header=False, index=False, line_terminator=',', na_rep=' ')
|
||||
csv = csv[:-1] # strip line terminator ',' from end of string
|
||||
return csv
|
||||
|
||||
def energy_total(self):
|
||||
energy = None
|
||||
|
|
Loading…
Reference in a new issue