Package maths_fns :: Module mf :: Class Mf
[hide private]
[frames] | no frames]

Class Mf

source code

Instance Methods [hide private]
 
__init__(self, init_params=None, model_type=None, diff_type=None, diff_params=None, scaling_matrix=None, num_spins=None, equations=None, param_types=None, param_values=None, relax_data=None, errors=None, bond_length=None, csa=None, num_frq=0, frq=None, num_ri=None, remap_table=None, noe_r1_table=None, ri_labels=None, gx=0, gh=0, h_bar=0, mu0=0, num_params=None, vectors=None)
The model-free minimisation class.
source code
 
func_mf(self, params)
Function for calculating the chi-squared value.
source code
 
func_local_tm(self, params)
Function for calculating the chi-squared value.
source code
 
func_diff(self, params)
Function for calculating the chi-squared value.
source code
 
func_all(self, params)
Function for calculating the chi-squared value.
source code
 
dfunc_mf(self, params)
Function for calculating the chi-squared gradient.
source code
 
dfunc_local_tm(self, params)
Function for calculating the chi-squared gradient.
source code
 
dfunc_diff(self, params)
Function for calculating the chi-squared gradient.
source code
 
dfunc_all(self, params)
Function for calculating the chi-squared gradient.
source code
 
d2func_mf(self, params)
Function for calculating the chi-squared Hessian.
source code
 
d2func_local_tm(self, params)
Function for calculating the chi-squared Hessian.
source code
 
d2func_diff(self, params)
Function for calculating the chi-squared Hessian.
source code
 
d2func_all(self, params)
Function for calculating the chi-squared Hessian.
source code
 
calc_ri(self)
Function for calculating relaxation values.
source code
 
init_diff_data(self, diff_data)
Function for the initialisation of diffusion tensor specific data.
source code
 
init_res_data(self, data, diff_data)
Function for the initialisation of the residue specific data.
source code
 
init_res_r1_data(self, data)
Function for initialisation of the R1 data class.
source code
 
lm_dri(self)
Return the function used for Levenberg-Marquardt minimisation.
source code
 
setup_equations(self, data)
Setup all the residue specific equations.
source code
Method Details [hide private]

__init__(self, init_params=None, model_type=None, diff_type=None, diff_params=None, scaling_matrix=None, num_spins=None, equations=None, param_types=None, param_values=None, relax_data=None, errors=None, bond_length=None, csa=None, num_frq=0, frq=None, num_ri=None, remap_table=None, noe_r1_table=None, ri_labels=None, gx=0, gh=0, h_bar=0, mu0=0, num_params=None, vectors=None)
(Constructor)

source code 

The model-free minimisation class.

This class should be initialised before every calculation.

Arguments

equation: The model-free equation string which should be either 'mf_orig' or 'mf_ext'.

param_types: An array of the parameter types used in minimisation.

relax_data: An array containing the experimental relaxation values.

errors: An array containing the experimental errors.

bond_length: The fixed bond length in meters.

csa: The fixed CSA value.

diff_type: The diffusion tensor string which should be either 'sphere', 'spheroid', or 'ellipsoid'.

diff_params: An array with the diffusion parameters.

scaling_matrix: A diagonal matrix of scaling factors.

Additional layer of equations to simplify the relaxation equations, gradients, and Hessians.

The R1 and R2 equations are left alone, while the NOE is calculated from the R1 and sigma_noe values.

The relaxation equations

Data structure: data.ri Dimension: 1D, (relaxation data) Type: numpy, float64 Dependencies: data.ri_prime Required by: data.chi2, data.dchi2, data.d2chi2

The equations are:

   R1()  =  R1'()


   R2()  =  R2'()

                  gH   sigma_noe()
   NOE()  =  1 +  -- . -----------
                  gN      R1()

The relaxation gradients

Data structure: data.dri Dimension: 2D, (parameters, relaxation data) Type: numpy array, float64 Dependencies: data.ri_prime, data.dri_prime Required by: data.dchi2, data.d2chi2

The equations are:

    dR1()       dR1'()
   -------  =  -------
   dthetaj     dthetaj


    dR2()       dR2'()
   -------  =  -------
   dthetaj     dthetaj


    dNOE()     gH      1      /        dsigma_noe()                    dR1()  \ 
   -------  =  -- . ------- . | R1() . ------------  -  sigma_noe() . ------- |
   dthetaj     gN   R1()**2   \          dthetaj                      dthetaj /

The relaxation Hessians

