FITS_tutorial3.C: Open a FITS file and retrieve the first plane of the image array | CFITSIO interface | FITS_tutorial5.C: Open a FITS file whose primary array represents |
// Open a FITS file whose primary array represents // a spectrum (flux vs wavelength) void FITS_tutorial4() { printf("\n\n--------------------------------\n"); printf("WELCOME TO FITS tutorial #4 !!!!\n"); printf("--------------------------------\n"); printf("We're gonna open a FITS file that contains the\n"); printf("primary HDU and a little data table.\n"); printf("The data table is extension #1 and it has 2 rows.\n"); printf("We want to read only the rows that have the column\n"); printf("named DATAMAX greater than 2e-15 (there's only 1\n"); printf("matching row)\n"); printf("Data copyright: NASA\n\n"); if (!gROOT->IsBatch()) { //printf("Press ENTER to start..."); getchar(); } //Open the table extension number 1) TFITSHDU *hdu = new TFITSHDU("sample2.fits[1][DATAMAX > 2e-15]"); if (hdu == 0) { printf("ERROR: could not access the HDU\n"); return; } //printf("Press ENTER to see information about the table's columns..."); getchar(); hdu->Print("T"); printf("\n\n........................................\n"); printf("Press ENTER to see full table contents (maybe you should resize\n"); //printf("this window as large as possible before)..."); getchar(); hdu->Print("T+"); printf("\n\n........................................\n"); //printf("Press ENTER to get only the DATAMAX value of the matched row..."); getchar(); TVectorD *v = hdu->GetTabRealVectorColumn("DATAMAX"); printf("%lg\n", (*v)[0]); printf("Does the matched row have DATAMAX > 2e-15? :-)\n"); //Clean up delete v; delete hdu; } FITS_tutorial4.C:1 FITS_tutorial4.C:2 FITS_tutorial4.C:3 FITS_tutorial4.C:4 FITS_tutorial4.C:5 FITS_tutorial4.C:6 FITS_tutorial4.C:7 FITS_tutorial4.C:8 FITS_tutorial4.C:9 FITS_tutorial4.C:10 FITS_tutorial4.C:11 FITS_tutorial4.C:12 FITS_tutorial4.C:13 FITS_tutorial4.C:14 FITS_tutorial4.C:15 FITS_tutorial4.C:16 FITS_tutorial4.C:17 FITS_tutorial4.C:18 FITS_tutorial4.C:19 FITS_tutorial4.C:20 FITS_tutorial4.C:21 FITS_tutorial4.C:22 FITS_tutorial4.C:23 FITS_tutorial4.C:24 FITS_tutorial4.C:25 FITS_tutorial4.C:26 FITS_tutorial4.C:27 FITS_tutorial4.C:28 FITS_tutorial4.C:29 FITS_tutorial4.C:30 FITS_tutorial4.C:31 FITS_tutorial4.C:32 FITS_tutorial4.C:33 FITS_tutorial4.C:34 FITS_tutorial4.C:35 FITS_tutorial4.C:36 FITS_tutorial4.C:37 FITS_tutorial4.C:38 FITS_tutorial4.C:39 FITS_tutorial4.C:40 FITS_tutorial4.C:41 FITS_tutorial4.C:42 FITS_tutorial4.C:43 FITS_tutorial4.C:44 FITS_tutorial4.C:45 FITS_tutorial4.C:46 FITS_tutorial4.C:47 |
|