Changeset 1910 for trunk/python
- Timestamp:
- 08/28/10 17:50:39 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/python/asapplotter.py
r1897 r1910 52 52 self._panellayout = self.set_panellayout(refresh=False) 53 53 self._offset = None 54 ###-S 55 #self._rowcount = 0 56 ###-E 54 57 55 58 def _translate(self, instr): 56 keys = "s b i p t ".split()59 keys = "s b i p t r".split() 57 60 if isinstance(instr, str): 58 61 for key in keys: … … 94 97 are consistent e.g. all 'channel' or all 'velocity' etc. 95 98 """ 99 ###-S 100 #self._rowcount = 0 101 ###-E 96 102 if self._plotter.is_dead: 97 103 if hasattr(self._plotter.figmgr,'casabar'): … … 337 343 not self.set_stacking(stacking): 338 344 raise TypeError(msg) 345 if self._panelling == 'r': 346 self._stacking = '_r' 339 347 if refresh and self._data: self.plot(self._data) 340 348 return … … 352 360 self._panelling = md 353 361 self._title = None 362 if self._panelling == 'r': 363 self._stacking = '_r' 354 364 return True 355 365 return False … … 816 826 savesel = scan.get_selection() 817 827 sel = savesel + self._selection 818 d0 = {'s': 'SCANNO', 'b': 'BEAMNO', 'i':'IFNO', 819 'p': 'POLNO', 'c': 'CYCLENO', 't' : 'TIME' } 820 order = [d0[self._panelling],d0[self._stacking]] 821 sel.set_order(order) 828 order = self._get_sortstring([self._panelling,self._stacking]) 829 if order: 830 sel.set_order(order) 822 831 scan.set_selection(sel) 823 832 d = {'b': scan.getbeam, 's': scan.getscan, 824 'i': scan.getif, 'p': scan.getpol, 't': scan._gettime } 833 'i': scan.getif, 'p': scan.getpol, 't': scan._gettime, 834 'r': int, '_r': int} 825 835 826 836 polmodes = dict(zip(self._selection.get_pols(), … … 831 841 if isinstance(n0, int): n = n0 832 842 else: n = len(n0) 843 ###-S 844 #nptot = n 845 ###-E 833 846 if isinstance(nstack0, int): nstack = nstack0 834 847 else: nstack = len(nstack0) 835 848 maxpanel, maxstack = 16,16 849 ###-S 836 850 if n > maxpanel or nstack > maxstack: 851 #if nstack > maxstack: 852 ###-E 853 ###-S 837 854 maxn = 0 838 855 if nstack > maxstack: maxn = maxstack … … 840 857 msg ="Scan to be plotted contains more than %d selections.\n" \ 841 858 "Selecting first %d selections..." % (maxn, maxn) 859 #msg ="Scan to be overlayed contains more than %d selections.\n" \ 860 # "Selecting first %d selections..." % (maxstack, maxstack) 861 ###-E 842 862 asaplog.push(msg) 843 863 asaplog.post('WARN') 864 ###-S 844 865 n = min(n,maxpanel) 866 ###-E 845 867 nstack = min(nstack,maxstack) 868 ###-S 869 #n = min(n,maxpanel) 870 ###-E 871 846 872 if n > 1: 847 873 ganged = rcParams['plotter.ganged'] … … 859 885 # self._plotter.set_panels() 860 886 self._plotter.set_panels(layout=self._panellayout) 861 r=0 887 ###-S 888 r = 0 889 #r = self._rowcount 890 ###-E 862 891 nr = scan.nrow() 863 892 a0,b0 = -1,-1 … … 958 987 break 959 988 r+=1 # next row 989 ###-S 990 #self._rowcount = r+1 991 #if self._rowcount > 0: enable prev button 992 #if self._rowcount >= nr: disable next button 993 ###-E 960 994 #reset the selector to the scantable's original 961 995 scan.set_selection(savesel) … … 966 1000 for o in self._plotter.figure.findobj(Text): 967 1001 o.set_fontproperties(self._fp) 1002 1003 def _get_sortstring(self, lorders): 1004 d0 = {'s': 'SCANNO', 'b': 'BEAMNO', 'i':'IFNO', 1005 'p': 'POLNO', 'c': 'CYCLENO', 't' : 'TIME', 'r':None, '_r':None } 1006 if not (type(lorders) == list) or not (type(lorders) == tuple): 1007 return None 1008 if len(lorders) > 0: 1009 lsorts = [] 1010 for order in lorders: 1011 ssort = d0[order] 1012 if ssort: 1013 lsorts.append(ssort) 1014 return lsorts 1015 return None 968 1016 969 1017 def set_selection(self, selection=None, refresh=True, **kw): … … 990 1038 raise TypeError("'selection' is not of type selector") 991 1039 992 d0 = {'s': 'SCANNO', 'b': 'BEAMNO', 'i':'IFNO', 993 'p': 'POLNO', 'c': 'CYCLENO', 't' : 'TIME' } 994 order = [d0[self._panelling],d0[self._stacking]] 995 self._selection.set_order(order) 1040 order = self._get_sortstring([self._panelling,self._stacking]) 1041 if order: 1042 self._selection.set_order(order) 996 1043 if refresh and self._data: self.plot(self._data) 997 1044 998 1045 def _get_selected_n(self, scan): 999 1046 d1 = {'b': scan.getbeamnos, 's': scan.getscannos, 1000 'i': scan.getifnos, 'p': scan.getpolnos, 't': scan.ncycle } 1047 'i': scan.getifnos, 'p': scan.getpolnos, 't': scan.ncycle, 1048 'r': scan.nrow, '_r': False} 1001 1049 d2 = { 'b': self._selection.get_beams(), 1002 1050 's': self._selection.get_scans(), 1003 1051 'i': self._selection.get_ifs(), 1004 1052 'p': self._selection.get_pols(), 1005 't': self._selection.get_cycles() } 1053 't': self._selection.get_cycles(), 1054 'r': False, '_r': 1} 1006 1055 n = d2[self._panelling] or d1[self._panelling]() 1007 1056 nstack = d2[self._stacking] or d1[self._stacking]() … … 1022 1071 'i': "IF"+str(scan.getif(row)), 1023 1072 'p': poleval, 1024 't': str(scan.get_time(row)) } 1073 't': str(scan.get_time(row)), 1074 'r': "row "+str(row), 1075 '_r': str(scan.get_time(row))+",\nIF"+str(scan.getif(row))+", "+poleval+", Beam"+str(scan.getbeam(row)) } 1025 1076 return userlabel or d[mode] 1026 1077
Note:
See TracChangeset
for help on using the changeset viewer.