Changeset 42389 for trunk/Ohana/src/opihi/cmd.data
- Timestamp:
- Feb 8, 2023, 12:17:35 PM (3 years ago)
- Location:
- trunk/Ohana
- Files:
-
- 15 edited
- 2 copied
-
. (modified) (1 prop)
-
src/opihi/cmd.data/Makefile (modified) (2 diffs)
-
src/opihi/cmd.data/cursor.c (modified) (1 diff)
-
src/opihi/cmd.data/init.c (modified) (4 diffs)
-
src/opihi/cmd.data/limits.c (modified) (3 diffs)
-
src/opihi/cmd.data/opihi_size.c (copied) (copied from branches/eam_branches/ipp-20220316/Ohana/src/opihi/cmd.data/opihi_size.c )
-
src/opihi/cmd.data/rdjpg.c (copied) (copied from branches/eam_branches/ipp-20220316/Ohana/src/opihi/cmd.data/rdjpg.c )
-
src/opihi/cmd.data/read_vectors.c (modified) (1 diff)
-
src/opihi/cmd.data/reindex.c (modified) (1 diff)
-
src/opihi/cmd.data/subset.c (modified) (3 diffs)
-
src/opihi/cmd.data/svd.c (modified) (1 diff)
-
src/opihi/cmd.data/test/histogram.sh (modified) (2 diffs)
-
src/opihi/cmd.data/test/join.sh (modified) (1 diff)
-
src/opihi/cmd.data/threshold.c (modified) (6 diffs)
-
src/opihi/cmd.data/tvcolors.c (modified) (1 diff)
-
src/opihi/cmd.data/wd.c (modified) (2 diffs)
-
src/opihi/cmd.data/write_vectors.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana
-
trunk/Ohana/src/opihi/cmd.data/Makefile
r42128 r42389 140 140 $(SRC)/radial.$(ARCH).o \ 141 141 $(SRC)/rd.$(ARCH).o \ 142 $(SRC)/rdjpg.$(ARCH).o \ 142 143 $(SRC)/rdseg.$(ARCH).o \ 143 144 $(SRC)/read_vectors.$(ARCH).o \ … … 154 155 $(SRC)/set.$(ARCH).o \ 155 156 $(SRC)/shift.$(ARCH).o \ 157 $(SRC)/opihi_size.$(ARCH).o \ 156 158 $(SRC)/sort.$(ARCH).o \ 157 159 $(SRC)/spline.$(ARCH).o \ -
trunk/Ohana/src/opihi/cmd.data/cursor.c
r39457 r42389 42 42 KiiCursorRead (kapa, &X, &Y, &Z, &R, &D, key); 43 43 44 sprintf (string, "X%s", key); 45 set_variable (string, X); 46 sprintf (string, "Y%s", key); 47 set_variable (string, Y); 48 sprintf (string, "Z%s", key); 49 set_variable (string, Z); 50 sprintf (string, "R%s", key); 51 set_variable (string, R); 52 sprintf (string, "D%s", key); 53 set_variable (string, D); 44 snprintf_nowarn (string, 20, "X%s", key); set_variable (string, X); 45 snprintf_nowarn (string, 20, "Y%s", key); set_variable (string, Y); 46 snprintf_nowarn (string, 20, "Z%s", key); set_variable (string, Z); 47 snprintf_nowarn (string, 20, "R%s", key); set_variable (string, R); 48 snprintf_nowarn (string, 20, "D%s", key); set_variable (string, D); 54 49 55 50 set_str_variable ("KEY", key); -
trunk/Ohana/src/opihi/cmd.data/init.c
r42128 r42389 126 126 int queue2book PROTO((int, char **)); 127 127 int rd PROTO((int, char **)); 128 int rdjpg PROTO((int, char **)); 128 129 int rdseg PROTO((int, char **)); 129 130 int read_vectors PROTO((int, char **)); … … 160 161 int tvgrid PROTO((int, char **)); 161 162 int opihi_type PROTO((int, char **)); 163 int opihi_size PROTO((int, char **)); 162 164 int uniq PROTO((int, char **)); 163 165 int uniqpair PROTO((int, char **)); … … 336 338 {1, "ipptool2book", queue2book, "convert queue with ipptool output to book"}, 337 339 {1, "rd", rd, "load fits image"}, 340 {1, "rdjpg", rdjpg, "load jpeg image"}, 338 341 {1, "rdseg", rdseg, "read a segment of an image from a file"}, 339 342 {1, "read", read_vectors, "read vectors from datafile"}, … … 350 353 {1, "set", set, "image and vector math"}, 351 354 {1, "shift", shift, "shift data in an image"}, 355 {1, "size", opihi_size, "get vector/matrix dimension/size information"}, 352 356 {1, "sort", sort_vectors, "sort list of vectors"}, 353 357 {1, "spline", spline_command, "shift data in an image"}, -
trunk/Ohana/src/opihi/cmd.data/limits.c
r40291 r42389 61 61 APPLY = TRUE; 62 62 } 63 63 64 char *name = NULL; 64 65 if ((N = get_argument (argc, argv, "-n"))) { … … 67 68 remove_argument (N, &argc, argv); 68 69 } 69 70 70 if (!GetGraph (&graphmode, &kapa, name)) return (FALSE); 71 71 FREE (name); 72 73 // this is not super intuitive 74 if ((N = get_argument (argc, argv, "-boxsize"))) { 75 remove_argument (N, &argc, argv); 76 float dx, dy; 77 // ask kapa for the size of the graph region in pixels 78 KapaGetLimits (kapa, &dx, &dy); 79 set_variable ("KAPA_XPIX", fabs(dx)); 80 set_variable ("KAPA_YPIX", fabs(dy)); 81 } 72 82 73 83 // XXX need an option to set the limits based on the current image bounds … … 169 179 return (TRUE); 170 180 } 181 182 /* -minX value : the minimum X axis value will be no higher than this value 183 -maxX value : the maximum X axis value will be no lower than this value 184 -delX value : the range of the X axis will be at least this value 185 186 These can be used to prevent the range from collapsing. 187 These are only used if the -a option is supplied, otherwise the supplied or auto-calculated 188 ranges are used (this seems like an poor choice) 189 190 */ 191 192 193 -
trunk/Ohana/src/opihi/cmd.data/read_vectors.c
r42082 r42389 385 385 if (!lineStatus && VERBOSE) { 386 386 char temp[32]; 387 strncpy (temp, c0, 32); 388 temp[31] = 0; 387 strncpy_nowarn (temp, c0, 31); 389 388 gprint (GP_ERR, "skip line %s\n\n", temp); 390 389 } -
trunk/Ohana/src/opihi/cmd.data/reindex.c
r42082 r42389 72 72 } 73 73 } 74 if (ivec->type == OPIHI_STR) { 75 opihi_int *vx = xvec[0].elements.Int; 76 for (Npts = i = 0; i < xvec[0].Nelements; i++, vx++) { 77 if (Npts >= NPTS) { 78 NPTS += 2000; 79 REALLOCATE (ovec[0].elements.Str, char *, NPTS); 80 } 81 if (*vx < 0) { 82 if (KEEP_UNMATCH) { 83 ovec[0].elements.Str[Npts] = strcreate(""); // XXX use a different or a specified value? 84 Npts++; 85 } 86 continue; 87 } 88 if (*vx > Nmax) ESCAPE("unexpected value in index: "OPIHI_INT_FMT" (%d)\n", *vx, i); 89 ovec[0].elements.Str[Npts] = strcreate(ivec->elements.Str[*vx]); 90 Npts++; 91 } 92 } 74 93 75 94 // free up unused memory -
trunk/Ohana/src/opihi/cmd.data/subset.c
r42311 r42389 44 44 ResetVector (ovec, ivec->type, tvec[0].Nelements); 45 45 46 // we have four cases: (ivec == flt or int) and (tvec == flt or int)46 // we have size cases: (ivec == flt, int, str) and (tvec == flt or int) 47 47 if ((ivec->type == OPIHI_FLT) && (tvec->type == OPIHI_FLT)) { 48 48 opihi_flt *vi = ivec[0].elements.Flt; … … 81 81 } 82 82 } 83 // XXX if ivec is an existing vector, this step will 84 // leak (existing elements need to be freed if they 85 // have been allocated). 83 86 if ((ivec->type == OPIHI_STR) && (tvec->type == OPIHI_FLT)) { 84 87 opihi_flt *vt = tvec[0].elements.Flt; 85 88 for (Npts = i = 0; i < tvec[0].Nelements; i++, vt++) { 86 89 if (!*vt) continue; 87 ovec[0].elements.Str[Npts] = strcreate (ivec[0].elements.Str[i]);90 ovec[0].elements.Str[Npts] = strcreate(ivec[0].elements.Str[i]); 88 91 Npts++; 89 92 } … … 93 96 for (Npts = i = 0; i < tvec[0].Nelements; i++, vt++) { 94 97 if (!*vt) continue; 95 ovec[0].elements.Str[Npts] = strcreate (ivec[0].elements.Str[i]);98 ovec[0].elements.Str[Npts] = strcreate(ivec[0].elements.Str[i]); 96 99 Npts++; 97 100 } -
trunk/Ohana/src/opihi/cmd.data/svd.c
r29540 r42389 58 58 59 59 // try C.R. Bond's version -- requires matrices in the form A[row][col] not A[row*Ncol + col] 60 if ( 1) {60 if (0) { 61 61 int j; 62 62 double **a, **u, **v, *q; -
trunk/Ohana/src/opihi/cmd.data/test/histogram.sh
r20936 r42389 35 35 local i 36 36 37 list word -x "ps -p $PID -o rss" 38 $startmem = $word:1 37 create xhis 0 10 0.1 38 $i = 1 39 40 memory stats 41 $startmem = $memory:Ntotal 39 42 40 43 for i 0 1000 … … 42 45 end 43 46 44 list word -x "ps -p $PID -o rss"45 $endmem = $ word:147 memory stats 48 $endmem = $memory:Ntotal 46 49 47 50 $PASS = 1 -
trunk/Ohana/src/opihi/cmd.data/test/join.sh
r36084 r42389 21 21 22 22 join ID1 ID2 23 24 mana: for i 0 index1[]25 >> echo index1[$i] index2[$i]26 >> end27 0 228 2 129 4 030 5 331 mana: join ID1 ID2 -outer32 mana: vectors33 N name size34 0 ID1 6 (INT)35 1 val1 6 (FLT)36 2 ID2 4 (INT)37 3 val 4 (FLT)38 4 index1 6 (INT)39 5 index2 4 (INT)40 mana: for i 0 index1[]41 >> echo index1[$i]42 >> end43 244 -145 146 -147 048 349 mana: echo ID1[2]50 351 mana: echo ID1[0] ID2[2]52 1 153 mana: for i 0 index1[]54 >> if (index1[$i] == -1) continue55 >> $N = index1[$i]56 >> echo $i index1[$i] ID1[$i] ID2[$N]57 >> end58 0 2 1 159 2 1 3 360 4 0 5 561 5 3 6 662 mana: for i 0 index2[]63 >> if (index2[$i] == -1) continue64 >> $N = index2[$i]65 >> echo $i index2[$i] ID2[$i] ID1[$N]66 >> end67 0 4 5 568 1 2 3 369 2 0 1 170 3 5 6 671 mana:72 73 # if ((xvec[1024] != 17) || (yvec[1024] != 100))74 # $PASS = 075 # echo "Value mismatch: xvec[1024] yvec[1024] (should be 17,100)"76 # end77 #78 # imhist -q buff xvec yvec -region 40 0 25 10 -range 0 1079 #80 # if ((xvec[1024] != 10) || (yvec[1024] != 100))81 # $PASS = 082 # echo "Value mismatch: xvec[1024] yvec[1024] (should be 10,100)"83 # end84 23 85 24 end -
trunk/Ohana/src/opihi/cmd.data/threshold.c
r42277 r42389 3 3 int QUIET = FALSE; 4 4 5 void _threshold_set_values (double value, int Nbin, double level ) {5 void _threshold_set_values (double value, int Nbin, double level, int thresherr) { 6 6 7 7 set_variable ("threshval", value); 8 8 set_int_variable ("threshbin", Nbin); 9 9 set_variable ("threshold", level); 10 set_int_variable ("thresherr", thresherr); 10 11 11 12 if (!QUIET) gprint (GP_LOG, "theshold %f (bin %d is %f)\n", level, Nbin, value); … … 117 118 if (vecy[0].elements.Flt[BinMin] > value) { 118 119 if (SATURATE) { 119 _threshold_set_values (vecy[0].elements.Flt[BinMin], BinMin, vecx[0].elements.Flt[BinMin] );120 _threshold_set_values (vecy[0].elements.Flt[BinMin], BinMin, vecx[0].elements.Flt[BinMin], 1); 120 121 return TRUE; 121 122 } else { 122 123 gprint (GP_ERR, "ERROR: all values above threshold\n"); 123 _threshold_set_values (NAN, -1, NAN );124 _threshold_set_values (NAN, -1, NAN, 1); 124 125 return FALSE; 125 126 } … … 127 128 if (vecy[0].elements.Flt[BinMax] < value) { 128 129 if (SATURATE) { 129 _threshold_set_values (vecy[0].elements.Flt[BinMax], BinMax, vecx[0].elements.Flt[BinMax] );130 _threshold_set_values (vecy[0].elements.Flt[BinMax], BinMax, vecx[0].elements.Flt[BinMax], 1); 130 131 return TRUE; 131 132 } else { 132 133 gprint (GP_ERR, "ERROR: all values below threshold\n"); 133 _threshold_set_values (NAN, -1, NAN );134 _threshold_set_values (NAN, -1, NAN, 1); 134 135 return FALSE; 135 136 } … … 156 157 if (vecy[0].elements.Flt[BinMin] < value) { 157 158 if (SATURATE) { 158 _threshold_set_values (vecy[0].elements.Flt[BinMin], BinMin, vecx[0].elements.Flt[BinMin] );159 _threshold_set_values (vecy[0].elements.Flt[BinMin], BinMin, vecx[0].elements.Flt[BinMin], 1); 159 160 return TRUE; 160 161 } else { 161 162 gprint (GP_ERR, "ERROR: all values below threshold\n"); 162 _threshold_set_values (NAN, -1, NAN );163 _threshold_set_values (NAN, -1, NAN, 1); 163 164 return FALSE; 164 165 } … … 166 167 if (vecy[0].elements.Flt[BinMax] > value) { 167 168 if (SATURATE) { 168 _threshold_set_values (vecy[0].elements.Flt[BinMax], BinMax, vecx[0].elements.Flt[BinMax] );169 _threshold_set_values (vecy[0].elements.Flt[BinMax], BinMax, vecx[0].elements.Flt[BinMax], 1); 169 170 return TRUE; 170 171 } else { 171 172 gprint (GP_ERR, "ERROR: all values above threshold\n"); 172 _threshold_set_values (NAN, -1, NAN );173 _threshold_set_values (NAN, -1, NAN, 1); 173 174 return FALSE; 174 175 } … … 219 220 } 220 221 221 _threshold_set_values (y1, Nhi, Xvalue );222 _threshold_set_values (y1, Nhi, Xvalue, 0); 222 223 return (TRUE); 223 224 } -
trunk/Ohana/src/opihi/cmd.data/tvcolors.c
r41341 r42389 41 41 gprint (GP_ERR, " f: 0 - 1 defines the scale value for the transition\n"); 42 42 gprint (GP_ERR, " R,G,B: 0 - 1 define the value of the color at the transition point\n"); 43 44 gprint (GP_ERR, " There are 5 colormap file format options:\n"); 45 gprint (GP_ERR, " * file:filename : index Red Green Blue\n"); 46 gprint (GP_ERR, " * lgcy:filename : index Red Blue Green\n"); 47 gprint (GP_ERR, " * csvf:filename : index,Red,Green,Blue\n"); 48 gprint (GP_ERR, " * cetf:filename : fRed,fGreen,fBlue \n"); 49 gprint (GP_ERR, " * cetr:filename : fRed,fGreen,fBlue \n\n"); 50 gprint (GP_ERR, " The index value goes from 0.0 to 1.0 and sets transitions (must be monotonic).\n"); 51 gprint (GP_ERR, " In the CET cases, the index is implicit, with 256 entries expected.\n"); 52 gprint (GP_ERR, " For cetr: the index is reversed.\n"); 53 43 54 return (FALSE); 44 55 } -
trunk/Ohana/src/opihi/cmd.data/wd.c
r41674 r42389 115 115 Ns = strlen (simple); 116 116 No = 80 - Ns; 117 strncpy (temp_header.buffer, simple, Ns);117 strncpy_nowarn (temp_header.buffer, simple, Ns); 118 118 memset (&temp_header.buffer[Ns], ' ', No); 119 119 } … … 275 275 return (f); 276 276 } 277 278 279 /// /* fix up header */280 /// {281 /// static char simple[] = "XTENSION= 'IMAGE ' / Image extension";282 /// int Ns, No;283 /// Ns = strlen (simple);284 /// No = 80 - Ns;285 /// strncpy (temp_header.buffer, simple, Ns);286 /// memset (&temp_header.buffer[Ns], ' ', No);287 /// }288 ///289 /// /* position to end of file to write new extend */290 /// fseeko (f, 0LL, SEEK_END);291 /// nbytes = fwrite (temp_header.buffer, 1, temp_header.datasize, f);292 /// fclose (f);293 /// if (nbytes != temp_header.datasize) {294 /// gprint (GP_ERR, "failed to write file\n");295 /// status = FALSE;296 /// goto done1;297 /// }298 ///299 /// } -
trunk/Ohana/src/opihi/cmd.data/write_vectors.c
r42127 r42389 214 214 /* identify type (%NNNNd %NNNNf) */ 215 215 for (p2 = p1 + 1; (*p2 == '.') || (*p2 == '-') || (*p2 == '+') || (*p2 == ' ') || isdigit(*p2); p2++); 216 strncpy (fmtlist[j], p0, p2 - p0 + 1);216 strncpy_nowarn (fmtlist[j], p0, p2 - p0 + 1); 217 217 switch (*p2) { 218 218 case 'e':
Note:
See TracChangeset
for help on using the changeset viewer.
