-
Notifications
You must be signed in to change notification settings - Fork 823
Description
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
- survey the list of save methods below: decide which ones should be removed and note here
- 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.1saying that thesave()functionality will be removed in 1.0 because users generally know best how they want to persist the data. DeprecationWarning
- docs (add a
- 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) - 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.
- MDAnalysis/analysis/align.py: def save(self, rmsdfile): Remove save() and changes filename in AlignTraj #2486
- MDAnalysis/analysis/contacts.py: def save(self, outfile): Remove save() methods for v1.0 - Part 1 #2487
- MDAnalysis/analysis/diffusionmap.py: def save(self, filename): Remove save() methods for v1.0 - Part 1 #2487
- MDAnalysis/analysis/hbonds/hbond_analysis.py: def save_table(self, filename="hbond_table.pickle"): Remove save part2 #2494
- MDAnalysis/analysis/hbonds/hbond_autocorrel.py: def save_results(self, filename='hbond_autocorrel'): Remove save part2 #2494
- MDAnalysis/analysis/hbonds/wbridge_analysis.py: def save_table(self, filename="wbridge_table.pickle"):
- MDAnalysis/analysis/hole.py: def save(self, filename="hole.pickle"): Remove save() methods for v1.0 - Part 1 #2487
- MDAnalysis/analysis/lineardensity.py: def save(self, description='', form='txt'): Remove save() methods for v1.0 - Part 1 #2487
- MDAnalysis/analysis/lineardensity.py: def _savetxt(self, filename): Remove save() methods for v1.0 - Part 1 #2487
- MDAnalysis/analysis/lineardensity.py: def _savez(self, filename): Remove save() methods for v1.0 - Part 1 #2487
- MDAnalysis/analysis/psa.py: def save_result(self, filename=None): Remove save part2 #2494
- MDAnalysis/analysis/rms.py: def save(self, filename=None): Remove save() methods for v1.0 - Part 1 #2487
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):