def main(): if sys.platform.startswith('win'): # Hack for multiprocessing.freeze_support() to work from a # setuptools-generated entry point. if __name__ != "__main__": sys.modules["__main__"] = sys.modules[__name__] multiprocessing.freeze_support() if len(sys.argv) == 1: sys.argv.append('-h') p = argparse.ArgumentParser( description='High energy diffraction data analysis') p.add_argument( "--debug", action="store_true", help='verbose reporting', ) p.add_argument( "--inst-profile", action="append", help='use the following files as source for functions to instrument', ) sub_parsers = p.add_subparsers( metavar='command', dest='cmd', ) help.configure_parser(sub_parsers) test.configure_parser(sub_parsers) documentation.configure_parser(sub_parsers) find_orientations.configure_parser(sub_parsers) fit_grains.configure_parser(sub_parsers) gui.configure_parser(sub_parsers) pickle23.configure_parser(sub_parsers) try: import argcomplete argcomplete.autocomplete(p) except ImportError: pass args = p.parse_args() log_level = logging.DEBUG if args.debug else logging.INFO logger = logging.getLogger('hexrd') ch = logging.StreamHandler() ch.setLevel(log_level) if args.inst_profile: profiler.instrument_all(args.inst_profile) args.func(args, p) if args.inst_profile: profiler.dump_results(args.inst_profile)
def main(args): # if there are arguments, try to load them as profile config if args: profiler.instrument_all(args) run_with_impl(compute_areas_3) run_with_impl(compute_areas_2) run_with_impl(compute_areas_3) run_with_impl(compute_areas_2) run_with_impl(compute_areas_3) run_with_impl(compute_areas_2) run_with_impl(compute_areas) if args: profiler.dump_results(args)
result_handler = forgetful_result_handler() controller = ProcessController(result_handler, progress_handler, ncpus=args.ncpus, chunk_size=args.chunk_size) if args.limit is not None: controller.set_limit('coords', lambda x: min(x, args.limit)) return controller if __name__ == '__main__': FORMAT = "%(relativeCreated)12d [%(process)6d/%(thread)6d] %(levelname)8s: %(message)s" logging.basicConfig(level=logging.NOTSET, format=FORMAT) args = parse_args() if len(args.inst_profile) > 0: from hexrd.utils import profiler logging.debug("Instrumenting functions") profiler.instrument_all(args.inst_profile) controller = build_controller(args) main(args, controller) del controller if len(args.inst_profile) > 0: logging.debug("Dumping profiler results") profiler.dump_results(args.inst_profile)
result_handler = forgetful_result_handler() controller = ProcessController(result_handler, progress_handler, ncpus=args.ncpus, chunk_size=args.chunk_size) if args.limit is not None: controller.set_limit('coords', lambda x: min(x, args.limit)) return controller if __name__=='__main__': FORMAT="%(relativeCreated)12d [%(process)6d/%(thread)6d] %(levelname)8s: %(message)s" logging.basicConfig(level=logging.NOTSET, format=FORMAT) args= parse_args() if len(args.inst_profile) > 0: from hexrd.utils import profiler logging.debug("Instrumenting functions") profiler.instrument_all(args.inst_profile) controller = build_controller(args) main(args, controller) del controller if len(args.inst_profile) > 0: logging.debug("Dumping profiler results") profiler.dump_results(args.inst_profile)
def main(): if sys.platform.startswith('win'): # Hack for multiprocessing.freeze_support() to work from a # setuptools-generated entry point. if __name__ != "__main__": sys.modules["__main__"] = sys.modules[__name__] multiprocessing.freeze_support() if len(sys.argv) == 1: sys.argv.append('-h') import hexrd p = argparse.ArgumentParser( description='High energy diffraction data analysis' ) p.add_argument( '-V', '--version', action = 'version', version = 'hexrd %s' % hexrd.__version__, ) p.add_argument( "--debug", action = "store_true", help = 'verbose reporting', ) p.add_argument( "--inst-profile", action="append", help='use the following files as source for functions to instrument', ) sub_parsers = p.add_subparsers( metavar = 'command', dest = 'cmd', ) help.configure_parser(sub_parsers) documentation.configure_parser(sub_parsers) gui.configure_parser(sub_parsers) findorientations.configure_parser(sub_parsers) fitgrains.configure_parser(sub_parsers) cacheframes.configure_parser(sub_parsers) test.configure_parser(sub_parsers) cakedata.configure_parser(sub_parsers) try: import argcomplete argcomplete.autocomplete(p) except ImportError: pass args = p.parse_args() log_level = logging.DEBUG if args.debug else logging.INFO logger = logging.getLogger('hexrd') ch = logging.StreamHandler() ch.setLevel(log_level) if args.inst_profile: profiler.instrument_all(args.inst_profile) args.func(args, p) if args.inst_profile: profiler.dump_results(args.inst_profile)
# perform check indices = _quant_and_clip(det_xy, angles[:, 2], base, inv_deltas, clip_vals) col_indices = indices[:, 0] row_indices = indices[:, 1] frame_indices = indices[:, 2] confidence[igrn, icrd] = _confidence_check(image_stack, frame_indices, row_indices, col_indices, row_dilation, col_dilation) pass pbar.update(icrd + 1) pass pbar.finish() def main(): image_stack = get_simulate_diffractions(grain_params) test_orientations(image_stack) if __name__ == '__main__': if len(sys.argv) > 1: profiler.instrument_all(sys.argv[1:]) main() if len(sys.argv) > 0: profiler.dump_results(sys.argv[1:])
# frame_indices = gridutil.cellIndices(ome_edges, all_angles[igrn][onDetector, 2]) # perform check indices = _quant_and_clip(det_xy, angles[: , 2], base, inv_deltas, clip_vals) col_indices = indices[:, 0] row_indices = indices[:, 1] frame_indices = indices[:, 2] confidence[igrn, icrd] = _confidence_check(image_stack, frame_indices, row_indices, col_indices, row_dilation, col_dilation) pass pbar.update(icrd + 1) pass pbar.finish() def main(): image_stack = get_simulate_diffractions(grain_params) test_orientations(image_stack) if __name__=='__main__': if len(sys.argv) > 1: profiler.instrument_all(sys.argv[1:]) main() if len(sys.argv) > 0: profiler.dump_results(sys.argv[1:])