summaryrefslogtreecommitdiff
path: root/bin/analyze-archive.py
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2018-03-28 12:28:11 +0200
committerDaniel Friesel <derf@finalrewind.org>2018-03-28 12:28:11 +0200
commitf5690d1ca3042fcbbe92ebc7f4fcc2785e6cfee3 (patch)
tree6be8147260d3c80cf5bc9af04a6b82e063909481 /bin/analyze-archive.py
parentfc38e211551a7c2d4c681f2b8ffc5b8b5ceb1032 (diff)
support plotting of raw and parameterized data + custom functions
Diffstat (limited to 'bin/analyze-archive.py')
-rwxr-xr-xbin/analyze-archive.py23
1 files changed, 20 insertions, 3 deletions
diff --git a/bin/analyze-archive.py b/bin/analyze-archive.py
index 9a8c416..88cfd62 100755
--- a/bin/analyze-archive.py
+++ b/bin/analyze-archive.py
@@ -4,7 +4,8 @@ import getopt
import plotter
import re
import sys
-from dfatool import EnergyModel, RawData, soft_cast_int
+from dfatool import EnergyModel, RawData
+from dfatool import soft_cast_int, is_numeric, gplearn_to_function
opts = {}
@@ -62,8 +63,11 @@ if __name__ == '__main__':
function_override = {}
try:
- raw_opts, args = getopt.getopt(sys.argv[1:], "",
- 'plot ignored-trace-indexes= discard-outliers= function-override= tex-output'.split(' '))
+ optspec = (
+ 'plot-unparam= plot-param= '
+ 'ignored-trace-indexes= discard-outliers= function-override= tex-output'
+ )
+ raw_opts, args = getopt.getopt(sys.argv[1:], "", optspec.split(' '))
for option, parameter in raw_opts:
optname = re.sub(r'^--', '', option)
@@ -97,6 +101,12 @@ if __name__ == '__main__':
discard_outliers = discard_outliers,
function_override = function_override)
+
+ if 'plot-unparam' in opts:
+ for kv in opts['plot-unparam'].split(';'):
+ state_or_trans, attribute = kv.split(' ')
+ plotter.plot_y(model.by_name[state_or_trans][attribute])
+
print('--- simple static model ---')
static_model = model.get_static()
#for state in model.states():
@@ -143,4 +153,11 @@ if __name__ == '__main__':
else:
model_quality_table([static_quality, analytic_quality, lut_quality], [None, param_info, None])
+ if 'plot-param' in opts:
+ for kv in opts['plot-param'].split(';'):
+ state_or_trans, attribute, param_name, *functions = kv.split(' ')
+ if len(functions):
+ functions = [gplearn_to_function(' '.join(functions))]
+ plotter.plot_param(model, state_or_trans, attribute, model.param_index(param_name), extra_functions=functions)
+
sys.exit(0)