- Timestamp:
- 07/30/12 17:06:01 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/python/scantable.py
r2599 r2610 2250 2250 s._add_history("smooth", varlist) 2251 2251 2252 action = 'H' 2252 2253 if plot: 2253 2254 from asap.asapplotter import new_asaplot … … 2263 2264 xorg=orgscan._getabcissa(r) 2264 2265 yorg=orgscan._getspectrum(r) 2265 theplot.clear() 2266 theplot.hold() 2267 theplot.set_axes('ylabel',ylab) 2268 theplot.set_axes('xlabel',s._getabcissalabel(r)) 2269 theplot.set_axes('title',s._getsourcename(r)) 2270 theplot.set_line(label='Original',color="#777777") 2271 theplot.plot(xorg,yorg) 2272 theplot.set_line(label='Smoothed',color="red") 2273 theplot.plot(xsm,ysm) 2274 ### Ugly part for legend 2275 for i in [0,1]: 2276 theplot.subplots[0]['lines'].append( 2277 [theplot.subplots[0]['axes'].lines[i]] 2278 ) 2279 theplot.release() 2280 ### Ugly part for legend 2281 theplot.subplots[0]['lines']=[] 2282 res = raw_input("Accept smoothing ([y]/n): ") 2266 if action != "N": #skip plotting if rejecting all 2267 theplot.clear() 2268 theplot.hold() 2269 theplot.set_axes('ylabel',ylab) 2270 theplot.set_axes('xlabel',s._getabcissalabel(r)) 2271 theplot.set_axes('title',s._getsourcename(r)) 2272 theplot.set_line(label='Original',color="#777777") 2273 theplot.plot(xorg,yorg) 2274 theplot.set_line(label='Smoothed',color="red") 2275 theplot.plot(xsm,ysm) 2276 ### Ugly part for legend 2277 for i in [0,1]: 2278 theplot.subplots[0]['lines'].append( 2279 [theplot.subplots[0]['axes'].lines[i]] 2280 ) 2281 theplot.release() 2282 ### Ugly part for legend 2283 theplot.subplots[0]['lines']=[] 2284 res = self._get_verify_action("Accept smoothing?",action) 2285 #print "IF%d, POL%d: got result = %s" %(s.getif(r),s.getpol(r),res) 2286 if r == 0: action = None 2287 #res = raw_input("Accept smoothing ([y]/n): ") 2283 2288 if res.upper() == 'N': 2289 # reject for the current rows 2284 2290 s._setspectrum(yorg, r) 2291 elif res.upper() == 'R': 2292 # reject all the following rows 2293 action = "N" 2294 s._setspectrum(yorg, r) 2295 elif res.upper() == 'A': 2296 # accept all the following rows 2297 break 2285 2298 theplot.quit() 2286 2299 del theplot … … 2948 2961 rows = xrange(workscan.nrow()) 2949 2962 #if len(rows) > 0: workscan._init_blinfo() 2950 2963 2964 action = "H" 2951 2965 for r in rows: 2952 2966 f.x = workscan._getabcissa(r) … … 2960 2974 f.fit() 2961 2975 2962 f.plot(residual=True) 2963 accept_fit = raw_input("Accept fit ( [y]/n ): ") 2976 if action != "Y": # skip plotting when accepting all 2977 f.plot(residual=True) 2978 #accept_fit = raw_input("Accept fit ( [y]/n ): ") 2979 #if accept_fit.upper() == "N": 2980 # #workscan._append_blinfo(None, None, None) 2981 # continue 2982 accept_fit = self._get_verify_action("Accept fit?",action) 2983 if r == 0: action = None 2964 2984 if accept_fit.upper() == "N": 2965 #workscan._append_blinfo(None, None, None)2966 2985 continue 2986 elif accept_fit.upper() == "R": 2987 break 2988 elif accept_fit.upper() == "A": 2989 action = "Y" 2967 2990 2968 2991 blpars = f.get_parameters() … … 3098 3121 rows = xrange(workscan.nrow()) 3099 3122 #if len(rows) > 0: workscan._init_blinfo() 3100 3123 3124 action = "H" 3101 3125 for r in rows: 3102 3126 idx = 2*workscan.getif(r) … … 3113 3137 f.fit() 3114 3138 3115 f.plot(residual=True) 3116 accept_fit = raw_input("Accept fit ( [y]/n ): ") 3139 if action != "Y": # skip plotting when accepting all 3140 f.plot(residual=True) 3141 #accept_fit = raw_input("Accept fit ( [y]/n ): ") 3142 accept_fit = self._get_verify_action("Accept fit?",action) 3143 if r == 0: action = None 3117 3144 if accept_fit.upper() == "N": 3118 3145 #workscan._append_blinfo(None, None, None) 3119 3146 continue 3147 elif accept_fit.upper() == "R": 3148 break 3149 elif accept_fit.upper() == "A": 3150 action = "Y" 3120 3151 3121 3152 blpars = f.get_parameters() … … 3666 3697 self.set_freqframe(rcParams['scantable.freqframe']) 3667 3698 3699 def _get_verify_action( self, msg, action=None ): 3700 valid_act = ['Y', 'N', 'A', 'R'] 3701 if not action or not isinstance(action, str): 3702 action = raw_input("%s [Y/n/a/r] (h for help): " % msg) 3703 if action == '': 3704 return "Y" 3705 elif (action.upper()[0] in valid_act): 3706 return action.upper()[0] 3707 elif (action.upper()[0] in ['H','?']): 3708 print "Available actions of verification [Y|n|a|r]" 3709 print " Y : Yes for current data (default)" 3710 print " N : No for current data" 3711 print " A : Accept all in the following and exit from verification" 3712 print " R : Reject all in the following and exit from verification" 3713 print " H or ?: help (show this message)" 3714 return self._get_verify_action(msg) 3715 else: 3716 return 'Y' 3668 3717 3669 3718 def __getitem__(self, key):
Note:
See TracChangeset
for help on using the changeset viewer.