IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Apr 16, 2020, 1:54:47 PM (6 years ago)
Author:
tdeboer
Message:

revert to working Ohana build

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/opihi/cmd.data/threshold.c

    r41164 r41340  
    2525    remove_argument (N, &argc, argv);
    2626    BinMax = atoi (argv[N]);
    27     remove_argument (N, &argc, argv);
    28   }
    29 
    30   float ValMin = NAN;
    31   float ValMax = NAN;
    32   if ((N = get_argument (argc, argv, "-vrange"))) {
    33     remove_argument (N, &argc, argv);
    34     ValMin = atof (argv[N]);
    35     remove_argument (N, &argc, argv);
    36     ValMax = atof (argv[N]);
    3727    remove_argument (N, &argc, argv);
    3828  }
     
    7464  }
    7565
    76   // ValMin, ValMax not compatible with BinMin, BinMax
    77   if (isfinite(ValMin)) {
    78     int binTest = ohana_bisection_double (vecx[0].elements.Flt, vecx[0].Nelements, ValMin);
    79     BinMin = (vecx[0].elements.Flt[binTest+1] == ValMin) ? binTest : binTest + 1;
    80     // XXX dangerous: check that this does not run off the end, etc
    81   }
    82   if (isfinite(ValMax)) {
    83     int binTest = ohana_bisection_double (vecx[0].elements.Flt, vecx[0].Nelements, ValMax);
    84     BinMax = (vecx[0].elements.Flt[binTest+1] == ValMax) ? binTest : binTest + 1;
    85     // XXX dangerous: check that this does not run off the end, etc
    86   }
    87 
    8866  // use bisection to find the value
    8967
     
    9371
    9472  if (!REVERSE) {
    95     // this algorithm assumes vecy[BinMax] > threshold, vecy[BinMin] < threshold
    96     if (vecy[0].elements.Flt[BinMin] > value) {
    97       gprint (GP_ERR, "ERROR: all values above threshold\n");
    98       return FALSE;
    99     }
    100     if (vecy[0].elements.Flt[BinMax] < value) {
    101       gprint (GP_ERR, "ERROR: all values below threshold\n");
    102       return FALSE;
    103     }
    10473    while (Nhi - Nlo > 10) {
    10574      N = 0.5*(Nlo + Nhi);
     
    12089    }
    12190  } else {
    122     // this algorithm assumes vecy[BinMin] > threshold, vecy[BinMax] < threshold
    123     if (vecy[0].elements.Flt[BinMin] < value) {
    124       gprint (GP_ERR, "ERROR: all values below threshold\n");
    125       return FALSE;
    126     }
    127     if (vecy[0].elements.Flt[BinMax] > value) {
    128       gprint (GP_ERR, "ERROR: all values above threshold\n");
    129       return FALSE;
    130     }
    13191    while (Nhi - Nlo > 10) {
    13292      N = 0.5*(Nlo + Nhi);
Note: See TracChangeset for help on using the changeset viewer.