Changeset 338 for trunk/src/SDReader.cc


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

add brightness unit to constructor

File:
1 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_;
Note: See TracChangeset for help on using the changeset viewer.