Changeset 1295
- Timestamp:
- 11/06/06 22:22:03 (18 years ago)
- Location:
- trunk
- Files:
-
- 18 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/Makefile
r1269 r1295 1 PREFIX := / usr2 PYDIR := $(PREFIX)/lib/python2. 3/site-packages1 PREFIX := /Library/Frameworks/Python.framework/Versions/2.4 2 PYDIR := $(PREFIX)/lib/python2.4/site-packages 3 3 4 4 ifndef ASAPROOT -
trunk/doc/CHANGELOG
r1259 r1295 1 1 Changelog 2 2 ========= 3 Release Version 2.1 [2006-09-11] 3 4 Minor Release 2.1.1 [] 5 6 * fix for Ticket #88 - numpy masks 7 * better TAB completion for ipython (handles quotes, don't list private members) 8 * Fix for Ticket #81 = scanatble.stats output as list 9 * ticket #64 - speed up of auto_poly_baseline 10 * fix for ticket #89 - export of IF sub-selections 11 12 Release Version 2.1.0 [2006-09-11] 4 13 5 14 * Processing of Multibeam MX data -
trunk/monitor/cgi-bin/asapmon.py
r1083 r1295 10 10 abspath= "/var/www/asapmon/" 11 11 cgiloc = "/cgi-bin/asapmon/" 12 tmppath = abspath+"tmp/"12 tmppath = os.path.join(abspath,"tmp/") 13 13 htmlloc = "/asapmon/" 14 14 tmploc = "/asapmon/tmp/" … … 25 25 logsink = WritableObject() 26 26 logsink2 = WritableObject() 27 sys.stdout = logsink27 sys.stdout = logsink 28 28 sys.stderr = logsink2 29 29 import asap … … 53 53 out = [] 54 54 for i in fi: 55 out.append( p+"/"+fl.files[i])55 out.append(os.path.join(p,fl.files[i])) 56 56 return out 57 57 58 58 def decodeWindow(self,window): 59 59 if not len(window.strip()): return None,None 60 x = window.split(", ")61 return [float(x[0].strip()), float(x[1].strip())]62 63 def decodeWindows(self, window):60 x = window.split(", ") 61 return [float(x[0].strip()), float(x[1].strip())] 62 63 def decodeWindows(self, window): 64 64 import re 65 65 p = re.compile("(\\[*\d+\\.*\d*,\d+\\.*\d*\\]*)") 66 66 r = re.compile("[\\[\\]]") 67 return [self.decodeWindow(re.sub(r, '',s)) for s in re.findall(p,window)]67 return [self.decodeWindow(re.sub(r, '', s)) for s in re.findall(p, window)] 68 68 69 69 def setDefaultFields(self): … … 80 80 self.fields['imagename'] = "" 81 81 self.fields['cunit'] = 0 82 self.fields['units'] = ["channel", "km/s","GHz"]82 self.fields['units'] = ["channel", "km/s", "GHz"] 83 83 self.fields['baseline'] = 0 84 84 self.fields['cpolyorder'] = 0 … … 87 87 self.fields['doppler'] = "RADIO" 88 88 self.fields['frame'] = "LSRK" 89 self.fields['restn'] = [11, 1]89 self.fields['restn'] = [11, 1] 90 90 self.fields['stokes'] = 0 91 91 self.fields['summary'] = "" … … 98 98 99 99 def getFormFields(self): 100 self.fields['cunit'] = int(self.form.getfirst("unit", 0))101 self.fields['frame'] = self.form.getfirst("frame", "TOPO")102 self.fields['doppler'] = self.form.getfirst("doppler", "RADIO")100 self.fields['cunit'] = int(self.form.getfirst("unit", 0)) 101 self.fields['frame'] = self.form.getfirst("frame", "TOPO") 102 self.fields['doppler'] = self.form.getfirst("doppler", "RADIO") 103 103 self.fields['restn'] = [] 104 104 105 self.fields['plotwindow'] = self.form.getfirst("plotwindow", "")105 self.fields['plotwindow'] = self.form.getfirst("plotwindow", "") 106 106 self.fields['baseline'] = int(self.form.has_key("baseline")) 107 self.fields['cpolyorder'] = int(self.form.getfirst("polyorder", 0))107 self.fields['cpolyorder'] = int(self.form.getfirst("polyorder", 0)) 108 108 self.fields['quotient'] = int(self.form.has_key("quotient")) 109 self.fields['doppler'] = self.form.getfirst("doppler", "RADIO")110 self.fields['frame'] = self.form.getfirst("frame", "LSRK")111 self.fields['cdir'] = int(self.form.getfirst("dlist", None))109 self.fields['doppler'] = self.form.getfirst("doppler", "RADIO") 110 self.fields['frame'] = self.form.getfirst("frame", "LSRK") 111 self.fields['cdir'] = int(self.form.getfirst("dlist", None)) 112 112 self.fields['cfile'] = [int(k) for k in self.form.getlist("list")] 113 113 self.fields['average'] = int(self.form.has_key("average")) … … 115 115 self.fields['bin'] = int(self.form.has_key("bin")) 116 116 self.fields['debug'] = ""#self.fields['restn'] 117 self.fields['csource'] = self.form.getfirst("csource", "")117 self.fields['csource'] = self.form.getfirst("csource", "") 118 118 119 119 def getRest(self): … … 140 140 for i in self.fields['nif']: 141 141 name = "rest%d" % i 142 self.fields['restn'].append(int(self.form.getfirst(name, 0)))142 self.fields['restn'].append(int(self.form.getfirst(name, 0))) 143 143 restfs = self.getRest() 144 144 … … 151 151 if i: 152 152 # filter off scans 153 i = not re.search(re.compile("_[R, e,w]$"),i) and i153 i = not re.search(re.compile("_[R, e, w]$"), i) and i 154 154 if i: 155 155 self.fields['sourcenames'].append(i) … … 162 162 if cs in self.fields['sourcenames']: 163 163 ss = s.get_scan(self.fields['csource']) 164 if isinstance(ss, asap.scantable):164 if isinstance(ss, asap.scantable): 165 165 s = ss 166 166 del ss … … 172 172 if self.fields['cunit'] == 1: 173 173 srest = s._getrestfreqs() 174 if isinstance(srest, tuple) and len(srest) != s.nif():175 s.set_restfreqs(restfs, unit="GHz")174 if isinstance(srest, tuple) and len(srest) != s.nif(): 175 s.set_restfreqs(restfs, unit="GHz") 176 176 s.set_unit(self.fields['units'][self.fields['cunit']]) 177 s.set_freqframe(self.form.getfirst("frame", "LSRK"))178 s.set_doppler(self.form.getfirst("doppler", "RADIO"))177 s.set_freqframe(self.form.getfirst("frame", "LSRK")) 178 s.set_doppler(self.form.getfirst("doppler", "RADIO")) 179 179 180 180 # baseline … … 189 189 self.fields['brangewindow'] = brstr 190 190 m = s.create_mask(brange) 191 s.poly_baseline(mask=m, order=order)191 s.poly_baseline(mask=m, order=order) 192 192 else: 193 193 s.auto_poly_baseline(order=order) … … 217 217 asap.plotter = asap.asapplotter(False) 218 218 if outscans.nif() > 1: 219 asap.plotter.set_mode("p", "i")219 asap.plotter.set_mode("p", "i") 220 220 else: 221 221 if outscans.npol() > 2: 222 asap.plotter.set_mode("t", "p")222 asap.plotter.set_mode("t", "p") 223 223 else: 224 asap.plotter.set_mode("p", "t")224 asap.plotter.set_mode("p", "t") 225 225 asap.plotter.plot(outscans) 226 226 if self.fields['stokes']: … … 231 231 sel.set_polarisations(pols) 232 232 asap.plotter.set_selection(sel) 233 x0, x1 = self.decodeWindow(self.fields['plotwindow'])234 asap.plotter.set_range(x0, x1)233 x0, x1 = self.decodeWindow(self.fields['plotwindow']) 234 asap.plotter.set_range(x0, x1) 235 235 imname = tmppath+"plot.png" 236 asap.plotter.save(imname, dpi=96)236 asap.plotter.save(imname, dpi=96) 237 237 self.fields['imagename'] = tmploc+"plot.png" 238 except RuntimeError, e:238 except RuntimeError, e: 239 239 self.fields['debug'] = e 240 240 return -
trunk/monitor/cgi-bin/filelist.py
r739 r1295 1 1 #!/usr/bin/python 2 2 import os 3 import sre 3 4 from obsconfig import observatory 4 5 5 6 class FileList: 6 7 7 def __init__(self, loc=None ):8 def __init__(self, loc=None, projectcode=None): 8 9 self.message ="""Content-Type: text/xml 9 10 10 11 <?xml version="1.0" encoding="ISO-8859-1"?>""" 11 12 12 self.error = None 13 13 if loc is None: … … 21 21 loc = observatory['rpfpath'][loc] 22 22 if os.path.exists(loc) and os.path.isdir(loc): 23 self.files = filter(lambda x: x.lower().endswith("rpf"), os.listdir(loc)) 23 rx = sre.compile("\d{4}-\d{2}-d{2}_\d{4}-M\d{3}.rpf.*") 24 self.files = [ f for f in os.listdir(loc) if sre.match(rx, f) ] 25 if projectcode is not None: 26 self.files = [ f for f in self.files if sre.match(projectcode, 27 f) ] 24 28 if len(self.files) == 0: 25 29 self.error = "No rpfits files found" … … 42 46 import cgi 43 47 form = cgi.FieldStorage() 48 pfilter = None 49 if form.has_key('project'): 50 pfilter = form.getfirst("project", None) 44 51 if form.has_key('path'): 45 52 pathindex = form.getfirst("path",0) 46 print FileList(pathindex )53 print FileList(pathindex, pfilter) 47 54 else: 48 55 print FileList() -
trunk/python/__init__.py
r1280 r1295 253 253 rcParams.update(rcParamsDefault) 254 254 255 def _n_bools(n, val): 256 return [ val for i in xrange(n) ] 255 257 256 258 def _is_sequence_or_number(param, ptype=int): … … 298 300 'data/Sgr_86p262_best_SPC.sdfits'] 299 301 """ 300 import os301 302 if not os.path.isdir(path): 302 303 return None 303 valid = "rpf sdf sdfits mbf asap".split()304 valid = "rpf rpf.1 rpf.2 sdf sdfits mbf asap".split() 304 305 if not suffix in valid: 305 306 return None … … 325 326 return 326 327 327 try: 328 import numpy.core as NUM 329 except ImportError: 330 try: 331 import numarray as NUM 332 except ImportError: 333 raise ImportError("You need to have numpy or numarray installed") 328 def mask_and(a, b): 329 assert(len(a)==len(b)) 330 return [ a[i] & b[i] for i in xrange(len(a)) ] 331 332 def mask_or(a, b): 333 assert(len(a)==len(b)) 334 return [ a[i] | b[i] for i in xrange(len(a)) ] 335 336 def mask_not(a): 337 return [ not i for i in a ] 334 338 335 339 from asapfitter import fitter … … 342 346 from linecatalog import linecatalog 343 347 344 mask_and = NUM.logical_and345 mask_or = NUM.logical_or346 mask_not = NUM.logical_not347 348 348 if rcParams['useplotter']: 349 from asapplotter import asapplotter 350 gui = os.environ.has_key('DISPLAY') and rcParams['plotter.gui'] 351 if gui: 352 import pylab as xyplotter 353 plotter = asapplotter(gui) 354 del gui 349 try: 350 from asapplotter import asapplotter 351 gui = os.environ.has_key('DISPLAY') and rcParams['plotter.gui'] 352 if gui: 353 import pylab as xyplotter 354 plotter = asapplotter(gui) 355 del gui 356 except ImportError: 357 print "Matplotlib not installed. No plotting available" 355 358 356 359 __date__ = '$Date$'.split()[1] … … 362 365 def version(): print "ASAP %s(%s)"% (__version__, __date__) 363 366 def list_scans(t = scantable): 364 import sys,types367 import types 365 368 globs = sys.modules['__main__'].__dict__.iteritems() 366 369 print "The user created scantables are:" -
trunk/python/asapfitter.py
r1273 r1295 2 2 from asap import rcParams 3 3 from asap import print_log 4 from asap import NUM4 from asap import _n_bools 5 5 6 6 class fitter: … … 42 42 self.y = ydat 43 43 if mask == None: 44 self.mask = NUM.ones(len(xdat))44 self.mask = _n_bools(len(xdat), True) 45 45 else: 46 46 self.mask = mask … … 65 65 self.mask = None 66 66 if mask is None: 67 self.mask = NUM.ones(self.data.nchan())67 self.mask = _n_bools(self.data.nchan(), True) 68 68 else: 69 69 self.mask = mask … … 215 215 if self.fitfunc == "gauss" and component is not None: 216 216 if not self.fitted and sum(self.fitter.getparameters()) == 0: 217 pars = list(NUM.zeros(len(self.components)*3))218 fxd = list(NUM.zeros(len(pars)))217 pars = _n_bools(len(self.components)*3, False) 218 fxd = _n_bools(len(pars), False) 219 219 else: 220 220 pars = list(self.fitter.getparameters()) -
trunk/python/asapplotter.py
r1259 r1295 1 1 from asap import rcParams, print_log, selector 2 from asap import NUM3 2 import matplotlib.axes 4 3 import sre -
trunk/python/scantable.py
r1280 r1295 4 4 from asap import asaplog 5 5 from asap import selector 6 from asap import NUM7 6 from asap import linecatalog 7 from asap import _n_bools, mask_not, mask_and, mask_or 8 8 9 9 class scantable(Scantable): … … 345 345 print "--------------------------------------------------" 346 346 print out 347 return 348 else: 349 retval = { 'axesnames': ['scanno', 'beamno', 'ifno', 'polno', 'cycleno'], 350 'axes' : axes, 351 'data': statvals} 352 return retval 347 #else: 348 #retval = { 'axesnames': ['scanno', 'beamno', 'ifno', 'polno', 'cycleno'], 349 # 'axes' : axes, 350 # 'data': statvals} 351 return statvals 353 352 354 353 def stddev(self, mask=None): … … 721 720 asaplog.push(msg) 722 721 n = self.nchan() 723 msk = NUM.zeros(n)722 msk = _n_bools(n, False) 724 723 # test if args is a 'list' or a 'normal *args - UGLY!!! 725 724 … … 731 730 for i in range(n): 732 731 if data[i] >= window[0] and data[i] <= window[1]: 733 msk[i] = 1732 msk[i] = True 734 733 if kwargs.has_key('invert'): 735 734 if kwargs.get('invert'): 736 msk = NUM.logical_not(msk)735 msk = mask_not(msk) 737 736 print_log() 738 737 return msk … … 1202 1201 varlist = vars() 1203 1202 if mask is None: 1204 mask = list(NUM.ones(self.nchan(-1)))1203 mask = [True for i in xrange(self.nchan(-1))] 1205 1204 from asap.asapfitter import fitter 1206 1205 try: -
trunk/scons/casa.py
r1135 r1295 14 14 ''' look for casa libraries''' 15 15 def addCasa(env): 16 casalibs = "casav atnf imagesms components coordinates \16 casalibs = "casav atnf ms components coordinates \ 17 17 lattices fits measures measures_f \ 18 18 tables scimath scimath_f casa wcs".split() -
trunk/share/ipythonrc-asap
r704 r1295 114 114 readline 1 115 115 116 116 117 # Screen Length: number of lines of your screen. This is used to control 117 118 # printing of very long strings. Strings longer than this number of lines will … … 226 227 # performed on strings which contain them. 227 228 228 readline_remove_delims '"[]{}-/~229 readline_remove_delims -/~ 229 230 230 231 #"' -- just to fix emacs coloring which gets confused by unmatched quotes. … … 242 243 # objects they are dealing with. 243 244 244 readline_omit__names 0245 readline_omit__names 2 245 246 246 247 #--------------------------------------------------------------------------- -
trunk/src/LineCatalog.h
r1259 r1295 36 36 */ 37 37 LineCatalog(const std::string& name = "jpl"); 38 /**39 * select a subset of the table by frequency range40 * @param fmin the lower frequency bound41 * @param fmin the upper frequency bound42 */43 38 44 39 virtual ~LineCatalog() {} … … 50 45 */ 51 46 void setFrequencyLimits(double fmin, double fmax); 47 52 48 /** 53 49 * select a subset of the table by line strength range … … 56 52 */ 57 53 void setStrengthLimits(double smin, double smax); 54 58 55 /** 59 56 * select a subset of the data by name pattern match (unix-style) … … 64 61 */ 65 62 void setPattern(const std::string& name, const std::string& ptype="pattern"); 63 66 64 /** 67 65 * save the table with current limits to disk (as an aips++ table) … … 69 67 */ 70 68 void save(const std::string& name); 69 71 70 /** 72 71 * Return a string representation of this table -
trunk/src/Makefile
r1259 r1295 34 34 35 35 G2CROOT := /usr/local 36 G2CARCH := $(G2CROOT)/lib/gcc/i386-apple-darwin8.7.1/4.2.0/libgcc.a 37 G2CARCH := $(G2CROOT)/lib/gcc/powerpc-apple-darwin8.7.0/4.2.0/libgcc.a 38 G2CLIB := $(G2CROOT)/lib/libgfortran.a $(G2CARCH) 36 G2CARCH := #$(G2CROOT)/lib/gcc/powerpc-apple-darwin8.7.0/4.2.0/libgcc.a 37 G2CLIB := $(G2CROOT)/lib/libg2c.a $(G2CARCH) 39 38 40 39 # This assumes all casa libs are static only (*.a) … … 42 41 CASAPPLIB := $(CASALIB)/version.o \ 43 42 -L$(CASALIB) \ 44 -latnf -l images -lms -lcomponents -lcoordinates \45 -llattices -lfits -lmeasures -lmeasures_f\43 -latnf -lms -lcomponents -lcoordinates \ 44 -llattices -lfits -lmeasures \ 46 45 -ltables -lscimath -lscimath_f -lcasa \ 47 46 $(CASALIB)/libwcs.a \ -
trunk/src/RowAccumulator.h
r1114 r1295 43 43 * @param tsys the Tsys corresponing to the spectrum 44 44 * @param interval the intergration time 45 * @param t he time of the observation45 * @param time the time of the observation 46 46 */ 47 47 void add(const casa::Vector<casa::Float>& v, -
trunk/src/STAsciiWriter.cpp
r996 r1295 109 109 String fName = rootName + String(onstr) + String(".txt"); 110 110 ofstream of(fName.chars(), ios::trunc); 111 int row0 = t.rowNumbers( )[0];111 int row0 = t.rowNumbers(tab)[0]; 112 112 MDirection mdir = stable.getDirection(row0); 113 113 of << setfill('#') << setw(70) << "" << setfill(' ') << endl; -
trunk/src/STMath.h
r1200 r1295 51 51 52 52 /** 53 * get the currnt @attr inistu state53 * get the currnt @attr inistu_ state 54 54 */ 55 55 bool insitu() const { return insitu_;}; … … 65 65 * average a vector of Scantables 66 66 * @param in the vector of Scantables to average 67 * @param an optional mask to apply on specific weights67 * @param mask an optional mask to apply on specific weights 68 68 * @param weight weighting scheme 69 69 * @param avmode the mode ov averaging. Per "SCAN" or "ALL". -
trunk/src/STWriter.cpp
r1280 r1295 119 119 //const Int nPol = hdr.npol; 120 120 //const Int nChan = hdr.nchan; 121 int nIF = in->nif(); 121 std::vector<uint> ifs = in->getIFNos(); 122 int nIF = in->nif();//ifs.size(); 122 123 Vector<uInt> nPol(nIF),nChan(nIF); 123 124 Vector<Bool> havexpol(nIF); 124 for (int i=0;i<nIF;++i) { 125 nPol(i) = in->npol(); 126 nChan(i) = in->nchan(i); 127 havexpol(i) = nPol(i) > 2; 125 nPol = 0;nChan = 0; havexpol = False; 126 for (int i=0;i<ifs.size();++i) { 127 nPol(ifs[i]) = in->npol(); 128 nChan(ifs[i]) = in->nchan(ifs[i]); 129 havexpol(ifs[i]) = nPol(ifs[i]) > 2; 128 130 } 129 131 … … 170 172 ROScalarColumn<Double> svelCol(btable, "SRCVELOCITY"); 171 173 svelCol.get(0, srcVel); 174 ROScalarColumn<uInt> bCol(btable, "BEAMNO"); 175 beamno = bCol(0)+1; 172 176 Int cycno = 1; 173 177 while (!cycit.pastEnd() ) { … … 181 185 const TableRecord& rec = row.get(0); 182 186 ROArrayColumn<Float> specCol(itable, "SPECTRA"); 187 ifno = rec.asuInt("IFNO")+1; 183 188 uInt nchan = specCol(0).nelements(); 184 189 Double cdelt,crval,crpix, restfreq; … … 244 249 } 245 250 ++count; 246 ++ifno;251 //++ifno; 247 252 ++ifit; 248 253 } … … 250 255 ++cycit; 251 256 } 252 ++beamno;257 //++beamno; 253 258 ++beamit; 254 259 } -
trunk/src/Scantable.h
r1189 r1295 120 120 /** 121 121 * set the header 122 * @param[in] s dh an STHeader object122 * @param[in] sth an STHeader object 123 123 */ 124 124 void setHeader( const STHeader& sth ); … … 175 175 /** 176 176 * set the direction type as a string, e.g. "J2000" 177 * @param[in] the direction type177 * @param[in] refstr the direction type 178 178 */ 179 179 void setDirectionRefString(const std::string& refstr=""); … … 203 203 /** 204 204 * Set the Stokes type of the data 205 * @param a string representing the type, e.g "circular" or "linear"205 * @param feedtype a string representing the type, e.g "circular" or "linear" 206 206 */ 207 207 void setFeedType( const std::string& feedtype ); -
trunk/web/index.html
r1259 r1295 118 118 <li><b class="asap">ASAP</b> source code is available through our subversion repository 119 119 <pre> 120 svn co http://sourcecode.atnf.csiro.au/repos/asap/ branches/Release2.1 asap2.1120 svn co http://sourcecode.atnf.csiro.au/repos/asap/tags/Release2.1.1 asap2.1.1 121 121 </pre> 122 122 </li>
Note:
See TracChangeset
for help on using the changeset viewer.