Skip to content

remove save() methods from analysis classes #1745

@orbeckst

Description

@orbeckst

Many classes in MDAnalysis.analysis have a save() method as a convenience to persist calculated data such as a timeseries to disk. However, storing data structures to disk in a portable manner is difficult and typical approaches such as using Python pickle are not portable (not even between Python 2 and Python 3). Instead of having to worry about the details of storing data, we should just let the user decide how to store data (e.g., convert to pandas dataframes and let pandas handle all this, or write as a custom text format).

(This issue came up in discussion on PR #1744 (for issue #1743).)

Proposal

Remove save() methods from analysis classes if the method is only a convenience functions. If the saved files can be read in again by the class, e.g., for re-analysis, then a more detailed case-by-case evaluation should be performed.

EDIT: Generally accepted, I rewrote the list of cases below.

approach

  1. survey the list of save methods below: decide which ones should be removed and note here
  2. add a deprecation notice for 0.17.1 (once this is done, update the Milestone to 1.0 instead of closing)
    • docs (add a .. deprecated:: 0.17.1 saying that the save() functionality will be removed in 1.0 because users generally know best how they want to persist the data.
    • DeprecationWarning
  3. add docs that explain which attributes might be worthwhile to save to disk and show an example for how to to this (basically, adding the code from the save() method to the docs)
  4. remove in 1.0

cases

With git grep 'save\w*(self'): Add a checkmark for any method that should be removed.

To be removed

Check methods once they have been removed.

To stay

Check if they are covered by tests

  • MDAnalysis/analysis/encore/utils.py: def savez(self, fname):
  • MDAnalysis/analysis/legacy/x3dna.py: def save(self, filename="x3dna.pickle"):
  • MDAnalysis/analysis/psa.py: def save_paths(self, filename=None):

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions