Changeset 21323 for trunk/pswarp/src/pswarpLoop.c
- Timestamp:
- Feb 5, 2009, 10:44:04 AM (17 years ago)
- File:
-
- 1 edited
-
trunk/pswarp/src/pswarpLoop.c (modified) (13 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/pswarp/src/pswarpLoop.c
r21256 r21323 1 /** @file pswarpLoop.c 2 * 3 * @brief 4 * 5 * @ingroup pswarp 6 * 7 * @author IfA 8 * @version $Revision: 1.36 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2009-02-05 20:44:04 $ 10 * Copyright 2009 Institute for Astronomy, University of Hawaii 11 */ 12 1 13 #include "pswarp.h" 2 14 #include <ppStats.h> 3 15 4 #define WCS_NONLIN_TOL 0.001 // Non-linear tolerance for header WCS 5 #define PSPHOT_FIND_PSF 1 // Use psphot's findPSF function? 6 #define TESTING 0 // Testing output? 7 8 // Lists of file rules used at different stages 9 #include "pswarpFileNames.h" 10 11 // XXX these are generic functions which should be moved to psModules 12 // Activate a list of files 13 static void fileActivation(pmConfig *config, // Configuration 14 char **files, // Files to turn on/off 15 bool state // Activation state 16 #define WCS_NONLIN_TOL 0.001 ///< Non-linear tolerance for header WCS 17 #define PSPHOT_FIND_PSF 1 ///< Use psphot's findPSF function? 18 #define TESTING 0 ///< Testing output? 19 20 #include "pswarpFileNames.h" ///< Lists of file rules used at different stages 21 22 /** 23 * XXX these are generic functions which should be moved to psModules 24 * Activate a list of files 25 */ 26 static void fileActivation(pmConfig *config, ///< Configuration 27 char **files, ///< Files to turn on/off 28 bool state ///< Activation state 16 29 ) 17 30 { … … 22 35 } 23 36 24 // Run down the FPA hierarchy, checking files 25 static bool ioChecksBefore(pmConfig *config // Configuration 37 /** 38 * Run down the FPA hierarchy, checking files 39 */ 40 static bool ioChecksBefore(pmConfig *config ///< Configuration 26 41 ) 27 42 { 28 pmFPAview *view = pmFPAviewAlloc(0); // View for checking29 bool status = true; // Status of checks43 pmFPAview *view = pmFPAviewAlloc(0); ///< View for checking 44 bool status = true; ///< Status of checks 30 45 status &= pmFPAfileIOChecks(config, view, PM_FPA_BEFORE); 31 46 view->chip = 0; … … 37 52 } 38 53 39 // Run up the FPA hierarchy, checking files 40 static bool ioChecksAfter(pmConfig *config // Configuration 54 /** 55 * Run up the FPA hierarchy, checking files 56 */ 57 static bool ioChecksAfter(pmConfig *config ///< Configuration 41 58 ) 42 59 { 43 pmFPAview *view = pmFPAviewAlloc(0); // View for checking60 pmFPAview *view = pmFPAviewAlloc(0); ///< View for checking 44 61 view->chip = view->cell = 0; 45 bool status = true; // Status of checks62 bool status = true; ///< Status of checks 46 63 status &= pmFPAfileIOChecks(config, view, PM_FPA_AFTER); 47 64 view->cell = -1; … … 54 71 55 72 56 // Loop over the inputs, warp them to the output skycell and then write out the output. 73 /** 74 * Loop over the inputs, warp them to the output skycell and then write out the output. 75 */ 57 76 bool pswarpLoop(pmConfig *config) 58 77 { … … 100 119 psFree (view); 101 120 102 bool mdok; // Status of MD lookup103 const char *statsName = psMetadataLookupStr(&mdok, config->arguments, "STATS"); // Filename for statistics104 psMetadata *stats = NULL; // Container for statistics105 FILE *statsFile = NULL; // File stream for statistics121 bool mdok; ///< Status of MD lookup 122 const char *statsName = psMetadataLookupStr(&mdok, config->arguments, "STATS"); ///< Filename for statistics 123 psMetadata *stats = NULL; ///< Container for statistics 124 FILE *statsFile = NULL; ///< File stream for statistics 106 125 if (mdok && statsName && strlen(statsName) > 0) { 107 126 psString resolved = pmConfigConvertFilename(statsName, config, true, true); … … 245 264 } 246 265 247 pmCell *outCell = output->parent; // Output cell248 pmChip *outChip = outCell->parent; // Output chip249 pmFPA *outFPA = outChip->parent; // Output FP266 pmCell *outCell = output->parent; ///< Output cell 267 pmChip *outChip = outCell->parent; ///< Output chip 268 pmFPA *outFPA = outChip->parent; ///< Output FP 250 269 251 270 if (!pswarpPixelFraction(output, stats, config)) { … … 265 284 varFactor /= goodPix; 266 285 267 psMetadataItem *vfItem = psMetadataLookup(outCell->concepts, "CELL.VARFACTOR"); // Item to update286 psMetadataItem *vfItem = psMetadataLookup(outCell->concepts, "CELL.VARFACTOR"); ///< Item to update 268 287 psAssert(vfItem && vfItem->type == PS_TYPE_F32, "Concept should be as specified."); 269 288 if (!isfinite(vfItem->data.F32)) { … … 283 302 psFree(cells); 284 303 285 psRegion *trimsec = psMetadataLookupPtr(NULL, outCell->concepts, "CELL.TRIMSEC"); // Trim section286 trimsec->x0 = trimsec->x1 = trimsec->y0 = trimsec->y1 = 0; // All pixels304 psRegion *trimsec = psMetadataLookupPtr(NULL, outCell->concepts, "CELL.TRIMSEC"); ///< Trim section 305 trimsec->x0 = trimsec->x1 = trimsec->y0 = trimsec->y1 = 0; ///< All pixels 287 306 288 307 if (!psMetadataCopy(outFPA->concepts, input->fpa->concepts)) { … … 293 312 } 294 313 295 pmHDU *hdu = outFPA->hdu; // HDU for the output warped image314 pmHDU *hdu = outFPA->hdu; ///< HDU for the output warped image 296 315 297 316 // Copy header from target 298 317 { 299 pmFPAview *skyView = pmFPAviewAlloc(0); // View into skycell318 pmFPAview *skyView = pmFPAviewAlloc(0); ///< View into skycell 300 319 skyView->chip = skyView->cell = 0; 301 320 pmCell *cell = pmFPAfileThisCell(config->files, skyView, "PSWARP.SKYCELL"); // Skycell cell 302 321 psFree(skyView); 303 pmHDU *skyHDU = pmHDUFromCell(cell); // HDU322 pmHDU *skyHDU = pmHDUFromCell(cell); ///< HDU 304 323 if (!skyHDU) { 305 324 psError(PS_ERR_UNEXPECTED_NULL, false, "Unable to find skycell HDU."); … … 333 352 pmFPACopy(photFile->fpa, outFPA); 334 353 335 pmFPAview *view = pmFPAviewAlloc(0); // View into skycell354 pmFPAview *view = pmFPAviewAlloc(0); ///< View into skycell 336 355 view->chip = view->cell = view->readout = 0; 337 356 … … 340 359 // We can adjust the weight directly since this is a deep copy 341 360 pmReadout *photRO = pmFPAviewThisReadout(view, photFile->fpa); 342 float vf = psMetadataLookupF32(NULL, photRO->parent->concepts, "CELL.VARFACTOR"); // Variance factor361 float vf = psMetadataLookupF32(NULL, photRO->parent->concepts, "CELL.VARFACTOR"); ///< Variance factor 343 362 psBinaryOp(photRO->weight, photRO->weight, "*", psScalarAlloc(vf, PS_TYPE_F32)); 344 363 … … 359 378 #if (TESTING) 360 379 { 361 #define PSF_SIZE 20 // Half-size of PSF362 #define PSF_FLUX 10000 // Central flux for PSF380 #define PSF_SIZE 20 ///< Half-size of PSF 381 #define PSF_FLUX 10000 ///< Central flux for PSF 363 382 pmChip *photChip = pmFPAviewThisChip(view, photFile->fpa); 364 383 pmPSF *psf = psMetadataLookupPtr(NULL, photChip->analysis, "PSPHOT.PSF"); … … 390 409 const char *chipName = psMetadataLookupStr(NULL, output->parent->parent->concepts, "CHIP.NAME"); 391 410 const char *cellName = psMetadataLookupStr(NULL, output->parent->concepts, "CELL.NAME"); 392 psString headerName = NULL; // Header name for MD5411 psString headerName = NULL; ///< Header name for MD5 393 412 psStringAppend(&headerName, "MD5_%s_%s_%d", chipName, cellName, view->readout); 394 psVector *md5 = psImageMD5(output->image); // md5 hash395 psString md5string = psMD5toString(md5); // String413 psVector *md5 = psImageMD5(output->image); ///< md5 hash 414 psString md5string = psMD5toString(md5); ///< String 396 415 psFree(md5); 397 416 psMetadataAddStr(hdu->header, PS_LIST_TAIL, headerName, PS_META_REPLACE,
Note:
See TracChangeset
for help on using the changeset viewer.
