The algorithms in the thunderfish modules should be usable without automatic import of matplotlib.pyplot - maybe matplotlib is not available (on a server) but you nevertheless want to use the algorithms. Therefore:
Each module may define functions that do plot some stuff.
If a module function implicitly uses matplotlib.pyplot
by operating on an axis, the module does NOT need to import matplotlib.
If a function uses matplotlib.pyplot directly, then you need to import matplotlib.pyplot in the module -
but then catch the ImportError as described below.
Importing matplotlib.pyplot in the main() function for demonstration is no problem.
Importing matplotlib.mlab is allowed if you need the mlab functions for basic (non-plotting) functionality of your script.
Catch the ImportException if you really need to import some matplotlib stuff in the module, e.g.
try:
import matplotlib.pyplot as plt
except ImportError:
pass
The algorithms in the thunderfish modules should be usable without automatic import of matplotlib.pyplot - maybe matplotlib is not available (on a server) but you nevertheless want to use the algorithms. Therefore: