Changeset 2865 for trunk


Ignore:
Timestamp:
11/07/13 18:42:23 (11 years ago)
Author:
Kana Sugimoto
Message:

New Development: No

JIRA Issue: Yes (CAS-4141)

Ready for Test: Yes

Interface Changes: Yes

What Interface Changed: Added a private function, STSideBandSep::shiftTimeInGriddedST()

Test Programs:

Put in Release Notes: No

Module(s): asap.sbseparator

Description: STSideBandSep::shiftTimeInGriddedST() an issue, direction of spectra are not properly resolved in gridded MS by shifting TIME value in scantable by direction.


Location:
trunk/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/STSideBandSep.cpp

    r2864 r2865  
    574574  const int itp = (tp_ == Table::Memory ? 0 : 1);
    575575  ScantableWrapper gtab = gridder.getResultAsScantable(itp);
     576  // WORKAROUND : Shift TIME for proper pointing resolution in future imaging.
     577  shiftTimeInGriddedST(gtab.getCP());
    576578  return gtab;
    577579};
     
    601603    ymin = min(ymin, bmin);
    602604    ymax = max(ymax, bmax);
     605  }
     606};
     607
     608// STGrid sets the identical time for all rows in scantable
     609// which is reasonable thing to do in position based averaging.
     610// However, this prevents CASA from finding proper pointing
     611// per spectra once the gridded scantable is converted to
     612// measurement set (MS). It is because MS does not
     613// have ability to store per spectra pointing information.
     614// MS stores pointing information in a subtable, POINTING,
     615// with corresponding TIME when an antenna pointed the direction.
     616// The pointing direction corresponding to a spectra is resolved
     617// in MS by interpolating DIRECTION in POINTING subtable in TIME
     618// the spectra is observed. If there are multiple match,
     619// the first match is adopted. Therefore, gridded table (whose TIME
     620// is set to a single value) is misunderstood in MS that all data
     621// come from a single pointing.
     622// The function workarounds this defect by artificially shifting
     623// TIME by INTERVAL in each row.
     624void STSideBandSep::shiftTimeInGriddedST(const CountedPtr<Scantable> &stab)
     625{
     626  LogIO os(LogOrigin("STSideBandSep", "shiftTimeInGriddedST()", WHERE));
     627  // Gridded table usually has an IF and a BEAM.
     628  {
     629    std::vector<uint> bmnos = stab->getBeamNos();
     630    if (bmnos.size() > 1)
     631      throw( AipsError("Multiple BEAMNOs found in the scantable. This may not a gridded table") );
     632    std::vector<uint> ifnos = stab->getIFNos();
     633    if (ifnos.size() > 1)
     634      throw( AipsError("Multiple IFNOs found in the scantable. This may not a gridded table") );
     635  }
     636  // Rows in gridded table usually sorted by DIRECTION
     637  const Table& tab = stab->table();
     638  ROScalarColumn<Double> mjdCol( tab, "TIME");
     639  ROScalarColumn<Double> intCol( tab, "INTERVAL");
     640  ROArrayColumn<Double> dirCol( tab, "DIRECTION");
     641  Matrix<Double> direction = dirCol.getColumn();
     642  Vector<Double> ra( direction.row(0) );
     643  Vector<Double> dec( direction.row(1) );
     644  Double prevTime, prevInt, prevRA(ra[0]), prevDec(dec[0]);
     645  mjdCol.get(0, prevTime);
     646  intCol.get(0, prevInt);
     647  Double currInt, currRA, currDec;
     648  Double dx(xtol_*0.95), dy(ytol_*0.95);
     649  Double secToDay(1./24./3600.);
     650  for (int irow = 0; irow < stab->nrow(); ++irow){
     651    currRA = ra[irow];
     652    currDec = dec[irow];
     653    if ((prevRA+dx-currRA)*(currRA-prevRA+dx)>=0 &&
     654        (prevDec+dy-currDec)*(currDec-prevDec+dy)>=0) {
     655      // the same time stamp as the previous row
     656      mjdCol.put(irow, prevTime);
     657      // remember the longest interval
     658      intCol.get(irow, currInt);
     659      if (currInt > prevInt) prevInt = currInt;
     660    } else {
     661      // a new direction. need to set new time stamp.
     662      prevTime += prevInt*secToDay;
     663      mjdCol.put(irow, prevTime);
     664      // new interval and direction
     665      intCol.get(irow, prevInt);
     666      prevRA = currRA;
     667      prevDec = currDec;
     668    }
    603669  }
    604670};
  • trunk/src/STSideBandSep.h

    r2853 r2865  
    114114                 Double &ymin, Double &ymax);
    115115
     116  /**
     117   * Shift TIME in gridded scantable for future imaging
     118   *
     119   * STGrid sets the identical time for all rows in scantable
     120   * which is reasonable thing to do in position based averaging.
     121   * However, this prevents CASA from finding proper pointing
     122   * per spectra once the gridded scantable is converted to
     123   * measurement set (MS). It is because MS does not
     124   * have ability to store per spectra pointing information.
     125   * MS stores pointing information in a subtable, POINTING,
     126   * with corresponding TIME when an antenna pointed the direction.
     127   * The pointing direction corresponding to a spectra is resolved
     128   * in MS by interpolating DIRECTION in POINTING subtable in TIME
     129   * the spectra is observed. If there are multiple match,
     130   * the first match is adopted. Therefore, gridded table (whose TIME
     131   * is set to a single value) is misunderstood in MS that all data
     132   * come from a single pointing.
     133   * The function workarounds this defect by artificially shifting
     134   * TIME by INTERVAL in each row.
     135   **/
     136  void shiftTimeInGriddedST(const CountedPtr<Scantable> &stab);
    116137  /**
    117138   * Actual calculation of frequencies of image sideband
Note: See TracChangeset for help on using the changeset viewer.