Changeset 28013 for trunk/psphot/src/psphotStackParseCamera.c
- Timestamp:
- May 18, 2010, 4:11:53 PM (16 years ago)
- Location:
- trunk/psphot
- Files:
-
- 2 edited
-
. (modified) (1 prop)
-
src/psphotStackParseCamera.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psphot
-
Property svn:mergeinfo
set to
/branches/eam_branches/psphot.20100506 merged eligible
-
Property svn:mergeinfo
set to
-
trunk/psphot/src/psphotStackParseCamera.c
r27657 r28013 25 25 psMetadata *input = item->data.md; // The input metadata of interest 26 26 27 // look for 'IMAGE', 'MASK', 'VARIANCE' in folder (only 'IMAGE' is required) 28 29 psString image = psMetadataLookupStr(NULL, input, "IMAGE"); // Name of image 30 if (!image || strlen(image) == 0) { 31 psError(PS_ERR_BAD_PARAMETER_VALUE, true, "Component %s lacks IMAGE of type STR", item->name); 27 pmFPAfile *rawInputFile = NULL; 28 pmFPAfile *cnvInputFile = NULL; 29 30 // RAW (unconvolved) input data (RAW:IMAGE, RAW:MASK, RAW:VARIANCE, RAW:PSF) 31 psString rawImage = psMetadataLookupStr(&status, input, "RAW:IMAGE"); // Name of image 32 if (rawImage && strlen(rawImage) > 0) { 33 rawInputFile = defineFile(config, NULL, "PSPHOT.STACK.INPUT.RAW", rawImage, PM_FPA_FILE_IMAGE); // File for image 34 if (!rawInputFile) { 35 psError(PS_ERR_UNKNOWN, false, "Unable to define file from image %d (%s)", i, rawImage); 36 return false; 37 } 38 psString mask = psMetadataLookupStr(&status, input, "RAW:MASK"); // Name of mask 39 if (mask && strlen(mask) > 0) { 40 if (!defineFile(config, rawInputFile, "PSPHOT.STACK.MASK.RAW", mask, PM_FPA_FILE_MASK)) { 41 psError(PS_ERR_UNKNOWN, false, "Unable to define file from mask %d (%s)", i, mask); 42 return false; 43 } 44 } 45 psString variance = psMetadataLookupStr(&status, input, "RAW:VARIANCE"); // Name of variance map 46 if (variance && strlen(variance) > 0) { 47 if (!defineFile(config, rawInputFile, "PSPHOT.STACK.VARIANCE.RAW", variance, PM_FPA_FILE_VARIANCE)) { 48 psError(PS_ERR_UNKNOWN, false, "Unable to define file from variance %d (%s)", i, variance); 49 return false; 50 } 51 } 52 psString psf = psMetadataLookupStr(&status, input, "RAW:PSF"); // Name of mask 53 if (psf && strlen(psf) > 0) { 54 if (!defineFile(config, rawInputFile, "PSPHOT.STACK.PSF.RAW", psf, PM_FPA_FILE_PSF)) { 55 psError(PS_ERR_UNKNOWN, false, "Unable to define file from psf %d (%s)", i, psf); 56 return false; 57 } 58 } 59 } 60 61 // CNV (convolved) input data (CNV:IMAGE, CNV:MASK, CNV:VARIANCE, CNV:PSF) 62 psString cnvImage = psMetadataLookupStr(&status, input, "CNV:IMAGE"); // Name of image 63 if (cnvImage && strlen(cnvImage) > 0) { 64 cnvInputFile = defineFile(config, NULL, "PSPHOT.STACK.INPUT.CNV", cnvImage, PM_FPA_FILE_IMAGE); // File for image 65 if (!cnvInputFile) { 66 psError(PS_ERR_UNKNOWN, false, "Unable to define file from image %d (%s)", i, cnvImage); 67 return false; 68 } 69 psString mask = psMetadataLookupStr(&status, input, "CNV:MASK"); // Name of mask 70 if (mask && strlen(mask) > 0) { 71 if (!defineFile(config, cnvInputFile, "PSPHOT.STACK.MASK.CNV", mask, PM_FPA_FILE_MASK)) { 72 psError(PS_ERR_UNKNOWN, false, "Unable to define file from mask %d (%s)", i, mask); 73 return false; 74 } 75 } 76 psString variance = psMetadataLookupStr(&status, input, "CNV:VARIANCE"); // Name of variance map 77 if (variance && strlen(variance) > 0) { 78 if (!defineFile(config, cnvInputFile, "PSPHOT.STACK.VARIANCE.CNV", variance, PM_FPA_FILE_VARIANCE)) { 79 psError(PS_ERR_UNKNOWN, false, "Unable to define file from variance %d (%s)", i, variance); 80 return false; 81 } 82 } 83 psString psf = psMetadataLookupStr(&status, input, "CNV:PSF"); // Name of mask 84 if (psf && strlen(psf) > 0) { 85 if (!defineFile(config, cnvInputFile, "PSPHOT.STACK.PSF.CNV", psf, PM_FPA_FILE_PSF)) { 86 psError(PS_ERR_UNKNOWN, false, "Unable to define file from psf %d (%s)", i, psf); 87 return false; 88 } 89 } 90 } 91 92 if (!rawInputFile && !cnvInputFile) { 93 psError(PS_ERR_BAD_PARAMETER_VALUE, true, "Component %s (%d) lacks IMAGE of type STR", item->name, i); 32 94 return false; 33 95 } 34 pmFPAfile *imageFile = defineFile(config, NULL, "PSPHOT.INPUT", image, PM_FPA_FILE_IMAGE); // File for image 35 if (!imageFile) { 36 psError(PS_ERR_UNKNOWN, false, "Unable to define file from image %d (%s)", i, image); 37 return false; 38 } 39 40 psString mask = psMetadataLookupStr(&status, input, "MASK"); // Name of mask 41 if (mask && strlen(mask) > 0) { 42 if (!defineFile(config, imageFile, "PSPHOT.MASK", mask, PM_FPA_FILE_MASK)) { 43 psError(PS_ERR_UNKNOWN, false, "Unable to define file from mask %d (%s)", i, mask); 44 return false; 45 } 46 } 47 48 psString variance = psMetadataLookupStr(&status, input, "VARIANCE"); // Name of variance map 49 if (variance && strlen(variance) > 0) { 50 if (!defineFile(config, imageFile, "PSPHOT.VARIANCE", variance, PM_FPA_FILE_VARIANCE)) { 51 psError(PS_ERR_UNKNOWN, false, "Unable to define file from variance %d (%s)", i, variance); 52 return false; 53 } 54 } 55 // the output sources are carried on the input->fpa structures 56 pmFPAfile *outsources = pmFPAfileDefineOutputFromFile (config, imageFile, "PSPHOT.STACK.OUTPUT"); 57 if (!outsources) { 58 psError(PSPHOT_ERR_CONFIG, false, "Cannot find a rule for PSPHOT.STACK.OUTPUT"); 59 return false; 60 } 61 outsources->save = true; 62 outsources->fileID = i; // this is used to generate output names 96 97 psString sources = psMetadataLookupStr(&status, input, "SOURCES"); // Name of mask 98 // pmFPAfile *srcInputFile = rawInputFile ? rawInputFile : cnvInputFile; 99 if (sources && strlen(sources) > 0) { 100 if (!defineFile(config, NULL, "PSPHOT.STACK.SOURCES", sources, PM_FPA_FILE_CMF)) { 101 psError(PS_ERR_UNKNOWN, false, "Unable to define file from sources %d (%s)", i, sources); 102 return false; 103 } 104 } 105 106 // generate an pmFPAimage for the output convolved image 107 // XXX output of these files should be optional 108 { 109 pmFPAfile *outputImage = pmFPAfileDefineOutput(config, NULL, "PSPHOT.STACK.OUTPUT.IMAGE"); 110 if (!outputImage) { 111 psError(PSPHOT_ERR_CONFIG, false, "Trouble defining PSPHOT.STACK.OUTPUT.IMAGE"); 112 return false; 113 } 114 outputImage->save = true; 115 outputImage->fileID = i; // this is used to generate output names 116 117 pmFPAfile *outputMask = pmFPAfileDefineOutput(config, outputImage->fpa, "PSPHOT.STACK.OUTPUT.MASK"); 118 if (!outputMask) { 119 psError(PS_ERR_IO, false, _("Unable to generate output file from PSPHOT.STACK.OUTPUT.MASK")); 120 return NULL; 121 } 122 if (outputMask->type != PM_FPA_FILE_MASK) { 123 psError(PS_ERR_IO, true, "PSPHOT.STACK.OUTPUT.MASK is not of type MASK"); 124 return NULL; 125 } 126 outputMask->save = true; 127 outputMask->fileID = i; // this is used to generate output names 128 129 pmFPAfile *outputVariance = pmFPAfileDefineOutput(config, outputImage->fpa, "PSPHOT.STACK.OUTPUT.VARIANCE"); 130 if (!outputVariance) { 131 psError(PS_ERR_IO, false, _("Unable to generate output file from PSPHOT.STACK.OUTPUT.VARIANCE")); 132 return NULL; 133 } 134 if (outputVariance->type != PM_FPA_FILE_VARIANCE) { 135 psError(PS_ERR_IO, true, "PSPHOT.STACK.OUTPUT.VARIANCE is not of type VARIANCE"); 136 return NULL; 137 } 138 outputVariance->save = true; 139 outputVariance->fileID = i; // this is used to generate output names 140 141 // the output sources are carried on the outputImage->fpa structures 142 pmFPAfile *outsources = pmFPAfileDefineOutputFromFile (config, outputImage, "PSPHOT.STACK.OUTPUT"); 143 if (!outsources) { 144 psError(PSPHOT_ERR_CONFIG, false, "Cannot find a rule for PSPHOT.STACK.OUTPUT"); 145 return false; 146 } 147 outsources->save = true; 148 outsources->fileID = i; // this is used to generate output names 149 } 63 150 } 64 151 psMetadataRemoveKey(config->arguments, "FILENAMES"); … … 71 158 72 159 // generate an pmFPAimage for the chisqImage 73 pmFPAfile *chisqImage = pmFPAfileDefineOutput(config, NULL, "PSPHOT.CHISQ.IMAGE"); 74 if (!chisqImage) { 75 psError(PSPHOT_ERR_CONFIG, false, "Trouble defining PSPHOT.CHISQ.IMAGE"); 76 return false; 77 } 78 chisqImage->save = true; 79 80 pmFPAfile *chisqMask = pmFPAfileDefineOutput(config, chisqImage->fpa, "PSPHOT.CHISQ.MASK"); 81 if (!chisqMask) { 82 psError(PS_ERR_IO, false, _("Unable to generate output file from PSPHOT.CHISQ.MASK")); 83 return NULL; 84 } 85 if (chisqMask->type != PM_FPA_FILE_MASK) { 86 psError(PS_ERR_IO, true, "PSPHOT.CHISQ.MASK is not of type MASK"); 87 return NULL; 88 } 89 chisqMask->save = true; 90 91 pmFPAfile *chisqVariance = pmFPAfileDefineOutput(config, chisqImage->fpa, "PSPHOT.CHISQ.VARIANCE"); 92 if (!chisqVariance) { 93 psError(PS_ERR_IO, false, _("Unable to generate output file from PSPHOT.CHISQ.VARIANCE")); 94 return NULL; 95 } 96 if (chisqVariance->type != PM_FPA_FILE_VARIANCE) { 97 psError(PS_ERR_IO, true, "PSPHOT.CHISQ.VARIANCE is not of type VARIANCE"); 98 return NULL; 99 } 100 chisqVariance->save = true; 101 102 # if (0) 103 // define the additional input/output files associated with psphot 104 // XXX figure out which files are needed by psphotStack 105 if (false && !psphotDefineFiles (config, input)) { 106 psError(PSPHOT_ERR_CONFIG, false, "Trouble defining the additional input/output files"); 107 return false; 108 } 109 # endif 160 // XXX output of these files should be optional 161 { 162 pmFPAfile *chisqImage = pmFPAfileDefineOutput(config, NULL, "PSPHOT.CHISQ.IMAGE"); 163 if (!chisqImage) { 164 psError(PSPHOT_ERR_CONFIG, false, "Trouble defining PSPHOT.CHISQ.IMAGE"); 165 return false; 166 } 167 chisqImage->save = true; 168 169 pmFPAfile *chisqMask = pmFPAfileDefineOutput(config, chisqImage->fpa, "PSPHOT.CHISQ.MASK"); 170 if (!chisqMask) { 171 psError(PS_ERR_IO, false, _("Unable to generate output file from PSPHOT.CHISQ.MASK")); 172 return NULL; 173 } 174 if (chisqMask->type != PM_FPA_FILE_MASK) { 175 psError(PS_ERR_IO, true, "PSPHOT.CHISQ.MASK is not of type MASK"); 176 return NULL; 177 } 178 chisqMask->save = true; 179 180 pmFPAfile *chisqVariance = pmFPAfileDefineOutput(config, chisqImage->fpa, "PSPHOT.CHISQ.VARIANCE"); 181 if (!chisqVariance) { 182 psError(PS_ERR_IO, false, _("Unable to generate output file from PSPHOT.CHISQ.VARIANCE")); 183 return NULL; 184 } 185 if (chisqVariance->type != PM_FPA_FILE_VARIANCE) { 186 psError(PS_ERR_IO, true, "PSPHOT.CHISQ.VARIANCE is not of type VARIANCE"); 187 return NULL; 188 } 189 chisqVariance->save = true; 190 } 110 191 111 192 psTrace("psphot", 1, "Done with psphotStackParseCamera...\n"); … … 145 226 } 146 227 228 229 /*** 230 * 231 * psphotStack : 232 233 * * inputs: 234 * * unconvolved images 235 * * raw convolved images 236 * * psfs (unconvolved or convolved?) 237 * * sources 238 239 * optionally convolve the unconvolved or the raw inputs 240 * optionally perform no convolutions 241 * optionally save the psf-matched images 242 243 */ 244 245 246 # if (0) 247 // define the additional input/output files associated with psphot 248 // XXX figure out which files are needed by psphotStack 249 if (false && !psphotDefineFiles (config, input)) { 250 psError(PSPHOT_ERR_CONFIG, false, "Trouble defining the additional input/output files"); 251 return false; 252 } 253 # endif 254
Note:
See TracChangeset
for help on using the changeset viewer.
