IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Nov 13, 2005, 1:16:22 PM (21 years ago)
Author:
eugene
Message:

development work

File:
1 edited

Legend:

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

    r5495 r5510  
    5454}
    5555
    56 pmAstromMatchedListFit (pmFPA *fpa, psArray *st1, psArray *st2, psArray *match, psMetadata *config) {
     56// take two matched star lists and fit a psPlaneTransform between them
     57//
     58psPlaneTransform *pmAstromMatchedListFit (psPlaneTransform *map, psArray *st1, psArray *st2, psArray *match, psMetadata *config) {
     59
     60    if (map == NULL) {
     61        // int nX = psMetadataLookupS32 (&status, myHeader, "CHIP.NX");
     62        // int nY = psMetadataLookupS32 (&status, myHeader, "CHIP.NY");
     63        map = psPlaneTransform (2, 2);
     64    }
     65
     66    psStats *stats = psStatsAlloc (CLIPPED_MEAN);
     67    stats->nSigma = psMetadataLookupS32 (&status, myHeader, "CHIP.NITER");
     68    stats->nSigma = psMetadataLookupS32 (&status, myHeader, "CHIP.NSIGMA");
    5769
    5870    psVector *X = psVectorAlloc (match->n);
     
    6274 
    6375    // take the matched stars, first fit
    64     for (i = 0; i < match->n; i++) {
     76    for (int i = 0; i < match->n; i++) {
    6577
    6678        pair = match->data[i];
     
    6880        ob2 = st2->data[pair->i2];
    6981
    70         X->data.F64[i] = ob1->P;
    71         Y->data.F64[i] = ob1->Q;
     82        X->data.F64[i] = ob1->chip.x;
     83        Y->data.F64[i] = ob1->chip.y;
    7284
    73         x->data.F64[i] = ob2->P;
    74         y->data.F64[i] = ob2->Q;
    75 
    76         // use one or the other...
    77         psPolynomial2D *xt = psVectorFitPolynomial2D (NULL, stats, NULL, 0, X, NULL, x, y);
    78         psPolynomial2D *xt = psVectorClipFitPolynomial2D (NULL, stats, NULL, 0, X, NULL, x, y);
    79 
    80         psPolynomial2D *yt = psVectorFitPolynomial2D (NULL, stats, NULL, 0, Y, NULL, x, y);
    81         psPolynomial2D *yt = psVectorClipFitPolynomial2D (NULL, stats, NULL, 0, Y, NULL, x, y);
     85        x->data.F64[i] = ob2->FP.x;
     86        y->data.F64[i] = ob2->FP.y;
    8287    }
    8388
    84     // apply fitted polynomials to fpa
     89    // no masking, no errors
     90    psVectorClipFitPolynomial2D (map->x, stats, NULL, 0, X, NULL, x, y);
     91    psVectorClipFitPolynomial2D (map->y, stats, NULL, 0, Y, NULL, x, y);
     92    psFree (x);
     93    psFree (y);
     94    psFree (X);
     95    psFree (Y);
     96    psFree (stats);
     97
     98    return (map);
    8599}
    86100
     
    103117        newObj = pmAstromObjCopy (oldObj);
    104118
    105         P = oldObj->FP.x - xCenter;
    106         Q = oldObj->FP.y - yCenter;
     119        X = oldObj->FP.x - xCenter;
     120        Y = oldObj->FP.y - yCenter;
    107121       
    108         newObj->FP.x = P*cs + Q*sn;
    109         newObj->FP.y = Q*cs - P*sn;
     122        newObj->FP.x = X*cs + Y*sn;
     123        newObj->FP.y = Y*cs - X*sn;
    110124       
    111125        new->data[i] = newObj;
Note: See TracChangeset for help on using the changeset viewer.