Data structure: data.d2ri Dimension: 3D, (parameters, parameters, relaxation data) Type: numpy array, float64 Dependencies: data.ri_prime, data.dri_prime, data.d2ri_prime Required by: data.d2chi2

The equations are:

        d2R1()             d2R1'()
   ---------------  =  ---------------
   dthetai.dthetaj     dthetai.dthetaj


        d2R2()             d2R2'()
   ---------------  =  ---------------
   dthetai.dthetaj     dthetai.dthetaj


       d2NOE()         gH      1      /               /      dR1()     dR1()                  d2R1()     \ 
   ---------------  =  -- . ------- . | sigma_noe() . | 2 . ------- . -------  -  R1() . --------------- |
   dthetai.dthetaj     gN   R1()**3   \               \     dthetai   dthetaj            dthetai.dthetaj /

                / dsigma_noe()    dR1()       dR1()    dsigma_noe()             d2sigma_noe()  \ \ 
       - R1() . | ------------ . -------  +  ------- . ------------  -  R1() . --------------- | |
                \   dthetai      dthetaj     dthetai     dthetaj               dthetai.dthetaj / /

The chi-sqared equation

The equation is:

           _n_
           \    (Ri - Ri()) ** 2
   chi2  =  >   ----------------
           /__    sigma_i ** 2
           i=1

where:

  • Ri are the values of the measured relaxation data set.
  • Ri() are the values of the back calculated relaxation data set.
  • sigma_i are the values of the error set.

The chi-sqared gradient

The equation is:

                  _n_
    dchi2         \   /  Ri - Ri()      dRi()  \ 
   -------  =  -2  >  | ----------  .  ------- |
   dthetaj        /__ \ sigma_i**2     dthetaj /
                  i=1

where:

  • Ri are the values of the measured relaxation data set.
  • Ri() are the values of the back calculated relaxation data set.
  • sigma_i are the values of the error set.

The chi-sqared Hessian

The equation is:

                        _n_
        d2chi2          \       1      /  dRi()     dRi()                         d2Ri()     \ 
   ---------------  = 2  >  ---------- | ------- . -------  -  (Ri - Ri()) . --------------- |
   dthetaj.dthetak      /__ sigma_i**2 \ dthetaj   dthetak                   dthetaj.dthetak /
                        i=1

where:

  • Ri are the values of the measured relaxation data set.
  • Ri() are the values of the back calculated relaxation data set.
  • sigma_i are the values of the error set.

func_mf(self, params)

source code 

Function for calculating the chi-squared value.

Used in the minimisation of model-free parameters for a single residue.

func_local_tm(self, params)

source code 

Function for calculating the chi-squared value.

Used in the minimisation of model-free parameters for a single residue with a local tm.

func_diff(self, params)

source code 

Function for calculating the chi-squared value.

Used in the minimisation of diffusion tensor parameters with all model-free parameters fixed.

func_all(self, params)

source code 

Function for calculating the chi-squared value.

Used in the minimisation of diffusion tensor parameters together with all model-free parameters.

dfunc_mf(self, params)

source code 

Function for calculating the chi-squared gradient.

Used in the minimisation of model-free parameters for a single residue.

dfunc_local_tm(self, params)

source code 

Function for calculating the chi-squared gradient.

Used in the minimisation of model-free parameters for a single residue with a local tm.

dfunc_diff(self, params)

source code 

Function for calculating the chi-squared gradient.

Used in the minimisation of diffusion tensor parameters with all model-free parameters fixed.

dfunc_all(self, params)

source code 

Function for calculating the chi-squared gradient.

Used in the minimisation of diffusion tensor parameters together with all model-free parameters.

d2func_mf(self, params)

source code 

Function for calculating the chi-squared Hessian.

Used in the minimisation of model-free parameters for a single residue.

d2func_local_tm(self, params)

source code 

Function for calculating the chi-squared Hessian.

Used in the minimisation of model-free parameters for a single residue with a local tm.

d2func_diff(self, params)

source code 

Function for calculating the chi-squared Hessian.

Used in the minimisation of diffusion tensor parameters with all model-free parameters fixed.

d2func_all(self, params)

source code 

Function for calculating the chi-squared Hessian.

Used in the minimisation of diffusion tensor parameters together with all model-free parameters.

init_res_r1_data(self, data)

source code 

Function for initialisation of the R1 data class.

This data class is only used if an NOE data set is collected but no R1 data set corresponding to the same frequency exists.