IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 39603 for trunk


Ignore:
Timestamp:
Jun 20, 2016, 3:17:27 PM (10 years ago)
Author:
eugene
Message:

fix boundary problem for repair warp (skycell Rmin,Rmax mis-calculated for boundary-overlapping skycells); add backup for repaired cpm files

Location:
trunk/Ohana/src/relastro/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/relastro/src/RepairWarpMeasures.c

    r39600 r39603  
    127127    // NOTE: this actually works surprisingly well near the pole
    128128    double dPos = hypot(dR,dD);
    129     if (dPos < 2.0) {
     129    if (dPos < 3.0) {
    130130      // image coord agrees with average coord
    131131      if (coordsDiffer) {
     
    146146        fprintf (stderr, "inconsistent warp measurement times: %d vs %d for %f, %f (%d, %ld)", measure->t, image[im].tzero, Rwrp, Dwrp, measure->photcode, extID);
    147147        result.NbadWarpTime ++;
    148         continue;
    149       }
     148      }
     149      continue;
    150150    }
    151151
  • trunk/Ohana/src/relastro/src/RepairWarps.c

    r39600 r39603  
    9090
    9191    // save backup of original cpm file
    92     if (!dvo_catalog_backup (&catalog, "rp0", TRUE)) {
    93       fprintf (stderr, "ERROR: failed to make backup for catalog %s\n", catalog.filename);
     92    if (!dvo_catalog_unlock (catalog.measure_catalog)) {
     93      fprintf (stderr, "ERROR: failed to unlock cpm table for catalog %s\n", catalog.filename);
     94      exit (1);
     95    }
     96    if (!dvo_catalog_backup (catalog.measure_catalog, ".rp2", FALSE)) {
     97      fprintf (stderr, "ERROR: failed to make backup cpm table for catalog %s\n", catalog.filename);
     98      exit (1);
     99    }
     100    if (!dvo_catalog_lock (catalog.measure_catalog, catalog.lockmode)) {
     101      fprintf (stderr, "failed to re-lock cpm table catalog file %s\n", catalog.filename);
    94102      exit (1);
    95103    }
  • trunk/Ohana/src/relastro/src/WarpImageMaps.c

    r39474 r39603  
    123123    ALLOCATE (warpgroup[i].onBoundary, int, warpgroup[i].Nwarps);
    124124
     125    if (i == 54950) {
     126      fprintf (stderr, "checking problem warpgroup\n");
     127    }
     128
    125129    for (int j = 0; j < warpgroup[i].Nwarps; j++) {
    126130
     
    178182
    179183      if (warpgroup[i].Rmax[j] - warpgroup[i].Rmin[j] > 270.0) {
    180         // Rmin and Rmax are in the range 0 - 360.  For images at the 0,360 boundary,
    181         // "Rmax" is the lower edge, and "Rmin" is the upper edge.  we need to flip them
    182         // and then break the 0-360 range:
    183         double tmp = warpgroup[i].Rmin[j];
    184         warpgroup[i].Rmin[j] = warpgroup[i].Rmax[j] - 360.0;
    185         warpgroup[i].Rmax[j] = tmp;
     184        // Rmin and Rmax are in the range 0 - 360.  For images at the 0,360 boundary, we need to recalculated Rmin,Rmax
     185        // using 0.0 as the midpoint (allowing the range -180 to +180)
     186
     187        XY_to_RD (&R, &D, 0.0, 0.0, &image[N].coords);
     188        R = ohana_normalize_angle_to_midpoint(R, 0.0);
     189        warpgroup[i].Rmin[j] = R;
     190        warpgroup[i].Rmax[j] = R;
     191        warpgroup[i].Dmin[j] = D;
     192        warpgroup[i].Dmax[j] = D;
     193
     194        XY_to_RD (&R, &D, Nx, 0.0, &image[N].coords);
     195        R = ohana_normalize_angle_to_midpoint(R, 0.0);
     196        warpgroup[i].Rmin[j] = MIN (warpgroup[i].Rmin[j], R);
     197        warpgroup[i].Rmax[j] = MAX (warpgroup[i].Rmax[j], R);
     198        warpgroup[i].Dmin[j] = MIN (warpgroup[i].Dmin[j], D);
     199        warpgroup[i].Dmax[j] = MAX (warpgroup[i].Dmax[j], D);
     200       
     201        XY_to_RD (&R, &D, 0.0, Ny, &image[N].coords);
     202        R = ohana_normalize_angle_to_midpoint(R, 0.0);
     203        warpgroup[i].Rmin[j] = MIN (warpgroup[i].Rmin[j], R);
     204        warpgroup[i].Rmax[j] = MAX (warpgroup[i].Rmax[j], R);
     205        warpgroup[i].Dmin[j] = MIN (warpgroup[i].Dmin[j], D);
     206        warpgroup[i].Dmax[j] = MAX (warpgroup[i].Dmax[j], D);
     207
     208        XY_to_RD (&R, &D, Nx, Ny, &image[N].coords);
     209        R = ohana_normalize_angle_to_midpoint(R, 0.0);
     210        warpgroup[i].Rmin[j] = MIN (warpgroup[i].Rmin[j], R);
     211        warpgroup[i].Rmax[j] = MAX (warpgroup[i].Rmax[j], R);
     212        warpgroup[i].Dmin[j] = MIN (warpgroup[i].Dmin[j], D);
     213        warpgroup[i].Dmax[j] = MAX (warpgroup[i].Dmax[j], D);
     214
    186215        warpgroup[i].onBoundary[j] = TRUE;
    187216      }
Note: See TracChangeset for help on using the changeset viewer.