Commit 488aed29 authored by jclamber's avatar jclamber
Browse files

fits in progress

git-svn-id: http://svn.oamp.fr/repos/uns_projects/trunk@117 f264a43e-d52d-4b82-913b-c2bd5215a18a
parent e3525d78
......@@ -56,11 +56,11 @@ int main(int argc, char ** argv )
FITS::setVerboseMode(true);
try {
try {
if (!readImage(simname,outname,typeout)) std::cerr << " readImage() \n";
}
catch (FitsException&)
catch (FitsException&)
// will catch all exceptions thrown by CCfits, including errors
// found by cfitsio (status != 0)
{
......@@ -76,34 +76,63 @@ int main(int argc, char ** argv )
int readImage(std::string in, std::string out, std::string type)
{
// std::auto_ptr<FITS> pInfile(new FITS("/windows7/JDL/ngc6503.fits",Read,true));
std::auto_ptr<FITS> pInfile(new FITS(in,Read,true));
std::auto_ptr<FITS> pInfile(new FITS(in,Read,false));
PHDU& image = pInfile->pHDU();
//PHDU& image = pInfile->pHDU();
//ExtHDU& image = pInfile->extension(0);
HDU * image;// = &pInfile->extension(1);
std::cerr << " Begin \n";
std::valarray<unsigned long> contents;
try {
image = &pInfile->extension(1);
std::cerr << "There is an extension\n";
std::cout << "#axis ="<<image->axes() << std::endl;
//(pInfile->extension(1)).read(contents);
((ExtHDU *) image)->read(contents);
} catch (FitsException&) {
image = &pInfile->pHDU();
std::cerr << "There is a pHDU\n";
std::cout << "#axis ="<<image->axes() << std::endl;
//(pInfile->pHDU()).read(contents);
((PHDU *) image)->read(contents);
}
std::cerr << " yo yo \n";
#if 1
// read all user-specifed, coordinate, and checksum keys in the image
image.readAllKeys();
image->readAllKeys();
image.read(contents);
std::cout << "#axis ="<<image->axes() << std::endl;
std::cout << "#axis ="<<image.axes() << std::endl;
for (int i=0;i<image.axes();i++) {
std::cerr << "axis["<<i<<"]="<<image.axis(i)<<"\n";
//image->read(contents);
std::cout << "#axis ="<<image->axes() << std::endl;
for (int i=0;i<image->axes();i++) {
std::cerr << "axis["<<i<<"]="<<image->axis(i)<<"\n";
}
// this doesn't print the data, just header info.
//std::cout << image << std::endl;
//std::cout << *image << std::endl;
std::cout << "value = " << contents.size() << "\n";
for (int i=0; i<contents.size(); i++) {
for (unsigned long i=0; i<contents.size(); i++) {
if (isnan(contents[i])) {
std::cerr << "Nan ["<<i<<"]\n";
}
if (isinf(contents[i])) {
std::cerr << "Inf ["<<i<<"]\n";
}
}
return 0;
long ax1(image.axis(0));
long ax2(image.axis(1));
long ax1(image->axis(0));
long ax2(image->axis(1));
for (long j = 0; j < ax2; j+=10)
{
......@@ -114,4 +143,5 @@ int readImage(std::string in, std::string out, std::string type)
std::cout << std::endl;
return 0;
#endif
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment