Changeset 1320


Ignore:
Timestamp:
03/02/07 11:02:27 (17 years ago)
Author:
mar637
Message:

merge from trunk, to get most recent bug fixes

Location:
branches/Release2.1.2
Files:
5 edited
1 copied

Legend:

Unmodified
Added
Removed
  • branches/Release2.1.2/python/__init__.py

    r1309 r1320  
    2222    if os.path.exists(os.environ["ASAPDATA"]):
    2323        asapdata = os.environ["ASAPDATA"]
    24 os.environ["AIPSPATH"] = "%s %s somwhere" % ( asapdata, plf)
     24if not os.environ.has_key("AIPSPATH"):
     25    os.environ["AIPSPATH"] = "%s %s somwhere" % ( asapdata, plf)
    2526# set up user space
    2627userdir = os.environ["HOME"]+"/.asap"
     
    254255
    255256def _n_bools(n, val):
    256     return [ val for i in xrange(n) ] 
     257    return [ val for i in xrange(n) ]
    257258
    258259def _is_sequence_or_number(param, ptype=int):
     
    348349if rcParams['useplotter']:
    349350    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
     351    from  asapplotter import asapplotter
     352    gui = os.environ.has_key('DISPLAY') and rcParams['plotter.gui']
     353    if gui:
     354        import pylab as xyplotter
     355        plotter = asapplotter(gui)
     356        del gui
    356357    except ImportError:
    357         print "Matplotlib not installed. No plotting available"
     358    print "Matplotlib not installed. No plotting available"
    358359
    359360__date__ = '$Date$'.split()[1]
    360 __version__  = '2.1.3'
     361__version__  = '2.1.2'
    361362
    362363def is_ipython():
  • branches/Release2.1.2/python/asapplotter.py

    r1295 r1320  
    11from asap import rcParams, print_log, selector
    22import matplotlib.axes
    3 import sre
     3import re
    44
    55class asapplotter:
  • branches/Release2.1.2/src/RowAccumulator.cpp

    r979 r1320  
    1313
    1414#include <casa/Arrays/MaskArrMath.h>
     15#include <casa/Arrays/MaskArrLogi.h>
    1516#include <casa/Arrays/ArrayMath.h>
     17#include <casa/Arrays/ArrayLogical.h>
    1618#include "RowAccumulator.h"
    1719
     
    4042  if (!initialized_) {
    4143    Vector<Float> dummy(v.nelements(), 0.0);
    42     spectrum_.setData(dummy, Vector<Bool>(m.nelements(), True));
    43     n_.setData(Vector<Float>(v.nelements(), 0.0), m);
    44     weightSum_.setData(Vector<Float>(v.nelements(), 0.0), m);
     44    Vector<Bool> dummymsk(m.nelements(), True);
     45    spectrum_.setData(dummy, dummymsk);
     46    n_.setData(Vector<Float>(v.nelements(), 0.0), dummymsk);
     47    weightSum_.setData(Vector<Float>(v.nelements(), 0.0), dummymsk);
    4548    tsysSum_.resize(tsys.nelements()); tsysSum_=0.0;
    4649  }
     
    4851  Float totalweight = 1.0;
    4952  totalweight *= addTsys(tsys);
    50   totalweight *= addInterval(interval);
    51   addTime(time);
     53  // only add these if not everything masked
     54  if ( !allEQ(m, False) ) {
     55    totalweight *= addInterval(interval);
     56    addTime(time);
     57  }
    5258  addSpectrum(v, m, totalweight);
    5359  initialized_ = True;
     
    134140casa::Vector< casa::Float > asap::RowAccumulator::getTsys( ) const
    135141{
    136   // @fixme this assummes tsys.nelements() == 1
     142  // @fixme this assumes tsys.nelements() == 1
    137143  return tsysSum_/max(n_);
    138144}
  • branches/Release2.1.2/src/STLineFinder.cpp

    r1016 r1320  
    5050//
    5151// RunningBox -    a running box calculator. This class implements
    52 //                 interations over the specified spectrum and calculates
     52//                 iterations over the specified spectrum and calculates
    5353//                 running box filter statistics.
    5454//
     
    399399          if (last_sign && last_sign!=getAboveMeanSign())
    400400              detect=False;
    401           }
    402           if (detect) {
    403               last_sign=getAboveMeanSign();
    404               if (is_detected_before)
    405                   cur_line.second=running_box->getChannel()+1;
    406               else {
    407                   is_detected_before=True;
    408                   cur_line.first=running_box->getChannel();
    409                   cur_line.second=running_box->getChannel()+1;
    410               }
    411           } else processCurLine(mask);
     401       }
     402       if (detect) {
     403           last_sign=getAboveMeanSign();
     404           if (is_detected_before)
     405               cur_line.second=running_box->getChannel()+1;
     406           else {
     407               is_detected_before=True;
     408               cur_line.first=running_box->getChannel();
     409               cur_line.second=running_box->getChannel()+1;
     410           }
     411       } else processCurLine(mask);
    412412  }
    413413  catch (const AipsError &ae) {
     
    426426  try {
    427427       if (is_detected_before) {
    428            if (cur_line.second-cur_line.first>min_nchan) {
     428           if (cur_line.second-cur_line.first>=min_nchan) {
    429429               // it was a detection. We need to change the list
    430430               Bool add_new_line=False;
     
    517517           signs[ch]=getAboveMeanSign();
    518518           // os<<ch<<" "<<spectrum[ch]<<" "<<fabs(running_box->aboveMean())<<" "<<
    519            //   threshold*offline_variance<<endl;
     519           // threshold*offline_variance<<endl;
    520520
    521521           const Float buf=running_box->aboveMean();
     
    523523           else if (buf<0) signs[ch]=-1;
    524524           else if (buf==0) signs[ch]=0;
    525         //   os<<ch<<" "<<spectrum[ch]<<" "<<running_box->getLinMean()<<" "<<
    526           //              threshold*offline_variance<<endl;
     525           //os<<ch<<" "<<spectrum[ch]<<" "<<running_box->getLinMean()<<" "<<
     526           //             threshold*offline_variance<<endl;
    527527      }
    528528      if (lines.size())
     
    768768         // nothing new - proceed to the next step of averaging, if any
    769769         // (to search for broad lines)
    770          if (avg_factor>avg_limit) break; // averaging up to avg_limit
     770         if (avg_factor>=avg_limit) break; // averaging up to avg_limit
    771771                                          // adjacent channels,
    772772                                          // stop after that
     
    775775         averageAdjacentChannels(temp_mask,avg_factor);
    776776         continue;
    777      }
     777     } 
    778778     keepStrongestOnly(temp_mask,new_lines,max_box_nchan);
    779779     // update the list (lines) merging intervals, if necessary
     
    951951// they will be find again at the next iteration. This approach
    952952// increases the number of iterations required, but is able to remove
    953 // the sidelobes likely to occur near strong lines.
     953// spurious detections likely to occur near strong lines.
    954954// Later a better criterion may be implemented, e.g.
    955955// taking into consideration the brightness of different lines. Now
  • branches/Release2.1.2/src/STMath.cpp

    r1310 r1320  
    167167        Vector<Bool> bflag(flag.shape());
    168168        convertArray(bflag, flag);
     169        /*
    169170        if ( allEQ(bflag, True) ) {
    170           continue;//don't accumulate
     171        continue;//don't accumulate
    171172        }
     173        */
    172174        specCol.get(k, spec);
    173175        tsysCol.get(k, tsys);
     
    904906    scaleByVector(tab,factors, false);
    905907  } else if ( etaap > 0.0) {
    906     Instrument inst =
    907       STAttr::convertInstrument(tab.keywordSet().asString("AntennaName"), True);
    908     STAttr sda;
    909     if (d < 0) d = sda.diameter(inst);
     908    if (d < 0) {
     909      Instrument inst =
     910        STAttr::convertInstrument(tab.keywordSet().asString("AntennaName"),
     911                                  True);
     912      STAttr sda;
     913      d = sda.diameter(inst);
     914    }
    910915    jyperk = STAttr::findJyPerK(etaap, d);
    911916    ostringstream oss;
     
    976981  for ( uInt i=0; i<tab.nrow(); ++i) {
    977982    Float zdist = Float(C::pi_2) - elev(i);
    978     Float factor = exp(tau)/cos(zdist);
     983    Float factor = exp(tau/cos(zdist));
    979984    MaskedArray<Float> ma = maskedArray(specCol(i), flagCol(i));
    980985    ma *= factor;
Note: See TracChangeset for help on using the changeset viewer.