if not input_files: print 'Missing input file(s).\n' optparser.print_usage() exit(1) if not (options.labels_file or options.places_file or options.registrations_file): print 'Missing output file(s): labels, place points, or registration points.\n' optparser.print_usage() exit(1) # # Load places. # places = Places(bool(options.dump_file)) for place in options.load_inputs(input_files, geometry, options.name_field, options.placement_field): places.add(place) # # Do the annealing. # annealer = Annealer(lambda p: p.energy, lambda p: p.move()) if options.temp_min and options.temp_max and options.steps: annealed, e = annealer.anneal(places, options.temp_max, options.temp_min, options.steps, 30) else: annealed = [None] * places.count()
if not input_files: print 'Missing input file(s).\n' optparser.print_usage() exit(1) if not (options.labels_file or options.places_file or options.registrations_file): print 'Missing output file(s): labels, place points, or registration points.\n' optparser.print_usage() exit(1) # # Load places. # places = Places(bool(options.dump_file)) for place in load_places(input_files, geometry, options.name_field): places.add(place) def state_energy(places): return places.energy def state_move(places): places.move() try: annealer = Annealer(state_energy, state_move) if options.temp_min and options.temp_max and options.steps: places, e = annealer.anneal(places, options.temp_max, options.temp_min, options.steps, 30)
if __name__ == '__main__': options, input_files = optparser.parse_args() if not input_files: print 'Missing input file(s).\n' optparser.print_usage() exit(1) elif not (options.labels_file or options.places_file or options.registrations_file): print 'Missing output file(s): labels, place points, or registration points.\n' optparser.print_usage() exit(1) places = Places(bool(options.dump_file)) for place in load_places(input_files, options.zoom): places.add(place) def state_energy(places): return places.energy def state_move(places): places.move() try: annealer = Annealer(state_energy, state_move) if options.temp_min and options.temp_max and options.steps: places, e = annealer.anneal(places, options.temp_max,
if not input_files: logging.critical('Missing input file(s).') optparser.print_usage() exit(1) if not (options.labels_file or options.places_file or options.registrations_file): logging.critical('Missing output file(s): labels, place points, or registration points.') optparser.print_usage() exit(1) # # Load places. # places = Places(bool(options.dump_file)) for place in options.load_inputs(input_files, geometry, options.name_field, options.placement_field): places.add(place) # # Do the annealing. # annealer = Annealer(lambda p: p.energy, lambda p: p.move()) if places.count() == 0: # looks like there's nothing to actually do. annealed = [] elif options.temp_min and options.temp_max and options.steps:
optparser.print_usage() exit(1) if not (options.labels_file or options.places_file or options.registrations_file): logging.critical( 'Missing output file(s): labels, place points, or registration points.' ) optparser.print_usage() exit(1) # # Load places. # places = Places(bool(options.dump_file)) for place in options.load_inputs(input_files, geometry, options.name_field, options.placement_field): places.add(place) # # Do the annealing. # annealer = Annealer(lambda p: p.energy, lambda p: p.move()) if places.count() == 0: # looks like there's nothing to actually do. annealed = []