Changeset 1389 for branches/alma/python/asapplotter.py
- Timestamp:
- 07/27/07 02:08:12 (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/alma/python/asapplotter.py
r1358 r1389 741 741 return userlabel or d[mode] 742 742 743 def plotazel(self, scan=None): 744 """ 745 plot azimuth and elevation versus time of a scantable 746 """ 747 import pylab as PL 748 from matplotlib.dates import DateFormatter, timezone, HourLocator, MinuteLocator, DayLocator 749 from matplotlib.ticker import MultipleLocator 750 from matplotlib.numerix import array, pi 751 self._data = scan 752 dates = self._data.get_time() 753 t = PL.date2num(dates) 754 tz = timezone('UTC') 755 PL.cla() 756 PL.ioff() 757 PL.clf() 758 tdel = max(t) - min(t) 759 ax = PL.subplot(2,1,1) 760 el = array(self._data.get_elevation())*180./pi 761 PL.ylabel('El [deg.]') 762 dstr = dates[0].strftime('%Y/%m/%d') 763 if tdel > 1.0: 764 dstr2 = dates[len(dates)-1].strftime('%Y/%m/%d') 765 dstr = dstr + " - " + dstr2 766 majloc = DayLocator() 767 minloc = HourLocator(range(0,23,12)) 768 timefmt = DateFormatter("%b%d") 769 else: 770 timefmt = DateFormatter('%H') 771 majloc = HourLocator() 772 minloc = MinuteLocator(20) 773 PL.title(dstr) 774 PL.plot_date(t,el,'b,', tz=tz) 775 #ax.grid(True) 776 ax.yaxis.grid(True) 777 yloc = MultipleLocator(30) 778 ax.set_ylim(0,90) 779 ax.xaxis.set_major_formatter(timefmt) 780 ax.xaxis.set_major_locator(majloc) 781 ax.xaxis.set_minor_locator(minloc) 782 ax.yaxis.set_major_locator(yloc) 783 if tdel > 1.0: 784 labels = ax.get_xticklabels() 785 # PL.setp(labels, fontsize=10, rotation=45) 786 PL.setp(labels, fontsize=10) 787 # Az plot 788 az = array(self._data.get_azimuth())*180./pi 789 if min(az) < 0: 790 for irow in range(len(az)): 791 if az[irow] < 0: az[irow] += 360.0 792 793 ax = PL.subplot(2,1,2) 794 PL.xlabel('Time (UT)') 795 PL.ylabel('Az [deg.]') 796 PL.plot_date(t,az,'b,', tz=tz) 797 ax.set_ylim(0,360) 798 #ax.grid(True) 799 ax.yaxis.grid(True) 800 #hfmt = DateFormatter('%H') 801 #hloc = HourLocator() 802 yloc = MultipleLocator(60) 803 ax.xaxis.set_major_formatter(timefmt) 804 ax.xaxis.set_major_locator(majloc) 805 ax.xaxis.set_minor_locator(minloc) 806 ax.yaxis.set_major_locator(yloc) 807 if tdel > 1.0: 808 labels = ax.get_xticklabels() 809 PL.setp(labels, fontsize=10) 810 PL.ion() 811 PL.draw() 812 813 def plotpointing(self, scan=None): 814 """ 815 plot telescope pointings 816 """ 817 import pylab as PL 818 from matplotlib.dates import DateFormatter, timezone 819 from matplotlib.ticker import MultipleLocator 820 from matplotlib.numerix import array, pi, zeros 821 self._data = scan 822 dir = array(self._data.get_directionval()).transpose() 823 ra = dir[0]*180./pi 824 dec = dir[1]*180./pi 825 PL.cla() 826 PL.ioff() 827 PL.clf() 828 ax = PL.axes([0.1,0.1,0.8,0.8]) 829 ax = PL.axes([0.1,0.1,0.8,0.8]) 830 ax.set_aspect('equal') 831 PL.plot(ra,dec, 'b,') 832 PL.xlabel('RA [deg.]') 833 PL.ylabel('Declination [deg.]') 834 PL.title('Telescope pointings') 835 [xmin,xmax,ymin,ymax] = PL.axis() 836 PL.axis([xmax,xmin,ymin,ymax]) 837 PL.ion() 838 PL.draw() 839
Note: See TracChangeset
for help on using the changeset viewer.