GEMScienceTools/gmpe-smtk

Two proposed changes to SMTK methods

g-weatherill opened this issue · 1 comments

Two changes are proposed that would modify the calls to specific functions:

  1. Change the smtk.response_spectrum.Response Spectrum class to execute the response spectrum analysis immediate on instantiation

  2. Change the smtk.trellis.trellis_plots.BaseTrellis class so that .create_plot() is not run on instantiation. Instead a simple .plot() function should be added which is called subsequently. This can permit generation of trellis ground motion values without invoking the plotting functionality

rizac commented

Hey,

  1. I see the point of doing that. What about about making the class callable like a function (via __call__ instead of evaluate()?) it basically maintains the current functionality (which might be handy, to postpone calculatation if needed) and adds yours by simply typing "()". Something like:
obj = NewmarkBeta(...)  # as it is now. Evaluate later
result = NewmarkBeta(...)()  # evaluate it now
  1. As we already discussed, are there plans to separate plotting stuff from base code, so that if we include the code as backend we might never need to import matplotlib? This might be of great help