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

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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:
Note: See TracChangeset for help on using the changeset viewer.