def _measure_optics(lins, optics_opt): if len(lins) == 0: lins = optics_opt.files inputs = measure_optics.InputFiles(lins, optics_opt) iotools.create_dirs(optics_opt.outputdir) calibrations = measure_optics.copy_calibration_files( optics_opt.outputdir, optics_opt.calibrationdir) inputs.calibrate(calibrations) with timeit(lambda spanned: LOGGER.info( f"Total time for optics measurements: {spanned}")): measure_optics.measure_optics(inputs, optics_opt)
def test_measure_optics(tmp_path, input_data, lin_slice, compensation, coupling_method, range_of_bpms, three_bpm_method, second_order_disp): data = input_data["free" if compensation == 'none' else "driven"] lins, optics_opt = data['lins'], data['optics_opt'] optics_opt.update( outputdir=tmp_path, compensation=compensation, coupling_method=coupling_method, range_of_bpms=range_of_bpms, three_bpm_method=three_bpm_method, second_order_disp=second_order_disp, chromatic_beating=lin_slice == slice(None, 7), ) inputs = measure_optics.InputFiles(lins[lin_slice], optics_opt) with timeit(lambda spanned: LOG.debug( f"\nTotal time for optics measurements: {spanned}")): measure_optics.measure_optics(inputs, optics_opt) evaluate_accuracy(optics_opt.outputdir, LIMITS)
def _run_evaluate_and_clean_up(inputs, optics_opt): with timeit(lambda spanned: print(f"\nTotal time for optics measurements: {spanned}")): measure_optics.measure_optics(inputs, optics_opt) evaluate_accuracy(optics_opt.outputdir) _clean_up(optics_opt.outputdir)