Metadata-Version: 2.4
Name: omc3
Version: 0.28.1
Summary: An accelerator physics tools package for the OMC team at CERN.
Project-URL: homepage, https://github.com/pylhc/omc3
Project-URL: repository, https://github.com/pylhc/omc3
Project-URL: documentation, https://pylhc.github.io/omc3/
Project-URL: changelog, https://github.com/pylhc/omc3/blob/master/CHANGELOG.md
Author-email: OMC Team <pylhc@github.com>
License-Expression: MIT
License-File: LICENSE
Classifier: Intended Audience :: Science/Research
Classifier: Natural Language :: English
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Topic :: Scientific/Engineering
Classifier: Topic :: Scientific/Engineering :: Physics
Classifier: Topic :: Scientific/Engineering :: Visualization
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Typing :: Typed
Requires-Python: >=3.11
Requires-Dist: generic-parser>=1.1
Requires-Dist: h5py>=2.9
Requires-Dist: matplotlib>=3.8
Requires-Dist: numpy>=1.24
Requires-Dist: odrpack>=0.4.0
Requires-Dist: optics-functions>=0.1
Requires-Dist: pandas>=2.1
Requires-Dist: requests>=2.27
Requires-Dist: scikit-learn>=1.0
Requires-Dist: scipy>=1.10
Requires-Dist: sdds>=0.4
Requires-Dist: tables>=3.10.1
Requires-Dist: tfs-pandas>=3.8
Requires-Dist: turn-by-turn>=1.0
Provides-Extra: all
Requires-Dist: gitpython>=3.1; extra == 'all'
Requires-Dist: jpype1>=1.3; extra == 'all'
Requires-Dist: kerberos>=1.3.1; extra == 'all'
Requires-Dist: nxcals>=1.6.6; extra == 'all'
Requires-Dist: pylogbook>=3.4; extra == 'all'
Requires-Dist: pymadng>=0.8.3; extra == 'all'
Requires-Dist: pymupdf>=1.22; extra == 'all'
Requires-Dist: pyside2; extra == 'all'
Requires-Dist: pyspark>=3.5; extra == 'all'
Requires-Dist: pytest-cov>=2.9; extra == 'all'
Requires-Dist: pytest-timeout>=1.4; extra == 'all'
Requires-Dist: pytest>=7.0; extra == 'all'
Requires-Dist: pytimber>=3.0; extra == 'all'
Requires-Dist: qtpy>=2.3.1; extra == 'all'
Requires-Dist: sphinx-rtd-theme>=2.0; extra == 'all'
Requires-Dist: sphinx>=7.0; extra == 'all'
Provides-Extra: cern
Requires-Dist: jpype1>=1.3; extra == 'cern'
Requires-Dist: kerberos>=1.3.1; extra == 'cern'
Requires-Dist: nxcals>=1.6.6; extra == 'cern'
Requires-Dist: pylogbook>=3.4; extra == 'cern'
Requires-Dist: pyspark>=3.5; extra == 'cern'
Requires-Dist: pytimber>=3.0; extra == 'cern'
Provides-Extra: doc
Requires-Dist: sphinx-rtd-theme>=2.0; extra == 'doc'
Requires-Dist: sphinx>=7.0; extra == 'doc'
Provides-Extra: madng
Requires-Dist: pymadng>=0.8.3; extra == 'madng'
Provides-Extra: optional
Requires-Dist: pymupdf>=1.22; extra == 'optional'
Requires-Dist: pyside2; extra == 'optional'
Requires-Dist: qtpy>=2.3.1; extra == 'optional'
Provides-Extra: test
Requires-Dist: gitpython>=3.1; extra == 'test'
Requires-Dist: jpype1>=1.3; extra == 'test'
Requires-Dist: pymadng>=0.8.3; extra == 'test'
Requires-Dist: pytest-cov>=2.9; extra == 'test'
Requires-Dist: pytest-timeout>=1.4; extra == 'test'
Requires-Dist: pytest>=7.0; extra == 'test'
Description-Content-Type: text/markdown

# <img src="https://raw.githubusercontent.com/pylhc/pylhc.github.io/master/docs/assets/logos/OMC_logo.svg" height="28" alt="omc3 logo"> 3

