def _copy_error_def_file(directory, options): new_err_def_path = os.path.join(directory, "error_deffs.txt") LOGGER.warning("copying errordefs file to '{}'".format(new_err_def_path)) iotools.copy_item(os.path.join( ERR_DEF_PATH, ERR_DEF_FILES[options.optics] ), new_err_def_path) return new_err_def_path
def _copy_files(src, dst, ignore): """ Copies files only from src to dst directories """ old_items = os.listdir(dst) + [getdiff.TWISS_CORRECTED, getdiff.TWISS_NOT_CORRECTED] for item in os.listdir(src): src_item = os.path.join(src, item) if os.path.isfile(src_item) and not re.search(ignore, item) and not item in old_items: iotools.copy_item(src_item, os.path.join(dst, item))
def _copy_error_def_file(directory, options): new_err_def_path = os.path.join(directory, "error_deffs.txt") LOGGER.warning("copying errordefs file to '{}'".format(new_err_def_path)) iotools.copy_item( os.path.join(ERR_DEF_PATH, ERR_DEF_FILES[options.optics]), new_err_def_path) return new_err_def_path
def model_creation(): iotools.create_dirs(test_folder) iotools.copy_item(os.path.join(data_folder, "modifiers.madx"), os.path.join(test_folder, "modifiers.madx")) LOG.info("Creating Model") create_instance_and_model(creator_args)
def _copy_calibration_files(outputdir, calibrationdir): if calibrationdir is None: return None calibs = {} for plane in PLANES: cal_file = "calibration_{}.out".format(plane.lower()) iotools.copy_item(join(calibrationdir, cal_file), join(outputdir, cal_file)) calibs[plane] = tfs_pandas.read_tfs(join(outputdir, cal_file)).set_index("NAME") return calibs
"--model_dir {model_dir}", "--optics_file {optics_file}", "--creator madx", "--outfile {response_out}", "--variables MQM MQT MQTL MQY coupling_knobs", "--deltak 2e-5", ]).format(model_dir=join(REGR_DIR, "_out_create_response_test_madx", "model"), optics_file=join(OPTICS, "2018", "opticsfile.24_ctpps2"), response_out=join(REGR_DIR, "_out_create_response_test_madx", "fullresponse")), output=join(REGR_DIR, "_out_create_response_test_madx"), test_function=lambda d1, d2: filecmp.cmp(join(d1, "fullresponse"), join(d2, "fullresponse")), pre_hook=lambda dir: iotools.copy_item( join(MODELS, "25cm_beam1"), join(dir, REGR_DIR, "_out_create_response_test_madx", "model"))), ) TEST_CASES_RESPONSE_CREATION_VIA_TWISS = (regression.TestCase( name="response_creation_test_via_twiss", script=join("generate_fullresponse_pandas.py"), arguments=" ".join([ "--accel lhc --lhcmode lhc_runII_2017 --beam 1", "--model_dir {model_dir}", "--optics_file {optics_file}", "--creator twiss", "--outfile {response_out}", "--variables MQM MQT MQTL MQY coupling_knobs", "--optics_params MUX MUY Q DX DY BBX BBY BETX BETY F1001I F1001R F1010R F1010I", ]).format(model_dir=join(REGR_DIR, "_out_create_response_test_twiss", "model"),