summaryrefslogtreecommitdiff
path: root/lib/dfatool.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 /lib/dfatool.py
parenta2adf6a90246110fcae4e6a6dcc049d8d69fcb48 (diff)
PTA: Add from_file constructor
Diffstat (limited to 'lib/dfatool.py')
-rw-r--r--lib/dfatool.py11
1 files changed, 5 insertions, 6 deletions
diff --git a/lib/dfatool.py b/lib/dfatool.py
index a3d5c0f..363c2a2 100644
--- a/lib/dfatool.py
+++ b/lib/dfatool.py
@@ -1505,7 +1505,7 @@ class PTAModel:
- rel_energy_next: transition energy relative to next state mean power in pJ
"""
- def __init__(self, by_name, parameters, arg_count, traces = [], ignore_trace_indexes = [], discard_outliers = None, function_override = {}, verbose = True, use_corrcoef = False, hwmodel = None):
+ def __init__(self, by_name, parameters, arg_count, traces = [], ignore_trace_indexes = [], discard_outliers = None, function_override = {}, verbose = True, use_corrcoef = False, pta = None):
"""
Prepare a new PTA energy model.
@@ -1534,7 +1534,7 @@ class PTAModel:
verbose -- print informative output, e.g. when removing an outlier
use_corrcoef -- use correlation coefficient instead of stddev comparison
to detect whether a model attribute depends on a parameter
- hwmodel -- hardware model suitable for PTA.from_hwmodel
+ pta -- hardware model as `PTA` object
"""
self.by_name = by_name
self.by_param = by_name_to_by_param(by_name)
@@ -1548,7 +1548,7 @@ class PTAModel:
self._outlier_threshold = discard_outliers
self.function_override = function_override.copy()
self.verbose = verbose
- self.hwmodel = hwmodel
+ self.pta = pta
self.ignore_trace_indexes = ignore_trace_indexes
self._aggregate_to_ndarray(self.by_name)
@@ -1715,9 +1715,8 @@ class PTAModel:
def to_json(self):
static_model = self.get_static()
_, param_info = self.get_fitted()
- pta = PTA.from_json(self.hwmodel)
- pta.update(static_model, param_info)
- return pta.to_json()
+ self.pta.update(static_model, param_info)
+ return self.pta.to_json()
def states(self):
return sorted(list(filter(lambda k: self.by_name[k]['isa'] == 'state', self.by_name.keys())))