Package: omc3
3This is the python-tool package of the Optics Measurements and Corrections team (OMC) at CERN.Most of the codes are generic and not limited to CERN accelerators, and the package can easily be used for your favorite circular accelerator.
To see how to adapt this for your machine, see ourdocumentation,Modelsection.
To contribute, seeour guidelineson the OMC website.DocumentationAutogenerated docs viaSphinxcan be found athttps://pylhc.github.io/omc3/.General documentation of the OMC Team is located athttps://pylhc.github.io/.InstallingInstallation is easily done viapip:pip install omc3For development purposes, we recommend creating a new virtual environment and installing from VCS in editable mode with all extra dependencies (cernfor packages only available in the CERN GPN,testforpytestand relevant plugins, anddocfor packages needed to build documentation)gitclonehttps://github.com/pylhc/omc3
pipinstall--editable"omc3[all]"Codes can then be run with eitherpython -m omc3.SCRIPT --FLAG ARGUMENTor calling the.pyfile directly.FunctionalityMain ScriptsMain scripts to be executed lie in the/omc3directory. These include:global_correction.pyto calculate corrections from measurement files.hole_in_one.pyto perform frequency analysis on turn by turn BPM data and infer optics (and more) for a given accelerator.madx_wrapper.pyto start aMAD-Xrun with a file or string as input.model_creator.pyto generate optics models required for optics analysis.response_creator.pyto provide correction response files.run_kmod.pyto analyze data from K-modulation and return the measured optics functions.tbt_converter.pyto convert different turn by turn data types toSDDS, potentially adding noise.amplitude_detuning_analysis.pyto perform amp. det. analysis on optics data with tune correction.knob_extractor.pyto extract fromNXCALSthe value of given knobs in the machine at a given time.Plotting ScriptsPlotting scripts for analysis outputs can be found in/omc3/plotting:plot_spectrum.pyto generate plots from files generated by frequency analysis.plot_bbq.pyto generate plots from files generated by BBQ analysis.plot_amplitude_detuning.pyto generate plots from files generated by amplitude detuning analysis.plot_optics_measurements.pyto generate plots from files generated by optics_measurements.plot_tfs.pyall-purpose tfs-file plotter.Other ScriptsOther general utility scripts are in/omc3/scripts:update_nattune_in_linfile.pyto update the natural tune columns in the lin files by finding the highest peak in the spectrum in a given interval.write_madx_macros.pyto generateMAD-Xtracking macros with observation points from a TWISS file.merge_kmod_results.pyto merge LSA results files created by kmod, and add the luminosity imbalance if the 4 needed IP/Beam files combination are present.fake_measurement_from_model.pyto create a fake measurement based on a model TWISS file.betabeatsrc_output_converter.pyto convert outputs from our old codes toomc3's new standardized format.linfile_clean.pyto automatically clean given columns in lin files.Example use for these scripts can be found in thetestsfiles.
Documentation including relevant flags and parameters can be found athttps://pylhc.github.io/omc3/.LicenseThis project is licensed under theMIT License- see theLICENSEfile for details.