pyfilm
Easily create films of 1D and 2D python arrays.
Getting Started
Python version support
pyfilm supports Python 3.6-3.9.
Installation
pyfilm can be installed directly from pip:
pip install pyfilm
This should install all the required dependencies. If numpy doesn't get automatically installed, install it first using pip and try again.
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.
Refer to the known issues section in the documentation to deal with Matplotlib backends in case plots don't display.
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
Importing
Simply import into your project via:
import pyfilm as pf
Examples
1D Example: pyfilm expects y to be of the form y(t, x)
import numpy as np
x = np.random.rand(10)
y = np.random.rand(10, 10)
pf.make_film_1d(x, y)
2D Example: pyfilm expects z to be of the form z(t, x, y)
import numpy as np
x = np.random.rand(10)
y = np.random.rand(10)
z = np.random.rand(10, 10, 10)
pf.make_film_2d(x, y, z)
1D Example with 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