def twiss_response_creation_test():
    with logging_tools.DebugMode():
        create_response(create_twiss_resp_args + variable_cat_args +
                        optics_param_arg)
    LOG.info("\n\n\n")
    LOG.info("Creating Twiss response.")
    with logging_tools.DebugMode():
        create_response(create_twiss_resp_args + variable_cat_args)
def twiss_correction_test():
    LOG.info("Creating Twiss response")
    create_response(create_twiss_resp_args + variable_cat_args +
                    optics_param_arg)

    LOG.info("Correcting Iteratively twiss_Response")
    global_correction(correct_args + [
        "--fullresponse",
        os.path.join(test_folder, "fullresponse_twiss"), "--output_dir",
        os.path.join(test_folder, "corrected_twiss")
    ])
def response_debugging_test():
    args = [
        '--accel', 'lhc', '--lhcmode', 'lhc_runII_2017', '--beam', '1',
        '--creator', 'madx', '--deltak', '0.00002', '--variables',
        'coupling_knobs', '--outfile',
        '/home/jdilly/link_gui_out/2018-03-22/models/LHCB1/multiturn_highbeta_colltunes/Fullresponse_pandas',
        '--model_dir',
        '/home/jdilly/link_gui_out/2018-03-22/models/LHCB1/multiturn_highbeta_colltunes',
        '--debug'
    ]
    create_response(args)
def madx_correction_test():
    LOG.info("Creating MADX response")
    create_response(create_madx_resp_args + variable_cat_args +
                    optics_param_arg)

    LOG.info("Correcting Iteratively MADX-Response")
    global_correction(correct_args + [
        "--fullresponse",
        os.path.join(test_folder, "fullresponse_madx"), "--output_dir",
        os.path.join(test_folder, "corrected_madx")
    ])
def create_responses(beam):
    """ Create responses to be used (saved in DATA-DIR!)"""
    for mode in ["normal", "coupling"]:
        f_madx = os.path.join(DATA_DIR[beam][mode], RESPONSES["madx"])
        f_twiss = os.path.join(DATA_DIR[beam][mode], RESPONSES["twiss"])

        args = {
            "accel": "lhc",
            "lhc_mode": "lhc_runII_2018",
            "beam": beam,
            "delta_k": DELTA_K,
            "variable_categories": VARIABLES[mode],
            "model_dir": MODEL_DIR[beam],
            "debug": False,
        }

        args_madx = args.copy()
        args_madx.update({"creator": "madx", "outfile_path": f_madx})
        create_response(**args_madx)

        args_twiss = args.copy()
        args_twiss.update({"creator": "twiss", "outfile_path": f_twiss})
        create_response(**args_twiss)