Changeset 2988 for trunk/python
- Timestamp:
- 09/10/14 19:19:16 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/python/asapplotter.py
r2977 r2988 1317 1317 return start,end 1318 1318 1319 def plotazel(self, scan=None, outfile=None): 1320 """ 1321 plot azimuth and elevation versus time of a scantable 1322 """ 1323 self._plotmode = "azel" 1324 visible = rcParams['plotter.gui'] 1319 def _get_date_axis_setup(self, dates): 1320 """ 1321 Returns proper axis title and formatters for a list of dates 1322 Input 1323 dates : a list of datetime objects returned by, 1324 e.g. scantable.get_time(asdatetime=True) 1325 Output 1326 a set of 1327 * date axis title string 1328 * formatter of date axis 1329 * major axis locator 1330 * minor axis locator 1331 """ 1325 1332 from matplotlib import pylab as PL 1326 1333 from matplotlib.dates import DateFormatter 1327 from pytz import timezone1328 1334 from matplotlib.dates import HourLocator, MinuteLocator,SecondLocator, DayLocator 1329 from matplotlib.ticker import MultipleLocator1330 from numpy import array, pi, ma1331 if self._plotter and (PL.gcf() == self._plotter.figure):1332 # the current figure is ASAP plotter. Use mpl plotter1333 figids = PL.get_fignums()1334 PL.figure(max(figids[-1],1))1335 1336 if not visible or not self._visible:1337 PL.ioff()1338 from matplotlib.backends.backend_agg import FigureCanvasAgg1339 PL.gcf().canvas.switch_backends(FigureCanvasAgg)1340 self._data = scan1341 dates = self._data.get_time(asdatetime=True)1342 # for flag handling1343 mask = [ self._data._is_all_chan_flagged(i) for i in range(self._data.nrow())]1344 1335 t = PL.date2num(dates) 1345 tz = timezone('UTC')1346 PL.cla()1347 PL.ioff()1348 PL.clf()1349 # Adjust subplot margins1350 if not self._margins or len(self._margins) != 6:1351 self.set_margin(refresh=False)1352 lef, bot, rig, top, wsp, hsp = self._margins1353 PL.gcf().subplots_adjust(left=lef,bottom=bot,right=rig,top=top,1354 wspace=wsp,hspace=hsp)1355 1356 1336 tdel = max(t) - min(t) # interval in day 1357 ax = PL.subplot(2,1,1)1358 el = ma.masked_array(array(self._data.get_elevation())*180./pi, mask)1359 PL.ylabel('El [deg.]')1360 1337 dstr = dates[0].strftime('%Y/%m/%d') 1361 1338 if tdel > 1.0: # >1day … … 1381 1358 majloc = MinuteLocator() 1382 1359 minloc = SecondLocator(30) 1383 1360 return (dstr, timefmt, majloc, minloc) 1361 1362 def plotazel(self, scan=None, outfile=None): 1363 """ 1364 plot azimuth and elevation versus time of a scantable 1365 """ 1366 self._plotmode = "azel" 1367 visible = rcParams['plotter.gui'] 1368 from matplotlib import pylab as PL 1369 from pytz import timezone 1370 from matplotlib.ticker import MultipleLocator 1371 from numpy import array, pi, ma 1372 if self._plotter and (PL.gcf() == self._plotter.figure): 1373 # the current figure is ASAP plotter. Use mpl plotter 1374 figids = PL.get_fignums() 1375 PL.figure(max(figids[-1],1)) 1376 1377 if not visible or not self._visible: 1378 PL.ioff() 1379 from matplotlib.backends.backend_agg import FigureCanvasAgg 1380 PL.gcf().canvas.switch_backends(FigureCanvasAgg) 1381 self._data = scan 1382 dates = self._data.get_time(asdatetime=True) 1383 # for flag handling 1384 mask = [ self._data._is_all_chan_flagged(i) for i in range(self._data.nrow())] 1385 t = PL.date2num(dates) 1386 tz = timezone('UTC') 1387 PL.cla() 1388 PL.ioff() 1389 PL.clf() 1390 # Adjust subplot margins 1391 if not self._margins or len(self._margins) != 6: 1392 self.set_margin(refresh=False) 1393 lef, bot, rig, top, wsp, hsp = self._margins 1394 PL.gcf().subplots_adjust(left=lef,bottom=bot,right=rig,top=top, 1395 wspace=wsp,hspace=hsp) 1396 1397 tdel = max(t) - min(t) # interval in day 1398 ax = PL.subplot(2,1,1) 1399 el = ma.masked_array(array(self._data.get_elevation())*180./pi, mask) 1400 PL.ylabel('El [deg.]') 1401 (dstr, timefmt, majloc, minloc) = self._get_date_axis_setup(dates) 1402 1384 1403 PL.title(dstr) 1385 1404 if tdel == 0.0:
Note:
See TracChangeset
for help on using the changeset viewer.