def createChangingTimeDomainData(baseFilename, low = 0, high = 10): dat0 = fftDataExtraction.getDownSampledData(baseFilename % low) dat10 = fftDataExtraction.getDownSampledData(baseFilename % high) #alternate 1 second of each correctOutput = [] allData = [] for i in range(0, len(dat0), constants.samplesPerSecond): allData += centerAroundZero(dat0[i:i+constants.samplesPerSecond]) correctOutput += [0] * constants.samplesPerSecond allData += centerAroundZero(dat10[i:i+constants.samplesPerSecond]) correctOutput += [1] * constants.samplesPerSecond return allData, correctOutput
import fftDataExtraction import constants from matplotlib import pylab if __name__ == "__main__": filename = "Data/Mark/32kSPS_160kS_ExtensorRadialis_0%.xls" data = fftDataExtraction.getDownSampledData(filename) sps = constants.samplesPerSecond windows = fftDataExtraction.getFFTWindows(data[int(0.8*sps):]) alltimes = [float(x) / sps for x in range(len(data))] times = range(len(windows[0])) postData = fftDataExtraction.subtractPolynomialFit(windows[0], 5) #pylab.plot(alltimes, data) pylab.plot(times, windows[0]) pylab.plot(times, postData) pylab.grid(True) pylab.show()