[![Tests](https://github.com/pylhc/omc3/actions/workflows/coverage.yml/badge.svg?branch=master)](https://github.com/pylhc/omc3/actions/workflows/coverage.yml)
[![GitHub last commit](https://img.shields.io/github/last-commit/pylhc/omc3.svg?style=popout)](https://github.com/pylhc/omc3/)
[![GitHub release](https://img.shields.io/github/release/pylhc/omc3.svg?style=popout)](https://github.com/pylhc/omc3/)
[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.5705625.svg)](https://doi.org/10.5281/zenodo.5705625)

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, and the package can easily be used for your favorite circular accelerator.
To see how to adapt this for your machine, see our [documentation](https://pylhc.github.io/omc3/), `Model` section.
To contribute, see [our guidelines](https://pylhc.github.io/packages/development/contributing/) on the OMC website.

## Documentation

- Autogenerated docs via `Sphinx` can be found at <https://pylhc.github.io/omc3/>.
- General documentation of the OMC Team is located at <https://pylhc.github.io/>.

## Installing

The package is deployed on `PyPI` and can easily be installed via `pip`:

```bash
python -m pip install omc3
```

For development purposes, we recommend creating a new virtual environment and installing from VCS in editable mode with all extra dependencies (`cern` for packages only available in the CERN GPN, `test` for `pytest` and relevant plugins, and `doc` for packages needed to build documentation).

```bash
git clone https://github.com/pylhc/omc3
python -m pip install --editable "omc3[all]"
```

## Functionality

Codes can then be run with either `python -m omc3.SCRIPT --FLAG ARGUMENT` or calling the `.py` file directly.

<details> <summary><b>Main Scripts</b></summary>

Main scripts to be executed lie in the [`/omc3`](omc3) directory. These include:

- `hole_in_one.py` to perform frequency analysis on turn by turn BPM data and infer optics (and more) for a given accelerator.
- `kmod_importer.py` to average, import and calculate lumi-imbalace K-modulation results.
- `knob_extractor.py` to extract from `NXCALS` the value of given knobs in the machine at a given time.
- `model_creator.py` to generate optics models required for optics analysis.
- `global_correction.py` to calculate corrections from measurement files.
- `response_creator.py` to provide correction response files.
- `tbt_converter.py` to convert different turn by turn data types to `SDDS`, potentially adding noise.
- `amplitude_detuning_analysis.py` to perform amp. det. analysis on optics data with tune correction.
- `madx_wrapper.py` to start a `MAD-X` run with a file or string as input.

</details>

<details> <summary><b>Plotting Scripts</b></summary>

Plotting scripts for analysis outputs can be found in [`/omc3/plotting`](omc3/plotting):

- `plot_spectrum.py` to generate plots from files generated by frequency analysis.
- `plot_bbq.py` to generate plots from files generated by BBQ analysis.
- `plot_amplitude_detuning.py` to generate plots from files generated by amplitude detuning analysis.
- `plot_optics_measurements.py` to generate plots from files generated by optics_measurements.
- `plot_tfs.py` all-purpose tfs-file plotter.
- `plot_kmod_results.py` to plot the beta and waist of the K-modulation results.

</details>

<details> <summary><b>Other Scripts</b></summary>

Other general utility scripts are in [`/omc3/scripts`](omc3/scripts):

- `update_nattune_in_linfile.py` to update the natural tune columns in the lin files by finding the highest peak in the spectrum in a given interval.
- `write_madx_macros.py` to generate `MAD-X` tracking macros with observation points from a TWISS file.
- `merge_kmod_results.py` to 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.py` to create a fake measurement based on a model TWISS file.
- `betabeatsrc_output_converter.py` to convert outputs from our old codes to `omc3`'s new standardized format.
- `linfile_clean.py` to automatically clean given columns in lin files.
- `kmod_average.py` to calculate the average of multiple K-modulation measurements.
- `kmod_import.py` to import a K-modulation measurement into an optics-measurement directory.
- `kmod_lumi_imbalace.py` to calculate the luminosity imbalance between two IPs from averaged K-modulation files.
- `bad_bpms_summary.py` to collect and summarize the bad BPMs from GUI runs.
- `resync_bpms.py` to perform re-synchronisation of SuperKEKB BPMs data after a first optics analysis.

Example use for these scripts can be found in the [`tests`](tests) files.
Documentation including relevant flags and parameters can be found at <https://pylhc.github.io/omc3/>.

</details>

## License

This project is licensed under the `MIT License` - see the [LICENSE](LICENSE) file for details.
