Changeset 29938 for trunk/Ohana/src/opihi
- Timestamp:
- Dec 5, 2010, 10:04:42 PM (16 years ago)
- Location:
- trunk/Ohana/src/opihi
- Files:
-
- 11 edited
- 1 copied
-
cmd.astro/region.c (modified) (1 diff)
-
cmd.data/Makefile (modified) (1 diff)
-
cmd.data/densify.c (copied) (copied from branches/eam_branches/ipp-20101103/Ohana/src/opihi/cmd.data/densify.c )
-
cmd.data/init.c (modified) (2 diffs)
-
cmd.data/rd.c (modified) (1 diff)
-
cmd.data/read_vectors.c (modified) (4 diffs)
-
cmd.data/resize.c (modified) (1 diff)
-
cmd.data/section.c (modified) (4 diffs)
-
cmd.data/vgauss.c (modified) (1 diff)
-
dvo/images.c (modified) (8 diffs)
-
dvo/imlist.c (modified) (1 diff)
-
lib.data/starfuncs.c (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/opihi/cmd.astro/region.c
r27435 r29938 55 55 if ((argc != 4) && (argc != 5)) { 56 56 gprint (GP_ERR, "USAGE: region Ra Dec Radius [projection] [orientation]\n"); 57 gprint (GP_ERR, " [-image] [-ew] [+ew] [-ns] [+ns] [-no-clear]\n"); 57 58 gprint (GP_ERR, " current: %f %f (%f x %f) (%s)\n", 58 59 graphmode.coords.crval1, graphmode.coords.crval2, -
trunk/Ohana/src/opihi/cmd.data/Makefile
r29540 r29938 36 36 $(SRC)/cut.$(ARCH).o \ 37 37 $(SRC)/delete.$(ARCH).o \ 38 $(SRC)/densify.$(ARCH).o \ 38 39 $(SRC)/device.$(ARCH).o \ 39 40 $(SRC)/dimendown.$(ARCH).o \ -
trunk/Ohana/src/opihi/cmd.data/init.c
r29540 r29938 25 25 int dbselect PROTO((int, char **)); 26 26 int delete PROTO((int, char **)); 27 int densify PROTO((int, char **)); 27 28 int device PROTO((int, char **)); 28 29 int dimendown PROTO((int, char **)); … … 161 162 {1, "dbselect", dbselect, "extract vectors from mysql database table"}, 162 163 {1, "delete", delete, "delete vectors or images"}, 164 {1, "densify", densify, "create an image histogram from a set of vectors"}, 163 165 {1, "device", device, "set / get current graphics device"}, 164 166 {1, "dimendown", dimendown, "convert image to vector"}, -
trunk/Ohana/src/opihi/cmd.data/rd.c
r28241 r29938 184 184 ftable.header[0].buffer = NULL; 185 185 gfits_copy_header (&buf[0].header, ftable.header); 186 status = gfits_fread_ftable_data (f, &ftable ); // this just reads the bytes (not even a SWAP)186 status = gfits_fread_ftable_data (f, &ftable, FALSE); // this just reads the bytes (not even a SWAP) 187 187 status = gfits_uncompress_image (&buf[0].header, &buf[0].matrix, &ftable); 188 188 // uncompressing the image leaves the format as an extension -
trunk/Ohana/src/opihi/cmd.data/read_vectors.c
r29540 r29938 160 160 161 161 off_t Nbytes; 162 int i, j, k, N, Nextend, Ny, Binary, vecType ;162 int i, j, k, N, Nextend, Ny, Binary, vecType, padIfShort; 163 163 char type[16], ID[80], *CCDKeyword; 164 164 FTable table; … … 174 174 CCDKeyword = strcreate (argv[N]); 175 175 remove_argument (N, &argc, argv); 176 } 177 178 padIfShort = FALSE; 179 if ((N = get_argument (argc, argv, "-pad-if-short"))) { 180 remove_argument (N, &argc, argv); 181 padIfShort = TRUE; 176 182 } 177 183 … … 205 211 } 206 212 if (!gfits_load_header (f, &header)) ESCAPE ("error reading header for extension"); 207 if (!gfits_fread_ftable_data (f, &table )) ESCAPE ("error reading table for extension");213 if (!gfits_fread_ftable_data (f, &table, padIfShort)) ESCAPE ("error reading table for extension"); 208 214 209 215 } else { … … 236 242 continue; 237 243 } 238 if (!gfits_fread_ftable_data (f, &table )) ESCAPE ("error reading table for extension");244 if (!gfits_fread_ftable_data (f, &table, padIfShort)) ESCAPE ("error reading table for extension"); 239 245 break; 240 246 } -
trunk/Ohana/src/opihi/cmd.data/resize.c
r13479 r29938 17 17 if (!GetImage (NULL, &kapa, name)) return (FALSE); 18 18 FREE (name); 19 20 if ((N = get_argument (argc, argv, "-by-image"))) { 21 remove_argument (N, &argc, argv); 22 KiiResizeByImage (kapa); 23 return (TRUE); 24 } 19 25 20 26 if (argc != 3) { -
trunk/Ohana/src/opihi/cmd.data/section.c
r27790 r29938 1 1 # include "data.h" 2 2 3 enum {NONE, LIST, UP, DOWN, TOP, BOTTOM, TOOL, BG };3 enum {NONE, LIST, UP, DOWN, TOP, BOTTOM, TOOL, BG, IMAGE}; 4 4 5 5 int section (int argc, char **argv) { … … 49 49 remove_argument (N, &argc, argv); 50 50 action = BG; 51 } 52 53 if ((N = get_argument (argc, argv, "-image"))) { 54 remove_argument (N, &argc, argv); 55 action = IMAGE; 51 56 } 52 57 … … 130 135 } 131 136 137 if (argc == 4) { 138 /* set section */ 139 section.name = argv[1]; 140 section.x = atof (argv[2]); 141 section.y = atof (argv[3]); 142 section.bg = background; 143 KapaSetSectionByImage (kapa, §ion); 144 return (TRUE); 145 } 146 132 147 if (argc == 6) { 133 148 /* set section */ … … 142 157 } 143 158 gprint (GP_ERR, "USAGE: section name [x y dx dy]\n"); 159 gprint (GP_ERR, "USAGE: section name [-image x y] : width based on current image\n"); 144 160 gprint (GP_ERR, "USAGE: section name [-list] [-up] [-down] [-top] [-bottom]\n"); 145 161 return (FALSE); -
trunk/Ohana/src/opihi/cmd.data/vgauss.c
r29001 r29938 45 45 CastVector (yvec, OPIHI_FLT); 46 46 CastVector (svec, OPIHI_FLT); 47 // XXX Cast is failing. 48 47 49 48 50 Npts = xvec[0].Nelements; -
trunk/Ohana/src/opihi/dvo/images.c
r28958 r29938 11 11 int images (int argc, char **argv) { 12 12 13 off_t i, Nimage ;13 off_t i, Nimage, Nmosaic; 14 14 int j, status, InPic, leftside, *plist, TimeSelect, ByName; 15 15 int WITH_MOSAIC, SOLO_MOSAIC, HIDDEN; 16 16 time_t tzero, tend; 17 int N, NPTS, n, npts, Npts, kapa ;17 int N, NPTS, n, npts, Npts, kapa, *foundMosaic; 18 18 Vector Xvec, Yvec; 19 19 double r[8], d[8], x[8], y[8], Rmin, Rmax, Rmid, trange, Radius; … … 35 35 36 36 SOLO_MOSAIC = FALSE; 37 foundMosaic = NULL; 37 38 if ((N = get_argument (argc, argv, "-mosaic"))) { 38 39 remove_argument (N, &argc, argv); … … 132 133 BuildChipMatch (image, Nimage); 133 134 135 if (SOLO_MOSAIC && photcode) { 136 ALLOCATE(foundMosaic, int, Nimage); 137 memset(foundMosaic, 0, Nimage*sizeof(int)); 138 } 139 134 140 Rmin = graphmode.coords.crval1 - 180.0; 135 141 Rmax = graphmode.coords.crval1 + 180.0; … … 137 143 138 144 int DistortImage = wordhash ("-DIS"); 145 int ChipImage = wordhash ("-WRP"); 139 146 int TriangleUp = wordhash ("TRP-"); 140 147 int TriangleDn = wordhash ("TRM-"); … … 150 157 if (ByName && strncmp (image[i].name, name, strlen(name))) continue; 151 158 if (TimeSelect && ((image[i].tzero < tzero) || (image[i].tzero+image[i].trate*image[i].NY > tzero + trange))) continue; 152 if (!FindMosaicForImage (image, Nimage, i)) continue; 159 if (!(Nmosaic = FindMosaicForImage (image, Nimage, i))) continue; 160 Nmosaic --; // XXX kind of a hack: FindMosaicForImage returns 0 or the mosaic seq number + 1 153 161 if (photcode) { 154 162 if ( photcodeEquiv && (photcode[0].code != GetPhotcodeEquivCodebyCode(image[i].photcode))) continue; … … 161 169 162 170 typehash = wordhash (&image[i].coords.ctype[4]); 171 172 if (photcode && SOLO_MOSAIC) { 173 // mosaic (DIS) images are not currently given a photcode : plot these via the WRP entries 174 /* DIS images represent a field, not a chip */ 175 if (typehash != ChipImage) continue; 176 if (foundMosaic[Nmosaic]) continue; 177 x[0] = -0.5*image[Nmosaic].NX; y[0] = -0.5*image[Nmosaic].NY; 178 x[1] = +0.5*image[Nmosaic].NX; y[1] = -0.5*image[Nmosaic].NY; 179 x[2] = +0.5*image[Nmosaic].NX; y[2] = +0.5*image[Nmosaic].NY; 180 x[3] = -0.5*image[Nmosaic].NX; y[3] = +0.5*image[Nmosaic].NY; 181 for (j = 0; j < Npts; j++) { 182 status = XY_to_RD (&r[j], &d[j], x[j], y[j], &image[Nmosaic].coords); 183 if (!status) break; 184 r[j] = ohana_normalize_angle (r[j]); 185 while (r[j] < Rmin) { r[j] += 360.0; } 186 while (r[j] > Rmax) { r[j] -= 360.0; } 187 if (j == 0) { 188 leftside = (r[j] < Rmid); 189 } 190 if (j > 0) { 191 if ( leftside && (r[j] > Rmid + 90)) { r[j] -= 360.0; } 192 if (!leftside && (r[j] < Rmid - 90)) { r[j] += 360.0; } 193 } 194 } 195 foundMosaic[Nmosaic] = TRUE; 196 goto plot_points; 197 } 163 198 164 199 /* DIS images represent a field, not a chip */ … … 270 305 if (Npts == 0) continue; 271 306 307 plot_points: 308 272 309 status = FALSE; 273 310 for (j = 0; j < Npts; j++) { … … 320 357 free (Yvec.elements.Flt); 321 358 FreeImages (image); 359 FREE (foundMosaic); 322 360 return (TRUE); 323 361 -
trunk/Ohana/src/opihi/dvo/imlist.c
r29540 r29938 104 104 XY_to_RD (&r, &d, 0.5*image[i].NX, 0.5*image[i].NY, &image[i].coords); 105 105 } 106 gprint (GP_LOG, "%3lld %s %8 .4f %8.4f %f %5d %2d %4.2f %5.3f %5.3f\n",107 (long long) i, image[i].name, r, d, t, image[i].nstar, image[i].photcode, image[i].secz, image[i].Mcal, image[i].dMcal);106 gprint (GP_LOG, "%3lld %s %8lld %8.4f %8.4f %f %5d %2d %4.2f %5.3f %5.3f\n", 107 (long long) i, image[i].name, (long long) image[i].imageID, r, d, t, image[i].nstar, image[i].photcode, image[i].secz, image[i].Mcal, image[i].dMcal); 108 108 } 109 109 -
trunk/Ohana/src/opihi/lib.data/starfuncs.c
r20936 r29938 5 5 double *ring; 6 6 double x, y, x2, y2, xy, I, sky, FWHMx, FWHMy, value, mag, Sxy; 7 int i, j, n, Npix2, Nring, Nmax;7 int i, j, n, Radius, Nring, Nmax; 8 8 double Npts, gain, dsky2, dmag, peak, offset; 9 9 char *string; … … 19 19 Nborder = MIN (1000, Nborder); 20 20 21 Npix2= (int)(0.5*Npix);22 Npix = 2 * Npix2+ 1;21 Radius = (int)(0.5*Npix); 22 Npix = 2 * Radius + 1; 23 23 Nring = 4*Nborder*(Nborder + Npix); 24 24 ALLOCATE (ring, double, Nring); … … 27 27 n = 0; 28 28 for (j = 0; j < Nborder; j++) { 29 for (i = X - Npix2 - Nborder; i < X + Npix2+ Nborder + 1; i++, n+=2) {30 ring[n] = gfits_get_matrix_value (matrix, i, (int)(Y - Npix2- j));31 ring[n+1] = gfits_get_matrix_value (matrix, i, (int)(Y + Npix2+ j));32 } 33 for (i = Y - Npix2; i < Y + Npix2+ 1; i++, n+=2) {34 ring[n] = gfits_get_matrix_value (matrix, (int)(X - Npix2- j), i);35 ring[n+1] = gfits_get_matrix_value (matrix, (int)(X + Npix2+ j), i);29 for (i = X - Radius - Nborder; i < X + Radius + Nborder + 1; i++, n+=2) { 30 ring[n] = gfits_get_matrix_value (matrix, i, (int)(Y - Radius - j)); 31 ring[n+1] = gfits_get_matrix_value (matrix, i, (int)(Y + Radius + j)); 32 } 33 for (i = Y - Radius; i < Y + Radius + 1; i++, n+=2) { 34 ring[n] = gfits_get_matrix_value (matrix, (int)(X - Radius - j), i); 35 ring[n+1] = gfits_get_matrix_value (matrix, (int)(X + Radius + j), i); 36 36 } 37 37 } … … 50 50 Npts = Nmax = 0; 51 51 x = y = x2 = y2 = xy = I = 0; 52 for (i = X - Npix2; i < X + Npix2 + 1; i++) { 53 for (j = Y - Npix2; j < Y + Npix2 + 1; j++) { 52 for (i = X - Radius; i < X + Radius + 1; i++) { 53 for (j = Y - Radius; j < Y + Radius + 1; j++) { 54 if (hypot((i-X), (j-Y)) > Radius) continue; 54 55 value = gfits_get_matrix_value (matrix, i, j); 55 56 offset = value - sky; … … 92 93 set_variable ("Zpk", peak); 93 94 set_int_variable ("Nsat", Nmax); 95 set_int_variable ("Npts", Npts); 94 96 95 97 gprint (GP_LOG, "%f %f %f %f %f %f %f %f\n", x, y, FWHMx, FWHMy, sky, I, mag, dmag);
Note:
See TracChangeset
for help on using the changeset viewer.
