-
Notifications
You must be signed in to change notification settings - Fork 667
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
remove save()
methods from analysis classes
#1745
Comments
@richardjgowers @kain88-de have we got a nice decorator for deprecating methods? Can we add a code snippet in the comments that anyone can quickly apply to any method they come across? |
@sseyler can you please comment on the necessity to keep the Are they commonly used? Are they used in the published tutorials and docs? |
We are not going to touch anything in |
numpy has a |
@mtiberti can you comment about the need for |
For The paths are saved in their original or (optionally) npz format, so I wouldn't think compatibility is much of an issue—but what do I know? The |
The idea behind |
Can the files from save_paths() read into any of the functions in the PSA module?
Do we have a test that covers it?
save_results() can go and be replaced with docs.
…--
Oliver Beckstein
email: [email protected]
Am Dec 20, 2017 um 04:09 schrieb Matteo Tiberti ***@***.***>:
The idea behind savez is to have an easy way to write to disk the matrix computed by get_distance_matrix, so that the user can load it from disk when they want to try runs of ces or dres. It writes, together with the array containing the data, some metadata which is used to do a consistency check on the file when it's loaded while initialising a TriangularMatrix with the loadfile option. It is not meant to be a user-friendly or output format (even though it can be opened using numpy as it's a standard numpy npz file), more a way to store a midpoint of the calculation for later reuse. We could always get rid of it, specify a format that the user needs to use when saving arrays for TriangularMatrix and expect the user to conform, however it sounds needlessly complicated and more error-prone. What do you think?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or mute the thread.
|
I'd keep savez() then.
Is it tested?
…--
Oliver Beckstein
email: [email protected]
Am Dec 20, 2017 um 04:09 schrieb Matteo Tiberti ***@***.***>:
The idea behind savez is to have an easy way to write to disk the matrix computed by get_distance_matrix, so that the user can load it from disk when they want to try runs of ces or dres. It writes, together with the array containing the data, some metadata which is used to do a consistency check on the file when it's loaded while initialising a TriangularMatrix with the loadfile option. It is not meant to be a user-friendly or output format (even though it can be opened using numpy as it's a standard numpy npz file), more a way to store a midpoint of the calculation for later reuse. We could always get rid of it, specify a format that the user needs to use when saving arrays for TriangularMatrix and expect the user to conform, however it sounds needlessly complicated and more error-prone. What do you think?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or mute the thread.
|
Yes, in that
Not specifically. |
It sounds as if you would want to keep save_paths(). In this case, can you please add a small test case so that we will at least know when it breaks?
At a minimum please add an example file to the tests and read it and check the expected values so that the test starts failing when the underlying file reading code changes.
A second test where we generate and then read the file would be good (or is this already covered in the existing tests?).
…--
Oliver Beckstein
email: [email protected]
Am Jan 1, 2018 um 14:44 schrieb Sean Seyler ***@***.***>:
Can the files from save_paths() read into any of the functions in the PSA module?
Yes, in that save_paths() is responsible for generating the (fitted) DCDs that can be reused directly since they're numbered and can be dumped into a PSA object easily.
Do we have a test that covers it?
Not specifically.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or mute the thread.
|
@richardjgowers I think the deprecations need to go into 0.17.x. |
That would be super-helpful! Thanks @IAlibay ! |
The save method in water bridge analysis has already been removed. |
@IAlibay when you have a moment, could you check the save methods that were removed in the merged PRs? (If you cannot modify my issue i.e., you cannot click the check marks then let me know, perhaps copy and paste the list into a comment where you can modify). I want to know what needs to be done to close this issue. |
@orbeckst Unfortunately I don't have modify access (I think the settings are set so that this is a core-dev only thing). Here is a copy of the list w/ changes: To be removedCheck methods once they have been removed.
To stayCheck if they are covered by tests
mdanalysis/testsuite/MDAnalysisTests/analysis/test_encore.py Lines 86 to 92 in 0b20ae8
mdanalysis/testsuite/MDAnalysisTests/analysis/test_psa.py Lines 170 to 184 in 0b20ae8
|
Many thanks @IAlibay , I copied the bare information to the top of the issue. Because everything was removed that needed removing I will close the issue. Yay! Thank you so much for doing most of the work! For anything related, please open new issues. Specifically
|
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
.. deprecated:: 0.17.1
saying that thesave()
functionality will be removed in 1.0 because users generally know best how they want to persist the data.DeprecationWarning
save()
method to the docs)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
The text was updated successfully, but these errors were encountered: