- Timestamp:
- May 3, 2010, 8:50:52 AM (16 years ago)
- Location:
- branches/simtest_nebulous_branches
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/simtest_nebulous_branches
- Property svn:mergeinfo changed
-
branches/simtest_nebulous_branches/Ohana
-
Property svn:mergeinfo
set to (toggle deleted branches)
/trunk/Ohana merged eligible /branches/eam_branches/Ohana.20100407 27635-27772 /branches/pap_delete/Ohana 27530-27595
-
Property svn:mergeinfo
set to (toggle deleted branches)
-
branches/simtest_nebulous_branches/Ohana/src/opihi/dvo/skycoverage.c
r21153 r27840 6 6 7 7 int WITH_MOSAIC, SOLO_MOSAIC; 8 int i, N, Nimage, status, TimeSelect, ByName, xs, ys; 8 off_t i, Nimage; 9 int N, status, TimeSelect, ByName, xs, ys; 9 10 time_t tzero, tend; 10 double pixscale, dX, dY, Npts, r, d, Xi, Yi, Xs, Ys, x[2], y[2], trange, RaCenter ;11 double pixscale, dX, dY, Npts, r, d, Xi, Yi, Xs, Ys, x[2], y[2], trange, RaCenter, DecCenter; 11 12 Image *image; 12 char name[256] ;13 char name[256], projection[16]; 13 14 float *V; 14 15 int Nx, Ny; … … 16 17 Coords coords; 17 18 int typehash; 19 int PhotcodeSelect; 20 PhotCode *PhotcodeValue; 18 21 19 22 WITH_MOSAIC = FALSE; … … 31 34 32 35 RaCenter = 0.0; 33 if ((N = get_argument (argc, argv, "-ra-center"))) { 36 DecCenter = 0.0; 37 if ((N = get_argument (argc, argv, "-center"))) { 34 38 remove_argument (N, &argc, argv); 35 39 RaCenter = atof (argv[N]); 40 remove_argument (N, &argc, argv); 41 DecCenter = atof (argv[N]); 42 remove_argument (N, &argc, argv); 43 } 44 45 Nx = 0; 46 Ny = 0; 47 if ((N = get_argument (argc, argv, "-size"))) { 48 remove_argument (N, &argc, argv); 49 Nx = atof (argv[N]); 50 remove_argument (N, &argc, argv); 51 Ny = atof (argv[N]); 52 remove_argument (N, &argc, argv); 53 } 54 55 pixscale = 1.0; 56 if ((N = get_argument (argc, argv, "-scale"))) { 57 remove_argument (N, &argc, argv); 58 pixscale = atof (argv[N]); 36 59 remove_argument (N, &argc, argv); 37 60 } … … 43 66 remove_argument (N, &argc, argv); 44 67 ByName = TRUE; 68 } 69 70 strcpy (projection, "DEC--AIT"); 71 if ((N = get_argument (argc, argv, "-proj"))) { 72 remove_argument (N, &argc, argv); 73 if (!strcasecmp(argv[N], "TAN")) { 74 strcpy (projection, "DEC--TAN"); 75 } 76 if (!strcasecmp(argv[N], "SIN")) { 77 strcpy (projection, "DEC--SIN"); 78 } 79 if (!strcasecmp(argv[N], "GLS")) { 80 strcpy (projection, "DEC--GLS"); 81 } 82 if (!strcasecmp(argv[N], "PAR")) { 83 strcpy (projection, "DEC--PAR"); 84 } 85 remove_argument (N, &argc, argv); 86 } 87 88 PhotcodeValue = NULL; 89 PhotcodeSelect = FALSE; 90 if ((N = get_argument (argc, argv, "-photcode"))) { 91 if (!InitPhotcodes ()) return (FALSE); 92 PhotcodeSelect = TRUE; 93 remove_argument (N, &argc, argv); 94 PhotcodeValue = GetPhotcodebyName (argv[N]); 95 if (PhotcodeValue == NULL) { 96 gprint (GP_ERR, "photcode not found in photcode table\n"); 97 return (FALSE); 98 } 99 remove_argument (N, &argc, argv); 45 100 } 46 101 … … 84 139 } 85 140 86 if (argc != 4) {87 gprint (GP_ERR, "USAGE: skycoverage (buffer) ( pixscale) (Npts) [-time start range] [-name name]\n");88 gprint (GP_ERR, " (buffer) saves bitmapped AIT plot\n");89 gprint (GP_ERR, " ( pixscale) specifies the pixel size in degrees\n");141 if (argc != 3) { 142 gprint (GP_ERR, "USAGE: skycoverage (buffer) (Npts)\n"); 143 gprint (GP_ERR, " options: [-scale pixscale] [-center ra dec] [-size Nx Nx] [-proj projection] [-time start range] [-trange start stop] [-name name] [-photcode name] [+mosaic] [-mosaic]\n"); 144 gprint (GP_ERR, " (buffer) saves bitmapped image\n"); 90 145 gprint (GP_ERR, " (Npts) gives the number of test points per image in each dimension\n"); 146 gprint (GP_ERR, " -scale (pixscale) : specifies the pixel size in degrees [1.0]\n"); 147 gprint (GP_ERR, " -center (ra) (dec) : specifies the center of the field [0.0, 0.0]\n"); 148 gprint (GP_ERR, " -size (Nx) (Ny) : specifies the size of the image [360/scale, 180/scale]\n"); 149 gprint (GP_ERR, " -proj (projection) : specifies the projection choice [AIT]\n"); 91 150 gprint (GP_ERR, " note: we need 64800 / (pixscale)^2 pixels to represent the sky\n"); 92 151 return (FALSE); … … 94 153 95 154 if ((buf = SelectBuffer (argv[1], ANYBUFFER, TRUE)) == NULL) return (FALSE); 96 pixscale = atof(argv[2]); 97 Npts = atof(argv[3]); 98 99 Nx = 360/pixscale; 100 Ny = 180/pixscale; 155 Npts = atof(argv[2]); 156 157 if (!Nx || !Ny) { 158 Nx = 360/pixscale; 159 Ny = 180/pixscale; 160 } 101 161 102 162 gfits_free_matrix (&buf[0].matrix); … … 106 166 107 167 coords.crval1 = RaCenter; 108 coords.crval2 = 0;168 coords.crval2 = DecCenter; 109 169 coords.crpix1 = 0.5*Nx; 110 170 coords.crpix2 = 0.5*Ny; 111 strcpy (coords.ctype, "DEC--AIT");171 strcpy (coords.ctype, projection); 112 172 coords.pc1_1 = -1.0; 113 173 coords.pc2_2 = +1.0; … … 128 188 for (xs = 0; xs < Nx; xs++) { 129 189 status = XY_to_RD (&r, &d, (double)(xs), (double)(ys), &coords); 130 status &= (r > 0);131 status &= (r < 360);190 status &= (r >= 0); 191 status &= (r <= 360); 132 192 if (status) { 133 193 V[ys*Nx + xs] = 2; … … 141 201 if (ByName && strcmp (name, image[i].name)) continue; 142 202 if (TimeSelect && ((image[i].tzero < tzero) || (image[i].tzero+image[i].trate*image[i].NY > tzero + trange))) continue; 203 204 if (PhotcodeSelect) { 205 if (PhotcodeValue[0].type == PHOT_DEP) { 206 if (PhotcodeValue[0].code != image[i].photcode) continue; 207 } else { 208 if (PhotcodeValue[0].code != GetPhotcodeEquivCodebyCode (image[i].photcode)) continue; 209 } 210 } 211 143 212 if (!FindMosaicForImage (image, Nimage, i)) continue; 144 213 … … 167 236 XY_to_RD (&r, &d, Xi, Yi, &image[i].coords); 168 237 r = ohana_normalize_angle (r); 238 if (r - RaCenter > +180.0) r -= 360.0; 239 if (r - RaCenter < -180.0) r += 360.0; 169 240 status = RD_to_XY (&Xs, &Ys, r, d, &coords); 170 241 if (Xs < 0) continue;
Note:
See TracChangeset
for help on using the changeset viewer.
