Created
February 19, 2011 15:34
-
-
Save astrofrog/835125 to your computer and use it in GitHub Desktop.
Read FITS table using CCFits
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <CCfits> | |
| int main() | |
| { | |
| CCfits::FITS::setVerboseMode(true); | |
| try | |
| { | |
| // Open file for reading | |
| std::auto_ptr<CCfits::FITS> input_file(new CCfits::FITS("moon.fits",CCfits::Read)); | |
| // Create pointer to extension | |
| CCfits::ExtHDU& ephemeris = input_file->extension("EPHEMERIS"); | |
| // Declare arrays that will hold values | |
| std::valarray<double> jd; | |
| // Read rows | |
| CCfits::Column& column = ephemeris.column("jd"); | |
| column.read(jd, 1, column.rows()); | |
| // Print out the first value to check | |
| std::cout << jd[0] << std::endl; | |
| } | |
| catch (CCfits::FitsException&) | |
| { | |
| std::cerr << " Fits Exception Thrown by test function \n"; | |
| } | |
| return 0; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment