summaryrefslogtreecommitdiff
path: root/bin/analyze-archive.py
diff options
context:
space:
mode:
authorDaniel Friesel <daniel.friesel@uos.de>2019-10-15 17:40:50 +0200
committerDaniel Friesel <daniel.friesel@uos.de>2019-10-15 17:40:50 +0200
commit9fb10653c723f10b36ae0567ff29f08a4e725ea3 (patch)
treebdfa5771c66736a0ed5f32b1188c7986770bb4ff /bin/analyze-archive.py
parenta2adf6a90246110fcae4e6a6dcc049d8d69fcb48 (diff)
PTA: Add from_file constructor
Diffstat (limited to 'bin/analyze-archive.py')
-rwxr-xr-xbin/analyze-archive.py14
1 files changed, 7 insertions, 7 deletions
diff --git a/bin/analyze-archive.py b/bin/analyze-archive.py
index 685ce92..4551cda 100755
--- a/bin/analyze-archive.py
+++ b/bin/analyze-archive.py
@@ -70,8 +70,8 @@ Options:
not been set yet) are discarded. Note that this may remove entire
function calls from the model.
---hwmodel=<hwmodel.json>
- Load DFA hardware model from JSON
+--hwmodel=<hwmodel.json|hwmodel.dfa>
+ Load DFA hardware model from JSON or YAML
--export-energymodel=<model.json>
Export energy model. Requires --hwmodel.
@@ -86,6 +86,7 @@ from dfatool import PTAModel, RawData, pta_trace_to_aggregate
from dfatool import soft_cast_int, is_numeric, gplearn_to_function
from dfatool import CrossValidator
from utils import filter_aggregate_by_param
+from automata import PTA
opts = {}
@@ -211,7 +212,7 @@ if __name__ == '__main__':
function_override = {}
show_models = []
show_quality = []
- hwmodel = None
+ pta = None
energymodel_export_file = None
xv_method = None
xv_count = 10
@@ -262,8 +263,7 @@ if __name__ == '__main__':
safe_functions_enabled = True
if 'hwmodel' in opts:
- with open(opts['hwmodel'], 'r') as f:
- hwmodel = json.load(f)
+ pta = PTA.from_file(opts['hwmodel'])
except getopt.GetoptError as err:
print(err)
@@ -280,7 +280,7 @@ if __name__ == '__main__':
traces = preprocessed_data,
discard_outliers = discard_outliers,
function_override = function_override,
- hwmodel = hwmodel)
+ pta = pta)
if xv_method:
xv = CrossValidator(PTAModel, by_name, parameters, arg_count)
@@ -416,7 +416,7 @@ if __name__ == '__main__':
plotter.plot_param(model, state_or_trans, attribute, model.param_index(param_name), extra_function=function)
if 'export-energymodel' in opts:
- if not hwmodel:
+ if not pta:
print('[E] --export-energymodel requires --hwmodel to be set')
sys.exit(1)
json_model = model.to_json()