Changeset 34844 for trunk/Ohana/src/addstar
- Timestamp:
- Dec 18, 2012, 10:04:35 AM (14 years ago)
- Location:
- trunk/Ohana
- Files:
-
- 3 edited
- 1 copied
-
. (modified) (1 prop)
-
src/addstar/src/findskycell.c (modified) (10 diffs)
-
src/addstar/src/sky_tessalation.c (modified) (3 diffs)
-
src/addstar/test/boundarytree.sh (copied) (copied from branches/eam_branches/ipp-20121130/Ohana/src/addstar/test/boundarytree.sh )
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana
- Property svn:mergeinfo changed
/branches/eam_branches/ipp-20121130/Ohana (added) merged: 34818-34822,34825-34827,34830-34831,34835-34837,34841
- Property svn:mergeinfo changed
-
trunk/Ohana/src/addstar/src/findskycell.c
r34291 r34844 15 15 16 16 void usage (void) { 17 fprintf (stderr, "USAGE: findcell -mktree (tree) (catdir) \n");17 fprintf (stderr, "USAGE: findcell -mktree (tree) (catdir) [-nx Nx] [-ny Ny]\n"); 18 18 fprintf (stderr, "USAGE: findcell -tree (tree) (datafile)\n"); 19 19 fprintf (stderr, " (datafile) should contain a list of RA,DEC pairs\n"); … … 24 24 int apply_tree (char *treefile, char *datafile); 25 25 26 float SCALE = 1.0; 27 int NX_SUB = 1; 28 int NY_SUB = 1; 29 26 30 int main (int argc, char **argv) { 27 31 … … 37 41 if (get_argument (argc, argv, "-help")) usage (); 38 42 if (get_argument (argc, argv, "-h")) usage (); 43 44 NX_SUB = NY_SUB = 1; 45 if ((N = get_argument (argc, argv, "-nx"))) { 46 remove_argument (N, &argc, argv); 47 NX_SUB = atof (argv[N]); 48 remove_argument (N, &argc, argv); 49 } 50 if ((N = get_argument (argc, argv, "-ny"))) { 51 remove_argument (N, &argc, argv); 52 NY_SUB = atof (argv[N]); 53 remove_argument (N, &argc, argv); 54 } 55 56 /* pixel scale (arcsec/pixel) */ 57 SCALE = 1.0; 58 if ((N = get_argument (argc, argv, "-scale"))) { 59 remove_argument (N, &argc, argv); 60 SCALE = atof (argv[N]); 61 remove_argument (N, &argc, argv); 62 } 39 63 40 64 /* extra error messages */ … … 109 133 110 134 tree.Nzone = 46; 135 tree.NX_SUB = NX_SUB; 136 tree.NY_SUB = NY_SUB; 137 tree.dPix = SCALE/3600.0; 111 138 112 139 ALLOCATE (tree.Nband, int, tree.Nzone); … … 122 149 ALLOCATE (tree.ra, double *, tree.Nzone); 123 150 ALLOCATE (tree.dec, double *, tree.Nzone); 151 ALLOCATE (tree.Xo, double *, tree.Nzone); 152 ALLOCATE (tree.Yo, double *, tree.Nzone); 153 ALLOCATE (tree.dX, int *, tree.Nzone); 154 ALLOCATE (tree.dY, int *, tree.Nzone); 124 155 ALLOCATE (tree.cell, int *, tree.Nzone); 125 156 ALLOCATE (tree.name, char **, tree.Nzone); … … 152 183 ALLOCATE (tree.ra[zone], double, tree.NBAND[zone]); 153 184 ALLOCATE (tree.dec[zone], double, tree.NBAND[zone]); 185 ALLOCATE (tree.Xo[zone], double, tree.NBAND[zone]); 186 ALLOCATE (tree.Yo[zone], double, tree.NBAND[zone]); 187 ALLOCATE (tree.dX[zone], int, tree.NBAND[zone]); 188 ALLOCATE (tree.dY[zone], int, tree.NBAND[zone]); 154 189 ALLOCATE (tree.cell[zone], int, tree.NBAND[zone]); 155 190 ALLOCATE (tree.name[zone], char *, tree.NBAND[zone]); … … 157 192 tree.ra[zone][band] = NAN; 158 193 tree.dec[zone][band] = NAN; 194 tree.Xo[zone][band] = NAN; 195 tree.Yo[zone][band] = NAN; 196 tree.dX[zone][band] = -1; 197 tree.dY[zone][band] = -1; 159 198 tree.cell[zone][band] = -1; 160 199 ALLOCATE (tree.name[zone][band], char, BOUNDARY_TREE_NAME_LENGTH); … … 179 218 REALLOCATE (tree.ra[zone], double, tree.NBAND[zone]); 180 219 REALLOCATE (tree.dec[zone], double, tree.NBAND[zone]); 181 REALLOCATE (tree.cell[zone], int, tree.NBAND[zone]); 220 REALLOCATE (tree.Xo[zone], double, tree.NBAND[zone]); 221 REALLOCATE (tree.Yo[zone], double, tree.NBAND[zone]); 222 REALLOCATE (tree.dX[zone], int, tree.NBAND[zone]); 223 REALLOCATE (tree.dY[zone], int, tree.NBAND[zone]); 224 REALLOCATE (tree.cell[zone], int, tree.NBAND[zone]); 182 225 REALLOCATE (tree.name[zone], char *, tree.NBAND[zone]); 183 226 for (j = start; j < tree.NBAND[zone]; j++) { 184 227 tree.ra[zone][j] = NAN; 185 228 tree.dec[zone][j] = NAN; 229 tree.Xo[zone][band] = NAN; 230 tree.Yo[zone][band] = NAN; 231 tree.dX[zone][band] = -1; 232 tree.dY[zone][band] = -1; 186 233 tree.cell[zone][j] = -1; 187 234 ALLOCATE (tree.name[zone][j], char, BOUNDARY_TREE_NAME_LENGTH); … … 190 237 tree.ra[zone][band] = ra; 191 238 tree.dec[zone][band] = dec; 239 tree.Xo[zone][band] = x; 240 tree.Yo[zone][band] = y; 241 tree.dX[zone][band] = image[i].NX / NX_SUB; 242 tree.dY[zone][band] = image[i].NY / NY_SUB; 243 192 244 tree.cell[zone][band] = i; 193 245 … … 325 377 } 326 378 327 fprintf (stdout, "%10.6f %10.6f %3d %3d %s\n", ra, dec, zone, band, tree->name[zone][band]); 379 // I know the projection cell (band,zone), but I need to find the skycell within that projection cell. 380 // the proj cell is divided into Nx, Ny bits. 381 // (ra,dec) for (Ro,Do) -> (x,y). given (Xo,Yo),(dX,dY) I can find ix,iy 382 // I currently track Ro,Do (tree->ra[zone][band], tree->dec[zone][band]) 383 // I need to have the skycell center in pixels (Xo,Yo) and the scale dX,dY 384 385 // convert R,D to X,Y with hard-wired projection and scale, orientation? 386 387 double x = 0.0; 388 double y = 0.0; 389 BoundaryTreeProjection (&x, &y, ra, dec, tree, zone, band); 390 391 int xi = x / tree->dX[zone][band]; 392 int yi = y / tree->dY[zone][band]; 393 394 char format[24], skycellname[128]; 395 int Ndigit = (int)(log10(tree->NX_SUB*tree->NY_SUB)) + 1 ; 396 snprintf (format, 24, "%s.%%0%dd", tree->name[zone][band], Ndigit); 397 398 int N = xi + tree->NX_SUB * yi; 399 snprintf (skycellname, 128, format, N); 400 401 fprintf (stdout, "%10.6f %10.6f %8.3f %8.3f %3d %3d %s\n", ra, dec, x, y, zone, band, skycellname); 328 402 } 329 403 330 404 exit (0); 331 405 } 406 -
trunk/Ohana/src/addstar/src/sky_tessalation.c
r34260 r34844 275 275 // convert the SkyRectangles to Images for output 276 276 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); 278 278 } 279 279 … … 691 691 // 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); 692 692 } 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); 694 694 695 695 // I think we need to return the value of dec for the next ring, but I am not sure... … … 776 776 ring[N].coords.crval2 = (j == 0) ? dec / d2r : -dec / d2r; 777 777 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); 779 779 780 780 ring[N].coords.pc1_1 = +1.0 * X_PARITY;
Note:
See TracChangeset
for help on using the changeset viewer.
