paramagpy.fit.qfactor

paramagpy.fit.qfactor(dataArray, ensembleAverage=False, calDenominator=False)[source]

Calculate the Q-factor to judge tensor fit quality

A lower value indicates a better fit. The Q-factor is calculated using the following equation:

\[Q = \sqrt{ \frac{\sum_i\left[\left(\sum_m\left[ PCS^{exp}_{m,i}-PCS^{calc}_{m,i}\right]\right)^2\right]} {\sum_i\left[ \left(\sum_m\left[PCS^{exp}_{m,i}\right]\right)^2\right]} }\]

where \(m\) and \(i\) are usually indexed over models and atoms respectively.

Parameters
  • dataArray (numpy array) – the dataArray must contain the columns ‘exp’, ‘cal’ and ‘idx’ corresponding to the experimenta, calculated and index values respectively. The index value determines the ensemble averaging behaviour, and can be ignored if the argument <ensembleAverage> is False.

  • ensembleAverage (bool, optional) – when False, the q-factor calculation squares each difference independently. When True, the q-factor calculates an ensemble average before taking the square of differences. The ‘idx’ column of the dataArray determines the ensemble averaging behaviour with common indices for atoms between models resulting in their summation.

  • calDenominator (bool, optional) – when False, the standard Q-factor is calculated with only the sum of squares for the experimental values used in the denominator when True, the Q-factor established by Ubbink et al. is calculated which has a sum of absolute values of exp and cal values squared in the denominator.

Returns

qfactor – the Q-factor

Return type

float