Changeset 990 for trunk/monitor
- Timestamp:
- 04/05/06 15:04:37 (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/monitor/cgi-bin/asapmon.py
r712 r990 135 135 sys.stderr = logsink2 136 136 try: 137 s cans = [asap.scantable(f) for f in files]138 outscans = []137 s = asap.scantable(files) 138 outscans = None 139 139 self.fields['nif'] = range(scans[-1].nif()) 140 140 for i in self.fields['nif']: … … 145 145 # source name selection 146 146 import re 147 for s in scans: 148 srcnames = s.get_sourcename() 149 for i in srcnames: 150 # only add the names once 151 i = not i in self.fields['sourcenames'] and i 147 srcnames = s.get_sourcename() 148 for i in srcnames: 149 # only add the names once 150 i = not i in self.fields['sourcenames'] and i 151 if i: 152 # filter off scans 153 i = not re.search(re.compile("_[R,e,w]$"),i) and i 152 154 if i: 153 # filter off scans 154 i = not re.search(re.compile("_[R,e,w]$"),i) and i 155 if i: 156 self.fields['sourcenames'].append(i) 157 for s in scans: 158 # form quotient 159 if self.form.has_key("quotient"): 160 s = s.auto_quotient() 161 162 # get source by name 163 cs = self.fields['csource'] 164 if len(cs) > 0: 165 if cs in self.fields['sourcenames']: 166 ss = s.get_scan(self.fields['csource']) 167 if isinstance(ss,asap.scantable): 168 s = ss 169 del ss 155 self.fields['sourcenames'].append(i) 156 # form quotient 157 if self.form.has_key("quotient"): 158 s = s.auto_quotient() 159 # get source by name 160 cs = self.fields['csource'] 161 if len(cs) > 0: 162 if cs in self.fields['sourcenames']: 163 ss = s.get_scan(self.fields['csource']) 164 if isinstance(ss,asap.scantable): 165 s = ss 166 del ss 167 else: 168 # get only the last source in the table if not averaging 169 s = s.get_scan(self.fields['sourcenames'][-1]) 170 #self.fields['debug'] = "DEBUG" 171 self.fields['csource'] = s.get_sourcename()[-1] 172 # baseline 173 if self.form.has_key('baseline'): 174 order = self.fields['cpolyorder'] 175 brstr = self.form.getfirst('brangewindow','').strip() 176 # auto baseline or user window 177 if brstr: 178 self.fields['brangewindow'] = brstr 179 brange = self.decodeWindows(brstr) 180 if len(brange): 181 self.fields['brangewindow'] = brstr 182 if self.fields['cunit'] == 1: 183 srest = s._getrestfreqs() 184 if isinstance(srest,tuple) and len(srest) != s.nif(): 185 s.set_restfreqs(restfs,unit="GHz") 186 s.set_unit(self.fields['units'][self.fields['cunit']]) 187 s.set_freqframe(self.form.getfirst("frame","LSRK")) 188 s.set_doppler(self.form.getfirst("doppler","RADIO")) 189 m = s.create_mask(brange) 190 s.poly_baseline(mask=m,order=order) 170 191 else: 171 # get only the last source in the table if not averaging 172 s = s.get_scan(self.fields['sourcenames'][-1]) 173 #self.fields['debug'] = "DEBUG" 174 self.fields['csource'] = s.get_sourcename()[-1] 175 # baseline 176 if self.form.has_key('baseline'): 177 order = self.fields['cpolyorder'] 178 brstr = self.form.getfirst('brangewindow','').strip() 179 # auto baseline or user window 180 if brstr: 181 self.fields['brangewindow'] = brstr 182 brange = self.decodeWindows(brstr) 183 if len(brange): 184 self.fields['brangewindow'] = brstr 185 if self.fields['cunit'] == 1: 186 srest = s._getrestfreqs() 187 if isinstance(srest,tuple) and len(srest) != s.nif(): 188 s.set_restfreqs(restfs,unit="GHz") 189 s.set_unit(self.fields['units'][self.fields['cunit']]) 190 s.set_freqframe(self.form.getfirst("frame","LSRK")) 191 s.set_doppler(self.form.getfirst("doppler","RADIO")) 192 193 m = s.create_mask(brange) 194 s.poly_baseline(mask=m,order=order) 195 else: 196 s.auto_poly_baseline(order=order) 197 outscans.append(s) 198 del scans 192 s.auto_poly_baseline(order=order) 193 outscans = None 199 194 200 195 if self.fields['average']: 201 outscans = asap.average_time(outscans,weight='tsys')196 outscans = s.average_time(weight='tsys') 202 197 else: 203 outscans = outscans[-1] 198 outscans = s 199 del s 204 200 205 201 if self.fields['bin']: 206 202 outscans.bin() 207 208 #duplicated as average_time doesn't remember settings209 if self.fields['cunit'] == 1:210 srest = outscans._getrestfreqs()211 if isinstance(srest,tuple) and len(srest) != outscans.nif():212 outscans.set_restfreqs(restfs,unit="GHz")213 outscans.set_unit(self.fields['units'][self.fields['cunit']])214 outscans.set_freqframe(self.form.getfirst("frame","LSRK"))215 outscans.set_doppler(self.form.getfirst("doppler","RADIO"))216 203 217 204 self.fields['summary'] = str(outscans) … … 225 212 rcp['figure.subplot.hspace'] = 0.3 226 213 del asap.plotter 214 # plotter without GUI 227 215 asap.plotter = asap.asapplotter(False) 228 216 if s.nif() > 1: … … 238 226 if outscans.npol() > 2: 239 227 pols += " Q U V" 240 asap.plotter.set_cursor(pol=pols) 228 sel = asap.selector() 229 sel.set_polarisations(pols) 230 asap.plotter.set_selection(sel) 241 231 x0,x1 = self.decodeWindow(self.fields['plotwindow']) 242 232 asap.plotter.set_range(x0,x1)
Note:
See TracChangeset
for help on using the changeset viewer.