#!/usr/bin/env python from matplotlib import matlab data = ((3, 1000), (10, 3), (100, 30), (500, 800), (50, 1)) matlab.xlabel("FOO") matlab.ylabel("FOO") matlab.title("Testing") matlab.gca().set_yscale('log') dim = len(data[0]) w = 0.75 dimw = w / dim x = matlab.arange(len(data)) for i in range(len(data[0])): y = [d[i] for d in data] b = matlab.bar(x + i * dimw, y, dimw, bottom=0.001) matlab.gca().set_xticks(x + w / 2) matlab.gca().set_ylim((0.001, 1000)) matlab.show()
#!/usr/bin/env python from matplotlib import matlab data = ((3,1000), (10,3), (100,30), (500, 800), (50,1)) matlab.xlabel("FOO") matlab.ylabel("FOO") matlab.title("Testing") matlab.gca().set_yscale('log') dim = len(data[0]) w = 0.75 dimw = w / dim x = matlab.arange(len(data)) for i in range(len(data[0])) : y = [d[i] for d in data] b = matlab.bar(x + i * dimw, y, dimw, bottom=0.001) matlab.gca().set_xticks(x + w / 2) matlab.gca().set_ylim( (0.001,1000)) matlab.show()
"""Load Nicolet BMSI data.""" if tmin < 0: tmin = 0 fh = file(filename, 'rb') indmin = Fs * tmin numsamples = os.path.getsize(filename) / (channels * 2) indmax = min(numsamples, Fs * tmax) byte0 = int(indmin * channels * 2) numbytes = int((indmax - indmin) * channels * 2) fh.seek(byte0) data = fromstring(fh.read(numbytes), Int16).astype(Float) data.shape = -1, channels t = (1 / Fs) * arange(indmin, indmax) return t, data t, data = read_nicolet(0, 10) x = data[:, 5] Pxx, freqs, t = specgram(x, NFFT=512, Fs=Fs, noverlap=412) T, F = meshgrid(t, freqs) pcolor(T, F, 10 * log10(Pxx), shading='flat') set(gca(), 'ylim', [0, 100]) #print Pxx.shape, freqs.shape, t.shape show()
indmax = min(numsamples, Fs*tmax) byte0 = int(indmin*channels*2) numbytes = int( (indmax-indmin)*channels*2 ) fh.seek(byte0) data = fromstring(fh.read(numbytes), Int16).astype(Float) data.shape = -1, channels t = (1/Fs)*arange(indmin, indmax) return t, data t, data = read_nicolet(0,10) x = data[:,5] Pxx, freqs, t = specgram(x, NFFT=512, Fs=Fs, noverlap=412) T, F = meshgrid(t,freqs) pcolor(T, F, 10*log10(Pxx), shading='flat') set(gca(), 'ylim', [0,100]) #print Pxx.shape, freqs.shape, t.shape show()