Mercurial > ~darius > hgwebdir.cgi > pyinst
view plotss.py @ 37:3d2306e39700
Move DataFile class to new file for ease of reuse.
author | Daniel O'Connor <darius@dons.net.au> |
---|---|
date | Wed, 28 Sep 2011 12:29:19 +0930 |
parents | ff63d71e1383 |
children | c6089f1ecc75 |
line wrap: on
line source
#!/usr/bin/env python import datafile import exceptions import numpy import pylab import sys def doplot(fname): dfile = DataFile(fname) xdata = dfile.freqs / 1e6 ydata = dfile.powers pylab.title("Tag \'" + dfile['TAG'] + "\' at " + dfile['TIMESTAMP']) pylab.xlabel("Frequency (MHz)") pylab.ylabel("Level (dBm)") annstr = "FStart\t%.2f MHz\nFStop\t%.2f MHz\nPoints\t%d" % ( float(dfile['FSTART']) / 1e6, float(dfile['FSTOP']) / 1e6, len(xdata)) pylab.annotate(annstr, xy=(5, -40), xycoords='axes points') annstr = "Video BW\t%.1f kHz\nResol. BW\t%.1f kHz\nAttenuation\t%.1f dB\nRef Level\t%.1f dBm" % ( float(dfile['VIDBW']) / 1e3, float(dfile['RESBW']) / 1e3, float(dfile['ATTEN']), float(dfile['REFLEV'])) pylab.annotate(annstr, xy=(-140, -55), xycoords='axes points') pylab.grid(True) pylab.plot(xdata, ydata, linestyle='solid', marker='.') pylab.show() if __name__ == "__main__": if len(sys.argv) < 2: print "Need at least one file to plot" sys.exit(1) for fn in sys.argv[1:]: doplot(fn)