IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

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/fakeastro/src
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • 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;
Note: See TracChangeset for help on using the changeset viewer.