Beispiel #1
0
	def __init__(self, split=0.5, pca_dims=3):
		print "Initialising reference data..."
		bar = progressbar.ProgressBar(maxval=7, widgets=[progressbar.Bar('=', '[', ']'), ' ', progressbar.Percentage()])
		bar.start(); progress = 0

		self.__data_V0=m.readCSVfile("captures/VerticalArmSpin-Dan.csv")
		self.__data_V1=m.readCSVfile("captures/VerticalArmSpin-Jibran.csv")
		self.__data_H0=m.readCSVfile("captures/HorizontalArmSpin-Dan.csv")
		self.__data_H1=m.readCSVfile("captures/HorizontalArmSpin-Jibran.csv")
		self.__data_H2=m.readCSVfile("captures/HorizontalArmSpinLittleCircles-Jibran.csv")
		progress += 1; bar.update(progress)

		(self.__HDsegs_V0,self.__LDsegs_V0,_) = m.getHighAndLowDimSegments(self.__data_V0, n_components=pca_dims, smoothingWindow=15); progress += 1; bar.update(progress)
		(self.__HDsegs_V1,self.__LDsegs_V1,_) = m.getHighAndLowDimSegments(self.__data_V1, n_components=pca_dims, smoothingWindow=25); progress += 1; bar.update(progress)
		(self.__HDsegs_H0,self.__LDsegs_H0,_) = m.getHighAndLowDimSegments(self.__data_H0, n_components=pca_dims, smoothingWindow=20); progress += 1; bar.update(progress)
		(self.__HDsegs_H1,self.__LDsegs_H1,_) = m.getHighAndLowDimSegments(self.__data_H1, n_components=pca_dims, smoothingWindow=20); progress += 1; bar.update(progress)
		(self.__HDsegs_H2,self.__LDsegs_H2,_) = m.getHighAndLowDimSegments(self.__data_H2, n_components=pca_dims, smoothingWindow=15); progress += 1; bar.update(progress)

		self.HDtraining = {'VerticalArmSpin - Dan':self.__HDsegs_V0[:(int(len(self.__HDsegs_V0)*split))],
							'VerticalArmSpin - Jibran':self.__HDsegs_V1[:(int(len(self.__HDsegs_V1)*split))],
							'HorizontalArmSpin - Dan':self.__HDsegs_H0[:(int(len(self.__HDsegs_H0)*split))],
							'HorizontalArmSpin - Jibran':self.__HDsegs_H1[:(int(len(self.__HDsegs_H1)*split))],
							'HorizontalArmSpin - Small - Jibran':self.__HDsegs_H2[:(int(len(self.__HDsegs_H2)*split))]}
		self.LDtraining = {'VerticalArmSpin - Dan':self.__LDsegs_V0[:(int(len(self.__LDsegs_V0)*split))],
							'VerticalArmSpin - Jibran':self.__LDsegs_V1[:(int(len(self.__LDsegs_V1)*split))],
							'HorizontalArmSpin - Dan':self.__LDsegs_H0[:(int(len(self.__LDsegs_H0)*split))],
							'HorizontalArmSpin - Jibran':self.__LDsegs_H1[:(int(len(self.__LDsegs_H1)*split))],
							'HorizontalArmSpin - Small - Jibran':self.__LDsegs_H2[:(int(len(self.__LDsegs_H2)*split))]}

		self.HDtest = {'VerticalArmSpin - Dan':self.__HDsegs_V0[(int(len(self.__HDsegs_V0)*split)):],
							'VerticalArmSpin - Jibran':self.__HDsegs_V1[(int(len(self.__HDsegs_V1)*split)):],
							'HorizontalArmSpin - Dan':self.__HDsegs_H0[(int(len(self.__HDsegs_H0)*split)):],
							'HorizontalArmSpin - Jibran':self.__HDsegs_H1[(int(len(self.__HDsegs_H1)*split)):],
							'HorizontalArmSpin - Small - Jibran':self.__HDsegs_H2[(int(len(self.__HDsegs_H2)*split)):]}
		self.LDtest = {'VerticalArmSpin - Dan':self.__LDsegs_V0[(int(len(self.__LDsegs_V0)*split)):],
							'VerticalArmSpin - Jibran':self.__LDsegs_V1[(int(len(self.__LDsegs_V1)*split)):],
							'HorizontalArmSpin - Dan':self.__LDsegs_H0[(int(len(self.__LDsegs_H0)*split)):],
							'HorizontalArmSpin - Jibran':self.__LDsegs_H1[(int(len(self.__LDsegs_H1)*split)):],
							'HorizontalArmSpin - Small - Jibran':self.__LDsegs_H2[(int(len(self.__LDsegs_H2)*split)):]}

		progress += 1; bar.update(progress)
		bar.finish()
