Skip to content

Commit

Permalink
Update muscleOptimizer.py
Browse files Browse the repository at this point in the history
  • Loading branch information
mrrezaie committed Apr 29, 2023
1 parent 93e8986 commit cf728b3
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions muscleOptimizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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}')
Expand Down Expand Up @@ -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]+
Expand Down

0 comments on commit cf728b3

Please sign in to comment.