Changeset 1360 for trunk/src


Ignore:
Timestamp:
04/27/07 11:00:43 (18 years ago)
Author:
mar637
Message:

enhancement #107; added scantable.shift_refpix

Location:
trunk/src
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/STFrequencies.cpp

    r941 r1360  
    4141}
    4242
    43 asap::STFrequencies::STFrequencies( casa::Table tab ) :
     43STFrequencies::STFrequencies( casa::Table tab ) :
    4444  STSubTable(tab, name_)
    4545{
     
    5454}
    5555
    56 STFrequencies & asap::STFrequencies::operator =( const STFrequencies & other )
     56STFrequencies & STFrequencies::operator=( const STFrequencies & other )
    5757{
    5858  if ( this != &other ) {
     
    140140  // get first row - there should only be one matching id
    141141  const TableRecord& rec = row.get(0);
    142 
    143142  return SpectralCoordinate( getFrame(true), rec.asDouble("REFVAL"),
    144143                             rec.asDouble("INCREMENT"),
     
    147146
    148147SpectralCoordinate
    149   asap::STFrequencies::getSpectralCoordinate( const MDirection& md,
    150                                               const MPosition& mp,
    151                                               const MEpoch& me,
    152                                               Double restfreq, uInt id ) const
     148  STFrequencies::getSpectralCoordinate( const MDirection& md,
     149                                        const MPosition& mp,
     150                                        const MEpoch& me,
     151                                        Double restfreq, uInt id ) const
    153152{
    154153  SpectralCoordinate spc = getSpectralCoordinate(id);
     
    242241}
    243242
    244 std::string asap::STFrequencies::getFrameString( bool base ) const
     243std::string STFrequencies::getFrameString( bool base ) const
    245244{
    246245  if ( base ) return table_.keywordSet().asString("BASEFRAME");
     
    248247}
    249248
    250 std::string asap::STFrequencies::getUnitString( ) const
     249std::string STFrequencies::getUnitString( ) const
    251250{
    252251  return table_.keywordSet().asString("UNIT");
    253252}
    254253
    255 Unit asap::STFrequencies::getUnit( ) const
     254Unit STFrequencies::getUnit( ) const
    256255{
    257256  return Unit(table_.keywordSet().asString("UNIT"));
    258257}
    259258
    260 std::string asap::STFrequencies::getDopplerString( ) const
     259std::string STFrequencies::getDopplerString( ) const
    261260{
    262261  return table_.keywordSet().asString("DOPPLER");
    263262}
    264263
    265 MDoppler::Types asap::STFrequencies::getDoppler( ) const
     264MDoppler::Types STFrequencies::getDoppler( ) const
    266265{
    267266  String dpl = table_.keywordSet().asString("DOPPLER");
     
    275274}
    276275
    277 std::string asap::STFrequencies::print( int id )
     276std::string STFrequencies::print( int id )
    278277{
    279278  Table t;
     
    303302}
    304303
    305 bool asap::STFrequencies::conformant( const STFrequencies& other ) const
     304bool STFrequencies::conformant( const STFrequencies& other ) const
    306305{
    307306  const Record& r = table_.keywordSet();
     
    314313}
    315314
    316 std::vector< std::string > asap::STFrequencies::getInfo( ) const
     315std::vector< std::string > STFrequencies::getInfo( ) const
    317316{
    318317  const Record& r = table_.keywordSet();
     
    324323}
    325324
    326 void asap::STFrequencies::setInfo( const std::vector< std::string >& theinfo )
     325void STFrequencies::setInfo( const std::vector< std::string >& theinfo )
    327326{
    328327  if ( theinfo.size() != 3 ) throw(AipsError("setInfo needs three parameters"));
     
    336335}
    337336
    338 void asap::STFrequencies::setUnit( const std::string & unit )
     337void STFrequencies::setUnit( const std::string & unit )
    339338{
    340339  if (unit == "" || unit == "pixel" || unit == "channel" ) {
     
    350349}
    351350
    352 void asap::STFrequencies::setFrame(MFrequency::Types frame, bool base )
     351void STFrequencies::setFrame(MFrequency::Types frame, bool base )
    353352{
    354353  String f = MFrequency::showType(frame);
     
    360359}
    361360
    362 void asap::STFrequencies::setFrame( const std::string & frame, bool base )
     361void STFrequencies::setFrame( const std::string & frame, bool base )
    363362{
    364363  MFrequency::Types mdr;
     
    380379}
    381380
    382 void asap::STFrequencies::setDoppler( const std::string & doppler )
     381void STFrequencies::setDoppler( const std::string & doppler )
    383382{
    384383  MDoppler::Types mdt;
     
    397396}
    398397
     398void STFrequencies::shiftRefPix(int npix, uInt id)
     399{
     400  Table t = table_(table_.col("ID") == Int(id) );
     401  if ( t.nrow() == 0 ) throw(AipsError("Selected Illegal frequency id"));
     402  ScalarColumn<Double> tcol(t, "REFPIX");
     403  tcol.put(0, tcol(0)+Double(npix));
     404}
    399405
    400406} // namespace
  • trunk/src/STFrequencies.h

    r1353 r1360  
    134134  float getRefFreq(casa::uInt id, casa::uInt channel);
    135135
    136 
    137136  /**
    138    * Rteun this table or s specific row as a string representation
     137    * shift the reference pixel by an integer amount
     138    * @param npix the shift in pixels
     139    * @param id the coordinate id
     140    */
     141  void shiftRefPix(int npix, casa::uInt id);
     142  /**
     143   * Return this table or s specific row as a string representation
    139144   * @param id the identifier. If id<0 all rows are returned
    140145   * @return a string
  • trunk/src/Scantable.cpp

    r1334 r1360  
    330330}
    331331
    332 void asap::Scantable::setSourceType( int stype )
     332void Scantable::setSourceType( int stype )
    333333{
    334334  if ( stype < 0 || stype > 1 )
     
    533533    return int(n);
    534534  } else {
    535     // take the first SCANNO,POLNO,BEAMNO,CYCLENO as nbeam shouldn't vary with these
     535    // take the first SCANNO,POLNO,BEAMNO,CYCLENO as nbeam shouldn't
     536    // vary with these
    536537    Table t = table_(table_.col("IFNO") == ifno);
    537538    if ( t.nrow() == 0 ) return 0;
     
    702703}
    703704
    704 void asap::Scantable::setSpectrum( const std::vector<float>& spec,
     705void Scantable::setSpectrum( const std::vector<float>& spec,
    705706                                   int whichrow )
    706707{
     
    867868}
    868869
    869 std::vector< double > asap::Scantable::getAbcissa( int whichrow ) const
     870std::vector< double > Scantable::getAbcissa( int whichrow ) const
    870871{
    871872  if ( whichrow > int(table_.nrow()) ) throw(AipsError("Illegal ro number"));
     
    902903  return stlout;
    903904}
    904 void asap::Scantable::setDirectionRefString( const std::string & refstr )
     905void Scantable::setDirectionRefString( const std::string & refstr )
    905906{
    906907  MDirection::Types mdt;
     
    916917}
    917918
    918 std::string asap::Scantable::getDirectionRefString( ) const
     919std::string Scantable::getDirectionRefString( ) const
    919920{
    920921  return table_.keywordSet().asString("DIRECTIONREF");
     
    959960}
    960961
    961 void asap::Scantable::setRestFrequencies( double rf, const std::string& name,
     962void Scantable::setRestFrequencies( double rf, const std::string& name,
    962963                                          const std::string& unit )
    963964{
     
    970971}
    971972
    972 void asap::Scantable::setRestFrequencies( const std::string& name )
     973void Scantable::setRestFrequencies( const std::string& name )
    973974{
    974975  throw(AipsError("setRestFrequencies( const std::string& name ) NYI"));
     
    976977}
    977978
    978 std::vector< unsigned int > asap::Scantable::rownumbers( ) const
     979std::vector< unsigned int > Scantable::rownumbers( ) const
    979980{
    980981  std::vector<unsigned int> stlout;
     
    985986
    986987
    987 Matrix<Float> asap::Scantable::getPolMatrix( uInt whichrow ) const
     988Matrix<Float> Scantable::getPolMatrix( uInt whichrow ) const
    988989{
    989990  ROTableRow row(table_);
     
    998999}
    9991000
    1000 std::vector< std::string > asap::Scantable::columnNames( ) const
     1001std::vector< std::string > Scantable::columnNames( ) const
    10011002{
    10021003  Vector<String> vec = table_.tableDesc().columnNames();
     
    10041005}
    10051006
    1006 casa::MEpoch::Types asap::Scantable::getTimeReference( ) const
     1007MEpoch::Types Scantable::getTimeReference( ) const
    10071008{
    10081009  return MEpoch::castType(timeCol_.getMeasRef().getType());
    10091010}
    10101011
    1011 void Scantable::addFit( const STFitEntry & fit, int row )
     1012void Scantable::addFit( const STFitEntry& fit, int row )
    10121013{
    10131014  cout << mfitidCol_(uInt(row)) << endl;
     
    10161017}
    10171018
     1019void Scantable::shift(int npix)
     1020{
     1021  Vector<uInt> fids(mfreqidCol_.getColumn());
     1022  genSort( fids, Sort::Ascending,
     1023           Sort::QuickSort|Sort::NoDuplicates );
     1024  for (uInt i=0; i<fids.nelements(); ++i) {
     1025    frequencies().shiftRefPix(npix, i);
     1026  }
     1027}
    10181028
    10191029}
  • trunk/src/Scantable.h

    r1350 r1360  
    356356  void setRestFrequencies(const std::string& name);
    357357
     358  void shift(int npix);
     359
    358360  void convertDirection(const std::string& newframe);
    359361
  • trunk/src/ScantableWrapper.h

    r1350 r1360  
    150150    { table_->setSourceType(stype); }
    151151
     152  void shift(int npix)
     153  { table_->shift(npix); }
     154
    152155  void setRestFrequencies(double rf, const std::string& name,
    153156                          const std::string& unit)
  • trunk/src/python_Scantable.cpp

    r1350 r1360  
    108108    .def("_getrestfreqs",  &ScantableWrapper::getRestFrequencies)
    109109    .def("_setrestfreqs",  &ScantableWrapper::setRestFrequencies)
     110    .def("shift_refpix", &ScantableWrapper::shift)
    110111    .def("_setcoordinfo", &ScantableWrapper::setCoordInfo)
    111112    .def("_getcoordinfo", &ScantableWrapper::getCoordInfo)
Note: See TracChangeset for help on using the changeset viewer.