IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 42156


Ignore:
Timestamp:
Apr 4, 2022, 3:59:15 PM (4 years ago)
Author:
eugene
Message:

add thresherr value and set if the desired threshold is saturated at one or other end of the data range

File:
1 edited

Legend:

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

    r41341 r42156  
    9595    // this algorithm assumes vecy[BinMax] > threshold, vecy[BinMin] < threshold
    9696    if (vecy[0].elements.Flt[BinMin] > value) {
    97       gprint (GP_ERR, "ERROR: all values above threshold\n");
    98       return FALSE;
     97      if (!QUIET) gprint (GP_ERR, "ERROR: all values above threshold\n");
     98      set_int_variable ("threshbin", BinMin);
     99      set_variable ("threshval", vecy[0].elements.Flt[BinMin]);
     100      set_variable ("threshold", vecx[0].elements.Flt[BinMin]);
     101      set_int_variable ("thresherr", 1);
     102      if (!QUIET) gprint (GP_LOG, "theshold %f (bin %d is %f)\n",
     103                          vecx[0].elements.Flt[BinMin], BinMin,
     104                          vecy[0].elements.Flt[BinMin]);
     105      return TRUE;
    99106    }
    100107    if (vecy[0].elements.Flt[BinMax] < value) {
    101       gprint (GP_ERR, "ERROR: all values below threshold\n");
    102       return FALSE;
     108      if (!QUIET) gprint (GP_ERR, "ERROR: all values below threshold\n");
     109      set_int_variable ("threshbin", BinMax);
     110      set_variable ("threshval", vecy[0].elements.Flt[BinMax]);
     111      set_variable ("threshold", vecx[0].elements.Flt[BinMax]);
     112      set_int_variable ("thresherr", 1);
     113      if (!QUIET) gprint (GP_LOG, "theshold %f (bin %d is %f)\n",
     114                          vecx[0].elements.Flt[BinMax], BinMax,
     115                          vecy[0].elements.Flt[BinMax]);
     116      return TRUE;
    103117    }
    104118    while (Nhi - Nlo > 10) {
     
    122136    // this algorithm assumes vecy[BinMin] > threshold, vecy[BinMax] < threshold
    123137    if (vecy[0].elements.Flt[BinMin] < value) {
    124       gprint (GP_ERR, "ERROR: all values below threshold\n");
    125       return FALSE;
     138      if (!QUIET) gprint (GP_ERR, "ERROR: all values below threshold\n");
     139      set_int_variable ("threshbin", BinMin);
     140      set_variable ("threshval", vecy[0].elements.Flt[BinMin]);
     141      set_variable ("threshold", vecx[0].elements.Flt[BinMin]);
     142      set_int_variable ("thresherr", 1);
     143      if (!QUIET) gprint (GP_LOG, "theshold %f (bin %d is %f)\n",
     144                          vecx[0].elements.Flt[BinMin], BinMin,
     145                          vecy[0].elements.Flt[BinMin]);
     146      return TRUE;
    126147    }
    127148    if (vecy[0].elements.Flt[BinMax] > value) {
    128       gprint (GP_ERR, "ERROR: all values above threshold\n");
    129       return FALSE;
     149      if (!QUIET) gprint (GP_ERR, "ERROR: all values above threshold\n");
     150      set_int_variable ("threshbin", BinMax);
     151      set_variable ("threshval", vecy[0].elements.Flt[BinMax]);
     152      set_variable ("threshold", vecx[0].elements.Flt[BinMax]);
     153      set_int_variable ("thresherr", 1);
     154      if (!QUIET) gprint (GP_LOG, "theshold %f (bin %d is %f)\n",
     155                          vecx[0].elements.Flt[BinMax], BinMax,
     156                          vecy[0].elements.Flt[BinMax]);
     157      return TRUE;
    130158    }
    131159    while (Nhi - Nlo > 10) {
     
    175203
    176204  set_variable ("threshval", y1);
     205  set_variable ("threshold", Xvalue);
    177206  set_int_variable ("threshbin", Nhi);
    178   set_variable ("threshold", Xvalue);
     207  set_int_variable ("thresherr", 0);
    179208
    180209  if (!QUIET) gprint (GP_LOG, "theshold %f (bin %d is %f)\n", Xvalue, Nhi, y1);
Note: See TracChangeset for help on using the changeset viewer.