Ejemplo n.º 1
0
    df["oversample"] = params.simulator.oversample
    if params.opt_det is not None:
        df["opt_det"] = params.opt_det
    df["stage1_refls"] = stg1_refls
    df["stage1_output_img"] = stg1_img_path

    df.to_pickle(pandas_path)
    return df


if __name__ == '__main__':
    from dials.util import show_mail_on_error

    with show_mail_on_error():
        script = Script()
        RUN = script.run
        lp = None
        if LineProfiler is not None and script.params.profile:
            lp = LineProfiler()
            lp.add_function(hopper_utils.model)
            lp.add_function(hopper_utils.target_func)
            RUN = lp(script.run)
        elif script.params.profile:
            print("Install line_profiler in order to use logging: libtbx.python -m pip install line_profiler")

        RUN()

        if lp is not None:
            stats = lp.get_stats()
            hopper_utils.print_profile(stats, ["model", "target_func"])
Ejemplo n.º 2
0
            lp.add_function(stage_two_refiner.StageTwoRefiner._mpi_aggregation)
            lp.add_function(stage_two_refiner.StageTwoRefiner._setup)
            lp.add_function(hopper_utils.DataModeler.GatherFromExperiment)
            RUN = lp(script.run)

        if script.params.outdir is None:
            od = script.params.refiner.io.output_dir
            script.params.outdir = od if od is not None else '.'

        if script.params.logging.logname is None:
            script.params.logging.logname = "main_stage2.log"
        if script.params.profile_name is None:
            script.params.profile_name = "prof_stage2.log"
        if script.params.logging.disable:
            logging.disable(
                level=logging.CRITICAL)  # disables CRITICAL and below
        else:
            mpi_logger.setup_logging_from_params(script.params)

        RUN()

        if lp is not None:
            stats = lp.get_stats()
            from simtbx.diffBragg import hopper_utils
            hopper_utils.print_profile(stats, [
                "launch_refiner", "_compute_functional_and_gradients",
                "_run_diffBragg_current", "_update_Fcell", "_scale_pixel_data",
                "_Fcell_derivatives", "_mpi_aggregation",
                "GatherFromExperiment", "_setup"
            ])