Skip to content
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

Finalizing #2537 #2616

Merged
merged 3 commits into from
Mar 15, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions package/CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ The rules for this file:
------------------------------------------------------------------------------
mm/dd/yy richardjgowers, kain88-de, lilyminium, p-j-smith, bdice, joaomcteixeira,
PicoCentauri, davidercruz, jbarnoud, RMeli, IAlibay, mtiberti, CCook96,
Yuan-Yu, xiki-tempula, orbeckst
Yuan-Yu, xiki-tempula, orbeckst, wvandertoorn
wvdtoorn marked this conversation as resolved.
Show resolved Hide resolved

* 0.21.0

Expand All @@ -25,15 +25,15 @@ Fixes
* Handle exception when PDBWriter is trying to remove an invalid StringIO
(Issue #2512)
* Clarifies density_from_Universe docs and adds user warning (Issue #2372)
* Fix upstream deprecation of `matplotlib.axis.Tick` attributes in
* Fix upstream deprecation of `matplotlib.axis.Tick` attributes in
wvdtoorn marked this conversation as resolved.
Show resolved Hide resolved
`MDAnalysis.analysis.psa`
* PDBWriter now uses first character of segid as ChainID (Issue #2224)
* Adds a more detailed warning when attempting to read chamber-style parm7
files (Issue #2475)
* ClusterCollection.get_ids now returns correctly (Issue #2464)
* Removes files for stubs mainly introduced in 0.11.0 (Issue #2443)
* Removes support for reading AMBER NetCDF files with `cell_angle` units set
to `degrees` instead of the convention agreed `degree` (Issue #2327).
to `degrees` instead of the convention agreed `degree` (Issue #2327).
* Removes the MassWeight option from gnm (PR #2479).
* AtomGroup.guess_bonds now uses periodic boundary information when available
(Issue #2350)
Expand Down Expand Up @@ -91,15 +91,15 @@ Changes
Segment.r1, Universe.s4AKE). Use select_atoms instead (Issue #1377)
* Calling Universe() now raises a TypeError advising you to use Universe.empty.
Universe.empty() now no longer has n_atoms=0 as default. (Issue #2527)
* deprecated `start`, `stop`, and `step` keywords have been removed from `__init__`
in :class:`AnalysisBase`. These should now be called in :meth:`AnalysisBase.run`
* deprecated `start`, `stop`, and `step` keywords have been removed from `__init__`
in :class:`AnalysisBase`. These should now be called in :meth:`AnalysisBase.run`
(Issue #1463)
* Standardize `select` keyword by removing `selection`, `atomselection`
and `ref_select` (Issue #2461, Issue #2530)
* Removes support for setting `start`/`stop`/`step` trajecotry slicing
keywords on :class:`HOLEtraj` construction. Also removes undocumented
support for passing :class:`HOLE` parameters to :meth:`HOLEtraj.run`
(Issue #2513).
(Issue #2513).
* Removes the `nproc` keyword from
:class:`Waterdynamics.HydrogenBondLifetimes` as the multiprocessing functionality
did not work in some cases(Issues #2511).
Expand Down
3 changes: 3 additions & 0 deletions package/MDAnalysis/analysis/density.py
Original file line number Diff line number Diff line change
Expand Up @@ -1264,6 +1264,9 @@ def Bfactor2RMSF(B):
----------

.. [Willis1975] BTM Willis and AW Pryor. *Thermal vibrations in crystallography*. Cambridge Univ. Press, 1975


.. deprecated:: 1.0.0
IAlibay marked this conversation as resolved.
Show resolved Hide resolved
IAlibay marked this conversation as resolved.
Show resolved Hide resolved
"""
return np.sqrt(3. * B / 8.) / np.pi

Expand Down
29 changes: 28 additions & 1 deletion testsuite/MDAnalysisTests/analysis/test_density.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@
from MDAnalysis.analysis import density

from MDAnalysisTests.datafiles import TPR, XTC, GRO, PDB_full
from unittest.mock import Mock, patch
from MDAnalysisTests.util import block_import


class TestDensity(object):
Expand Down Expand Up @@ -452,9 +454,34 @@ def test_density_from_PDB(self, sigma, ref_shape, ref_gridsum):

assert isinstance(D, density.Density)
assert_equal(D.grid.shape, ref_shape)
assert_almost_equal(D.grid.sum(), ref_gridsum, decimal=6)
assert_almost_equal(D.grid.sum(), ref_gridsum, decimal=5)

def test_has_DeprecationWarning(self):
with pytest.warns(DeprecationWarning,
match="will be removed in release 2.0.0"):
density.density_from_PDB(PDB_full, delta=5.0, sigma=2)

class TestGridImport(object):

@block_import('gridData')
def test_absence_griddata(self):
sys.modules.pop('MDAnalysis.analysis.density', None)
# if gridData package is missing an ImportError should be raised
# at the module level of MDAnalysis.analysis.density
with pytest.raises(ImportError):
import MDAnalysis.analysis.density

def test_presence_griddata(self):
sys.modules.pop('MDAnalysis.analysis.density', None)
# no ImportError exception is raised when gridData is properly
# imported by MDAnalysis.analysis.density

# mock gridData in case there are testing scenarios where
# it is not available
mock = Mock()
with patch.dict('sys.modules', {'gridData':mock}):
try:
import MDAnalysis.analysis.density
except ImportError:
pytest.fail(msg='''MDAnalysis.analysis.density should not raise
an ImportError if gridData is available.''')