Skip to content

Documentation for pymask v0.3

The python version of the mask file, pymask, has been developed as an evolution of the traditional MAD-X approach to overcome limitations of the MAD-X scripting and profit of the flexibility offered by the python language and general-purpose python packages.

The code is hosted on github at https://github.com/lhcopt/lhcmask.

A complete example can be found here.

Pymask offers all the features of the legacy MAD-X mask file, and provides the following capabilities that are not easily available with the pure MAD-X approach:

  • Create code that is independent on knob naming conventions. This, for example, allows the usage of the same code for LHC and HL-LHC;
  • Configuration of anticlockwise beam (b4) with beam-beam lenses by using multiple MAD-X instances within the same python environment;
  • Manipulation of arrays and strings as well as interfacing to other python packages (general purpose and custom made). This allows, for example, importing measured bunch-by-bunch intensities, or realistic filling patterns.
  • Automatic sanity checks and interactive debugging using python packages for processing and plotting, as well as the python debugger when needed;
  • Advanced introspection into MAD-X namespace (identification of dependent and independent variables, verificantion of knobs dependences);

The MAD-X code is used within python for all the optics calculations thanks to the cpymad interface. The equivalent MAD-X input can always be autogenerated for debugging.

For some features the corresponding modules of the MAD-X mask files are simply called. For other features instead, like the beam-beam configuration and the luminosity leveling, the code has been fully restructured and rewritten in python in order to allow for the new features mentioned above.

For more information on the tool and how to use it, please explore the sections in the navigation menu.