Text and SQLite backends (update)

This PR is an update of #500.

The only new change to the interface is a function to dump a trace sampled with the NDArray backend into a text database. Most other changes are focused on updating the testing approach.