MDAnalysis / membrane-curvature

MDAnalysis tool to calculate membrane curvature.
https://membrane-curvature.readthedocs.io/
GNU General Public License v3.0
29 stars 6 forks source link

Initial refactor and test added [Fixes #33] #34

Closed ojeda-e closed 3 years ago

ojeda-e commented 3 years ago

Helps to fix #33. In this first version of the refactored code, the calculation of curvature doesn't evaluate per leaflet, and instead, it runs for a surface defined by selected atoms. (More general)

Changes in this PR:

As suggested here, tests with toy model using pytest.mark.parametrize added:

This PR may also fix

Edit: This PR also fixes #16 .

codecov[bot] commented 3 years ago

Codecov Report

Merging #34 (8569cf0) into main (bf6019b) will increase coverage by 9.39%. The diff coverage is 73.33%.

ojeda-e commented 3 years ago

Thanks for your comments @orbeckst There are two main reasons for all the changes here introduced.

In the spirit of moving forward, I added changes in this PR that wrap up the previous limitations and allows me to progress. If further tests are needed, now with this refactored version providing dummy coordinates will be possible. I feel I haven't made progress because of the tests that have been asked previously, which were going to change no matter what with this PR. If it's better, I can put the big systems tests for two of the functions, mean_curvature and gaussian_curvature, which are essentially the only two functions that remain the same after refactoring.

pep8speaks commented 3 years ago

Hello @ojeda-e! 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! :beers:

Comment last updated at 2021-06-25 03:37:02 UTC
ojeda-e commented 3 years ago

Hi @lilyminium Lily, thanks for your review. Regarding this comment (and below)

Currently core_fast_leaflet does three things:

  • gets positions for each atom in the atom group for each frame
  • identifies the grid cell for each coordinate (currently grid_map)
  • calculates the average z for the atom group

Could you please break this down into three functions, and write a new function that simply calls them (just for the regression tests?) I would be keen to have these as divorced from either MDTraj or MDAnalysis as possible and work only with numpy arrays, which are generally more versatile. The overall function could grab the positions from the AtomGroup and feed it into the functions instead.

If it works for you, I'll add these remarks as new issues instead of adding them in this PR. The changes are getting a bit too long. Would that work? If yes, then it'll be happy to submit a PR with the requested changes.