pymad / cpymad

cPyMAD is a python interface to Mad-X using cython and libmadx
http://cern.ch/pymad
Apache License 2.0
3 stars 3 forks source link

WARNING: This project is currently unmaintained! Please consider using the active fork at:

https://github.com/hibtc/cpymad

See also Project status_.

CPyMAD

CPyMad is a Cython binding to MAD-X_.

MAD-X is a software package to simulate particle accelerators and is used at CERN and all around the world. It has its own proprietary scripting language and is usually launched from the command line.

There is also a binding via JMad called JPyMAD. This has less features but does not require a C compiler for installing.

.. _CPyMAD: https://github.com/pymad/cpymad .. _Cython: http://cython.org/ .. _MAD-X: http://cern.ch/mad .. _JMad: http://jmad.web.cern.ch/jmad/ .. _JPyMAD: https://github.com/pymad/jpymad

IMPORTANT: cern-cpymad links against an unofficial build of MAD-X that is not supported by CERN, i.e. in case of problems you will not get help there.

Dependencies

To build MAD-X and CPyMAD from source you will need

Furthermore, CPyMAD depends on the following python packages:

The python packages can be installed using pip_.

.. _CMake: http://www.cmake.org/ .. _setuptools: https://pypi.python.org/pypi/setuptools .. _Cython: http://cython.org/ .. _NumPy: http://www.numpy.org/ .. _PyYAML: https://pypi.python.org/pypi/PyYAML .. _pip: https://pypi.python.org/pypi/pip

Installation


Installation instructions are available at http://pymad.github.io/cpymad/installation.

Usage

.. code-block:: python

from cern import cpymad

# Instanciate a model:
m = cpymad.load_model('lhc')

# Calculate TWISS parameters:
twiss, summary = m.twiss()

# Your own analysis below:
from matplotlib import pyplot as plt
plt.plot(twiss['s'], twiss['betx'])
plt.show()

See http://pymad.github.io/cpymad for further documentation.

Project Status


There are currently no active developers working on this project. The code might still be working
fine against the current stable and development version of Mad-X, so it could still be useful.
Below you find a list of alternative projects which may have a more complete feature set and documentation.

**Known Forks and Similar Projects:**
 - https://github.com/hibtc/cpymad (python binding to MAD-X using C extension)
 - http://jmad.web.cern.ch/jmad/ (java binding to MAD-X)
 - https://github.com/pymad/jpymad (python -> jmad -> MAD-X)

Development guidelines

Coding:

Try to be consistent with the PEP8 guidelines as far as you are familiar with it. Add unit tests for all non-trivial functionality. Dependency injection_ is a great pattern to keep modules testable.

.. PEP8: http://www.python.org/dev/peps/pep-0008/ .. unit tests: http://docs.python.org/2/library/unittest.html .. _Dependency injection: http://www.youtube.com/watch?v=RlfLCWKxHJ0

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_.

.. _A Note About Git Commit Messages: http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html

Tests:

Currently, two major test services are used:

.. CDash: http://abp-cdash.web.cern.ch/abp-cdash/index.php?project=pymad .. Travis CI: https://travis-ci.org/pymad/cpymad

Contribution work flow:

All changes are reviewed via pull-requests. Before merging to master the pull-request must reside aliased by the testing branch long enough to be confirmed as stable. Any issues are discussed in the associated issue thread. Concrete suggestions for changes are best posed as pull-requests onto the feature branch.