Changeset 30631 for branches/czw_branch/20101203/ppStack/src/ppStackFiles.c
- Timestamp:
- Feb 14, 2011, 1:05:28 PM (15 years ago)
- Location:
- branches/czw_branch/20101203
- Files:
-
- 2 edited
-
. (modified) (1 prop)
-
ppStack/src/ppStackFiles.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/czw_branch/20101203
- Property svn:mergeinfo changed
-
branches/czw_branch/20101203/ppStack/src/ppStackFiles.c
r28253 r30631 1 #ifdef HAVE_CONFIG_H2 #include <config.h>3 #endif4 5 #include <stdio.h>6 #include <unistd.h>7 #include <pslib.h>8 #include <psmodules.h>9 10 1 #include "ppStack.h" 11 2 12 13 3 // Here follows lists of files for activation/deactivation at various stages. Each must be NULL-terminated. 4 5 /// NOP list 6 static char *filesNOP[] = { NULL }; 14 7 15 8 /// Files required in preparation for convolution … … 41 34 { 42 35 switch (list) { 36 case PPSTACK_FILES_NONE: return filesNOP; 43 37 case PPSTACK_FILES_PREPARE: return filesPrepare; 44 38 case PPSTACK_FILES_TARGET: return filesTarget; … … 206 200 return true; 207 201 } 202 203 // Write an image to a FITS file 204 bool ppStackWriteVariance(const char *name, // Name of image 205 psMetadata *header, // Header 206 const psImage *variance, // Variance 207 const psImage *covariance, // Variance 208 pmConfig *config // Configuration 209 ) 210 { 211 assert(name); 212 assert(variance); 213 214 psString resolved = pmConfigConvertFilename(name, config, true, true); // Resolved file name 215 psFits *fits = psFitsOpen(resolved, "w"); 216 if (!fits) { 217 psError(PPSTACK_ERR_IO, false, "Unable to open FITS file %s to write image.", resolved); 218 psFree(resolved); 219 return false; 220 } 221 if (!psFitsWriteImage(fits, header, variance, 0, NULL)) { 222 psError(PPSTACK_ERR_IO, false, "Unable to write FITS image %s.", resolved); 223 psFitsClose(fits); 224 psFree(resolved); 225 return false; 226 } 227 if (covariance) { 228 psMetadata *tmphead = psMetadataAlloc(); 229 psMetadataAddS32(tmphead, PS_LIST_TAIL, "COVARIANCE.CENTRE.X", PS_META_REPLACE, "center", (int)(covariance->numCols / 2)); 230 psMetadataAddS32(tmphead, PS_LIST_TAIL, "COVARIANCE.CENTRE.Y", PS_META_REPLACE, "center", (int)(covariance->numRows / 2)); 231 if (!psFitsWriteImage(fits, tmphead, covariance, 0, "COVAR_SkyChip_SkyCell")) { 232 psError(PPSTACK_ERR_IO, false, "Unable to write FITS image %s.", resolved); 233 psFitsClose(fits); 234 psFree(resolved); 235 return false; 236 } 237 } 238 if (!psFitsClose(fits)) { 239 psError(PPSTACK_ERR_IO, false, "Unable to close FITS image %s.", resolved); 240 psFree(resolved); 241 return false; 242 } 243 psFree(resolved); 244 return true; 245 }
Note:
See TracChangeset
for help on using the changeset viewer.
