GEMScienceTools / gmpe-smtk

Python and OpenQuake-based Toolkit for Analysis of Strong Motions and Interpretation of GMPEs
GNU Affero General Public License v3.0
43 stars 33 forks source link

Decouples residual plots data from matplotlib functions + tests + minor bug fixes #95

Closed rizac closed 5 years ago

rizac commented 6 years ago

This PR essentially does:

  1. Fixes some minor bugs found in smtk/strong_motion_selector.py (just spotted via editor highlights, no tests implemented)
  2. Decouples all plot data calculation from matplotlib rendering part: the old smtk.residuals.residual_plotter.py still handles the rendering (matplotlib), but a new module (smtk.residuals.residual_plots.py) implements the core functions, so that the code is cleaner and matplotlib is not imported when only plot data is required
  3. Implements tests for both the two modules above (by mocking pyplot.show and other GUI-related functions)