print mean(sqrt(diffxs**2 + diffys**2)) if opts.map2: xds, yds = mapping2(goodxs, goodys) goodxs += xds/opts.pxsize goodys += yds/opts.pxsize diffxs = (xls[sel] - goodxs) * opts.pxsize diffys = (yls[sel] - goodys) * opts.pxsize print "In the second round, those colocalized at an error of", print mean(sqrt(diffxs**2 + diffys**2)) else: if opts.save_map2 \ or raw_input('Save Second Pass? y/[n]').lower()[0] == 'y': Analysis.makeLSQspline(diffxs, diffys, goodxs, goodys, savefile= 'offsets'+os.path.basename(fname), n = floor(max(2,sqrt(len(goodys)/10)))) if len(goodxs): goodxf = [goodxs[0]] goodyf = [goodys[0]] diffxf = [diffxs[0]] diffyf = [diffys[0]] print "Selecting low density..." for goodx, goody, diffx, diffy in zip(goodxs, goodys, diffxs, diffys): if min(sqrt((goodx - array(goodxf))**2 + (goody - array(goodyf))**2)) > opts.quiv_dist: goodxf.append(goodx) goodyf.append(goody) diffxf.append(diffx)
else: xl = xld[sel] yl = yld[sel] xr = xrd[sel] yr = yrd[sel] if opts.interact: from IPython.Shell import IPShellEmbed ipshell = IPShellEmbed([], banner="\a\a\aEntering Interpreter") print "\a\a\a" ipshell() ############################## Make the Spline ####################### # print "Splining!" mapping = Analysis.makeLSQspline(xl, yl, xr, yr, n=opts.n, savefile=fname + "_1", multi=opts.multi) ############################## Evaluate spline quality ############### # print "applying on all good data" xn, yn = mapping(xrd[sel], yrd[sel]) diffx = xld[sel] - xn diffy = yld[sel] - yn diffmag = sqrt(diffx ** 2 + diffy ** 2) diffmags = sorted(diffmag) print "Median: ", median(diffmag), "1%", diffmags[int(0.01 * len(diffmags))], "5%", diffmags[ int(0.05 * len(diffmags)) ], "10%", diffmags[int(0.10 * len(diffmags))], "20%", diffmags[int(0.20 * len(diffmags))], "30%", diffmags[ int(0.30 * len(diffmags)) ], "40%", diffmags[ int(0.40 * len(diffmags)) ], "60%", diffmags[