Beispiel #2
0
	def __init__(self, split=0.5):
		print "Initialising reference data..."
		bar = progressbar.ProgressBar(maxval=14, widgets=[progressbar.Bar('=', '[', ']'), ' ', progressbar.Percentage()])
		bar.start(); progress = 0
		self.data0a=m.readRaw("captures/mechanicalArm/ArmLength60cm/Anticlockwise/radius0cmHorizontal.txt")[26:,4:]
		self.data5a=m.readRaw("captures/mechanicalArm/ArmLength60cm/Anticlockwise/radius5cmHorizontal.txt")[26:,4:]
		self.data10a=m.readRaw("captures/mechanicalArm/ArmLength60cm/Anticlockwise/radius10cmHorizontal.txt")[26:,4:]
		self.data15a=m.readRaw("captures/mechanicalArm/ArmLength60cm/Anticlockwise/radius15cmHorizontal.txt")[26:,4:]
		self.data20a=m.readRaw("captures/mechanicalArm/ArmLength60cm/Anticlockwise/radius20cmHorizontal.txt")[26:,4:]
		self.data25a=m.readRaw("captures/mechanicalArm/ArmLength60cm/Anticlockwise/radius25cmHorizontal.txt")[26:,4:]
		self.data0c=m.readRaw("captures/mechanicalArm/ArmLength60cm/Clockwise/radius0cmHorizontal.txt")[26:,4:]
		self.data5c=m.readRaw("captures/mechanicalArm/ArmLength60cm/Clockwise/radius5cmHorizontal.txt")[26:,4:]
		self.data10c=m.readRaw("captures/mechanicalArm/ArmLength60cm/Clockwise/radius10cmHorizontal.txt")[26:,4:]
		self.data15c=m.readRaw("captures/mechanicalArm/ArmLength60cm/Clockwise/radius15cmHorizontal.txt")[26:,4:]
		self.data20c=m.readRaw("captures/mechanicalArm/ArmLength60cm/Clockwise/radius20cmHorizontal.txt")[26:,4:]
		self.data25c=m.readRaw("captures/mechanicalArm/ArmLength60cm/Clockwise/radius25cmHorizontal.txt")[26:,4:]
		progress += 1; bar.update(progress)

		(self.HDsegs0a,self.LDsegs0a,self.w0a) = m.getHighAndLowDimSegments(self.data0a, n_components=9); progress += 1; bar.update(progress)
		(self.HDsegs5a,self.LDsegs5a,self.w5a) = m.getHighAndLowDimSegments(self.data5a, n_components=9); progress += 1; bar.update(progress)
		(self.HDsegs10a,self.LDsegs10a,self.w10a) = m.getHighAndLowDimSegments(self.data10a, n_components=9); progress += 1; bar.update(progress)
		(self.HDsegs15a,self.LDsegs15a,self.w15a) = m.getHighAndLowDimSegments(self.data15a, n_components=9); progress += 1; bar.update(progress)
		(self.HDsegs20a,self.LDsegs20a,self.w20a) = m.getHighAndLowDimSegments(self.data20a, n_components=9); progress += 1; bar.update(progress)
		(self.HDsegs25a,self.LDsegs25a,self.w25a) = m.getHighAndLowDimSegments(self.data25a, n_components=9); progress += 1; bar.update(progress)
		(self.HDsegs0c,self.LDsegs0c,self.w0c) = m.getHighAndLowDimSegments(self.data0c, n_components=9); progress += 1; bar.update(progress)
		(self.HDsegs5c,self.LDsegs5c,self.w5c) = m.getHighAndLowDimSegments(self.data5c, n_components=9); progress += 1; bar.update(progress)
		(self.HDsegs10c,self.LDsegs10c,self.w10c) = m.getHighAndLowDimSegments(self.data10c, n_components=9); progress += 1; bar.update(progress)
		(self.HDsegs15c,self.LDsegs15c,self.w15c) = m.getHighAndLowDimSegments(self.data15c, n_components=9); progress += 1; bar.update(progress)
		(self.HDsegs20c,self.LDsegs20c,self.w20c) = m.getHighAndLowDimSegments(self.data20c, n_components=9); progress += 1; bar.update(progress)
		(self.HDsegs25c,self.LDsegs25c,self.w25c) = m.getHighAndLowDimSegments(self.data25c, n_components=9); progress += 1; bar.update(progress)
		
		self.averageWeights = [float(sum(t))/float(len(t)) for t in zip(self.w0a,self.w5a,self.w10a,self.w15a,self.w20a,self.w25a,self.w0c,self.w5c,self.w10c,self.w15c,self.w20c,self.w25c)]

		self.HDsegs20a=self.HDsegs20a[:-1]
		self.HDsegs25a=self.HDsegs25a[1:]
		self.HDsegs0c=self.HDsegs0c[1:-1]
		self.HDsegs5c=self.HDsegs5c[1:]
		self.HDsegs10c=self.HDsegs10c[:-1]
		self.HDsegs15c=self.HDsegs15c[1:-1]
		self.HDsegs20c=self.HDsegs20c[1:-1]
		self.HDsegs25c=self.HDsegs25c[1:-1]
		self.LDsegs20a=self.LDsegs20a[:-1]
		self.LDsegs25a=self.LDsegs25a[1:]
		self.LDsegs0c=self.LDsegs0c[1:-1]
		self.LDsegs5c=self.LDsegs5c[1:]
		self.LDsegs10c=self.LDsegs10c[:-1]
		self.LDsegs15c=self.LDsegs15c[1:-1]
		self.LDsegs20c=self.LDsegs20c[1:-1]
		self.LDsegs25c=self.LDsegs25c[1:-1]

		self.HDtraining = {'Anticlockwise radius=0cm':self.HDsegs0a[:(int(len(self.HDsegs0a)*split))],
							'Anticlockwise radius=5cm':self.HDsegs5a[:(int(len(self.HDsegs5a)*split))],
							'Anticlockwise radius=10cm':self.HDsegs10a[:(int(len(self.HDsegs10a)*split))],
							'Anticlockwise radius=15cm':self.HDsegs15a[:(int(len(self.HDsegs15a)*split))],
							'Anticlockwise radius=20cm':self.HDsegs20a[:(int(len(self.HDsegs20a)*split))],
							'Anticlockwise radius=25cm':self.HDsegs25a[:(int(len(self.HDsegs25a)*split))],
							'Anticlockwise radius=0cm':self.HDsegs0a[:(int(len(self.HDsegs0a)*split))],
							'Clockwise radius=5cm':self.HDsegs5c[:(int(len(self.HDsegs5c)*split))],
							'Clockwise radius=10cm':self.HDsegs10c[:(int(len(self.HDsegs10c)*split))],
							'Clockwise radius=15cm':self.HDsegs15c[:(int(len(self.HDsegs15c)*split))],
							'Clockwise radius=20cm':self.HDsegs20c[:(int(len(self.HDsegs20c)*split))],
							'Clockwise radius=25cm':self.HDsegs25c[:(int(len(self.HDsegs25c)*split))]}
		self.LDtraining = {'Anticlockwise radius=0cm':self.LDsegs0a[:(int(len(self.LDsegs0a)*split))],
							'Anticlockwise radius=5cm':self.LDsegs5a[:(int(len(self.LDsegs5a)*split))],
							'Anticlockwise radius=10cm':self.LDsegs10a[:(int(len(self.LDsegs10a)*split))],
							'Anticlockwise radius=15cm':self.LDsegs15a[:(int(len(self.LDsegs15a)*split))],
							'Anticlockwise radius=20cm':self.LDsegs20a[:(int(len(self.LDsegs20a)*split))],
							'Anticlockwise radius=25cm':self.LDsegs25a[:(int(len(self.LDsegs25a)*split))],
							'Anticlockwise radius=0cm':self.LDsegs0a[:(int(len(self.LDsegs0a)*split))],
							'Clockwise radius=5cm':self.LDsegs5c[:(int(len(self.LDsegs5c)*split))],
							'Clockwise radius=10cm':self.LDsegs10c[:(int(len(self.LDsegs10c)*split))],
							'Clockwise radius=15cm':self.LDsegs15c[:(int(len(self.LDsegs15c)*split))],
							'Clockwise radius=20cm':self.LDsegs20c[:(int(len(self.LDsegs20c)*split))],
							'Clockwise radius=25cm':self.LDsegs25c[:(int(len(self.LDsegs25c)*split))]}

		self.HDtest = {'Anticlockwise radius=0cm':self.HDsegs0a[(int(len(self.HDsegs0a)*split)):],
							'Anticlockwise radius=5cm':self.HDsegs5a[(int(len(self.HDsegs5a)*split)):],
							'Anticlockwise radius=10cm':self.HDsegs10a[(int(len(self.HDsegs10a)*split)):],
							'Anticlockwise radius=15cm':self.HDsegs15a[(int(len(self.HDsegs15a)*split)):],
							'Anticlockwise radius=20cm':self.HDsegs20a[(int(len(self.HDsegs20a)*split)):],
							'Anticlockwise radius=25cm':self.HDsegs25a[(int(len(self.HDsegs25a)*split)):],
							'Anticlockwise radius=0cm':self.HDsegs0a[(int(len(self.HDsegs0a)*split)):],
							'Clockwise radius=5cm':self.HDsegs5c[(int(len(self.HDsegs5c)*split)):],
							'Clockwise radius=10cm':self.HDsegs10c[(int(len(self.HDsegs10c)*split)):],
							'Clockwise radius=15cm':self.HDsegs15c[(int(len(self.HDsegs15c)*split)):],
							'Clockwise radius=20cm':self.HDsegs20c[(int(len(self.HDsegs20c)*split)):],
							'Clockwise radius=25cm':self.HDsegs25c[(int(len(self.HDsegs25c)*split)):]}
		self.LDtest = {'Anticlockwise radius=0cm':self.LDsegs0a[(int(len(self.LDsegs0a)*split)):],
							'Anticlockwise radius=5cm':self.LDsegs5a[(int(len(self.LDsegs5a)*split)):],
							'Anticlockwise radius=10cm':self.LDsegs10a[(int(len(self.LDsegs10a)*split)):],
							'Anticlockwise radius=15cm':self.LDsegs15a[(int(len(self.LDsegs15a)*split)):],
							'Anticlockwise radius=20cm':self.LDsegs20a[(int(len(self.LDsegs20a)*split)):],
							'Anticlockwise radius=25cm':self.LDsegs25a[(int(len(self.LDsegs25a)*split)):],
							'Anticlockwise radius=0cm':self.LDsegs0a[(int(len(self.LDsegs0a)*split)):],
							'Clockwise radius=5cm':self.LDsegs5c[(int(len(self.LDsegs5c)*split)):],
							'Clockwise radius=10cm':self.LDsegs10c[(int(len(self.LDsegs10c)*split)):],
							'Clockwise radius=15cm':self.LDsegs15c[(int(len(self.LDsegs15c)*split)):],
							'Clockwise radius=20cm':self.LDsegs20c[(int(len(self.LDsegs20c)*split)):],
							'Clockwise radius=25cm':self.LDsegs25c[(int(len(self.LDsegs25c)*split)):]}

		progress += 1; bar.update(progress)
		bar.finish()
Beispiel #3
0
	def computeSegments(self):
		print "Segmenting data..."
		bar = progressbar.ProgressBar(maxval=54, widgets=[progressbar.Bar('=', '[', ']'), ' ', progressbar.Percentage()])
		bar.start(); progress = 0

		dan10r=m.getHighAndLowDimSegments(self.data['10r'][0], n_components=9, smoothingWindow=150); progress += 1; bar.update(progress)
		dan10l=m.getHighAndLowDimSegments(self.data['10l'][0], n_components=9, smoothingWindow=150); progress += 1; bar.update(progress)
		dan20r=m.getHighAndLowDimSegments(self.data['20r'][0], n_components=9, smoothingWindow=150); progress += 1; bar.update(progress)
		dan20l=m.getHighAndLowDimSegments(self.data['20l'][0], n_components=9, smoothingWindow=150); progress += 1; bar.update(progress)
		dan30r=m.getHighAndLowDimSegments(self.data['30r'][0], n_components=9, smoothingWindow=170); progress += 1; bar.update(progress)
		dan30l=m.getHighAndLowDimSegments(self.data['30l'][0], n_components=9, smoothingWindow=160); progress += 1; bar.update(progress)
		dan40r=m.getHighAndLowDimSegments(self.data['40r'][0], n_components=9, smoothingWindow=200); progress += 1; bar.update(progress)
		dan40l=m.getHighAndLowDimSegments(self.data['40l'][0], n_components=9, smoothingWindow=150); progress += 1; bar.update(progress)
		dan50r=m.getHighAndLowDimSegments(self.data['50r'][0], n_components=9, smoothingWindow=180); progress += 1; bar.update(progress)
		dan50l=m.getHighAndLowDimSegments(self.data['50l'][0], n_components=9, smoothingWindow=180); progress += 1; bar.update(progress)
		dan60r=m.getHighAndLowDimSegments(self.data['60r'][0], n_components=9, smoothingWindow=180); progress += 1; bar.update(progress)
		dan60l=m.getHighAndLowDimSegments(self.data['60l'][0], n_components=9, smoothingWindow=200); progress += 1; bar.update(progress)
		dan70r=m.getHighAndLowDimSegments(self.data['70r'][0], n_components=9, smoothingWindow=170); progress += 1; bar.update(progress)
		dan70l=m.getHighAndLowDimSegments(self.data['70l'][0], n_components=9, smoothingWindow=150); progress += 1; bar.update(progress)
		dan80r=m.getHighAndLowDimSegments(self.data['80r'][0], n_components=9, smoothingWindow=150); progress += 1; bar.update(progress)
		dan80l=m.getHighAndLowDimSegments(self.data['80l'][0], n_components=9, smoothingWindow=180); progress += 1; bar.update(progress)
		dan90r=m.getHighAndLowDimSegments(self.data['90r'][0], n_components=9, smoothingWindow=180); progress += 1; bar.update(progress)
		dan90l=m.getHighAndLowDimSegments(self.data['90l'][0], n_components=9, smoothingWindow=150); progress += 1; bar.update(progress)

		robert10r=m.getHighAndLowDimSegments(self.data['10r'][1], n_components=9, smoothingWindow=130); progress += 1; bar.update(progress)
		robert10l=m.getHighAndLowDimSegments(self.data['10l'][1], n_components=9, smoothingWindow=130); progress += 1; bar.update(progress)
		robert20r=m.getHighAndLowDimSegments(self.data['20r'][1], n_components=9, smoothingWindow=130); progress += 1; bar.update(progress)
		robert20l=m.getHighAndLowDimSegments(self.data['20l'][1], n_components=9, smoothingWindow=130); progress += 1; bar.update(progress)
		robert30r=m.getHighAndLowDimSegments(self.data['30r'][1], n_components=9, smoothingWindow=130); progress += 1; bar.update(progress)
		robert30l=m.getHighAndLowDimSegments(self.data['30l'][1], n_components=9, smoothingWindow=130); progress += 1; bar.update(progress)
		robert40r=m.getHighAndLowDimSegments(self.data['40r'][1], n_components=9, smoothingWindow=130); progress += 1; bar.update(progress)
		robert40l=m.getHighAndLowDimSegments(self.data['40l'][1], n_components=9, smoothingWindow=130); progress += 1; bar.update(progress)
		robert50r=m.getHighAndLowDimSegments(self.data['50r'][1], n_components=9, smoothingWindow=170); progress += 1; bar.update(progress)
		robert50l=m.getHighAndLowDimSegments(self.data['50l'][1], n_components=9, smoothingWindow=130); progress += 1; bar.update(progress)
		robert60r=m.getHighAndLowDimSegments(self.data['60r'][1], n_components=9, smoothingWindow=200); progress += 1; bar.update(progress)
		robert60l=m.getHighAndLowDimSegments(self.data['60l'][1], n_components=9, smoothingWindow=130); progress += 1; bar.update(progress)
		robert70r=m.getHighAndLowDimSegments(self.data['70r'][1], n_components=9, smoothingWindow=130); progress += 1; bar.update(progress)
		robert70l=m.getHighAndLowDimSegments(self.data['70l'][1], n_components=9, smoothingWindow=130); progress += 1; bar.update(progress)
		robert80r=m.getHighAndLowDimSegments(self.data['80r'][1], n_components=9, smoothingWindow=190); progress += 1; bar.update(progress)
		robert80l=m.getHighAndLowDimSegments(self.data['80l'][1], n_components=9, smoothingWindow=130); progress += 1; bar.update(progress)
		robert90r=m.getHighAndLowDimSegments(self.data['90r'][1], n_components=9, smoothingWindow=150); progress += 1; bar.update(progress)
		robert90l=m.getHighAndLowDimSegments(self.data['90l'][1], n_components=9, smoothingWindow=130); progress += 1; bar.update(progress)

		laura10r=m.getHighAndLowDimSegments(self.data['10r'][2], n_components=9, smoothingWindow=100); progress += 1; bar.update(progress)
		laura10l=m.getHighAndLowDimSegments(self.data['10l'][2], n_components=9, smoothingWindow=100); progress += 1; bar.update(progress)
		laura20r=m.getHighAndLowDimSegments(self.data['20r'][2], n_components=9, smoothingWindow=100); progress += 1; bar.update(progress)
		laura20l=m.getHighAndLowDimSegments(self.data['20l'][2], n_components=9, smoothingWindow=100); progress += 1; bar.update(progress)
		laura30r=m.getHighAndLowDimSegments(self.data['30r'][2], n_components=9, smoothingWindow=100); progress += 1; bar.update(progress)
		laura30l=m.getHighAndLowDimSegments(self.data['30l'][2], n_components=9, smoothingWindow=100); progress += 1; bar.update(progress)
		laura40r=m.getHighAndLowDimSegments(self.data['40r'][2], n_components=9, smoothingWindow=100); progress += 1; bar.update(progress)
		laura40l=m.getHighAndLowDimSegments(self.data['40l'][2], n_components=9, smoothingWindow=100); progress += 1; bar.update(progress)
		laura50r=m.getHighAndLowDimSegments(self.data['50r'][2], n_components=9, smoothingWindow=100); progress += 1; bar.update(progress)
		laura50l=m.getHighAndLowDimSegments(self.data['50l'][2], n_components=9, smoothingWindow=100); progress += 1; bar.update(progress)
		laura60r=m.getHighAndLowDimSegments(self.data['60r'][2], n_components=9, smoothingWindow=100); progress += 1; bar.update(progress)
		laura60l=m.getHighAndLowDimSegments(self.data['60l'][2], n_components=9, smoothingWindow=100); progress += 1; bar.update(progress)
		laura70r=m.getHighAndLowDimSegments(self.data['70r'][2], n_components=9, smoothingWindow=100); progress += 1; bar.update(progress)
		laura70l=m.getHighAndLowDimSegments(self.data['70l'][2], n_components=9, smoothingWindow=100); progress += 1; bar.update(progress)
		laura80r=m.getHighAndLowDimSegments(self.data['80r'][2], n_components=9, smoothingWindow=100); progress += 1; bar.update(progress)
		laura80l=m.getHighAndLowDimSegments(self.data['80l'][2], n_components=9, smoothingWindow=100); progress += 1; bar.update(progress)
		laura90r=m.getHighAndLowDimSegments(self.data['90r'][2], n_components=9, smoothingWindow=100); progress += 1; bar.update(progress)
		laura90l=m.getHighAndLowDimSegments(self.data['90l'][2], n_components=9, smoothingWindow=100); progress += 1; bar.update(progress)

		#Delete bad segments and throw some away anyway - there are plenty to spare!
		
		dan10r=([],[],dan10r[2]) # This was garbage
		dan10l=(dan10l[0][2:-2],dan10l[1][2:-2],dan10l[2])
		dan20r=(dan20r[0][2:-2],dan20r[1][2:-2],dan20r[2])
		dan20l=(dan20l[0][2:-2],dan20l[1][2:-2],dan20l[2])
		dan30r=(dan30r[0][2:-2],dan30r[1][2:-2],dan30r[2])
		dan30l=(dan30l[0][2:-2],dan30l[1][2:-2],dan30l[2])
		dan40r=(dan40r[0][2:-2],dan40r[1][2:-2],dan40r[2])
		dan40l=(dan40l[0][2:-2],dan40l[1][2:-2],dan40l[2])
		dan50r=(dan50r[0][2:-2],dan50r[1][2:-2],dan50r[2])
		dan50l=(dan50l[0][2:-2],dan50l[1][2:-2],dan50l[2])
		dan60r=(dan60r[0][2:-2],dan60r[1][2:-2],dan60r[2])
		dan60l=(dan60l[0][2:-2],dan60l[1][2:-2],dan60l[2])
		dan70r=(dan70r[0][2:-2],dan70r[1][2:-2],dan70r[2])
		dan70l=(dan70l[0][2:-2],dan70l[1][2:-2],dan70l[2])
		dan80r=(dan80r[0][2:-2],dan80r[1][2:-2],dan80r[2])
		dan80l=(dan80l[0][2:-2],dan80l[1][2:-2],dan80l[2])
		dan90r=(dan90r[0][2:-2],dan90r[1][2:-2],dan90r[2])
		dan90l=(dan90l[0][2:-2],dan90l[1][2:-2],dan90l[2])

		robert10r=(robert10r[0][2:-2],robert10r[1][2:-2],robert10r[2])
		robert10l=(robert10l[0][2:-2],robert10l[1][2:-2],robert10l[2])
		robert20r=(robert20r[0][2:-2],robert20r[1][2:-2],robert20r[2])
		robert20l=(robert20l[0][2:-2],robert20l[1][2:-2],robert20l[2])
		robert30r=(robert30r[0][2:-2],robert30r[1][2:-2],robert30r[2])
		robert30l=(robert30l[0][2:-2],robert30l[1][2:-2],robert30l[2])
		robert40r=(robert40r[0][2:-2],robert40r[1][2:-2],robert40r[2])
		robert40l=(robert40l[0][2:-2],robert40l[1][2:-2],robert40l[2])
		robert50r=(robert50r[0][2:-2],robert50r[1][2:-2],robert50r[2])
		robert50l=(robert50l[0][2:-2],robert50l[1][2:-2],robert50l[2])
		robert60r=(robert60r[0][2:-2],robert60r[1][2:-2],robert60r[2])
		robert60l=(robert60l[0][2:-2],robert60l[1][2:-2],robert60l[2])
		robert70r=(robert70r[0][2:-2],robert70r[1][2:-2],robert70r[2])
		robert70l=(robert70l[0][2:-2],robert70l[1][2:-2],robert70l[2])
		robert80r=(robert80r[0][2:-2],robert80r[1][2:-2],robert80r[2])
		robert80l=(robert80l[0][2:-2],robert80l[1][2:-2],robert80l[2])
		robert90r=(robert90r[0][2:-2],robert90r[1][2:-2],robert90r[2])
		robert90l=(robert90l[0][2:-2],robert90l[1][2:-2],robert90l[2])

		laura10r=(laura10r[0][2:-2],laura10r[1][2:-2],laura10r[2])
		laura10l=(laura10l[0][2:-2],laura10l[1][2:-2],laura10l[2])
		laura20r=(laura20r[0][2:-2],laura20r[1][2:-2],laura20r[2])
		laura20l=(laura20l[0][2:-2],laura20l[1][2:-2],laura20l[2])
		laura30r=(laura30r[0][2:-2],laura30r[1][2:-2],laura30r[2])
		laura30l=(laura30l[0][2:-2],laura30l[1][2:-2],laura30l[2])
		laura40r=(laura40r[0][2:-2],laura40r[1][2:-2],laura40r[2])
		laura40l=(laura40l[0][2:-2],laura40l[1][2:-2],laura40l[2])
		laura50r=(laura50r[0][2:-2],laura50r[1][2:-2],laura50r[2])
		laura50l=(laura50l[0][2:-2],laura50l[1][2:-2],laura50l[2])
		laura60r=(laura60r[0][2:-2],laura60r[1][2:-2],laura60r[2])
		laura60l=(laura60l[0][2:-2],laura60l[1][2:-2],laura60l[2])
		laura70r=(laura70r[0][2:-2],laura70r[1][2:-2],laura70r[2])
		laura70l=(laura70l[0][2:-2],laura70l[1][2:-2],laura70l[2])
		laura80r=(laura80r[0][2:-2],laura80r[1][2:-2],laura80r[2])
		laura80l=(laura80l[0][2:-2],laura80l[1][2:-2],laura80l[2])
		laura90r=(laura90r[0][2:-2],laura90r[1][2:-2],laura90r[2])
		laura90l=(laura90l[0][2:-2],laura90l[1][2:-2],laura90l[2])

		self.HDsegs={'10l':[dan10l[0],robert10l[0],laura10l[0]],'20l':[dan20l[0],robert20l[0],laura20l[0]],'30l':[dan30l[0],robert30l[0],laura30l[0]],'40l':[dan40l[0],robert40l[0],laura40l[0]],'50l':[dan50l[0],robert50l[0],laura50l[0]],'60l':[dan60l[0],robert60l[0],laura60l[0]],'70l':[dan70l[0],robert70l[0],laura70l[0]],'80l':[dan80l[0],robert80l[0],laura80l[0]],'90l':[dan90l[0],robert90l[0],laura90l[0]],
		             '10r':[dan10r[0],robert10r[0],laura10r[0]],'20r':[dan20r[0],robert20r[0],laura20r[0]],'30r':[dan30r[0],robert30r[0],laura30r[0]],'40r':[dan40r[0],robert40r[0],laura40r[0]],'50r':[dan50r[0],robert50r[0],laura50r[0]],'60r':[dan60r[0],robert60r[0],laura60r[0]],'70r':[dan70r[0],robert70r[0],laura70r[0]],'80r':[dan80r[0],robert80r[0],laura80r[0]],'90r':[dan90r[0],robert90r[0],laura90r[0]]}

		self.LDsegs={'10l':[dan10l[1],robert10l[1],laura10l[1]],'20l':[dan20l[1],robert20l[1],laura20l[1]],'30l':[dan30l[1],robert30l[1],laura30l[1]],'40l':[dan40l[1],robert40l[1],laura40l[1]],'50l':[dan50l[1],robert50l[1],laura50l[1]],'60l':[dan60l[1],robert60l[1],laura60l[1]],'70l':[dan70l[1],robert70l[1],laura70l[1]],'80l':[dan80l[1],robert80l[1],laura80l[1]],'90l':[dan90l[1],robert90l[1],laura90l[1]],
		             '10r':[dan10r[1],robert10r[1],laura10r[1]],'20r':[dan20r[1],robert20r[1],laura20r[1]],'30r':[dan30r[1],robert30r[1],laura30r[1]],'40r':[dan40r[1],robert40r[1],laura40r[1]],'50r':[dan50r[1],robert50r[1],laura50r[1]],'60r':[dan60r[1],robert60r[1],laura60r[1]],'70r':[dan70r[1],robert70r[1],laura70r[1]],'80r':[dan80r[1],robert80r[1],laura80r[1]],'90r':[dan90r[1],robert90r[1],laura90r[1]]}


		# storing high and low dim segments under each key (only for Laura I at the moment)
		self.segs = {'10l':[laura10l[0][1:-1],laura10l[1][1:-1]],'20l':[laura20l[0][1:-1],laura20l[1][1:-1]],'30l':[laura30l[0][1:-1],laura30l[1][1:-1]],'40l':[laura40l[0][1:-1],laura40l[1][1:-1]],'50l':[laura50l[0][1:-1],laura50l[1][1:-1]],'60l':[laura60l[0][1:-1],laura60l[1][1:-1]],'70l':[laura70l[0][1:-1],laura70l[1][1:-1]],'80l':[laura80l[0][1:-1],laura80l[1][1:-1]],'90l':[laura90l[0][1:7]+laura90l[0][9:-1],laura90l[1][1:7]+laura90l[1][9:-1]],
		             '10r':[laura10r[0][1:-1],laura10r[1][1:-1]],'20r':[laura20r[0][1:-1],laura20r[1][1:-1]],'30r':[laura30r[0][1:-1],laura30r[1][1:-1]],'40r':[laura40r[0][1:-1],laura40r[1][1:-1]],'50r':[laura50r[0][1:-1],laura50r[1][1:-1]],'60r':[laura60r[0][1:-1],laura60r[1][1:-1]],'70r':[laura70r[0][1:-1],laura70r[1][1:-1]],'80r':[laura80r[0][1:-1],laura80r[1][1:-1]],'90r':[laura90r[0][1:-1],laura90r[1][1:-1]]}

		bar.finish()
