IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 42515


Ignore:
Timestamp:
Aug 17, 2023, 4:27:16 PM (3 years ago)
Author:
eugene
Message:

merging from trunk: save stdev in median image accumulation

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20230313/Ohana/src/opihi/cmd.data/medacc.c

    r42082 r42515  
    88  Vector *val, *key, *out;
    99
     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
    1021  if ((argc != 6) && (argc != 7)) {
    1122    gprint (GP_ERR, "USAGE: medacc <value> <vector> <key> start end [delta]\n");
    1223    gprint (GP_ERR, "  value and key are vectors of the same length\n");
    1324    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");
    1529
    1630    return (FALSE);
     
    4357  ResetVector (out, OPIHI_FLT, Nbins);
    4458  bzero (out[0].elements.Flt, sizeof(opihi_flt)*out[0].Nelements);
     59
     60  if (stdev) {
     61    ResetVector (stdev, OPIHI_FLT, Nbins);
     62  }
    4563
    4664  /* copy vec and key to temp vectors */
     
    8098    }
    8199    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    }
    82108  }     
    83109 
Note: See TracChangeset for help on using the changeset viewer.