xyz = np.column_stack((x.ravel(), y.ravel(), z.ravel())) pdb = saxs.PDB(superargs.ref) if superargs.center: pdb.coords -= pdb.coords.mean(axis=0) refrho = saxs.pdb2map_gauss(pdb, xyz=xyz, sigma=superargs.resolution) refrho = refrho * np.sum(allrhos[0]) / np.sum(refrho) if superargs.ref.endswith('.mrc'): refrho, refside = saxs.read_mrc(superargs.ref) if superargs.enan: print() print(" Selecting best enantiomers...") try: allrhos, scores = saxs.select_best_enantiomers( allrhos, cores=superargs.cores) except KeyboardInterrupt: sys.exit(1) if superargs.ref is None: print() print(" Generating reference...") try: refrho = saxs.binary_average(allrhos, superargs.cores) saxs.write_mrc(refrho, sides[0], output + "_reference.mrc") except KeyboardInterrupt: sys.exit(1) print() print(" Aligning all maps to reference...") try:
sigma=args.resolution, r=args.resolution * 2) refrho = refrho * np.sum(allrhos[0]) / np.sum(refrho) saxs.write_mrc(refrho, sides[0], filename=refbasename + '_pdb.mrc') if args.ref.endswith('.mrc'): refrho, refside = saxs.read_mrc(args.ref) if (not args.ref.endswith('.mrc')) and (not args.ref.endswith('.pdb')): print( "Invalid reference filename given. .mrc or .pdb file required") sys.exit(1) if args.enan: print(" Selecting best enantiomer(s)...") try: if args.ref: allrhos, scores = saxs.select_best_enantiomers( allrhos, refrho=refrho, cores=args.cores) else: allrhos, scores = saxs.select_best_enantiomers( allrhos, refrho=allrhos[0], cores=args.cores) except KeyboardInterrupt: sys.exit(1) print(" Aligning to reference...") try: aligned, scores = saxs.align_multiple(refrho, allrhos, args.cores) except KeyboardInterrupt: sys.exit(1) for i in range(nmaps): basename, ext = os.path.splitext(args.files[i]) output = basename + "_aligned"