Author: bugman
Date: Thu Feb 5 14:06:39 2015
New Revision: 27542
URL: http://svn.gna.org/viewcvs/relax?rev=27542&view=rev
Log:
Created the N_state_model.test_statistics system test.
This system test will be used to implement the new statistics user function
class consisting of the
structure.model and structure.aic user functions for calculating and storing
the [chi2, n, k]
parameters and Akaike's Information Criterion statistic respectively.
Modified:
trunk/test_suite/system_tests/n_state_model.py
Modified: trunk/test_suite/system_tests/n_state_model.py
URL:
http://svn.gna.org/viewcvs/relax/trunk/test_suite/system_tests/n_state_model.py?rev=27542&r1=27541&r2=27542&view=diff
==============================================================================
--- trunk/test_suite/system_tests/n_state_model.py (original)
+++ trunk/test_suite/system_tests/n_state_model.py Thu Feb 5 14:06:39 2015
@@ -1,6 +1,6 @@
###############################################################################
# #
-# Copyright (C) 2008-2014 Edward d'Auvergne #
+# Copyright (C) 2008-2015 Edward d'Auvergne #
# Copyright (C) 2013-2014 Troels E. Linnet #
# #
# This file is part of the program relax (http://www.nmr-relax.com). #
@@ -1033,6 +1033,47 @@
self.script_exec(status.install_path +
sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'n_state_model'+sep+'rdc_tensor.py')
+ def test_statistics(self):
+ """Test the statistics user functions for the N-state model.
+
+ This uses the 4-state model analysis of lactose using RDCs and PCSs.
+ """
+
+ # Execute the script.
+ self.script_exec(status.install_path +
sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'n_state_model'+sep+'lactose_n_state.py')
+
+ # Test the optimised chi-squared, then delete the variable.
+ self.assertAlmostEqual(cdp.chi2, 1051728.8810718122)
+ del cdp.chi2
+
+
+ # Statistics at the solution and off the solution.
+ dy_tensor = [
+ (-1.809863649202e-05, 1.706576149818e-05, -7.790951217246e-06,
-1.314676121261e-05, 4.526806452559e-08),
+ (10.0e-05, 1.706576149818e-05, -7.790951217246e-06,
-1.314676121261e-05, 4.526806452559e-08),
+ ]
+ chi2 = [1051728.8810718122, 5927446.9030144978]
+ k = 5*4
+ n = 22*4 + 10*4
+
+ # Loop over the solution and non-solution.
+ for i in range(2):
+ # Reset the Dy tensor.
+ self.interpreter.align_tensor.init(tensor='Dy', align_id='Dy',
params=dy_tensor[i], param_types=3)
+
+ # Calculate the statistics.
+ self.interpreter.statistics.model()
+
+ # Checks.
+ self.assertAlmostEqual(cdp.chi2, chi2[i])
+ self.assertAlmostEqual(cdp.num_params, k)
+ self.assertAlmostEqual(cdp.num_data_points, n)
+
+ # Test the AIC statistic.
+ self.interpreter.statistics.aic()
+ self.assertAlmostEqual(cdp.aic, chi2[i]+2.0*k)
+
+
def test_stereochem_analysis(self):
"""The full relative stereochemistry analysis."""
_______________________________________________
relax (http://www.nmr-relax.com)
This is the relax-commits mailing list
[email protected]
To unsubscribe from this list, get a password
reminder, or change your subscription options,
visit the list information page at
https://mail.gna.org/listinfo/relax-commits