Line data Source code
1 : //# tVisModelData.cc: Tests the Synthesis model data serving 2 : //# Copyright (C) 2011 3 : //# Associated Universities, Inc. Washington DC, USA. 4 : //# 5 : //# This program is free software; you can redistribute it and/or modify it 6 : //# under the terms of the GNU General Public License as published by the Free 7 : //# Software Foundation; either version 2 of the License, or (at your option) 8 : //# any later version. 9 : //# 10 : //# This program is distributed in the hope that it will be useful, but WITHOUT 11 : //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 12 : //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 13 : //# more details. 14 : //# 15 : //# You should have received a copy of the GNU General Public License along 16 : //# with this program; if not, write to the Free Software Foundation, Inc., 17 : //# 675 Massachusetts Ave, Cambridge, MA 02139, USA. 18 : //# 19 : //# Correspondence concerning AIPS++ should be addressed as follows: 20 : //# Internet email: aips2-request@nrao.edu. 21 : //# Postal address: AIPS++ Project Office 22 : //# National Radio Astronomy Observatory 23 : //# 520 Edgemont Road 24 : //# Charlottesville, VA 22903-2475 USA 25 : //# 26 : //# $Id$ 27 : 28 : #include <casacore/casa/Arrays/ArrayMath.h> 29 : #include <components/ComponentModels/ComponentList.h> 30 : #include <components/ComponentModels/ComponentShape.h> 31 : #include <components/ComponentModels/Flux.h> 32 : #include <casacore/tables/TaQL/ExprNode.h> 33 : #include <casacore/measures/Measures/MeasTable.h> 34 : #include <casacore/ms/MSSel/MSSelection.h> 35 : 36 : #include <synthesis/TransformMachines2/VisModelData.h> 37 : #include <synthesis/TransformMachines2/FTMachine.h> 38 : #include <synthesis/TransformMachines2/GridFT.h> 39 : #include <msvis/MSVis/VisibilityIterator.h> 40 : #include <msvis/MSVis/VisBuffer2.h> 41 : #include <casacore/casa/OS/Timer.h> 42 : #include <casacore/casa/namespace.h> 43 : #include <casacore/casa/OS/Directory.h> 44 : #include <casacore/casa/Utilities/Regex.h> 45 : 46 : using namespace std; 47 : using namespace casa; 48 : using namespace casacore; 49 : 50 : int 51 1 : main(int argc, char **argv){ 52 : 53 : 54 1 : if (argc<2) { 55 1 : cout <<"Usage: tVisModelData ms-table-name "<<endl; 56 1 : exit(0); 57 : } 58 : try{ 59 : 60 0 : MeasurementSet myms(argv[1],Table::Update); 61 : 62 0 : String spwsel=String("*"); 63 0 : MSSelection selector; 64 : //selector.setFieldExpr(MSSelection::indexExprStr(field)); 65 0 : selector.setSpwExpr(spwsel); 66 0 : TableExprNode exprNode=selector.toTableExprNode(&myms); 67 0 : cerr << "is expr null " << exprNode.isNull() << endl; 68 0 : MeasurementSet mssel(myms(exprNode)); 69 : 70 : 71 0 : Block<Int> sort(0); // create empty block with sortColumns 72 : //VisibilityIterator vi(mssel,sort); 73 0 : vi::VisibilityIterator2 vi(mssel,vi::SortColumns(),false); 74 0 : vi::VisBuffer2 *vb=vi.getVisBuffer(); 75 : 76 : 77 : 78 : // tm.mark(); 79 0 : vi.originChunks(); 80 0 : Float meanval=0; 81 0 : for (vi.originChunks();vi.moreChunks(); vi.nextChunk()){ 82 0 : for (vi.origin(); vi.more(); vi.next()){ 83 : 84 : //meanval+=mean(vb.visCube()); 85 : //vm.getModelVis(vb); 86 0 : cerr << "field " << vb->fieldId()(0) << " spw " << vb->spectralWindows()(0) << " stddev " << stddev(vb->visCubeModel()) << " mean " << mean(vb->visCubeModel()) <<" max " << max(amplitude(vb->visCubeModel())) << " min " << min(vb->visCubeModel()) << endl; 87 : // cerr << vb->visCubeModel().xyPlane(40) << endl; 88 : //vb.visCube(); 89 : } 90 : } 91 : //cerr << "meanval of data "<< meanval << data 92 : //tm.show("Time to read data"); 93 : //VisModelData::clearModel(myms); 94 : 95 : 96 0 : } catch (AipsError x) { 97 0 : cout << "Caught exception " << endl; 98 0 : cout << x.getMesg() << endl; 99 0 : return(1); 100 0 : } 101 : 102 : 103 : 104 : 105 : 106 : 107 : 108 : 109 : 110 : 111 : 112 : 113 : 114 : 115 0 : cout << "Done" << endl; 116 0 : exit(0); 117 : 118 : }