Skip to content

Commit

Permalink
add abs option to showOverlap
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesmkrieger committed Nov 21, 2024
1 parent 910e333 commit adc11bd
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions prody/dynamics/plotting.py
Original file line number Diff line number Diff line change
Expand Up @@ -1132,6 +1132,9 @@ def showOverlap(mode, modes, *args, **kwargs):
:arg modes: multiple modes
:type modes: :class:`.ModeSet`, :class:`.ANM`, :class:`.GNM`, :class:`.PCA`
:arg abs: whether to take absolute values
:type abs: bool
"""

import matplotlib.pyplot as plt
Expand All @@ -1149,9 +1152,16 @@ def showOverlap(mode, modes, *args, **kwargs):
.format(type(modes)))

if mode.numModes() > 1:
overlap = abs(calcOverlap(mode, modes, diag=True))
overlap = calcOverlap(mode, modes, diag=True)
else:
overlap = abs(calcOverlap(mode, modes, diag=False))
overlap = calcOverlap(mode, modes, diag=False)

take_abs = kwargs.pop('abs', True)
if not isinstance(take_abs, bool):
raise TypeError('abs should be a Boolean (True or False)')

if take_abs:
overlap = abs(overlap)

if isinstance(modes, NMA):
arange = np.arange(len(modes)) + 1
Expand Down

0 comments on commit adc11bd

Please sign in to comment.