IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 34830


Ignore:
Timestamp:
Dec 17, 2012, 6:26:01 AM (14 years ago)
Author:
eugene
Message:

determine primary cell at the skycell level not the projection cell level

Location:
branches/eam_branches/ipp-20121130/Ohana/src
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20121130/Ohana/src/addstar/src/findskycell.c

    r34827 r34830  
    149149  ALLOCATE (tree.ra,   double *, tree.Nzone);
    150150  ALLOCATE (tree.dec,  double *, tree.Nzone);
    151   ALLOCATE (tree.Xo,      int *, tree.Nzone);
    152   ALLOCATE (tree.Yo,      int *, tree.Nzone);
     151  ALLOCATE (tree.Xo,   double *, tree.Nzone);
     152  ALLOCATE (tree.Yo,   double *, tree.Nzone);
    153153  ALLOCATE (tree.dX,      int *, tree.Nzone);
    154154  ALLOCATE (tree.dY,      int *, tree.Nzone);
     
    183183    ALLOCATE (tree.ra[zone],   double, tree.NBAND[zone]);
    184184    ALLOCATE (tree.dec[zone],  double, tree.NBAND[zone]);
    185     ALLOCATE (tree.Xo[zone],      int, tree.NBAND[zone]);
    186     ALLOCATE (tree.Yo[zone],      int, tree.NBAND[zone]);
     185    ALLOCATE (tree.Xo[zone],   double, tree.NBAND[zone]);
     186    ALLOCATE (tree.Yo[zone],   double, tree.NBAND[zone]);
    187187    ALLOCATE (tree.dX[zone],      int, tree.NBAND[zone]);
    188188    ALLOCATE (tree.dY[zone],      int, tree.NBAND[zone]);
     
    192192      tree.ra[zone][band] = NAN;
    193193      tree.dec[zone][band] = NAN;
    194       tree.Xo[zone][band] = -1;
    195       tree.Yo[zone][band] = -1;
     194      tree.Xo[zone][band] = NAN;
     195      tree.Yo[zone][band] = NAN;
    196196      tree.dX[zone][band] = -1;
    197197      tree.dY[zone][band] = -1;
     
    218218      REALLOCATE (tree.ra[zone],   double, tree.NBAND[zone]);
    219219      REALLOCATE (tree.dec[zone],  double, tree.NBAND[zone]);
    220       REALLOCATE (tree.Xo[zone],      int, tree.NBAND[zone]);
    221       REALLOCATE (tree.Yo[zone],      int, tree.NBAND[zone]);
     220      REALLOCATE (tree.Xo[zone],   double, tree.NBAND[zone]);
     221      REALLOCATE (tree.Yo[zone],   double, tree.NBAND[zone]);
    222222      REALLOCATE (tree.dX[zone],      int, tree.NBAND[zone]);
    223223      REALLOCATE (tree.dY[zone],      int, tree.NBAND[zone]);
     
    227227        tree.ra[zone][j] = NAN;
    228228        tree.dec[zone][j] = NAN;
    229         tree.Xo[zone][band] = -1;
    230         tree.Yo[zone][band] = -1;
     229        tree.Xo[zone][band] = NAN;
     230        tree.Yo[zone][band] = NAN;
    231231        tree.dX[zone][band] = -1;
    232232        tree.dY[zone][band] = -1;
     
    377377    }
    378378
    379     fprintf (stdout, "%10.6f %10.6f  %3d %3d  %s\n", ra, dec, zone, band, tree->name[zone][band]);
    380 
    381379    // I know the projection cell (band,zone), but I need to find the skycell within that projection cell.
    382380    // the proj cell is divided into Nx, Ny bits.
     
    390388    double y = 0.0;
    391389    BoundaryTreeProjection (&x, &y, ra, dec, tree, zone, band);
    392     fprintf (stdout, "%6.1f %6.1f\n", x, y);
    393390
    394391    int xi = x / tree->dX[zone][band];
     
    402399    snprintf (skycellname, 128, format, N);
    403400
    404     fprintf (stderr, "skycell: %s\n", skycellname);
     401    fprintf (stdout, "%10.6f %10.6f  %8.3f %8.3f  %3d %3d  %s\n", ra, dec, x, y, zone, band, skycellname);
    405402  }
    406403
  • branches/eam_branches/ipp-20121130/Ohana/src/addstar/src/sky_tessalation.c

    r34260 r34830  
    275275      // convert the SkyRectangles to Images for output
    276276      sky_subdivide_image (&image[j*NX_SUB*NY_SUB], &ring[j], NX_SUB, NY_SUB);
    277       printf("%s %8.2f %8.2f\n", ring[j].name, ring[j].coords.crval1, ring[j].coords.crval2);
     277      // printf("%s %8.2f %8.2f\n", ring[j].name, ring[j].coords.crval1, ring[j].coords.crval2);
    278278    }
    279279
     
    691691    // fprintf (stdout, "%f %f  %f  %f  %f %f  %f %f  %f %f %f\n", dec, decUpper, dRA, arg, root1, root2, theta1, theta2, r1, r2, k*r2);
    692692  }
    693   fprintf (stdout, "%f %f  %f x %f (%d)\n", dec, decUpper, dRA, theta, nRA);
     693  // fprintf (stdout, "%f %f  %f x %f (%d)\n", dec, decUpper, dRA, theta, nRA);
    694694
    695695  // I think we need to return the value of dec for the next ring, but I am not sure...
     
    776776      ring[N].coords.crval2 = (j == 0) ? dec / d2r : -dec / d2r;
    777777
    778       printf(" \t %d   %25.20f   %25.20f\n", i, ring[N].coords.crval2, ring[N].coords.crval1);
     778      // printf(" \t %d   %25.20f   %25.20f\n", i, ring[N].coords.crval2, ring[N].coords.crval1);
    779779
    780780      ring[N].coords.pc1_1 = +1.0 * X_PARITY;
  • branches/eam_branches/ipp-20121130/Ohana/src/libdvo/include/dvo.h

    r34827 r34830  
    331331  double dPix;
    332332
    333   int **Xo;
    334   int **Yo;
     333  double **Xo;
     334  double **Yo;
    335335  int **dX;
    336336  int **dY;
  • branches/eam_branches/ipp-20121130/Ohana/src/libdvo/src/BoundaryTree.c

    r34827 r34830  
    7979    ALLOCATE (tree->ra,   double *, tree->Nzone);
    8080    ALLOCATE (tree->dec,  double *, tree->Nzone);
    81     ALLOCATE (tree->Xo,      int *, tree->Nzone);
    82     ALLOCATE (tree->Yo,      int *, tree->Nzone);
     81    ALLOCATE (tree->Xo,   double *, tree->Nzone);
     82    ALLOCATE (tree->Yo,   double *, tree->Nzone);
    8383    ALLOCATE (tree->dX,      int *, tree->Nzone);
    8484    ALLOCATE (tree->dY,      int *, tree->Nzone);
     
    8888      ALLOCATE (tree->ra[i],   double, tree->Nband[i]);
    8989      ALLOCATE (tree->dec[i],  double, tree->Nband[i]);
    90       ALLOCATE (tree->Xo[i],      int, tree->Nband[i]);
    91       ALLOCATE (tree->Yo[i],      int, tree->Nband[i]);
     90      ALLOCATE (tree->Xo[i],   double, tree->Nband[i]);
     91      ALLOCATE (tree->Yo[i],   double, tree->Nband[i]);
    9292      ALLOCATE (tree->dX[i],      int, tree->Nband[i]);
    9393      ALLOCATE (tree->dY[i],      int, tree->Nband[i]);
     
    114114    GET_COLUMN_NEW(band,  "BAND",        int);
    115115    GET_COLUMN_NEW(index, "INDEX",       int);
    116     GET_COLUMN_NEW(Xo,    "X_CENT",      int);
    117     GET_COLUMN_NEW(Yo,    "Y_CENT",      int);
     116    GET_COLUMN_NEW(Xo,    "X_CENT",      double);
     117    GET_COLUMN_NEW(Yo,    "Y_CENT",      double);
    118118    GET_COLUMN_NEW(dX,    "X_GRID",      int);
    119119    GET_COLUMN_NEW(dY,    "Y_GRID",      int);
     
    251251    gfits_define_bintable_column (&theader, "J", "BAND", "band sequence number", "none", 1.0, 0.0);
    252252    gfits_define_bintable_column (&theader, "J", "INDEX","cell index", "none", 1.0, 0.0);
    253     gfits_define_bintable_column (&theader, "J", "X_CENT", "projection cell center pixel", "none", 1.0, 0.0);
    254     gfits_define_bintable_column (&theader, "J", "Y_CENT", "projection cell center pixel", "none", 1.0, 0.0);
     253    gfits_define_bintable_column (&theader, "D", "X_CENT", "projection cell center pixel", "none", 1.0, 0.0);
     254    gfits_define_bintable_column (&theader, "D", "Y_CENT", "projection cell center pixel", "none", 1.0, 0.0);
    255255    gfits_define_bintable_column (&theader, "J", "X_GRID", "skycell grid spacing", "none", 1.0, 0.0);
    256256    gfits_define_bintable_column (&theader, "J", "Y_GRID", "skycell grid spacing", "none", 1.0, 0.0);
     
    272272    int    *band          ; ALLOCATE (band,  int,    Ncell);
    273273    int    *index         ; ALLOCATE (index, int,    Ncell);
    274     int    *Xo            ; ALLOCATE (Xo,    int,    Ncell);
    275     int    *Yo            ; ALLOCATE (Yo,    int,    Ncell);
     274    double *Xo            ; ALLOCATE (Xo,    double, Ncell);
     275    double *Yo            ; ALLOCATE (Yo,    double, Ncell);
    276276    int    *dX            ; ALLOCATE (dX,    int,    Ncell);
    277277    int    *dY            ; ALLOCATE (dY,    int,    Ncell);
     
    372372int BoundaryTreeProjection (double *x, double *y, double r, double d, BoundaryTree *tree, int zone, int band) {
    373373
    374     double Xo = tree->Yo[zone][band];
    375     double Yo = tree->Xo[zone][band];
     374    double Xo = tree->Xo[zone][band];
     375    double Yo = tree->Yo[zone][band];
    376376    double Ro = tree->ra[zone][band];
    377377    double Do = tree->dec[zone][band];
  • branches/eam_branches/ipp-20121130/Ohana/src/opihi/dvo/gimages.c

    r34260 r34830  
    212212        status = XY_to_RD (&Rout, &Dout, X, Y, &image[i].coords);
    213213        fprintf (stderr, "r,d = %f,%f\n", Rout, Dout);
     214        status = RD_to_XY (&X, &Y, Ra, Dec, &image[i].coords);
     215        fprintf (stderr, "x,y = %f,%f\n", X, Y);
    214216    }
    215217# endif
  • branches/eam_branches/ipp-20121130/Ohana/src/relphot/src/BoundaryTreeOps.c

    r34825 r34830  
    2121  }
    2222 
     23# define USE_PROJECTION_CELL 0
     24# if (USE_PROJECTION_CELL)
    2325  snprintf (primaryCellName, DVO_MAX_PATH, "RINGS.V3.%s", tree->name[zone][band]);
     26# else
    2427
    2528  // I have ra, dec, and the primary projection cell.  In order to choose the primary skycell,
    2629  // I just need to project to ra,dec to X,Y based on the center of the cell and then get the subdivision right.
     30   
     31  double x = 0.0;
     32  double y = 0.0;
     33  BoundaryTreeProjection (&x, &y, ra, dec, tree, zone, band);
     34 
     35  int xi = x / tree->dX[zone][band];
     36  int yi = y / tree->dY[zone][band];
     37  int N = xi + tree->NX_SUB * yi;
     38 
     39  // XXX short-circuit this for now (we should use this code if we make tree have more variable NX,NY values
     40  // char format[24], skycellname[128];
     41  // int Ndigit = (int)(log10(tree->NX_SUB*tree->NY_SUB)) + 1 ;
     42  // snprintf (format, 24, "%s.%%0%dd", tree->name[zone][band], Ndigit);
     43  // snprintf (skycellname, 128, format, N);
     44
     45  snprintf (primaryCellName, DVO_MAX_PATH, "RINGS.V3.%s.%03d", tree->name[zone][band], N);
     46# endif
    2747
    2848  return TRUE;
  • branches/eam_branches/ipp-20121130/Ohana/src/relphot/src/ImageOps.c

    r34260 r34830  
    400400  if (i == -1) return FALSE;
    401401
    402   // this is a bit crude: stack image names are of the form
    403   // RINGS.V3.skycell.1495.027.sky.191211.stk.988232.cmf
    404   // the primaryCell has a name of the form RINGS.V3.skycell.1495
     402  // this is a bit crude: stack image names are of the form:
     403  // RINGS.V3.skycell.1495.027.sky.191211.stk.988232.cmf.
     404
     405  // the primaryCell has a name of the form RINGS.V3.skycell.1495 or RINGS.V3.skycell.1495.027
     406  // (if we use projection or skycell as the primary)
    405407
    406408  if (!strncmp(image[i].name, name, strlen(name))) return TRUE;
  • branches/eam_branches/ipp-20121130/Ohana/src/relphot/src/StarOps.c

    r34749 r34830  
    363363
    364364    if (isSetMrelFinal) {
     365      // set the name of the primary skycell (this is used in a strcmp to match the skycells in stack detections)
    365366      BoundaryTreePrimaryCell(primaryCell, catalog[Nc].average[j].R, catalog[Nc].average[j].D);
    366367    }
Note: See TracChangeset for help on using the changeset viewer.