示例#1
0
文件: transforms.py 项目: whitews/fcm
def _logicle(y, T=262144, m=4.5, r=None, w=0.5, a=0):
    y = array(y, dtype='double')
    if w is None:  # we need an r then...
        if r == 0:
            w = 1  # don't like this but it works... FIX!
        else:
            w = (m - log10(T / abs(r))) / 2.0

    clogicle.logicle_scale(T, w, m, a, y)
    return y
示例#2
0
文件: transforms.py 项目: whitews/fcm
def _logicle(y, T=262144, m=4.5, r=None, w=0.5, a=0):
    y = array(y, dtype='double')
    if w is None: # we need an r then...
        if r == 0:
            w = 1 # don't like this but it works... FIX!
        else:
            w = (m - log10(T / abs(r))) / 2.0

    clogicle.logicle_scale(T, w, m, a, y)
    return y
示例#3
0
def _logicle(y, T, m, r, w):
    y = array(y, dtype='double')
    if w is None:
        if r == 0:
            w = 1  # don't like this but it works... FIX!
        else:
            w = (m - log10(T / abs(r))) / 2.0

    clogicle.logicle_scale(T, w, m, 0, y)
    return y
示例#4
0
文件: transforms.py 项目: whitews/fcm
    d3 = concatenate([d1, d2])

    T = 262144
    d = 4
    #m = d*log(10)
    m = 4.5
    print m
    r = quantile(d3[d3 < 0], 0.05)
    w = (m - log(T / abs(r))) / 2
    w = (m - numpy.log10(T / numpy.abs(r))) / 2.0
    #if (w<0):
    #w = .5
    print w
    print _logicle([0, T], T, m, r)
    n = array([0, T], dtype='double')
    clogicle.logicle_scale(T, w, 4.5, 0, n)
    print n
    lmin, lmax = _logicle([0, T], T, m, r)
    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(4, 1, 1)
    x = arange(0, m, 0.1)
    pylab.plot(x, S(x, 0, T, m, w))
示例#5
0
文件: transforms.py 项目: whitews/fcm
    d3 = concatenate([d1, d2])

    T = 262144
    d = 4
    #m = d*log(10)
    m = 4.5
    print m
    r = quantile(d3[d3 < 0], 0.05)
    w = (m - log(T / abs(r))) / 2
    w = (m - numpy.log10(T / numpy.abs(r))) / 2.0
    #if (w<0):
    #w = .5
    print w
    print _logicle([0, T], T, m, r)
    n = array([0, T], dtype='double')
    clogicle.logicle_scale(T, w, 4.5, 0, n)
    print n
    lmin, lmax = _logicle([0, T], T, m, r)
    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(4, 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(4, 1, 2)