Skip to content

Commit

Permalink
Post-PRS: Ruff formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
JHKru committed Sep 30, 2024
1 parent 0278182 commit 373e661
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/springcraft/anm.py
Original file line number Diff line number Diff line change
Expand Up @@ -388,4 +388,4 @@ def prs_eff_sens(self, norm=True):
"""
prs_mat = nma.prs(self, norm)
eff, sens = nma.prs_to_eff_sens(prs_mat)
return prs_mat, eff, sens
return prs_mat, eff, sens
16 changes: 8 additions & 8 deletions src/springcraft/nma.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
"dcc",
"normal_mode",
"linear_response",
"prs",
"prs_to_eff_sens"
"prs",
"prs_to_eff_sens",
]

import numpy as np
Expand Down Expand Up @@ -472,18 +472,17 @@ def linear_response(anm, force):

return np.dot(anm.covariance, force).reshape(len(anm._coord), 3)


def prs(anm, norm=True):
"""
Compute the perturbation response matrix following
Atilgan et al.
"""
from .anm import ANM

if not isinstance(anm, ANM):
raise ValueError(
"Instance of ANM class expected."
)

raise ValueError("Instance of ANM class expected.")

cov = anm.covariance
dim_3n = cov.shape[0]
# Maybe better to add coord as attributes
Expand All @@ -500,6 +499,7 @@ def prs(anm, norm=True):
prs_mat = prs_mat / prs_mat_ii
return prs_mat


def prs_to_eff_sens(prs_mat):
"""
Compute effector/sensor residues according to the PRS-Matrix
Expand All @@ -509,4 +509,4 @@ def prs_to_eff_sens(prs_mat):
diag_zero = 1 - np.eye(len(prs_mat))
eff = np.average(prs_mat, weights=diag_zero, axis=1)
sens = np.average(prs_mat, weights=diag_zero, axis=0)
return eff, sens
return eff, sens

0 comments on commit 373e661

Please sign in to comment.