From c43864afd9cd4c3f5a73f680a989ab2e8181b63c Mon Sep 17 00:00:00 2001 From: Martin Vonk Date: Wed, 7 Dec 2022 12:37:19 +0100 Subject: [PATCH] check if simulation was terminated instead of succeeded --- src/vs2dpy/model.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/vs2dpy/model.py b/src/vs2dpy/model.py index 0616413..94a0f4a 100644 --- a/src/vs2dpy/model.py +++ b/src/vs2dpy/model.py @@ -846,7 +846,9 @@ def write_A(self) -> OrderedDict: A = OrderedDict() A["A01"] = f"{self.titl}\n" A["A02"] = f"{self.tmax} {self.stim} 0. /A-2 -- TMAX, STIM, ANG\n" - A["A03"] = f"{self.zunit} {self.tunit} g J /A-3 -- ZUNIT, TUNIT, CUNX, HUNX\n" + A[ + "A03" + ] = f"{self.zunit} {self.tunit} g J /A-3 -- ZUNIT, TUNIT, CUNX, HUNX\n" A["A04"] = f"{self.nxr} {self.nly} /A-4 -- NXR, NLY\n" A["A05"] = f"{self.nrech} {self.numt} /A-5 -- NRECH, NUMT\n" A_06 = ["F"] + ["T" if x else "F" for x in (self.itstop,)] + ["F", "F"] @@ -1316,11 +1318,11 @@ def run_model( success : boolean buff : list of lines of stdout """ - success = False + success = True buff = [] # convert normal_msg to a list of lower case str for comparison - normal_msg = ["seconds"] + normal_msg = ["Simulation terminated"] # create a list of arguments to pass to Popen argv = [] @@ -1335,8 +1337,7 @@ def run_model( if line: for msg in normal_msg: if msg in line.lower(): - success = True - break + success = False line = line.rstrip("\r\n") if not silent: print(line)