Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/STGrid.h

    r2371 r2413  
    1919
    2020#include <casa/BasicSL/String.h>
     21#include <casa/Arrays/Array.h>
    2122#include <casa/Arrays/Vector.h>
    22 #include <casa/Arrays/Matrix.h>
    23 #include <casa/Arrays/Cube.h>
    24 // #include <casa/Arrays/ArrayMath.h>
    25 // #include <casa/Inputs/Input.h>
    26 // #include <casa/Quanta/Quantum.h>
    27 // #include <casa/Quanta/QuantumHolder.h>
    28 // #include <casa/Utilities/CountedPtr.h>
     23#include <casa/Containers/RecordField.h>
    2924
    3025#include <tables/Tables/Table.h>
    31 // #include <tables/Tables/ScalarColumn.h>
    32 // #include <tables/Tables/ArrayColumn.h>
    33 
    34 // #include <measures/Measures/MDirection.h>
    35 
    36 // #include "Scantable.h"
     26#include <tables/Tables/ScalarColumn.h>
     27#include <tables/Tables/ArrayColumn.h>
     28
     29#include "concurrent.h"
    3730
    3831using namespace std ;
     
    4538  STGrid() ;
    4639  STGrid( const string infile ) ;
     40  STGrid( const vector<string> infile ) ;
    4741  virtual ~STGrid() {} ;
    4842
    4943  void setFileIn( const string infile ) ;
     44  void setFileList( const vector<string> infile ) ;
    5045
    5146  void setIF( unsigned int ifno ) { ifno_ = ifno ; } ;
     
    6560  void setWeight( const string wType="uniform" ) ;
    6661
     62  void enableClip() { doclip_ = True ; } ;
     63  void disableClip() { doclip_ = False ; } ;
     64
    6765  void grid() ;
    6866 
     
    7270  void init() ;
    7371
     72  // actual gridding
     73  void gridPerRow() ;
     74  void gridPerRowWithClipping() ;
     75
     76  // clipping
     77  void clipMinMax( Array<Complex> &data,
     78                   Array<Float> &weight,
     79                   Array<Int> &npoints,
     80                   Array<Complex> &clipmin,
     81                   Array<Float> &clipwmin,
     82                   Array<Float> &clipcmin,
     83                   Array<Complex> &clipmax,
     84                   Array<Float> &clipwmax,
     85                   Array<Float> &clipcmax ) ;
     86                   
     87
     88  void setupGrid() ;
    7489  void setupGrid( Int &nx,
    7590                  Int &ny,
     
    8196                  Double &ymax,
    8297                  String &center ) ;
    83 
    84   void setData( Array<Float> &data,
    85                 Array<Float> &gdata,
     98  void mapExtent( Double &xmin, Double &xmax,
     99                  Double &ymin, Double &ymax ) ;
     100
     101  void setData( Array<Complex> &gdata,
    86102                Array<Float> &gwgt ) ;
    87103 
    88   void getData( Cube<Float> &spectra,
    89                 Matrix<Double> &direction,
    90                 Cube<uChar> &flagtra,
    91                 Matrix<uInt> &rflag,
    92                 Matrix<Float> &weight ) ;
    93 
    94   void getWeight( Matrix<Float> &w,
    95                   Cube<Float> &tsys,
    96                   Matrix<Double> &tint ) ;
    97 
    98   void toInt( Array<uChar> *u, Array<Int> *v ) ;
    99   void toInt( Array<uInt> *u, Array<Int> *v ) ;
    100 
    101   void toPixel( Matrix<Double> &world, Matrix<Double> &pixel ) ;
     104  Int getDataChunk( IPosition const &wshape,
     105                    IPosition const &vshape,
     106                    IPosition const &dshape,
     107                    Array<Complex> &spectra,
     108                    Array<Double> &direction,
     109                    Array<Int> &flagtra,
     110                    Array<Int> &rflag,
     111                    Array<Float> &weight ) ;
     112  Int getDataChunk( Array<Complex> &spectra,
     113                    Array<Double> &direction,
     114                    Array<Int> &flagtra,
     115                    Array<Int> &rflag,
     116                    Array<Float> &weight ) ;
     117  Int getDataChunk( Array<Float> &spectra,
     118                    Array<Double> &direction,
     119                    Array<uChar> &flagtra,
     120                    Array<uInt> &rflag,
     121                    Array<Float> &weight ) ;
     122
     123  void getWeight( Array<Float> &w,
     124                  Array<Float> &tsys,
     125                  Array<Double> &tint ) ;
     126 
     127  void toInt( Array<uChar> &u, Array<Int> &v ) ;
     128  void toInt( Array<uInt> &u, Array<Int> &v ) ;
     129
     130  void toPixel( Array<Double> &world, Array<Double> &pixel ) ;
    102131 
    103132  void boxFunc( Vector<Float> &convFunc, Int &convSize ) ;
     
    106135  void pbFunc( Vector<Float> &convFunc ) ;
    107136  void setConvFunc( Vector<Float> &convFunc ) ;
    108   void selectData( Table &tab ) ;
    109 
    110   Float polMean( const Float *p ) ;
    111   Double polMean( const Double *p ) ;
    112 
    113   void updatePolList( Table &tab ) ;
    114137
    115138  void prepareTable( Table &tab, String &name ) ;
    116139
    117   String infile_ ;
     140  void selectData() ;
     141  void setupArray() ;
     142
     143  void updateChunkShape() ;
     144  void attach( Table &tab ) ;
     145
     146  void call_ggridsd( Array<Double> &xy,
     147                     Array<Complex> &values,
     148                     Int &nvispol,
     149                     Int &nvischan,
     150                     Array<Int> &flag,
     151                     Array<Int> &rflag,
     152                     Array<Float> &weight,
     153                     Int &nrow,
     154                     Int &irow,
     155                     Array<Complex> &grid,
     156                     Array<Float> &wgrid,
     157                     Int &nx,
     158                     Int &ny,
     159                     Int &npol,
     160                     Int &nchan,
     161                     Int &support,
     162                     Int &sampling,
     163                     Vector<Float> &convFunc,
     164                     Int *chanMap,
     165                     Int *polMap ) ;
     166  void call_ggridsd2( Array<Double> &xy,
     167                      Array<Complex> &values,
     168                      Int &nvispol,
     169                      Int &nvischan,
     170                      Array<Int> &flag,
     171                      Array<Int> &rflag,
     172                      Array<Float> &weight,
     173                      Int &nrow,
     174                      Int &irow,
     175                      Array<Complex> &grid,
     176                      Array<Float> &wgrid,
     177                      Array<Int> &npoints,
     178                      Array<Complex> &clipmin,
     179                      Array<Float> &clipwmin,
     180                      Array<Float> &clipcmin,
     181                      Array<Complex> &clipmax,
     182                      Array<Float> &clipwmax,
     183                      Array<Float> &clipcmax,
     184                      Int &nx,
     185                      Int &ny,
     186                      Int &npol,
     187                      Int &nchan,
     188                      Int &support,
     189                      Int &sampling,
     190                      Vector<Float> &convFunc,
     191                      Int *chanMap,
     192                      Int *polMap ) ;
     193
     194  void initPol( Int ipol ) ;
     195  void initTable( uInt idx ) ;
     196  Bool isMultiIF( Table &tab ) ;
     197  void fillMainColumns( Table &tab ) ;
     198  static bool produceChunk(void *ctx) throw(concurrent::PCException);
     199  static void consumeChunk(void *ctx) throw(concurrent::PCException);
     200  static void consumeChunkWithClipping(void *ctx) throw(concurrent::PCException);
     201
     202
     203  // user input
     204  Int nxUI_ ;
     205  Int nyUI_ ;
     206  String cellxUI_ ;
     207  String cellyUI_ ;
     208  String centerUI_ ;
     209
     210  Block<String> infileList_ ;
     211  uInt nfile_ ;
    118212  Int ifno_ ;
     213  Bool doclip_ ;
     214
    119215  Int nx_ ;
    120216  Int ny_ ;
    121217  Int npol_ ;
     218  Int npolOrg_ ;
    122219  Int nchan_ ;
    123   Int nrow_ ;
    124220  Double cellx_ ;
    125221  Double celly_ ;
     
    129225  Int userSupport_ ;
    130226  Int convSampling_ ;
    131   Array<Float> data_ ;
    132227  Vector<uInt> pollist_ ;
    133228  Vector<uInt> scanlist_ ;
    134229  String wtype_ ;
     230  Block<Table> tableList_ ;
     231  Vector<uInt> rows_ ;
     232  Int nchunk_ ;
     233
     234  /////////////// gridPerRow variable
     235  IPosition vshape_;
     236  IPosition wshape_;
     237  IPosition dshape_;
     238  // loop variable
     239  Int nrow_ ;
     240  Array<Float> data_ ;
    135241
    136242  Table tab_ ;
     243  // per pol
     244  Table ptab_ ;
     245  ROArrayColumn<Float> spectraCol_ ;
     246  ROArrayColumn<uChar> flagtraCol_ ;
     247  ROArrayColumn<Double> directionCol_ ;
     248  ROScalarColumn<uInt> flagRowCol_ ;
     249  ROArrayColumn<Float> tsysCol_ ;
     250  ROScalarColumn<Double> intervalCol_ ;
     251
     252  Int nprocessed_ ;
     253
     254
     255  double eGetData_;
     256  double eToPixel_;
     257  double eGGridSD_;
    137258};
    138259}
Note: See TracChangeset for help on using the changeset viewer.