summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Friesel <daniel.friesel@uos.de>2020-07-15 10:49:42 +0200
committerDaniel Friesel <daniel.friesel@uos.de>2020-07-15 10:49:42 +0200
commitfd277cb77927a6764b7d5e85f8935319032edf5d (patch)
tree84b4f2f7576d0bf0a069a413099757c154c5fef4
parent3b9cec6634b02f2808f9f0383b51e643602013e3 (diff)
Allow state-only PTAModel to be converted to JSON without underlying PTA
-rw-r--r--lib/model.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/model.py b/lib/model.py
index 082fe8a..bb4a45b 100644
--- a/lib/model.py
+++ b/lib/model.py
@@ -5,6 +5,7 @@ import numpy as np
from scipy import optimize
from sklearn.metrics import r2_score
from multiprocessing import Pool
+from .automata import PTA
from .functions import analytic
from .functions import AnalyticFunction
from .parameters import ParamStats
@@ -931,13 +932,16 @@ class PTAModel:
static_quality = self.assess(static_model)
param_model, param_info = self.get_fitted()
analytic_quality = self.assess(param_model)
- self.pta.update(
+ pta = self.pta
+ if pta is None:
+ pta = PTA(self.states(), parameters=self._parameter_names)
+ pta.update(
static_model,
param_info,
static_error=static_quality["by_name"],
analytic_error=analytic_quality["by_name"],
)
- return self.pta.to_json()
+ return pta.to_json()
def states(self):
"""Return sorted list of state names."""