IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 37531


Ignore:
Timestamp:
Oct 27, 2014, 2:44:02 PM (12 years ago)
Author:
eugene
Message:

do NOT normalize RA in XY_to_RD, deal with normalization outside; fix various fakeastro issues at 0,360

Location:
branches/eam_branches/ipp-20140904/Ohana/src
Files:
15 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20140904/Ohana/src/dvomerge/src/dvorepairCPT.c

    r37046 r37531  
    119119    thisImage = MatchImage (image, Nimage, measure[i].t, measure[i].photcode, measure[i].imageID);
    120120    XY_to_RD (&average[Nave].R, &average[Nave].D, measure[i].Xccd, measure[i].Yccd, &thisImage[0].coords);
     121    average[Nave].R = ohana_normalize_angle (average[Nave].R);
    121122
    122123    average[Nave].Nmeasure = 1;
  • branches/eam_branches/ipp-20140904/Ohana/src/dvomerge/src/dvorepairDeleteImageList.c

    r37378 r37531  
    400400    thisImage = MatchImage (image, Nimage, measure[i].t, measure[i].photcode, measure[i].imageID);
    401401    XY_to_RD (&average[Nave].R, &average[Nave].D, measure[i].Xccd, measure[i].Yccd, &thisImage[0].coords);
     402    average[Nave].R = ohana_normalize_angle (average[Nave].R);
    402403
    403404    average[Nave].Nmeasure = 1;
  • branches/eam_branches/ipp-20140904/Ohana/src/dvomerge/src/dvorepairFixTables.c

    r37046 r37531  
    259259    thisImage = MatchImage (image, Nimage, measure[i].t, measure[i].photcode, measure[i].imageID);
    260260    XY_to_RD (&average[Nave].R, &average[Nave].D, measure[i].Xccd, measure[i].Yccd, &thisImage[0].coords);
     261    average[Nave].R = ohana_normalize_angle (average[Nave].R);
    261262
    262263    average[Nave].Nmeasure = 1;
  • branches/eam_branches/ipp-20140904/Ohana/src/fakeastro/src/fit_fake_stars.c

    r37527 r37531  
    2525  if (Nstars >  24) order_use = 2; //  6 stars per cell
    2626  if (Nstars >  63) order_use = 3; //  7 stars per cell
    27   if (Nstars > 128) order_use = 4; //  8 stars per cell
    28   if (Nstars > 225) order_use = 5; //  9 stars per cell
    29   if (Nstars > 360) order_use = 6; // 10 stars per cell
     27  // if (Nstars > 128) order_use = 4; //  8 stars per cell
     28  // if (Nstars > 225) order_use = 5; //  9 stars per cell
     29  // if (Nstars > 360) order_use = 6; // 10 stars per cell
    3030  if (order_use < 1) {
    3131    fprintf (stderr, "insufficient measurements (%d) for linear fit\n", Nstars);
     
    8686    XY_to_LM (&Le, &Me, 0.0, 4850.0, &image[0].coords);
    8787
    88     fprintf (stderr, "%s : (dL,dM)_1 : %f : (dL,dM)_2 : %f\n", image->name, hypot(Le-Lo, Me-Mo), hypot(Ls-Lo, Ms-Mo));
     88    if (FALSE) fprintf (stderr, "%s : (dL,dM)_1 : %f : (dL,dM)_2 : %f\n", image->name, hypot(Le-Lo, Me-Mo), hypot(Ls-Lo, Ms-Mo));
    8989  }
    9090
     
    134134    // if we have fitted the map above, Npolyterms needs to be -1 here:
    135135    XY_to_RD (&stars[i].average.R, &stars[i].average.D, stars[i].measure.Xccd, stars[i].measure.Yccd, &image[0].coords);
     136    stars[i].average.R = ohana_normalize_angle (stars[i].average.R);
    136137  }
    137138
  • branches/eam_branches/ipp-20140904/Ohana/src/fakeastro/src/get_image_patch.c

    r37467 r37531  
    2020    XY_to_RD (&R, &D, Xpt[i]*image->NX, Ypt[i]*image->NY, &image->coords);
    2121
     22    // fprintf (stderr, "%f %f -> %f %f\n", Xpt[i]*image->NX, Ypt[i]*image->NY, R, D);
    2223    Rmin = MIN(R,Rmin);
    2324    Rmax = MAX(R,Rmax);
     
    3233  region->Dmin = Dmin;
    3334  region->Dmax = Dmax;
     35
     36  // fprintf (stderr, "%f %f , %f %f\n", Rmin, Rmax, Dmin, Dmax);
    3437
    3538  return region;
     
    4851int SkyRegionsOverlap (SkyRegion *region, SkyRegion *patch) {
    4952
    50   if (region->Rmin >= patch->Rmax) return FALSE;
    51   if (region->Rmax <= patch->Rmin) return FALSE;
     53  // what are the assumptions? 
     54  // * patch->Rmin,Rmax are on the same side of the boundary
     55  //   * [-2,-1], [-2,+1], [358,361] : all OK
     56  //   * [358, 2] : NOT OK
     57
     58  myAssert (patch->Rmin <= patch->Rmax, "impossible!");
     59
    5260  if (region->Dmin >= patch->Dmax) return FALSE;
    5361  if (region->Dmax <= patch->Dmin) return FALSE;
     62
     63  int keepR0 = FALSE;
     64  int keepR1 = FALSE;
     65  int keepR2 = FALSE;
     66  if (patch->Rmin < 0.0) {
     67    float Rmin = patch->Rmin + 360.0;
     68    float Rmax = patch->Rmax + 360.0;
     69    keepR0 = (Rmin <= region->Rmax) && (Rmax >= region->Rmin);
     70  }
     71  if (patch->Rmax > 360.0) {
     72    float Rmin = patch->Rmin - 360.0;
     73    float Rmax = patch->Rmax - 360.0;
     74    keepR1 = (Rmin <= region->Rmax) && (Rmax >= region->Rmin);
     75  }
     76  keepR2 = (patch->Rmin <= region->Rmax) && (patch->Rmax >= region->Rmin);
     77
     78  int keep = keepR0 || keepR1 || keepR2;
     79
     80  if (!keep) return FALSE;
    5481  return TRUE;
    5582}
  • branches/eam_branches/ipp-20140904/Ohana/src/fakeastro/src/make_fake_images.c

    r37527 r37531  
    7171      // gpc1-specific (assumes grizy map to 10101, etc)
    7272      fakeImage[N].photcode = fakeImage[0].photcode + iy*10 + ix;
     73
     74      char *ptr = strstr (fakeImage[N].name, "[PHU]");
     75      if (ptr) {
     76        snprintf (ptr, 7, "[XY%d%d]", ix, iy);
     77      }
    7378      N++;
    7479    }
  • branches/eam_branches/ipp-20140904/Ohana/src/fakeastro/src/make_fake_stars.c

    r37464 r37531  
    55  // patch is generous region around image, but limited ot this image
    66  SkyRegion *imagePatch = get_image_patch (image);
     7
     8  // fprintf (stderr, "image patch: %f %f , %f %f\n", imagePatch->Rmin, imagePatch->Rmax, imagePatch->Dmin, imagePatch->Dmax);
    79
    810  int Nstars = 0;
     
    1416    // skylist matches catalog
    1517
     18    // fprintf (stderr, "try catalog: %f %f , %f %f : ", skylist[0].regions[i][0].Rmin, skylist[0].regions[i][0].Rmax, skylist[0].regions[i][0].Dmin, skylist[0].regions[i][0].Dmax);
     19
    1620    // XXX check that catalog overlaps patch
    17     if (!SkyRegionsOverlap(skylist[0].regions[i], imagePatch)) continue;
     21    if (!SkyRegionsOverlap(skylist[0].regions[i], imagePatch)) { continue; }
     22    // fprintf (stderr, "skip\n");
     23    // fprintf (stderr, "keep\n");
    1824
    1925    // generate fake measurements for this image
  • branches/eam_branches/ipp-20140904/Ohana/src/fakeastro/src/make_fake_stars_catalog.c

    r37523 r37531  
    5050  StarPar *starpar = catalog->starpar;
    5151 
     52  double Rmid = 0.5*(imagePatch->Rmin + imagePatch->Rmax);
     53
    5254  int i;
    5355  for (i = 0; i < catalog->Naverage; i++) {
    5456
    5557    // true position from src catalog
    56     if (!IN_PATCH(imagePatch, average[i].R, average[i].D)) continue;
     58    double ra = ohana_normalize_angle_to_midpoint (average[i].R, Rmid);
     59
     60    // int show = !strcmp (image->name, "o6600g0127o.672655.cm.955522.smf[XY01]") && ((average[i].R < 1.0) || (average[i].R > 359.0));
     61    int show = FALSE;
     62
     63    if (show) fprintf (stderr, "try: %f (%f) %f : %f %f , %f %f", average[i].R, ra, average[i].D, imagePatch->Rmin, imagePatch->Rmax, imagePatch->Dmin, imagePatch->Dmax);
     64
     65    if (!IN_PATCH(imagePatch, ra, average[i].D)) {
     66      if (show) fprintf (stderr, "\n");
     67      continue;
     68    }
     69    if (show) fprintf (stderr, " * \n");
    5770
    5871    int nStar = average[i].starparOffset;
     
    8598    // tzero, timeRef are in UNIX seconds, Toffset should be in years
    8699    double Toffset = (image->tzero - timeRef) / 365.25 / 86400.0;
     100    // Toffset = 0.0; // XXX TEST
    87101
    88102    // uR,uD in linear (arcsec / yr)
     
    100114    double Dobs = Dtru + dDoff;
    101115
     116    Robs = ohana_normalize_angle (Robs);
     117
    102118    double X, Y;
    103119    RD_to_XY (&X, &Y, Robs, Dobs, &image->coords);
     120
     121    if ((fabs(Robs) < 0.1) || (fabs(Robs - 360.0) < 0.1)) {
     122      // fprintf (stderr, "%f %f : %f %f : %f %f\n", Rtru, Dtru, Robs, Dobs, X, Y);
     123    }
     124
    104125    if (X < 0) continue;
    105126    if (Y < 0) continue;
    106127    if (X > image->NX) continue;
    107128    if (Y > image->NY) continue;
     129
     130    if (!strcmp (image->name, "o6600g0127o.672655.cm.955522.smf[XY01]")) {
     131      // fprintf (stderr, "keep: %f %f\n", average[i].R, average[i].D);
     132    }
    108133
    109134    stars[Nstars].measure.Xccd       = X;
  • branches/eam_branches/ipp-20140904/Ohana/src/libdvo/src/BoundaryTree.c

    r37116 r37531  
    371371int BoundaryTreeCellCoords (BoundaryTree *tree, int *zone, int *band, double ra, double dec) {
    372372
     373  ra = ohana_normalize_angle (ra);
     374
    373375  // first, find the containing zone
    374376
  • branches/eam_branches/ipp-20140904/Ohana/src/libdvo/src/coordops.c

    r37402 r37531  
    174174    *dec = DEG_RAD*delta;
    175175
    176     *ra = ohana_normalize_angle (*ra);
     176    // *ra = ohana_normalize_angle (*ra);
    177177
    178178    return (TRUE);
     
    207207    *dec = delta + coords[0].crval2;
    208208
    209     *ra = ohana_normalize_angle (*ra);
     209    // *ra = ohana_normalize_angle (*ra);
    210210
    211211    return (TRUE);
  • branches/eam_branches/ipp-20140904/Ohana/src/libdvo/src/skyregion_ops.c

    r37514 r37531  
    268268  }
    269269
    270   if( Rmax > (Rmin+180.)) {
    271    
    272       double temp = Rmax;
    273       Rmax = Rmin;
    274       Rmin = temp;
    275   }
    276 
    277270  list = SkyListByBounds (table, depth, Rmin, Rmax, Dmin, Dmax);
    278271
     
    283276}
    284277
     278// a region like -10 10 0 20 will become 350 10 0 20 and return all regions on both sides of 0,360
    285279SkyList *SkyListByBounds (SkyTable *table, int depth, double Rmin, double Rmax, double Dmin, double Dmax) {
    286280
  • branches/eam_branches/ipp-20140904/Ohana/src/opihi/dvo/objectcoverage.c

    r37386 r37531  
    163163    for (xs = 0; xs < Nx; xs++) {
    164164      status = XY_to_RD (&r, &d, (double)(xs), (double)(ys), &coords);
    165       status &= (r >= 0);
    166       status &= (r <= 360);
     165      r = ohana_normalize_angle (r);
    167166      if (status) {
    168167        V[ys*Nx + xs] = ShowDensity ?  0 : 2;
  • branches/eam_branches/ipp-20140904/Ohana/src/opihi/dvo/skycoverage.c

    r37386 r37531  
    227227    for (xs = 0; xs < Nx; xs++) {
    228228      status = XY_to_RD (&r, &d, (double)(xs), (double)(ys), &coords);
    229       status &= (r >= 0);
    230       status &= (r <= 360);
     229      r = ohana_normalize_angle (r);
     230
    231231      // are we in a part of the projection covering the sky or not?
    232232      if (status) {
  • branches/eam_branches/ipp-20140904/Ohana/src/relastro/src/UpdateObjects.c

    r37455 r37531  
    357357    XY_to_RD (&fitPM.Ro, &fitPM.Do, fitPM.Ro, fitPM.Do, &coords);
    358358    if (XVERB) fprintf (stderr, "project: %f %f : %f %f : %f\n", fitPM.Ro, fitPM.Do, fitPM.uR, fitPM.uD, fitPM.p);
     359    if (fabs(fitPM.Ro) < 0.01) fprintf (stderr, "watch out for 0,360 boundary\n");
     360    // XXX : does this make sense at 0,360 boundary?
    359361
    360362    fitPM.p  = fitPM.dp  = 0.0;
     
    408410    average[0].flags |= ID_STAR_FIT_PAR;
    409411    fitStats->Npar ++;
     412
     413    if (fabs(fitPM.Ro) < 0.01) fprintf (stderr, "watch out for 0,360 boundary\n");
    410414
    411415    // XXX a hard-wired hack...
  • branches/eam_branches/ipp-20140904/Ohana/src/relphot/src/MosaicOps.c

    r37386 r37531  
    641641      Dmax = MAX (Dmax, D);
    642642
     643      // XXX : this probably does not handle mosaics at RA = 0,360 well
     644
    643645      /* we are using mosaic.Mcal, not image.Mcal. reset image.Mcal */
    644646
Note: See TracChangeset for help on using the changeset viewer.