mailRe: r27219 - /trunk/specific_analyses/relax_disp/api.py


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by Edward d'Auvergne on January 19, 2015 - 10:37:
Hi,

That works, just use RelaxImplementError as in the base API.  That
would be the safest.  An implementation for the R2eff model is
unnecessary.

Regards,

Edward



On 19 January 2015 at 10:31, Troels Emtekær Linnet
<tlinnet@xxxxxxxxxxxxx> wrote:
Hi Edward.

I was wondering to throw an error, if the R2eff model is used with this.

Best
Troels

2015-01-19 10:17 GMT+01:00 Edward d'Auvergne <edward@xxxxxxxxxxxxx>:

Hi Troels,

This still has the same problems with the R2eff model as mentioned at
http://thread.gmane.org/gmane.science.nmr.relax.scm/24963/focus=7490.

Regards,

Edward



On 17 January 2015 at 17:25,  <tlinnet@xxxxxxxxxxxxx> wrote:
Author: tlinnet
Date: Sat Jan 17 17:25:20 2015
New Revision: 27219

URL: http://svn.gna.org/viewcvs/relax?rev=27219&view=rev
Log:
Added API function in relaxation dispersion to return error structure
from the reduced chi2 distribution.

Task #7882 (https://gna.org/task/?7882): Implement Monte-Carlo
simulation, where errors are generated with width of standard deviation 
or
residuals.): Implement Monte-Carlo simulation, where errors are generated
with width of standard deviation or residuals.

Modified:
    trunk/specific_analyses/relax_disp/api.py

Modified: trunk/specific_analyses/relax_disp/api.py
URL:
http://svn.gna.org/viewcvs/relax/trunk/specific_analyses/relax_disp/api.py?rev=27219&r1=27218&r2=27219&view=diff

==============================================================================
--- trunk/specific_analyses/relax_disp/api.py   (original)
+++ trunk/specific_analyses/relax_disp/api.py   Sat Jan 17 17:25:20 2015
@@ -27,7 +27,7 @@
 # Python module imports.
 import bmrblib
 from copy import deepcopy
-from numpy import int32, zeros
+from numpy import int32, sqrt, zeros
 from re import match, search
 import string
 import sys
@@ -1035,6 +1035,44 @@

         # Return the error list.
         return errors
+
+
+    def return_error_red_chi2(self, data_id=None):
+        """Return the standard deviation data structure, where standard
deviation is from the overall gauss distribution described by the 
STD_fit of
the goodness of fit, where STD_fit = sqrt(chi2/(N-p))
+
+        @param data_id: The tuple of the spin container and the
exponential curve identifying key, as yielded by the base_data_loop()
generator method.
+        @type data_id:  SpinContainer instance and float
+        @return:        The standard deviation data structure.
+        @rtype:         list of float
+        """
+
+        # Get the errors structure as above.
+        errors = self.return_error(data_id=data_id)
+
+        # Unpack the data.
+        spin, spin_id = data_id
+
+        # Loop over the spin groupings for the model.
+        for spin_ids in self.model_loop():
+            # If the spin of interest is in the returned spin cluster.
+            if spin_id in spin_ids:
+                # Get the statistics
+                k, n, chi2 = self.model_statistics(model_info=spin_ids)
+
+                # Calculate degrees of freedom.
+                dof = n - k
+
+                # Calculate reduced chi2, or named as the variance of
the squared residuals.
+                red_chi2 = chi2 / float(dof)
+
+                # Calculated the standard deviation.
+                std_red_chi2 = sqrt(red_chi2)
+
+                # Replace values with the stored value.
+                for id in errors:
+                    errors[id] = std_red_chi2
+
+                return errors


     def return_value(self, spin, param, sim=None, bc=False):


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

This is the relax-commits mailing list
relax-commits@xxxxxxx

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

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

This is the relax-devel mailing list
relax-devel@xxxxxxx

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-devel





Related Messages


Powered by MHonArc, Updated Mon Jan 19 11:00:12 2015