<commit_before>====
PyDy
====

.. image:: https://travis-ci.org/pydy/pydy.png?branch=master
   :target: https://travis-ci.org/pydy/pydy

PyDy_, short for Python Dynamics, is a tool kit written in and accessed through
the Python programming language that utilizes an array of scientific tools to
study multibody dynamics. The goal is to have a modular framework and
eventually a physics abstraction layer which utilizes a variety of backends
that can provide the user with their desired workflow, including:

- Model specification
- Equation of motion generation
- Simulation
- Visualization
- Publication

We started by building the SymPy_ `mechanics package`_ which provides an API
for building models and generating the symbolic equations of motion for complex
multibody systems and have more recently developed two packages, pydy.codegen
and pydy.viz, for simulation and visualization of the models. The remaining
tools currently used in the PyDy workflow are popular scientific Python
packages such as NumPy_, SciPy_, IPython_, and matplotlib_ (i.e. the SciPy
stack) which provide additional code for numerical analyses, simulation, and
visualization.

Installation
============

The PyDy workflow has hard dependencies on these Python packages:

- Python >= 2.7
- setuptools

SciPy Stack

- SymPy_ >= 0.7.4.1
- NumPy_ >= 1.6.1
- SciPy_ >= 0.9.0
- IPython_ >= 0.13.0

It's best to install the SciPy Stack dependencies using the instructions_
provided on the SciPy website.

Once the dependencies are installed, the package can be installed from PyPi
using::

   $ easy_install pydy

or::

   $ pip install pydy

For system wide installs you will need root permissions (perhaps prepend
commands with ``sudo``).

