def histo_0(data, range = (0.0, 1.0, 10)): min = range[0] max = range[1] nstep = range[2] xstep = (max - min)/nstep histogram = [0.0] * (nstep + 1) histx = [0.0] * (nstep + 1) for i in xrange(nstep + 1): histx[i] = float(min + i * xstep) for x in data: i = int((x + min)/xstep) if i > nstep: i = nstep elif i < 0: i = 0 histogram[i] += 1.0 return (histx, histogram) def histo(data, min = 0.0, max = 1.0, nstep = 10): xstep = (max - min)/nstep histogram = [0.0] * (nstep + 1) histx = [0.0] * (nstep + 1) for i in xrange(nstep + 1): histx[i] = float(min + i * xstep) for x in data: i = int((x - min)/xstep + 0.5) if 0 <= i <= nstep: histogram[i] += 1.0 return histx, histogram def histo2pdf((histx, histogram)): step = float(histx[1] - histx[0]) total = 0.0 distr = [] for x in histogram: total += x for x in histogram: distr.append(x/(total * step)) return histx, distr def argcheck(): return (1,2,3), (4,5,6) # #def BLER(time_seq): # for i in xrange(len(time_seq)):