Changeset 204


Ignore:
Timestamp:
01/18/05 17:22:47 (20 years ago)
Author:
mar637
Message:
  • added fluxunit, epoch
  • added restfrequencies
  • added history
  • now using asap::AxisNo enum instead of fixed axis indeces
Location:
trunk/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/SDContainer.cc

    r125 r204  
    3737#include <casa/Quanta/MVTime.h>
    3838
     39#include "Definitions.h"
    3940#include "SDContainer.h"
    4041
     
    121122                              uInt whichBeam, uInt whichIF) {
    122123
    123   ArrayAccessor<Float, Axis<0> > aa0(spectrum_);
     124  ArrayAccessor<Float, Axis<asap::BeamAxis> > aa0(spectrum_);
    124125  aa0.reset(aa0.begin(whichBeam));
    125   ArrayAccessor<Float, Axis<1> > aa1(aa0);
     126  ArrayAccessor<Float, Axis<asap::IFAxis> > aa1(aa0);
    126127  aa1.reset(aa1.begin(whichIF));
    127128 
    128129  //Vector<Float> pols(nPol);
    129   ArrayAccessor<Float, Axis<1> > j(spec);
     130  ArrayAccessor<Float, Axis<asap::IFAxis> > j(spec);
    130131  IPosition shp0 = spectrum_.shape();
    131132  IPosition shp1 = spec.shape();
     
    135136  }
    136137  // assert dimensions are the same....
    137   for (ArrayAccessor<Float, Axis<2> > i(aa1);i != i.end(); ++i) {
    138     ArrayAccessor<Float, Axis<0> > jj(j);
    139     for (ArrayAccessor<Float, Axis<3> > ii(i);ii != ii.end(); ++ii) {
     138  for (ArrayAccessor<Float, Axis<asap::PolAxis> > i(aa1);i != i.end(); ++i) {
     139    ArrayAccessor<Float, Axis<asap::BeamAxis> > jj(j);
     140    for (ArrayAccessor<Float, Axis<asap::ChanAxis> > ii(i);ii != ii.end(); ++ii) {
    140141      (*ii) = (*jj);
    141142      jj++;
     
    156157                           uInt whichBeam, uInt whichIF) {
    157158
    158   ArrayAccessor<uChar, Axis<0> > aa0(flags_);
     159  ArrayAccessor<uChar, Axis<asap::BeamAxis> > aa0(flags_);
    159160  aa0.reset(aa0.begin(whichBeam));
    160   ArrayAccessor<uChar, Axis<1> > aa1(aa0);
     161  ArrayAccessor<uChar, Axis<asap::IFAxis> > aa1(aa0);
    161162  aa1.reset(aa1.begin(whichIF));
    162163 
    163   ArrayAccessor<uChar, Axis<1> > j(flag);
     164  ArrayAccessor<uChar, Axis<asap::IFAxis> > j(flag);
    164165  IPosition shp0 = flags_.shape();
    165166  IPosition shp1 = flag.shape();
     
    170171
    171172  // assert dimensions are the same....
    172   for (ArrayAccessor<uChar, Axis<2> > i(aa1);i != i.end(); ++i) {
    173     ArrayAccessor<uChar, Axis<0> > jj(j);
    174     for (ArrayAccessor<uChar, Axis<3> > ii(i);ii != ii.end(); ++ii) {
     173  for (ArrayAccessor<uChar, Axis<asap::PolAxis> > i(aa1);i != i.end(); ++i) {
     174    ArrayAccessor<uChar, Axis<asap::BeamAxis> > jj(j);
     175    for (ArrayAccessor<uChar, Axis<asap::ChanAxis> > ii(i);ii != ii.end(); ++ii) {
    175176      (*ii) = (*jj);
    176177      jj++;
     
    183184Bool SDContainer::setTsys(const Vector<Float>& tsys,
    184185                          uInt whichBeam, uInt whichIF) {
    185   ArrayAccessor<Float, Axis<0> > aa0(tsys_);
     186  ArrayAccessor<Float, Axis<asap::BeamAxis> > aa0(tsys_);
    186187  aa0.reset(aa0.begin(whichBeam));
    187   ArrayAccessor<Float, Axis<1> > aa1(aa0);
     188  ArrayAccessor<Float, Axis<asap::IFAxis> > aa1(aa0);
    188189  aa1.reset(aa1.begin(whichIF));
    189190  // assert dimensions are the same....
    190   for (ArrayAccessor<Float, Axis<3> > i(aa1);i != i.end(); ++i) {   
    191     ArrayAccessor<Float, Axis<0> > j(tsys);
    192     for (ArrayAccessor<Float, Axis<2> > ii(i);ii != ii.end(); ++ii) {
     191  for (ArrayAccessor<Float, Axis<asap::ChanAxis> > i(aa1);i != i.end(); ++i) {   
     192    ArrayAccessor<Float, Axis<asap::BeamAxis> > j(tsys);
     193    for (ArrayAccessor<Float, Axis<asap::PolAxis> > ii(i);ii != ii.end(); ++ii) {
    193194      (*ii) = (*j);
    194195      j++;
     
    202203
    203204  // Beam.
    204   ArrayAccessor<Float, Axis<0> > i0(spectrum_);
     205  ArrayAccessor<Float, Axis<asap::BeamAxis> > i0(spectrum_);
    205206  i0.reset(i0.begin(whichBeam));
    206207
    207208  // IF.
    208   ArrayAccessor<Float, Axis<1> > i1(i0);
     209  ArrayAccessor<Float, Axis<asap::IFAxis> > i1(i0);
    209210  i1.reset(i1.begin(whichIF));
    210211
    211212  // Polarization.
    212   ArrayAccessor<Float, Axis<2> > i2(i1);
    213   ArrayAccessor<Float, Axis<1> > o1(spectra);
     213  ArrayAccessor<Float, Axis<asap::PolAxis> > i2(i1);
     214  ArrayAccessor<Float, Axis<asap::IFAxis> > o1(spectra);
    214215
    215216  while (i2 != i2.end()) {
    216217    // Channel.
    217     ArrayAccessor<Float, Axis<3> > i3(i2);
    218     ArrayAccessor<Float, Axis<0> > o0(o1);
     218    ArrayAccessor<Float, Axis<asap::ChanAxis> > i3(i2);
     219    ArrayAccessor<Float, Axis<asap::BeamAxis> > o0(o1);
    219220
    220221    while (i3 != i3.end()) {
     
    238239
    239240  // Beam.
    240   ArrayAccessor<uChar, Axis<0> > i0(flags_);
     241  ArrayAccessor<uChar, Axis<asap::BeamAxis> > i0(flags_);
    241242  i0.reset(i0.begin(whichBeam));
    242243
    243244  // IF.
    244   ArrayAccessor<uChar, Axis<1> > i1(i0);
     245  ArrayAccessor<uChar, Axis<asap::IFAxis> > i1(i0);
    245246  i1.reset(i1.begin(whichIF));
    246247
    247248  // Polarization.
    248   ArrayAccessor<uChar, Axis<2> > i2(i1);
    249   ArrayAccessor<uChar, Axis<1> > o1(flagtra);
     249  ArrayAccessor<uChar, Axis<asap::PolAxis> > i2(i1);
     250  ArrayAccessor<uChar, Axis<asap::IFAxis> > o1(flagtra);
    250251
    251252  while (i2 != i2.end()) {
    252253    // Channel.
    253     ArrayAccessor<uChar, Axis<3> > i3(i2);
    254     ArrayAccessor<uChar, Axis<0> > o0(o1);
     254    ArrayAccessor<uChar, Axis<asap::ChanAxis> > i3(i2);
     255    ArrayAccessor<uChar, Axis<asap::BeamAxis> > o0(o1);
    255256
    256257    while (i3 != i3.end()) {
     
    273274
    274275  // Beam.
    275   ArrayAccessor<Float, Axis<0> > i0(tsys_);
     276  ArrayAccessor<Float, Axis<asap::BeamAxis> > i0(tsys_);
    276277  i0.reset(i0.begin(whichBeam));
    277278
    278279  // IF.
    279   ArrayAccessor<Float, Axis<1> > i1(i0);
     280  ArrayAccessor<Float, Axis<asap::IFAxis> > i1(i0);
    280281  i1.reset(i1.begin(whichIF));
    281282
    282283  // Channel.
    283   ArrayAccessor<Float, Axis<3> > i3(i1);
     284  ArrayAccessor<Float, Axis<asap::ChanAxis> > i3(i1);
    284285
    285286  // Polarization.
    286   ArrayAccessor<Float, Axis<2> > i2(i3);
    287   ArrayAccessor<Float, Axis<0> > o0(tsys);
     287  ArrayAccessor<Float, Axis<asap::PolAxis> > i2(i3);
     288  ArrayAccessor<Float, Axis<asap::BeamAxis> > o0(tsys);
    288289
    289290  while (i2 != i2.end()) {
     
    298299Array<Double> SDContainer::getDirection(uInt whichBeam) const {
    299300  Vector<Double> direct(2);
    300   ArrayAccessor<Double, Axis<0> > i0(direction_);
     301  ArrayAccessor<Double, Axis<asap::BeamAxis> > i0(direction_);
    301302  i0.reset(i0.begin(whichBeam));
    302   ArrayAccessor<Double, Axis<0> > o0(direct);
    303   ArrayAccessor<Double, Axis<1> > i1(i0);
     303  ArrayAccessor<Double, Axis<asap::BeamAxis> > o0(direct);
     304  ArrayAccessor<Double, Axis<asap::IFAxis> > i1(i0);
    304305  while (i1 != i1.end()) {
    305306    *o0 = *i1;
     
    324325Bool SDContainer::setDirection(const Vector<Double>& point, uInt whichBeam) {
    325326  if (point.nelements() != 2) return False;
    326   ArrayAccessor<Double, Axis<0> > aa0(direction_);
     327  ArrayAccessor<Double, Axis<asap::BeamAxis> > aa0(direction_);
    327328  aa0.reset(aa0.begin(whichBeam));
    328   ArrayAccessor<Double, Axis<0> > jj(point);
    329   for (ArrayAccessor<Double, Axis<1> > i(aa0);i != i.end(); ++i) {
     329  ArrayAccessor<Double, Axis<asap::BeamAxis> > jj(point);
     330  for (ArrayAccessor<Double, Axis<asap::IFAxis> > i(aa0);i != i.end(); ++i) {
    330331   
    331332    (*i) = (*jj);
     
    338339  direction_.resize();
    339340  direction_ = dir;
     341  return True;
     342}
     343
     344Bool SDContainer::appendHistory(const String& hist)
     345{
     346  history_.resize(history_.nelements()+1,True);
     347  history_[history_.nelements()-1] = hist;
     348  return True;
     349}
     350Bool SDContainer::putHistory(const Vector<String>& hist)
     351{
     352  history_.resize();
     353  history_ = hist;
    340354  return True;
    341355}
     
    367381}
    368382
     383void SDFrequencyTable::addRestFrequency(Double val)
     384{
     385  if (restFreqs_.nelements()  == 0) {
     386    restFreqs_.resize(1);
     387    restFreqs_[0] = val;
     388  } else {
     389    Bool found = False;
     390    for (uInt i=0;i<restFreqs_.nelements();++i) {
     391      if (restFreqs_[i] == val) {
     392        found = True;
     393        return;
     394      }
     395    }
     396    if (!found) {
     397      restFreqs_.resize(restFreqs_.nelements()+1,True);
     398      restFreqs_[restFreqs_.nelements()-1] = val;
     399    }
     400  }
     401}
     402void SDFrequencyTable::restFrequencies(Vector<Double>& rfs,
     403                                       String& rfunit ) const
     404{
     405  rfs.resize(restFreqs_.nelements());
     406  rfs = restFreqs_;
     407  rfunit = restFreqUnit_;
     408}
  • trunk/src/SDContainer.h

    r125 r204  
    5959  casa::Double bandwidth;
    6060  casa::Double utc;
     61  casa::String fluxunit;
     62  casa::String epoch;
    6163  void print() const ;
    6264};
     
    7678  casa::Float equinox() const { return equinox_; }
    7779  casa::String refFrame() const { return refFrame_; }
     80  void restFrequencies(casa::Vector<casa::Double>& rfs,
     81                       casa::String& rfunit ) const ;
    7882
    7983  // returns the index into the table
     
    8387  void setEquinox(casa::Float eq) { equinox_ = eq; }
    8488  void setRefFrame(const casa::String& reff) { refFrame_ = reff; }
    85  
     89  void addRestFrequency(casa::Double);
     90  void setRestFrequencyUnit(const casa::String& theunit) {
     91    restFreqUnit_ = theunit;
     92  };
     93
    8694private:
    8795  casa::Int nFreq_;
     
    9199  casa::Float equinox_;
    92100  casa::String refFrame_;
     101  casa::Vector<casa::Double> restFreqs_;
     102  casa::String restFreqUnit_;
    93103};
    94104
     
    139149  const casa::Vector<casa::uInt>& getFreqMap() const { return freqidx_; }
    140150 
     151  const casa::Vector<casa::String>& getHistory() const { return history_; }
     152  casa::Bool putHistory(const casa::Vector<casa::String>& hist);
     153  casa::Bool appendHistory(const casa::String& hist);
     154
    141155  casa::Double timestamp;
    142156  //Double bandwidth;
     
    168182  //(nBeam,2) maybe use Measures here...
    169183  casa::Array<casa::Double>   direction_;
     184  casa::Vector<casa::String> history_;
    170185
    171186};
Note: See TracChangeset for help on using the changeset viewer.