Getting Started¶
Python version support¶
Currently, pyfilm supports Python versions > 2.7 and > 3.4.
System dependencies¶
pyfilm generates a .png file for each timestep and stitches them together using ffmpeg/avconv. The following non-system specific packages are therefore required:
For example on Ubuntu 14.04 these are installed via:
sudo apt-get install libpng12-dev libav-tools
For OSX using the Brew package manager, these can be installed via:
brew install libpng ffmpeg
pyfilm will automatically check which of these is installed on your system
and default to avconv
if both are found.
Python dependencies¶
pyfilm requires:
A complete list is found in the requirements.txt file and is installed by running:
$ pip install -r requirements.txt
Since this project is structured as a PIP package, it also needs to be installed using the following command (in the package root directory):
$ python setup.py install
Examples¶
1D Example:
import numpy as np
x = np.linspace(0, 1, 10)
y = np.random.rand(10, 10)
pf.make_film_1d(x, y)
2D Example:
import numpy as np
x = np.linspace(0, 1, 10)
y = np.linspace(0, 1, 10)
z = np.random.rand(10, 10, 10)
pf.make_film_2d(x, y, z)
1D Example wiht styling and options:
import numpy as np
x = np.random.rand(10)
y = np.random.rand(10, 10)
pf.make_film_1d(x, y, plot_options={'lw':3, 'ls':'--'},
options={'ylabel':'Amplitude', 'fname':'amp'})
Running Tests¶
pyfilm uses the pytest framework for unit and functional tests. To run the tests, run the following in the package root directory:
$ py.test
To see information on the test coverage for individual files:
$ py.test --cov pyfilm tests
Documentation¶
The documentation is completely built on Sphinx with numpydoc docstring
convention and is hosted on Read the Docs. Using
RTD/GitHub webhooks, the documentation is rebuilt upon every commit that makes
changes to the documentation files The current build status is shown by the
docs
badge at the top of the main page. To make the docs, run:
$ cd docs
$ make html
where html
can be replaced with other acceptable formats, such as latex,
latexpdf, text, etc. In order to view the Latex document, it first has to be
built:
$ cd build/latex
$ make