コード例 #1
0
def micro_annotate_search(sourceFile):

    flag = False
    counter = 0
    tempData = []
    output = []
    quemican = deque
    ARRAY_TUPLED = namedtuple('ARRAY_TUPLED', 'AXC AYC AZC GXC GYC GZC AVMC GVMC'
                                 ' AXT AYT AZT GXT GYT GZT AVMT GVMT DUMMY ANNOT') #change this for OJ's data, add one element before ANNOT

    print('start to re-annotate')
    print('Please waiting! ....')

    with open(sourceFile) as objectFile:
        for line in objectFile:

            dataread = line.split()

            ori_data = [float(x) for x in dataread[:len(dataread)]]
            data = ARRAY_TUPLED(*ori_data)

            if data.ANNOT in FALL_SET: #change this for OJ's data

                tempData.append(data)

                if flag == False:
                    flag = True


            elif (flag is True) and (data.ANNOT not in FALL_SET) :

                micanDat = searchmax.micAn(tempData) #search for maximum value
                for x in range(len(micanDat)):
                    output.append(micanDat[x])

                flag = False
                tempData = []
                output.append(reannotright.reanotright(data))

            else:

                saveData = reannotright.reanotright(data)
                output.append(saveData)

    #write_csv(destFile, output)
    return output

    print('finish')
コード例 #2
0
def micro_annotate_search(sourceFile):

    flag = False
    counter = 0
    tempData = []
    output = []
    quemican = deque
    ARRAY_TUPLED = namedtuple(
        'ARRAY_TUPLED', 'AXC AYC AZC GXC GYC GZC AVMC GVMC'
        ' AXT AYT AZT GXT GYT GZT AVMT GVMT ANNOT')

    print('start to re-annotate')
    with open(sourceFile) as objectFile:
        for line in objectFile:

            dataread = line.split()

            ori_data = [float(x) for x in dataread[:len(dataread)]]
            data = ARRAY_TUPLED(*ori_data)

            if data.ANNOT in FALL_SET:  #change this for OJ's data

                tempData.append(data)

                if not flag:
                    flag = True

            elif flag and (data.ANNOT not in FALL_SET):

                micanDat = searchmax.micAn(tempData)  #search for maximum value
                for x in range(len(micanDat)):
                    output.append(micanDat[x])

                flag = False
                tempData = []
                output.append(reannotright.reanotright(data))

            else:

                saveData = reannotright.reanotright(data)
                output.append(saveData)

    #write_csv(destFile, output)
    return output
コード例 #3
0
    def micro_test(self):

        targetList = [[0.9398233871,0.1540502688,-0.1714986559,2.5631636763,1.4646649579,-1.4646649579,0.9676834571,
                              3.2954961553,0],[0.9474754032,0.0440576613,0.2685430108,0.7323324789,-1.8308311974,0.3661662395,
                              0.9857819566,2.0055750916,0]]

        sourceList = [0.9398233871,0.1540502688,-0.1714986559,2.5631636763,1.4646649579,-1.4646649579,0.9676834571,
                              3.2954961553,0.9474754032,0.0440576613,0.2685430108,0.7323324789,-1.8308311974,0.3661662395,
                              0.9857819566,2.0055750916,0]

        resultList = reannotright.reanotright(sourceList)

        for i in range(len(targetList)):
            for j in range(len(targetList[0])):
                self.assertAlmostEqual(targetList[i][j],resultList[i][j])
コード例 #4
0
    def micro_nonfall_test(self):

        """micro_nonfall_test: this test is used to check the micro-annotation fucntion for non-fall activities"""

        targetList = [[0.9398233871,0.1540502688,-0.1714986559,2.5631636763,1.4646649579,-1.4646649579,0.9676834571,
                              3.2954961553,0],[0.9474754032,0.0440576613,0.2685430108,0.7323324789,-1.8308311974,0.3661662395,
                              0.9857819566,2.0055750916,0]]

        sourceList = [0.9398233871,0.1540502688,-0.1714986559,2.5631636763,1.4646649579,-1.4646649579,0.9676834571,
                              3.2954961553,0.9474754032,0.0440576613,0.2685430108,0.7323324789,-1.8308311974,0.3661662395,
                              0.9857819566,2.0055750916,0]

        resultList = reannotright.reanotright(sourceList)

        for i in range(len(targetList)):
            for j in range(len(targetList[0])):
                self.assertAlmostEqual(targetList[i][j],resultList[i][j])