Changeset 40528
- Timestamp:
- Sep 25, 2018, 10:21:11 AM (8 years ago)
- Location:
- trunk/Ohana/src/addstar
- Files:
-
- 3 edited
-
include/skycells.h (modified) (3 diffs)
-
src/args_skycells.c (modified) (5 diffs)
-
src/sky_tessalation.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/addstar/include/skycells.h
r34260 r40528 12 12 # include <glob.h> 13 13 14 enum {SQUARES, TRIANGLES, LOCAL, RINGS, TAMAS };14 enum {SQUARES, TRIANGLES, LOCAL, RINGS, TAMAS, CFIS}; 15 15 enum {TETRAHEDRON, CUBE, OCTOHEDRON, DODECAHEDRON, ICOSAHEDRON}; 16 16 … … 96 96 int sky_tessellation_rings PROTO((FITS_DB *db, int level, int Nmax)); 97 97 int sky_tessellation_tamas PROTO((FITS_DB *db, int level, int Nmax)); 98 int sky_tessellation_cfis PROTO((FITS_DB *db, int level, int Nmax)); 98 99 99 100 int sky_triangle_to_image PROTO((Image *image, SkyTriangle *triangle)); … … 106 107 SkyRectangle *sky_rectangle_ring PROTO((float dec, float dDEC, int *nring, char *format)); 107 108 SkyRectangle *sky_rectangle_tamas PROTO((double *Dec, double dm, double halfa, double halftheta, int *nring, char *format)); 109 SkyRectangle *sky_rectangle_cfis PROTO((double dec, int *nring, char *format)); 108 110 109 111 SkyTriangle *sky_divide_triangles PROTO((SkyTriangle *in, int *ntriangles)); -
trunk/Ohana/src/addstar/src/args_skycells.c
r34260 r40528 40 40 if (!strcasecmp (argv[N], "tamas")) { 41 41 MODE = TAMAS; 42 } 43 if (!strcasecmp (argv[N], "cfis")) { 44 MODE = CFIS; 42 45 } 43 46 remove_argument (N, &argc, argv); … … 115 118 /* pixel scale (arcsec/pixel) */ 116 119 SCALE = 1.0; 120 if (MODE == CFIS) { 121 SCALE = 0.185768447409; // default CFIS value 122 } 117 123 if ((N = get_argument (argc, argv, "-scale"))) { 118 124 remove_argument (N, &argc, argv); … … 174 180 175 181 CELLSIZE = 4.0; 176 if ((MODE == RINGS) && (N = get_argument (argc, argv, "-cellsize"))) { 182 if (MODE == TAMAS) CELLSIZE = 3.955; 183 if (MODE == CFIS) CELLSIZE = 0.5; 184 185 int checkCellsize = (MODE == RINGS) || (MODE == TAMAS) || (MODE == CFIS); 186 187 if (checkCellsize && (N = get_argument (argc, argv, "-cellsize"))) { 177 188 remove_argument (N, &argc, argv); 178 189 CELLSIZE = strtod (argv[N], &ptr); … … 183 194 remove_argument (N, &argc, argv); 184 195 } 185 if (MODE == TAMAS) {186 CELLSIZE = 3.955;187 if ((N = get_argument (argc, argv, "-cellsize"))) {188 remove_argument (N, &argc, argv);189 CELLSIZE = strtod (argv[N], &ptr);190 if ((*ptr != 0) || (CELLSIZE < 0.0)) {191 fprintf (stderr, "-cellsize requires a floating-point argument\n");192 help ();193 }194 remove_argument (N, &argc, argv);195 }196 }197 196 198 197 OVERLAP_RA = 0; … … 230 229 fprintf (stderr, " TRIANGLE : generate triangular skycells using icosahedron base solid\n"); 231 230 fprintf (stderr, " RINGS : generate rectangular skycells using declination strips\n"); 231 fprintf (stderr, " CFIS : generate rectangular skycells using CFIS declination strips\n"); 232 232 fprintf (stderr, " LOCAL : generate a local tessellation around a spot on the sky\n"); 233 233 fprintf (stderr, " (Note that this tessellation does not cover the full sky)\n"); -
trunk/Ohana/src/addstar/src/sky_tessalation.c
r40498 r40528 26 26 sky_tessellation_tamas (db, level, Nmax); 27 27 return TRUE; 28 case CFIS: 29 sky_tessellation_cfis (db, level, Nmax); 30 return TRUE; 28 31 default: 29 32 break; … … 235 238 236 239 free (image); 240 return (TRUE); 241 } 242 243 // the CADC / CFIS tessellation uses the constant DEC offsets and simple cos(DEC)-scaled 244 // RA offsets. The skycell names are defined to match the RA,DEC sequence 245 int sky_tessellation_cfis (FITS_DB *db, int level, int Nmax) { 246 OHANA_UNUSED_PARAM(level); 247 OHANA_UNUSED_PARAM(Nmax); 248 249 char format[32]; 250 251 int Ndec = 0; 252 253 // generate the a collection of rectangles for each ring 254 for (double dec = -90.0; dec < +90.01; dec += CELLSIZE, Ndec ++) { 255 256 snprintf (format, 32, "skycell.%%03d.%03d", Ndec); 257 258 int Nring; 259 SkyRectangle *ring = sky_rectangle_cfis (dec, &Nring, format); 260 if (!ring) continue; 261 262 // nominal CFIS uses a single skycell per projection center 263 264 // subdivide each image (Nx x Ny subcells) 265 int Nimage = NX_SUB*NY_SUB*Nring; 266 ALLOCATE_PTR (image, Image, Nimage); 267 for (int j = 0; j < Nring; j++) { 268 // convert the SkyRectangles to Images for output 269 sky_subdivide_image (&image[j*NX_SUB*NY_SUB], &ring[j], NX_SUB, NY_SUB); 270 // printf("%s %8.2f %8.2f\n", ring[j].name, ring[j].coords.crval1, ring[j].coords.crval2); 271 } 272 273 /* add the new images and save */ 274 dvo_image_addrows (db, image, Nimage); 275 SetProtect (TRUE); 276 dvo_image_update (db, VERBOSE); 277 SetProtect (FALSE); 278 dvo_image_clear_vtable (db); 279 280 free (ring); 281 free (image); 282 } 237 283 return (TRUE); 238 284 } … … 623 669 624 670 return (TRUE); 671 } 672 673 // define the parameters of a projection centers for this DEC band 674 // dec : ~ center of band in Dec 675 // dDEC : approximate height 676 // nring : number of cells generated for this ring 677 // format : guide to generate the filenames (c-type string format) 678 679 // for skycell xxx.yyy, Dcenter = (yyy / 2 - 900), Rcenter = (xxx / 2 / dcos(Dcenter)) 680 681 SkyRectangle *sky_rectangle_cfis (double dec, int *nring, char *format) { 682 683 int i; 684 685 // Subdivide the DEC center line into an integer number of segments: 686 float dRA = CELLSIZE / cos(RAD_DEG*dec); // dRA is a size in RA degrees == \alpha_n 687 int nRA = (360.0 + 2*CELLSIZE) / dRA; // CELLSIZE is projection center spacing (DEC-direction) 688 689 ALLOCATE_PTR (ring, SkyRectangle, nRA); 690 691 for (i = 0; i < nRA; i++) { 692 memset (&ring[i], 0, sizeof(SkyRectangle)); 693 694 InitCoords (&ring[i].coords, "DEC--TAN"); 695 ring[i].coords.crval1 = i*dRA; 696 ring[i].coords.crval2 = dec; 697 698 ring[i].coords.pc1_1 = +1.0 * X_PARITY; 699 700 // we need to make this a user-defined option 701 // for the default CFIS cells, PADDING is 0 (hard-wired into NX,NY = 10000) 702 // ring[i].NX = NX*(1.0 + PADDING); 703 // ring[i].NY = NY*(1.0 + PADDING); 704 ring[i].NX = 10000; 705 ring[i].NY = 10000; 706 ring[i].photcode = 1; // this needs to be set more sensibly 707 708 // crpix1,crpix2 is the projection center 709 ring[i].coords.crpix1 = 0.5*ring[i].NX; 710 ring[i].coords.crpix2 = 0.5*ring[i].NY; 711 712 // user-supplied pixel scale 713 ring[i].coords.cdelt1 = SCALE / 3600.0; 714 ring[i].coords.cdelt2 = SCALE / 3600.0; 715 716 // CFIS uses names with centers based on ra,dec 717 // format = skycell.%03d.%03d 718 snprintf (ring[i].name, DVO_IMAGE_NAME_LEN, format, i); 719 } 720 721 *nring = nRA; 722 return (ring); 625 723 } 626 724
Note:
See TracChangeset
for help on using the changeset viewer.
