Last change
on this file since 3106 was 2517, checked in by Malte Marquarding, 13 years ago |
More updates to get a distutils/scons build going
|
File size:
1.3 KB
|
Rev | Line | |
---|
[1415] | 1 | #!/usr/bin/env python
|
---|
| 2 |
|
---|
| 3 | from asap import *
|
---|
| 4 | from numpy import array
|
---|
| 5 |
|
---|
| 6 | # don't print any messages
|
---|
| 7 | rcParams['verbose'] = 0
|
---|
| 8 | # load data unaveraged
|
---|
| 9 |
|
---|
| 10 | scan = scantable("../test/data/tid-t002.rpf", average=False)
|
---|
| 11 | print scan
|
---|
[2517] | 12 |
|
---|
[1415] | 13 | # select only one IF/Pol/Beam
|
---|
[2517] | 14 | scan.set_selection(ifs=0, beams=0, pols=0)
|
---|
[1415] | 15 |
|
---|
| 16 | # plot in GHz
|
---|
| 17 | scan.set_unit("GHz")
|
---|
| 18 |
|
---|
| 19 | # get all spectra into a matrix [ ncycle x nchan ]
|
---|
| 20 | mat = array([ spectrum for spectrum in scan ])
|
---|
| 21 |
|
---|
| 22 | # find the min/max values
|
---|
| 23 | xax = scan.get_abcissa()
|
---|
| 24 | xmin = min(xax[0])
|
---|
| 25 | xmax = max(xax[0])
|
---|
| 26 |
|
---|
| 27 | # a bit more complicate because we want to plot nice time axis labels
|
---|
| 28 | yax = scan.get_time(asdatetime=True)
|
---|
| 29 | ymin = min(xyplotter.date2num(yax))
|
---|
| 30 | ymax = max(xyplotter.date2num(yax))
|
---|
| 31 |
|
---|
| 32 |
|
---|
| 33 | # the date labels are a bit wide, so set the viewport
|
---|
| 34 | xyplotter.axes([0.2,0.1,0.7,0.8])
|
---|
| 35 |
|
---|
| 36 | # plot the waterfall
|
---|
| 37 | xyplotter.imshow(mat,
|
---|
| 38 | aspect='auto', # scale to fill the plot
|
---|
| 39 | origin='lower', # start at the bottom-left
|
---|
| 40 | extent=[xmin,xmax,ymin,ymax], # give the axes coordinates
|
---|
| 41 | interpolation='nearest'
|
---|
| 42 | )
|
---|
| 43 | xyplotter.gca().yaxis_date() # tell the plotter that the yaxis is using dates
|
---|
| 44 |
|
---|
| 45 | # display axis labels
|
---|
| 46 | xyplotter.xlabel(xax[1])
|
---|
| 47 | xyplotter.ylabel("Obs. Time")
|
---|
| 48 |
|
---|
[2517] | 49 | xyplotter.savefig("test.png",orientation="landscape")
|
---|
Note:
See
TracBrowser
for help on using the repository browser.