Author: bugman Date: Wed Jul 9 15:40:54 2008 New Revision: 6885 URL: http://svn.gna.org/viewcvs/relax?rev=6885&view=rev Log: Changed the N_state_opt functions to be model dependent. The func_rdcs() method is now func_population(), and the func_tensors() method is now func_2domain(). Modified: branches/rdc_analysis/maths_fns/n_state_model.py Modified: branches/rdc_analysis/maths_fns/n_state_model.py URL: http://svn.gna.org/viewcvs/relax/branches/rdc_analysis/maths_fns/n_state_model.py?rev=6885&r1=6884&r2=6885&view=diff ============================================================================== --- branches/rdc_analysis/maths_fns/n_state_model.py (original) +++ branches/rdc_analysis/maths_fns/n_state_model.py Wed Jul 9 15:40:54 2008 @@ -68,8 +68,8 @@ self.params = 1.0 * init_params # Force a copy of the data to be stored. self.total_num_params = len(init_params) - # Using alignment tensors. - if full_tensors: + # The 2-domain N-state model. + if model == '2-domain': # Some checks. if red_data == None and not len(red_data): raise RelaxError, "The red_data argument " + `red_data` + " must be supplied." @@ -96,10 +96,10 @@ self.red_bc_vector = zeros(self.num_tensors*5, float64) # Set the target function. - self.func = self.func_tensors + self.func = self.func_2domain - # Using RDCs. - elif rdcs: + # The flexible population N-state model. + elif model == 'population': # Some checks. if xh_vect == None and not len(xh_vect): raise RelaxError, "The xh_vect argument " + `xh_vect` + " must be supplied." @@ -113,27 +113,11 @@ self.xh_vect.append(array(xh_vect[i], float64)) # Set the target function. - self.func = self.func_rdcs + self.func = self.func_population - def func_rdcs(self, params): - """The target function for optimisation using RDCs. - - This function should be passed to the optimisation algorithm. It accepts, as an array, a - vector of parameter values and, using these, returns the single chi-squared value - corresponding to that coordinate in the parameter space. If no RDC errors are supplied, - then the SSE (the sum of squares error) value is returned instead. The chi-squared is - simply the SSE normalised to unit variance (the SSE divided by the error squared). - - @param params: The vector of parameter values. - @type params: list of float - @return: The chi-squared or SSE value. - @rtype: float - """ - - - def func_tensors(self, params): - """The target function for optimisation using alignment tensors. + def func_2domain(self, params): + """The target function for optimisation of the 2-domain N-state model. This function should be passed to the optimisation algorithm. It accepts, as an array, a vector of parameter values and, using these, returns the single chi-squared value @@ -188,3 +172,20 @@ # Return the chi-squared value. return chi2(self.red_data, self.red_bc_vector, self.red_errors) + + + def func_population(self, params): + """The target function for optimisation of the flexible population N-state model. + + This function should be passed to the optimisation algorithm. It accepts, as an array, a + vector of parameter values and, using these, returns the single chi-squared value + corresponding to that coordinate in the parameter space. If no RDC errors are supplied, + then the SSE (the sum of squares error) value is returned instead. The chi-squared is + simply the SSE normalised to unit variance (the SSE divided by the error squared). + + @param params: The vector of parameter values. + @type params: list of float + @return: The chi-squared or SSE value. + @rtype: float + """ +