- Timestamp:
- 07/02/13 10:38:18 (11 years ago)
- Location:
- trunk
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/python/__init__.py
r2649 r2818 59 59 60 60 __date__ = '$Date$'.split()[1] 61 __version__ = ' trunk'61 __version__ = '4.1.3a' 62 62 __revision__ = get_revision() 63 63 -
trunk/python/asapmath.py
r2754 r2818 90 90 else: 91 91 #s = scantable(stm._average(alignedlst, mask, weight.upper(), scanav)) 92 s = scantable(stm._new_average(alignedlst, compel, mask, weight.upper(), scanav)) 92 s = scantable(stm._new_average(alignedlst, compel, mask, 93 weight.upper(), scanav)) 93 94 s._add_history("average_time",varlist) 94 95 -
trunk/python/scantable.py
r2810 r2818 2112 2112 # 2113 2113 @asaplog_post_dec 2114 def average_time(self, mask=None, scanav=False, weight='tint', align=False): 2114 def average_time(self, mask=None, scanav=False, weight='tint', align=False, 2115 avmode="NONE"): 2115 2116 """\ 2116 2117 Return the (time) weighted average of a scan. Scans will be averaged … … 2140 2141 align: align the spectra in velocity before averaging. It takes 2141 2142 the time of the first spectrum as reference time. 2143 avmode: 'SOURCE' - also select by source name - or 2144 'NONE' (default). Not applicable for scanav=True or 2145 weight=median 2142 2146 2143 2147 Example:: … … 2150 2154 weight = weight or 'TINT' 2151 2155 mask = mask or () 2152 scanav = (scanav and 'SCAN') or 'NONE'2156 scanav = (scanav and 'SCAN') or avmode.upper() 2153 2157 scan = (self, ) 2154 2158 2155 2159 if align: 2156 2160 scan = (self.freq_align(insitu=False), ) 2161 asaplog.push("Note: Alignment is don on a source-by-source basis") 2162 asaplog.push("Note: Averaging (by default) is not") 2163 # we need to set it to SOURCE averaging here 2157 2164 s = None 2158 2165 if weight.upper() == 'MEDIAN': … … 4246 4253 self._add_history("set_sourcetype", varlist) 4247 4254 4255 4256 def set_sourcename(self, name): 4257 varlist = vars() 4258 self._setsourcename(name) 4259 self._add_history("set_sourcename", varlist) 4260 4248 4261 @asaplog_post_dec 4249 4262 @preserve_selection -
trunk/setup.py
r2653 r2818 4 4 5 5 setup(name = PKGNAME, 6 version = '4.1. 0',6 version = '4.1.3a', 7 7 description = 'ATNF Spectral-line Analysis Package', 8 8 author = 'Malte Marquarding', -
trunk/src/STMath.cpp
r2695 r2818 2781 2781 MVTime mvt(refEpoch.getValue()); 2782 2782 String epochout = mvt.string(MVTime::YMD) + String(" (") + refEpoch.getRefString() + String(")"); 2783 os << "Align edat reference Epoch " << epochout2783 os << "Aligning at reference Epoch " << epochout 2784 2784 << " in frame " << MFrequency::showType(system) << LogIO::POST; 2785 2785 // set up the iterator … … 2795 2795 while ( !iter.pastEnd() ) { 2796 2796 Table t = iter.table(); 2797 ROScalarColumn<String> snCol(t, "SRCNAME"); 2798 os << "Aligning to position of source '" << snCol(0) << "'" << LogIO::POST; 2797 2799 MDirection::ROScalarColumn dirCol(t, "DIRECTION"); 2798 2800 TableIterator fiter(t, "FREQ_ID"); 2799 2801 // determine nchan from the first row. This should work as 2800 // we are iterating over BEAMNO and IFNO // we should have constant direction 2802 // we are iterating over BEAMNO and IFNO 2803 // we should have constant direction 2801 2804 2802 2805 ROArrayColumn<Float> sCol(t, "SPECTRA"); … … 2813 2816 ScalarColumn<uInt> freqidCol(ftab, "FREQ_ID"); 2814 2817 // get the SpectralCoordinate for the freqid, which we are iterating over 2815 SpectralCoordinate sC = in->frequencies().getSpectralCoordinate(freqidCol(0)); 2818 SpectralCoordinate sC = \ 2819 in->frequencies().getSpectralCoordinate(freqidCol(0)); 2816 2820 FrequencyAligner<Float> fa( sC, nchan, refEpoch, 2817 2821 direction, refPos, system ); … … 2826 2830 sc2.increment()[0]); 2827 2831 while ( !fiter.pastEnd() ) { 2832 2828 2833 ftab = fiter.table(); 2829 2834 // spectral coordinate for the current FREQ_ID -
trunk/src/Scantable.cpp
r2813 r2818 180 180 table_ = TableCopy::makeEmptyMemoryTable(newname, 181 181 other.table_, True); 182 } else 182 } else { 183 183 table_ = other.table_.copyToMemoryTable(newname); 184 } 184 185 } else { 185 186 other.table_.deepCopy(newname, Table::New, False, … … 450 451 TableVector<Int> tabvec(table_, "SRCTYPE"); 451 452 tabvec = Int(stype); 453 } 454 455 void Scantable::setSourceName( const std::string& name ) 456 { 457 TableVector<String> tabvec(table_, "SRCNAME"); 458 tabvec = name; 452 459 } 453 460 -
trunk/src/Scantable.h
r2811 r2818 155 155 void setSourceType(int stype); 156 156 157 /** 158 * 159 * @param stype The name of the source 160 */ 161 void setSourceName(const std::string& name); 162 157 163 158 164 /** … … 387 393 388 394 //std::string getTime(int whichrow=-1, bool showdate=true) const; 389 std::string getTime(int whichrow=-1, bool showdate=true, casa::uInt prec=0) const; 395 std::string getTime(int whichrow=-1, bool showdate=true, 396 casa::uInt prec=0) const; 390 397 double getIntTime(int whichrow) const { return integrCol_(whichrow); } 391 398 … … 668 675 669 676 std::string formatTime(const casa::MEpoch& me, bool showdate)const; 670 std::string formatTime(const casa::MEpoch& me, bool showdate, casa::uInt prec)const; 677 std::string formatTime(const casa::MEpoch& me, bool showdate, 678 casa::uInt prec)const; 671 679 672 680 /** -
trunk/src/ScantableWrapper.h
r2811 r2818 188 188 { table_->setSourceType(stype); } 189 189 190 void setSourceName(const std::string& name) 191 { table_->setSourceName(name); } 192 190 193 void shift(int npix) 191 194 { table_->shift(npix); } -
trunk/src/python_Scantable.cpp
r2791 r2818 137 137 .def("_recalcazel", &ScantableWrapper::calculateAZEL) 138 138 .def("_setsourcetype", &ScantableWrapper::setSourceType) 139 .def("_setsourcename", &ScantableWrapper::setSourceName) 139 140 .def("_getdirectionvec", &ScantableWrapper::getDirectionVector) 140 141 .def("_parallactify", &ScantableWrapper::parallactify) -
trunk/test/test_scantable.py
r2802 r2818 149 149 'Orion_SiO', 'Orion_SiO']) 150 150 151 def test_set_sourcename(self): 152 s = self.st.copy() 153 newname = "TEST" 154 s.set_sourcename(newname) 155 assert_equal(s.get_sourcename(), [newname]*4) 156 151 157 def test_get_azimuth(self): 152 158 assert_almost_equal(self.st.get_azimuth()[0], 5.628767013) … … 194 200 assert_almost_equal(q1.stats(stat='max')[0], 2.66563416) 195 201 202 203 def test_average_time_weight(self): 204 weights = {'none': 236.61423, 205 'var' : 232.98752, 206 'tsys' : 236.37482, 207 'tint' : 236.61423, 208 'tintsys' : 236.37485, 209 'median' : 236.61423, 210 } 211 212 for k,v in weights.items(): 213 yield self.av_weight, k, v 214 215 def av_weight(self, weight, result): 216 out = self.st.average_time(weight=weight) 217 assert_almost_equals(max(out.get_spectrum(0)), result, 5) 218 196 219 @with_setup(tempdir_setup, tempdir_teardown) 197 220 def test_save(self): … … 203 226 (fname % 'txt', 'ASCII', False), 204 227 ] 205 for f ormat in formats:206 yield self.save, f ormat228 for fmt in formats: 229 yield self.save, fmt 207 230 208 231 def save(self, args):
Note:
See TracChangeset
for help on using the changeset viewer.