summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rwxr-xr-xlib/automata.py6
-rw-r--r--lib/functions.py20
2 files changed, 13 insertions, 13 deletions
diff --git a/lib/automata.py b/lib/automata.py
index 69b3969..ebe1871 100755
--- a/lib/automata.py
+++ b/lib/automata.py
@@ -103,7 +103,7 @@ class PTAAttribute:
def __repr__(self):
if self.function is not None:
return "PTAATtribute<{:.0f}, {}>".format(
- self.value, self.function._model_str
+ self.value, self.function.model_function
)
return "PTAATtribute<{:.0f}, None>".format(self.value)
@@ -137,8 +137,8 @@ class PTAAttribute:
}
if self.function:
ret["function"] = {
- "raw": self.function._model_str,
- "regression_args": list(self.function._regression_args),
+ "raw": self.function.model_function,
+ "regression_args": list(self.function.model_args),
}
ret["function_error"] = self.function_error
return ret
diff --git a/lib/functions.py b/lib/functions.py
index 0b849bd..99ba17d 100644
--- a/lib/functions.py
+++ b/lib/functions.py
@@ -141,7 +141,7 @@ class AnalyticFunction:
"""
self._parameter_names = parameters
self._num_args = num_args
- self._model_str = function_str
+ self.model_function = function_str
rawfunction = function_str
self._dependson = [False] * (len(parameters) + num_args)
self.fit_success = False
@@ -174,12 +174,12 @@ class AnalyticFunction:
self._function = function_str
if regression_args:
- self._regression_args = regression_args.copy()
+ self.model_args = regression_args.copy()
self._fit_success = True
elif type(function_str) == str:
- self._regression_args = list(np.ones((num_vars)))
+ self.model_args = list(np.ones((num_vars)))
else:
- self._regression_args = []
+ self.model_args = []
def get_fit_data(self, by_param, state_or_tran, model_attribute):
"""
@@ -260,22 +260,22 @@ class AnalyticFunction:
error_function = lambda P, X, y: self._function(P, X) - y
try:
res = optimize.least_squares(
- error_function, self._regression_args, args=(X, Y), xtol=2e-15
+ error_function, self.model_args, args=(X, Y), xtol=2e-15
)
except ValueError as err:
logger.warning(
"Fit failed for {}/{}: {} (function: {})".format(
- state_or_tran, model_attribute, err, self._model_str
+ state_or_tran, model_attribute, err, self.model_function
),
)
return
if res.status > 0:
- self._regression_args = res.x
+ self.model_args = res.x
self.fit_success = True
else:
logger.warning(
"Fit failed for {}/{}: {} (function: {})".format(
- state_or_tran, model_attribute, res.message, self._model_str
+ state_or_tran, model_attribute, res.message, self.model_function
),
)
else:
@@ -308,9 +308,9 @@ class AnalyticFunction:
corresponds to lexically first parameter, etc.
:param arg_list: argument values (list of float), if arguments are used.
"""
- if len(self._regression_args) == 0:
+ if len(self.model_args) == 0:
return self._function(param_list, arg_list)
- return self._function(self._regression_args, param_list)
+ return self._function(self.model_args, param_list)
class analytic: