IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Oct 28, 2008, 1:20:29 PM (18 years ago)
Author:
beaumont
Message:

New plots for fixChips and CommonScale

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/cnb_branch_20081011/psastro/src/psastroFixChips.c

    r16077 r20443  
    109109  }
    110110  xObs->n = yObs->n = xRef->n = yRef->n = nPts;
    111        
     111
    112112  psPlaneTransform *map = psPlaneTransformAlloc (1, 1);
    113  
     113
    114114  psVector *mask = psVectorAlloc (nPts, PS_TYPE_U8);
    115115  psVectorInit (mask, 0);
     
    127127
    128128  // loop over all chips, select the outliers, and replace the measured astrometry with the model
    129   // the measured transformation above must be applied to make the comparison, and also then applied to the 
     129  // the measured transformation above must be applied to make the comparison, and also then applied to the
    130130  // model transformation
    131131
    132   psFree (xObs);
    133   psFree (yObs);
    134132  psFree (xRef);
    135133  psFree (yRef);
     
    159157    psPlaneTransformApply (&tmpCoord, refChip->toFPA, &refPixel);
    160158    psPlaneTransformApply (&refCoord, map, &tmpCoord);
    161    
     159
    162160    psPlane offPixel = {100.0, 0.0, 100.0, 0.0};
    163161    psPlane obsOffPt, refOffPt;
     
    169167    psPlaneTransformApply (&tmpCoord, refChip->toFPA, &offPixel);
    170168    psPlaneTransformApply (&refOffPt, map, &tmpCoord);
    171    
     169
    172170    double obsAngle = PM_DEG_RAD*atan2 (obsOffPt.y - obsCoord.y, obsOffPt.x - obsCoord.x);
    173171    double refAngle = PM_DEG_RAD*atan2 (refOffPt.y - refCoord.y, refOffPt.x - refCoord.x);
     
    183181
    184182    psLogMsg ("psastro", PS_LOG_INFO, "fixing chip %d, angle: %f, pixel: %f,%f\n",
    185               view->chip, obsAngle - refAngle, obsCoord.x - refCoord.x, obsCoord.y - refCoord.y);
     183              view->chip, obsAngle - refAngle, obsCoord.x - refCoord.x, obsCoord.y - refCoord.y);
    186184
    187185    psFree (obsChip->toFPA);
     
    192190    psPlaneTransform *toFPA = psPlaneTransformAlloc(refChip->toFPA->x->nX, refChip->toFPA->x->nY);
    193191    for (int i = 0; i <= refChip->toFPA->x->nX; i++) {
    194         for (int j = 0; j <= refChip->toFPA->x->nY; j++) {
    195             double f1 = refChip->toFPA->x->coeffMask[i][j] ? 0.0 : map->x->coeff[1][0]*refChip->toFPA->x->coeff[i][j];
    196             double f2 = refChip->toFPA->y->coeffMask[i][j] ? 0.0 : map->x->coeff[0][1]*refChip->toFPA->y->coeff[i][j];
    197             toFPA->x->coeff[i][j] = f1 + f2;
    198 
    199             double g1 = refChip->toFPA->x->coeffMask[i][j] ? 0.0 : map->y->coeff[1][0]*refChip->toFPA->x->coeff[i][j];
    200             double g2 = refChip->toFPA->y->coeffMask[i][j] ? 0.0 : map->y->coeff[0][1]*refChip->toFPA->y->coeff[i][j];
    201             toFPA->y->coeff[i][j] = g1 + g2;
    202         }
     192        for (int j = 0; j <= refChip->toFPA->x->nY; j++) {
     193            double f1 = refChip->toFPA->x->coeffMask[i][j] ? 0.0 : map->x->coeff[1][0]*refChip->toFPA->x->coeff[i][j];
     194            double f2 = refChip->toFPA->y->coeffMask[i][j] ? 0.0 : map->x->coeff[0][1]*refChip->toFPA->y->coeff[i][j];
     195            toFPA->x->coeff[i][j] = f1 + f2;
     196
     197            double g1 = refChip->toFPA->x->coeffMask[i][j] ? 0.0 : map->y->coeff[1][0]*refChip->toFPA->x->coeff[i][j];
     198            double g2 = refChip->toFPA->y->coeffMask[i][j] ? 0.0 : map->y->coeff[0][1]*refChip->toFPA->y->coeff[i][j];
     199            toFPA->y->coeff[i][j] = g1 + g2;
     200        }
    203201    }
    204202    toFPA->x->coeff[0][0] += map->x->coeff[0][0];
     
    209207    obsChip->fromFPA = psPlaneTransformInvert(NULL, obsChip->toFPA, *region, 50);
    210208    psFree (region);
    211    
     209
    212210    // XXX this stuff below should be applied to each readout...
    213211    // XXX for now, just use first readout
     
    226224    // the absolute minimum number of stars is 4 (for order = 1)
    227225    if ((rawstars->n < 4) || (refstars->n < 4)) {
    228         readout->data_exists = false;
    229         psLogMsg ("psastro", 3, "insufficient rawstars (%ld) or refstars (%ld)",
    230                   rawstars->n, refstars->n);
    231         continue;
    232     } 
     226        readout->data_exists = false;
     227        psLogMsg ("psastro", 3, "insufficient rawstars (%ld) or refstars (%ld)",
     228                  rawstars->n, refstars->n);
     229        continue;
     230    }
    233231
    234232    psastroUpdateChipToFPA (input->fpa, obsChip, rawstars, refstars);
     
    237235    psMetadata *updates = psMemIncrRefCounter (psMetadataLookupMetadata (&status, readout->analysis, "PSASTRO.HEADER"));
    238236    if (!updates) {
    239         updates = psMetadataAlloc ();
     237        updates = psMetadataAlloc ();
    240238    }
    241239
    242240    // XXX update the header with info to reflect the failure
    243241    if (!psastroOneChipFit (input->fpa, obsChip, refstars, rawstars, recipe, updates)) {
    244         readout->data_exists = false;
    245         psLogMsg ("psastro", 3, "failed to find a solution\n");
    246         psFree (updates);
    247         continue;
     242        readout->data_exists = false;
     243        psLogMsg ("psastro", 3, "failed to find a solution\n");
     244        psFree (updates);
     245        continue;
    248246    }
    249247
     
    253251  }
    254252
     253  psastroVisualPlotFixChips (input, xObs, yObs);
     254  psFree (xObs);
     255  psFree (yObs);
    255256  psFree (map);
    256257  psFree (view);
Note: See TracChangeset for help on using the changeset viewer.