Changeset 13186
- Timestamp:
- May 2, 2007, 7:42:37 PM (19 years ago)
- Location:
- trunk/Ohana/src/addstar
- Files:
-
- 3 edited
-
include/skycells.h (modified) (1 diff)
-
src/args_skycells.c (modified) (2 diffs)
-
src/sky_tessalation.c (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/addstar/include/skycells.h
r13185 r13186 53 53 int MODE; 54 54 int NMAX; 55 int NX_SUB, NY_SUB; 55 56 double SCALE; 56 57 -
trunk/Ohana/src/addstar/src/args_skycells.c
r13185 r13186 43 43 } 44 44 45 /* max number of skycells kept in memory */ 46 NX_SUB = NY_SUB = 1; 47 if ((N = get_argument (argc, argv, "-nx"))) { 48 remove_argument (N, &argc, argv); 49 NX_SUB = atof (argv[N]); 50 remove_argument (N, &argc, argv); 51 } 52 if ((N = get_argument (argc, argv, "-ny"))) { 53 remove_argument (N, &argc, argv); 54 NY_SUB = atof (argv[N]); 55 remove_argument (N, &argc, argv); 56 } 57 45 58 if (argc == 2) { 46 59 strtol (argv[1], &ptr, 10); … … 48 61 } 49 62 50 fprintf (stderr, "USAGE: skycells (level) [-triangles] [-scale arcsec/pix] [-nmax Max Cells in memory] \n");63 fprintf (stderr, "USAGE: skycells (level) [-triangles] [-scale arcsec/pix] [-nmax Max Cells in memory] [-nx (Nx cells)] [-ny (Ny cells)]\n"); 51 64 exit (2); 52 65 } -
trunk/Ohana/src/addstar/src/sky_tessalation.c
r13185 r13186 93 93 int sky_tessalation_squares (FITS_DB *db, int level, int Nmax) { 94 94 95 int i, j, Ndigit, Ntriangles, Nbase, Ntotal, Ntop, Ltop, Nout ;95 int i, j, Ndigit, Ntriangles, Nbase, Ntotal, Ntop, Ltop, Nout, Nx, Ny; 96 96 double fLtop; 97 97 SkyTriangle *base, *tri, *new; … … 99 99 char format[16]; 100 100 101 Nx = NX_SUB; 102 Ny = NY_SUB; 103 101 104 // generate the initial base set 102 105 base = sky_base_triangles (&Nbase); … … 108 111 109 112 // to what depth do we need to go to have only Nmax foreach subcell? 110 Ntop = Ntotal / Nmax;113 Ntop = Ntotal / (Nmax*Nx*Ny) ; 111 114 if (Ntop > Nbase) { 112 115 fLtop = log10(Ntotal / (double)(Ntop * Nbase)) / log10(4.0); … … 154 157 free (image); 155 158 159 // subdivide each image (Nx x Ny subcells) 160 if (Nx*Ny > 1) { 161 ALLOCATE (image, Image, Nx*Ny*Nout); 162 for (j = 0; j < Nout; j++) { 163 sky_subdivide_image (&image[j*Nx*Ny], &out[j], Nx, Ny); 164 } 165 free (out); 166 out = image; 167 Nout *= Nx*Ny; 168 } 169 156 170 /* add the new images and save */ 157 171 dvo_image_addrows (db, out, Nout); … … 229 243 image[0].Mxxy = xv[2]; image[0].Myyy = yv[2]; 230 244 245 return (TRUE); 246 } 247 248 // an allocated image set is supplied, we fill in the values 249 int sky_subdivide_image (Image *output, Image *input, int Nx, int Ny) { 250 251 int i, j, N, NX, NY; 252 253 NX = input[0].NX/(double)Nx + 0.5; 254 NY = input[0].NY/(double)Ny + 0.5; 255 256 N = 0; 257 for (j = 0; j < Ny; j++) { 258 for (i = 0; i < Nx; i++) { 259 260 memcpy (&output[N], &input[0], sizeof(Image)); 261 262 // output[0].coords = input[0].coords; 263 // strcpy (output[0].coords.ctype, input[0].coords.ctype); 264 265 output[N].NX = NX; 266 output[N].NY = NY; 267 268 output[N].coords.crpix1 = input[0].coords.crpix1 - i*NX; 269 output[N].coords.crpix2 = input[0].coords.crpix2 - j*NY; 270 N++; 271 } 272 } 231 273 return (TRUE); 232 274 }
Note:
See TracChangeset
for help on using the changeset viewer.
