Author: bugman Date: Fri Jul 11 10:14:45 2014 New Revision: 24519 URL: http://svn.gna.org/viewcvs/relax?rev=24519&view=rev Log: The frame order linear_constraints() function now returns None if no constraints are present. This allows the code using this to be simplified with respect to turning off the constraints. Modified: branches/frame_order_cleanup/specific_analyses/frame_order/api.py branches/frame_order_cleanup/specific_analyses/frame_order/optimisation.py branches/frame_order_cleanup/specific_analyses/frame_order/parameters.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=24519&r1=24518&r2=24519&view=diff ============================================================================== --- branches/frame_order_cleanup/specific_analyses/frame_order/api.py (original) +++ branches/frame_order_cleanup/specific_analyses/frame_order/api.py Fri Jul 11 10:14:45 2014 @@ -498,13 +498,14 @@ # Linear constraints. A, b = None, None if constraints: + # Obtain the constraints. A, b = linear_constraints(scaling_matrix=scaling_matrix) - # Constraint flag set but no constraints present. - if A != None and len(A) == 0: - if verbosity: - warn(RelaxWarning("The '%s' model parameters are not constrained, turning the linear constraint algorithm off." % cdp.model)) - constraints = False + # Constraint flag set but no constraints present. + if A == None: + if verbosity: + warn(RelaxWarning("The '%s' model parameters are not constrained, turning the linear constraint algorithm off." % cdp.model)) + constraints = False # Eliminate all points outside of constraints (useful for the pseudo-ellipse models). if constraints: 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=24519&r1=24518&r2=24519&view=diff ============================================================================== --- branches/frame_order_cleanup/specific_analyses/frame_order/optimisation.py (original) +++ branches/frame_order_cleanup/specific_analyses/frame_order/optimisation.py Fri Jul 11 10:14:45 2014 @@ -886,19 +886,18 @@ # Linear constraints. self.A, self.b = None, None if constraints: + # Obtain the constraints. self.A, self.b = linear_constraints(scaling_matrix=scaling_matrix) - # Constraint flag set but no constraints present. - if self.A != None and len(self.A) == 0: - if verbosity: - warn(RelaxWarning("The '%s' model parameters are not constrained, turning the linear constraint algorithm off." % cdp.model)) - self.A = None - self.b = None - - # Pop out the log barrier algorithm. - if self.min_algor == 'Log barrier': - self.min_algor = self.min_options[0] - self.min_options = self.min_options[1:] + # Constraint flag set but no constraints present. + if self.A == None: + if verbosity: + warn(RelaxWarning("The '%s' model parameters are not constrained, turning the linear constraint algorithm off." % cdp.model)) + + # Pop out the log barrier algorithm. + if self.min_algor == 'Log barrier': + self.min_algor = self.min_options[0] + self.min_options = self.min_options[1:] def run(self, processor, completed): Modified: branches/frame_order_cleanup/specific_analyses/frame_order/parameters.py URL: http://svn.gna.org/viewcvs/relax/branches/frame_order_cleanup/specific_analyses/frame_order/parameters.py?rev=24519&r1=24518&r2=24519&view=diff ============================================================================== --- branches/frame_order_cleanup/specific_analyses/frame_order/parameters.py (original) +++ branches/frame_order_cleanup/specific_analyses/frame_order/parameters.py Fri Jul 11 10:14:45 2014 @@ -180,6 +180,11 @@ A = array(A, float64) b = array(b, float64) + # No constraints are present. + if len(A) == 0: + A = None + b = None + # Return the constraint objects. return A, b