Changeset 23740 for trunk/ppSub/src/ppSubCamera.c
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:mergeinfo changed
/branches/pap merged: 23690,23704,23711,23719,23723,23730-23735
- Property svn:mergeinfo changed
-
trunk/ppSub
- Property svn:mergeinfo changed
/branches/pap/ppSub merged: 23704,23711,23719,23723,23730,23732-23734
- Property svn:mergeinfo changed
-
trunk/ppSub/src
- Property svn:ignore
-
old new 10 10 stamp-h1 11 11 ppSubKernel 12 ppSubErrorCodes.h 13 ppSubErrorCodes.c
-
- Property svn:ignore
-
trunk/ppSub/src/ppSubCamera.c
r23688 r23740 134 134 135 135 136 bool ppSubCamera(pmConfig *config )136 bool ppSubCamera(pmConfig *config, ppSubData *data) 137 137 { 138 138 psAssert(config, "Require configuration"); … … 147 147 pmFPAfile *inVar = defineInputFile(config, input, "PPSUB.INPUT.VARIANCE", "INPUT.VARIANCE", 148 148 PM_FPA_FILE_VARIANCE); 149 defineInputFile(config, input, "PPSUB.INPUT.SOURCES", "INPUT.SOURCES", PM_FPA_FILE_CMF);149 defineInputFile(config, NULL, "PPSUB.INPUT.SOURCES", "INPUT.SOURCES", PM_FPA_FILE_CMF); 150 150 151 151 // Reference image … … 158 158 pmFPAfile *refVar = defineInputFile(config, ref, "PPSUB.REF.VARIANCE", "REF.VARIANCE", 159 159 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 } 160 defineInputFile(config, NULL, "PPSUB.REF.SOURCES", "REF.SOURCES", PM_FPA_FILE_CMF); 181 161 182 162 … … 216 196 217 197 198 // Now that the camera has been determined, we can read the recipe 199 psMetadata *recipe = psMetadataLookupMetadata(NULL, config->recipes, PPSUB_RECIPE); // Recipe for ppSim 200 if (!recipe) { 201 psError(PS_ERR_UNEXPECTED_NULL, false, "Unable to find recipe %s", PPSUB_RECIPE); 202 return false; 203 } 204 if (psMetadataLookupBool(NULL, config->arguments, "-photometry")) { 205 psMetadataAddBool(recipe, PS_LIST_TAIL, "PHOTOMETRY", PS_META_REPLACE, 206 "Perform photometry?", true); 207 } 208 if (psMetadataLookupBool(NULL, config->arguments, "-inverse")) { 209 psMetadataAddBool(recipe, PS_LIST_TAIL, "INVERSE", PS_META_REPLACE, 210 "Generate inverse subtractions?", true); 211 } 212 213 data->inverse = psMetadataLookupBool(NULL, recipe, "INVERSE"); 214 data->photometry = psMetadataLookupBool(NULL, recipe, "PHOTOMETRY"); 215 216 217 // Output image 218 pmFPAfile *output = defineOutputFile(config, inConvImage, true, "PPSUB.OUTPUT", PM_FPA_FILE_IMAGE); 219 pmFPAfile *outMask = defineOutputFile(config, output, false, "PPSUB.OUTPUT.MASK", PM_FPA_FILE_MASK); 220 if (!output || !outMask) { 221 psError(PS_ERR_UNKNOWN, false, "Unable to define output files"); 222 return false; 223 } 224 output->save = true; 225 outMask->save = true; 226 if (inVar && refVar) { 227 pmFPAfile *outVar = defineOutputFile(config, output, false, "PPSUB.OUTPUT.VARIANCE", 228 PM_FPA_FILE_VARIANCE); 229 if (!outVar) { 230 psError(PS_ERR_UNKNOWN, false, "Unable to define output files"); 231 return false; 232 } 233 outVar->save = true; 234 } 235 236 pmFPAfile *inverse = NULL; // Inverse output image 237 if (data->inverse) { 238 // Inverse output image 239 inverse = defineOutputFile(config, output, true, "PPSUB.INVERSE", PM_FPA_FILE_IMAGE); 240 pmFPAfile *invMask = defineOutputFile(config, inverse, false, "PPSUB.INVERSE.MASK", 241 PM_FPA_FILE_MASK); 242 if (!inverse || !invMask) { 243 psError(PS_ERR_UNKNOWN, false, "Unable to define output files"); 244 return false; 245 } 246 inverse->save = true; 247 invMask->save = true; 248 if (inVar && refVar) { 249 pmFPAfile *invVar = defineOutputFile(config, inverse, false, "PPSUB.INVERSE.VARIANCE", 250 PM_FPA_FILE_VARIANCE); 251 if (!invVar) { 252 psError(PS_ERR_UNKNOWN, false, "Unable to define output files"); 253 return false; 254 } 255 invVar->save = true; 256 } 257 } 258 259 218 260 // Output JPEGs 219 261 pmFPAfile *jpeg1 = pmFPAfileDefineOutput(config, NULL, "PPSUB.OUTPUT.JPEG1"); … … 245 287 } 246 288 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 289 // psPhot input 254 if ( psMetadataLookupBool(NULL, recipe, "PHOTOMETRY")) {290 if (data->photometry) { 255 291 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 292 269 293 pmFPAfile *psphot = pmFPAfileDefineFromFPA(config, output->fpa, 1, 1, "PSPHOT.INPUT"); … … 276 300 return false; 277 301 } 302 pmFPAfileActivate(config->files, false, "PSPHOT.INPUT"); 303 304 // Internal-ish file for getting the PSF from the minuend 305 pmFPAfile *psf = pmFPAfileDefineOutputFromFile(config, psphot, "PSPHOT.PSF.LOAD"); 306 if (!psf) { 307 psError(PS_ERR_IO, false, "Failed to build FPA from PSPHOT.PSF.LOAD"); 308 return false; 309 } 310 if (psf->type != PM_FPA_FILE_PSF) { 311 psError(PS_ERR_IO, true, "PSPHOT.PSF.LOAD is not of type PSF"); 312 return false; 313 } 314 pmFPAfileActivate(config->files, false, "PSPHOT.PSF.LOAD"); 278 315 279 316 if (!psphotDefineFiles(config, psphot)) { … … 281 318 return false; 282 319 } 320 321 // Deactivate psphot output sources --- we want to define output source files of our own 322 pmFPAfile *psphotOutput = pmFPAfileSelectSingle(config->files, "PSPHOT.OUTPUT", 0); 323 psphotOutput->save = false; 324 325 pmFPAfile *outSources = defineOutputFile(config, output, false, "PPSUB.OUTPUT.SOURCES", 326 PM_FPA_FILE_CMF); 327 if (!outSources) { 328 psError(PS_ERR_UNKNOWN, false, "Unable to set up output source file."); 329 return false; 330 } 331 outSources->save = true; 332 333 if (data->inverse) { 334 pmFPAfile *invSources = defineOutputFile(config, inverse, false, "PPSUB.INVERSE.SOURCES", 335 PM_FPA_FILE_CMF); 336 if (!invSources) { 337 psError(PS_ERR_UNKNOWN, false, "Unable to set up inverse source file."); 338 return false; 339 } 340 invSources->save = true; 341 } 283 342 } 284 343
Note:
See TracChangeset
for help on using the changeset viewer.
