Changeset 13705
- Timestamp:
- Jun 7, 2007, 2:49:27 PM (19 years ago)
- Location:
- trunk/pswarp/src
- Files:
-
- 3 edited
-
pswarpDefine.c (modified) (7 diffs)
-
pswarpLoop.c (modified) (2 diffs)
-
pswarpParseCamera.c (modified) (3 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); -
trunk/pswarp/src/pswarpLoop.c
r13686 r13705 135 135 } 136 136 137 output->data_exists = true; 138 outCell->data_exists = true; 139 outChip->data_exists = true; 140 137 141 138 142 // XXX Hack so that INSTRUME header keyword and the like are not updated properly … … 163 167 164 168 pmHDU *hdu = output->parent->parent->parent->hdu; // HDU for the output warped image 169 if (!hdu->header) { 170 hdu->header = psMetadataAlloc(); 171 } 165 172 166 173 // Add MD5 information for readout -
trunk/pswarp/src/pswarpParseCamera.c
r13685 r13705 9 9 // the input image(s) are required arguments; they define the camera 10 10 status = false; 11 pmFPAfile *input = pmFPAfileDefineFromArgs (&status, config, "PSWARP.INPUT", "INPUT");11 pmFPAfile *input = pmFPAfileDefineFromArgs(&status, config, "PSWARP.INPUT", "INPUT"); 12 12 if (!input || !status) { 13 13 psError(PSWARP_ERR_CONFIG, false, "Failed to build FPA from PSWARP.INPUT"); … … 17 17 // the input image(s) are required arguments; they define the camera 18 18 status = false; 19 pmFPAfile *astrom = pmFPAfile DefineFromArgs (&status, config, "PSWARP.ASTROM", "ASTROM");19 pmFPAfile *astrom = pmFPAfileBindFromArgs(&status, input, config, "PSWARP.ASTROM", "ASTROM"); 20 20 if (!status) { 21 21 psError (PS_ERR_UNKNOWN, false, "failed to load find definition"); … … 49 49 // the input skycell is a required argument: it defines the output image 50 50 // XXX we may need a different skycell structure here 51 status = pswarpDefineSkycell (&skycell, &skyConfig, config, "PSWARP.SKYCELL", "SKYCELL");51 status = pswarpDefineSkycell(&skycell, &skyConfig, config, "PSWARP.SKYCELL", "SKYCELL"); 52 52 if (!status) { 53 53 psError(PSWARP_ERR_CONFIG, false, "Failed to build FPA from PSWARP.SKYCELL"); 54 54 return false; 55 55 } 56 psFree(skyConfig); 56 57 57 // these calls bind the I/O handle to the specified fpa 58 // NOTE: output file could be binned relative to sky cell... 59 // if (!pmFPAfileDefineFromFPA (skyConfig, skycell->fpa, 1, 1, "PSWARP.OUTPUT")) { 60 if (!pmFPAfileDefineOutput (skyConfig, skycell->fpa, "PSWARP.OUTPUT")) { 58 // The output skycell 59 pmFPAfile *output = pmFPAfileDefineSkycell(config, NULL, "PSWARP.OUTPUT"); 60 if (!output) { 61 61 psError(PSWARP_ERR_CONFIG, false, "Failed to build FPA from PSWARP.OUTPUT"); 62 62 return false; 63 63 } 64 if (!pmFPAfileDefine Output (skyConfig, skycell->fpa, "PSWARP.OUTPUT.MASK")) {64 if (!pmFPAfileDefineSkycell(config, output->fpa, "PSWARP.OUTPUT.MASK")) { 65 65 psError(PSWARP_ERR_CONFIG, false, "Failed to build FPA from PSWARP.OUTPUT.MASK"); 66 66 return false; 67 67 } 68 68 if (inWeight) { 69 if (!pmFPAfileDefine Output (skyConfig, skycell->fpa, "PSWARP.OUTPUT.WEIGHT")) {69 if (!pmFPAfileDefineSkycell(config, output->fpa, "PSWARP.OUTPUT.WEIGHT")) { 70 70 psError(PSWARP_ERR_CONFIG, false, "Failed to build FPA from PSWARP.OUTPUT.WEIGHT"); 71 71 return false; 72 72 } 73 73 } 74 psFree (skyConfig);75 74 76 75 // Chip selection: turn on only the chips specified
Note:
See TracChangeset
for help on using the changeset viewer.
