Changeset 1320
- Timestamp:
- 03/02/07 11:02:27 (18 years ago)
- Location:
- branches/Release2.1.2
- Files:
-
- 5 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
branches/Release2.1.2/python/__init__.py
r1309 r1320 22 22 if os.path.exists(os.environ["ASAPDATA"]): 23 23 asapdata = os.environ["ASAPDATA"] 24 os.environ["AIPSPATH"] = "%s %s somwhere" % ( asapdata, plf) 24 if not os.environ.has_key("AIPSPATH"): 25 os.environ["AIPSPATH"] = "%s %s somwhere" % ( asapdata, plf) 25 26 # set up user space 26 27 userdir = os.environ["HOME"]+"/.asap" … … 254 255 255 256 def _n_bools(n, val): 256 return [ val for i in xrange(n) ] 257 return [ val for i in xrange(n) ] 257 258 258 259 def _is_sequence_or_number(param, ptype=int): … … 348 349 if rcParams['useplotter']: 349 350 try: 350 351 352 353 354 355 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 356 357 except ImportError: 357 358 print "Matplotlib not installed. No plotting available" 358 359 359 360 __date__ = '$Date$'.split()[1] 360 __version__ = '2.1. 3'361 __version__ = '2.1.2' 361 362 362 363 def is_ipython(): -
branches/Release2.1.2/python/asapplotter.py
r1295 r1320 1 1 from asap import rcParams, print_log, selector 2 2 import matplotlib.axes 3 import sre3 import re 4 4 5 5 class asapplotter: -
branches/Release2.1.2/src/RowAccumulator.cpp
r979 r1320 13 13 14 14 #include <casa/Arrays/MaskArrMath.h> 15 #include <casa/Arrays/MaskArrLogi.h> 15 16 #include <casa/Arrays/ArrayMath.h> 17 #include <casa/Arrays/ArrayLogical.h> 16 18 #include "RowAccumulator.h" 17 19 … … 40 42 if (!initialized_) { 41 43 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); 45 48 tsysSum_.resize(tsys.nelements()); tsysSum_=0.0; 46 49 } … … 48 51 Float totalweight = 1.0; 49 52 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 } 52 58 addSpectrum(v, m, totalweight); 53 59 initialized_ = True; … … 134 140 casa::Vector< casa::Float > asap::RowAccumulator::getTsys( ) const 135 141 { 136 // @fixme this assum mes tsys.nelements() == 1142 // @fixme this assumes tsys.nelements() == 1 137 143 return tsysSum_/max(n_); 138 144 } -
branches/Release2.1.2/src/STLineFinder.cpp
r1016 r1320 50 50 // 51 51 // RunningBox - a running box calculator. This class implements 52 // i nterations over the specified spectrum and calculates52 // iterations over the specified spectrum and calculates 53 53 // running box filter statistics. 54 54 // … … 399 399 if (last_sign && last_sign!=getAboveMeanSign()) 400 400 detect=False; 401 402 403 404 405 406 407 408 409 410 411 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); 412 412 } 413 413 catch (const AipsError &ae) { … … 426 426 try { 427 427 if (is_detected_before) { 428 if (cur_line.second-cur_line.first> min_nchan) {428 if (cur_line.second-cur_line.first>=min_nchan) { 429 429 // it was a detection. We need to change the list 430 430 Bool add_new_line=False; … … 517 517 signs[ch]=getAboveMeanSign(); 518 518 // os<<ch<<" "<<spectrum[ch]<<" "<<fabs(running_box->aboveMean())<<" "<< 519 // 519 // threshold*offline_variance<<endl; 520 520 521 521 const Float buf=running_box->aboveMean(); … … 523 523 else if (buf<0) signs[ch]=-1; 524 524 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; 527 527 } 528 528 if (lines.size()) … … 768 768 // nothing new - proceed to the next step of averaging, if any 769 769 // (to search for broad lines) 770 if (avg_factor> avg_limit) break; // averaging up to avg_limit770 if (avg_factor>=avg_limit) break; // averaging up to avg_limit 771 771 // adjacent channels, 772 772 // stop after that … … 775 775 averageAdjacentChannels(temp_mask,avg_factor); 776 776 continue; 777 } 777 } 778 778 keepStrongestOnly(temp_mask,new_lines,max_box_nchan); 779 779 // update the list (lines) merging intervals, if necessary … … 951 951 // they will be find again at the next iteration. This approach 952 952 // 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. 954 954 // Later a better criterion may be implemented, e.g. 955 955 // taking into consideration the brightness of different lines. Now -
branches/Release2.1.2/src/STMath.cpp
r1310 r1320 167 167 Vector<Bool> bflag(flag.shape()); 168 168 convertArray(bflag, flag); 169 /* 169 170 if ( allEQ(bflag, True) ) { 170 171 continue;//don't accumulate 171 172 } 173 */ 172 174 specCol.get(k, spec); 173 175 tsysCol.get(k, tsys); … … 904 906 scaleByVector(tab,factors, false); 905 907 } 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 } 910 915 jyperk = STAttr::findJyPerK(etaap, d); 911 916 ostringstream oss; … … 976 981 for ( uInt i=0; i<tab.nrow(); ++i) { 977 982 Float zdist = Float(C::pi_2) - elev(i); 978 Float factor = exp(tau )/cos(zdist);983 Float factor = exp(tau/cos(zdist)); 979 984 MaskedArray<Float> ma = maskedArray(specCol(i), flagCol(i)); 980 985 ma *= factor;
Note:
See TracChangeset
for help on using the changeset viewer.