- Timestamp:
- May 26, 2009, 1:59:32 PM (17 years ago)
- Location:
- branches/cnb_branches/cnb_branch_20090301
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/cnb_branches/cnb_branch_20090301
- Property svn:mergeinfo changed
-
branches/cnb_branches/cnb_branch_20090301/ppSub
- Property svn:mergeinfo changed
-
branches/cnb_branches/cnb_branch_20090301/ppSub/src
- Property svn:ignore
-
old new 10 10 stamp-h1 11 11 ppSubKernel 12 ppSubErrorCodes.h 13 ppSubErrorCodes.c 14 ppSubVersionDefinitions.h
-
- Property svn:ignore
-
branches/cnb_branches/cnb_branch_20090301/ppSub/src/ppSubCamera.c
r23594 r24244 134 134 135 135 136 bool ppSubCamera(p mConfig *config)136 bool ppSubCamera(ppSubData *data) 137 137 { 138 psAssert(data, "Require processing data"); 139 pmConfig *config = data->config; 138 140 psAssert(config, "Require configuration"); 139 141 … … 147 149 pmFPAfile *inVar = defineInputFile(config, input, "PPSUB.INPUT.VARIANCE", "INPUT.VARIANCE", 148 150 PM_FPA_FILE_VARIANCE); 149 defineInputFile(config, input, "PPSUB.INPUT.SOURCES", "INPUT.SOURCES", PM_FPA_FILE_CMF);151 defineInputFile(config, NULL, "PPSUB.INPUT.SOURCES", "INPUT.SOURCES", PM_FPA_FILE_CMF); 150 152 151 153 // Reference image … … 158 160 pmFPAfile *refVar = defineInputFile(config, ref, "PPSUB.REF.VARIANCE", "REF.VARIANCE", 159 161 PM_FPA_FILE_VARIANCE); 160 defineInputFile(config, ref, "PPSUB.REF.SOURCES", "REF.SOURCES", PM_FPA_FILE_CMF); 161 162 163 // Output image 164 pmFPAfile *output = defineOutputFile(config, input, true, "PPSUB.OUTPUT", PM_FPA_FILE_IMAGE); 165 pmFPAfile *outMask = defineOutputFile(config, output, false, "PPSUB.OUTPUT.MASK", PM_FPA_FILE_MASK); 166 if (!output || !outMask) { 167 psError(PS_ERR_UNKNOWN, false, "Unable to define output files"); 168 return false; 169 } 170 output->save = true; 171 outMask->save = true; 172 pmFPAfile *outVar = NULL; 173 if (inVar && refVar) { 174 outVar = defineOutputFile(config, output, false, "PPSUB.OUTPUT.VARIANCE", PM_FPA_FILE_VARIANCE); 175 if (!outVar) { 176 psError(PS_ERR_UNKNOWN, false, "Unable to define output files"); 177 return false; 178 } 179 outVar->save = true; 180 } 162 defineInputFile(config, NULL, "PPSUB.REF.SOURCES", "REF.SOURCES", PM_FPA_FILE_CMF); 181 163 182 164 … … 216 198 217 199 200 // Now that the camera has been determined, we can read the recipe 201 psMetadata *recipe = psMetadataLookupMetadata(NULL, config->recipes, PPSUB_RECIPE); // Recipe for ppSim 202 if (!recipe) { 203 psError(PS_ERR_UNEXPECTED_NULL, false, "Unable to find recipe %s", PPSUB_RECIPE); 204 return false; 205 } 206 if (psMetadataLookupBool(NULL, config->arguments, "-photometry")) { 207 psMetadataAddBool(recipe, PS_LIST_TAIL, "PHOTOMETRY", PS_META_REPLACE, 208 "Perform photometry?", true); 209 } 210 if (psMetadataLookupBool(NULL, config->arguments, "-inverse")) { 211 psMetadataAddBool(recipe, PS_LIST_TAIL, "INVERSE", PS_META_REPLACE, 212 "Generate inverse subtractions?", true); 213 } 214 215 data->inverse = psMetadataLookupBool(NULL, recipe, "INVERSE"); 216 data->photometry = psMetadataLookupBool(NULL, recipe, "PHOTOMETRY"); 217 218 219 // Output image 220 pmFPAfile *output = defineOutputFile(config, inConvImage, true, "PPSUB.OUTPUT", PM_FPA_FILE_IMAGE); 221 pmFPAfile *outMask = defineOutputFile(config, output, false, "PPSUB.OUTPUT.MASK", PM_FPA_FILE_MASK); 222 if (!output || !outMask) { 223 psError(PS_ERR_UNKNOWN, false, "Unable to define output files"); 224 return false; 225 } 226 output->save = true; 227 outMask->save = true; 228 if (inVar && refVar) { 229 pmFPAfile *outVar = defineOutputFile(config, output, false, "PPSUB.OUTPUT.VARIANCE", 230 PM_FPA_FILE_VARIANCE); 231 if (!outVar) { 232 psError(PS_ERR_UNKNOWN, false, "Unable to define output files"); 233 return false; 234 } 235 outVar->save = true; 236 } 237 238 pmFPAfile *inverse = NULL; // Inverse output image 239 if (data->inverse) { 240 // Inverse output image 241 inverse = defineOutputFile(config, output, true, "PPSUB.INVERSE", PM_FPA_FILE_IMAGE); 242 pmFPAfile *invMask = defineOutputFile(config, inverse, false, "PPSUB.INVERSE.MASK", 243 PM_FPA_FILE_MASK); 244 if (!inverse || !invMask) { 245 psError(PS_ERR_UNKNOWN, false, "Unable to define output files"); 246 return false; 247 } 248 inverse->save = true; 249 invMask->save = true; 250 if (inVar && refVar) { 251 pmFPAfile *invVar = defineOutputFile(config, inverse, false, "PPSUB.INVERSE.VARIANCE", 252 PM_FPA_FILE_VARIANCE); 253 if (!invVar) { 254 psError(PS_ERR_UNKNOWN, false, "Unable to define output files"); 255 return false; 256 } 257 invVar->save = true; 258 } 259 } 260 261 218 262 // Output JPEGs 219 263 pmFPAfile *jpeg1 = pmFPAfileDefineOutput(config, NULL, "PPSUB.OUTPUT.JPEG1"); … … 245 289 } 246 290 247 psMetadata *recipe = psMetadataLookupMetadata(NULL, config->recipes, PPSUB_RECIPE); // Recipe for ppSim248 if (!recipe) {249 psError(PS_ERR_UNEXPECTED_NULL, false, "Unable to find recipe %s", PPSUB_RECIPE);250 return false;251 }252 253 291 // psPhot input 254 if ( psMetadataLookupBool(NULL, recipe, "PHOTOMETRY")) {292 if (data->photometry) { 255 293 psphotModelClassInit(); // load implementation-specific models 256 257 // Internal-ish file for getting the PSF from the minuend258 pmFPAfile *psf = pmFPAfileDefineOutputFromFile(config, output, "PSPHOT.PSF.LOAD");259 if (!psf) {260 psError(PS_ERR_IO, false, "Failed to build FPA from PSPHOT.PSF.LOAD");261 return false;262 }263 if (psf->type != PM_FPA_FILE_PSF) {264 psError(PS_ERR_IO, true, "PSPHOT.PSF.LOAD is not of type PSF");265 return false;266 }267 pmFPAfileActivate(config->files, false, "PSPHOT.PSF.LOAD");268 294 269 295 pmFPAfile *psphot = pmFPAfileDefineFromFPA(config, output->fpa, 1, 1, "PSPHOT.INPUT"); … … 276 302 return false; 277 303 } 304 pmFPAfileActivate(config->files, false, "PSPHOT.INPUT"); 305 306 // Internal-ish file for getting the PSF from the minuend 307 pmFPAfile *psf = pmFPAfileDefineOutputFromFile(config, psphot, "PSPHOT.PSF.LOAD"); 308 if (!psf) { 309 psError(PS_ERR_IO, false, "Failed to build FPA from PSPHOT.PSF.LOAD"); 310 return false; 311 } 312 if (psf->type != PM_FPA_FILE_PSF) { 313 psError(PS_ERR_IO, true, "PSPHOT.PSF.LOAD is not of type PSF"); 314 return false; 315 } 316 pmFPAfileActivate(config->files, false, "PSPHOT.PSF.LOAD"); 278 317 279 318 if (!psphotDefineFiles(config, psphot)) { … … 281 320 return false; 282 321 } 322 323 // Deactivate psphot output sources --- we want to define output source files of our own 324 pmFPAfile *psphotOutput = pmFPAfileSelectSingle(config->files, "PSPHOT.OUTPUT", 0); 325 psphotOutput->save = false; 326 327 pmFPAfile *outSources = defineOutputFile(config, output, false, "PPSUB.OUTPUT.SOURCES", 328 PM_FPA_FILE_CMF); 329 if (!outSources) { 330 psError(PS_ERR_UNKNOWN, false, "Unable to set up output source file."); 331 return false; 332 } 333 outSources->save = true; 334 335 if (data->inverse) { 336 pmFPAfile *invSources = defineOutputFile(config, inverse, false, "PPSUB.INVERSE.SOURCES", 337 PM_FPA_FILE_CMF); 338 if (!invSources) { 339 psError(PS_ERR_UNKNOWN, false, "Unable to set up inverse source file."); 340 return false; 341 } 342 invSources->save = true; 343 } 283 344 } 284 345 285 346 return true; 286 347 } 348 349
Note:
See TracChangeset
for help on using the changeset viewer.
