Changeset 1295 for trunk


Ignore:
Timestamp:
11/06/06 22:22:03 (18 years ago)
Author:
mar637
Message:

merge form Release2.1.1 branch

Location:
trunk
Files:
18 edited
1 copied

Legend:

Unmodified
Added
Removed
  • trunk/Makefile

    r1269 r1295  
    1 PREFIX := /usr
    2 PYDIR := $(PREFIX)/lib/python2.3/site-packages
     1PREFIX := /Library/Frameworks/Python.framework/Versions/2.4
     2PYDIR := $(PREFIX)/lib/python2.4/site-packages
    33
    44ifndef ASAPROOT
  • trunk/doc/CHANGELOG

    r1259 r1295  
    11Changelog
    22=========
    3 Release Version 2.1 [2006-09-11]
     3
     4Minor 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
     12Release Version 2.1.0 [2006-09-11]
    413
    514* Processing of Multibeam MX data
  • trunk/monitor/cgi-bin/asapmon.py

    r1083 r1295  
    1010abspath= "/var/www/asapmon/"
    1111cgiloc = "/cgi-bin/asapmon/"
    12 tmppath = abspath+"tmp/"
     12tmppath = os.path.join(abspath,"tmp/")
    1313htmlloc = "/asapmon/"
    1414tmploc = "/asapmon/tmp/"
     
    2525logsink = WritableObject()
    2626logsink2 = WritableObject()
    27 sys.stdout =logsink
     27sys.stdout = logsink
    2828sys.stderr = logsink2
    2929import asap
     
    5353        out = []
    5454        for i in fi:
    55             out.append(p+"/"+fl.files[i])
     55            out.append(os.path.join(p,fl.files[i]))
    5656        return out
    5757
    5858    def decodeWindow(self,window):
    5959        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):
    6464        import re
    6565        p = re.compile("(\\[*\d+\\.*\d*,\d+\\.*\d*\\]*)")
    6666        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)]
    6868
    6969    def setDefaultFields(self):
     
    8080        self.fields['imagename'] = ""
    8181        self.fields['cunit'] = 0
    82         self.fields['units'] = ["channel","km/s","GHz"]
     82        self.fields['units'] = ["channel", "km/s", "GHz"]
    8383        self.fields['baseline'] = 0
    8484        self.fields['cpolyorder'] = 0
     
    8787        self.fields['doppler'] = "RADIO"
    8888        self.fields['frame'] = "LSRK"
    89         self.fields['restn'] = [11,1]
     89        self.fields['restn'] = [11, 1]
    9090        self.fields['stokes'] = 0
    9191        self.fields['summary'] = ""
     
    9898
    9999    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")
    103103        self.fields['restn'] = []
    104104
    105         self.fields['plotwindow'] = self.form.getfirst("plotwindow","")
     105        self.fields['plotwindow'] = self.form.getfirst("plotwindow", "")
    106106        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))
    108108        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))
    112112        self.fields['cfile'] = [int(k) for k in self.form.getlist("list")]
    113113        self.fields['average'] = int(self.form.has_key("average"))
     
    115115        self.fields['bin'] = int(self.form.has_key("bin"))
    116116        self.fields['debug'] = ""#self.fields['restn']
    117         self.fields['csource'] = self.form.getfirst("csource","")
     117        self.fields['csource'] = self.form.getfirst("csource", "")
    118118
    119119    def getRest(self):
     
    140140            for i in self.fields['nif']:
    141141                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)))
    143143            restfs = self.getRest()
    144144
     
    151151                if i:
    152152                    # filter off scans
    153                     i = not re.search(re.compile("_[R,e,w]$"),i) and i
     153                    i = not re.search(re.compile("_[R, e, w]$"), i) and i
    154154                    if i:
    155155                        self.fields['sourcenames'].append(i)
     
    162162                if cs in self.fields['sourcenames']:
    163163                    ss = s.get_scan(self.fields['csource'])
    164                     if isinstance(ss,asap.scantable):
     164                    if isinstance(ss, asap.scantable):
    165165                        s = ss
    166166                    del ss
     
    172172            if self.fields['cunit'] == 1:
    173173                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")
    176176            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"))
    179179
    180180            # baseline
     
    189189                        self.fields['brangewindow'] = brstr
    190190                        m = s.create_mask(brange)
    191                         s.poly_baseline(mask=m,order=order)
     191                        s.poly_baseline(mask=m, order=order)
    192192                else:
    193193                    s.auto_poly_baseline(order=order)
     
    217217            asap.plotter = asap.asapplotter(False)
    218218            if outscans.nif() > 1:
    219                 asap.plotter.set_mode("p","i")
     219                asap.plotter.set_mode("p", "i")
    220220            else:
    221221                if outscans.npol() > 2:
    222                     asap.plotter.set_mode("t","p")
     222                    asap.plotter.set_mode("t", "p")
    223223                else:
    224                     asap.plotter.set_mode("p","t")
     224                    asap.plotter.set_mode("p", "t")
    225225            asap.plotter.plot(outscans)
    226226            if self.fields['stokes']:
     
    231231                sel.set_polarisations(pols)
    232232                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)
    235235            imname = tmppath+"plot.png"
    236             asap.plotter.save(imname,dpi=96)
     236            asap.plotter.save(imname, dpi=96)
    237237            self.fields['imagename'] = tmploc+"plot.png"
    238         except RuntimeError,e:
     238        except RuntimeError, e:
    239239            self.fields['debug'] = e
    240240            return
  • trunk/monitor/cgi-bin/filelist.py

    r739 r1295  
    11#!/usr/bin/python
    22import os
     3import sre
    34from obsconfig import observatory
    45
    56class FileList:
    67
    7     def __init__(self, loc=None):
     8    def __init__(self, loc=None, projectcode=None):
    89        self.message ="""Content-Type: text/xml
    910
    1011<?xml version="1.0" encoding="ISO-8859-1"?>"""
    11 
    1212        self.error = None
    1313        if loc is None:
     
    2121                loc = observatory['rpfpath'][loc]
    2222        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) ]
    2428            if len(self.files) == 0:
    2529                self.error = "No rpfits files found"
     
    4246    import cgi
    4347    form = cgi.FieldStorage()
     48    pfilter = None
     49    if form.has_key('project'):
     50        pfilter = form.getfirst("project", None)
    4451    if form.has_key('path'):
    4552        pathindex = form.getfirst("path",0)
    46         print FileList(pathindex)
     53        print FileList(pathindex, pfilter)
    4754    else:
    4855        print FileList()
  • trunk/python/__init__.py

    r1280 r1295  
    253253    rcParams.update(rcParamsDefault)
    254254
     255def _n_bools(n, val):
     256    return [ val for i in xrange(n) ]
    255257
    256258def _is_sequence_or_number(param, ptype=int):
     
    298300        'data/Sgr_86p262_best_SPC.sdfits']
    299301    """
    300     import os
    301302    if not os.path.isdir(path):
    302303        return None
    303     valid = "rpf sdf sdfits mbf asap".split()
     304    valid = "rpf rpf.1 rpf.2 sdf sdfits mbf asap".split()
    304305    if not suffix in valid:
    305306        return None
     
    325326    return
    326327
    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")
     328def mask_and(a, b):
     329    assert(len(a)==len(b))
     330    return [ a[i] & b[i] for i in xrange(len(a)) ]
     331
     332def mask_or(a, b):
     333    assert(len(a)==len(b))
     334    return [ a[i] | b[i] for i in xrange(len(a)) ]
     335
     336def mask_not(a):
     337    return [ not i for i in a ]
    334338
    335339from asapfitter import fitter
     
    342346from linecatalog import linecatalog
    343347
    344 mask_and = NUM.logical_and
    345 mask_or = NUM.logical_or
    346 mask_not = NUM.logical_not
    347 
    348348if 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"
    355358
    356359__date__ = '$Date$'.split()[1]
     
    362365    def version(): print  "ASAP %s(%s)"% (__version__, __date__)
    363366    def list_scans(t = scantable):
    364         import sys, types
     367        import types
    365368        globs = sys.modules['__main__'].__dict__.iteritems()
    366369        print "The user created scantables are:"
  • trunk/python/asapfitter.py

    r1273 r1295  
    22from asap import rcParams
    33from asap import print_log
    4 from asap import NUM
     4from asap import _n_bools
    55
    66class fitter:
     
    4242        self.y = ydat
    4343        if mask == None:
    44             self.mask = NUM.ones(len(xdat))
     44            self.mask = _n_bools(len(xdat), True)
    4545        else:
    4646            self.mask = mask
     
    6565        self.mask = None
    6666        if mask is None:
    67             self.mask = NUM.ones(self.data.nchan())
     67            self.mask = _n_bools(self.data.nchan(), True)
    6868        else:
    6969            self.mask = mask
     
    215215        if self.fitfunc == "gauss" and component is not None:
    216216            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)
    219219            else:
    220220                pars = list(self.fitter.getparameters())
  • trunk/python/asapplotter.py

    r1259 r1295  
    11from asap import rcParams, print_log, selector
    2 from asap import NUM
    32import matplotlib.axes
    43import sre
  • trunk/python/scantable.py

    r1280 r1295  
    44from asap import asaplog
    55from asap import selector
    6 from asap import NUM
    76from asap import linecatalog
     7from asap import _n_bools, mask_not, mask_and, mask_or
    88
    99class scantable(Scantable):
     
    345345            print "--------------------------------------------------"
    346346            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
    353352
    354353    def stddev(self, mask=None):
     
    721720            asaplog.push(msg)
    722721        n = self.nchan()
    723         msk = NUM.zeros(n)
     722        msk = _n_bools(n, False)
    724723        # test if args is a 'list' or a 'normal *args - UGLY!!!
    725724
     
    731730            for i in range(n):
    732731                if data[i] >= window[0] and data[i] <= window[1]:
    733                     msk[i] = 1
     732                    msk[i] = True
    734733        if kwargs.has_key('invert'):
    735734            if kwargs.get('invert'):
    736                 msk = NUM.logical_not(msk)
     735                msk = mask_not(msk)
    737736        print_log()
    738737        return msk
     
    12021201        varlist = vars()
    12031202        if mask is None:
    1204             mask = list(NUM.ones(self.nchan(-1)))
     1203            mask = [True for i in xrange(self.nchan(-1))]
    12051204        from asap.asapfitter import fitter
    12061205        try:
  • trunk/scons/casa.py

    r1135 r1295  
    1414        ''' look for casa libraries'''
    1515        def addCasa(env):
    16             casalibs = "casav atnf images ms components coordinates \
     16            casalibs = "casav atnf ms components coordinates \
    1717                        lattices fits measures measures_f \
    1818                        tables scimath scimath_f casa wcs".split()
  • trunk/share/ipythonrc-asap

    r704 r1295  
    114114readline 1
    115115
     116
    116117# Screen Length: number of lines of your screen. This is used to control
    117118# printing of very long strings. Strings longer than this number of lines will
     
    226227# performed on strings which contain them.
    227228
    228 readline_remove_delims '"[]{}-/~
     229readline_remove_delims -/~
    229230
    230231#"' -- just to fix emacs coloring which gets confused by unmatched quotes.
     
    242243# objects they are dealing with.
    243244
    244 readline_omit__names 0
     245readline_omit__names 2
    245246
    246247#---------------------------------------------------------------------------
  • trunk/src/LineCatalog.h

    r1259 r1295  
    3636    */
    3737  LineCatalog(const std::string& name = "jpl");
    38   /**
    39     * select a subset of the table by frequency range
    40     * @param fmin the lower frequency bound
    41     * @param fmin the upper frequency bound
    42     */
    4338
    4439  virtual ~LineCatalog() {}
     
    5045   */
    5146  void setFrequencyLimits(double fmin, double fmax);
     47
    5248  /**
    5349    * select a subset of the table by line strength range
     
    5652    */
    5753  void setStrengthLimits(double smin, double smax);
     54 
    5855  /**
    5956    * select a subset of the data by name pattern match (unix-style)
     
    6461    */
    6562  void setPattern(const std::string& name, const std::string& ptype="pattern");
     63 
    6664  /**
    6765    * save the table  with current limits to disk (as an aips++ table)
     
    6967    */
    7068  void save(const std::string& name);
     69 
    7170  /**
    7271    * Return a string representation of this table
  • trunk/src/Makefile

    r1259 r1295  
    3434
    3535G2CROOT := /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)
     36G2CARCH := #$(G2CROOT)/lib/gcc/powerpc-apple-darwin8.7.0/4.2.0/libgcc.a
     37G2CLIB := $(G2CROOT)/lib/libg2c.a $(G2CARCH)
    3938
    4039# This assumes all casa libs are static only (*.a)
     
    4241CASAPPLIB := $(CASALIB)/version.o \
    4342             -L$(CASALIB) \
    44              -latnf -limages -lms -lcomponents -lcoordinates \
    45              -llattices -lfits -lmeasures -lmeasures_f \
     43             -latnf -lms -lcomponents -lcoordinates \
     44             -llattices -lfits -lmeasures \
    4645             -ltables -lscimath -lscimath_f -lcasa  \
    4746             $(CASALIB)/libwcs.a \
  • trunk/src/RowAccumulator.h

    r1114 r1295  
    4343    * @param tsys the Tsys corresponing to the spectrum
    4444    * @param interval the intergration time
    45     * @param the time of the observation
     45    * @param time the time of the observation
    4646    */
    4747  void add(const casa::Vector<casa::Float>& v,
  • trunk/src/STAsciiWriter.cpp

    r996 r1295  
    109109    String fName = rootName + String(onstr) + String(".txt");
    110110    ofstream of(fName.chars(), ios::trunc);
    111     int row0 = t.rowNumbers()[0];
     111    int row0 = t.rowNumbers(tab)[0];
    112112    MDirection mdir = stable.getDirection(row0);
    113113    of << setfill('#') << setw(70) << "" << setfill(' ') << endl;
  • trunk/src/STMath.h

    r1200 r1295  
    5151
    5252  /**
    53    * get the currnt @attr inistu state
     53   * get the currnt @attr inistu_ state
    5454   */
    5555  bool insitu() const { return insitu_;};
     
    6565    * average a vector of Scantables
    6666    * @param in the vector of Scantables to average
    67     * @param an optional mask to apply on specific weights
     67    * @param mask an optional mask to apply on specific weights
    6868    * @param weight weighting scheme
    6969    * @param avmode the mode ov averaging. Per "SCAN" or "ALL".
  • trunk/src/STWriter.cpp

    r1280 r1295  
    119119  //const Int nPol  = hdr.npol;
    120120  //const Int nChan = hdr.nchan;
    121   int nIF = in->nif();
     121  std::vector<uint> ifs = in->getIFNos();
     122  int nIF = in->nif();//ifs.size();
    122123  Vector<uInt> nPol(nIF),nChan(nIF);
    123124  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;
    128130  }
    129131
     
    170172      ROScalarColumn<Double> svelCol(btable, "SRCVELOCITY");
    171173      svelCol.get(0, srcVel);
     174      ROScalarColumn<uInt> bCol(btable, "BEAMNO");
     175      beamno = bCol(0)+1;
    172176      Int cycno = 1;
    173177      while (!cycit.pastEnd() ) {
     
    181185          const TableRecord& rec = row.get(0);
    182186          ROArrayColumn<Float> specCol(itable, "SPECTRA");
     187          ifno = rec.asuInt("IFNO")+1;
    183188          uInt nchan = specCol(0).nelements();
    184189          Double cdelt,crval,crpix, restfreq;
     
    244249          }
    245250          ++count;
    246           ++ifno;
     251          //++ifno;
    247252          ++ifit;
    248253        }
     
    250255        ++cycit;
    251256      }
    252       ++beamno;
     257      //++beamno;
    253258      ++beamit;
    254259    }
  • trunk/src/Scantable.h

    r1189 r1295  
    120120  /**
    121121   * set the header
    122    * @param[in] sdh an STHeader object
     122   * @param[in] sth an STHeader object
    123123   */
    124124  void setHeader( const STHeader& sth );
     
    175175        /**
    176176         * set the direction type as a string, e.g. "J2000"
    177          * @param[in] the direction type
     177         * @param[in] refstr the direction type
    178178         */
    179179  void setDirectionRefString(const std::string& refstr="");
     
    203203  /**
    204204   * 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"
    206206   */
    207207  void setFeedType( const std::string& feedtype );
  • trunk/web/index.html

    r1259 r1295  
    118118  <li><b class="asap">ASAP</b> source code is available through our subversion repository
    119119    <pre>
    120         svn co http://sourcecode.atnf.csiro.au/repos/asap/branches/Release2.1 asap2.1
     120        svn co http://sourcecode.atnf.csiro.au/repos/asap/tags/Release2.1.1 asap2.1.1
    121121    </pre>
    122122  </li>
Note: See TracChangeset for help on using the changeset viewer.