This was published a while ago on Github.

Langevin integrator for SDEs with constant drift and diffusion on continuous intervals with circular boundary conditions.

CILES is written in Cython and uses GSL for interpolation of drift & diffusion fields, to be able to simulate continuous variables.

Description

Given a discretized drift field A(x) and a (position dependent) diffusion coefficient B(x) this tool performs simple time-forward integration of the SDE:

where eta(t) is a gaussian white noise term and x is a variable on an interval with circular boundaries (commonly 0 <= x < 2PI).

Both drift field A and diffusion B need to be arrays of the same dimension. They are internally interpolated (usinggsl_interp_cspline_periodic) to provide continuous fields, which are then used in the forward integration.

Forward integration is performed with the Euler-Murayama scheme

where r is a normally distributed random number with zero mean and unit variance.

Dependencies

Installation

To install ciles in your Python distribution: – Clone repository – python setup.py install – To test (using nosetests): nosetests

You can also use ciles locally without installing: – Clone repository – python setup.py build_ext --inplace

Example use

More examples

Below are the plot results of the currently available examples from ciles.examples.

Final distributions after 2s diffusion

See the source

Diffusion for 2 seconds

Trajectories for drift-field with 2 fixed points

See the source

Plotting trajectories