예제 #1
0
def generateTwoTestAngleData():
    '''
    This creates a list of data samples to be tested.
    Theses samples are from participants 2 and 3 and
    the calculated angles are used as features.
    '''
    testSamples = []
    index = 0

    for filename in sub2:
        #Open the file
        fIn = open(filename, 'r')
        #For each line of the file calculate the 
        # angles inbetween joints and use the resulting 
        # array as the feature vector. Add that to the list.
        for line in fIn:
            features = generateAngles(line)
            testSamples.append(sample(features, labels[index]))
        fIn.close()
        index += 1

    index = 0
    for filename in sub3:
        #Open the file
        fIn = open(filename, 'r')
        #For each line of the file calculate the 
        # angles inbetween joints and use the resulting 
        # array as the feature vector. Add that to the list.
        for line in fIn:
            features = generateAngles(line)
            testSamples.append(sample(features, labels[index]))
        fIn.close()
        index += 1

    return testSamples
예제 #2
0
def generateTwoTestAngleData():
    '''
    This creates a list of data samples to be tested.
    Theses samples are from participants 2 and 3 and
    the calculated angles are used as features.
    '''
    testSamples = []
    index = 0

    for filename in sub2:
        #Open the file
        fIn = open(filename, 'r')
        #For each line of the file calculate the
        # angles inbetween joints and use the resulting
        # array as the feature vector. Add that to the list.
        for line in fIn:
            features = generateAngles(line)
            testSamples.append(sample(features, labels[index]))
        fIn.close()
        index += 1

    index = 0
    for filename in sub3:
        #Open the file
        fIn = open(filename, 'r')
        #For each line of the file calculate the
        # angles inbetween joints and use the resulting
        # array as the feature vector. Add that to the list.
        for line in fIn:
            features = generateAngles(line)
            testSamples.append(sample(features, labels[index]))
        fIn.close()
        index += 1

    return testSamples
예제 #3
0
def generateOneTestPositionData(means, stdDevs):
    '''
    This creates a list of sample objects that can
    be used for testing. This list is built from the third
    participant's data and uses joint positions as features.
    The poisitions are also normalized as they are added to
    the list.
    '''

    testSamples = []
    index = 0

    for filename in sub3:
        #Open the file
        fIn = open(filename, 'r')
        #For each line of the files, create a feature vector
        # of the raw joint positions. Add that to the list.
        for line in fIn:
            features = returnLine(line)
            samp = sample(features, labels[index])
            samp.normalizeValues(means, stdDevs)
            testSamples.append(samp)
        fIn.close()
        index += 1

    return testSamples
예제 #4
0
def generateOneTestPositionData(means, stdDevs):
    '''
    This creates a list of sample objects that can 
    be used for testing. This list is built from the third 
    participant's data and uses joint positions as features.
    The poisitions are also normalized as they are added to 
    the list.
    '''

    testSamples = []
    index = 0

    for filename in sub3:
        #Open the file
        fIn = open(filename, 'r')
        #For each line of the files, create a feature vector
        # of the raw joint positions. Add that to the list.
        for line in fIn:
            features = returnLine(line)
            samp = sample(features, labels[index])
            samp.normalizeValues(means, stdDevs)
            testSamples.append(samp)
        fIn.close()
        index += 1

    return testSamples
예제 #5
0
def generateDetectData(feat):
    '''
    This creates a list of data samples to be tested.
    Theses samples are from participants 2 and 3 and
    the calculated angles are used as features.
    '''
    detectSamples = []

    for line in feat:
        features = np.array(line)
        detectSamples.append(sample(features))

    return detectSamples
예제 #6
0
def generateTwoTestPositionData(means, stdDevs):
    '''
    This creates a list of data samples to be tested.
    Theses samples are from participants 2 and 3 and
    the joint poisitions are used as features.
    '''
    testSamples = []
    index = 0

    for filename in sub2:
        #Open the file
        fIn = open(filename, 'r')
        #For each line of the files, create a feature vector
        # of the raw joint positions. Add that to the list.
        for line in fIn:
            features = returnLine(line)
            samp = sample(features, labels[index])
            samp.normalizeValues(means, stdDevs)
            testSamples.append(samp)
        fIn.close()
        index += 1

    index = 0

    for filename in sub3:
        #Open the file
        fIn = open(filename, 'r')
        #For each line of the files, create a feature vector
        # of the raw joint positions. Add that to the list.
        for line in fIn:
            features = returnLine(line)
            samp = sample(features, labels[index])
            samp.normalizeValues(means, stdDevs)
            testSamples.append(samp)
        fIn.close()
        index += 1

    return testSamples
예제 #7
0
def generateTwoTestPositionData(means, stdDevs):
    '''
    This creates a list of data samples to be tested.
    Theses samples are from participants 2 and 3 and
    the joint poisitions are used as features.
    '''
    testSamples = []
    index = 0

    for filename in sub2:
        #Open the file
        fIn = open(filename, 'r')
        #For each line of the files, create a feature vector
        # of the raw joint positions. Add that to the list.
        for line in fIn:
            features = returnLine(line)
            samp = sample(features, labels[index])
            samp.normalizeValues(means, stdDevs)
            testSamples.append(samp)
        fIn.close()
        index += 1

    index = 0 

    for filename in sub3:
        #Open the file
        fIn = open(filename, 'r')
        #For each line of the files, create a feature vector
        # of the raw joint positions. Add that to the list.
        for line in fIn:
            features = returnLine(line)
            samp = sample(features, labels[index])
            samp.normalizeValues(means, stdDevs)
            testSamples.append(samp)
        fIn.close()
        index += 1

    return testSamples
예제 #8
0
def generateDetectData(filename):
    '''
    This creates a list of data samples to be tested.
    Theses samples are from participants 2 and 3 and
    the calculated angles are used as features.
    '''
    detectSamples = []

    # Open the file
    fIn = open(filename, 'r')
    for line in fIn:
        features = np.array(json.loads(line)['feature'])
        detectSamples.append(sample(features))
    fIn.close()

    return detectSamples
예제 #9
0
def generateOneTestAngleData():
    '''
    This creates a list of sample objects that can
    be used for testing. This list is built from the third
    participant's data and uses angles as features.
    '''

    testSamples = []
    index = 0

    for filename in sub3:
        #Open the file
        fIn = open(filename, 'r')
        #For each line of the file calculate the
        # angles inbetween joints and use the resulting
        # array as the feature vector. Add that to the list.
        for line in fIn:
            features = generateAngles(line)
            testSamples.append(sample(features, labels[index]))
        fIn.close()
        index += 1

    return testSamples
예제 #10
0
def generateOneTestAngleData():
    '''
    This creates a list of sample objects that can 
    be used for testing. This list is built from the third 
    participant's data and uses angles as features.
    '''

    testSamples = []
    index = 0

    for filename in sub3:
        #Open the file
        fIn = open(filename, 'r')
        #For each line of the file calculate the 
        # angles inbetween joints and use the resulting 
        # array as the feature vector. Add that to the list.
        for line in fIn:
            features = generateAngles(line)
            testSamples.append(sample(features, labels[index]))
        fIn.close()
        index += 1

    return testSamples