You can also grab the source and then install\ [#]_.

Using the zip download::

   $ wget https://github.com/pydy/pydy/archive/master.zip
   $ unzip pydy-master.zip
   $ cd pydy-master
   $ python setup.py install

Using Git::

   $ git clone https://github.com/pydy/pydy.git
   $ cd pydy
   $ python setup.py install

.. [#] Note that this is the latest development version. Specific releases
   can be found here: https://github.com/pydy/pydy/releases
   or by checking out a tag with Git.

Development Environment
-----------------------

Development Dependencies
~~~~~~~~~~~~~~~~~~~~~~~~

Tests require nose:

- nose: 1.3.0

Isolated Environments
~~~~~~~~~~~~~~~~~~~~~

The following installation assumes you have virtualenvwrapper_ and all the
dependencies needed to build the various packages::

   $ mkvirtualenv pydy-dev
   (pydy-dev)$ pip install numpy scipy cython nose theano sympy
   (pydy-dev)$ pip install matplotlib # make sure to do this after numpy
   (pydy-dev)$ git clone <EMAIL>:pydy/pydy.git
   (pydy-dev)$ cd pydy
   (pydy-dev)$ python setup.py develop

.. _virtualenvwrapper: https://pypi.python.org/pypi/virtualenvwrappe://pypi.python.org/pypi/virtualenvwrapper

Or with conda_::

   $ conda create -n pydy-dev numpy scipy cython nose theano sympy matplotlib
   $ source activate pydy-dev
   (pydy-dev)$ git clone <EMAIL>:pydy/pydy.git
   (pydy-dev)$ cd pydy
   (pydy-dev)$ python setup.py develop

.. _conda: https://github.com/conda/conda

Run the tests::

   (pydy-dev)$ nosetests

For the Javascript tests the Jasmine and blanket.js libraries are used.  Both
of these libraries are included in pydy-viz with the source. To run the
Javascript tests, go to the javascript library directory::

   $ cd pydy/viz/static/js

Then run a simple HTTP Server with Python (the server is required due to some
cross browser issues with blanket.js)::

   $ python -m SimpleHTTPServer

Now visit http://localhost:8000/SpecRunner.html in a webgl compliant browser.

Run the benchmark to test the n-link pendulum problem.::

   (pydy-dev)$ python bin/benchmark_pydy_code_gen.py <max # of links> <# of time steps>

Usage
=====

This is an example of a simple 1 degree of freedom system: a mass, spring,
damper system under the influence of gravity and a force::


   / / / / / / / / /
   -----------------
     |    |     |   | g
     \   | |    |   V
   k /   --- c  |
     |    |     | x, v
    --------    V
    |  m   | -----
    --------
       | F
       V<commit_msg>Added updated js testing instructions<commit_after>====
PyDy
====

.. image:: https://travis-ci.org/pydy/pydy.png?branch=master
   :target: https://travis-ci.org/pydy/pydy

PyDy_, short for Python Dynamics, is a tool kit written in and accessed through
the Python programming language that utilizes an array of scientific tools to
study multibody dynamics. The goal is to have a modular framework and
eventually a physics abstraction layer which utilizes a variety of backends
that can provide the user with their desired workflow, including:

- Model specification
- Equation of motion generation
- Simulation
- Visualization
- Publication

We started by building the SymPy_ `mechanics package`_ which provides an API
for building models and generating the symbolic equations of motion for complex
multibody systems and have more recently developed two packages, pydy.codegen
and pydy.viz, for simulation and visualization of the models. The remaining
tools currently used in the PyDy workflow are popular scientific Python
packages such as NumPy_, SciPy_, IPython_, and matplotlib_ (i.e. the SciPy
stack) which provide additional code for numerical analyses, simulation, and
visualization.

Installation
============

The PyDy workflow has hard dependencies on these Python packages:

- Python >= 2.7
- setuptools

SciPy Stack

- SymPy_ >= 0.7.4.1
- NumPy_ >= 1.6.1
- SciPy_ >= 0.9.0
- IPython_ >= 0.13.0

It's best to install the SciPy Stack dependencies using the instructions_
provided on the SciPy website.

Once the dependencies are installed, the package can be installed from PyPi
using::

   $ easy_install pydy

or::

   $ pip install pydy

For system wide installs you will need root permissions (perhaps prepend
commands with ``sudo``).

You can also grab the source and then install\ [#]_.

Using the zip download::

   $ wget https://github.com/pydy/pydy/archive/master.zip
   $ unzip pydy-master.zip
   $ cd pydy-master
   $ python setup.py install

Using Git::

   $ git clone https://github.com/pydy/pydy.git
   $ cd pydy
   $ python setup.py install

.. [#] Note that this is the latest development version. Specific releases
   can be found here: https://github.com/pydy/pydy/releases
   or by checking out a tag with Git.

Development Environment
-----------------------

Development Dependencies
~~~~~~~~~~~~~~~~~~~~~~~~

Tests require nose:

- nose: 1.3.0

Javascript testing requires phantomjs:

- phantomjs: 1.9.0

Isolated Environments
~~~~~~~~~~~~~~~~~~~~~

The following installation assumes you have virtualenvwrapper_ and all the
dependencies needed to build the various packages::

   $ mkvirtualenv pydy-dev
   (pydy-dev)$ pip install numpy scipy cython nose theano sympy
   (pydy-dev)$ pip install matplotlib # make sure to do this after numpy
   (pydy-dev)$ git clone <EMAIL>@github.com:pydy/pydy.git
   (pydy-dev)$ cd pydy
   (pydy-dev)$ python setup.py develop

.. _virtualenvwrapper: https://pypi.python.org/pypi/virtualenvwrappe://pypi.python.org/pypi/virtualenvwrapper

Or with conda_::

   $ conda create -n pydy-dev numpy scipy cython nose theano sympy matplotlib
   $ source activate pydy-dev
   (pydy-dev)$ git clone git@github.com:pydy/pydy.git
   (pydy-dev)$ cd pydy
   (pydy-dev)$ python setup.py develop

.. _conda: https://github.com/conda/conda

Run the tests::

   (pydy-dev)$ nosetests

For the Javascript tests the Jasmine and blanket.js libraries are used.  Both
of these libraries are included in pydy.viz with the source. To run the
Javascript tests::

   cd pydy/viz/static/js/tests && phantomjs run-jasmine.js SpecRunner.html && cd ../../../../../

Then run a simple HTTP Server with Python (the server is required due to some
cross browser issues with blanket.js)::

   $ python -m SimpleHTTPServer

Now visit http://localhost:8000/SpecRunner.html in a webgl compliant browser.

Run the benchmark to test the n-link pendulum problem.::

   (pydy-dev)$ python bin/benchmark_pydy_code_gen.py <max # of links> <# of time steps>

Usage
=====

This is an example of a simple 1 degree of freedom system: a mass, spring,
damper system under the influence of gravity and a force::


   / / / / / / / / /
   -----------------
     |    |     |   | g
     \   | |    |   V
   k /   --- c  |
     |    |     | x, v
    --------    V
    |  m   | -----
    --------
       | F
       V
{'fraction_non_alphanumeric': 0.10808909730363424, 'fraction_numerical': 0.005978898007033997, 'mean_word_length': 3.2066074950690333, 'pattern_counts': {'":': 0, '<': 10, '<?xml version=': 0, '>': 20, 'https://': 14, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 3, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2694733', 'n_tokens_mistral': 2667, 'n_tokens_neox': 2491, 'n_words': 1003}