- Timestamp:
- Apr 21, 2014, 5:42:34 AM (12 years ago)
- Location:
- branches/eam_branches/ps2-tc3-20130727
- Files:
-
- 12 edited
- 10 copied
-
. (modified) (1 prop)
-
Ohana (modified) (1 prop)
-
Ohana/src/opihi (modified) (1 prop)
-
Ohana/src/opihi/cmd.data (modified) (1 prop)
-
Ohana/src/opihi/cmd.data/Makefile (modified) (4 diffs)
-
Ohana/src/opihi/cmd.data/cast.c (copied) (copied from trunk/Ohana/src/opihi/cmd.data/cast.c )
-
Ohana/src/opihi/cmd.data/densify.c (modified) (5 diffs)
-
Ohana/src/opihi/cmd.data/impeaks.c (copied) (copied from trunk/Ohana/src/opihi/cmd.data/impeaks.c )
-
Ohana/src/opihi/cmd.data/imsmooth.2d.c (copied) (copied from trunk/Ohana/src/opihi/cmd.data/imsmooth.2d.c )
-
Ohana/src/opihi/cmd.data/imsmooth.generic.c (copied) (copied from trunk/Ohana/src/opihi/cmd.data/imsmooth.generic.c )
-
Ohana/src/opihi/cmd.data/init.c (modified) (8 diffs)
-
Ohana/src/opihi/cmd.data/join.c (copied) (copied from trunk/Ohana/src/opihi/cmd.data/join.c )
-
Ohana/src/opihi/cmd.data/match2d.c (modified) (3 diffs)
-
Ohana/src/opihi/cmd.data/medimage.c (copied) (copied from trunk/Ohana/src/opihi/cmd.data/medimage.c )
-
Ohana/src/opihi/cmd.data/medimage_commands.c (copied) (copied from trunk/Ohana/src/opihi/cmd.data/medimage_commands.c )
-
Ohana/src/opihi/cmd.data/read_vectors.c (modified) (3 diffs)
-
Ohana/src/opihi/cmd.data/rebin.c (modified) (1 diff)
-
Ohana/src/opihi/cmd.data/test/join.sh (copied) (copied from trunk/Ohana/src/opihi/cmd.data/test/join.sh )
-
Ohana/src/opihi/cmd.data/test/medimage.sh (copied) (copied from trunk/Ohana/src/opihi/cmd.data/test/medimage.sh )
-
Ohana/src/opihi/cmd.data/vellipse.c (modified) (1 diff)
-
Ohana/src/opihi/cmd.data/vgauss.c (modified) (2 diffs)
-
Ohana/src/opihi/cmd.data/vlist.c (copied) (copied from trunk/Ohana/src/opihi/cmd.data/vlist.c )
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ps2-tc3-20130727
- Property svn:mergeinfo changed
-
branches/eam_branches/ps2-tc3-20130727/Ohana
- Property svn:mergeinfo deleted
-
branches/eam_branches/ps2-tc3-20130727/Ohana/src/opihi
- Property svn:mergeinfo deleted
-
branches/eam_branches/ps2-tc3-20130727/Ohana/src/opihi/cmd.data
- Property svn:mergeinfo deleted
-
branches/eam_branches/ps2-tc3-20130727/Ohana/src/opihi/cmd.data/Makefile
r35416 r36680 25 25 $(SRC)/book.$(ARCH).o \ 26 26 $(SRC)/book_commands.$(ARCH).o \ 27 $(SRC)/cast.$(ARCH).o \ 27 28 $(SRC)/center.$(ARCH).o \ 28 29 $(SRC)/clear.$(ARCH).o \ … … 63 64 $(SRC)/imcut.$(ARCH).o \ 64 65 $(SRC)/imhist.$(ARCH).o \ 66 $(SRC)/impeaks.$(ARCH).o \ 65 67 $(SRC)/imsmooth.$(ARCH).o \ 68 $(SRC)/imsmooth.generic.$(ARCH).o \ 69 $(SRC)/imsmooth.2d.$(ARCH).o \ 66 70 $(SRC)/integrate.$(ARCH).o \ 67 71 $(SRC)/interpolate.$(ARCH).o \ 72 $(SRC)/join.$(ARCH).o \ 68 73 $(SRC)/jpeg.$(ARCH).o \ 69 74 $(SRC)/kern.$(ARCH).o \ … … 84 89 $(SRC)/mget.$(ARCH).o \ 85 90 $(SRC)/minterpolate.$(ARCH).o \ 91 $(SRC)/medimage.$(ARCH).o \ 92 $(SRC)/medimage_commands.$(ARCH).o \ 86 93 $(SRC)/mset.$(ARCH).o \ 87 94 $(SRC)/peak.$(ARCH).o \ … … 143 150 $(SRC)/vmaxwell.$(ARCH).o \ 144 151 $(SRC)/vgrid.$(ARCH).o \ 152 $(SRC)/vlist.$(ARCH).o \ 145 153 $(SRC)/vload.$(ARCH).o \ 146 154 $(SRC)/vzload.$(ARCH).o \ -
branches/eam_branches/ps2-tc3-20130727/Ohana/src/opihi/cmd.data/densify.c
r34088 r36680 2 2 3 3 # define CHECKVAL(ARG) if (!isfinite(ARG)) { gprint (GP_ERR, "illegal value for %s: %f\n", #ARG, ARG); return (FALSE); } 4 enum {IS_DOT, IS_SQUARE, IS_CIRCLE, IS_GAUSS}; 4 5 5 6 int densify (int argc, char **argv) { 6 7 7 int i, Nx, Ny, Xb, Yb, N, Xpix, Ypix, good, UseGraph;8 int i, Nx, Ny, Xb, Yb, ix, iy, N, Xpix, Ypix, good, UseGraph; 8 9 double Xmin, Xmax, dX, Ymin, Ymax, dY; 9 10 float *val; … … 24 25 } 25 26 27 float scale = 0.0; 28 if ((N = get_argument (argc, argv, "-scale"))) { 29 remove_argument (N, &argc, argv); 30 scale = atof(argv[N]); 31 remove_argument (N, &argc, argv); 32 } 33 34 int PSFTYPE = IS_DOT; 35 if ((N = get_argument (argc, argv, "-psf"))) { 36 remove_argument (N, &argc, argv); 37 if (!strcasecmp(argv[N], "dot")) PSFTYPE = IS_DOT; 38 if (!strcasecmp(argv[N], "square")) PSFTYPE = IS_SQUARE; 39 if (!strcasecmp(argv[N], "circle")) PSFTYPE = IS_CIRCLE; 40 if (!strcasecmp(argv[N], "gauss")) PSFTYPE = IS_GAUSS; 41 remove_argument (N, &argc, argv); 42 } 43 26 44 good = UseGraph ? (argc == 4) : (argc == 10); 27 45 if (!good) { 28 46 gprint (GP_ERR, "USAGE: densify buffer x y Xmin Xmax dX Ymin Ymax dY\n"); 29 47 gprint (GP_ERR, " OR: densify buffer x y -graph\n"); 48 gprint (GP_ERR, " option: -psf [dot] (circle) (square) (gauss)\n"); 30 49 return (FALSE); 31 50 } … … 69 88 CHECKVAL(dY); 70 89 90 float scaleX = (scale > 0.0) ? scale / dX : 3.0; 91 float scaleY = (scale > 0.0) ? scale / dY : 3.0; 92 71 93 Nx = (Xmax - Xmin) / dX + 1; 72 94 Ny = (Ymax - Ymin) / dY + 1; … … 76 98 CreateBuffer (bf, Nx, Ny, -32, 0.0, 1.0); 77 99 strcpy (bf[0].file, "(empty)"); 100 101 float scale2 = (scaleX + 1.0) * (scaleY + 1.0); 102 float fSquare = 1.0 / scale2; 103 float fCircle = 1.0 / (3.141592 * scale2); 104 float fSigma = 0.5 / scale2; 105 float fGauss = 1.0 / (2.0 * 3.141592 * scale2); 78 106 79 107 x = vx[0].elements.Flt; … … 83 111 Xb = (*x - Xmin) / dX; 84 112 Yb = (*y - Ymin) / dY; 85 if (Xb >= Nx) continue; 86 if (Yb >= Ny) continue; 87 if (Xb < 0) continue; 88 if (Yb < 0) continue; 89 val[Xb + Yb*Nx] ++; 113 switch (PSFTYPE) { 114 case IS_DOT: 115 if (Xb >= Nx) continue; 116 if (Yb >= Ny) continue; 117 if (Xb < 0) continue; 118 if (Yb < 0) continue; 119 val[Xb + Yb*Nx] ++; 120 break; 121 case IS_SQUARE: 122 for (ix = Xb - scaleX; ix <= Xb + scaleX; ix++) { 123 for (iy = Yb - scaleY; iy <= Yb + scaleY; iy++) { 124 if (ix >= Nx) continue; 125 if (iy >= Ny) continue; 126 if (ix < 0) continue; 127 if (iy < 0) continue; 128 val[ix + iy*Nx] += fSquare; 129 } 130 } 131 break; 132 case IS_CIRCLE: 133 for (ix = Xb - scaleX; ix <= Xb + scaleX; ix++) { 134 float dX = ix - Xb; 135 for (iy = Yb - scaleY; iy <= Yb + scaleY; iy++) { 136 float dY = iy - Yb; 137 float r2 = dX*dX + dY*dY; 138 if (r2 > 9) continue; 139 if (ix >= Nx) continue; 140 if (iy >= Ny) continue; 141 if (ix < 0) continue; 142 if (iy < 0) continue; 143 val[ix + iy*Nx] += fCircle; 144 } 145 } 146 break; 147 case IS_GAUSS: 148 for (ix = Xb - scaleX; ix <= Xb + scaleX; ix++) { 149 float dX = ix - Xb; 150 for (iy = Yb - scaleY; iy <= Yb + scaleY; iy++) { 151 float dY = iy - Yb; 152 float r2 = dX*dX + dY*dY; 153 if (ix >= Nx) continue; 154 if (iy >= Ny) continue; 155 if (ix < 0) continue; 156 if (iy < 0) continue; 157 val[ix + iy*Nx] += fGauss*exp(-fSigma*r2); 158 } 159 } 160 break; 161 } 90 162 } 91 163 return (TRUE); -
branches/eam_branches/ps2-tc3-20130727/Ohana/src/opihi/cmd.data/init.c
r35416 r36680 10 10 int center PROTO((int, char **)); 11 11 int parity PROTO((int, char **)); 12 int cast PROTO((int, char **)); 12 13 int circstats PROTO((int, char **)); 13 14 int clear PROTO((int, char **)); … … 52 53 int imcut PROTO((int, char **)); 53 54 int imhist PROTO((int, char **)); 55 int impeaks PROTO((int, char **)); 54 56 int imsmooth PROTO((int, char **)); 57 int imsmooth_generic PROTO((int, char **)); 58 int imsmooth_2d PROTO((int, char **)); 55 59 int integrate PROTO((int, char **)); 56 60 int interpolate PROTO((int, char **)); 61 int join PROTO((int, char **)); 57 62 int jpeg PROTO((int, char **)); 58 63 int kern PROTO((int, char **)); … … 74 79 int mget PROTO((int, char **)); 75 80 int minterp PROTO((int, char **)); 81 int medimage_command PROTO((int, char **)); 76 82 int mset PROTO((int, char **)); 77 83 int peak PROTO((int, char **)); … … 133 139 int vmaxwell PROTO((int, char **)); 134 140 int vload PROTO((int, char **)); 141 int vlist PROTO((int, char **)); 135 142 int vzload PROTO((int, char **)); 136 143 int vstats PROTO((int, char **)); … … 160 167 {1, "buffers", list_buffers, "list the currently allocated buffers (images)"}, 161 168 {1, "center", center, "center image on coords"}, 169 {1, "cast", cast, "cast input vector to specified type"}, 162 170 {1, "circstats", circstats, "circular statistics"}, 163 171 {1, "clear", clear, "erase plot"}, … … 205 213 {1, "imcut", imcut, "linear image cut between arbitrary coords"}, 206 214 {1, "imhistogram", imhist, "histogram of an image region"}, 215 {1, "impeaks", impeaks, "find peaks in an image (return vectors)"}, 207 216 {1, "imsmooth", imsmooth, "circular gaussian smoothing"}, 217 {1, "imsmooth.generic", imsmooth_generic, "circular non-gaussian smoothing"}, 218 {1, "imsmooth.2d", imsmooth_2d, "circular non-gaussian smoothing"}, 208 219 {1, "imstats", imstats, "statistics on a portion of an image"}, 209 220 {1, "integrate", integrate, "integrate a vector"}, 210 221 {1, "interpolate", interpolate, "interpolate between vector pairs"}, 222 {1, "join", join, "find the join of two ID vectors"}, 211 223 {1, "jpeg", jpeg, "convert display image to JPEG"}, 212 224 {1, "kern", kern, "convolve with 3x3 kernel"}, … … 224 236 {1, "minterp", minterp, "interpolate image pixels"}, 225 237 {1, "iminterp", minterp, "interpolate image pixels"}, 238 {1, "medimage", medimage_command, "median image manipulation"}, 226 239 {1, "matrix", matrix, "matrix math operations"}, 227 240 {1, "match2d", match2d, "match 2 pairs of X,Y vectors and return matched indexes"}, … … 290 303 {1, "vgrid", vgrid, "generate an image from a triplet of vectors"}, 291 304 {1, "vhistogram", histogram, "generate histogram from vector"}, 305 {1, "vlist", vlist, "append values to a vector from command line"}, 292 306 {1, "vload", vload, "load vectors as overlay on image display"}, 293 307 {1, "vmaxwell", vmaxwell, "fit a Maxwellian to a vector"}, -
branches/eam_branches/ps2-tc3-20130727/Ohana/src/opihi/cmd.data/match2d.c
r33963 r36680 14 14 Vector *index1, *index2; 15 15 16 if ((N = get_argument (argc, argv, "-h"))) goto usage; 17 if ((N = get_argument (argc, argv, "--help"))) goto usage; 18 16 19 CLOSEST = FALSE; 17 20 if ((N = get_argument (argc, argv, "-closest"))) { … … 38 41 if (argc != 6) { 39 42 gprint (GP_ERR, "USAGE: match2d X1 Y1 X2 Y2 Radius [-index1 (index1)] [-index2 (index2)] [-closest]\n"); 40 gprint (GP_ERR, " if -closest is provided, index1 & index2 will have the same length as X1 and X2 (respectively)\n"); 41 gprint (GP_ERR, " with either the index of the match or a value of -1 for non-matches\n"); 43 gprint (GP_ERR, " use -h or --help for more detail\n"); 42 44 return (FALSE); 43 45 } … … 90 92 91 93 return (TRUE); 94 95 usage: 96 gprint (GP_ERR, "we have two modes of operation:\n\n"); 97 98 gprint (GP_ERR, "without -closest, we are finding all matched pairs within the match radius. in this\n"); 99 gprint (GP_ERR, "case, the two index vectors have the same length, one entry per matched pair.\n"); 100 gprint (GP_ERR, "x1[index1],y1[index1] matches to x2[index2],y2[index2].\n\n"); 101 102 gprint (GP_ERR, "with -closest selected, we are finding the closest element of set 1 to each of set 2\n"); 103 gprint (GP_ERR, "and vice versa. in this case, index1 is always the same length as x1,y1, while index2\n"); 104 gprint (GP_ERR, "is the same lengths as x2,y2. x2[index1],y2[index1] matches x1,y1 while\n"); 105 gprint (GP_ERR, "x1[index2],y1[index2] matches x2,y2\n\n"); 106 107 gprint (GP_ERR, "if -index1 or -index2 is not supplied, the vectors are created with names index1 or index2\n"); 108 gprint (GP_ERR, "use 'reindex' to generate new vectors based on these index vectors\n"); 109 110 return FALSE; 92 111 } 93 112 -
branches/eam_branches/ps2-tc3-20130727/Ohana/src/opihi/cmd.data/read_vectors.c
r34753 r36680 23 23 // vector types 24 24 enum {COLTYPE_NONE, COLTYPE_FLT, COLTYPE_INT, COLTYPE_TIME, COLTYPE_CHAR}; 25 static int FITS_TRANSPOSE; 25 26 26 27 int read_vectors (int argc, char **argv) { … … 34 35 35 36 char *buffer = NULL; 37 38 FITS_TRANSPOSE = FALSE; 39 if ((Narg = get_argument (argc, argv, "-transpose"))) { 40 remove_argument (Narg, &argc, argv); 41 FITS_TRANSPOSE = TRUE; 42 } 36 43 37 44 /* auto-sense table type */ … … 410 417 } 411 418 412 // define the multifield vector names 413 ALLOCATE (vec, Vector *, Nval); 414 for (j = 0; j < Nval; j++) { 415 if (Nval == 1) 416 sprintf (name, "%s", argv[i]); 417 else 418 sprintf (name, "%s:%d", argv[i], j); 419 if ((vec[j] = SelectVector (name, ANYVECTOR, TRUE)) == NULL) ESCAPE ("bad vector name"); 420 ResetVector (vec[j], vecType, Ny); 421 } 422 423 if (!strcmp (type, "char")) { 424 char *Ptr = data; 419 if (!FITS_TRANSPOSE) { 420 // define the multifield vector names (Nval vectors x Ny elements) 421 ALLOCATE (vec, Vector *, Nval); 422 for (j = 0; j < Nval; j++) { 423 if (Nval == 1) 424 sprintf (name, "%s", argv[i]); 425 else 426 sprintf (name, "%s:%d", argv[i], j); 427 if ((vec[j] = SelectVector (name, ANYVECTOR, TRUE)) == NULL) ESCAPE ("bad vector name"); 428 ResetVector (vec[j], vecType, Ny); 429 } 430 431 if (!strcmp (type, "char")) { 432 char *Ptr = data; 433 for (j = 0; j < Ny; j++) { 434 for (k = 0; k < Nval; k++, Ptr++) { 435 vec[k][0].elements.Int[j] = *Ptr; 436 } 437 } 438 } 439 if (!strcmp (type, "short")) { 440 short *Ptr = data; 441 for (j = 0; j < Ny; j++) { 442 for (k = 0; k < Nval; k++, Ptr++) { 443 vec[k][0].elements.Int[j] = *Ptr; 444 } 445 } 446 } 447 if (!strcmp (type, "int")) { 448 int *Ptr = data; 449 for (j = 0; j < Ny; j++) { 450 for (k = 0; k < Nval; k++, Ptr++) { 451 vec[k][0].elements.Int[j] = *Ptr; 452 } 453 } 454 } 455 if (!strcmp (type, "int64_t")) { 456 int64_t *Ptr = data; 457 for (j = 0; j < Ny; j++) { 458 for (k = 0; k < Nval; k++, Ptr++) { 459 vec[k][0].elements.Int[j] = *Ptr; 460 } 461 } 462 } 463 if (!strcmp (type, "float")) { 464 float *Ptr = data; 465 for (j = 0; j < Ny; j++) { 466 for (k = 0; k < Nval; k++, Ptr++) { 467 vec[k][0].elements.Flt[j] = *Ptr; 468 } 469 } 470 } 471 if (!strcmp (type, "double")) { 472 double *Ptr = data; 473 for (j = 0; j < Ny; j++) { 474 for (k = 0; k < Nval; k++, Ptr++) { 475 vec[k][0].elements.Flt[j] = *Ptr; 476 } 477 } 478 } 479 } else { 480 // define the multifield vector names (Ny vectors x Nval elements) 481 ALLOCATE (vec, Vector *, Ny); 425 482 for (j = 0; j < Ny; j++) { 426 for (k = 0; k < Nval; k++, Ptr++) { 427 vec[k][0].elements.Int[j] = *Ptr; 428 } 429 } 430 } 431 if (!strcmp (type, "short")) { 432 short *Ptr = data; 433 for (j = 0; j < Ny; j++) { 434 for (k = 0; k < Nval; k++, Ptr++) { 435 vec[k][0].elements.Int[j] = *Ptr; 436 } 437 } 438 } 439 if (!strcmp (type, "int")) { 440 int *Ptr = data; 441 for (j = 0; j < Ny; j++) { 442 for (k = 0; k < Nval; k++, Ptr++) { 443 vec[k][0].elements.Int[j] = *Ptr; 444 } 445 } 446 } 447 if (!strcmp (type, "int64_t")) { 448 int64_t *Ptr = data; 449 for (j = 0; j < Ny; j++) { 450 for (k = 0; k < Nval; k++, Ptr++) { 451 vec[k][0].elements.Int[j] = *Ptr; 452 } 453 } 454 } 455 if (!strcmp (type, "float")) { 456 float *Ptr = data; 457 for (j = 0; j < Ny; j++) { 458 for (k = 0; k < Nval; k++, Ptr++) { 459 vec[k][0].elements.Flt[j] = *Ptr; 460 } 461 } 462 } 463 if (!strcmp (type, "double")) { 464 double *Ptr = data; 465 for (j = 0; j < Ny; j++) { 466 for (k = 0; k < Nval; k++, Ptr++) { 467 vec[k][0].elements.Flt[j] = *Ptr; 483 if (Ny == 1) 484 sprintf (name, "%s", argv[i]); 485 else 486 sprintf (name, "%s:%d", argv[i], j); 487 if ((vec[j] = SelectVector (name, ANYVECTOR, TRUE)) == NULL) ESCAPE ("bad vector name"); 488 ResetVector (vec[j], vecType, Nval); 489 } 490 491 if (!strcmp (type, "char")) { 492 char *Ptr = data; 493 for (j = 0; j < Ny; j++) { 494 for (k = 0; k < Nval; k++, Ptr++) { 495 vec[j][0].elements.Int[k] = *Ptr; 496 } 497 } 498 } 499 if (!strcmp (type, "short")) { 500 short *Ptr = data; 501 for (j = 0; j < Ny; j++) { 502 for (k = 0; k < Nval; k++, Ptr++) { 503 vec[j][0].elements.Int[k] = *Ptr; 504 } 505 } 506 } 507 if (!strcmp (type, "int")) { 508 int *Ptr = data; 509 for (j = 0; j < Ny; j++) { 510 for (k = 0; k < Nval; k++, Ptr++) { 511 vec[j][0].elements.Int[k] = *Ptr; 512 } 513 } 514 } 515 if (!strcmp (type, "int64_t")) { 516 int64_t *Ptr = data; 517 for (j = 0; j < Ny; j++) { 518 for (k = 0; k < Nval; k++, Ptr++) { 519 vec[j][0].elements.Int[k] = *Ptr; 520 } 521 } 522 } 523 if (!strcmp (type, "float")) { 524 float *Ptr = data; 525 for (j = 0; j < Ny; j++) { 526 for (k = 0; k < Nval; k++, Ptr++) { 527 vec[j][0].elements.Flt[k] = *Ptr; 528 } 529 } 530 } 531 if (!strcmp (type, "double")) { 532 double *Ptr = data; 533 for (j = 0; j < Ny; j++) { 534 for (k = 0; k < Nval; k++, Ptr++) { 535 vec[j][0].elements.Flt[k] = *Ptr; 536 } 468 537 } 469 538 } -
branches/eam_branches/ps2-tc3-20130727/Ohana/src/opihi/cmd.data/rebin.c
r28241 r36680 133 133 *Vout += *Vin; 134 134 if (Normalize) {(*Vn) ++;} 135 // if ((i == 1) && (j == 1)) fprintf (stderr, "%d,%d : %d,%d : %f : %f : %d\n", i, j, x, y, *Vin, *Vout, *Vn); 135 136 } 136 137 if (Normalize) {Vn ++;} -
branches/eam_branches/ps2-tc3-20130727/Ohana/src/opihi/cmd.data/vellipse.c
r25757 r36680 228 228 */ 229 229 230 // XXX NOTE that PHI is defined with the wrong sign, should fix this... 230 231 opihi_flt fellipseOD (opihi_flt alpha, opihi_flt *par, int Npar, opihi_flt *dpar) { 231 232 -
branches/eam_branches/ps2-tc3-20130727/Ohana/src/opihi/cmd.data/vgauss.c
r35109 r36680 48 48 if ((ovec = SelectVector (argv[4], ANYVECTOR, TRUE)) == NULL) return (FALSE); 49 49 50 CastVector (xvec, OPIHI_FLT); 51 CastVector (yvec, OPIHI_FLT); 52 50 53 int Nsvec = strlen(argv[3]); 51 54 … … 69 72 } 70 73 71 CastVector (xvec, OPIHI_FLT);72 CastVector (yvec, OPIHI_FLT);73 74 CastVector (svec, OPIHI_FLT); 74 75 // XXX Cast is failing.
Note:
See TracChangeset
for help on using the changeset viewer.
