Author: bugman Date: Wed May 21 23:55:46 2008 New Revision: 6227 URL: http://svn.gna.org/viewcvs/relax?rev=6227&view=rev Log: Updated the off() and on() functions to the new design. Modified: 1.3/generic_fns/monte_carlo.py Modified: 1.3/generic_fns/monte_carlo.py URL: http://svn.gna.org/viewcvs/relax/1.3/generic_fns/monte_carlo.py?rev=6227&r1=6226&r2=6227&view=diff ============================================================================== --- 1.3/generic_fns/monte_carlo.py (original) +++ 1.3/generic_fns/monte_carlo.py Wed May 21 23:55:46 2008 @@ -272,40 +272,40 @@ init_sim_values() -def off(run=None): - """Function for turning simulations off.""" - - # Arguments. - self.run = run - - # Test if the run exists. - if not self.run in relax_data_store.run_names: - raise RelaxNoPipeError, self.run - - # Test if simulations have been set up. - if not hasattr(relax_data_store, 'sim_state'): - raise RelaxError, "Monte Carlo simulations for the run " + `self.run` + " have not been set up." +def off(): + """Turn simulations off.""" + + # Test if the current data pipe exists. + if not relax_data_store.current_pipe: + raise RelaxNoPipeError + + # Alias the current data pipe. + cdp = relax_data_store[relax_data_store.current_pipe] + + # Test if simulations have been set up. + if not hasattr(cdp, 'sim_state'): + raise RelaxError, "Monte Carlo simulations have not been set up." # Turn simulations off. - relax_data_store.sim_state[self.run] = 0 - - -def on(run=None): - """Function for turning simulations on.""" - - # Arguments. - self.run = run - - # Test if the run exists. - if not self.run in relax_data_store.run_names: - raise RelaxNoPipeError, self.run - - # Test if simulations have been set up. - if not hasattr(relax_data_store, 'sim_state'): - raise RelaxError, "Monte Carlo simulations for the run " + `self.run` + " have not been set up." + cdp.sim_state = False + + +def on(): + """Turn simulations on.""" + + # Test if the current data pipe exists. + if not relax_data_store.current_pipe: + raise RelaxNoPipeError + + # Alias the current data pipe. + cdp = relax_data_store[relax_data_store.current_pipe] + + # Test if simulations have been set up. + if not hasattr(cdp, 'sim_state'): + raise RelaxError, "Monte Carlo simulations have not been set up." # Turn simulations on. - relax_data_store.sim_state[self.run] = 1 + cdp.sim_state = True def select_all_sims(number=None, all_select_sim=None):