Changeset 1444 for trunk/src


Ignore:
Timestamp:
10/28/08 21:09:24 (16 years ago)
Author:
Malte Marquarding
Message:

Ticket #110: I have added a fix for the FITS header now, This modifies CRVAL1, CTYPE1 to be read by CLASS

Location:
trunk/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/STFITSImageWriter.cpp

    r1443 r1444  
    3030//#---------------------------------------------------------------------------
    3131
     32#include <fitsio.h>
    3233#include <images/Images/TempImage.h>
    3334
     
    217218
    218219void STFITSImageWriter::classHackHeader(const String& filename) {
    219   cout << "Not yet implemented" << endl;
     220  int status = 0;
     221  fitsfile *fptr;     
     222  cout << "filename" << endl;
     223  if( fits_open_file(&fptr, filename.c_str(), READWRITE, &status) )
     224    throw AipsError("FCoudn't open fits file for CLASS modification");
     225
     226  if ( fits_update_key(fptr, TSTRING, "CTYPE1", (char *)"FREQ",
     227                       NULL, &status) )
     228    throw AipsError("Couldn't modify CTYPE1.");
     229  float restf,refval,newfreq;
     230  fits_read_key(fptr, TFLOAT, "CRVAL1",
     231                &refval, NULL, &status);
     232  fits_read_key(fptr, TFLOAT, "RESTFREQ",
     233                &restf, NULL, &status);
     234  newfreq = refval - restf;
     235  if ( fits_update_key(fptr, TFLOAT, "CRVAL1", &newfreq,  NULL, &status) )
     236    throw AipsError("Couldn't modify CRVAL1");
     237  fits_close_file(fptr, &status);
     238
    220239}
  • trunk/src/STFITSImageWriter.h

    r1443 r1444  
    6161                                                   casa::Double lon,
    6262                                                   casa::Double lat);
     63  // Apply hacks to fits file so it can be read by class
     64  // modifications are
     65  // CTYPE1 :  FREQ-XYZ -> FREQ
     66  // CRVAL1 :  -> CRVAL1-RESTFREQ
    6367  void classHackHeader(const casa::String& filename);
    6468
Note: See TracChangeset for help on using the changeset viewer.