Beispiel #4
0
	def __init__ (self):
		print "Gathering data..."
		bar = progressbar.ProgressBar(maxval=14, widgets=[progressbar.Bar('=', '[', ']'), ' ', progressbar.Percentage()])
		bar.start(); progress = 0
		data0a=m.readRaw("captures/mechanicalArm/ArmLength60cm/Anticlockwise/radius0cmHorizontal.txt")[26:,4:]
		data5a=m.readRaw("captures/mechanicalArm/ArmLength60cm/Anticlockwise/radius5cmHorizontal.txt")[26:,4:]
		data10a=m.readRaw("captures/mechanicalArm/ArmLength60cm/Anticlockwise/radius10cmHorizontal.txt")[26:,4:]
		data15a=m.readRaw("captures/mechanicalArm/ArmLength60cm/Anticlockwise/radius15cmHorizontal.txt")[26:,4:]
		data20a=m.readRaw("captures/mechanicalArm/ArmLength60cm/Anticlockwise/radius20cmHorizontal.txt")[26:,4:]
		data25a=m.readRaw("captures/mechanicalArm/ArmLength60cm/Anticlockwise/radius25cmHorizontal.txt")[26:,4:]
		data0c=m.readRaw("captures/mechanicalArm/ArmLength60cm/Clockwise/radius0cmHorizontal.txt")[26:,4:]
		data5c=m.readRaw("captures/mechanicalArm/ArmLength60cm/Clockwise/radius5cmHorizontal.txt")[26:,4:]
		data10c=m.readRaw("captures/mechanicalArm/ArmLength60cm/Clockwise/radius10cmHorizontal.txt")[26:,4:]
		data15c=m.readRaw("captures/mechanicalArm/ArmLength60cm/Clockwise/radius15cmHorizontal.txt")[26:,4:]
		data20c=m.readRaw("captures/mechanicalArm/ArmLength60cm/Clockwise/radius20cmHorizontal.txt")[26:,4:]
		data25c=m.readRaw("captures/mechanicalArm/ArmLength60cm/Clockwise/radius25cmHorizontal.txt")[26:,4:];
		progress += 1; bar.update(progress)

		(HDsegs0a,LDsegs0a,w0a) = m.getHighAndLowDimSegments(data0a, n_components=9); progress += 1; bar.update(progress)
		(HDsegs5a,LDsegs5a,w5a) = m.getHighAndLowDimSegments(data5a, n_components=9); progress += 1; bar.update(progress)
		(HDsegs10a,LDsegs10a,w10a) = m.getHighAndLowDimSegments(data10a, n_components=9); progress += 1; bar.update(progress)
		(HDsegs15a,LDsegs15a,w15a) = m.getHighAndLowDimSegments(data15a, n_components=9); progress += 1; bar.update(progress)
		(HDsegs20a,LDsegs20a,w20a) = m.getHighAndLowDimSegments(data20a, n_components=9); progress += 1; bar.update(progress)
		(HDsegs25a,LDsegs25a,w25a) = m.getHighAndLowDimSegments(data25a, n_components=9); progress += 1; bar.update(progress)
		(HDsegs0c,LDsegs0c,w0c) = m.getHighAndLowDimSegments(data0c, n_components=9); progress += 1; bar.update(progress)
		(HDsegs5c,LDsegs5c,w5c) = m.getHighAndLowDimSegments(data5c, n_components=9); progress += 1; bar.update(progress)
		(HDsegs10c,LDsegs10c,w10c) = m.getHighAndLowDimSegments(data10c, n_components=9); progress += 1; bar.update(progress)
		(HDsegs15c,LDsegs15c,w15c) = m.getHighAndLowDimSegments(data15c, n_components=9); progress += 1; bar.update(progress)
		(HDsegs20c,LDsegs20c,w20c) = m.getHighAndLowDimSegments(data20c, n_components=9); progress += 1; bar.update(progress)
		(HDsegs25c,LDsegs25c,w25c) = m.getHighAndLowDimSegments(data25c, n_components=9); progress += 1; bar.update(progress)
		
		HDsegs20a=HDsegs20a[:-1]
		HDsegs25a=HDsegs25a[1:]
		HDsegs0c=HDsegs0c[1:-1]
		HDsegs5c=HDsegs5c[1:]
		HDsegs10c=HDsegs10c[:-1]
		HDsegs15c=HDsegs15c[1:-1]
		HDsegs20c=HDsegs20c[1:-1]
		HDsegs25c=HDsegs25c[1:-1]
		LDsegs20a=LDsegs20a[:-1]
		LDsegs25a=LDsegs25a[1:]
		LDsegs0c=LDsegs0c[1:-1]
		LDsegs5c=LDsegs5c[1:]
		LDsegs10c=LDsegs10c[:-1]
		LDsegs15c=LDsegs15c[1:-1]
		LDsegs20c=LDsegs20c[1:-1]
		LDsegs25c=LDsegs25c[1:-1]

		self.data = {'clockwise0cm':data0a,'anticlockwise5cm':data5a, 'anticlockwise10cm':data10a, 'anticlockwise15cm':data15a, 'anticlockwise20cm':data20a, 'anticlockwise25cm':data25a,
					 'clockwise0cm':data0c,'clockwise5cm':data5c, 'clockwise10cm':data10c, 'clockwise15cm':data15c, 'clockwise20cm':data20c, 'clockwise25cm':data25c}
		self.HDsegments = {'anticlockwise0cm':HDsegs0a,'anticlockwise5cm':HDsegs5a, 'anticlockwise10cm':HDsegs10a, 'anticlockwise15cm':HDsegs15a, 'anticlockwise20cm':HDsegs20a, 'anticlockwise25cm':HDsegs25a,
						   'clockwise0cm':HDsegs0c,'clockwise5cm':HDsegs5c, 'clockwise10cm':HDsegs10c, 'clockwise15cm':HDsegs15c, 'clockwise20cm':HDsegs20c, 'clockwise25cm':HDsegs25c}
		self.LDsegments = {'anticlockwise0cm':LDsegs0a,'anticlockwise5cm':LDsegs5a, 'anticlockwise10cm':LDsegs10a, 'anticlockwise15cm':LDsegs15a, 'anticlockwise20cm':LDsegs20a, 'anticlockwise25cm':LDsegs25a,
						   'clockwise0cm':LDsegs0c,'clockwise5cm':LDsegs5c, 'clockwise10cm':LDsegs10c, 'clockwise15cm':LDsegs15c, 'clockwise20cm':LDsegs20c, 'clockwise25cm':LDsegs25c}
		progress += 1; bar.update(progress)
		bar.finish()
Beispiel #5
0
	def computeAccelSegments(self):
		print "Segmenting just accelerometer data..."
		self.accelSegs = {k:[m.getHighAndLowDimSegments(a, n_components=3, smoothingWindow=300) for a in v] for k,v in self.accelData.iteritems()}
		self.HDaccelSegments = {k:[HD for (HD,LD,vs) in v] for k,v in self.accelSegs.iteritems()}
		self.LDaccelSegments = {k:[LD for (HD,LD,vs) in v] for k,v in self.accelSegs.iteritems()}
Beispiel #6
0
	def computeGyroWithMagSegments(self):
		print "Segmenting gyroscope with magnetometer data..."
		self.gyroWithMagSegs = {k:[m.getHighAndLowDimSegments(a, n_components=3, smoothingWindow=300) for a in v] for k,v in self.gyroWithMagData.iteritems()}
		self.HDgyroWithMagSegments = {k:[HD for (HD,LD,vs) in v] for k,v in self.gyroWithMagSegs.iteritems()}
		self.LDgyroWithMagSegments = {k:[LD for (HD,LD,vs) in v] for k,v in self.gyroWithMagSegs.iteritems()}