Changeset 957


Ignore:
Timestamp:
03/31/06 17:01:45 (18 years ago)
Author:
mar637
Message:

Polarisation changes according to Ticket #8; Fix Ticket #10

Location:
trunk/src
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/STFocus.cpp

    r896 r957  
    3737{
    3838  rotationCol_.attach(table_,"ROTATION");
    39   angleCol_.attach(table_,"ANGLE");
     39  axisCol_.attach(table_,"AXIS");
    4040  tanCol_.attach(table_,"TAN");
     41  handCol_.attach(table_,"HAND");
     42  userCol_.attach(table_,"USERPHASE");
     43  mountCol_.attach(table_,"MOUNT");
     44  xyphCol_.attach(table_,"XYPHASE");
     45  xyphoffCol_.attach(table_,"XYPHASEOFFSET");
    4146}
    4247
     
    5055    static_cast<STSubTable&>(*this) = other;
    5156    rotationCol_.attach(table_,"ROTATION");
    52     angleCol_.attach(table_,"ANGLE");
     57    axisCol_.attach(table_,"AXIS");
    5358    tanCol_.attach(table_,"TAN");
     59    handCol_.attach(table_,"HAND");
     60    userCol_.attach(table_,"USERPHASE");
     61    mountCol_.attach(table_,"MOUNT");
     62    xyphCol_.attach(table_,"XYPHASE");
     63    xyphoffCol_.attach(table_,"XYPHASEOFFSET");
    5464  }
    5565  return *this;
     
    5969  // add to base class table
    6070  table_.addColumn(ScalarColumnDesc<Float>("ROTATION"));
    61   table_.addColumn(ScalarColumnDesc<Float>("ANGLE"));
     71  table_.addColumn(ScalarColumnDesc<Float>("AXIS"));
    6272  table_.addColumn(ScalarColumnDesc<Float>("TAN"));
     73  table_.addColumn(ScalarColumnDesc<Float>("HAND"));
     74  table_.addColumn(ScalarColumnDesc<Float>("USERPHASE"));
     75  table_.addColumn(ScalarColumnDesc<Float>("MOUNT"));
     76  table_.addColumn(ScalarColumnDesc<Float>("XYPHASE"));
     77  table_.addColumn(ScalarColumnDesc<Float>("XYPHASEOFFSET"));
    6378
    6479  // new cached columns
    6580  rotationCol_.attach(table_,"ROTATION");
    66   angleCol_.attach(table_,"ANGLE");
     81  axisCol_.attach(table_,"AXIS");
    6782  tanCol_.attach(table_,"TAN");
     83  handCol_.attach(table_,"HAND");
     84  userCol_.attach(table_,"USERPHASE");
     85  mountCol_.attach(table_,"MOUNT");
     86  xyphCol_.attach(table_,"XYPHASE");
     87  xyphoffCol_.attach(table_,"XYPHASEOFFSET");
    6888}
    6989
    70 uInt STFocus::addEntry( Float rotation, Float angle, Float ftan)
     90uInt STFocus::addEntry( Float fax, Float ftan, Float frot, Float hand,
     91                        Float user, Float mount,
     92                        Float xyphase, Float xyphaseoffset)
    7193{
    72   Table result = table_( near(table_.col("ROTATION"), rotation)
    73                     && near(table_.col("ANGLE"), angle)
    74                     && near(table_.col("TAN"), ftan) );
     94  Table result = table_( near(table_.col("ROTATION"), frot)
     95                    && near(table_.col("AXIS"), fax)
     96                    && near(table_.col("TAN"), ftan)
     97                    && near(table_.col("HAND"), hand)
     98                    && near(table_.col("USERPHASE"), user)
     99                    && near(table_.col("MOUNT"), mount)
     100                    && near(table_.col("XYPHASE"), xyphase)
     101                    && near(table_.col("XYPHASEOFFSET"), xyphaseoffset)
     102                    );
    75103  uInt resultid = 0;
    76104  if ( result.nrow() > 0) {
     
    85113      resultid++;
    86114    }
    87     rotationCol_.put(rno, rotation);
    88     angleCol_.put(rno, angle);
     115    rotationCol_.put(rno, frot);
     116    axisCol_.put(rno, fax);
    89117    tanCol_.put(rno, ftan);
     118    handCol_.put(rno, hand);
     119    userCol_.put(rno, user);
     120    mountCol_.put(rno, mount);
     121    xyphCol_.put(rno, xyphase);
     122    xyphoffCol_.put(rno, xyphaseoffset);
    90123    idCol_.put(rno, resultid);
    91124  }
     
    94127
    95128void asap::STFocus::getEntry( Float& rotation, Float& angle, Float& ftan,
     129                              Float& hand, Float& user, Float& mount,
     130                              Float& xyphase, Float& xyphaseoffset,
    96131                              uInt id) const
    97132{
     
    104139  const TableRecord& rec = row.get(0);
    105140  rotation = rec.asFloat("ROTATION");
    106   angle = rec.asFloat("ANGLE");
     141  angle = rec.asFloat("AXIS");
    107142  ftan = rec.asFloat("TAN");
     143  hand = rec.asFloat("HAND");
     144  user = rec.asFloat("USERPHASE");
     145  mount = rec.asFloat("MOUNT");
     146  xyphase = rec.asFloat("XYPHASE");
     147  xyphaseoffset = rec.asFloat("XYPHASEOFFSET");
    108148}
    109149
    110150
     151casa::Float asap::STFocus::getTotalFeedAngle( casa::uInt id ) const
     152{
     153  Float total = 0.0f;
     154  Table t = table_(table_.col("ID") == Int(id) );
     155  if (t.nrow() == 0 ) {
     156    throw(AipsError("STFocus::getEntry - id out of range"));
     157  }
     158  ROTableRow row(t);
     159  // get first row - there should only be one matching id
     160  const TableRecord& rec = row.get(0);
     161  total += rec.asFloat("ROTATION");
     162  total += rec.asFloat("USERPHASE");
     163  total += rec.asFloat("MOUNT");
     164  return total;
    111165}
     166}
     167
     168casa::Float asap::STFocus::getFeedHand( casa::uInt id ) const
     169{
     170  Table t = table_(table_.col("ID") == Int(id) );
     171  if (t.nrow() == 0 ) {
     172    throw(AipsError("STFocus::getEntry - id out of range"));
     173  }
     174  ROTableRow row(t);
     175  const TableRecord& rec = row.get(0);
     176  return rec.asFloat("HAND");
     177}
     178
  • trunk/src/STFocus.h

    r896 r957  
    3737  STFocus& operator=(const STFocus& other);
    3838
    39   casa::uInt addEntry( casa::Float rotation, casa::Float angle,
    40                        casa::Float ftan);
     39  casa::uInt addEntry( casa::Float faxis, casa::Float ftan,
     40                       casa::Float frot, casa::Float hand=1.0f,
     41                       casa::Float mount=0.0f, casa::Float user=0.0f,
     42                       casa::Float xyphase=0.0f, casa::Float xyphaseoffset=0.0f);
    4143
    42   void getEntry( casa::Float& rotation, casa::Float& angle,
    43                        casa::Float& ftan, casa::uInt id) const;
     44  void getEntry( casa::Float& fax, casa::Float& ftan,
     45                 casa::Float& frot, casa::Float& hand,
     46                 casa::Float& mount, casa::Float& user,
     47                 casa::Float& xyphase, casa::Float& xyphaseoffset,
     48                 casa::uInt id) const;
     49
     50  casa::Float getTotalFeedAngle(casa::uInt id) const;
     51  casa::Float getFeedHand(casa::uInt id) const;
    4452
    4553  const casa::String& name() const { return name_; }
     
    4856  void setup();
    4957  static const casa::String name_;
    50   //casa::Table table_;
    51   //casa::ScalarColumn<casa::uInt> freqidCol_;
    52   casa::ScalarColumn<casa::Float> rotationCol_, angleCol_,
    53                                   tanCol_;
     58  casa::ScalarColumn<casa::Float> rotationCol_, axisCol_,
     59                                  tanCol_,handCol_,
     60                                  mountCol_,userCol_,
     61                                  xyphCol_,xyphoffCol_;
    5462};
    5563
  • trunk/src/STPol.h

    r904 r957  
    5252      else if ( mode == "linpol" )
    5353        return getLinPol(index);
    54       else if ( mode == "cicular" )
    55         return getLinPol(index);
     54      else if ( mode == "circular" )
     55        return getCircular(index);
    5656      else
    5757        throw(casa::AipsError("Polarisation type unknown"));
     
    8282    { basespectra_.resize(); basespectra_ = spec; }
    8383
    84   void setPhaseCorrections(casa::Float, casa::Float, casa::Float) {}
     84
     85  void setPhaseCorrections(casa::Float parangle=0.0, casa::Float totalfeed=0.0,
     86                           casa::Float feedhand=1.0)
     87    { totalfeed_=totalfeed;parangle_=parangle;feedhand_=feedhand;}
     88
     89  casa::Float getTotalPhase() const { return totalfeed_+parangle_; }
     90  casa::Float getFeedHand() const { return feedhand_; }
    8591
    8692  static std::pair<int, std::string> polFromString(const std::string& key);
     
    9399  static std::map<std::string, std::map<int, std::string> > labelmap_;
    94100
    95   casa::Vector<casa::Float> phaseCorrections_;
     101  casa::Float totalfeed_,parangle_,feedhand_;
    96102  std::string mode_;
    97103  casa::Matrix<casa::Float> basespectra_;
  • trunk/src/STPolLinear.cpp

    r911 r957  
    3030Vector<Float> asap::STPolLinear::getStokes( uint index )
    3131{
    32   cout << "debug asap::STPolLinear::getStokes" << endl;
    3332  if ( index < 0 || index >4 ) throw(AipsError("Stokes index out of range"));
    3433  Vector<Float> out;
    35   cout << nspec() << endl;
     34  Float phase = getTotalPhase();
     35  Vector<Float> q(getSpectrum(0) - getSpectrum(1));
    3636  if ( nspec() == 4 ) {
    3737    switch(index) {
    3838      case 0:
    39         out = Vector<Float>(getSpectrum(0) + getSpectrum(1)) * Float(0.5);
     39        out = Vector<Float>(getSpectrum(0) + getSpectrum(1));
    4040        break;
    4141      case 1:
    42         out = Vector<Float>(getSpectrum(0) - getSpectrum(1)) * Float(0.5);
     42        out = Vector<Float>(q * cos(phase) - getSpectrum(2) * sin(phase));
    4343        break;
    44       default:
    45         out =Vector<Float>(getSpectrum(index));
     44      case 2:
     45        out = Vector<Float>(q * sin(phase) + getSpectrum(2) * cos(phase));
     46        break;
     47      case 3:
     48        cout << getFeedHand() << endl;
     49        out = getFeedHand() * Vector<Float>(getSpectrum(3));
     50        break;
    4651    }
    4752  }
     
    5257{
    5358  if ( index < 0 || index >4 ) throw(AipsError("LinPol index out of range"));
    54   Vector<Float> out,q;
     59  Vector<Float> out,q,u;
    5560  if ( nspec() == 4) {
    5661    switch(index) {
    5762      case 1:
    58         q = getStokes(index);
    59         out = Vector<Float>(sqrt(pow(q,Float(2.0))+pow(getSpectrum(2), Float(2.0))));
     63        q = getStokes(1);
     64        u = getStokes(2);
     65        out = Vector<Float>(sqrt(pow(q,Float(2.0))+pow(u, Float(2.0))));
    6066        break;
    6167      case 2:
    6268        q = getStokes(index);
    63         out = Vector<Float>(Float(180.0/C::pi/2.0) * atan2(getSpectrum(2),q));
     69        u = getStokes(2);
     70        out = Vector<Float>(Float(180.0/C::pi/2.0) * atan2(u,q));
    6471        break;
    6572      default:
     
    8895  switch(index) {
    8996  case 0:
    90     out = (I + V)/Float(2.0);
     97    out = (I + V);
    9198    break;
    9299  case 1:
    93     out = (I - V)/Float(2.0);
     100    out = (I - V);
    94101    break;
    95102  default:
  • trunk/src/STPolStokes.cpp

    r910 r957  
    5656Vector<Float> asap::STPolStokes::getLinear(uInt index )
    5757{
    58   cout << "test" << endl;
    5958  Vector<Float> out;
    6059  switch(index) {
     
    8180  switch(index) {
    8281  case 0:
    83     out = (getSpectrum(0) + getSpectrum(3))/Float(2.0);
     82    out = (getSpectrum(0) + getSpectrum(3));
    8483    break;
    8584  case 1:
    86     out = (getSpectrum(0) - getSpectrum(3))/Float(2.0);
     85    out = (getSpectrum(0) - getSpectrum(3));
    8786    break;
    8887  default:
Note: See TracChangeset for help on using the changeset viewer.