def Stockaufsatz(matrixnew,extractedstep,Einheitsvektor ="rE1"):
    re1 = Init.getData(matrixnew,sensors=["RNS","LNS"],datas=[ Einheitsvektor])
    ACC = Init.getData(matrixnew,sensors=["RNS","LNS"],datas=["acc"],specifiedDatas="x")
    ACCright =  Ableitung(ACC[:,:],[2],1)[:,2:]
    ACCleft = Ableitung(ACC[:,:],[3],1)[:,2:]


    Vektor = np.zeros((len(re1),3))
    Vektor[:,2] = 1
    anlematrixre1 = angle(re1[:,2:5],Vektor)
    anlematrixre = angle(re1[:,5:8],Vektor)
    anglestickright = anlematrixre1[:,0]
    anglestickleft = anlematrixre[:,0]

    rightpeak = []
    leftpeak = []
    for i in range(0,len(extractedstep)):
        posleft = (np.argmax(ACCleft[(extractedstep[i,0]):(extractedstep[i,1]),0]))
        leftpeak.append(anglestickleft[(extractedstep[i,0])+posleft,0])
        posright = (np.argmax(ACCright[(extractedstep[i,0]):(extractedstep[i,1]),0]))
        rightpeak.append(anglestickright[(extractedstep[i,0])+posright,0])


    print rightpeak

    return rightpeak,leftpeak
def Passgang(matrixnew,extractedstep):
    ACC = Init.getData(matrixnew,sensors=["RNS","LLL"],datas=["acc"],specifiedDatas="x")
    ACC2 = Init.getData(matrixnew,sensors=["LNS","RLL"],datas=["acc"],specifiedDatas="x")

    ACC = Ableitung(ACC[:,:],[2,3],1)[:,2:]
    ACC2 = Ableitung(ACC2[:,:],[2,3],1)[:,2:]
    zeitverschiebung =[]
    zeitverschiebunglinks =[]
    for i in range(0,len(extractedstep)):

        maxpos = (np.argmax(ACC2[(extractedstep[i,0]):(extractedstep[i,1]),0]))
        minpos= (np.argmax(ACC2[(extractedstep[i,0]):(extractedstep[i,1]),1]))
        print abs(maxpos-minpos)
        print "_______"
        print (extractedstep[i,1]-extractedstep[i,0])
        zeitverschiebung.append(float(abs(maxpos-minpos))/float((extractedstep[i,1]-extractedstep[i,0])))
        maxpos = (np.argmax(ACC[(extractedstep[i,0]):(extractedstep[i,1]),0]))
        minpos= (np.argmax(ACC[(extractedstep[i,0]):(extractedstep[i,1]),1]))
        zeitverschiebunglinks.append(float(abs(maxpos-minpos))/float((extractedstep[i,1]-extractedstep[i,0])))


    vereinigung=[]
    for j in range(0,len(zeitverschiebunglinks)):
        if(zeitverschiebung[j]>=zeitverschiebunglinks[j]):
            vereinigung.append(zeitverschiebunglinks[j])
        else: vereinigung.append(zeitverschiebung[j])
    plt.plot(vereinigung)
    plt.show()
    return vereinigung
def Fussabrollen(matrixnew,extractedstep):
    ACC = Init.getData(matrixnew,sensors=["RLL","LLL"],datas=["acc"],specifiedDatas="x")
    ACCright =  Ableitung(ACC[:,:],[2],1)[:,2:]
    ACCleft = Ableitung(ACC[:,:],[3],1)[:,2:]




    anlematrixre1 = winkelgesamt(matrixnew,Sensoren=["RUA","RLA"])
    anlematrixre = winkelgesamt(matrixnew,Sensoren=["LUA","LLA"])
    anglestickright = anlematrixre1
    anglestickleft = anlematrixre
    plt.plot(anglestickleft)
    plt.plot(anglestickright)
    plt.show()

    rightpeak = []
    leftpeak = []
    for i in range(0,len(extractedstep)):
        posleft = (np.argmax(ACCleft[(extractedstep[i,0]):(extractedstep[i,1]),0]))
        leftpeak.append(anglestickleft[(extractedstep[i,0])+posleft])
        posright = (np.argmax(ACCright[(extractedstep[i,0]):(extractedstep[i,1]),0]))
        rightpeak.append(anglestickright[(extractedstep[i,0])+posright])


    print rightpeak

    return rightpeak,leftpeak
