Exemplo n.º 1
0
def dp_dist_fps(config, parser): #@UnusedVariable
    """ Computation speed statistics for distances. """
    parser.add_option("-d", "--distances", default='*',
                      help="Comma-separated list of distances. Can use *.")
    
    parser.add_option("-t", "--testcases", default='*',
                       help="Comma-separated list of algorithms. Can use *.")

    parser.add_option("-r", "--repeat", default=1, type='int',
                       help="Repeat many times.")
 
    options = parser.parse_options()
    
    distances = config.distances.expand_names(options.distances)
    testcases = config.testcases.expand_names(options.testcases)

    logger.info('Using distances: %s' % distances)
    logger.info('Using testcases: %s' % testcases)
    
    testcases = map(config.testcases.instance, testcases)
    
    for id_distance in distances:    
        dist = config.distances.instance(id_distance)
        
        fps = InAWhile()
        for _ in range(options.repeat):
            for tc in testcases: 
                fps.its_time()
                result = dist.distance(tc.y0, tc.y1)
                print('%s / %s: %s (%s)' % (id_distance, tc.id_tc, result, tc.true_plan))
        print('frames per second: %s' % fps.fps())
Exemplo n.º 2
0
def measure_fps():
    n = 100
    for id_data, id_algo in itertools.product(data, algos):
        v = data[id_data]
        algo = algos[id_algo]
    
        count = InAWhile()
        for _ in xrange(n):
            algo(v)
            count.its_time()
        
        fps = count.fps()
        print('%s-%15s: %s' % (id_data, id_algo, fps))
def diffeo_quick1(id_dd, dd):  # @UnusedVariable
    M, N = dd.shape[0], dd.shape[1]
    template = np.random.rand(M, N)

    fda = FastDiffeoApply(dd)

    functions = dict(regular=lambda: diffeo_apply(dd, template),
                     fast=lambda: fda(template))

    repeat = 100
    for name, function in functions.items():
        fps = InAWhile()
        for _ in range(repeat):
            fps.its_time()
            _ = function()
        print('%s: %s fps' % (name, fps.fps()))
def diffeo_quick1(id_dd, dd):  # @UnusedVariable
    M, N = dd.shape[0], dd.shape[1]
    template = np.random.rand(M, N)

    fda = FastDiffeoApply(dd)
    
    functions = dict(regular=lambda: diffeo_apply(dd, template),
                     fast=lambda: fda(template))

    repeat = 100
    for name, function in functions.items():
        fps = InAWhile()
        for _ in range(repeat):
            fps.its_time()
            _ = function()
        print('%s: %s fps' % (name, fps.fps()))
Exemplo n.º 5
0
def dp_dist_fps(config, parser):  #@UnusedVariable
    """ Computation speed statistics for distances. """
    parser.add_option("-d",
                      "--distances",
                      default='*',
                      help="Comma-separated list of distances. Can use *.")

    parser.add_option("-t",
                      "--testcases",
                      default='*',
                      help="Comma-separated list of algorithms. Can use *.")

    parser.add_option("-r",
                      "--repeat",
                      default=1,
                      type='int',
                      help="Repeat many times.")

    options = parser.parse_options()

    distances = config.distances.expand_names(options.distances)
    testcases = config.testcases.expand_names(options.testcases)

    logger.info('Using distances: %s' % distances)
    logger.info('Using testcases: %s' % testcases)

    testcases = map(config.testcases.instance, testcases)

    for id_distance in distances:
        dist = config.distances.instance(id_distance)

        fps = InAWhile()
        for _ in range(options.repeat):
            for tc in testcases:
                fps.its_time()
                result = dist.distance(tc.y0, tc.y1)
                print('%s / %s: %s (%s)' %
                      (id_distance, tc.id_tc, result, tc.true_plan))
        print('frames per second: %s' % fps.fps())