Changeset 1500
- Timestamp:
- 02/10/09 13:17:31 (16 years ago)
- Location:
- trunk/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/STFITSImageWriter.cpp
r1476 r1500 179 179 latMask.putSlice(!bflag, where, stride); 180 180 tIm.attachMask(latMask); 181 if (isClass_) { 182 preferVelocity = True; 183 } 181 184 Bool ok = ImageFITSConverter::ImageToFITS(errMsg, tIm, fileName, 182 185 maxMem, preferVelocity, … … 188 191 } 189 192 if (isClass_) { 190 classHackHeader(fileName); 193 // Add CLASS specific information 194 // Apply hacks to fits file so it can be read by class 195 // modifications are 196 // CTYPE1 : FREQ-XYZ -> FREQ 197 // CRVAL1 : -> CRVAL1-RESTFREQ 198 int status = 0; 199 fitsfile *fptr; 200 if( fits_open_file(&fptr, fileName.c_str(), READWRITE, &status) ) 201 throw AipsError("Coudn't open fits file for CLASS modification"); 202 203 // Use preferVelocity which seems to work. 204 // When no restfrequency is given this will set up the correct 205 // frequency axis. Otherwise it uses a velocity axis 206 // if ( fits_update_key(fptr, TSTRING, "CTYPE1", (char *)"FREQ", 207 // NULL, &status) ) 208 // throw AipsError("Couldn't modify CTYPE1."); 209 // float restf,refval,newfreq; 210 // fits_read_key(fptr, TFLOAT, "CRVAL1", 211 // &refval, NULL, &status); 212 // fits_read_key(fptr, TFLOAT, "RESTFREQ", 213 // &restf, NULL, &status); 214 // newfreq = refval - restf; 215 // if ( fits_update_key(fptr, TFLOAT, "CRVAL1", &newfreq, NULL, &status) ) 216 // throw AipsError("Couldn't modify CRVAL1"); 217 218 219 Float tsys = stable.getTsys(row0); 220 if ( fits_update_key(fptr, TFLOAT, "TSYS", &tsys, 221 "System temperature", &status) ) { 222 throw AipsError("Couldn't modify TSYS"); 223 } 224 Float otime = Float(stable.getIntTime(row0)); 225 if ( fits_update_key(fptr, TFLOAT, "OBSTIME", &otime, 226 "Integration time", &status) ) { 227 throw AipsError("Couldn't modify OBSTIME"); 228 } 229 230 const char* oname = stable.getSourceName(row0).c_str(); 231 if ( fits_update_key(fptr, TSTRING, "OBJECT", (char *)oname, 232 NULL, &status) ) { 233 throw AipsError("Couldn't modify OBJECT"); 234 } 235 fits_close_file(fptr, &status); 191 236 } 192 237 //pushLog(String(oss)); … … 216 261 } 217 262 218 void STFITSImageWriter::classHackHeader(const String& filename) {219 int status = 0;220 fitsfile *fptr;221 if( fits_open_file(&fptr, filename.c_str(), READWRITE, &status) )222 throw AipsError("FCoudn't open fits file for CLASS modification");223 224 if ( fits_update_key(fptr, TSTRING, "CTYPE1", (char *)"FREQ",225 NULL, &status) )226 throw AipsError("Couldn't modify CTYPE1.");227 float restf,refval,newfreq;228 fits_read_key(fptr, TFLOAT, "CRVAL1",229 &refval, NULL, &status);230 fits_read_key(fptr, TFLOAT, "RESTFREQ",231 &restf, NULL, &status);232 newfreq = refval - restf;233 if ( fits_update_key(fptr, TFLOAT, "CRVAL1", &newfreq, NULL, &status) )234 throw AipsError("Couldn't modify CRVAL1");235 fits_close_file(fptr, &status);236 237 } -
trunk/src/STFITSImageWriter.h
r1444 r1500 61 61 casa::Double lon, 62 62 casa::Double lat); 63 // Apply hacks to fits file so it can be read by class64 // modifications are65 // CTYPE1 : FREQ-XYZ -> FREQ66 // CRVAL1 : -> CRVAL1-RESTFREQ67 void classHackHeader(const casa::String& filename);68 63 69 64 casa::Bool isClass_;
Note:
See TracChangeset
for help on using the changeset viewer.