Changeset 21153 for trunk/Ohana/src/opihi/dvo/skycoverage.c
- Timestamp:
- Jan 22, 2009, 10:43:26 AM (17 years ago)
- File:
-
- 1 edited
-
trunk/Ohana/src/opihi/dvo/skycoverage.c (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/opihi/dvo/skycoverage.c
r19823 r21153 1 1 # include "dvoshell.h" 2 3 int wordhash (char *word); 2 4 3 5 int skycoverage (int argc, char **argv) { 4 6 7 int WITH_MOSAIC, SOLO_MOSAIC; 5 8 int i, N, Nimage, status, TimeSelect, ByName, xs, ys; 6 9 time_t tzero, tend; 7 double pixscale, d Pix, r, d, Xi, Yi, Xs, Ys, x[2], y[2], trange;10 double pixscale, dX, dY, Npts, r, d, Xi, Yi, Xs, Ys, x[2], y[2], trange, RaCenter; 8 11 Image *image; 9 12 char name[256]; … … 12 15 Buffer *buf; 13 16 Coords coords; 17 int typehash; 18 19 WITH_MOSAIC = FALSE; 20 if ((N = get_argument (argc, argv, "+mosaic"))) { 21 remove_argument (N, &argc, argv); 22 WITH_MOSAIC = TRUE; 23 } 24 25 SOLO_MOSAIC = FALSE; 26 if ((N = get_argument (argc, argv, "-mosaic"))) { 27 remove_argument (N, &argc, argv); 28 SOLO_MOSAIC = TRUE; 29 WITH_MOSAIC = TRUE; 30 } 31 32 RaCenter = 0.0; 33 if ((N = get_argument (argc, argv, "-ra-center"))) { 34 remove_argument (N, &argc, argv); 35 RaCenter = atof (argv[N]); 36 remove_argument (N, &argc, argv); 37 } 14 38 15 39 ByName = FALSE; … … 61 85 62 86 if (argc != 4) { 63 gprint (GP_ERR, "USAGE: skycoverage (buffer) (pixscale) ( dPix) [-time start range] [-name name]\n");87 gprint (GP_ERR, "USAGE: skycoverage (buffer) (pixscale) (Npts) [-time start range] [-name name]\n"); 64 88 gprint (GP_ERR, " (buffer) saves bitmapped AIT plot\n"); 65 89 gprint (GP_ERR, " (pixscale) specifies the pixel size in degrees\n"); 90 gprint (GP_ERR, " (Npts) gives the number of test points per image in each dimension\n"); 66 91 gprint (GP_ERR, " note: we need 64800 / (pixscale)^2 pixels to represent the sky\n"); 67 92 return (FALSE); … … 70 95 if ((buf = SelectBuffer (argv[1], ANYBUFFER, TRUE)) == NULL) return (FALSE); 71 96 pixscale = atof(argv[2]); 72 dPix= atof(argv[3]);97 Npts = atof(argv[3]); 73 98 74 99 Nx = 360/pixscale; … … 80 105 strcpy (buf[0].file, "(empty)"); 81 106 82 coords.crval1 = 180;107 coords.crval1 = RaCenter; 83 108 coords.crval2 = 0; 84 109 coords.crpix1 = 0.5*Nx; 85 110 coords.crpix2 = 0.5*Ny; 86 111 strcpy (coords.ctype, "DEC--AIT"); 87 coords.pc1_1 = coords.pc2_2 = 1; 88 coords.pc1_2 = coords.pc2_1 = 0; 112 coords.pc1_1 = -1.0; 113 coords.pc2_2 = +1.0; 114 coords.pc1_2 = 0.0; 115 coords.pc2_1 = 0.0; 89 116 coords.cdelt1 = coords.cdelt2 = pixscale; 90 117 coords.Npolyterms = 0; … … 109 136 } 110 137 138 int DistortImage = wordhash ("-DIS"); 139 111 140 for (i = 0; i < Nimage; i++) { 112 141 if (ByName && strcmp (name, image[i].name)) continue; 113 142 if (TimeSelect && ((image[i].tzero < tzero) || (image[i].tzero+image[i].trate*image[i].NY > tzero + trange))) continue; 114 143 if (!FindMosaicForImage (image, Nimage, i)) continue; 144 145 typehash = wordhash (&image[i].coords.ctype[4]); 146 147 /* DIS images represent a field, not a chip */ 148 if ((typehash == DistortImage) && !WITH_MOSAIC) continue; 149 if ((typehash != DistortImage) && SOLO_MOSAIC) continue; 115 150 116 151 /* project this image to screen display coords */ … … 125 160 status = FALSE; 126 161 127 for (Yi = y[0] + 0.5*dPix; Yi < y[1]; Yi += dPix) { 128 for (Xi = x[0] + 0.5*dPix; Xi < x[1]; Xi += dPix) { 162 dX = (x[1] - x[0]) / Npts; 163 dY = (y[1] - y[0]) / Npts; 164 165 for (Yi = y[0] + 0.5*dY; Yi < y[1]; Yi += dY) { 166 for (Xi = x[0] + 0.5*dX; Xi < x[1]; Xi += dX) { 129 167 XY_to_RD (&r, &d, Xi, Yi, &image[i].coords); 130 168 r = ohana_normalize_angle (r); 131 169 status = RD_to_XY (&Xs, &Ys, r, d, &coords); 170 if (Xs < 0) continue; 171 if (Ys < 0) continue; 172 if (Xs >= Nx) continue; 173 if (Ys >= Ny) continue; 132 174 if (status) { 133 175 xs = (int)Xs;
Note:
See TracChangeset
for help on using the changeset viewer.
