mailr17293 - in /branches/frame_order_testing: specific_fns/frame_order.py user_functions/frame_order.py


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

Header


Content

Posted by edward on July 23, 2012 - 11:41:
Author: bugman
Date: Mon Jul 23 11:41:08 2012
New Revision: 17293

URL: http://svn.gna.org/viewcvs/relax?rev=17293&view=rev
Log:
Created the frame_order.quad_int user function.

This is used to switch between the high precision Scipy quadratic numerical 
integration and the low
precision but much faster quasi-random Sobol' sequence integration.


Modified:
    branches/frame_order_testing/specific_fns/frame_order.py
    branches/frame_order_testing/user_functions/frame_order.py

Modified: branches/frame_order_testing/specific_fns/frame_order.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/frame_order_testing/specific_fns/frame_order.py?rev=17293&r1=17292&r2=17293&view=diff
==============================================================================
--- branches/frame_order_testing/specific_fns/frame_order.py (original)
+++ branches/frame_order_testing/specific_fns/frame_order.py Mon Jul 23 
11:41:08 2012
@@ -1068,6 +1068,20 @@
         return True
 
 
+    def _quad_int(self, flag=False):
+        """Turn the high precision Scipy quadratic numerical integration on 
or off.
+
+        @keyword flag:  The flag which if True will perform high precision 
numerical integration via the scipy.integrate quad(), dblquad() and tplquad() 
integration methods rather than the rough quasi-random numerical integration.
+        @type flag:     bool
+        """
+
+        # Test if the current data pipe exists.
+        pipes.test()
+
+        # Store the flag.
+        cdp.quad_int = flag
+
+
     def _ref_domain(self, ref=None):
         """Set the reference domain for the frame order, multi-domain models.
 
@@ -1118,13 +1132,15 @@
         # Initialise the list of model parameters.
         cdp.params = []
 
-        # Scipy quadratic numerical integration.
-        if cdp.model in []:
-            cdp.quad_int = True
-
-        # Quasi-random numerical integration.
-        else:
-            cdp.quad_int = False
+        # Set the integration method if needed.
+        if not hasattr(cdp, 'quad_int'):
+            # Scipy quadratic numerical integration.
+            if cdp.model in []:
+                cdp.quad_int = True
+
+            # Quasi-random numerical integration.
+            else:
+                cdp.quad_int = False
 
         # Update the model.
         self._update_model()

Modified: branches/frame_order_testing/user_functions/frame_order.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/frame_order_testing/user_functions/frame_order.py?rev=17293&r1=17292&r2=17293&view=diff
==============================================================================
--- branches/frame_order_testing/user_functions/frame_order.py (original)
+++ branches/frame_order_testing/user_functions/frame_order.py Mon Jul 23 
11:41:08 2012
@@ -174,6 +174,27 @@
 uf.desc[-1].add_paragraph("This allows the number of integration points used 
during the Frame Order target function optimisation to be changed from the 
default.  This is used in the quasi-random Sobol' sequence for the numerical 
integration.")
 uf.backend = frame_order_obj._num_int_pts
 uf.menu_text = "&num_int_pts"
+uf.gui_icon = "oxygen.actions.edit-rename"
+uf.wizard_size = (900, 500)
+uf.wizard_image = WIZARD_IMAGE_PATH + 'frame_order.png'
+
+
+# The frame_order.quad_int user function.
+uf = uf_info.add_uf('frame_order.quad_int')
+uf.title = "Turn the high precision quadratic integration on or off."
+uf.title_short = "Quadratic integration."
+uf.add_keyarg(
+    name = "flag",
+    default = False,
+    py_type = "bool",
+    desc_short = "flag",
+    desc = "The flag with if True  will perform high precision numerical 
integration via the scipy.integrate quad(), dblquad() and tplquad() 
integration methods rather than the rough quasi-random numerical integration."
+)
+# Description.
+uf.desc.append(Desc_container())
+uf.desc[-1].add_paragraph("This allows the high precision numerical 
integration of the Scipy quad() and related functions to be used instead of 
the lower precision quasi-random Sobol' sequence integration.  This is for 
the optimisation of the Frame Order target functions.  The quadratic 
integration is orders of magnitude slower than the Sobol' sequence 
integration, but the precision is much higher.")
+uf.backend = frame_order_obj._quad_int
+uf.menu_text = "&quad_int"
 uf.gui_icon = "oxygen.actions.edit-rename"
 uf.wizard_size = (900, 500)
 uf.wizard_image = WIZARD_IMAGE_PATH + 'frame_order.png'




Related Messages


Powered by MHonArc, Updated Mon Jul 23 12:20:01 2012