IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 15259


Ignore:
Timestamp:
Oct 9, 2007, 9:58:25 AM (19 years ago)
Author:
eugene
Message:

distinguish PS_POLY_MASK_FIT,SET; allow 0th order fitting with 1st order terms fixed for the fit

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psastro/src/psastroMosaicOneChip.c

    r12806 r15259  
    1111    bool status;
    1212    char errorWord[64];
     13    char orderWord[64];
     14
     15    assert (iteration < 4);
    1316
    1417    PS_ASSERT_PTR_NON_NULL(chip,    false);
     
    3134
    3235    // allowed limits for valid solutions
    33     sprintf (errorWord, "PSASTRO.MOSAIC.MAX.ERROR.N%d", iteration);
     36    snprintf (errorWord, 64, "PSASTRO.MOSAIC.MAX.ERROR.N%d", iteration);
    3437    REQUIRED_RECIPE_VALUE (float maxError, errorWord, F32, "failed to find single-chip max allowed error\n");
    3538    REQUIRED_RECIPE_VALUE (int minNstar, "PSASTRO.MOSAIC.MIN.NSTAR", S32, "failed to find single-chip min allowed stars\n");
    3639
    3740    // set the order of the per-chip fit (higher order only if iteration > 0)
    38     int order = 1;
    39     if (iteration > 0) {
    40         // select the desired chip order
    41         REQUIRED_RECIPE_VALUE (order, "PSASTRO.MOSAIC.CHIP.ORDER", S32, "failed to find mosaic chip-level fit order\n");
     41    REQUIRED_RECIPE_VALUE (int defaultOrder, "PSASTRO.MOSAIC.CHIP.ORDER", S32, "failed to find mosaic chip-level fit default order\n");
    4242
    43         // modify the order to correspond to the actual number of matched stars:
    44         if ((match->n < 15) && (order >= 3)) order = 2;
    45         if ((match->n < 11) && (order >= 2)) order = 1;
    46         if ((match->n <  8) && (order >= 1)) order = 0;
    47         if (order < 1) {
    48             psLogMsg ("psastro", 3, "insufficient stars or invalid order: %ld stars", match->n);
    49             return false;
    50         }
     43    snprintf (orderWord, 64, "PSASTRO.MOSAIC.CHIP.ORDER.N%d", iteration);
     44    int order = psMetadataLookupS32 (&status, recipe, orderWord);
     45    if (!status || (order == -1)) {
     46        order = defaultOrder;
    5147    }
    5248
    53     // create output toFPA; set masks appropriate to the Elixir DVO astrometry format
    54     psFree (chip->toFPA);
    55     chip->toFPA = psPlaneTransformAlloc (order, order);
    56     for (int i = 0; i <= chip->toFPA->x->nX; i++) {
    57         for (int j = 0; j <= chip->toFPA->x->nY; j++) {
    58             if (i + j > order) {
    59                 chip->toFPA->x->mask[i][j] = 1;
    60                 chip->toFPA->y->mask[i][j] = 1;
    61             }
    62         }
     49    // modify the order to correspond to the actual number of matched stars:
     50    if ((match->n < 15) && (order >= 3)) order = 2;
     51    if ((match->n < 11) && (order >= 2)) order = 1;
     52    if ((match->n <  8) && (order >= 1)) order = 0;
     53    if ((match->n <  3) || (order < 0) || (order > 3)) {
     54        psLogMsg ("psastro", 3, "insufficient stars (%ld) or invalid order (%d)", match->n, order);
     55        return false;
     56    }
     57
     58    // create output toFPA; set masks appropriate to the Elixir DVO astrometry format if we are
     59    // fitting 0th order, use the current polynomial of whatever order, with higher order
     60    // coefficients frozen to the current values
     61    if (order == 0) {
     62        // set FIT mask for all higher order terms of the existing solution
     63        // any existing SET masks will be retained.
     64        for (int i = 0; i <= chip->toFPA->x->nX; i++) {
     65            for (int j = 0; j <= chip->toFPA->x->nY; j++) {
     66                if (i + j > 0) {
     67                    chip->toFPA->x->coeffMask[i][j] |= PS_POLY_MASK_FIT;
     68                    chip->toFPA->y->coeffMask[i][j] |= PS_POLY_MASK_FIT;
     69                }
     70            }
     71        }
     72    } else {
     73        psFree (chip->toFPA);
     74        chip->toFPA = psPlaneTransformAlloc (order, order);
     75        for (int i = 0; i <= chip->toFPA->x->nX; i++) {
     76            for (int j = 0; j <= chip->toFPA->x->nY; j++) {
     77                if (i + j > order) {
     78                    chip->toFPA->x->coeffMask[i][j] = PS_POLY_MASK_SET;
     79                    chip->toFPA->y->coeffMask[i][j] = PS_POLY_MASK_SET;
     80                }
     81            }
     82        }
    6383    }
    6484
Note: See TracChangeset for help on using the changeset viewer.