IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 23212


Ignore:
Timestamp:
Mar 6, 2009, 12:48:29 PM (17 years ago)
Author:
Paul Price
Message:

Moving hardwired ppStack values to recipe. Adjusting what's now ZP.MATCH to 0.3 from 0.5 --- not enough sources were getting through, resulting in errors for subtraction (can't find stamps, can't measure PSF).

Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/ippconfig/recipes/ppStack.config

    r21475 r23212  
    3232
    3333ZP.RADIUS       F32     1.0             # Radius (pixels) for matching sources
    34 ZP.ITER         S32     1000            # Maximum iterations for zero point
     34ZP.ITER.1       S32     5               # Iterations for zero point; pass 1
     35ZP.ITER.2       S32     1000            # Iterations for zero point; pass 2
    3536ZP.TOL          F32     1.0e-6          # Tolerance for zero point iterations
    3637ZP.TRANS.ITER   S32     2               # Iterations for transparency determination
    3738ZP.TRANS.REJ    F32     3.0             # Rejection threshold for transparency determination
    3839ZP.TRANS.THRESH F32     1.0             # Threshold for transparency determination
    39 ZP.STAR.REJ     F32     3.0             # Rejection threshold for stars
     40ZP.STAR.REJ.1   F32     20.0            # Rejection threshold for stars; pass 1
     41ZP.STAR.REJ.2   F32     3.0             # Rejection threshold for stars; pass 2
    4042ZP.STAR.LIMIT   F32     1.0e-2          # Limit on star rejection fraction for successful iteration
    41 ZP.STAR.SYS     F32     0.05            # Estimated systematic error
     43ZP.STAR.SYS.1   F32     0.10            # Estimated systematic error; pass 1
     44ZP.STAR.SYS.2   F32     0.05            # Estimated systematic error; pass 2
     45ZP.MATCH        F32     0.3             # Fraction of images to match for good star
    4246ZP.AIRMASS      METADATA                # Airmass terms by filter
    4347        g       F32     0.0
  • trunk/ppStack/src/ppStackArguments.c

    r22733 r23212  
    168168                      "Play safe with small numbers of pixels to combine?", false);
    169169    psMetadataAddF32(arguments, PS_LIST_TAIL, "-zp-radius", 0, "Radius (pixels) for matching sources", NAN);
    170     psMetadataAddS32(arguments, PS_LIST_TAIL, "-zp-iter", 0, "Maximum iterations for zero point", 0);
     170    psMetadataAddS32(arguments, PS_LIST_TAIL, "-zp-iter-1", 0, "Maximum iterations for zero point; pass 1", 0);
     171    psMetadataAddS32(arguments, PS_LIST_TAIL, "-zp-iter-2", 0, "Maximum iterations for zero point; pass 2", 0);
    171172    psMetadataAddF32(arguments, PS_LIST_TAIL, "-zp-tol", 0, "Tolerance for zero point iterations", NAN);
    172173    psMetadataAddS32(arguments, PS_LIST_TAIL, "-zp-trans-iter", 0, "Iterations for transparency determination", 0);
    173174    psMetadataAddF32(arguments, PS_LIST_TAIL, "-zp-trans-rej", 0, "Rejection threshold for transparency determination", NAN);
    174175    psMetadataAddF32(arguments, PS_LIST_TAIL, "-zp-trans-thresh", 0, "Threshold for transparency determination", NAN);
    175     psMetadataAddF32(arguments, PS_LIST_TAIL, "-zp-star-rej", 0, "Rejection threshold for stars", NAN);
     176    psMetadataAddF32(arguments, PS_LIST_TAIL, "-zp-star-rej-1", 0, "Rejection threshold for stars; pass 1", NAN);
     177    psMetadataAddF32(arguments, PS_LIST_TAIL, "-zp-star-rej-2", 0, "Rejection threshold for stars; pass 2", NAN);
    176178    psMetadataAddF32(arguments, PS_LIST_TAIL, "-zp-star-limit", 0, "Limit on star rejection fraction for successful iteration", NAN);
    177     psMetadataAddF32(arguments, PS_LIST_TAIL, "-zp-star-sys", 0, "Estimated systematic error", NAN);
     179    psMetadataAddF32(arguments, PS_LIST_TAIL, "-zp-star-sys-1", 0, "Estimated systematic error; pass 1", NAN);
     180    psMetadataAddF32(arguments, PS_LIST_TAIL, "-zp-star-sys-2", 0, "Estimated systematic error; pass 2", NAN);
    178181    psMetadataAddStr(arguments, PS_LIST_TAIL, "-temp-image", 0, "Suffix for temporary images", NULL);
    179182    psMetadataAddStr(arguments, PS_LIST_TAIL, "-temp-mask", 0, "Suffix for temporary masks", NULL);
     
    242245
    243246    VALUE_ARG_RECIPE_FLOAT("-zp-radius",       "ZP.RADIUS",       F32);
    244     VALUE_ARG_RECIPE_INT("-zp-iter",           "ZP.ITER",         S32, 0);
     247    VALUE_ARG_RECIPE_INT("-zp-iter-1",         "ZP.ITER.1",       S32, 0);
     248    VALUE_ARG_RECIPE_INT("-zp-iter-2",         "ZP.ITER.2",       S32, 0);
    245249    VALUE_ARG_RECIPE_FLOAT("-zp-tol",          "ZP.TOL",          F32);
    246250    VALUE_ARG_RECIPE_INT("-zp-trans-iter",     "ZP.TRANS.ITER",   S32, 0);
    247251    VALUE_ARG_RECIPE_FLOAT("-zp-trans-rej",    "ZP.TRANS.REJ",    F32);
    248252    VALUE_ARG_RECIPE_FLOAT("-zp-trans-thresh", "ZP.TRANS.THRESH", F32);
    249     VALUE_ARG_RECIPE_FLOAT("-zp-star-rej",     "ZP.STAR.REJ",     F32);
     253    VALUE_ARG_RECIPE_FLOAT("-zp-star-rej-1",   "ZP.STAR.REJ.1",   F32);
     254    VALUE_ARG_RECIPE_FLOAT("-zp-star-rej-2",   "ZP.STAR.REJ.2",   F32);
    250255    VALUE_ARG_RECIPE_FLOAT("-zp-star-limit",   "ZP.STAR.LIMIT",   F32);
    251     VALUE_ARG_RECIPE_FLOAT("-zp-star-sys",     "ZP.STAR.SYS",     F32);
     256    VALUE_ARG_RECIPE_FLOAT("-zp-star-sys-1",   "ZP.STAR.SYS.1",   F32);
     257    VALUE_ARG_RECIPE_FLOAT("-zp-star-sys-2",   "ZP.STAR.SYS.2",   F32);
    252258
    253259    VALUE_ARG_RECIPE_INT("-psf-instances", "PSF.INSTANCES", S32, 0);
  • trunk/ppStack/src/ppStackSources.c

    r23211 r23212  
    8181
    8282    float radius = psMetadataLookupF32(NULL, recipe, "ZP.RADIUS"); // Radius (pixels) for matching sources
    83     int iter = psMetadataLookupS32(NULL, recipe, "ZP.ITER"); // Maximum iterations
     83    int iter1 = psMetadataLookupS32(NULL, recipe, "ZP.ITER.1"); // Maximum iterations for pass 1
     84    int iter2 = psMetadataLookupS32(NULL, recipe, "ZP.ITER.2"); // Maximum iterations for pass 2
    8485    float tol = psMetadataLookupF32(NULL, recipe, "ZP.TOL"); // Tolerance for zero point iterations
    8586    int transIter = psMetadataLookupS32(NULL, recipe, "ZP.TRANS.ITER"); // Iterations for transparency
    8687    float transRej = psMetadataLookupF32(NULL, recipe, "ZP.TRANS.REJ");// Rejection threshold for transparency
    8788    float transThresh = psMetadataLookupF32(NULL, recipe, "ZP.TRANS.THRESH"); // Threshold for transparency
    88     float starRej = psMetadataLookupF32(NULL, recipe, "ZP.STAR.REJ"); // Rejection threshold for stars
     89
     90    float starRej1 = psMetadataLookupF32(NULL, recipe, "ZP.STAR.REJ.1"); // Rejection threshold for stars
     91    float starSys1 = psMetadataLookupF32(NULL, recipe, "ZP.STAR.SYS.1"); // Estimated systematic error
     92    float starRej2 = psMetadataLookupF32(NULL, recipe, "ZP.STAR.REJ.2"); // Rejection threshold for stars
     93    float starSys2 = psMetadataLookupF32(NULL, recipe, "ZP.STAR.SYS.2"); // Estimated systematic error
     94
    8995    float starLimit = psMetadataLookupF32(NULL, recipe, "ZP.STAR.LIMIT"); // Limit on star rejection fraction
    90     float starSys = psMetadataLookupF32(NULL, recipe, "ZP.STAR.SYS"); // Estimated systematic error
     96
     97    float fracMatch = psMetadataLookupF32(NULL, recipe, "ZP.MATCH"); // Fraction of images to match for star
    9198
    9299    psMetadata *airmassZP = psMetadataLookupMetadata(NULL, recipe, "ZP.AIRMASS"); // Airmass terms
     
    164171#endif
    165172
    166     psVector *trans = pmSourceMatchRelphot(matches, zp, iter, tol, starLimit, transIter, transRej,
    167                                            transThresh, starRej, starSys); // Transparencies for each image
     173    psVector *trans = pmSourceMatchRelphot(matches, zp, tol, iter1, starRej1, starSys1,
     174                                           iter2, starRej2, starSys2, starLimit,
     175                                           transIter, transRej, transThresh); // Transparencies for each image
    168176    if (!trans) {
    169177        psError(PS_ERR_UNKNOWN, false, "Unable to measure transparencies");
     
    184192    // XXX this is a really poor output location; clean up the pmFPAfiles used in ppStack
    185193    pmCell *sourcesCell = pmFPAfileThisCell(config->files, view, "PPSTACK.OUTPUT");
    186     psArray *sourcesBest = psArrayAllocEmpty (100);
    187 
    188     // XXX something of a hack: require at least 2 detections or 1/2 of the max possible
    189     int minMatches = PS_MAX(2, 0.3*num);// Minimum number of matches required
     194    psArray *sourcesBest = psArrayAllocEmpty(matches->n);
     195
     196    // XXX something of a hack: require at least 2 detections or the nominated fraction of the max possible
     197    int minMatches = PS_MAX(2, fracMatch * num);// Minimum number of matches required
    190198    for (int i = 0; i < matches->n; i++) {
    191199        pmSourceMatch *match = matches->data[i]; // Match of interest
     
    200208        pmSource *source = sources->data[index]; // Source of interest
    201209
    202         psArrayAdd(sourcesBest, 100, source);
     210        psArrayAdd(sourcesBest, sourcesBest->n, source);
    203211    }
    204212    psMetadataAdd(sourcesCell->analysis, PS_LIST_TAIL, "PSPHOT.SOURCES", PS_DATA_ARRAY | PS_META_REPLACE,
  • trunk/psModules/src/objects/pmSourceMatch.c

    r23189 r23212  
    524524psVector *pmSourceMatchRelphot(const psArray *matches, // Array of matches
    525525                               const psVector *zp, // Zero points for each image (including airmass term)
    526                                int maxIter, // Maximum number of iterations
    527526                               float tol, // Relative tolerance for convergence
     527                               int iter1, // Number of iterations for pass 1
     528                               float rej1, // Limit on rejection between iterations for pass 1
     529                               float sys1, // Systematic error in measurements for pass 1
     530                               int iter2, // Number of iterations for pass 2
     531                               float rej2, // Limit on rejection between iterations for pass 2
     532                               float sys2, // Systematic error in measurements for pass 2
    528533                               float rejLimit, // Limit on rejection between iterations
    529534                               int transIter, // Clipping iterations for transparency
    530535                               float transClip, // Clipping level for transparency
    531                                float photoLevel, // Level at which we declare image is photometric
    532                                float starClip, // Clipping for stars
    533                                float sysErr // Systematic error in measurements
     536                               float photoLevel // Level at which we declare image is photometric
    534537                               )
    535538{
     
    539542    PS_ASSERT_FLOAT_LARGER_THAN(transClip, 0.0, NULL);
    540543
    541     sysErr *= sysErr;
     544    sys1 *= sys1;
     545    sys2 *= sys2;
    542546
    543547    int numImages = zp->n;              // Number of images
     
    552556
    553557    float chi2 = sourceMatchRelphotIterate(trans, stars, badImage, matches, zp,
    554                                            photo, sysErr); // chi^2 for solution
     558                                           photo, sys1); // chi^2 for solution
    555559    psTrace("psModules.objects", 1, "Initial: chi^2 = %f\n", chi2);
    556560    float lastChi2 = INFINITY;          // chi^2 on last iteration
    557561    float fracRej = INFINITY;        // Fraction of measurements rejected
    558562
    559     // in the first passes, the transparencies are not well deteremined: use high systematic error and the rejection thresholds
    560     for (int i = 0; i < 5; i++) {
     563    // In the first passes, the transparencies are not well deteremined: use high systematic error and
     564    // rejection thresholds
     565    for (int i = 0; i < iter1; i++) {
    561566
    562567        // Identify photometric nights
     
    572577        psTrace("psModules.objects", 3, "Pass 1: Determined %d/%d are photometric", numPhoto, numImages);
    573578
    574         // XXX use 20 sigma rejection and 0.1 mag systematic error (move these to the recipe)
    575         fracRej = sourceMatchRelphotReject(trans, stars, matches, zp, photo, badImage, 20.0, PS_SQR(0.1));
     579        fracRej = sourceMatchRelphotReject(trans, stars, matches, zp, photo, badImage, rej1, sys1);
    576580        psTrace("psModules.objects", 3, "Pass 1: %f%% of measurements rejected", fracRej * 100);
    577581
    578         // XXX use 0.05 mag systematic error (move these to the recipe)
    579         chi2 = sourceMatchRelphotIterate(trans, stars, badImage, matches, zp, photo, PS_SQR(0.1));
     582        chi2 = sourceMatchRelphotIterate(trans, stars, badImage, matches, zp, photo, sys1);
    580583        psTrace("psModules.objects", 1, "Pass 1: iter = %d: chi^2 = %f rejected = %f\n", i, chi2, fracRej);
    581584    }
    582585
    583     for (int i = 0; i < maxIter && (fabsf(lastChi2 - chi2) > tol * chi2 || fracRej > rejLimit); i++) {
     586    for (int i = 0; i < iter2 && (fabsf(lastChi2 - chi2) > tol * chi2 || fracRej > rejLimit); i++) {
    584587        lastChi2 = chi2;
    585588
     
    594597            return NULL;
    595598        }
    596         psTrace("psModules.objects", 3, "Determined %d/%d are photometric", numPhoto, numImages);
    597 
    598         fracRej = sourceMatchRelphotReject(trans, stars, matches, zp, photo, badImage, starClip, sysErr);
    599         psTrace("psModules.objects", 3, "%f%% of measurements rejected", fracRej * 100);
    600 
    601         chi2 = sourceMatchRelphotIterate(trans, stars, badImage, matches, zp, photo, sysErr);
    602         psTrace("psModules.objects", 1, "iter = %d: chi^2 = %f rejected = %f\n", i, chi2, fracRej);
     599        psTrace("psModules.objects", 3, "Pass 2: Determined %d/%d are photometric", numPhoto, numImages);
     600
     601        fracRej = sourceMatchRelphotReject(trans, stars, matches, zp, photo, badImage, rej2, sys2);
     602        psTrace("psModules.objects", 3, "Pass 2: %f%% of measurements rejected", fracRej * 100);
     603
     604        chi2 = sourceMatchRelphotIterate(trans, stars, badImage, matches, zp, photo, sys2);
     605        psTrace("psModules.objects", 1, "Pass 2: iter = %d: chi^2 = %f rejected = %f\n", i, chi2, fracRej);
    603606    }
    604607
  • trunk/psModules/src/objects/pmSourceMatch.h

    r20953 r23212  
    5555psVector *pmSourceMatchRelphot(const psArray *matches, // Array of matches
    5656                               const psVector *zp, // Zero points for each image (including airmass term)
    57                                int maxIter, // Maximum number of iterations
    5857                               float tol, // Relative tolerance for convergence
     58                               int iter1, // Number of iterations for pass 1
     59                               float rej1, // Limit on rejection between iterations for pass 1
     60                               float sys1, // Systematic error in measurements for pass 1
     61                               int iter2, // Number of iterations for pass 2
     62                               float rej2, // Limit on rejection between iterations for pass 2
     63                               float sys2, // Systematic error in measurements for pass 2
    5964                               float rejLimit, // Limit on rejection between iterations
    6065                               int transIter, // Clipping iterations for transparency
    6166                               float transClip, // Clipping level for transparency
    62                                float photoLevel, // Level at which we declare image is photometric
    63                                float starClip, // Clipping for stars
    64                                float sysErr // Systematic error in measurements
     67                               float photoLevel // Level at which we declare image is photometric
    6568    );
    6669
Note: See TracChangeset for help on using the changeset viewer.