def aufrechtgehen(matrixnew, extractedstep):
        back = Init.getData(matrixnew,sensors=["STE","CEN"],datas=[ "rE1"])
        Vektor = np.zeros((len(back),3))
        Vektor[:,0] = 1
        angleSTEmovement = angle(back[:,2:5],Vektor)
        angleCENmovement = angle(back[:,5:8],Vektor)
        Vektor[:,0] = 0
        Vektor[:,2] = 1
        angleSTEupwards = angle(back[:,2:5],Vektor)
        angleCENupwards = angle(back[:,5:8],Vektor)
        angleSTEupwardsstep = []
        angleSTEmovementstep =[]
        angleSTEmovementstep = []
        angleCENupwardsstep = []
        for i in range(0,len(extractedstep)):
            angleCENupwardsstep.append(np.sum(angleCENupwards[(extractedstep[i,0]):(extractedstep[i,1])])/((extractedstep[i,1])-(extractedstep[i,0])))
            angleSTEupwardsstep.append(np.sum(angleSTEupwards[(extractedstep[i,0]):(extractedstep[i,1])])/((extractedstep[i,1])-(extractedstep[i,0])))


        plt.subplot(2,1,1)
        plt.plot(angleSTEupwardsstep)
        plt.subplot(2,1,2)

        plt.plot(angleCENupwardsstep)
        plt.show()
        difference = (np.absolute([x-y for x,y in zip(angleCENupwardsstep,angleSTEupwardsstep)]))
        return  angleSTEupwardsstep,angleCENupwardsstep, difference
def sensorwinkel(matrixnew, extractedstep, Sensoren= ["RUA","RLA"]):
    re1 = Init.getData(matrixnew,sensors=Sensoren,datas=[ "rE1","rE2","rE3"])
    anlematrixre1 = angle(re1[:,11:14],re1[:,2:5])
    anglearm = anlematrixre1[:,0]
    anlematrixre1 = angle(re1[:,14:17],re1[:,5:8])
    anglearm2 = anlematrixre1[:,0]
    anlematrixre1 = angle(re1[:,17:20],re1[:,8:11])
    anglearm3 = anlematrixre1[:,0]
    anglecomb= [ ]

    for i in range(0,len(anglearm)):
        anglecomb.append(np.sqrt((np.square(anglearm2[i,0]))+(np.square(anglearm[i,0]))+(np.square(anglearm3[i,0]))))

    print anglecomb
    maxanglearm = []
    minanglearm = []
    for i in range(0,len(extractedstep)):
        maxpos = (np.argmax(anglecomb[(extractedstep[i,0]):(extractedstep[i,1])]))
        maxanglearm.append((anglecomb[(extractedstep[i,0])+maxpos]))
        minpos= (np.argmin(anglecomb[(extractedstep[i,0]):(extractedstep[i,1])]))
        minanglearm.append(anglecomb[(extractedstep[i,0])+minpos])

    angleE = np.c_[minanglearm,maxanglearm]
    print "---------------------------------------------------------------------"
    angleE= 180-angleE
    return angleE
Example #6
0
def findsync(dataMatrix):

    datamatrix = Init.getData(dataMatrix,sensors=["STE"],datas=[ "acc"])
    signal= dataMatrix[:,2]
    maxAbsValue, maxAbsFreq = FourierTransformation.maxAbsFreq(signal)
    Filtered = FeatureKonstruktion.filter(datamatrix,[2,3,4],maxAbsFreq)
    plt.plot(Filtered[:,2:])
    plt.show()
def winkelgesamt(matrixnew,Sensoren= ["RUA","RLA"]):
    re1 = Init.getData(matrixnew,sensors=Sensoren,datas=[ "rE1","rE2","rE3"])
    print len(matrixnew)
    anlematrixre1 = angle(re1[:,11:14],re1[:,2:5])
    anglearm = anlematrixre1[:,0]
    anlematrixre1 = angle(re1[:,14:17],re1[:,5:8])
    anglearm2 = anlematrixre1[:,0]
    anlematrixre1 = angle(re1[:,17:20],re1[:,8:11])
    anglearm3 = anlematrixre1[:,0]
    anglecomb= [ ]
    plt.plot(anglearm)
    plt.plot(anglearm2)
    plt.plot(anglearm3)
    plt.show()
    for i in range(0,len(anglearm)):
        anglecomb.append(np.sqrt((np.square(anglearm2[i,0]))+(np.square(anglearm[i,0]))+(np.square(anglearm3[i,0]))))
    print len(anglecomb)
    return anglecomb