zwicker-group / py-pde

Python package for solving partial differential equations using finite differences.

Home Page:https://py-pde.readthedocs.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add tracker that directly writes all data to video

david-zwicker opened this issue · comments

This would allow to write data in a much more compressed format during the simulation. The idea would work best for 2d simulations of a single scalar field (but could probably be extended to more complicated cases, e.g. using colors for three fields). The idea is to have a tracker that converts a scalar field to a numpy array of dtype uint8 using a given value range and pushes this to ffmpeg, which encodes everything in a video. A useful package with an example is this. We might also need to store meta information about the underlying grid and particular the color scale to be able to revert this later again (using a special readonly storage class).

An alternative python package might be ffmpeg-python, but it's not clear whether it supports the required online update: jonghwanhyeon/python-ffmpeg#47.

A more flexible solution might be to simply implement a MovieStorage, which uses a movie as a backend. This might obviously only offer limited possibilities (e.g. only tracker with fixed time intervals).

A first version has been implemented by #545