cokelaer / spectrum

Spectral Analysis in Python
http://pyspectrum.readthedocs.io
BSD 3-Clause "New" or "Revised" License
339 stars 90 forks source link

consider having Periodogram.run be "lazy executed" #35

Closed eteq closed 7 years ago

eteq commented 7 years ago

While looking over the documentation (and doing some test runs myself) for openjournals/joss-reviews#348, I high-level API/interface item struck me. Why does p.run() (or p() need to happen at all? All of the subsequent accessor methods or functions (e.g. p.plot(...) or p. pcorrelogram or the like) could "lazily" execute p.run() inside them...? That is, something like:

if not self._has_run:
    self.run()
    self._has_run = True

This would free the user from the seemingly unnecessary task of running run before doing anything they might actually want to get as an output.

cokelaer commented 7 years ago

done on the master branch. Documentation updated