Skip to content

Commit

Permalink
Fixed error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
jdetle committed Jul 10, 2016
1 parent 023408d commit 40eb01c
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions package/MDAnalysis/analysis/rms.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
import matplotlib.pyplot as plt
rmsd = R.rmsd.T # transpose makes it easier for plotting
time = rmsd[1]facebook.com
time = rmsd[1]
fig = plt.figure(figsize=(4,4))
ax = fig.add_subplot(111)
ax.plot(time, rmsd[2], 'k-', label="all")
Expand Down Expand Up @@ -351,12 +351,13 @@ def __init__(self, traj, reference=None, select='all',
self.ref_atoms = self.reference.select_atoms(*self.select['reference'])
self.traj_atoms = self.universe.select_atoms(*self.select['mobile'])
if len(self.ref_atoms) != len(self.traj_atoms):
logger.exception('SelectionError: ref_atoms, traj_atoms unequal')
raise SelectionError("Reference and trajectory atom selections do "
errmsg = "Reference and trajectory atom selections do "
"not contain the same number of atoms: "
"N_ref={0:d}, N_traj={1:d}".format(
self.ref_atoms.n_atoms,
self.traj_atoms.n_atoms))
self.traj_atoms.n_atoms)
logger.exception(errmsg)
raise SelectionError(errormsg)
logger.info("RMS calculation for {0:d} atoms.".format(len(self.ref_atoms)))
mass_mismatches = (np.absolute(self.ref_atoms.masses - self.traj_atoms.masses) > self.tol_mass)
if np.any(mass_mismatches):
Expand All @@ -366,7 +367,8 @@ def __init__(self, traj, reference=None, select='all',
if ar.name != at.name:
logger.error("{0!s:>4} {1:3d} {2!s:>3} {3!s:>3} {4:6.3f} | {5!s:>4} {6:3d} {7!s:>3} {8!s:>3} {9:6.3f}".format(ar.segid, ar.resid, ar.resname, ar.name, ar.mass,
at.segid, at.resid, at.resname, at.name, at.mass))
errmsg = "Inconsistent selections, masses differ by more than {0:f}; mis-matching atoms are shown above.".format( \
errmsg = "Inconsistent selections, masses differ by more than"
+ "{0:f}; mis-matching atoms are shown above.".format(
self.tol_mass)
logger.error(errmsg)
raise SelectionError(errmsg)
Expand Down

0 comments on commit 40eb01c

Please sign in to comment.