JPyMAD is a python wrapper for MAD-X (Methodical Accelerator Design). It uses uses JMad via Py4J which then accesses the MAD-X library.
There is also cpymad uses Cython to access the MAD-X library directly.
Installation might be as easy as running
python setup.py install
from the source repository.
Further instructions are available at http://cern.ch/jpymad/installation.
# Once installed this is a nice example showing current
# usability (run from examples folder):
from cern.jpymad import JPyMadService
# the service object is responsible for locating and instanciating models
pms = JPyMadService()
# Create a model:
pm = pms.create_model('lhc')
# Run twiss:
# This returns a "lookup dictionary" containing
# numpy arrays. Lowercase keys.
twiss,summary = pm.twiss()
# Your own analysis below:
import matplotlib.pyplot as plt
plt.plot(twiss.s, twiss.betx)
See http://cern.ch/jpymad/ for further documentation.
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.
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.
Tests:
Currently, two major test services are used:
- The tests on CDash are run on a daily basis on the
master
branch and on update of thetesting
branch. It ensures that the integration tests for the LHC models are working correctly on all tested platforms. The tests are run only on specific python versions. - The Travis CI service is mainly used to check that the unit tests for pymad itself execute on several python versions. Python{2.6,2.7,3.3} are supported. The tests are executed on any update of an upstream branch.
Contribution work flow:
This motivates the following work flow when performing any changes:
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.