Changeset 21524 for trunk/ppSub/src/ppSubMatchPSFs.c
- Timestamp:
- Feb 17, 2009, 2:31:20 PM (17 years ago)
- File:
-
- 1 edited
-
trunk/ppSub/src/ppSubMatchPSFs.c (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ppSub/src/ppSubMatchPSFs.c
r21360 r21524 6 6 * 7 7 * @author IfA 8 * @version $Revision: 1. 2$ $Name: not supported by cvs2svn $9 * @date $Date: 2009-02- 06 01:37:17$8 * @version $Revision: 1.3 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2009-02-18 00:31:20 $ 10 10 * Copyright 2009 Institute for Astronomy, University of Hawaii 11 11 */ 12 12 13 #ifdef HAVE_CONFIG_H 14 #include <config.h> 15 #endif 16 17 #include <stdio.h> 18 #include <pslib.h> 19 #include <psmodules.h> 20 #include <psphot.h> 21 13 22 #include "ppSub.h" 14 23 15 /** Generate the PSF-matching kernel and convolve the images as needed. Most of this function 16 * involves looking up the parameters in the recipe and supplying them to the function 17 * pmSubtractionMatch(); 18 */ 19 20 bool ppSubMatchPSFs (pmConfig *config, const pmFPAview *view) { 21 22 bool mdok; // Status of MD lookup 24 bool ppSubMatchPSFs(pmConfig *config, const pmFPAview *view) 25 { 26 psAssert(config, "Require configuration"); 27 psAssert(view, "Require view"); 23 28 24 29 // Look up recipe values … … 26 31 psAssert(recipe, "We checked this earlier, so it should be here."); 27 32 28 // input images33 // Input images 29 34 pmReadout *inRO = pmFPAfileThisReadout(config->files, view, "PPSUB.INPUT"); // Input readout 30 35 pmReadout *refRO = pmFPAfileThisReadout(config->files, view, "PPSUB.REF"); // Reference readout 31 36 32 // get or generate output image holders33 pmReadout *inConv = pmFPAfileThisReadout(config->files, view, "PPSUB.INPUT.CONV"); // Input convolved readout37 // Output image holders 38 pmReadout *inConv = pmFPAfileThisReadout(config->files, view, "PPSUB.INPUT.CONV"); // Input convolved 34 39 if (!inConv) { 35 pmCell *cell = pmFPAfileThisCell(config->files, view, "PPSUB.INPUT.CONV"); // Input convolved readout36 inConv = pmReadoutAlloc(cell); // Convolved version of input 40 pmCell *cell = pmFPAfileThisCell(config->files, view, "PPSUB.INPUT.CONV"); // Cell for convolved input 41 inConv = pmReadoutAlloc(cell); 37 42 } 38 pmReadout *refConv = pmFPAfileThisReadout(config->files, view, "PPSUB.REF.CONV"); // Reference convolved readout43 pmReadout *refConv = pmFPAfileThisReadout(config->files, view, "PPSUB.REF.CONV"); // Reference convolved 39 44 if (!refConv) { 40 pmCell *cell = pmFPAfileThisCell(config->files, view, "PPSUB.REF.CONV"); // Input convolved readout 41 refConv = pmReadoutAlloc(cell); // Convolved version of input 45 pmCell *cell = pmFPAfileThisCell(config->files, view, "PPSUB.REF.CONV"); // Cell for convolved ref. 46 refConv = pmReadoutAlloc(cell); 42 47 } 43 48 44 // options which control the generation of optimal parameters 45 bool optimum = psMetadataLookupBool(&mdok, recipe, "OPTIMUM"); // Derive optimum parameters? 46 float optMin = psMetadataLookupF32(&mdok, recipe, "OPTIMUM.MIN"); // Minimum width for search 47 float optMax = psMetadataLookupF32(&mdok, recipe, "OPTIMUM.MAX"); // Maximum width for search 48 float optStep = psMetadataLookupF32(&mdok, recipe, "OPTIMUM.STEP"); // Step for search 49 bool mdok; // Status of MD lookup 49 50 50 // Vector with FWHMs for optimum search 51 psVector *optWidths = NULL; 52 if (optimum) { 53 optWidths = psVectorCreate(optWidths, optMin, optMax, optStep, PS_TYPE_F32); 54 } 55 56 // Sources in image : these must be loaded from previous analysis stages 57 pmReadout *sourcesRO = pmFPAfileThisReadout(config->files, view, "PPSUB.SOURCES"); // Readout with sources 58 psArray *sources = NULL; 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 59 54 if (sourcesRO) { 60 55 sources = psMetadataLookupPtr(&mdok, sourcesRO->analysis, "PSPHOT.SOURCES"); … … 66 61 float spacing = psMetadataLookupF32(NULL, recipe, "STAMP.SPACING"); // Typical stamp spacing 67 62 float threshold = psMetadataLookupF32(NULL, recipe, "STAMP.THRESHOLD"); // Threshold for stmps 68 69 63 const char *stampsName = psMetadataLookupStr(&mdok, config->arguments, "STAMPS"); // Filename for stamps 70 64 71 65 const char *typeStr = psMetadataLookupStr(NULL, recipe, "KERNEL.TYPE"); // Kernel type 72 66 psAssert(typeStr, "We put it here in ppSubArguments.c"); 73 74 67 pmSubtractionKernelsType type = pmSubtractionKernelsTypeFromString(typeStr); // Type of kernel 75 68 if (type == PM_SUBTRACTION_KERNEL_NONE) { … … 87 80 int binning = psMetadataLookupS32(NULL, recipe, "SPAM.BINNING"); // Binning for SPAM kernel 88 81 float penalty = psMetadataLookupF32(NULL, recipe, "PENALTY"); // Penalty for wideness 89 90 int optOrder = psMetadataLookupS32(&mdok, recipe, "OPTIMUM.ORDER"); // Order for search91 float optThresh = psMetadataLookupF32(&mdok, recipe, "OPTIMUM.TOL"); // Tolerance for search92 93 82 int iter = psMetadataLookupS32(NULL, recipe, "ITER"); // Rejection iterations 94 83 float rej = psMetadataLookupF32(NULL, recipe, "REJ"); // Rejection threshold … … 98 87 float poorFrac = psMetadataLookupF32(&mdok, recipe, "POOR.FRACTION"); // Fraction for "poor" 99 88 100 // XXX EAM : do we need to / want to define different values for BAD and POOR subtraction vs BAD and POOR warp? 101 psImageMaskType maskVal = pmConfigMaskGet("MASK.VALUE", config); // Bits to mask going in to pmSubtractionMatch 89 // Options which control the generation of optimal parameters 90 bool optimum = psMetadataLookupBool(&mdok, recipe, "OPTIMUM"); // Derive optimum parameters? 91 float optMin = psMetadataLookupF32(&mdok, recipe, "OPTIMUM.MIN"); // Minimum width for search 92 float optMax = psMetadataLookupF32(&mdok, recipe, "OPTIMUM.MAX"); // Maximum width for search 93 float optStep = psMetadataLookupF32(&mdok, recipe, "OPTIMUM.STEP"); // Step for search 94 psVector *optWidths = NULL; // Vector with FWHMs for optimum search 95 if (optimum) { 96 optWidths = psVectorCreate(optWidths, optMin, optMax, optStep, PS_TYPE_F32); 97 } 98 int optOrder = psMetadataLookupS32(&mdok, recipe, "OPTIMUM.ORDER"); // Order for search 99 float optThresh = psMetadataLookupF32(&mdok, recipe, "OPTIMUM.TOL"); // Tolerance for search 100 101 // XXX Do we need/want to define different values for BAD and POOR subtraction vs BAD and POOR warp? 102 psImageMaskType maskVal = pmConfigMaskGet("MASK.VALUE", config); // Bits to mask in inputs 102 103 psImageMaskType maskPoor = pmConfigMaskGet("POOR.WARP", config); // Bits to mask for poor pixels 103 104 psImageMaskType maskBad = pmConfigMaskGet("BLANK", config); // Bits to mask for bad pixels … … 124 125 pmSubtractionThreadsFinalize(inRO, refRO); 125 126 127 psImageCovarianceTransfer(inConv->variance, inConv->covariance); 128 psImageCovarianceTransfer(refConv->variance, refConv->covariance); 129 126 130 // XXX drop the pixels associated with inRO and refRO (now that we have inConv and refConf) 127 131
Note:
See TracChangeset
for help on using the changeset viewer.
