IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 13512


Ignore:
Timestamp:
May 24, 2007, 11:48:31 AM (19 years ago)
Author:
Paul Price
Message:

Use seeing information provided to perform additional rejection

Location:
trunk/ppStack/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/ppStack/src/ppStackArguments.c

    r13489 r13512  
    8585    psMetadataAddU8(arguments,  PS_LIST_TAIL, "-mask-bad", 0, "Mask value for bad pixels", 0);
    8686    psMetadataAddU8(arguments,  PS_LIST_TAIL, "-mask-blank", 0, "Mask value for blank region", 0);
     87    psMetadataAddStr(arguments, PS_LIST_TAIL, "-seeing", 0, "Name of file with seeing FWHMs", NULL);
    8788
    8889    if (argc == 1 || !psArgumentParse(arguments, &argc, argv) || argc != 4) {
     
    112113    VALUE_ARG_RECIPE_INT("-mask-blank",     "MASK.BLANK",   U8, 0);
    113114
     115    const char *seeingName = psMetadataLookupStr(NULL, arguments, "-seeing"); // Name of seeing file
     116    if (seeingName && strlen(seeingName) > 0) {
     117        psArray *seeing = psVectorsReadFromFile(seeingName, "%f"); // Array with seeing vector only
     118        if (!seeing || seeing->n != 1) {
     119            psError(PS_ERR_UNKNOWN, false, "Unable to read file with seeing FWHMs.");
     120            psFree(seeing);
     121            goto ERROR;
     122        }
     123        psMetadataAddVector(config->arguments, PS_LIST_TAIL, "SEEING", 0, "Seeing in each image",
     124                            seeing->data[0]);
     125        psFree(seeing);
     126    }
     127
    114128    psTrace("ppStack", 1, "Done reading command-line arguments\n");
    115129    psFree(arguments);
  • trunk/ppStack/src/ppStackReadout.c

    r13493 r13512  
    1212
    1313
    14 #define SEEING 1.0                      // Seeing FWHM (pixels)
    1514#define WEIGHT 1.0                      // Weighting
    1615
     
    1817{
    1918    // Get the recipe values
     19    bool mdok;                          // Status of MD lookup
    2020    int iter = psMetadataLookupS32(NULL, config->arguments, "ITER"); // Rejection iterations
    2121    float combineRej = psMetadataLookupF32(NULL, config->arguments, "COMBINE.REJ"); // Combination threshold
     
    2424    psMaskType maskBad = psMetadataLookupU8(NULL, config->arguments, "MASK.BAD"); // Value to mask
    2525    psMaskType maskBlank = psMetadataLookupU8(NULL, config->arguments, "MASK.BLANK"); // Mask for blank reg.
     26    psVector *seeing = psMetadataLookupPtr(&mdok, config->arguments, "SEEING"); // Seeing in each image
    2627
    2728    // Get the output target
     
    3940    psStats *stats = psStatsAlloc(PS_STAT_ROBUST_MEDIAN); // Statistics
    4041    psRandom *rng = psRandomAlloc(0, PS_RANDOM_TAUS); // Random number generator
     42    int fileNum = 0;                    // Number of file
    4143    while ((item = psMetadataGetAndIncrement(inputIter))) {
    4244        assert(item->type == PS_DATA_UNKNOWN);
     
    6971        }
    7072        (void)psBinaryOp(ro->image, ro->image, "/", psScalarAlloc(exposure, PS_TYPE_F32));
    71         pmStackData *data = pmStackDataAlloc(ro, SEEING, WEIGHT); // Data to stack
     73        pmStackData *data = pmStackDataAlloc(ro, seeing ? seeing->data.F32[fileNum] : 0.0,
     74                                             WEIGHT); // Data to stack
    7275        psArrayAdd(stack, ARRAY_BUFFER, data);
    7376        psFree(data);                   // Drop reference
     77        fileNum++;
    7478    }
    7579    psFree(inputIter);
     
    107111#endif
    108112
    109     if (!pmStackReject(stack, maskBad, extent, convolveRej)) {
     113    // Only perform the additional rejection if we have seeing information
     114    if (seeing && !pmStackReject(stack, maskBad, extent, convolveRej)) {
    110115        psError(PS_ERR_UNKNOWN, false, "Unable to reject input pixels.");
    111116        psFree(stack);
Note: See TracChangeset for help on using the changeset viewer.