Changeset 13705 for trunk/pswarp/src/pswarpDefine.c
- Timestamp:
- Jun 7, 2007, 2:49:27 PM (19 years ago)
- File:
-
- 1 edited
-
trunk/pswarp/src/pswarpDefine.c (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/pswarp/src/pswarpDefine.c
r13109 r13705 14 14 pmFPAfile *skycell = psMetadataLookupPtr (NULL, config->files, "PSWARP.SKYCELL"); 15 15 if (!skycell) { 16 psError(PSWARP_ERR_CONFIG, true, "Can't find skycell data!\n"); 16 psError(PSWARP_ERR_CONFIG, false, "Can't find skycell data!\n"); 17 return false; 18 } 19 pmFPAfile *output = psMetadataLookupPtr(NULL, config->files, "PSWARP.OUTPUT"); 20 if (!output) { 21 psError(PSWARP_ERR_CONFIG, false, "Can't find output data!\n"); 22 return false; 23 } 24 pmFPAfile *input = psMetadataLookupPtr(NULL, config->files, "PSWARP.INPUT"); 25 if (!input) { 26 psError(PSWARP_ERR_CONFIG, false, "Can't find input data!\n"); 17 27 return false; 18 28 } … … 24 34 // Read header and create target 25 35 { 26 pmFPAReadHeaderSet(skycell->fpa, skycell->fits, config->database); 36 if (!pmFPAReadHeaderSet(skycell->fpa, skycell->fits, config->database)) { 37 psError(PS_ERR_UNKNOWN, false, "Unable to read headers for skycell."); 38 psFree(view); 39 return false; 40 } 27 41 view->chip = 0; 28 42 view->cell = 0; … … 32 46 if (!hdu || !hdu->header) { 33 47 psError(PS_ERR_UNEXPECTED_NULL, false, "Unable to find header for sky cell."); 48 psFree(view); 34 49 return false; 35 50 } … … 37 52 int numRows = psMetadataLookupS32(NULL, hdu->header, "NAXIS2"); // Number of rows 38 53 39 pmCell *target = pmFPA fileThisCell(config->files, view, "PSWARP.OUTPUT"); // Target cell54 pmCell *target = pmFPAviewThisCell(view, output->fpa); // Target cell 40 55 pmReadout *readout = pmReadoutAlloc(target); // Target readout 41 56 readout->image = psImageAlloc(numCols, numRows, PS_TYPE_F32); … … 54 69 // XXX this is not a sufficient test 55 70 view->chip = 0; 56 pmChip *chip = pmFPAviewThisChip (view, skycell->fpa); 57 pmHDU *phu = pmFPAviewThisPHU (view, skycell->fpa); 58 pmHDU *hdu = pmFPAviewThisHDU (view, skycell->fpa); 71 view->cell = 0; 72 view->readout = -1; 73 pmHDU *phu = pmFPAviewThisPHU(view, skycell->fpa); // Skycell PHU 74 pmHDU *hdu = pmFPAviewThisHDU(view, skycell->fpa); // Skycell header 59 75 bool bilevelAstrometry = false; 60 76 if (phu) { 61 char *ctype = psMetadataLookupStr (NULL, phu->header, "CTYPE1");77 char *ctype = psMetadataLookupStr(NULL, phu->header, "CTYPE1"); 62 78 if (ctype) { 63 bilevelAstrometry = !strcmp (&ctype[4], "-DIS");79 bilevelAstrometry = !strcmp(&ctype[4], "-DIS"); 64 80 } 65 81 } 82 83 // We read from the skycell into the output. i.e., the output receives the desired astrometry. 84 pmChip *outputChip = pmFPAviewThisChip(view, output->fpa); // Chip in the output 66 85 if (bilevelAstrometry) { 67 if (!pmAstromReadBilevelMosaic (skycell->fpa, phu->header)) {86 if (!pmAstromReadBilevelMosaic(output->fpa, phu->header)) { 68 87 psError(PS_ERR_UNKNOWN, false, "Unable to read bilevel mosaic astrometry for skycell."); 69 88 psFree(view); 70 89 return false; 71 90 } 72 if (!pmAstromReadBilevelChip (chip, hdu->header)) {91 if (!pmAstromReadBilevelChip(outputChip, hdu->header)) { 73 92 psError(PS_ERR_UNKNOWN, false, "Unable to read bilevel chip astrometry for skycell."); 74 93 psFree(view); … … 77 96 } else { 78 97 // we use a default FPA pixel scale of 1.0 79 if (!pmAstromReadWCS (skycell->fpa, chip, hdu->header, 1.0)) {98 if (!pmAstromReadWCS(output->fpa, outputChip, hdu->header, 1.0)) { 80 99 psError(PS_ERR_UNKNOWN, false, "Unable to read WCS astrometry for skycell."); 81 100 psFree(view); … … 84 103 } 85 104 86 // construct the output fpa here 87 pmFPAfile *output = psMetadataLookupPtr (NULL, config->files, "PSWARP.OUTPUT"); 88 if (!output) { 89 psError(PSWARP_ERR_CONFIG, true, "Can't find output data!\n"); 90 return false; 91 } 105 const char *name = psMetadataLookupStr(NULL, input->fpa->concepts, "FPA.NAME"); // Name of FPA 106 view->chip = view->cell = view->readout = -1; 107 pmFPAAddSourceFromView(output->fpa, name, view, output->format); 92 108 93 109 psFree (view);
Note:
See TracChangeset
for help on using the changeset viewer.
