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

Refactor of Residuals subclasses #97

Open g-weatherill opened 5 years ago

g-weatherill commented 5 years ago

Currently the comparison of GMPEs to data is undertaken in the smtk.residuals.gmpe_residuals.Residuals class. The various tools for analysis the model fit (Likelihood, LLH, EDR, MultivariateLLH) all subclass the Residuals object, adding on specific functions when needed. This was intended when the anticipated use case was to look at exploring the results from a single tool. The downside, however, is that if the user wishes to apply several metrics then they need to instantiate each class, and thus re-calculate the residuals, which is extremely time consuming. As this latter workflow is becoming more common there is no good argument for keeping the tools as separate classes. Instead a refactor is proposed to move the functions as methods of the core residuals class.