From cf728b32db1dc63d0fb813b01c48afacda135db3 Mon Sep 17 00:00:00 2001 From: mrrezaie Date: Sat, 29 Apr 2023 12:32:36 +0330 Subject: [PATCH] Update muscleOptimizer.py --- muscleOptimizer.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/muscleOptimizer.py b/muscleOptimizer.py index 5164e86..0c5f0df 100644 --- a/muscleOptimizer.py +++ b/muscleOptimizer.py @@ -14,7 +14,7 @@ console = sys.stdout sys.stdout = open(f'{nameTarg[:-5]}_N{interval}.log', 'w') # print to log file -outputJson = nameRef[:-5]+f'_N{interval}.json' +refJson = nameRef[:-5]+f'_N{interval}.json' osim.Logger.setLevelString('Off') t0 = time() @@ -128,9 +128,9 @@ def getMuscleQuantities(modelFile): return muscleQuantities -if os.path.isfile(outputJson): - print(f'Pre-calculated muscle quantities exists:\n\tload {outputJson}') - ref = json.load(open(outputJson, mode='r')) +if os.path.isfile(refJson): + print(f'Pre-calculated muscle quantities exists:\n\tload {refJson}') + ref = json.load(open(refJson, mode='r')) printJson = False else: print(f'\nRef model: {nameRef}') @@ -216,7 +216,7 @@ def default(self, obj): return obj.round(6).tolist() return json.JSONEncoder.default(self, obj) - json.dump(ref, open(outputJson,'w'), cls=myEncoder, separators=(',', ':')) + json.dump(ref, open(refJson,'w'), cls=myEncoder, separators=(',', ':')) f.close() modelTarg.printToXML(f'{nameTarg[:-5]}_N{interval}_pyOpt.osim') # nameTarg[:-5]+