IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 14582


Ignore:
Timestamp:
Aug 21, 2007, 9:58:39 AM (19 years ago)
Author:
Paul Price
Message:

Fixing up analysis metadata.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psModules/src/imcombine/pmSubtractionMatch.c

    r14580 r14582  
    4444
    4545
    46 bool pmSubtractionMatch(pmReadout *convolved,
    47                         const pmReadout *reference,
    48                         const pmReadout *input,
    49                         int footprint,
    50                         float regionSize,
    51                         float stampSpacing,
    52                         float threshold,
    53                         psString stampsName,
    54                         float targetWidth,
    55                         pmSubtractionKernelsType type,
    56                         int size,
    57                         int order,
    58                         const psVector *isisWidths,
    59                         const psVector *isisOrders,
    60                         int inner,
    61                         int ringsOrder,
    62                         int binning,
    63                         int iter,
    64                         float rej,
    65                         psMaskType maskBad,
    66                         psMaskType maskBlank
    67     )
     46bool pmSubtractionMatch(pmReadout *convolved, const pmReadout *reference, const pmReadout *input,
     47                        int footprint, float regionSize, float stampSpacing, float threshold,
     48                        psString stampsName, float targetWidth, pmSubtractionKernelsType type,
     49                        int size, int order, const psVector *isisWidths, const psVector *isisOrders,
     50                        int inner, int ringsOrder, int binning, int iter, float rej, psMaskType maskBad,
     51                        psMaskType maskBlank)
    6852{
    6953    PS_ASSERT_PTR_NON_NULL(convolved, false);
     
    164148    pmSubtractionKernels *kernels = pmSubtractionKernelsGenerate(type, size, order, isisWidths, isisOrders,
    165149                                                                 inner, binning, ringsOrder);
    166     psMetadataAddStr(convolved->analysis, PS_LIST_TAIL, "SUBTRACTION.DESCRIPTION", 0,
     150    psMetadataAddStr(convolved->analysis, PS_LIST_TAIL, "SUBTRACTION.KERNEL.DESCRIPTION", 0,
    167151                     "Subtraction kernel description", kernels->description);
    168152    psArray *stamps = NULL;             // Stamps for matching PSF
     
    175159    float xRegionSize = 0, yRegionSize = 0; // Size of iso-kernel regions
    176160    psRegion *region = NULL;            // Iso-kernel region
     161    psString regionString = NULL;       // String for region
    177162    if (isfinite(regionSize) || regionSize == 0.0) {
    178163        xRegions = numCols / regionSize + 1;
     
    191176                *region = psRegionSet((int)(i * xRegionSize), (int)((i + 1) * xRegionSize),
    192177                                      (int)(j * yRegionSize), (int)((j + 1) * yRegionSize));
    193                 psString string = psRegionToString(*region);
     178                psFree(regionString);
     179                regionString = psRegionToString(*region);
    194180                psTrace("psModules.imcombine", 3, "Iso-kernel region: %s out of %d,%d\n",
    195                         string, numCols, numRows);
    196                 psFree(string);
     181                        regionString, numCols, numRows);
    197182            }
    198183
     
    267252                    goto ERROR;
    268253                }
    269                 psLogMsg("psModules.imcombine", PS_LOG_INFO, "%d stamps rejected on iteration %d.", numRejected, k);
     254                psLogMsg("psModules.imcombine", PS_LOG_INFO, "%d stamps rejected on iteration %d.",
     255                         numRejected, k);
    270256
    271257                memCheck("  reject stamps");
     
    312298                }
    313299
    314                 psString comment = NULL;// Comment for metadata
    315                 psString regionString = psRegionToString(*region); // String for region
     300                psString comment = NULL; // Comment for metadata
    316301                psStringAppend(&comment, "Subtraction kernel for region %s", regionString);
    317                 psFree(regionString);
    318                 psMetadataAddPtr(convolved->analysis, PS_LIST_TAIL, "SUBTRACTION.KERNEL",
     302                psMetadataAddPtr(convolved->analysis, PS_LIST_TAIL, "SUBTRACTION.KERNEL.IMAGE",
    319303                                 PS_META_DUPLICATE_OK, comment, convKernels);
    320304                psFree(comment);
     
    351335            }
    352336
     337            {
     338                psString comment = NULL; // Comment for metadata
     339                psStringAppend(&comment, "Subtraction solution for region %s", regionString);
     340                psMetadataAddVector(convolved->analysis, PS_LIST_TAIL, "SUBTRACTION.SOLUTION",
     341                                    PS_META_DUPLICATE_OK, comment, solution);
     342                psFree(comment);
     343            }
     344
    353345            psFree(solution);
    354346            solution = NULL;
     347
     348            // There is data in the readout now
     349            convolved->data_exists = true;
     350            convolved->parent->data_exists = true;
     351            convolved->parent->parent->data_exists = true;
    355352        }
    356353    }
    357354    psFree(kernels);
     355    kernels = NULL;
    358356
    359357    psFree(region);
    360358    region = NULL;
     359    psFree(regionString);
     360    regionString = NULL;
    361361    psFree(subMask);
    362362    subMask = NULL;
    363363
    364364    if (!pmSubtractionBorder(convolved->image, convolved->weight, convolved->mask, kernels, maskBlank)) {
    365         psError(PS_ERR_UNKNOWN, false, "Unable to set border region of convolved image.");
     365        psError(PS_ERR_UNKNOWN, false, "Unable to set border of convolved image.");
    366366        goto ERROR;
    367367    }
     
    374374ERROR:
    375375    psFree(region);
     376    psFree(regionString);
    376377    psFree(subMask);
    377378    psFree(kernels);
Note: See TracChangeset for help on using the changeset viewer.