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
RFC: Handle classes without save_results
#17
Conversation
Honestly, I don't see it this way. I think pickling objects will disrupt the whole purpose of the project in the first place. In my view, MDACLI aims to bridge MDAnalysis to less programmatic users, or facilitate operations for everyone, or to allow piping sequential workflows. Hence, once the pickle object is created, what is the user to do with ti? The user will need to go the Python prompt again, import pickle, unpickle, go to MDAnalsysis documentation, look for the needed method, extract the data, and finally use it. A user that can do all this labyrinthic process will actually scripting the MDAnalysis whole way and won't use MDACLI. Pickle does serve piping though. This has been a recurrent thought in my mind for the last months. I see two possibilities:
All and all, I truly believe that MDACLI's output should be a So answering your question: For the long term, No. For the time being and as an additional output format, Yes. So, I believe your PR is very valuable. But we should maintain this discussion active. I will wait for your thoughts before merging. Let me know you think. |
Do you have a specification document of what you would like the MDA AnalysisBase API to look like, from MDACLI's perspective? This would help focus the discussion. Here are some possible approaches that I can think of: Reserved attribute namesFor example, should Trailing underscore attributes (sklearn-style)In scikit-learn, computed variables get an underscore affixed (e.g. Flexible annotationOr should there be a more flexible approach where we might have an attribute that marks up important "Result attributes" e.g. "OUTPUT" for anything that is always computed after self._annotation = {'results': 'OUTPUT', 'times': 'OUTPUT', 'count_by_type': 'OPTIONAL'} Then MDACLI can find anything that's 'OUTPUT' and use There's certainly a better way to do this but you get the idea. |
c5718a9
to
8401823
Compare
I added a saving routine that uses the results of the new MDAnalysis Results class. Currently the test will fail and one can not test the code. I will add additional test cases and streamline the code when Please comment if the code is readable and the output structure seems reasonable. |
If an analysis class have no save_results function we simply dump a pickel file with the name of the class.
Also adds execution command to save CSV. Only saves JSON if dict has length. All new code was provided by Philip. Co-authored-by: Philip Loche <ploche@physik.fu-berlin.de>
Hello @PicoCentauri! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found: There are currently no PEP 8 issues detected in this Pull Request. Cheers! 🍻 Comment last updated at 2021-05-20 22:51:30 UTC |
I added a test for the cli. |
@PicoCentauri |
Improves docstring General improvements cleaning Saves ndim > 3 to npz TODO: - some refact on save_results - some testing
TODO: * lint * tests
before attempting mdacli saving engine. Co-authored-by: Philip Loche <ploche@physik.fu-berlin.de>
correct json saving command
Functional refactoring of save branch
If an analysis class have no save_results function we simply dump a
pickel file with the name of the class.
What do you think about this @joaomcteixeira?