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

Improves gsim strings in trellis and fixes setup.py issue with new pip policy #119

Closed rizac closed 3 years ago

rizac commented 3 years ago

This PR does two things:

  1. Fixes installation problems by removing matplotlib from setup.py. Not only there is no point in listing a package that is already required by OpenQuake, but from now, with the new pip policiy, the matplotlib version must match that of Openquake, otherwise the install would fail.

  2. Improves the Gsim names returned by Trellis plot output, which might confuse the user (if one passes "AkkarEtAlRjb2014" he/she gets results for "AkkarEtAlRjb2014(adjustment factor=0.0)"). The standard old behaviour is still maintained if one passes Gsim as class instance. However, if the Gsim is passed as string, return the input string instead (without the Gsim default parameters used, if any). (implementation detail: the gsims attribute of the class BaseTrellis is not anymore a list of Gsims instances, but a dict of strings mapped to Gsim instances. Looking at the code, almost every time we work with a Gsim we need also its str representation, and thus this modification incidentally makes the code also more efficient)

g-weatherill commented 3 years ago

LGTM