Exemple #1
0
def main():
    (options, args) = parse_command_line()

    LOGbegin(sys.argv)

    map1 = EMAN.EMData()
    map1.readImage(args[0])

    map2 = EMAN.EMData()
    map2.readImage(args[1])
    map2t = map2.copy()

    print "Start searching the scale factor in range [%g, %g]" % (options.scale_min, options.scale_max)
    scale = brent(matching_score, brack=[options.scale_min, options.scale_max], args=(map1, map2t))
    print "Final result: scale = %g" % (scale)
    if options.save_map or options.save_fsc:
        map2.setTAlign(0, 0, 0)
        map2.setRAlign(0, 0, 0)
        map2.rotateAndTranslate(scale)
        if options.save_map:
            map2.writeImage(options.save_map)
            print "Final transformed map2 is saved to %s" % (options.save_map)
        if options.save_fsc:
            fsc = map1.fsc(map2)
            if options.apix:
                EMAN.save_data(0, 1.0 / (options.apix * 2.0 * len(fsc)), fsc, len(fsc), options.save_fsc)
            else:
                EMAN.save_data(0, 1.0, fsc, len(fsc), options.save_fsc)
            print "Final Fourier Shell Correlation curve is saved to %s" % (options.save_fsc)

    LOGend()