obspy.core.util.testing.compare_images

compare_images(expected, actual, tol)[source]

Custom version of matplotlib.testing.compare.compare_images(). This enable ObsPy to have the same image comparison metric across matplotlib versions. Furthermore nose is no longer a test dependency of ObsPy.

In contrast to the matplotlib version this one only works with png files. Fully transparent pixels will have their color set to white as the RGB values of fully transparent pixels change depending on the matplotlib version.

Additionally this version uses a straight RMSE definition instead of the binned one of matplotlib.

Parameters:
  • expected (str) The filename of the expected png file.
  • actual (str) The filename of the actual png file.
  • tol (float) The tolerance (a color value difference, where 255 is the maximal difference). The test fails if the average pixel difference is greater than this value.