Author: bugman Date: Wed Jul 9 13:33:29 2008 New Revision: 6870 URL: http://svn.gna.org/viewcvs/relax?rev=6870&view=rev Log: Renamed setup_model() to the private __update_model() method. Modified: branches/rdc_analysis/specific_fns/n_state_model.py Modified: branches/rdc_analysis/specific_fns/n_state_model.py URL: http://svn.gna.org/viewcvs/relax/branches/rdc_analysis/specific_fns/n_state_model.py?rev=6870&r1=6869&r2=6870&view=diff ============================================================================== --- branches/rdc_analysis/specific_fns/n_state_model.py (original) +++ branches/rdc_analysis/specific_fns/n_state_model.py Wed Jul 9 13:33:29 2008 @@ -44,6 +44,46 @@ class N_state_model(Common_functions): """Class containing functions for the N-state model.""" + + def __update_model(self): + """Update the model parameters as necessary.""" + + # Alias the current data pipe. + cdp = ds[ds.current_pipe] + + # Determine the number of states, if not already set. + if not hasattr(cdp, 'N'): + # No structures. + if not hasattr(cdp, 'structure'): + raise RelaxError, "The number of states cannot be determined as no structures are loaded." + + # Set the number. + cdp.N = cdp.structure.num_structures() + + # No states? + if not cdp.N > 0: + raise RelaxError, "The number of states " + `cdp.N` + " is invalid." + + # Initialise the list of model parameters. + if not hasattr(cdp, 'params'): + cdp.params = [] + + # Add the probability or population weight parameters. + for i in xrange(cdp.N-1): + cdp.params.append('p' + `i`) + + # Add the Euler angle parameters. + for i in xrange(cdp.N): + cdp.params.append('alpha' + `i`) + cdp.params.append('beta' + `i`) + cdp.params.append('gamma' + `i`) + + # Initialise the probability and Euler angle arrays. + cdp.probs = [None] * cdp.N + cdp.alpha = [None] * cdp.N + cdp.beta = [None] * cdp.N + cdp.gamma = [None] * cdp.N + def assemble_param_vector(self, sim_index=None): """Assemble all the parameters of the model into a single array. @@ -550,8 +590,8 @@ if not hasattr(cdp, 'ref_domain'): raise RelaxError, "The reference domain has not been set." - # Set up the model parameters if necessary. - self.setup_model() + # Update the model parameters if necessary. + self.__update_model() # Create the initial parameter vector. param_vector = self.assemble_param_vector(sim_index=sim_index) @@ -721,8 +761,8 @@ # Set the value of N. cdp.N = N - # Set up the model. - self.setup_model + # Update the model. + self.__update_model def ref_domain(self, ref=None): """Set the reference domain for the '2-domain' N-state model. @@ -1028,43 +1068,3 @@ # The tensor label doesn't exist. if not match: raise RelaxNoTensorError, ('alignment', tensor) - - - def setup_model(self): - """Set up the model parameters as necessary.""" - - # Alias the current data pipe. - cdp = ds[ds.current_pipe] - - # Determine the number of states, if not already set. - if not hasattr(cdp, 'N'): - # No structures. - if not hasattr(cdp, 'structure'): - raise RelaxError, "The number of states cannot be determined as no structures are loaded." - - # Set the number. - cdp.N = cdp.structure.num_structures() - - # No states? - if not cdp.N > 0: - raise RelaxError, "The number of states " + `cdp.N` + " is invalid." - - # Initialise the list of model parameters. - if not hasattr(cdp, 'params'): - cdp.params = [] - - # Add the probability or population weight parameters. - for i in xrange(cdp.N-1): - cdp.params.append('p' + `i`) - - # Add the Euler angle parameters. - for i in xrange(cdp.N): - cdp.params.append('alpha' + `i`) - cdp.params.append('beta' + `i`) - cdp.params.append('gamma' + `i`) - - # Initialise the probability and Euler angle arrays. - cdp.probs = [None] * cdp.N - cdp.alpha = [None] * cdp.N - cdp.beta = [None] * cdp.N - cdp.gamma = [None] * cdp.N