Changeset 338


Ignore:
Timestamp:
01/31/05 20:54:05 (20 years ago)
Author:
kil064
Message:

add brightness unit to constructor

Location:
trunk/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/SDReader.cc

    r337 r338  
    3232#include <casa/OS/Path.h>
    3333#include <casa/OS/File.h>
     34#include <casa/Quanta/Unit.h>
    3435#include <atnf/PKSIO/PKSreader.h>
    3536
     
    4546  cursor_ = 0;
    4647}
    47 SDReader::SDReader(const std::string& filename, int whichIF, int whichBeam) :
     48SDReader::SDReader(const std::string& filename, const std::string& unit,
     49                   int whichIF, int whichBeam) :
    4850  reader_(0),
    4951  table_(new SDMemTable()) {
    5052  cursor_ = 0;
    51   open(filename, whichIF, whichBeam);
     53  open(filename, unit, whichIF, whichBeam);
    5254}
    5355
     
    8688
    8789
    88 void SDReader::open(const std::string& filename, int whichIF, int whichBeam) {
     90void SDReader::open(const std::string& filename, const std::string& unit,
     91                    int whichIF, int whichBeam) {
    8992  if (reader_) delete reader_; reader_ = 0;
    9093  Bool   haveBase, haveSpectra, haveXPol;
     
    146149// Determine Telescope and set units...
    147150
    148   Bool throwIt = False;
    149   Instrument inst = SDMemTable::convertInstrument (header_.antennaname, throwIt);
    150   header_.fluxunit = "Jy";
    151   if (inst==ATMOPRA || inst==TIDBINBILLA) {
    152      header_.fluxunit = "K";
    153   }
    154   cerr << "Assuming brightness units are " << header_.fluxunit << endl;
     151  String sUnit(unit);
     152  if (sUnit.empty()) {
     153     Bool throwIt = False;
     154     Instrument inst = SDMemTable::convertInstrument (header_.antennaname, throwIt);
     155     header_.fluxunit = "Jy";
     156     if (inst==ATMOPRA || inst==TIDBINBILLA) {
     157        header_.fluxunit = "K";
     158     }
     159     cerr << "Assuming brightness unit is " << header_.fluxunit << endl;
     160   } else {
     161      Unit u(sUnit);
     162      if (u==Unit("Jy") || u==Unit("K")) {
     163         header_.fluxunit = unit;
     164         cerr << "Setting brightness unit to " << header_.fluxunit << endl;
     165      } else {
     166         throw(AipsError("Specified brightness unit is illegal - must be consistent with Jy or K"));
     167      }
     168   }
    155169//
    156170  header_.nif = nIF_;
  • trunk/src/SDReader.h

    r332 r338  
    5151public:
    5252  SDReader();
    53   SDReader(const std::string& filename, int whichIF=-1,
    54           int whichBeam=-1);
     53  SDReader(const std::string& filename, const std::string& unit,
     54           int whichIF=-1, int whichBeam=-1);
    5555  SDReader(casa::CountedPtr<SDMemTable> tbl);
    5656  virtual ~SDReader();
    5757
    5858  void open(const std::string& filename,
     59            const std::string& unit,
    5960            int whichIF=-1,
    6061            int whichBeam=-1);
  • trunk/src/SDReaderWrapper.h

    r332 r338  
    4343public:
    4444  SDReaderWrapper() {;}
    45   SDReaderWrapper(const std::string& filename, int ifSel=-1, int beamSel=-1) : SDReader(filename,ifSel,beamSel) {;}
     45  SDReaderWrapper(const std::string& filename, const std::string& unit,
     46                  int ifSel=-1, int beamSel=-1) : SDReader(filename,unit,ifSel,beamSel) {;}
    4647  SDReaderWrapper(SDMemTableWrapper tbl) :
    4748    SDReader(tbl.getCP()){;}
  • trunk/src/python_SDReader.cc

    r332 r338  
    4040    void python_SDReader() {
    4141      class_<SDReaderWrapper>("sdreader")
    42         .def( init < std::string, int, int > () )
     42        .def( init < std::string, string, int, int > () )
    4343        .def("open", &SDReaderWrapper::open)
    4444        .def("read", &SDReaderWrapper::read)
Note: See TracChangeset for help on using the changeset viewer.