示例#1
0
def LogicleOp(data, indices, inputs):
    m = inputs['M'] * log(10) # convert from log10 to log
    for i in indices:
        d = data[:, i]
        r = quantile(d[d<0], inputs['r'])
        data[:, i] = logicle(data[:, i], inputs['T'], m, r)
示例#2
0
    xx = exp(arange(0, ub, ub/intervals))-1+min(x)
    yy = biex0(xx, a, b, c, d, f)
    t = interpolate.splrep(xx, yy, k=order)
    return interpolate.splev(x, t)

if __name__ == '__main__':
    import pylab

    d1 = normal(0, 50, (50000))
    d2 = lognormal(8, 1, (50000))
    d3 = concatenate([d1, d2])

    T = 262144
    d = 4
    m = d*log(10)
    r = quantile(d3[d3<0], 0.05)
    w = (m-log(T/abs(r)))/2

    pylab.clf()
    pylab.figtext(0.5, 0.94, 'Logicle transform with r=%.2f, d=%d and T=%d\nData is normal(0, 50, 50000) + lognormal(8, 1, 50000)' % (r, d, T),
                  va='center', ha='center', fontsize=12)

    pylab.subplot(3,1,1)
    x = arange(0, m, 0.1)
    pylab.plot(x, S(x, 0, T, m, w))
    locs, labs = pylab.xticks()
    pylab.xticks([])
    pylab.yticks([])
    pylab.ylabel('Inverse logicle')

    pylab.subplot(3,1,2)