Skip to main content

GUI for accelerator simulations using MAD-X.

Project description

madgui is a Qt5 python GUI for interactive accelerator simulations using MAD-X.


  • Python >= 3.3

    On linux, I recommend the latest python version you can find.

    On windows, I strongly recommend WinPython 3.4 (pick an installer with Qt5 suffix, should be about 300MiB in size). In particular, you can not use python 3.5 and above, since there are problems building cpymad for these versions, see hibtc/cpymad#32.

  • PyQt5, should be installed using the official installer or your distributions package manager.

  • cpymad, in order to work with MAD-X.

    On windows, installing cpymad for python 3.3 or 3.4 should be as simple as:

    pip install cpymad

    Otherwise, please refer to cpymad’s installation instructions.


You are now ready to install madgui. Type:

pip install madgui

Or, in order to install from the local checkout:

python install

If you intend to make changes to the madgui code and want to try the effects immediately, use:

python develop


Now, you should be able to start madgui with the command:



python -m madgui

If you are on windows, and nothing happens, you can start madgui manually as follows, which may provide you with more error information:

python -c "from import main; main()"

Development guidelines



  • Stick to names_with_underscores for methods and variable names as mandated by PEP8 (I admit that the code base is currently very inconsistent in this regard)
  • class names are in CamelCase
  • only PyQt class method overrides and their parameters shall be written in lowerCamelCase

Version control:

Commits should be reversible, independent units if possible. Use descriptive titles and also add an explaining commit message unless the modification is trivial. See also: A Note About Git Commit Messages.


Copyright 2016-2018 HIT Betriebs GmbH

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <>.

For a full text version of the license, see COPYING.GPLv3.txt.



Date: 02.03.2018

  • fix knobs in skew quadrupoles
  • hotfix regression with posx/posy aliases
  • compatible with hit_models 0.7.0, hit_csys 0.6.0


Date: 02.03.2018

  • compute alfa/beta from sigma matrix for consistency
  • expose twiss variable holding twiss table in python shell widget
  • set better display units for some plots
  • keep plot axis limits on most updates
  • finally start to use position dependent emittances in some places
  • add more plots: momentum/dispersion/phase advance/emittance/gamma
  • plot monitors as dashed lines
  • plot loaded/snapshot curves without markers
  • update infobox window title when changing element
  • add tab with global variables to init-settings dialog
  • add tabs to info box: primary/expert/twiss/sigma/ellipse
  • keep position in info-box when refreshing values or element
  • fit small tool buttons to text size
  • let user click on zero-length elements
  • scale interpolation step length with sequence length, to show smooth curves
  • default number_format.align=right
  • default mirror_mode=True
  • fix python shell, when starting madqt as gui_script under windows
  • rework the multi-grid dialog (for orbit correction)
  • rename back to madgui
  • new versioning scheme, interpret: 0.0.X -> 1.X.0, acknowledging the the 0.X.Y releases of the old wx-based madgui.
  • remove pytao binding
  • match dialog: dropdown menu for knobs, minor visual improvements
  • internal refactoring, module renamings
  • can connect online control without loaded model


Date: 26.01.2018

  • element info box: add UI to switch element
  • floor plan: support 3D models (no more curved sbends anymore though…)
  • floor plan: add UI to change view perspective
  • floor plan: fix mirror inversion
  • main/plot window: set window title
  • main window: add config setting for initial position
  • codebase: unify the workspace/segment mess, now only have ‘model’ again (it’s unlikely that we will ever be able to work on less/more than one sequence in the same workspace anyway)


Date: 24.01.2018

  • fix mass unit in MAD-X
  • massive simplification of knobs API for interfacing control system
  • can read beam parameters from online plugin
  • show updated orbit plot after fitting in orbit-correction-mode (regression)
  • open orbit plot for orbit-correction-mode


Date: 09.01.2018

  • Emit signal when workspace is changed (for plugins…)
  • Show about boxes only if the package exists
  • Add about dialog for pytao
  • Change tab in settings dialog when clicking menu
  • When user invokes an action via a menu and the corresponding dialog already exists, focus the existing window
  • No longer show checkboxes for twiss/beam dialogs in menu
  • Read spinbox setting from config
  • [regression] Fix exception (closed logfile) when opening different model
  • [regression] Fix exception in online-control module when changing values into MAD-X


Date: 06.01.2018

  • fuzzy select when removing constraints in matching mode (middle click)
  • start log threads as daemon thread (never blocks program exit)
  • thread safe access to madx/tao
  • fetch element data for indicators in background
  • fix missing .ui files in installation
  • fix crash on windows at startup when starting via gui_scripts entrypoint


Date: 05.12.2017

  • continuous matching (within any element position)
  • fix bugs in matching code
  • updated dependencies: pint 0.8.1, cpymad>=0.18.2, pytao>=0.0.1


Date: 30.11.2017

First reference point to define somewhat stable versions.

List of features:

  • cpymad/pytao as simulation backends
  • plots: alfa/beta/envelope/orbit; and the ones defined by tao
  • integrated python shell (ipython/jupyter) not very useful as of yet: limited exhibition of objects, no convenient APIs provided (plotting)
  • log tab that shows madx/tao output
  • tab that shows madx/tao commands
  • display and edit box for beam parameters; initial conditions (i.e. twiss); and element attributes (read-only so far)
  • 2D floor plan
  • matching (interactive + dialog)
  • emittance (dialog)
  • orbit alignment: 2-grid + N+optic methods

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for madgui, version 1.7.1
Filename, size File type Python version Upload date Hashes
Filename, size madgui-1.7.1.tar.gz (116.8 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page