Changeset 2607 for trunk/python
- Timestamp:
- 07/25/12 15:51:33 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/python/asapplotter.py
r2604 r2607 1612 1612 """ 1613 1613 from asap import scantable 1614 from numpy import array, ma 1614 from numpy import array, ma, cos 1615 1615 if not self._data and not scan: 1616 1616 msg = "No scantable is specified to plot" … … 1649 1649 1650 1650 # Center and spacing 1651 if type(center) == list and len(center) > 1: 1652 center = center[0:2] 1653 else: 1654 asaplog.post() 1651 if center is None: 1652 #asaplog.post() 1655 1653 asaplog.push("Grid center is not specified. Automatically calculated from pointing center.") 1656 asaplog.post("WARN")1654 #asaplog.post("WARN") 1657 1655 dirarr = array(self._data.get_directionval()).transpose() 1658 1656 #center = [dirarr[0].mean(), dirarr[1].mean()] … … 1660 1658 0.5*(dirarr[1].max() + dirarr[1].min())] 1661 1659 del dirarr 1660 elif (type(center) in (list, tuple)) and len(center) > 1: 1661 center = center[0:2] 1662 else: 1663 msg = "Direction of grid center should be a list of float (R.A., Dec.)" 1664 raise ValueError, msg 1662 1665 asaplog.push("Grid center: (%f, %f) " % (center[0],center[1])) 1663 1666 1664 1667 if spacing is None: 1665 asaplog.post()1668 #asaplog.post() 1666 1669 asaplog.push("Grid spacing not specified. Automatically calculated from map coverage") 1667 asaplog.post("WARN")1670 #asaplog.post("WARN") 1668 1671 # automatically get spacing 1669 1672 dirarr = array(self._data.get_directionval()).transpose() … … 1672 1675 wy = 2. * max(abs(dirarr[1].max()-center[1]), 1673 1676 abs(dirarr[1].min()-center[1])) 1674 # slightly expand area to plot the edges 1675 wx *= 1.01 1676 wy *= 1.01 1677 xgrid = wx/self._cols 1678 ygrid = wy/self._rows 1677 ## slightly expand area to plot the edges 1678 #wx *= 1.01 1679 #wy *= 1.01 1680 #xgrid = wx/self._cols 1681 #ygrid = wy/self._rows 1682 xgrid = wx/max(self._cols-1.,1.) 1683 ygrid = wy/max(self._rows-1.,1.) 1679 1684 #print "Pointing range: (x, y) = (%f - %f, %f - %f)" %\ 1680 1685 # (dirarr[0].min(),dirarr[0].max(),dirarr[1].min(),dirarr[1].max()) … … 1689 1694 #elif isinstance(spacing, str): 1690 1695 # # spacing is a quantity 1691 elif isinstance(spacing,list) and len(spacing) > 1:1696 elif (type(spacing) in (list, tuple)) and len(spacing) > 1: 1692 1697 for i in xrange(2): 1693 1698 val = spacing[i] … … 1697 1702 spacing[i] = -val 1698 1703 spacing = spacing[0:2] 1704 # Correction of Dec. effect 1705 spacing[0] /= cos(center[1]) 1699 1706 else: 1700 1707 msg = "Invalid spacing." 1701 1708 raise TypeError(msg) 1702 asaplog.push("Spacing: (%f, %f) " % (spacing[0],spacing[1]))1709 asaplog.push("Spacing: (%f, %f) (projected)" % (spacing[0],spacing[1])) 1703 1710 1704 1711 ntotpl = self._rows * self._cols 1705 1712 minpos = [center[0]-spacing[0]*self._cols/2., 1706 1713 center[1]-spacing[1]*self._rows/2.] 1707 #xbound = [center[0]-spacing[0]*self._cols/2.,1708 # center[0]+spacing[0]*self._cols/2.]1709 #ybound = [center[1]-spacing[1]*self._rows/2.,1710 # center[1]+spacing[1]*self._rows/2.]1711 1714 #print "Plot range: (x, y) = (%f - %f, %f - %f)" %\ 1712 1715 # (minpos[0],minpos[0]+spacing[0]*self._cols, 1713 1716 # minpos[1],minpos[1]+spacing[1]*self._rows) 1714 ## (xbound[0],xbound[1],ybound[0],ybound[1])1715 1717 ifs = self._data.getifnos() 1716 1718 if len(ifs) > 1: … … 1750 1752 nplots=ntotpl,margin=self._margins,ganged=True) 1751 1753 if self.casabar_exists(): 1752 #self._plotter.figmgr.casabar.disable_button()1753 1754 self._plotter.figmgr.casabar.set_pagecounter(1) 1754 1755 self._plotter.figmgr.casabar.enable_button() … … 1758 1759 pos = self._data.get_directionval(irow) 1759 1760 ix = int((pos[0] - minpos[0])/spacing[0]) 1760 #if pos[0] < xbound[0] or pos[0] > xbound[1]:1761 1761 if ix < 0 or ix >= self._cols: 1762 1762 #print "Row %d : Out of X-range (x = %f) ... skipped" % (irow, pos[0]) 1763 1763 continue 1764 #ix = min(int((pos[0] - xbound[0])/spacing[0]),self._cols)1765 1764 iy = int((pos[1]- minpos[1])/spacing[1]) 1766 #if pos[1] < ybound[0] or pos[1] > ybound[1]:1767 1765 if iy < 0 or iy >= self._cols: 1768 1766 #print "Row %d : Out of Y-range (y = %f) ... skipped" % (irow,pos[1]) 1769 1767 continue 1770 #iy = min(int((pos[1]- ybound[0])/spacing[1]),self._rows)1771 1768 ipanel = ix + iy*self._cols 1772 1769 if len(self._plotter.subplots[ipanel]['lines']) > 0:
Note:
See TracChangeset
for help on using the changeset viewer.