mailr23642 - /branches/frame_order_cleanup/specific_analyses/frame_order/api.py


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

Header


Content

Posted by edward on June 04, 2014 - 19:36:
Author: bugman
Date: Wed Jun  4 19:36:43 2014
New Revision: 23642

URL: http://svn.gna.org/viewcvs/relax?rev=23642&view=rev
Log:
Constraints are now implemented in the frame order grid search.

This is useful for the pseudo-elliptic models as the cone theta_x < theta_y 
constraint halves the
optimisation space.


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

Modified: branches/frame_order_cleanup/specific_analyses/frame_order/api.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/frame_order_cleanup/specific_analyses/frame_order/api.py?rev=23642&r1=23641&r2=23642&view=diff
==============================================================================
--- branches/frame_order_cleanup/specific_analyses/frame_order/api.py   
(original)
+++ branches/frame_order_cleanup/specific_analyses/frame_order/api.py   Wed 
Jun  4 19:36:43 2014
@@ -27,7 +27,7 @@
 from math import pi
 from minfx.generic import generic_minimise
 from minfx.grid import grid_point_array
-from numpy import float64, zeros
+from numpy import array, dot, float64, zeros
 from re import search
 from warnings import warn
 
@@ -478,6 +478,23 @@
                     break    # Exit so that the other step numbers are not 
incremented.
                 else:
                     indices[j] = 0
+
+        # Eliminate all points outside of constraints (useful for the 
pseudo-ellipse models).
+        if constraints:
+            A, b = linear_constraints(scaling_matrix=scaling_matrix)
+
+            # Construct a new point array.
+            new_pts = []
+            for i in range(total_pts):
+                # Calculate A.x - b.
+                ci = dot(A, pts[i]) - b
+
+                # Only add the point if all constraints are satisfied.
+                if min(ci) >= 0.0:
+                    new_pts.append(pts[i])
+
+            # Convert to a numpy array.
+            pts = array(new_pts)
 
         # Minimisation.
         self.minimise(min_algor='grid', min_options=pts, 
constraints=constraints, verbosity=verbosity, sim_index=sim_index)




Related Messages


Powered by MHonArc, Updated Thu Jun 05 08:40:05 2014