def main(): parser = OptionParser(usage="usage: python %prog [options] file_name ...") parser.add_option("-c", "--cutoff", type="float", default=6.05, metavar="FLOAT", help="maximum sin(theta)/lambda") (options, args) = parser.parse_args() if len(args) < 1: parser.print_help() return cutoff = options.cutoff for file_name in args: tab = read_table(file_name) if tab.element == "Es": continue wk = xray_scattering.wk1995(tab.element, True).fetch() sel = tab.x <= cutoff tab_x = tab.x.select(sel) tab_y = tab.y.select(sel) sigmas = flex.double(tab_x.size(), 0.0005) wky = wk.at_x(tab_x) errors_abs = flex.abs(wky - tab_y) fit = scitbx.math.gaussian.fit(tab_x, tab_y, sigmas, wk) errors_rel = fit.significant_relative_errors(1.0e-6) print tab.element, tab.atomic_number, print "max error < %.1fA-1 abs, rel: %7.4f %7.4f" % (cutoff, flex.max(errors_abs), flex.max(errors_rel)) for x, y, f, ea, er in zip(tab_x, tab_y, wky, errors_abs, errors_rel): print "%7.4f %7.4f %7.4f %7.4f %7.4f" % (x, y, f, ea, er) print
def main(): parser = OptionParser(usage="usage: python %prog [options] file_name ...") parser.add_option("-c", "--cutoff", type="float", default=6.05, metavar="FLOAT", help="maximum sin(theta)/lambda") (options, args) = parser.parse_args() if (len(args) < 1): parser.print_help() return cutoff = options.cutoff for file_name in args: tab = read_table(file_name) if (tab.element == "Es"): continue wk = xray_scattering.wk1995(tab.element, True).fetch() sel = tab.x <= cutoff tab_x = tab.x.select(sel) tab_y = tab.y.select(sel) sigmas = flex.double(tab_x.size(), 0.0005) wky = wk.at_x(tab_x) errors_abs = flex.abs(wky - tab_y) fit = scitbx.math.gaussian.fit(tab_x, tab_y, sigmas, wk) errors_rel = fit.significant_relative_errors(1.e-6) print(tab.element, tab.atomic_number, end=' ') print("max error < %.1fA-1 abs, rel: %7.4f %7.4f" % (cutoff, flex.max(errors_abs), flex.max(errors_rel))) for x, y, f, ea, er in zip(tab_x, tab_y, wky, errors_abs, errors_rel): print("%7.4f %7.4f %7.4f %7.4f %7.4f" % (x, y, f, ea, er)) print()
def main(): parser = OptionParser( usage="usage: python %prog file_name [n_chunks,i_chunk] [scatterer...]") parser.add_option("-v", "--verbose", action="store_true", default=0, help="show comparison table for each element") parser.add_option("-c", "--cutoff", type="float", default=6, metavar="FLOAT", help="maximum sin(theta)/lambda") parser.add_option("-n", "--max_n_terms", type="int", default=5, metavar="INT", help="maximum number of Gaussian terms") parser.add_option("-s", "--six_term", action="store_true", default=0, help="fit six-term Gaussians using Golay based starts") (options, args) = parser.parse_args() if (len(args) < 1): parser.print_help() return run_and_time( args=args, cutoff=options.cutoff, max_n_terms=options.max_n_terms, six_term=options.six_term, verbose=options.verbose)
def main(): parser = OptionParser( usage="usage: python %prog [options] itvc_table kissel_files ...") parser.add_option("-c", "--cutoff", type="float", default=6, metavar="FLOAT", help="maximum sin(theta)/lambda") parser.add_option("-g", "--high_resolution_only", action="store_true", default=0, help="analyze points beyond sin(theta)/lambda=2A-1 only") (options, args) = parser.parse_args() if (len(args) < 2): parser.print_help() return run( args=args, cutoff=options.cutoff, high_resolution_only=options.high_resolution_only)
def main(): parser = OptionParser( usage="usage: python %prog [options] itvc_table kissel_files ...") parser.add_option("-c", "--cutoff", type="float", default=6, metavar="FLOAT", help="maximum sin(theta)/lambda") parser.add_option("-g", "--high_resolution_only", action="store_true", default=0, help="analyze points beyond sin(theta)/lambda=2A-1 only") (options, args) = parser.parse_args() if (len(args) < 2): parser.print_help() return run( args=args, cutoff=options.cutoff, high_resolution_only=options.high_resolution_only)
def setup_parser(): parser = OptionParser( prog="phenix.perigee", version=""" up-to-date version """, usage=""" phenix.perigee pdb_file_name=pdb3a37.ent """, ) # Input options parser.add_option("", "--show_defaults", dest="show_defaults", default=False, action="store_true", help="Display defaults", ) return parser
def run(http_server_name=None, html_subdir="asu_gallery"): parser = OptionParser( usage="usage: python jv_asu.py [options] [numbers...]") parser.add_option("-s", "--server", action="store", type="string", help="network name of http server", metavar="NAME") parser.add_option("-p", "--plane_group", action="store_true") options, args = parser.parse_args() if (options.server is not None): http_server_name = options.server if (not os.path.isdir(html_subdir)): os.makedirs(html_subdir) jv_index.write_html(open("%s/index.html" % html_subdir, "w")) guide_to_notation.write_html( open("%s/guide_to_notation.html" % html_subdir, "w")) if (len(args) == 0): if (options.plane_group): args = ["1-17"] else: args = ["1-230"] for arg in args: numbers = [int(n) for n in arg.split('-')] assert len(numbers) in (1, 2) if (len(numbers) == 1): numbers *= 2 for group_type_number in xrange(numbers[0], numbers[1] + 1): if (options.plane_group): print "Plane group number:", group_type_number from cctbx.sgtbx.direct_space_asu import plane_group_reference_table asu = plane_group_reference_table.get_asu(group_type_number) group_type_number *= -1 else: print "Space group number:", group_type_number asu = reference_table.get_asu(group_type_number) for colored_grid_points in [None, []]: asu_as_jvx(group_type_number=group_type_number, asu=asu, colored_grid_points=colored_grid_points, http_server_name=http_server_name, html_subdir=html_subdir)
def setup_parser(): parser = OptionParser( prog="phenix.perigee", version=""" up-to-date version """, usage=""" phenix.perigee pdb_file_name=pdb3a37.ent """, ) # Input options parser.add_option( "", "--show_defaults", dest="show_defaults", default=False, action="store_true", help="Display defaults", ) return parser
def run(http_server_name=None, html_subdir="asu_gallery"): parser = OptionParser(usage="usage: python jv_asu.py [options] [numbers...]") parser.add_option( "-s", "--server", action="store", type="string", help="network name of http server", metavar="NAME" ) parser.add_option("-p", "--plane_group", action="store_true") options, args = parser.parse_args() if options.server is not None: http_server_name = options.server if not os.path.isdir(html_subdir): os.makedirs(html_subdir) jv_index.write_html(open("%s/index.html" % html_subdir, "w")) guide_to_notation.write_html(open("%s/guide_to_notation.html" % html_subdir, "w")) if len(args) == 0: if options.plane_group: args = ["1-17"] else: args = ["1-230"] for arg in args: numbers = [int(n) for n in arg.split("-")] assert len(numbers) in (1, 2) if len(numbers) == 1: numbers *= 2 for group_type_number in xrange(numbers[0], numbers[1] + 1): if options.plane_group: print "Plane group number:", group_type_number from cctbx.sgtbx.direct_space_asu import plane_group_reference_table asu = plane_group_reference_table.get_asu(group_type_number) group_type_number *= -1 else: print "Space group number:", group_type_number asu = reference_table.get_asu(group_type_number) for colored_grid_points in [None, []]: asu_as_jvx( group_type_number=group_type_number, asu=asu, colored_grid_points=colored_grid_points, http_server_name=http_server_name, html_subdir=html_subdir, )
def main(): parser = OptionParser(usage="usage: python %prog [options] file_name ...") parser.add_option("-t", "--itvc", action="store", metavar="FILE", help="file name for international tables data") parser.add_option("-k", "--kissel", action="store", metavar="DIRECTORY", help="directory name for Kissel data") parser.add_option("-c", "--cross_check", action="store_true", default=0, help="compare two quick_summary.pickle files") (options, args) = parser.parse_args() if (len(args) < 1): parser.print_help() return assert not (options.itvc and options.kissel) if (options.cross): assert len(args) == 2 if (not options.cross): run(gaussian_fit_pickle_file_names=args, itvc_file_name=options.itvc, kissel_dir=options.kissel) else: cross_check(args)
def main(): parser = OptionParser( usage="usage: python %prog [options] file_name ...") parser.add_option("-t", "--itvc", action="store", metavar="FILE", help="file name for international tables data") parser.add_option("-k", "--kissel", action="store", metavar="DIRECTORY", help="directory name for Kissel data") parser.add_option("-c", "--cross_check", action="store_true", default=0, help="compare two quick_summary.pickle files") (options, args) = parser.parse_args() if (len(args) < 1): parser.print_help() return assert not (options.itvc and options.kissel) if (options.cross): assert len(args) == 2 if (not options.cross): run( gaussian_fit_pickle_file_names=args, itvc_file_name=options.itvc, kissel_dir=options.kissel) else: cross_check(args)
def setup_parser(): usage = """ elbow.generate_all_chemical_component_restraint_files only_code=NAG """ parser = OptionParser( prog="elbow.generate_all_chemical_component_restraint_files", version=""" up-to-date version """, usage=usage, ) # Input options parser.add_option( "", "--show_defaults", dest="show_defaults", default=False, action="store_true", help="Display defaults", ) parser.add_option( "", "--dry-run", dest="dry_run", default=False, action="store_true", help="Display which residues will be processed", ) if 0: parser.add_option( "", "--verbose", dest="verbose", default=False, action="store_true", help="Verbose output", ) parser.add_option( "", "--silent", dest="silent", default=False, action="store_true", help="No output to screen", ) return parser
def setup_parser(): usage=""" elbow.generate_all_chemical_component_restraint_files only_code=NAG """ parser = OptionParser( prog="elbow.generate_all_chemical_component_restraint_files", version=""" up-to-date version """, usage=usage, ) # Input options parser.add_option("", "--show_defaults", dest="show_defaults", default=False, action="store_true", help="Display defaults", ) parser.add_option("", "--dry-run", dest="dry_run", default=False, action="store_true", help="Display which residues will be processed", ) if 0: parser.add_option("", "--verbose", dest="verbose", default=False, action="store_true", help="Verbose output", ) parser.add_option("", "--silent", dest="silent", default=False, action="store_true", help="No output to screen", ) return parser
def main(): parser = OptionParser( usage="usage: python %prog file_name [n_chunks,i_chunk] [scatterer...]" ) parser.add_option("-v", "--verbose", action="store_true", default=0, help="show comparison table for each element") parser.add_option("-c", "--cutoff", type="float", default=6, metavar="FLOAT", help="maximum sin(theta)/lambda") parser.add_option("-q", "--quick", action="store_true", default=0, help="quick mode for debugging") parser.add_option("-n", "--max_n_terms", type="int", default=5, metavar="INT", help="maximum number of Gaussian terms") parser.add_option("-e", "--max_max_error", type="float", default=0.01, metavar="FLOAT", help="max acceptable max_error") parser.add_option("-s", "--six_term", action="store_true", default=0, help="fit six-term Gaussians using Golay based starts") parser.add_option("-z", "--zig_zag", action="store_true", default=0, help="zig-zag fits starting from six-term Gaussians") parser.add_option("-r", "--full_fits", action="store", help="pickled six-term Gaussian fits") (options, args) = parser.parse_args() if (len(args) < 1): parser.print_help() return assert [options.six_term, options.zig_zag, options.full_fits ].count(True) < 2 if (options.full_fits is not None): full_fits = easy_pickle.load(options.full_fits) else: full_fits = None params = cctbx.eltbx.gaussian_fit.fit_parameters( max_n_terms=options.max_n_terms, max_max_error=options.max_max_error) if (options.quick): params = params.quick() run_and_time(file_name=args[0], args=args[1:], cutoff=options.cutoff, params=params, zig_zag=options.zig_zag, six_term=options.six_term, full_fits=full_fits, verbose=options.verbose)
def main(): parser = OptionParser( usage="usage: python %prog file_name [n_chunks,i_chunk] [scatterer...]") parser.add_option("-v", "--verbose", action="store_true", default=0, help="show comparison table for each element") parser.add_option("-c", "--cutoff", type="float", default=6, metavar="FLOAT", help="maximum sin(theta)/lambda") parser.add_option("-q", "--quick", action="store_true", default=0, help="quick mode for debugging") parser.add_option("-n", "--max_n_terms", type="int", default=5, metavar="INT", help="maximum number of Gaussian terms") parser.add_option("-e", "--max_max_error", type="float", default=0.01, metavar="FLOAT", help="max acceptable max_error") parser.add_option("-s", "--six_term", action="store_true", default=0, help="fit six-term Gaussians using Golay based starts") parser.add_option("-z", "--zig_zag", action="store_true", default=0, help="zig-zag fits starting from six-term Gaussians") parser.add_option("-r", "--full_fits", action="store", help="pickled six-term Gaussian fits") (options, args) = parser.parse_args() if (len(args) < 1): parser.print_help() return assert [options.six_term, options.zig_zag, options.full_fits].count(True) < 2 if (options.full_fits is not None): full_fits = easy_pickle.load(options.full_fits) else: full_fits = None params = cctbx.eltbx.gaussian_fit.fit_parameters( max_n_terms=options.max_n_terms, max_max_error=options.max_max_error) if (options.quick): params = params.quick() run_and_time( file_name=args[0], args=args[1:], cutoff=options.cutoff, params=params, zig_zag=options.zig_zag, six_term=options.six_term, full_fits=full_fits, verbose=options.verbose)
def main(): parser = OptionParser(usage="usage: python %prog [options] file_name") parser.add_option("-t", "--table", default="wk1995", action="store", dest="table_of_gaussians", help="wk1995 or it1992") parser.add_option("-q", "--quiet", action="store_true", default=0, help="do not show values for large errors, only stol") parser.add_option("-v", "--verbose", action="store_true", default=0, help="show comparison table for each element") parser.add_option("-l", "--low_resolution_only", action="store_true", default=0, help="analyze points up to sin(theta)/lambda=2A-1 only") parser.add_option("-g", "--high_resolution_only", action="store_true", default=0, help="analyze points beyond sin(theta)/lambda=2A-1 only") parser.add_option("-s", "--significant_errors_only", action="store_true", default=0, help="show errors greater than 1% only") (options, args) = parser.parse_args() if (len(args) != 1): parser.print_help() return assert options.table_of_gaussians in ["wk1995", "it1992"] if (options.table_of_gaussians == "wk1995"): table_of_gaussians = xray_scattering.wk1995 plots_dir = "itvc_wk1995_plots" cutoff = 6 else: table_of_gaussians = xray_scattering.it1992 plots_dir = "itvc_it1992_plots" cutoff = 2 assert not options.low_resolution_only assert not options.high_resolution_only print("table_of_gaussians:", options.table_of_gaussians) run(file_name=args[0], table_of_gaussians=table_of_gaussians, cutoff=cutoff, low_resolution_only=options.low_resolution_only, high_resolution_only=options.high_resolution_only, significant_errors_only=options.significant_errors_only, plots_dir=plots_dir, quiet=options.quiet, verbose=options.verbose)
def main(): parser = OptionParser(usage="usage: python %prog [options] file_name") parser.add_option( "-t", "--table", default="wk1995", action="store", dest="table_of_gaussians", help="wk1995 or it1992" ) parser.add_option( "-q", "--quiet", action="store_true", default=0, help="do not show values for large errors, only stol" ) parser.add_option("-v", "--verbose", action="store_true", default=0, help="show comparison table for each element") parser.add_option( "-l", "--low_resolution_only", action="store_true", default=0, help="analyze points up to sin(theta)/lambda=2A-1 only", ) parser.add_option( "-g", "--high_resolution_only", action="store_true", default=0, help="analyze points beyond sin(theta)/lambda=2A-1 only", ) parser.add_option( "-s", "--significant_errors_only", action="store_true", default=0, help="show errors greater than 1% only" ) (options, args) = parser.parse_args() if len(args) != 1: parser.print_help() return assert options.table_of_gaussians in ["wk1995", "it1992"] if options.table_of_gaussians == "wk1995": table_of_gaussians = xray_scattering.wk1995 plots_dir = "itvc_wk1995_plots" cutoff = 6 else: table_of_gaussians = xray_scattering.it1992 plots_dir = "itvc_it1992_plots" cutoff = 2 assert not options.low_resolution_only assert not options.high_resolution_only print "table_of_gaussians:", options.table_of_gaussians run( file_name=args[0], table_of_gaussians=table_of_gaussians, cutoff=cutoff, low_resolution_only=options.low_resolution_only, high_resolution_only=options.high_resolution_only, significant_errors_only=options.significant_errors_only, plots_dir=plots_dir, quiet=options.quiet, verbose=options.verbose, )