IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Aug 5, 2008, 11:52:02 AM (18 years ago)
Author:
Paul Price
Message:

Adding configuration dumping. Required reorganisation of how recipe values get into the program. Formerly, the command-line and recipe values were parsed and the result was put on config->arguments. Now, we want whatever was altered by the command-line to be reflected in the recipe (which is dumped), so using the recipe as the storage. Not yet tested, but will do so soon.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ppSub/src/ppSubReadout.c

    r18612 r18920  
    5858    PS_ASSERT_IMAGES_SIZE_EQUAL(input, reference, false);
    5959
    60     // Look up appropriate values
     60    // Look up recipe values
     61    psMetadata *recipe = psMetadataLookupMetadata(NULL, config->recipes, PPSUB_RECIPE); // Recipe for ppSim
     62    psAssert(recipe, "We checked this earlier, so it should be here.");
     63
     64    const char *typeStr = psMetadataLookupStr(NULL, recipe, "KERNEL.TYPE"); // Kernel type
     65    psAssert(typeStr, "We put it here in ppSubArguments.c");
     66    pmSubtractionKernelsType type = pmSubtractionKernelsTypeFromString(typeStr); // Type of kernel
     67    if (type == PM_SUBTRACTION_KERNEL_NONE) {
     68        psError(PS_ERR_BAD_PARAMETER_VALUE, true, "Unrecognised kernel type: %s", typeStr);
     69        psFree(inConv);
     70        psFree(refConv);
     71        psFree(outRO);
     72        return false;
     73    }
     74
    6175    bool mdok;                          // Status of MD lookup
    62     int size = psMetadataLookupS32(NULL, config->arguments, "KERNEL.SIZE"); // Kernel half-size
    63     int order = psMetadataLookupS32(NULL, config->arguments, "SPATIAL.ORDER"); // Spatial polynomial order
    64     float regionSize = psMetadataLookupF32(NULL, config->arguments, "REGION.SIZE"); // Size of iso-kernel regs
    65     float spacing = psMetadataLookupF32(NULL, config->arguments, "STAMP.SPACING"); // Typical stamp spacing
    66     int footprint = psMetadataLookupS32(NULL, config->arguments, "STAMP.FOOTPRINT"); // Stamp half-size
    67     float threshold = psMetadataLookupF32(NULL, config->arguments, "STAMP.THRESHOLD"); // Threshold for stmps
    68     int iter = psMetadataLookupS32(NULL, config->arguments, "ITER"); // Rejection iterations
    69     float rej = psMetadataLookupF32(NULL, config->arguments, "REJ"); // Rejection threshold
    70     pmSubtractionKernelsType type = psMetadataLookupS32(NULL, config->arguments,
    71                                                         "KERNEL.TYPE"); // Kernel type
     76    int size = psMetadataLookupS32(NULL, recipe, "KERNEL.SIZE"); // Kernel half-size
     77    int order = psMetadataLookupS32(NULL, recipe, "SPATIAL.ORDER"); // Spatial polynomial order
     78    float regionSize = psMetadataLookupF32(NULL, recipe, "REGION.SIZE"); // Size of iso-kernel regs
     79    float spacing = psMetadataLookupF32(NULL, recipe, "STAMP.SPACING"); // Typical stamp spacing
     80    int footprint = psMetadataLookupS32(NULL, recipe, "STAMP.FOOTPRINT"); // Stamp half-size
     81    float threshold = psMetadataLookupF32(NULL, recipe, "STAMP.THRESHOLD"); // Threshold for stmps
     82    int iter = psMetadataLookupS32(NULL, recipe, "ITER"); // Rejection iterations
     83    float rej = psMetadataLookupF32(NULL, recipe, "REJ"); // Rejection threshold
    7284    bool reverse = psMetadataLookupBool(NULL, config->arguments, "REVERSE"); // Reverse sense of subtraction?
    73     psVector *widths = psMetadataLookupPtr(NULL, config->arguments, "ISIS.WIDTHS"); // ISIS Gaussian widths
    74     psVector *orders = psMetadataLookupPtr(NULL, config->arguments, "ISIS.ORDERS"); // ISIS Polynomial orders
    75     int inner = psMetadataLookupS32(NULL, config->arguments, "INNER"); // Inner radius
    76     int ringsOrder = psMetadataLookupS32(NULL, config->arguments, "RINGS.ORDER"); // RINGS polynomial order
    77     int binning = psMetadataLookupS32(NULL, config->arguments, "SPAM.BINNING"); // Binning for SPAM kernel
    78     float penalty = psMetadataLookupF32(NULL, config->arguments, "PENALTY"); // Penalty for wideness
     85    psVector *widths = psMetadataLookupPtr(NULL, recipe, "ISIS.WIDTHS"); // ISIS Gaussian widths
     86    psVector *orders = psMetadataLookupPtr(NULL, recipe, "ISIS.ORDERS"); // ISIS Polynomial orders
     87    int inner = psMetadataLookupS32(NULL, recipe, "INNER"); // Inner radius
     88    int ringsOrder = psMetadataLookupS32(NULL, recipe, "RINGS.ORDER"); // RINGS polynomial order
     89    int binning = psMetadataLookupS32(NULL, recipe, "SPAM.BINNING"); // Binning for SPAM kernel
     90    float penalty = psMetadataLookupF32(NULL, recipe, "PENALTY"); // Penalty for wideness
    7991    psMaskType maskIn = pmConfigMaskGet("MASK.VALUE", config); // Bits to mask going in to pmSubtractionMatch
    8092    psMaskType maskOut = pmConfigMaskGet("BLANK", config); // Bits to mask after pmSubtractionMatch
    81     float badFrac = psMetadataLookupF32(NULL, config->arguments, "BADFRAC"); // Maximum bad fraction
     93    float badFrac = psMetadataLookupF32(NULL, recipe, "BADFRAC"); // Maximum bad fraction
    8294    const char *stampsName = psMetadataLookupStr(&mdok, config->arguments, "STAMPS"); // Filename for stamps
    8395
    84     bool optimum = psMetadataLookupBool(&mdok, config->arguments, "OPTIMUM"); // Derive optimum parameters?
    85     float optMin = psMetadataLookupF32(&mdok, config->arguments, "OPTIMUM.MIN"); // Minimum width for search
    86     float optMax = psMetadataLookupF32(&mdok, config->arguments, "OPTIMUM.MAX"); // Maximum width for search
    87     float optStep = psMetadataLookupF32(&mdok, config->arguments, "OPTIMUM.STEP"); // Step for search
    88     float optThresh = psMetadataLookupF32(&mdok, config->arguments, "OPTIMUM.TOL"); // Tolerance for search
    89     int optOrder = psMetadataLookupS32(&mdok, config->arguments, "OPTIMUM.ORDER"); // Order for search
    90     bool dual = psMetadataLookupBool(&mdok, config->arguments, "DUAL"); // Dual convolution?
    91     bool renorm = psMetadataLookupBool(&mdok, config->arguments, "RENORM"); // Renormalise weights?
    92     int renormWidth = psMetadataLookupS32(&mdok, config->arguments, "RENORM.WIDTH"); // Width for renormalise
     96    bool optimum = psMetadataLookupBool(&mdok, recipe, "OPTIMUM"); // Derive optimum parameters?
     97    float optMin = psMetadataLookupF32(&mdok, recipe, "OPTIMUM.MIN"); // Minimum width for search
     98    float optMax = psMetadataLookupF32(&mdok, recipe, "OPTIMUM.MAX"); // Maximum width for search
     99    float optStep = psMetadataLookupF32(&mdok, recipe, "OPTIMUM.STEP"); // Step for search
     100    float optThresh = psMetadataLookupF32(&mdok, recipe, "OPTIMUM.TOL"); // Tolerance for search
     101    int optOrder = psMetadataLookupS32(&mdok, recipe, "OPTIMUM.ORDER"); // Order for search
     102    bool dual = psMetadataLookupBool(&mdok, recipe, "DUAL"); // Dual convolution?
     103    bool renorm = psMetadataLookupBool(&mdok, recipe, "RENORM"); // Renormalise weights?
     104    int renormWidth = psMetadataLookupS32(&mdok, recipe, "RENORM.WIDTH"); // Width for renormalise
    93105
    94106    pmSubtractionMode mode = dual ? PM_SUBTRACTION_MODE_DUAL : PM_SUBTRACTION_MODE_UNSURE; // Subtraction mode
     
    97109    int numCols = input->numCols, numRows = input->numRows; // Image dimensions
    98110    if (!inRO->mask) {
    99         if (psMetadataLookupBool(NULL, config->arguments, "MASK.GENERATE")) {
     111        if (psMetadataLookupBool(NULL, recipe, "MASK.GENERATE")) {
    100112            pmReadoutSetMask(inRO, pmConfigMaskGet("SAT", config), pmConfigMaskGet("BAD", config));
    101113        } else {
     
    105117    }
    106118    if (!refRO->mask) {
    107         if (psMetadataLookupBool(NULL, config->arguments, "MASK.GENERATE")) {
     119        if (psMetadataLookupBool(NULL, recipe, "MASK.GENERATE")) {
    108120            pmReadoutSetMask(refRO, pmConfigMaskGet("SAT", config), pmConfigMaskGet("BAD", config));
    109121        } else {
     
    220232    // Photometry stage 1: measure the PSF
    221233    pmPSF *psf = NULL;                  // PSF for photometry
    222     if (psMetadataLookupBool(NULL, config->arguments, "PHOTOMETRY")) {
     234    if (psMetadataLookupBool(NULL, recipe, "PHOTOMETRY")) {
    223235        outRO->image = psImageCopy(outRO->image, minuend->image, PS_TYPE_F32);
    224236        if (minuend->weight) {
     
    319331
    320332    // QA: photometry of known sources with measured PSF
    321     if (sourcesRO && psMetadataLookupBool(NULL, config->arguments, "PHOTOMETRY")) {
     333    if (sourcesRO && psMetadataLookupBool(NULL, recipe, "PHOTOMETRY")) {
    322334        sources = psMetadataLookupPtr(&mdok, sourcesRO->analysis, "PSPHOT.SOURCES");
    323335
     
    374386
    375387    // Photometry stage 2: find and measure sources on the subtracted image
    376     if (psMetadataLookupBool(NULL, config->arguments, "PHOTOMETRY")) {
     388    if (psMetadataLookupBool(NULL, recipe, "PHOTOMETRY")) {
    377389        // The PSF should already be stored for the readout
    378390        pmFPAfile *photFile = psMetadataLookupPtr(NULL, config->files, "PSPHOT.INPUT");
Note: See TracChangeset for help on using the changeset viewer.