def test_functions(self): filename = pyCGM2.TEST_DATA_PATH + "LowLevel\\IO\\Hånnibøl_c3d\\gait1.c3d" acq = btkTools.smartReader(filename, translators=None) btkTools.GetMarkerNames(acq) btkTools.findNearestMarker(acq, 0, "LASI") btkTools.GetAnalogNames(acq) btkTools.isGap(acq, "LASI") btkTools.findMarkerGap(acq) btkTools.isPointExist(acq, "LASI") btkTools.isPointsExist(acq, ["LASI", "RASI"]) btkTools.clearPoints(acq, ["LASI", "RASI"]) btkTools.checkFirstAndLastFrame(acq, "LASI") btkTools.isGap_inAcq(acq, ["LASI", "RASI"]) btkTools.findValidFrames(acq, ["LASI", "RASI"]) btkTools.checkMultipleSubject(acq) btkTools.checkMarkers(acq, ["LASI", "RASI"]) btkTools.clearEvents(acq, ["Foot Strike"]) btkTools.modifyEventSubject(acq, "Hän") btkTools.modifySubject(acq, "Han") btkTools.getVisibleMarkersAtFrame(acq, ["LASI", "RASI"], 0) btkTools.isAnalogExist(acq, "emg-Hän") btkTools.createZeros(acq, ["LASI", "RASI"]) btkTools.constructEmptyMarker(acq, "zéros", desc="Hän") btkTools.getStartEndEvents(acq, "Left") btkTools.changeSubjectName(acq, "Hän") btkTools.smartGetMetadata(acq, "SUBJECTS", "USED") btkTools.smartSetMetadata(acq, "SUBJECTS", "USED", 0, "Hän")
def addForcePlateGeneralEvents(btkAcq, mappedForcePlate): """ Add General events from force plate assignmenet """ ff = btkAcq.GetFirstFrame() lf = btkAcq.GetLastFrame() pf = btkAcq.GetPointFrequency() appf = btkAcq.GetNumberAnalogSamplePerFrame() # --- ground reaction force wrench --- pfe = btk.btkForcePlatformsExtractor() grwf = btk.btkGroundReactionWrenchFilter() pfe.SetInput(btkAcq) pfc = pfe.GetOutput() grwf.SetInput(pfc) grwc = grwf.GetOutput() grwc.Update() # remove force plates events btkTools.clearEvents(btkAcq, ["Left-FP", "Right-FP"]) # add general events indexFP = 0 for letter in mappedForcePlate: force = grwc.GetItem(indexFP).GetForce().GetValues() force_downsample = force[0:(lf - ff + 1) * appf:appf] # downsample Rz = np.abs(force_downsample[:, 2]) frameMax = ff + np.argmax(Rz) if letter == "L": ev = btk.btkEvent('Left-FP', (frameMax - 1) / pf, 'General', btk.btkEvent.Automatic, '', 'event from Force plate assignment') btkAcq.AppendEvent(ev) elif letter == "R": ev = btk.btkEvent('Right-FP', (frameMax - 1) / pf, 'General', btk.btkEvent.Automatic, '', 'event from Force plate assignment') btkAcq.AppendEvent(ev) indexFP += 1