IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Nov 20, 2007, 9:02:55 PM (19 years ago)
Author:
eugene
Message:

adding a re-scale option to pmAstrometryObjects grid match; working on astrometry I/O tables

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psModules/src/astrom/pmAstrometryObjects.c

    r15102 r15665  
    88*  @author EAM, IfA
    99*
    10 *  @version $Revision: 1.34 $ $Name: not supported by cvs2svn $
    11 *  @date $Date: 2007-09-29 02:28:04 $
     10*  @version $Revision: 1.35 $ $Name: not supported by cvs2svn $
     11*  @date $Date: 2007-11-21 07:02:55 $
    1212*
    1313*  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    269269
    270270/******************************************************************************
    271 pmAstromRotateObj(old, center, angle): rotate the focal-plane coordinates
     271pmAstromRotateObj(old, center, angle, angle): rotate & scale the focal-plane coordinates
    272272about the center coordinate angle specified in radians
    273273 ******************************************************************************/
     
    275275    const psArray *old,
    276276    psPlane center,
    277     double angle)
     277    double angle,
     278    double scale)
    278279{
    279280    PS_ASSERT_PTR_NON_NULL(old, NULL);
     
    284285
    285286    psArray *new = psArrayAlloc (old->n);
    286     double cs = cos(angle);
    287     double sn = sin(angle);
     287    double cs = scale*cos(angle);
     288    double sn = scale*sin(angle);
    288289    double xCenter = center.x;
    289290    double yCenter = center.y;
     
    326327    //    stats->offset = {0, 0, 0, 0};
    327328    stats->angle     = 0.0;
     329    stats->scale     = 1.0;
    328330    stats->minMetric = 0.0;
    329331    stats->minVar    = 0.0;
     
    703705    center.y = 0.5*(yMin + yMax);
    704706
     707    double minScale = psMetadataLookupF32 (&status, config, "PSASTRO.GRID.MIN.SCALE");
     708    double maxScale = psMetadataLookupF32 (&status, config, "PSASTRO.GRID.MAX.SCALE");
     709    double delScale = psMetadataLookupF32 (&status, config, "PSASTRO.GRID.DEL.SCALE");
     710
    705711    double minAngle = RAD_DEG*psMetadataLookupF32 (&status, config, "PSASTRO.GRID.MIN.ANGLE");
    706712    double maxAngle = RAD_DEG*psMetadataLookupF32 (&status, config, "PSASTRO.GRID.MAX.ANGLE");
     
    709715
    710716    minStat->minMetric = 1e10;
    711     for (double angle = minAngle; angle <= maxAngle; angle += delAngle) {
    712         rot = pmAstromRotateObj (raw, center, angle);
    713         newStat = pmAstromGridAngle (rot, ref, config);
    714         newStat->angle  = angle;
    715         newStat->center = center;
    716 
    717         if (newStat->minMetric < minStat->minMetric) {
    718             *minStat = *newStat;
    719             psLogMsg ("psModule.astrom", 4, "grid test - offset: %7.2f,%7.2f @ %6.1f deg (%4d pts, %5.1f sig, %5.1f var, %6.3f log metric) *",
    720                       minStat->offset.x, minStat->offset.y, DEG_RAD*minStat->angle, minStat->nMatch, minStat->nSigma, minStat->minVar, log10(minStat->minMetric));
    721         } else {
    722             psLogMsg ("psModule.astrom", 4, "grid test - offset: %7.2f,%7.2f @ %6.1f deg (%4d pts, %5.1f sig, %5.1f var, %6.3f log metric)",
    723                       newStat->offset.x, newStat->offset.y, DEG_RAD*newStat->angle, newStat->nMatch, newStat->nSigma, newStat->minVar, log10(newStat->minMetric));
    724 
    725         }
    726         psFree (newStat);
    727         psFree (rot);
    728     }
    729     psLogMsg ("psModule.astrom.grid.match", 4, "grid best - offset: %7.2f,%7.2f @ %6.1f deg (%4d pts, %5.1f sig, %5.1f var, %6.3f log metric)",
    730               minStat->offset.x, minStat->offset.y, DEG_RAD*minStat->angle, minStat->nMatch, minStat->nSigma, minStat->minVar, log10(minStat->minMetric));
     717    for (double scale = minScale; scale <= maxScale; scale += delScale) {
     718        for (double angle = minAngle; angle <= maxAngle; angle += delAngle) {
     719            rot = pmAstromRotateObj (raw, center, angle, scale);
     720            newStat = pmAstromGridAngle (rot, ref, config);
     721            newStat->angle  = angle;
     722            newStat->scale  = scale;
     723            newStat->center = center;
     724
     725            if (newStat->minMetric < minStat->minMetric) {
     726                *minStat = *newStat;
     727                psLogMsg ("psModule.astrom", 4, "grid test - offset: %7.2f,%7.2f @ %6.1f deg x %7.3f (%4d pts, %5.1f sig, %5.1f var, %6.3f log metric) *",
     728                          minStat->offset.x, minStat->offset.y, DEG_RAD*minStat->angle, minStat->scale, minStat->nMatch, minStat->nSigma, minStat->minVar, log10(minStat->minMetric));
     729            } else {
     730                psLogMsg ("psModule.astrom", 4, "grid test - offset: %7.2f,%7.2f @ %6.1f deg x %7.3f (%4d pts, %5.1f sig, %5.1f var, %6.3f log metric)",
     731                          newStat->offset.x, newStat->offset.y, DEG_RAD*newStat->angle, newStat->scale, newStat->nMatch, newStat->nSigma, newStat->minVar, log10(newStat->minMetric));
     732
     733            }
     734            psFree (newStat);
     735            psFree (rot);
     736        }
     737    }
     738    psLogMsg ("psModule.astrom.grid.match", 4, "grid best - offset: %7.2f,%7.2f @ %6.1f deg x %7.3f (%4d pts, %5.1f sig, %5.1f var, %6.3f log metric)",
     739              minStat->offset.x, minStat->offset.y, DEG_RAD*minStat->angle, minStat->scale, minStat->nMatch, minStat->nSigma, minStat->minVar, log10(minStat->minMetric));
    731740
    732741    // I need to decide if a solution is likely to be a good solution or just a mis-match
     
    756765    int nBin, xBin, yBin;
    757766
    758     rot = pmAstromRotateObj (raw, stats->center, stats->angle);
     767    rot = pmAstromRotateObj (raw, stats->center, stats->angle, stats->scale);
    759768
    760769    // sampling scale of the grid
     
    846855    PS_ASSERT_POLY_NON_NULL(map->y, NULL);
    847856
    848     double cs = cos (stat->angle);
    849     double sn = sin (stat->angle);
     857    double cs = stat->scale * cos (stat->angle);
     858    double sn = stat->scale * sin (stat->angle);
    850859
    851860    double dx = (map->x->coeff[0][0] - stat->center.x);
Note: See TracChangeset for help on using the changeset viewer.