Coder Social home page Coder Social logo

cpymad's Introduction

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.

Dependencies

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

  • CMake
  • python>=2.6
  • C / Fortran compilers.

Furthermore, CPyMAD depends on the following python packages:

The python packages can be installed using pip.

Installation

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

Usage

from cern import cpymad

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

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

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

See http://cern.ch/pymad/ for further documentation.

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.

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 the testing 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.

cpymad's People

Contributors

coldfix avatar eothred avatar kaifox avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.