コード例 #1
0
ファイル: 30_4_2014.py プロジェクト: ranBernstein/GaitKinect
out.write('@relation weka.kuku\n\n')
for i in range(numOfFeatures):
    out.write('@attribute a'+str(i)+ ' numeric\n')
st=''
for i,s in enumerate(subjects):
    st+=str(s)
    if i!= len(subjects)-1:
        st+=','
out.write('@attribute class {'+st+'}\n\n@data\n\n')
for subject in subjects:
    for stride in xrange(1,13):
        file = '../AMCs/subjects/' + str(subject) + '/' + str(stride) + '.amc'
        features = []
        for joint in joints:
            try:
                input = getAMCperiod(joint, file)
            except:
                continue
            input = alignByMax(input)
            sub =  fig.add_subplot(frameSize*110 + subjects.index(subject))
            sub.plot(range(len(input)), input)
            sub_uniform = fig_uniform.add_subplot(frameSize*110 + subjects.index(subject))
            
            specialFeatures = [op(input) for op in specialOperators]
            new_time, uniform_input = inter.getUniformSampled(xrange(len(input)), input, lenVec)
            features += specialFeatures 
            features += uniform_input.tolist()
            sub_uniform.plot( xrange(len(uniform_input)), uniform_input)
            data.append(uniform_input)
            tags.append(subject)
            plt.xlabel('Time (in frames)')
コード例 #2
0
import numpy as np
import math
import matplotlib.pyplot as plt 
from utils.vicon.amcParser import getAMCperiod
from utils.stitching.stitching import MAXIMA_ORDER, CLUSTER_COEFF, plotParts, createParts
import utils.stitching.stitching as loop
import utils.utils as ut
import utils.MovingAverage as ma

file = 'AMCs/598.amc'
joint = 'rtibia'
list = getAMCperiod(joint, file)
stride = list[112:251] 
list = ut.alignByMax(stride)
#list = ut.alignByMax(list)
noiseStdFactor = 0.04
amplitude = np.max(list) - np.min(list)
var = (amplitude*noiseStdFactor)**2
print var
partsAmount = 16
noisy_parts = createParts(list, True, partsAmount, var)
parts = ma.partsmovingAverage(noisy_parts)

frameSize = math.ceil(np.sqrt(len(parts)))
fig = plt.figure()
for i,part in enumerate(parts):
    curr = fig.add_subplot(frameSize,  frameSize, i+1)
    curr.plot(part)
        
merged, mergedDes = loop.stitch(parts)
print(len(merged))