From 6ca31da4db5ba4ddf5f5cea48616b9c339d3f210 Mon Sep 17 00:00:00 2001 From: Patrick Kunzmann Date: Wed, 2 Nov 2022 17:38:54 +0100 Subject: [PATCH] Fix formula in docstring --- src/springcraft/anm.py | 41 ++++++++++++++++++++++------------------- src/springcraft/gnm.py | 41 ++++++++++++++++++++++------------------- src/springcraft/nma.py | 8 ++++---- 3 files changed, 48 insertions(+), 42 deletions(-) diff --git a/src/springcraft/anm.py b/src/springcraft/anm.py index ee435c6..03657da 100644 --- a/src/springcraft/anm.py +++ b/src/springcraft/anm.py @@ -326,24 +326,9 @@ def bfactor(self, mode_subset=None, tem=None, ) def dcc(self, mode_subset=None, norm=True, tem=None, tem_factors=K_B): - """ + r""" Computes the normalized *dynamic cross-correlation* between - nodes of the ANM. The DCC for a nodepair :math:`ij` is computed as: - - .. math:: - - DCC_{ij} = \frac{3 k_B T}{\gamme} \sum_k^L \left[ \frac{\vec{u}_k \cdot \vec{u}_k^T}{\lambda_k} \right]_{ij} - - with :math:`\lambda` and :math:`\vec{u}` as - Eigenvalues and Eigenvectors corresponding to mode :math:`k` of - the modeset :math:`L`. - - DCCs can be normalized to MSFs exhibited by two compared nodes - following: - - .. math:: - - nDCC_{ij} = \frac{DCC_{ij}}{[\DCC_{ii} DCC_{jj}]^{1/2}} + nodes of the ANM. The DCC is a measure for the correlation in fluctuations exhibited by a given pair of nodes. If normalized, pairs with @@ -351,7 +336,6 @@ def dcc(self, mode_subset=None, norm=True, tem=None, tem_factors=K_B): anticorrelated fluctuations (opposite phase, same period) and non-correlated fluctuations are assigned (normalized) DCC values of 1, -1 and 0 respectively. - For results consistent with MSFs, temperature-weighted absolute values can be computed (only relevant if results are not normalized). @@ -374,12 +358,31 @@ def dcc(self, mode_subset=None, norm=True, tem=None, tem_factors=K_B): If tem is None, no temperature scaling is conducted. tem_factors : int, float, optional Factors included in temperature weighting - (with K_B as preset). + (with :math:`k_B` as preset). Returns ------- dcc : ndarray, shape=(n, n), dtype=float DCC values for ENM nodes. + + Notes + ----- + The DCC for a nodepair :math:`ij` is computed as: + + .. math:: + + DCC_{ij} = \frac{3 k_B T}{\gamma} \sum_k^L \left[ \frac{\vec{u}_k \cdot \vec{u}_k^T}{\lambda_k} \right]_{ij} + + with :math:`\lambda` and :math:`\vec{u}` as + Eigenvalues and Eigenvectors corresponding to mode :math:`k` of + the modeset :math:`L`. + + DCCs can be normalized to MSFs exhibited by two compared nodes + following: + + .. math:: + + nDCC_{ij} = \frac{DCC_{ij}}{[DCC_{ii} DCC_{jj}]^{1/2}} """ return nma.dcc( self, mode_subset, norm, tem, tem_factors diff --git a/src/springcraft/gnm.py b/src/springcraft/gnm.py index edb5df3..59a82a4 100644 --- a/src/springcraft/gnm.py +++ b/src/springcraft/gnm.py @@ -245,24 +245,9 @@ def bfactor(self, mode_subset=None, tem=None, ) def dcc(self, mode_subset=None, norm=True, tem=None, tem_factors=K_B): - """ + r""" Computes the normalized *dynamic cross-correlation* between - nodes of the GNM. The DCC for a nodepair :math:`ij` is computed as: - - .. math:: - - DCC_{ij} = \frac{3 k_B T}{\gamme} \sum_k^L \left[ \frac{\vec{u}_k \cdot \vec{u}_k^T}{\lambda_k} \right]_{ij} - - with :math:`\lambda`. and :math:`\vec{u}`. as - Eigenvalues and Eigenvectors corresponding to mode :math:`k`. of - the modeset :math:`L`. - - DCCs can be normalized to MSFs exhibited by two compared nodes - following: - - .. math:: - - nDCC_{ij} = \frac{DCC_{ij}}{[\DCC_{ii} DCC_{jj}]^{1/2}} + nodes of the GNM. The DCC is a measure for the correlation in fluctuations exhibited by a given pair of nodes. If normalized, pairs with @@ -270,7 +255,6 @@ def dcc(self, mode_subset=None, norm=True, tem=None, tem_factors=K_B): anticorrelated fluctuations (opposite phase, same period) and non-correlated fluctuations are assigned (normalized) DCC values of 1, -1 and 0 respectively. - For results consistent with MSFs, temperature-weighted absolute values can be computed (only relevant if results are not normalized). @@ -293,12 +277,31 @@ def dcc(self, mode_subset=None, norm=True, tem=None, tem_factors=K_B): If tem is None, no temperature scaling is conducted. tem_factors : int, float, optional Factors included in temperature weighting - (with K_B as preset). + (with :math:`k_B` as preset). Returns ------- dcc : ndarray, shape=(n, n), dtype=float DCC values for ENM nodes. + + Notes + ----- + The DCC for a nodepair :math:`ij` is computed as: + + .. math:: + + DCC_{ij} = \frac{3 k_B T}{\gamma} \sum_k^L \left[ \frac{\vec{u}_k \cdot \vec{u}_k^T}{\lambda_k} \right]_{ij} + + with :math:`\lambda` and :math:`\vec{u}` as + Eigenvalues and Eigenvectors corresponding to mode :math:`k` of + the modeset :math:`L`. + + DCCs can be normalized to MSFs exhibited by two compared nodes + following: + + .. math:: + + nDCC_{ij} = \frac{DCC_{ij}}{[DCC_{ii} DCC_{jj}]^{1/2}} """ return nma.dcc( self, mode_subset, norm, tem, tem_factors diff --git a/src/springcraft/nma.py b/src/springcraft/nma.py index b9af005..24bc9cf 100644 --- a/src/springcraft/nma.py +++ b/src/springcraft/nma.py @@ -229,7 +229,7 @@ def bfactor(enm, mode_subset=None, tem=None, return b_factors def dcc(enm, mode_subset=None, norm=True, tem=None, tem_factors=K_B): - """ + r""" Computes the normalized *dynamic cross-correlation* between nodes of the GNM/ANM. @@ -254,7 +254,7 @@ def dcc(enm, mode_subset=None, norm=True, tem=None, tem_factors=K_B): If tem is None, no temperature scaling is conducted. tem_factors : int, float, optional Factors included in temperature weighting - (with K_B as preset). + (with :math:`k_B` as preset). Returns ------- @@ -268,7 +268,7 @@ def dcc(enm, mode_subset=None, norm=True, tem=None, tem_factors=K_B): .. math:: - DCC_{ij} = \frac{3 k_B T}{\gamme} \sum_k^L \left[ \frac{\vec{u}_k \cdot \vec{u}_k^T}{\lambda_k} \right]_{ij} + DCC_{ij} = \frac{3 k_B T}{\gamma} \sum_k^L \left[ \frac{\vec{u}_k \cdot \vec{u}_k^T}{\lambda_k} \right]_{ij} with :math:`\lambda` and :math:`\vec{u}` as Eigenvalues and Eigenvectors corresponding to mode :math:`k` of @@ -279,7 +279,7 @@ def dcc(enm, mode_subset=None, norm=True, tem=None, tem_factors=K_B): .. math:: - nDCC_{ij} = \frac{DCC_{ij}}{[\DCC_{ii} DCC_{jj}]^{1/2}} + nDCC_{ij} = \frac{DCC_{ij}}{[DCC_{ii} DCC_{jj}]^{1/2}} """ from .gnm import GNM from .anm import ANM