Code: Select all
timeFile = 'irrelevant path and file'
times = []
with open(ikPath + ikFile) as to_read:
with open(timeFile, 'wb') as tmp_file:
reader = csv.reader(to_read, delimiter = '\t')
writer = csv.writer(tmp_file)
desired_column = [0]
for row in reader:
myColumn = list(row[i] for i in desired_column)
times.append(myColumn)
times = times[9:len(times)] # exclude all the headers
times = [[float(float(j)) for j in i] for i in times]
startTime = min(times)
stopTime = max(times)
curModel = osim.Model(modelPath + modelFile)
curState = curModel.initSystem()
prefix = ikFile.replace('IKResults_File_Name.mot', '_BK')
bk = osim.BodyKinematics(curModel)
bk.setModel(curModel)
bk.setRecordCenterOfMass(True)
bk.setStartTime(startTime[0])
bk.setEndTime(stopTime[0])
curState = curModel.initSystem();
bk.begin(curState) # this apparently only processes the first step
bk.printResults(prefix, results)
Code: Select all
b = 0
i = 1
while b is 0:
print i
b = bk.step(curState, i)
bk.proceed(bk.step(curState, i))
i = i + 1
I hope I'm just missing something dumb and obvious here, that working on getting the tool working has blinded me to something in front of my face. It's been a while since I've used Python too so maybe that is contributing here, but either way, I'm at a loss as to why the methods that seem like they'd run the analysis don't seem to do anything at all.
As always, any help is appreciated. Thanks!