help = "Maximum allowed inter-color colocalization distance", default = 100, type = "float") parser.add_option('-q', '--quiet', dest = "quiet", action = "store_true", default = False) parser.add_option('-d', '--quiver-distance', dest="quiv_dist", help = "Minimum distance between points on the quiver map", default = 10) opts, args = parser.parse_args() if not opts.map: if opts.x1 and opts.x2 and opts.y1 and opts.y2: opts.xshift = opts.x2 - opts.x1 opts.yshift = opts.y2 - opts.y1 else: mapping = Analysis.loadmapping(opts.map) if opts.map2: mapping2 = Analysis.loadmapping(opts.map2) if len(args) == 1 and '*' in args[0]: args = glob(args[0]) print "Found this many files", len(args) xrs = [] xls = [] yrs = [] yls = [] varxrs = [] varxls = [] for fname in args:
import Analysis, sys, math, numpy as np, pylab mapping = Analysis.loadmapping(sys.argv[1]) num_rows = 256 num_cols = 512 colors = np.zeros((256,512,3)) starty = np.random.rand(1,100)*150 + 50 startx = np.random.rand(1,100)*400 + 50 endx, endy = mapping(startx, starty) base_shift_x = 256 # (endx - startx).mean() base_shift_y = 512 # (endy - starty).mean() for x in range(num_cols): for y in range(num_rows): newx, newy = mapping(x,y) sat = 1 hue = (90 + 180 / math.pi * math.atan2(newy - base_shift_y, newx - base_shift_x)) % 360 val = min(.001 * math.sqrt((newy - base_shift_y)**2 + (newx - base_shift_x)**2), 1) hueprm = hue / 60 C = val * sat X = C * (1 - abs((hueprm %2) -1 )) if hueprm < 1: r1, g1, b1 = C, X, 0 elif hueprm < 2: r1, g1, b1 = X, C, 0 elif hueprm < 3: r1, g1, b1 = X, C, 0