Changeset 2639 for trunk/src


Ignore:
Timestamp:
08/09/12 16:09:09 (12 years ago)
Author:
Takeshi Nakazato
Message:

New Development: No

JIRA Issue: Yes CAS-2825

Ready for Test: Yes

Interface Changes: No

What Interface Changed: Please list interface changes

Test Programs: not available

Put in Release Notes: No

Module(s): Module Names change impacts.

Description: Describe your changes here...

Correct DEC correction on R.A.


Location:
trunk/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/GenericEdgeDetector.cpp

    r2637 r2639  
    1717#include <casa/Arrays/ArrayIO.h>
    1818#include <casa/Utilities/GenSort.h>
     19
     20#include <coordinates/Coordinates/DirectionCoordinate.h>
    1921
    2022#include "GenericEdgeDetector.h"
     
    99101
    100102  setup() ;
     103  // using DirectionCoordinate
     104  Matrix<Double> xform(2,2) ;
     105  xform = 0.0 ;
     106  xform.diagonal() = 1.0 ;
     107  DirectionCoordinate coord( MDirection::J2000,
     108                             Projection( Projection::SIN ),
     109                             cenx_, ceny_,
     110                             dx_, dy_,
     111                             xform,
     112                             0.5*Double(nx_-1),
     113                             0.5*Double(ny_-1) ) ;
    101114  Double *pdir_p = new Double[dir_.nelements()] ;
    102115  pdir_.takeStorage( dir_.shape(), pdir_p, TAKE_OVER ) ;
    103116  uInt len = time_.nelements() ;
    104117  Bool b ;
    105   Double *px_p = pdir_p ;
    106   Double *py_p = pdir_p + 1 ;
    107   const Double *dir_p = dir_.getStorage( b ) ;
    108   const Double *x_p = dir_p ;
    109   const Double *y_p = dir_p + 1 ;
     118  Double *dir_p = dir_.getStorage( b ) ;
     119  Double *wdir_p = dir_p ;
     120  Vector<Double> world ;
     121  Vector<Double> pixel ;
     122  IPosition vshape( 1, 2 ) ;
    110123  for ( uInt i = 0 ; i < len ; i++ ) {
    111     *px_p = pcenx_ + ( *x_p - cenx_ ) / dx_ ;
    112     *py_p = pceny_ + ( *y_p - ceny_ ) / dy_ ;
    113     px_p += 2 ;
    114     py_p += 2 ;
    115     x_p += 2 ;
    116     y_p += 2 ;
    117   }
    118   dir_.freeStorage( dir_p, b ) ;
     124    world.takeStorage( vshape, wdir_p, SHARE ) ;
     125    pixel.takeStorage( vshape, pdir_p, SHARE ) ;
     126    coord.toPixel( pixel, world ) ;
     127    pdir_p += 2 ;
     128    wdir_p += 2 ;
     129  }
     130  dir_.putStorage( dir_p, b ) ;
    119131}
    120132
     
    131143  cenx_ = 0.5 * ( xmin + xmax ) ;
    132144  ceny_ = 0.5 * ( ymin + ymax ) ;
    133   decCorr_ = 1.0 / cos( ceny_ ) ;
     145  Double decCorr = cos( ceny_ ) ;
    134146
    135147  uInt len = time_.nelements() ;
    136148  Matrix<Double> dd = dir_.copy() ;
    137149  for ( uInt i = len-1 ; i > 0 ; i-- ) {
    138     dd(0,i) = ( dd(0,i) - dd(0,i-1) ) * decCorr_ ;
     150    //dd(0,i) = ( dd(0,i) - dd(0,i-1) ) * decCorr ;
     151    dd(0,i) = ( dd(0,i) - dd(0,i-1) ) * cos( 0.5*(dd(1,i-1)+dd(1,i)) ) ;
    139152    dd(1,i) = dd(1,i) - dd(1,i-1) ;
    140153  }
     
    152165  Double med = median( dr, False, True, True ) ;
    153166  dy_ = med * width_ ;
    154   dx_ = dy_ * decCorr_ ;
     167  dx_ = dy_ / decCorr ;
    155168
    156169  nx_ = uInt( ceil( wx / dx_ ) ) ;
  • trunk/src/GenericEdgeDetector.h

    r2632 r2639  
    6262  casa::Double dx_ ;
    6363  casa::Double dy_ ;
    64   casa::Double decCorr_ ;
    6564 
    6665  // storage for detection
Note: See TracChangeset for help on using the changeset viewer.