mailr23211 - /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 May 17, 2014 - 18:03:
Author: bugman
Date: Sat May 17 18:03:46 2014
New Revision: 23211

URL: http://svn.gna.org/viewcvs/relax?rev=23211&view=rev
Log:
Fix for a number of the frame order models which do not have parameter 
constraints.

The linear_constraint() function was returning A, b = [], [] for these 
models, but these empty numpy
arrays were causing the minfx library (https://gna.org/projects/minfx/) to 
fail.  These values are
now caught and the constraint algorithm turned off in the minimise() specific 
API method.

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=23211&r1=23210&r2=23211&view=diff
==============================================================================
--- branches/frame_order_cleanup/specific_analyses/frame_order/api.py   
(original)
+++ branches/frame_order_cleanup/specific_analyses/frame_order/api.py   Sat 
May 17 18:03:46 2014
@@ -29,9 +29,11 @@
 from minfx.grid import grid_point_array
 from numpy import float64, zeros
 from re import search
+from warnings import warn
 
 # relax module imports.
 from lib.errors import RelaxError, RelaxNoModelError
+from lib.warnings import RelaxWarning
 from pipe_control import pipes
 from pipe_control.interatomic import interatomic_loop, return_interatom
 from pipe_control.mol_res_spin import return_spin, spin_loop
@@ -552,6 +554,16 @@
         if constraints:
             A, b = linear_constraints(scaling_matrix=scaling_matrix)
 
+        # No constraints.
+        if len(A) == 0:
+            warn(RelaxWarning("The '%s' model parameters are not 
constrained, turning the linear constraint algorithm off." % cdp.model))
+            constraints = False
+
+            # Pop out the log barrier algorithm.
+            if min_algor == 'Log barrier':
+                min_algor = min_options[0]
+                min_options = min_options[1:]
+
         # Grid search.
         if search('^[Gg]rid', min_algor):
             results = grid_point_array(func=model.func, args=(), 
points=min_options, verbosity=verbosity)




Related Messages


Powered by MHonArc, Updated Sun May 18 20:20:03 2014