IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 27862


Ignore:
Timestamp:
May 5, 2010, 1:35:27 PM (16 years ago)
Author:
bills
Message:

fix for ticket #1194. When linearizing WCS transform, set the reference
point to the center of the chip.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/magic/remove/src/streaksastrom.c

    r27466 r27862  
    375375}
    376376
     377static void chipToSky(pmAstromObj *pt, pmFPA *fpa, pmChip *chip)
     378{
     379    // chip to FP
     380    psPlaneTransformApply(pt->FP, chip->toFPA, pt->chip);
     381    // FP to TP to sky
     382    psPlaneTransformApply(pt->TP, fpa->toTPA, pt->FP);
     383    psDeproject(pt->sky, pt->TP, fpa->toSky);
     384}
     385
     386
    377387bool
    378388linearizeTransforms(strkAstrom *astrom)
    379389{
    380     if (!pmAstromLinearizeTransforms((pmFPA *) astrom->fpa, (pmChip *) astrom->chip, NULL, NULL, NULL, 0, 0)) {
    381         psErrorStackPrint(stderr, "linear fit to astrometry failed. ignoring\n");
     390    pmFPA  *inFPA  = (pmFPA *) astrom->fpa;
     391    pmChip *inChip = (pmChip *) astrom->chip;
     392
     393    // compute ra and dec of chip center
     394    pmAstromObj *center = pmAstromObjAlloc();
     395    center->chip->x = (double) astrom->numCols / 2.;
     396    center->chip->xErr = 0;
     397    center->chip->y = (double) astrom->numRows / 2.;
     398    center->chip->yErr = 0;
     399
     400    chipToSky(center, inFPA, inChip);
     401
     402    psRegion bounds = {0, astrom->numCols - 1, 0, astrom->numRows - 1 };
     403
     404    // create skeleton containers for the linearized transforms;
     405    pmFPA  outFPA;
     406    pmChip outChip;
     407
     408    memset(&outFPA, 0, sizeof(outFPA));
     409    memset(&outChip, 0, sizeof(outChip));
     410
     411    outFPA.toSky = psProjectionAlloc (center->sky->r, center->sky->d, inFPA->toSky->Xs, inFPA->toSky->Ys, PS_PROJ_TAN);
     412
     413    psFree(center);
     414
     415    if (!pmAstromLinearizeToSky(inFPA, inChip, &outFPA, &outChip, &bounds)) {
     416        psError(PS_ERR_UNKNOWN, false, "Failed to linearize astrometry\n");
    382417        return false;
    383418    }
    384     return true;
    385 }
     419
     420    psFree(inFPA->toSky);
     421    inFPA->toSky = outFPA.toSky;
     422
     423    psFree(inFPA->toTPA);
     424    inFPA->toTPA = outFPA.toTPA;
     425
     426    psFree(inFPA->fromTPA);
     427    inFPA->fromTPA = outFPA.fromTPA;
     428
     429    psFree(inChip->toFPA)
     430    inChip->toFPA = outChip.toFPA;
     431
     432    psFree(inChip->fromFPA);
     433    inChip->fromFPA = outChip.fromFPA;
     434
     435    return true;
     436}
  • trunk/psModules/src/astrom/pmAstrometryWCS.c

    r27461 r27862  
    972972    // FPA  -> TPA : identidy
    973973
     974    // NOTE: streaksremove's linearizeTransform function passes pointers to skeleton outFPA and outChip structs
     975    // Only outFPA->toSky is valid. No other memebers in these structs should be read. The resulting output transforms
     976    // are copied to inFPA and inChip by the caller.
     977
    974978    int nSamples = 10;  // 10 samples in each dimension
    975979
Note: See TracChangeset for help on using the changeset viewer.