mailr24717 - /branches/frame_order_cleanup/specific_analyses/frame_order/optimisation.py


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

Header


Content

Posted by edward on July 24, 2014 - 16:53:
Author: bugman
Date: Thu Jul 24 16:53:06 2014
New Revision: 24717

URL: http://svn.gna.org/viewcvs/relax?rev=24717&view=rev
Log:
Fix for the specific_analyses.frame_order.optimisation.grid_row() function.

This can now handle the case of a single grid increment.  The change is 
similar to r163 in the minfx
project (https://mail.gna.org/public/minfx-commits/2014-07/msg00015.html).


Modified:
    branches/frame_order_cleanup/specific_analyses/frame_order/optimisation.py

Modified: 
branches/frame_order_cleanup/specific_analyses/frame_order/optimisation.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/frame_order_cleanup/specific_analyses/frame_order/optimisation.py?rev=24717&r1=24716&r2=24717&view=diff
==============================================================================
--- 
branches/frame_order_cleanup/specific_analyses/frame_order/optimisation.py  
(original)
+++ 
branches/frame_order_cleanup/specific_analyses/frame_order/optimisation.py  
Thu Jul 24 16:53:06 2014
@@ -72,24 +72,33 @@
 
     # Linear grid.
     if dist_type == None:
+        # Handle a single increment.
+        if incs == 1:
+            row.append((lower + upper) / 2.0)
+
         # Loop over the increments.
-        for i in range(incs):
-            # The row.
-            row.append(lower + i * (upper - lower) / (incs - 1.0))
+        else:
+            for i in range(incs):
+                row.append(lower + i * (upper - lower) / (incs - 1.0))
 
     # Inverse cos distribution.
     elif dist_type == 'acos':
+        # Handle a single increment.
+        if incs == 1:
+            row.append((lower + upper) / 2.0)
+
         # Generate the increment values of v from cos(upper) to cos(lower).
-        v = zeros(incs, float64)
-        val = (cos(lower) - cos(upper)) / (incs - 1.0)
-        for i in range(incs):
-            v[-i-1] = cos(upper) + float(i) * val
-
-        # Generate the distribution.
-        row = arccos(v)
+        else:
+            v = zeros(incs, float64)
+            val = (cos(lower) - cos(upper)) / (incs - 1.0)
+            for i in range(incs):
+                v[-i-1] = cos(upper) + float(i) * val
+
+            # Generate the distribution.
+            row = arccos(v)
 
     # Remove the last point.
-    if not end_point:
+    if incs != 1 and not end_point:
         row = row[:-1]
 
     # Return the row (as a list).




Related Messages


Powered by MHonArc, Updated Thu Jul 24 17:20:02 2014