Author: bugman
Date: Thu Feb  5 17:41:31 2015
New Revision: 27553

URL: http://svn.gna.org/viewcvs/relax?rev=27553&view=rev
Log:
Implemented the backend of the statistics.model user function.

The implementation heavily uses the specific analysis API, calling the 
calculate(), model_loop(),
print_model_title(), model_statistics() and get_model_container() methods to do 
all of the work.
The last of these API methods is yet to be implemented.


Modified:
    trunk/pipe_control/statistics.py
    trunk/user_functions/statistics.py

Modified: trunk/pipe_control/statistics.py
URL: 
http://svn.gna.org/viewcvs/relax/trunk/pipe_control/statistics.py?rev=27553&r1=27552&r2=27553&view=diff
==============================================================================
--- trunk/pipe_control/statistics.py    (original)
+++ trunk/pipe_control/statistics.py    Thu Feb  5 17:41:31 2015
@@ -22,4 +22,37 @@
 # Module docstring.
 """Module for handling statistics."""
 
+# relax module imports.
+from pipe_control.pipes import check_pipe
+from specific_analyses.api import return_api
 
+
+def model_statistics():
+    """Calculate and store the model statistics."""
+
+    # Checks.
+    check_pipe()
+
+    # The specific analysis API object.
+    api = return_api()
+
+    # Calculate the chi2.
+    print("Calculating the chi-squared value for the current parameter 
values.")
+    api.calculate()
+
+    # Loop over the base models.
+    print("\nStoring the model statistics.")
+    for model_info in api.model_loop():
+        # Printout.
+        api.print_model_title(model_info)
+
+        # Get the model statistics.
+        k, n, chi2 = api.model_statistics(model_info)
+
+        # The model container.
+        container = api.get_model_container(model_info)
+
+        # Store the values.
+        container.chi2 = chi2
+        container.num_params = k
+        container.num_data_points = n

Modified: trunk/user_functions/statistics.py
URL: 
http://svn.gna.org/viewcvs/relax/trunk/user_functions/statistics.py?rev=27553&r1=27552&r2=27553&view=diff
==============================================================================
--- trunk/user_functions/statistics.py  (original)
+++ trunk/user_functions/statistics.py  Thu Feb  5 17:41:31 2015
@@ -24,6 +24,7 @@
 
 # relax module imports.
 from graphics import WIZARD_IMAGE_PATH
+from pipe_control.statistics import model_statistics
 from user_functions.data import Uf_info; uf_info = Uf_info()
 from user_functions.objects import Desc_container
 
@@ -42,7 +43,7 @@
 # Description.
 uf.desc.append(Desc_container())
 uf.desc[-1].add_paragraph("This will perform a back-calculation to obtain the 
chi-squared statistic for the current parameter values, count the number of 
parameters and data points per model, and place all the values in the relax 
data store.")
-uf.backend = ()
+uf.backend = model_statistics
 uf.menu_text = "&model"
 uf.gui_icon = "oxygen.categories.applications-education"
 uf.wizard_apply_button = False


_______________________________________________
relax (http://www.nmr-relax.com)

This is the relax-commits mailing list
relax-commits@gna.org

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

Reply via email to