示例#1
0
文件: pwrmap_img.py 项目: ufwt/icfuzz
    valsl = mk_valsl()

    # take log
    if 0:
        mval = min(valsl) - 0.0001
        print 'Min: %f' % mval
        # Prevent negative current issues
        valsl = [math.log(x - mval) for x in valsl]

    # Limit numbers that are more than a few std dev away
    # this messes up way that hist eq currently works
    # although not entirely sure why
    # helped a lot
    if 1:
        print valsl[0:10]
        sd = statistics.stdev(valsl)
        u = statistics.mean(valsl)
        sds = 2
        print 'Mean: %f' % u
        print 'SD: %f' % sd
        keep_min = u - sd * sds
        keep_max = u + sd * sds
        print 'Keeping'
        print '  Min: %f' % keep_min
        print '  Max: %f' % keep_max
        valsl = [min(keep_max, x) for x in valsl]
        valsl = [max(keep_min, x) for x in valsl]

    if 1:
        print 'Equalizing...'
        valsl = histeq(valsl)
示例#2
0
                    break
            # Account for second derrivitive
            val = opened[i + 2] - opened[0]
        
        valsl.append(val)

    print 'Cols: %d' % cols
    print 'Rows: %d' % rows

    # Limit numbers that are more than a few std dev away
    # this messes up way that hist eq currently works
    # although not entirely sure why
    # helped a lot
    if 1:
        print valsl[0:10]
        sd = statistics.stdev(valsl)
        u = statistics.mean(valsl)
        sds = 2
        print 'Mean: %f' % u
        print 'SD: %f' % sd
        keep_min = u - sd * sds
        keep_max = u + sd * sds
        print 'Keeping'
        print '  Min: %f' % keep_min
        print '  Max: %f' % keep_max
        valsl = [min(keep_max, x) for x in valsl]
        valsl = [max(keep_min, x) for x in valsl]

    if 0:
        print 'Equalizing...'
        valsl = histeq(valsl)
示例#3
0
    while True:
        this = gp.get()
        ig, a, b = this
        
        igstr = gp307.fmt(ig)
        astr = gp307.fmt(a)
        bstr = gp307.fmt(b)
        
        t = time.time()
        print '%s: IG %s, A %s, B %s' % (time.strftime('%F %T'), igstr, astr, bstr)
        
        if args.diff and lasts:
            last = lasts[0]
            diff = [x - y for x, y in zip(this, last)]
            print '    D IG %s, A %s, B %s' % (fmts(diff[0]), fmts(diff[1]), fmts(diff[2]))
        
        if f:
            f.write('%s, %s, %s, %s\n' % (t, igstr, astr, bstr))
            f.flush()
    
        lasts = [this] + lasts[0:args.trend_n - 1]

        if args.stat and len(lasts) > 1:
            s = ''
            for chan in zip(*lasts):
                chanl = [math.log(x, 10) for x in chan]
                sd = statistics.stdev(chanl)
                u = statistics.mean(chanl)
                s += '(%s, %s) ' % (fmte(u), fmte(sd))
            print '    % 3u %s' % (len(lasts), s)
示例#4
0
        ig, a, b = this

        igstr = gp307.fmt(ig)
        astr = gp307.fmt(a)
        bstr = gp307.fmt(b)

        t = time.time()
        print '%s: IG %s, A %s, B %s' % (time.strftime('%F %T'), igstr, astr,
                                         bstr)

        if args.diff and lasts:
            last = lasts[0]
            diff = [x - y for x, y in zip(this, last)]
            print '    D IG %s, A %s, B %s' % (fmts(diff[0]), fmts(
                diff[1]), fmts(diff[2]))

        if f:
            f.write('%s, %s, %s, %s\n' % (t, igstr, astr, bstr))
            f.flush()

        lasts = [this] + lasts[0:args.trend_n - 1]

        if args.stat and len(lasts) > 1:
            s = ''
            for chan in zip(*lasts):
                chanl = [math.log(x, 10) for x in chan]
                sd = statistics.stdev(chanl)
                u = statistics.mean(chanl)
                s += '(%s, %s) ' % (fmte(u), fmte(sd))
            print '    % 3u %s' % (len(lasts), s)