Changeset 42466 for trunk/Ohana/src/opihi/cmd.data/medacc.c
- Timestamp:
- May 24, 2023, 3:31:48 PM (3 years ago)
- File:
-
- 1 edited
-
trunk/Ohana/src/opihi/cmd.data/medacc.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/opihi/cmd.data/medacc.c
r42082 r42466 8 8 Vector *val, *key, *out; 9 9 10 Vector *stdev = NULL; 11 if ((N = get_argument (argc, argv, "-stdev"))) { 12 remove_argument (N, &argc, argv); 13 stdev = SelectVector (argv[N], ANYVECTOR, TRUE); 14 remove_argument (N, &argc, argv); 15 if (!stdev) { 16 gprint (GP_ERR, "output vector for standard deviation not found\n"); 17 return (FALSE); 18 } 19 } 20 10 21 if ((argc != 6) && (argc != 7)) { 11 22 gprint (GP_ERR, "USAGE: medacc <value> <vector> <key> start end [delta]\n"); 12 23 gprint (GP_ERR, " value and key are vectors of the same length\n"); 13 24 gprint (GP_ERR, " the output vector bins correspond to values ranging from start to end in steps of delta (default 1)\n"); 14 gprint (GP_ERR, " for a given output bin, all input values for which the key matches the output bin are averaged\n"); 25 gprint (GP_ERR, " for a given output bin, all input values for which the key matches the output bin are used to calculate the statistic\n"); 26 27 gprint (GP_ERR, " the output is the average of the inner 25%% of data values\n"); 28 gprint (GP_ERR, " -stdev (outvec) : optionally return the standard deviation, calculated based on the 68%%-ile range\n"); 15 29 16 30 return (FALSE); … … 43 57 ResetVector (out, OPIHI_FLT, Nbins); 44 58 bzero (out[0].elements.Flt, sizeof(opihi_flt)*out[0].Nelements); 59 60 if (stdev) { 61 ResetVector (stdev, OPIHI_FLT, Nbins); 62 } 45 63 46 64 /* copy vec and key to temp vectors */ … … 80 98 } 81 99 if (fn > 0) O[i] /= fn; 100 101 if (stdev) { 102 int Nmin = 0.16*N; 103 int Nmax = 0.84*N; 104 float Smin = tmpvec[N0 + Nmin]; 105 float Smax = tmpvec[N0 + Nmax]; 106 stdev[0].elements.Flt[i] = 0.5*(Smax - Smin); 107 } 82 108 } 83 109
Note:
See TracChangeset
for help on using the changeset viewer.
