Skip to content
Merged
1 change: 1 addition & 0 deletions package/AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,7 @@ Chronological list of authors
- Raúl Lois-Cuns
- Pranay Pelapkar
- Shreejan Dolai
- Tanisha Dubey

External code
-------------
Expand Down
2 changes: 1 addition & 1 deletion package/CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ The rules for this file:

-------------------------------------------------------------------------------
??/??/?? IAlibay, orbeckst, marinegor, tylerjereddy, ljwoods2, marinegor,
spyke7, talagayev
spyke7, talagayev, tanii1125

* 2.11.0

Expand Down
9 changes: 3 additions & 6 deletions package/MDAnalysis/analysis/msd.py
Original file line number Diff line number Diff line change
Expand Up @@ -382,14 +382,11 @@ def _parse_msd_type(self):
"xyz": [0, 1, 2],
}

self.msd_type = self.msd_type.lower()

try:
self._dim = keys[self.msd_type]
except KeyError:
self._dim = keys[self.msd_type.lower()]
except (AttributeError, KeyError):
raise ValueError(
"invalid msd_type: {} specified, please specify one of xyz, "
"xy, xz, yz, x, y, z".format(self.msd_type)
f"Invalid msd_type {self.msd_type}, must be a string and one of: xyz, xy, xz, yz, x, y, z"
)

self.dim_fac = len(self._dim)
Expand Down
6 changes: 4 additions & 2 deletions testsuite/MDAnalysisTests/analysis/test_msd.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,11 @@ def test_updating_ag_rejected(self, u):
with pytest.raises(TypeError, match=errmsg):
m = MSD(updating_ag, msd_type="xyz", fft=False)

@pytest.mark.parametrize("msdtype", ["foo", "bar", "yx", "zyx"])
@pytest.mark.parametrize(
"msdtype", ["foo", "bar", "yx", "zyx", 123, "", " xy "]
)
def test_msdtype_error(self, u, SELECTION, msdtype):
errmsg = f"invalid msd_type: {msdtype}"
errmsg = f"Invalid msd_type {msdtype}, must be a string and one of: xyz, xy, xz, yz, x, y, z"
with pytest.raises(ValueError, match=errmsg):
m = MSD(u, SELECTION, msd_type=msdtype)

Expand Down
Loading