IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Nov 4, 2021, 6:05:18 PM (5 years ago)
Author:
eugene
Message:

merge changes from eam_branches/ipp-dev-20210817 (pmPattern updates, new inverse transform extra orders api, forward transform uses ORD, pmSourceIO_CMF.c.in conversion to pmFitsTableNew)

Location:
trunk/psModules
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/psModules

  • trunk/psModules/src/astrom/pmAstrometryWCS.c

    r41810 r41892  
    501501    psPlaneTransform *toFPA;
    502502
     503    int ExtraOrders = pmAstrometryGetExtraOrders();
     504
    503505    // create transformation with 0,0 reference pixel and units of degrees/pixel
    504506    toFPA = psPlaneTransformSetCenter (NULL, wcs->trans, -wcs->crpix1, -wcs->crpix2);
     
    552554        // apply the exiting fromTPA transformation to make the new toFPA consistent with the toTPA layter
    553555        // XXX this only works if toTPA is at most a linear transformation
    554         psPlaneTransform *toFPAnew = psPlaneTransformAlloc(toFPA->x->nX, toFPA->x->nY);
     556        psPlaneTransform *toFPAnew = psPlaneTransformAlloc(toFPA->x->nX, toFPA->x->nY, PS_POLYNOMIAL_ORD);
    555557        for (int i = 0; i <= toFPA->x->nX; i++) {
    556558            for (int j = 0; j <= toFPA->x->nY; j++) {
     
    608610    // as of r40806, psPlaneTransformInvert supplies the extra order (if non-linear)
    609611    psFree (chip->fromFPA);
    610     chip->fromFPA = psPlaneTransformInvert(NULL, chip->toFPA, *region, 100, 6);
     612    chip->fromFPA = psPlaneTransformInvert(NULL, chip->toFPA, *region, 50, ExtraOrders);
    611613    psFree (region);
    612614
     
    648650     */
    649651
     652    int ExtraOrders = pmAstrometryGetExtraOrders();
     653
    650654    psFree (chip->toFPA);
    651655    if ((fabs(wcs->crpix1) > 0.01) || (fabs(wcs->crpix2) > 0.01)) {
    652656      chip->toFPA = psPlaneTransformSetCenter (NULL, wcs->trans, -wcs->crpix1, -wcs->crpix2);
    653657    } else {
    654       chip->toFPA = psPlaneTransformAlloc(wcs->trans->x->nX, wcs->trans->x->nY);
     658      chip->toFPA = psPlaneTransformAlloc(wcs->trans->x->nX, wcs->trans->x->nY, PS_POLYNOMIAL_ORD);
    655659
    656660      // copy the toFPA x,y, transformations to the wcs version
     
    668672    // as of r40806, psPlaneTransformInvert supplies the extra order (if non-linear)
    669673    psFree (chip->fromFPA);
    670     chip->fromFPA = psPlaneTransformInvert(NULL, chip->toFPA, *region, 100, 6);
     674    chip->fromFPA = psPlaneTransformInvert(NULL, chip->toFPA, *region, 50, ExtraOrders);
    671675    psFree (region);
    672676
     
    700704    // the region defines the FPA pixels covered by the tranformation
    701705    psFree (fpa->fromTPA);
    702     int additional_orders = 4;  // This is the number of orders that should be added.
     706    int additional_orders = pmAstrometryGetExtraOrders();  // This is the number of orders that should be added.
    703707    bool status = false;
    704708    int config_additional_orders = psMetadataLookupS32(&status,fpa->analysis, "ADDITIONAL_WCS_ORDERS");
     
    706710      additional_orders = config_additional_orders;
    707711    }
    708     fpa->fromTPA = psPlaneTransformInvert(NULL, fpa->toTPA, region, 100, additional_orders);
     712    fpa->fromTPA = psPlaneTransformInvert(NULL, fpa->toTPA, region, 50, additional_orders);
    709713    return true;
    710714}
     
    739743    // XXX require fpa->toTPA->nX == 1
    740744
    741     psPlaneTransform *toTPA = psPlaneTransformAlloc(chip->toFPA->x->nX, chip->toFPA->x->nY);
     745    psPlaneTransform *toTPA = psPlaneTransformAlloc(chip->toFPA->x->nX, chip->toFPA->x->nY, PS_POLYNOMIAL_ORD);
    742746
    743747    for (int i = 0; i <= toTPA->x->nX; i++) {
     
    958962    }
    959963
    960     psPlaneTransform *newTrans = psPlaneTransformAlloc(1, 1);
     964    psPlaneTransform *newTrans = psPlaneTransformAlloc(1, 1, PS_POLYNOMIAL_ORD);
    961965
    962966    if (!psPlaneTransformFit(newTrans, src, dst, 0, 0)) {
     
    9971001    PS_ASSERT_PTR_NON_NULL(inChip, NULL);
    9981002
     1003    int ExtraOrders = pmAstrometryGetExtraOrders();
     1004
    9991005    if (outFPA == NULL) {
    10001006        outFPA = inFPA;
     
    10321038
    10331039    // NOTE: the extraOrders value (4) should be ignored since outToFPA is specified to be linear
    1034     psPlaneTransform *outFromFPA = psPlaneTransformInvert(NULL, outToFPA, *outputBounds, 100, 6);
     1040    psPlaneTransform *outFromFPA = psPlaneTransformInvert(NULL, outToFPA, *outputBounds, 50, ExtraOrders);
    10351041    if (!outFromFPA) {
    10361042        psFree(outToFPA);
     
    11161122    }
    11171123
    1118     psPlaneTransform *newToFPA = psPlaneTransformAlloc(1, 1);
     1124    psPlaneTransform *newToFPA = psPlaneTransformAlloc(1, 1, PS_POLYNOMIAL_ORD);
    11191125    newToFPA->x->coeffMask[1][1] = 1;
    11201126    newToFPA->y->coeffMask[1][1] = 1;
     
    11481154    psFree(dst);
    11491155
    1150     // this is a linear transformation
     1156    // this is a linear transformation, no extra orders are needed
    11511157    psPlaneTransform *newFromFPA = psPlaneTransformInvert(NULL, newToFPA, *bounds, 1, 0);
    11521158    if (!newFromFPA) {
     
    11871193    psMemSetDeallocator(wcs, (psFreeFunc) pmAstromWCSFree);
    11881194
    1189     wcs->trans = psPlaneTransformAlloc (nXorder, nYorder);
     1195    // note: WCS transforms are always defined as chip to sky
     1196    wcs->trans = psPlaneTransformAlloc (nXorder, nYorder, PS_POLYNOMIAL_ORD);
    11901197    wcs->toSky = NULL;
    11911198    wcs->wcsCDkeys = 0;
Note: See TracChangeset for help on using the changeset viewer.