Author: bugman Date: Wed Oct 1 14:17:50 2008 New Revision: 7481 URL: http://svn.gna.org/viewcvs/relax?rev=7481&view=rev Log: Converted the deselect() method to the new design. Modified: branches/pipe_refs/specific_fns/model_free/main.py Modified: branches/pipe_refs/specific_fns/model_free/main.py URL: http://svn.gna.org/viewcvs/relax/branches/pipe_refs/specific_fns/model_free/main.py?rev=7481&r1=7480&r2=7481&view=diff ============================================================================== --- branches/pipe_refs/specific_fns/model_free/main.py (original) +++ branches/pipe_refs/specific_fns/model_free/main.py Wed Oct 1 14:17:50 2008 @@ -872,6 +872,49 @@ # Delete the data. delattr(spin, name) + + + def deselect(self, model_index, sim_index=None): + """Deselect models or simulations. + + @keyword model_index: The model index. This is zero for the global models or equal to the + global spin index (which covers the molecule, residue, and spin + indices). + @type model_index: int + @keyword sim_index: The Monte Carlo simulation index. If None, then models will be + deselected, otherwise the given simulation will. + @type sim_index: int + """ + + # Determine the model type. + model_type = self.determine_model_type() + + # Local models. + if model_type == 'mf' or model_type == 'local_tm': + # Get the spin. + spin = return_spin_from_index(model_index) + + # Spin deselection. + if sim_index == None: + spin.select = False + + # Simulation deselection. + else: + spin.select_sim[sim_index] = False + + # Global models. + else: + # Global model deselection. + if sim_index == None: + raise RelaxError, "Cannot deselect the global model." + + # Simulation deselection. + else: + # Get the current data pipe. + cdp = pipes.get_pipe() + + # Deselect. + cdp.select_sim[sim_index] = False def determine_model_type(self): @@ -3105,29 +3148,3 @@ # Don't skip. return False - - - def deselect(self, run, i, sim_index=None): - """Function for deselecting models or simulations.""" - - # Arguments. - self.run = run - - # Determine the model type. - model_type = self.determine_model_type() - - # Simulation deselect. - if sim_index != None: - # Single instance. - if model_type == 'mf' or model_type == 'local_tm': - ds.res[self.run][i].select_sim[sim_index] = 0 - - # Multiple instances. - else: - ds.select_sim[self.run][sim_index] = 0 - - # Residue deselect. - else: - # Single residue. - if model_type == 'mf' or model_type == 'local_tm': - ds.res[self.run][i].select = 0