def utilityAt(i, counts_v, data, bin_options): """Call the binning library.""" events = len(counts_v) counts = statistics.countStatistic(counts_v) alpha = data['alpha'] beta = data['beta'] gamma = data['gamma'] return interface.utilityAt(i, events, counts, alpha, beta, gamma, bin_options)
def timingsToCounts(timings, binsize, srange): if srange == None: MIN = min(map(min, timings)) MAX = max(map(max, timings)) else: MIN = srange[0] MAX = srange[1] N = int(math.ceil(float(MAX-MIN)/binsize)) successes = list(np.repeat(0, N+1)) x = range(MIN, MAX+binsize, binsize) for trial in timings: for t in trial: n = int(math.ceil(float(t-MIN)/binsize)) successes[n] += 1 trials = len(timings) failures = computeFailures(successes, trials) counts = [successes, failures] return x, statistics.countStatistic(counts)
def readCounts(config_parser, section): counts = readMatrix(config_parser, section, 'counts', float) return statistics.countStatistic(counts)