Changeset 2890 in Sophya for trunk/SophyaProg/Tests
- Timestamp:
- Jan 9, 2006, 6:33:27 PM (20 years ago)
- Location:
- trunk/SophyaProg/Tests
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaProg/Tests/tfitsdt.cc
r2845 r2890 8 8 #include "datatable.h" 9 9 #include "fitshdtable.h" 10 #include "swfitsdtable.h" 11 12 /* 13 Programme de test lecture-ecriture FITS de DataTable 14 + test classe SwFitsDataTable 15 Oct 2005 - Jan 2006 16 */ 10 17 11 18 void test_fdtable() ; … … 18 25 } 19 26 catch(PThrowable exc ) { 20 cerr << "t nt-main() , Catched exception: \n" << exc.Msg() << endl;27 cerr << "tfitsdt-main() , Catched exception: \n" << exc.Msg() << endl; 21 28 } 22 29 catch(std::exception ex) { 23 cerr << "t nt-main() , Catched exception ! " << (string)(ex.what()) << endl;30 cerr << "tfitsdt-main() , Catched exception ! " << (string)(ex.what()) << endl; 24 31 } 25 32 catch(...) { 26 cerr << "t nt-main() , Catched ... ! " << endl;33 cerr << "tfitsdt-main() , Catched ... ! " << endl; 27 34 } 28 35 } … … 32 39 { 33 40 int NL = 600; 34 cout << "======= test_fdtable: simple DataTable+FITS test ======= " << endl; 41 DataTable refdt(100); // Reference DataTable - for tests 42 43 cout << "======= test_fdtable: Simple DataTable+FITS test ======= " << endl; 35 44 { 36 45 cout << "1/ Creating DataTable / Writing to FITS " << endl; … … 60 69 } 61 70 cout << dt; 71 cout << " Copying dt to refdt (refdt = dt) " << endl; 72 refdt = dt; 62 73 cout << " Writing dt to fits file dtable.fits ... " << endl; 63 74 FitsInOutFile fios("!dtable.fits", FitsInOutFile::Fits_Create); … … 67 78 fios.SetNextExtensionName("ASC_DTable"); 68 79 fios << dt; 80 cout << "1.b/ Creating SwFitsDataTable (file swdtable.fits) " << endl; 81 FitsInOutFile swf("!swdtable.fits", FitsInOutFile::Fits_Create); 82 SwFitsDataTable swdt(swf, 64); 83 cout << " Copying from DataTable dt ..." << endl; 84 swdt = dt; 85 cout << swdt; 69 86 } 70 87 { … … 80 97 for(int k = 0; k<NL; k+=NL/12) 81 98 cout << "Line[" << k << "] " << dtr.LineToString(k) << endl ; 82 cout << "2. c/ Reading from ASCII table " << endl;99 cout << "2.b/ Reading from ASCII table " << endl; 83 100 DataTable dtra; 84 101 fios >> dtra; … … 87 104 for(int k = 0; k<NL; k+=NL/12) 88 105 cout << "Line[" << k << "] " << dtra.LineToString(k) << endl ; 89 106 107 cout << "2.c/ Reading SwFitsDataTable from swdtable.fits " << endl; 108 SwFitsDataTable swdtr; 109 FitsInOutFile swf("swdtable.fits", FitsInOutFile::Fits_RO); 110 swf.MoveAbsToHDU(2); 111 swf >> swdtr; 112 cout << swdtr; 113 cout << swdtr.LineHeaderToString() << endl; 114 for(int k = 0; k<NL; k+=NL/12) 115 cout << "Line[" << k << "] " << swdtr.LineToString(k) << endl ; 90 116 } 91 cout << "============ FIN test_fdtable ======== 117 cout << "============ FIN test_fdtable =============== " << endl; 92 118 } 93 119 -
trunk/SophyaProg/Tests/tswfits.cc
r2866 r2890 7 7 #include "histinit.h" 8 8 #include "dvlist.h" 9 // #include "datatable.h"10 // #include "swppfdtable.h"11 9 #include "fitsswapper.h" 12 10 #include "fiosinit.h" 11 #include "swfitsdtable.h" 13 12 14 13 void test_fdtable() ; … … 85 84 segd.Print(cout, 4, " "); 86 85 } 87 86 87 { 88 cout << "8/ Creation SwFitsDataTable sur myswtable.fits " << endl; 89 FitsInOutFile so("!myswtable.fits", FitsInOutFile::Fits_Create); 90 SwFitsDataTable dt(so, 16); 91 // define table columns 92 dt.AddFloatColumn("X0_f"); 93 dt.AddFloatColumn("X1_f"); 94 dt.AddDoubleColumn("X0X0pX1X1_d"); 95 cout << "8.b/ start fill " << endl; 96 // Fill the table 97 r_8 x[5]; 98 for(int i=0; i<63; i++) { 99 if (i < 5) cout << " DBG - i= " << i << endl; 100 x[0] = (i%9)-4.; x[1] = (i/9)-3.; x[2] = x[0]*x[0]+x[1]*x[1]; 101 dt.AddLine(x); 102 } 103 cout << "8.c/ End fill " << endl; 104 105 // Printing table info 106 cout << dt ; 107 } 88 108 cout << "============ FIN test_fdtable ======== ======= " << endl; 89 109 }
Note:
See TracChangeset
for help on using the changeset viewer.