This 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. You can use it easily for your favourite circular accelerator.
To see how to adapt this for your accelerator, see our documentation, Model section.
To contribute, see the Hints for Developers section below.
- Autogenerated docs via
Sphinxcan be found at https://pylhc.github.io/omc3/. - General documentation of the OMC-Teams software is located at https://twiki.cern.ch/twiki/bin/view/BEABP/OMC.
The omc3 package is Python 3.7+ compatible, but not yet deployed to PyPI.
The best way to install is though pip and VCS:
git clone https://github.com/pylhc/omc3
pip install /path/to/omc3Or simply from the online master branch, which is stable:
pip install git+https://github.com/pylhc/omc3.gitAfter installing, codes can be run with either python -m omc3.SCRIPT --FLAG ARGUMENT or calling path to the .py file directly.
Main scripts to be executed lie in the /omc3 directory. These include:
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 provide optics models required for optics analysis.run_kmod.pyto analyse data from K-modulation and return the measured optics functions.tbt_converter.pyto convert different turn by turn datatypes to sdds, and add noise.amplitude_detuning_analysis.pyto perform amp. det. analysis on optics data with tune correction.
Plotting 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 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.
Example use for these scripts can be found in the tests files.
- Unit and accuracy tests are run automatically through CI Github Actions. See our workflows in this readme.
- Additional checks for code-complexity, design-rules, test-coverage and duplication are made through CodeClimate.
- Pull requests implementing functionality or fixes are merged into the master branch after passing CI, and a reviewer's approval.
See the CHANGELOG file.
In case you want to contribute to omc3's development, you should install it in editable mode:
git clone https://github.com/pylhc/omc3
pip install --editable omc3
You can install extra dependencies (as defined in setup.py) suited to your use case with the following commands:
pip install --editable omc3[test]
pip install --editable omc3[test,doc]
pip install --editable omc3[all]
Open an issue, make your changes in a branch and submit a pull request.
- pyLHC/OMC-Team - Working Group - pyLHC
This project is licensed under the GNU GPLv3 License.
Please take a moment to check its permissivity - see the LICENSE file for details.