IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
May 25, 2019, 8:59:46 AM (7 years ago)
Author:
eugene
Message:

add functions to fit a sigmoid to a vector and to match two vectors in 1D; allow vtransitions to be restricted to a value range

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ohana.20190329/src/opihi/cmd.data/threshold.c

    r40664 r40752  
    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]);
    2737    remove_argument (N, &argc, argv);
    2838  }
     
    6272    }
    6373    if (BinMax < 0) BinMax += vecx[0].Nelements;
     74  }
     75
     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
    6486  }
    6587
Note: See TracChangeset for help on using the changeset viewer.