- Timestamp:
- Jun 8, 2011, 11:47:27 AM (15 years ago)
- Location:
- branches/eam_branches/ipp-20110505/Ohana
- Files:
-
- 5 edited
-
. (modified) (1 prop)
-
src/opihi/cmd.data/init.c (modified) (2 diffs)
-
src/opihi/cmd.data/read_vectors.c (modified) (4 diffs)
-
src/opihi/cmd.data/tvcolors.c (modified) (2 diffs)
-
src/opihi/cmd.data/zplot.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20110505/Ohana
- Property svn:mergeinfo set to
-
branches/eam_branches/ipp-20110505/Ohana/src/opihi/cmd.data/init.c
r31450 r31615 137 137 int zap PROTO((int, char **)); 138 138 int zplot PROTO((int, char **)); 139 int zcplot PROTO((int, char **)); 139 140 140 141 static Command cmds[] = { … … 284 285 {1, "zap", zap, "assign values to pixel regions"}, 285 286 {1, "zplot", zplot, "plot x y with size scaled by z"}, 287 {1, "zcplot", zcplot, "plot x y with color scaled by z"}, 286 288 }; 287 289 -
branches/eam_branches/ipp-20110505/Ohana/src/opihi/cmd.data/read_vectors.c
r31598 r31615 2 2 3 3 FILE *f = (FILE *) NULL; 4 char filename[ 1024];4 char filename[2048]; 5 5 6 6 int datafile (int argc, char **argv) { … … 84 84 colstr = argv[2*i+2]; 85 85 for (j = 0; j < strlen (colstr); j++) { 86 if (!isdigit(colstr[j])) { 87 gprint (GP_ERR, "USAGE: read name N name N ...\n"); 88 free (vec); 89 free (col); 90 return (FALSE); 91 } 92 } 93 col[i] = atof (colstr); 86 if (isdigit(colstr[j])) { 87 col[i] = atof (colstr); 88 continue; 89 } 90 // allow 'excel' columns names of the form A-Z, AA-AZ, BA-BZ, .. ZA-ZZ 91 if (strlen(colstr) >= 3) goto bad_colname; 92 if (colstr[0] < 'A') goto bad_colname; 93 if (colstr[0] > 'Z') goto bad_colname; 94 if (colstr[1] && colstr[1] < 'A') goto bad_colname; 95 if (colstr[1] && colstr[1] > 'Z') goto bad_colname; 96 97 col[i] = colstr[0] - 'A' + 1; 98 if (colstr[1]) { 99 col[i] *= 26; 100 col[i] += colstr[1] - 'A' + 1; 101 } 102 continue; 103 104 bad_colname: 105 gprint (GP_ERR, "USAGE: read name N name N ...\n"); 106 free (vec); 107 free (col); 108 return (FALSE); 109 } 94 110 } 95 111 … … 105 121 scan_line (f, buffer); 106 122 } 123 124 int Nfield = 0; 125 int Nline = 0; 107 126 108 127 Nstart = 0; … … 139 158 } 140 159 vec[i][0].elements.Flt[N] = value; 160 if (status) { 161 Nfield ++; 162 } 141 163 if (!status) vec[i][0].elements.Flt[N] = NAN; 142 164 } 143 165 if (status) N++; 144 166 } 167 Nline ++; 168 if (c1) { 169 // fprintf (stderr, "line %d, chars %ld, fields %d\n", Nline, (c1 - c0), Nfield); 170 } 171 Nfield = 0; 145 172 c0 = c1 + 1; 146 173 if (N == NELEM) { -
branches/eam_branches/ipp-20110505/Ohana/src/opihi/cmd.data/tvcolors.c
r25757 r31615 5 5 int N, kapa; 6 6 char *name; 7 KapaImageData data;7 // KapaImageData data; 8 8 9 9 name = NULL; … … 13 13 remove_argument (N, &argc, argv); 14 14 } 15 if (!Get Image (&data, &kapa, name)) return (FALSE);15 if (!GetGraph (NULL, &kapa, name)) return (FALSE); 16 16 FREE (name); 17 17 -
branches/eam_branches/ipp-20110505/Ohana/src/opihi/cmd.data/zplot.c
r20936 r31615 58 58 } 59 59 60 int zcplot (int argc, char **argv) { 61 62 int i, kapa; 63 opihi_flt *out; 64 double min, range; 65 Graphdata graphmode; 66 Vector *xvec, *yvec, *zvec, Zvec; 60 67 68 if (!style_args (&graphmode, &argc, argv, &kapa)) return (FALSE); 69 70 if (argc != 6) { 71 gprint (GP_ERR, "USAGE: zplot <x> <y> <z> min max\n"); 72 return (FALSE); 73 } 74 75 min = atof(argv[4]); 76 range = atof(argv[5]) - min; 77 78 /* find vectors */ 79 if ((xvec = SelectVector (argv[1], OLDVECTOR, TRUE)) == NULL) return (FALSE); 80 if ((yvec = SelectVector (argv[2], OLDVECTOR, TRUE)) == NULL) return (FALSE); 81 if ((zvec = SelectVector (argv[3], OLDVECTOR, TRUE)) == NULL) return (FALSE); 82 if (xvec[0].Nelements != yvec[0].Nelements) { 83 gprint (GP_ERR, "vectors %s and %s not the same length\n", argv[1], argv[2]); 84 return (FALSE); 85 } 86 if (xvec[0].Nelements != zvec[0].Nelements) { 87 gprint (GP_ERR, "vectors %s and %s not the same length\n", argv[1], argv[3]); 88 return (FALSE); 89 } 90 SetVector (&Zvec, OPIHI_FLT, zvec[0].Nelements); 91 out = Zvec.elements.Flt; 92 93 if (zvec[0].type == OPIHI_FLT) { 94 opihi_flt *in = zvec[0].elements.Flt; 95 for (i = 0; i < Zvec.Nelements; i++, in++, out++) { 96 *out = MIN (1.0, MAX (0.01, (*in - min) / range)); 97 } 98 } else { 99 opihi_int *in = zvec[0].elements.Int; 100 for (i = 0; i < Zvec.Nelements; i++, in++, out++) { 101 *out = MIN (1.0, MAX (0.01, (*in - min) / range)); 102 } 103 } 104 105 /* point size determined by Zvec */ 106 graphmode.style = 2; /* plot points */ 107 graphmode.color = -1; /* point color determined by Zvec */ 108 graphmode.etype = 0; /* no errorbars */ 109 PlotVectorTriplet (kapa, xvec, yvec, &Zvec, &graphmode); 110 111 free (Zvec.elements.Ptr); 112 113 return (TRUE); 114 115 } 116 117
Note:
See TracChangeset
for help on using the changeset viewer.
