Changeset 3089 in Sophya for trunk/SophyaProg/Tests/tswfits.cc
- Timestamp:
- Oct 11, 2006, 12:58:10 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaProg/Tests/tswfits.cc
r2890 r3089 11 11 #include "swfitsdtable.h" 12 12 13 #include "datatable.h" 14 #include "fitshdtable.h" 15 13 16 void test_fdtable() ; 17 static long NROW = 64; 18 static long NPRT = 10; 14 19 15 20 int main(int narg, char *arg[]) … … 17 22 SophyaInit(); 18 23 FitsIOServerInit(); 24 if (narg < 3) { 25 cout << "Erreur arg/Usage: tswfits NRowTable NPRT" << endl; 26 return 1; 27 } 28 NROW = atoi(arg[1]); 29 NPRT = atoi(arg[2]); 19 30 try { 20 /*21 if (*arg[1] == 'd') test_dvl();22 else if (*arg[1] == 'n') test_ntuple();23 // else if (*arg[1] == 'x') test_xntuple();24 else if (*arg[1] == 'X') test_Xntuple();25 */26 31 test_fdtable(); 27 32 } … … 35 40 cerr << "tswfits-main() , Catched ... ! " << endl; 36 41 } 42 37 43 } 38 44 … … 40 46 void test_fdtable() 41 47 { 42 cout << "======= test_fdtable: simple DataTable+FITStest ======= " << endl;48 cout << "======= test_fdtable: simple SwapOnFits test ======= " << endl; 43 49 int SWSEGSZ = 4; 44 50 vector<int_8> tags; 45 51 { 46 cout << " Creation FITSDataSwapper<double> swout(so) avec swseg.fits " << endl;52 cout << "1/ Creation FITSDataSwapper<double> swout(so) avec swseg.fits " << endl; 47 53 vector<string> ttype, tform, tunit; 48 54 ttype.push_back("D-Col1"); … … 74 80 } 75 81 { 76 cout << " 6/ Creation PPFDataSwapper<float> avec lecture depuis swseg.ppf" << endl;82 cout << "2/ Creation FITSDataSwapper<double> avec lecture depuis swseg.fits" << endl; 77 83 FitsInOutFile si("swseg.fits", FitsInOutFile::Fits_RO); 78 84 si.MoveAbsToHDU(2); 79 85 FITSDataSwapper<double> swin(si, 1); 80 86 SwSegDataBlock<double> swsd(swin, tags, SWSEGSZ); 81 cout <<" 7/ Recopie ds SegDataBlock<float> depuis SwSegDataBlock<float> et print" << endl;87 cout <<"2.b/ Recopie ds SegDataBlock<double> depuis SwSegDataBlock<double> et print" << endl; 82 88 SegDataBlock<double> segd; 83 89 segd = swsd; … … 86 92 87 93 { 88 cout << "8/ Creation SwFitsDataTable sur myswtable.fits " << endl; 94 cout << " ------------------------------------------------ " << endl; 95 cout << "3/ Creation SwFitsDataTable sur myswtable.fits " << endl; 89 96 FitsInOutFile so("!myswtable.fits", FitsInOutFile::Fits_Create); 90 SwFitsDataTable dt(so, 16);97 SwFitsDataTable dt(so, 45); 91 98 // define table columns 92 99 dt.AddFloatColumn("X0_f"); 93 100 dt.AddFloatColumn("X1_f"); 94 101 dt.AddDoubleColumn("X0X0pX1X1_d"); 95 cout << " 8.b/ start fill " << endl;102 cout << "3.b/ start fill " << endl; 96 103 // Fill the table 97 104 r_8 x[5]; 98 for(int i=0; i<63; i++) { 99 if (i < 5) cout << " DBG - i= " << i << endl; 105 int pmod = NROW/50; 106 if (pmod < 10) pmod = 10; 107 for(int i=0; i<NROW; i++) { 108 // if (i%pmod == 0) cout << " DBG - i= " << i << endl; 100 109 x[0] = (i%9)-4.; x[1] = (i/9)-3.; x[2] = x[0]*x[0]+x[1]*x[1]; 101 110 dt.AddLine(x); 102 111 } 103 cout << " 8.c/ End fill " << endl;112 cout << "3.c/ End fill " << endl; 104 113 105 114 // Printing table info 106 115 cout << dt ; 116 for(int k = 0; k<NPRT; k++) 117 cout << "Line[" << k << "] " << dt.LineToString(k) << endl ; 118 107 119 } 120 { 121 cout << " ------------------------------------------------ " << endl; 122 cout << "4/ Lecture SwFitsDataTable depuis myswtable.fits " << endl; 123 FitsInOutFile si("myswtable.fits", FitsInOutFile::Fits_RO); 124 si.SkipEmptyFirstHDU(); 125 SwFitsDataTable dt(si,40,false); 126 // si >> dt; 127 // Printing table info 128 cout << dt ; 129 for(int k = 0; k<NPRT; k++) 130 cout << "Line[" << k << "] " << dt.LineToString(k) << endl ; 131 } 132 108 133 cout << "============ FIN test_fdtable ======== ======= " << endl; 109 134 }
Note:
See TracChangeset
for help on using the changeset viewer.