IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 3559


Ignore:
Timestamp:
Mar 29, 2005, 4:21:53 PM (21 years ago)
Author:
gusciora
Message:

...

Location:
trunk/psLib
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/astronomy/psAstrometry.c

    r3540 r3559  
    88 *  @author GLG, MHPCC
    99 *
    10  *  @version $Revision: 1.61 $ $Name: not supported by cvs2svn $
    11  *  @date $Date: 2005-03-29 19:41:56 $
     10 *  @version $Revision: 1.62 $ $Name: not supported by cvs2svn $
     11 *  @date $Date: 2005-03-30 02:21:14 $
    1212 *
    1313 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    6262    PS_PTR_CHECK_NULL(transform->y, 0);
    6363
    64     int i;
    65 
    66     for (i=2;i<(transform->x->nX);i++) {
    67         if (transform->x->coeff[i][0] != 0.0) {
    68             return(0);
    69         }
    70     }
    71     for (i=2;i<(transform->x->nY);i++) {
    72         if (transform->x->coeff[0][i] != 0.0) {
    73             return(0);
    74         }
    75     }
    76 
    77     for (i=2;i<(transform->y->nX);i++) {
    78         if (transform->y->coeff[i][0] != 0.0) {
    79             return(0);
    80         }
    81     }
    82     for (i=2;i<(transform->y->nY);i++) {
    83         if (transform->y->coeff[0][i] != 0.0) {
    84             return(0);
     64    for (psS32 i=0;i<(transform->x->nX);i++) {
     65        for (psS32 j=0;j<(transform->x->nY);j++) {
     66            if (transform->x->coeff[i][j] != 0.0) {
     67                if (!(((i == 0) && (j == 0)) ||
     68                        ((i == 0) && (j == 1)) ||
     69                        ((i == 1) && (j == 0)))) {
     70                    return(0);
     71                }
     72            }
     73        }
     74    }
     75
     76    for (psS32 i=0;i<(transform->y->nX);i++) {
     77        for (psS32 j=0;j<(transform->y->nY);j++) {
     78            if (transform->y->coeff[i][j] != 0.0) {
     79                if (!(((i == 0) && (j == 0)) ||
     80                        ((i == 0) && (j == 1)) ||
     81                        ((i == 1) && (j == 0)))) {
     82                    return(0);
     83                }
     84            }
    8585        }
    8686    }
     
    108108             (Y2 * (1.0 / (F - ((C*E)/B))));
    109109 
    110 XXX: Since thre is now a general psPlaneTransformInvertTmp() function, we
     110XXX: Since thre is now a general psPlaneTransformInvert() function, we
    111111should rename this.
     112 
    112113 *****************************************************************************/
    113114static psPlaneTransform *invertPlaneTransform(psPlaneTransform *transform)
     
    117118    PS_PTR_CHECK_NULL(transform->y, 0);
    118119
    119     double A = transform->x->coeff[0][0];
    120     double B = transform->x->coeff[1][0];
    121     double C = transform->x->coeff[0][1];
    122     double D = transform->y->coeff[0][0];
    123     double E = transform->y->coeff[1][0];
    124     double F = transform->y->coeff[0][1];
     120    psF64 A = 0.0;
     121    psF64 B = 0.0;
     122    psF64 C = 0.0;
     123    psF64 D = 0.0;
     124    psF64 E = 0.0;
     125    psF64 F = 0.0;
     126
     127    // XXX: Test this for correctness.
     128    A = transform->x->coeff[0][0];
     129    if (transform->x->nX >= 2) {
     130        B = transform->x->coeff[1][0];
     131    }
     132    if (transform->x->nY >= 2) {
     133        C = transform->x->coeff[0][1];
     134    }
     135    D = transform->y->coeff[0][0];
     136    if (transform->y->nX >= 2) {
     137        E = transform->y->coeff[1][0];
     138    }
     139    if (transform->y->nY >= 2) {
     140        F = transform->y->coeff[0][1];
     141    }
    125142
    126143    // XXX: Use the constructor here.
    127     psPlaneTransform *out = psAlloc(sizeof(psPlaneTransform));
     144    psPlaneTransform *out = psPlaneTransformAlloc(2, 2);
    128145
    129146    out->x->coeff[0][0] = -D + ((F*A)/C) / (E - ((F*B)/C));
     
    10921109
    10931110/*****************************************************************************
    1094 psPlaneTranformFit(trans, source, dest, nRejIter, sigmaClip)
     1111psPlaneTransformFit(trans, source, dest, nRejIter, sigmaClip)
    10951112 
    10961113XXX: What about nRejIter?  Iterations?
    10971114XXX: Use static vectors for internal data.
    10981115 *****************************************************************************/
    1099 bool psPlaneTranformFit(psPlaneTransform *trans,
    1100                         const psArray *source,
    1101                         const psArray *dest,
    1102                         int nRejIter,
    1103                         float sigmaClip)
     1116bool psPlaneTransformFit(psPlaneTransform *trans,
     1117                         const psArray *source,
     1118                         const psArray *dest,
     1119                         int nRejIter,
     1120                         float sigmaClip)
    11041121{
    11051122    PS_PTR_CHECK_NULL(trans, NULL);
    11061123    PS_PTR_CHECK_NULL(source, NULL);
    11071124    PS_PTR_CHECK_NULL(dest, NULL);
    1108 
    1109     // Ensure that the input transformation is symmetrical.
    1110     if ((trans->x->nX != trans->x->nY) ||
    1111             (trans->y->nX != trans->y->nY) ||
    1112             (trans->x->nX != trans->y->nX)) {
    1113         psError(PS_ERR_BAD_PARAMETER_TYPE, true, "Input transformation must have same nX==nY.");
    1114     }
    11151125
    11161126    psS32 numCoords = PS_MIN(source->n, dest->n);
     
    12261236    //
    12271237    if (isProjectionLinear((psPlaneTransform *) in)) {
     1238        printf("COOL: is linear\n");
    12281239        return(invertPlaneTransform((psPlaneTransform *) in));
    12291240    }
    12301241    PS_PTR_CHECK_NULL(region, NULL);
    1231     PS_INT_COMPARE(0, nSamples, NULL);
     1242    PS_INT_COMPARE(1, nSamples, NULL);
    12321243
    12331244    // Ensure that the input transformation is symmetrical.
     
    13001311        }
    13011312    }
    1302     bool rc = psPlaneTranformFit(myPT, inData, outData, 10, 100.0);
     1313    bool rc = psPlaneTransformFit(myPT, inData, outData, 10, 100.0);
    13031314
    13041315    psFree(inCoord);
  • trunk/psLib/src/astronomy/psAstrometry.h

    r3540 r3559  
    88*  @author GLG, MHPCC
    99*
    10 *  @version $Revision: 1.36 $ $Name: not supported by cvs2svn $
    11 *  @date $Date: 2005-03-29 19:41:56 $
     10*  @version $Revision: 1.37 $ $Name: not supported by cvs2svn $
     11*  @date $Date: 2005-03-30 02:21:14 $
    1212*
    1313*  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    552552
    553553// XXX: Doxygenate.
    554 bool psPlaneTranformFit(
     554bool psPlaneTransformFit(
    555555    psPlaneTransform *trans,
    556556    const psArray *source,
  • trunk/psLib/test/astronomy/tst_psAstrometry01.c

    r3557 r3559  
    55*  @author GLG, MHPCC
    66*
    7 *  @version $Revision: 1.14 $ $Name: not supported by cvs2svn $
    8 *  @date $Date: 2005-03-30 00:17:04 $
     7*  @version $Revision: 1.15 $ $Name: not supported by cvs2svn $
     8*  @date $Date: 2005-03-30 02:21:53 $
     9*
     10* XXX: Must test
     11* pmSourceAddModel
     12* pmSourceSubModel
     13* pmSourceFitModel
     14* pmSourceContour
     15* pmSourceModelGuess
     16* pmSourceRoughClass
     17* pmSourceMoments
     18* pmSourceLocalSky
     19*
    920*
    1021*  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
Note: See TracChangeset for help on using the changeset viewer.