Changeset 23235
- Timestamp:
- Mar 9, 2009, 3:16:06 PM (17 years ago)
- Location:
- trunk/ppSub/src
- Files:
-
- 4 edited
-
ppSubArguments.c (modified) (4 diffs)
-
ppSubCamera.c (modified) (5 diffs)
-
ppSubMakePSF.c (modified) (1 diff)
-
ppSubMatchPSFs.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ppSub/src/ppSubArguments.c
r22735 r23235 30 30 fprintf(stderr, "\nPan-STARRS PSF-matched image subtraction\n\n"); 31 31 fprintf(stderr, "Usage: %s INPUT.fits REFERENCE.fits OUTPUT_ROOT \n" 32 "\t[-psf REFERENCE.psf.fits] [-sources REFERENCE.cmf]\n\n"32 "\t[-psf REFERENCE.psf.fits]\n\n" 33 33 "This subtracts the convolved REFERENCE from the INPUT, by default.\n", 34 34 program); … … 205 205 } 206 206 207 pmConfigFileSetsMD(config->arguments, &argc, argv, "PPSUB.SOURCES", "-sources", NULL);208 209 207 psMetadata *arguments = config->arguments; // Command-line arguments 210 208 psMetadataAddStr(arguments, PS_LIST_TAIL, "-inmask", 0, "Input mask image", NULL); 211 209 psMetadataAddStr(arguments, PS_LIST_TAIL, "-invariance", 0, "Input variance image", NULL); 210 psMetadataAddStr(arguments, PS_LIST_TAIL, "-insources", 0, "Input source list", NULL); 212 211 psMetadataAddStr(arguments, PS_LIST_TAIL, "-refmask", 0, "Reference mask image", NULL); 213 212 psMetadataAddStr(arguments, PS_LIST_TAIL, "-refvariance", 0, "Reference variance image", NULL); 213 psMetadataAddStr(arguments, PS_LIST_TAIL, "-refsources", 0, "Reference source list", NULL); 214 214 psMetadataAddStr(arguments, PS_LIST_TAIL, "-stats", 0, "Statistics file", NULL); 215 215 psMetadataAddF32(arguments, PS_LIST_TAIL, "-region", 0, "Size of iso-kernel region", NAN); … … 272 272 fileList("INPUT.VARIANCE", inVariance, "Name of the input variance image", config); 273 273 } 274 const char *inSources = psMetadataLookupStr(NULL, arguments, "-insources"); // Name of input source list 275 if (inSources && strlen(inSources) > 0) { 276 fileList("INPUT.SOURCES", inSources, "Name of the input source list", config); 277 } 274 278 275 279 const char *refMask = psMetadataLookupStr(NULL, arguments, "-refmask"); // Name of reference mask … … 280 284 if (refVariance && strlen(refVariance) > 0) { 281 285 fileList("REF.VARIANCE", refVariance, "Name of the reference variance image", config); 286 } 287 const char *refSources = psMetadataLookupStr(NULL, arguments, "-refsources"); // Name of ref source list 288 if (refSources && strlen(refSources) > 0) { 289 fileList("REF.SOURCES", refSources, "Name of the reference source list", config); 282 290 } 283 291 -
trunk/ppSub/src/ppSubCamera.c
r21524 r23235 40 40 pmFPAfile *inputMask = pmFPAfileBindFromArgs(&status, input, config, "PPSUB.INPUT.MASK", "INPUT.MASK"); 41 41 if (!status) { 42 psError (PS_ERR_UNKNOWN, false, "Failed to load file definition PPSUB.INPUT.MASK");42 psError(PS_ERR_UNKNOWN, false, "Failed to load file definition PPSUB.INPUT.MASK"); 43 43 return NULL; 44 44 } … … 51 51 pmFPAfile *inputVariance = pmFPAfileBindFromArgs(&status, input, config, "PPSUB.INPUT.VARIANCE", "INPUT.VARIANCE"); 52 52 if (!status) { 53 psError (PS_ERR_UNKNOWN, false, "Failed to load file definition PPSUB.INPUT.VARIANCE");53 psError(PS_ERR_UNKNOWN, false, "Failed to load file definition PPSUB.INPUT.VARIANCE"); 54 54 return NULL; 55 55 } 56 56 if (inputVariance && inputVariance->type != PM_FPA_FILE_VARIANCE) { 57 57 psError(PS_ERR_IO, true, "PPSUB.INPUT.VARIANCE is not of type VARIANCE"); 58 return false; 59 } 60 61 // Input source list 62 pmFPAfile *inputSources = pmFPAfileBindFromArgs(&status, input, config, "PPSUB.INPUT.SOURCES", "INPUT.SOURCES"); 63 if (!status) { 64 psError(PS_ERR_UNKNOWN, false, "Failed to load file definition PPSUB.INPUT.SOURCES"); 65 return NULL; 66 } 67 if (inputSources && inputSources->type != PM_FPA_FILE_CMF) { 68 psError(PS_ERR_IO, true, "PPSUB.INPUT.SOURCES is not of type CMF"); 58 69 return false; 59 70 } … … 74 85 pmFPAfile *refMask = pmFPAfileBindFromArgs(&status, ref, config, "PPSUB.REF.MASK", "REF.MASK"); 75 86 if (!status) { 76 psError (PS_ERR_UNKNOWN, false, "Failed to load file definition PPSUB.REF.MASK");87 psError(PS_ERR_UNKNOWN, false, "Failed to load file definition PPSUB.REF.MASK"); 77 88 return NULL; 78 89 } … … 85 96 pmFPAfile *refVariance = pmFPAfileBindFromArgs(&status, ref, config, "PPSUB.REF.VARIANCE", "REF.VARIANCE"); 86 97 if (!status) { 87 psError (PS_ERR_UNKNOWN, false, "Failed to load file definition PPSUB.REF.VARIANCE");98 psError(PS_ERR_UNKNOWN, false, "Failed to load file definition PPSUB.REF.VARIANCE"); 88 99 return NULL; 89 100 } 90 101 if (refVariance && refVariance->type != PM_FPA_FILE_VARIANCE) { 91 102 psError(PS_ERR_IO, true, "PPSUB.REF.VARIANCE is not of type VARIANCE"); 103 return false; 104 } 105 106 // Reference source list 107 pmFPAfile *refSources = pmFPAfileBindFromArgs(&status, ref, config, "PPSUB.REF.SOURCES", "REF.SOURCES"); 108 if (!status) { 109 psError(PS_ERR_UNKNOWN, false, "Failed to load file definition PPSUB.REF.SOURCES"); 110 return NULL; 111 } 112 if (refSources && refSources->type != PM_FPA_FILE_CMF) { 113 psError(PS_ERR_IO, true, "PPSUB.REF.SOURCES is not of type CMF"); 92 114 return false; 93 115 } … … 241 263 outKernels->save = true; 242 264 243 #if 0244 if (!pmFPAAddSourceFromFormat(output->fpa, "Subtraction", output->format)) {245 psError(PS_ERR_UNKNOWN, false, "Unable to generate output FPA.");246 return false;247 }248 #endif249 250 pmFPAfile *sources = pmFPAfileDefineFromArgs(&status, config, "PPSUB.SOURCES", "PPSUB.SOURCES");251 if (!status) {252 psError(PS_ERR_IO, false, "Failed to load file definition PPSUB.SOURCES");253 return false;254 }255 if (sources && sources->type != PM_FPA_FILE_CMF) {256 psError(PS_ERR_IO, true, "PPSUB.SOURCES is not of type CMF");257 return false;258 }259 265 260 266 psMetadata *recipe = psMetadataLookupMetadata(NULL, config->recipes, PPSUB_RECIPE); // Recipe for ppSim -
trunk/ppSub/src/ppSubMakePSF.c
r21524 r23235 81 81 // Extract the loaded sources from the associated readout, and generate PSF 82 82 // Here, we assume the image is background-subtracted 83 pmReadout *sourcesRO = pmFPAfileThisReadout(config->files, view, "PPSUB.SOURCES"); 84 psArray *sources = psMetadataLookupPtr(&mdok, sourcesRO->analysis, "PSPHOT.SOURCES"); 83 psArray *sources = psMetadataLookupPtr(&mdok, minuend->analysis, "PSPHOT.SOURCES"); 85 84 if (!psphotReadoutFindPSF(config, view, sources)) { 86 85 psError(PS_ERR_UNKNOWN, false, "Unable to perform photometry on subtracted image."); -
trunk/ppSub/src/ppSubMatchPSFs.c
r23217 r23235 50 50 51 51 // Sources in image, used for stamps: these must be loaded from previous analysis stages 52 pmReadout *sourcesRO = pmFPAfileThisReadout(config->files, view, "PPSUB.SOURCES"); // Readout with sources 53 psArray *sources = NULL; // Sources in image; used for stamps 54 if (sourcesRO) { 55 sources = psMetadataLookupPtr(&mdok, sourcesRO->analysis, "PSPHOT.SOURCES"); 52 psArray *inSources = psMetadataLookupPtr(&mdok, inRO->analysis, "PSPHOT.SOURCES"); // Input source list 53 psArray *refSources = psMetadataLookupPtr(&mdok, refRO->analysis, "PSPHOT.SOURCES"); // Ref source list 54 55 psArray *sources = NULL; // Merged list of sources 56 if (inSources && refSources) { 57 float radius = psMetadataLookupF32(NULL, recipe, "SOURCE.RADIUS"); // Matching radius 58 psArray *lists = psArrayAlloc(2); // Source lists 59 lists->data[0] = psMemIncrRefCounter(inSources); 60 lists->data[1] = psMemIncrRefCounter(refSources); 61 sources = pmSourceMatchMerge(lists, radius); 62 psFree(lists); 63 if (!sources) { 64 psError(PS_ERR_UNKNOWN, false, "Unable to merge source lists"); 65 return false; 66 } 67 } else if (inSources) { 68 sources = psMemIncrRefCounter(inSources); 69 } else if (refSources) { 70 sources = psMemIncrRefCounter(refSources); 56 71 } 72 73 psMetadataAddArray(inConv->analysis, PS_LIST_TAIL, "PSPHOT.SOURCES", PS_META_REPLACE, 74 "Merged source list", sources); 75 psMetadataAddArray(refConv->analysis, PS_LIST_TAIL, "PSPHOT.SOURCES", PS_META_REPLACE, 76 "Merged source list", sources); 77 psFree(sources); // Drop reference 57 78 58 79 int footprint = psMetadataLookupS32(NULL, recipe, "STAMP.FOOTPRINT"); // Stamp half-size
Note:
See TracChangeset
for help on using the changeset viewer.
