summaryrefslogtreecommitdiff
path: root/bin/analyze-archive.py
diff options
context:
space:
mode:
authorDaniel Friesel <daniel.friesel@uos.de>2020-05-15 16:24:45 +0200
committerDaniel Friesel <daniel.friesel@uos.de>2020-05-15 16:24:45 +0200
commit96406d24d0246ac1f7511a59a3102523c6d69767 (patch)
tree23de38e208a85c70d36085c06c577dffd31d4351 /bin/analyze-archive.py
parent09fadc865649e7726577153f50a87b4803e74e86 (diff)
analyze-arche: Add --plot-traces option
Diffstat (limited to 'bin/analyze-archive.py')
-rwxr-xr-xbin/analyze-archive.py15
1 files changed, 13 insertions, 2 deletions
diff --git a/bin/analyze-archive.py b/bin/analyze-archive.py
index f7847c5..b254e76 100755
--- a/bin/analyze-archive.py
+++ b/bin/analyze-archive.py
@@ -21,6 +21,9 @@ Options:
parameters. Also plots the corresponding measurements.
If gplearn function is set, it is plotted using dashed lines.
+--plot-traces=<name>
+ Plot power trace for state or transition <name>.
+
--export-traces=<directory>
Export power traces of all states and transitions to <directory>.
Creates a JSON file for each state and transition. Each JSON file
@@ -242,7 +245,7 @@ if __name__ == '__main__':
try:
optspec = (
- 'plot-unparam= plot-param= param-info show-models= show-quality= '
+ 'plot-unparam= plot-param= plot-traces= param-info show-models= show-quality= '
'ignored-trace-indexes= discard-outliers= function-override= '
'export-traces= '
'filter-param= '
@@ -293,7 +296,7 @@ if __name__ == '__main__':
print(err)
sys.exit(2)
- raw_data = RawData(args, with_traces=('export-traces' in opts))
+ raw_data = RawData(args, with_traces=('export-traces' in opts or 'plot-traces' in opts))
preprocessed_data = raw_data.get_preprocessed_data()
@@ -313,6 +316,14 @@ if __name__ == '__main__':
with open(target, 'w') as f:
json.dump(data, f)
+ if 'plot-traces' in opts:
+ traces = list()
+ for trace in preprocessed_data:
+ for state_or_transition in trace['trace']:
+ if state_or_transition['name'] == opts['plot-traces']:
+ traces.extend(map(lambda x: x['uW'], state_or_transition['offline']))
+ plotter.plot_y(traces, xlabel='t [1e-5 s]', ylabel='P [uW]', title=opts['plot-traces'], family=True)
+
if raw_data.preprocessing_stats['num_valid'] == 0:
print('No valid data available. Abort.')
sys.exit(2)