コード例 #1
0
def compareToLinear():
	xs = [0, 1, 2, 3, 4, 5]
	ys = [y * 100.0 for y in [1, 3, 5, 7, 9, 11]]
	
	coefs, C = polynomialFit(xs, ys, 2, returnErrors = True)
	print coefs
	print C
	
	print stats.lineOfBestFit(xs, ys, returnErrors = True)
コード例 #2
0
def getSignalCoherenceError(downSampledFrequency, rawData = rawData):
	downSampled = fftDataExtraction.downSample(rawData, rawSps, downSampledFrequency, interpolate = True)#[int(random()*100):]
	#downSampled = downSampled[:int(downSampledFrequency)/2]
	#downSampled = downSampled[:40]
	highSamples = downSampled[::2]
	lowSamples = downSampled[1::2]

	times = map(lambda x: x/downSampledFrequency, range(len(downSampled)))
	highTimes = times[::2]
	lowTimes = times[1::2]
	
	differences = map(lambda x: (x[0]-x[1])**1.0, zip(highSamples, lowSamples))
	
	slope, yint = stats.lineOfBestFit(highTimes, differences)
	#return slope
	#return abs(slope)
	#return 1.0 / slope
	#return max(differences) - min(differences)
	
	#derivSquared = sum([(differences[i+1] - differences[i])**2.0 for i in range(len(differences)-1)])
	#return derivSquared
	
	return stats.variance(differences)
コード例 #3
0
def centerAroundZero(timeData):
	#line of best fit, then subtract that
	xValues = range(len(timeData))
	slope, yint = stats.lineOfBestFit(xValues, timeData)
	result = [y-yint-x*slope for x, y in zip(xValues, timeData)]
	return result