def test_pipe_bundle(self): """Test the pipe bundle concepts.""" # Execute the script. self.script_exec(status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'pipe_bundle.py') # Checks. self.assertEqual(pipes.cdp_name(), None) self.assertEqual(pipes.has_bundle('test bundle 1'), True) self.assertEqual(pipes.has_bundle('test bundle 2'), True) self.assertEqual(pipes.has_bundle('test bundle 3'), False) bundles = sorted(pipes.bundle_names()) self.assertEqual(bundles, ['test bundle 1', 'test bundle 2']) for pipe, name in pipes.pipe_loop(name=True): self.assert_(name in ['test pipe 1', 'test pipe 2', 'test pipe 3', 'test pipe 4', 'test pipe 5', 'test pipe 6']) self.assert_(pipes.get_bundle(name) in ['test bundle 1', 'test bundle 2'])
def test_pipe_bundle(self): """Test the pipe bundle concepts.""" # Execute the script. self.script_exec(status.install_path + sep + 'test_suite' + sep + 'system_tests' + sep + 'scripts' + sep + 'pipe_bundle.py') # Checks. self.assertEqual(pipes.cdp_name(), None) self.assertEqual(pipes.has_bundle('test bundle 1'), True) self.assertEqual(pipes.has_bundle('test bundle 2'), True) self.assertEqual(pipes.has_bundle('test bundle 3'), False) bundles = sorted(pipes.bundle_names()) self.assertEqual(bundles, ['test bundle 1', 'test bundle 2']) for pipe, name in pipes.pipe_loop(name=True): self.assert_(name in [ 'test pipe 1', 'test pipe 2', 'test pipe 3', 'test pipe 4', 'test pipe 5', 'test pipe 6' ]) self.assert_( pipes.get_bundle(name) in ['test bundle 1', 'test bundle 2'])
def pipe_deletion(self): """Remove analysis tabs for which the associated data pipe has been deleted.""" # Loop over the analyses, noting which no longer have an associated data pipe bundle. del_list = [] for i in range(self._num_analyses): if not pipes.has_bundle(ds.relax_gui.analyses[i].pipe_bundle): del_list.append(i) # Reverse the order of the list so the removal works correctly. del_list.reverse() # Delete the analyses. for index in del_list: self.delete_analysis(index)
def __init__(self, parent, id=-1, pos=wx.Point(-1, -1), size=wx.Size(-1, -1), style=524288, name='scrolledpanel', gui=None, analysis_name=None, pipe_name=None, pipe_bundle=None, uf_exec=[], data_index=None): """Build the automatic R1 and R2 analysis GUI frame elements. @param parent: The parent wx element. @type parent: wx object @keyword id: The unique ID number. @type id: int @keyword pos: The position. @type pos: wx.Size object @keyword size: The size. @type size: wx.Size object @keyword style: The style. @type style: int @keyword name: The name for the panel. @type name: unicode @keyword gui: The main GUI class. @type gui: gui.relax_gui.Main instance @keyword analysis_name: The name of the analysis (the name in the tab part of the notebook). @type analysis_name: str @keyword pipe_name: The name of the data pipe associated with this analysis. @type pipe_name: str @keyword pipe_bundle: The name of the data pipe bundle associated with this analysis. @type pipe_bundle: str @keyword uf_exec: The list of user function on_execute methods returned from the new analysis wizard. @type uf_exec: list of methods @keyword data_index: The index of the analysis in the relax data store (set to None if no data currently exists). @type data_index: None or int """ # Store the GUI main class. self.gui = gui # Init. self.init_flag = True # New data container. if data_index == None: # First create the data pipe if not already in existence. if not has_pipe(pipe_name): self.gui.interpreter.apply('pipe.create', pipe_name=pipe_name, pipe_type='relax_fit', bundle=pipe_bundle) # Create the data pipe bundle if needed. if not has_bundle(pipe_bundle): self.gui.interpreter.apply('pipe.bundle', bundle=pipe_bundle, pipe=pipe_name) # Generate a storage container in the relax data store, and alias it for easy access. data_index = ds.relax_gui.analyses.add(self.label) # Store the analysis and pipe names. ds.relax_gui.analyses[data_index].analysis_name = analysis_name ds.relax_gui.analyses[data_index].pipe_name = pipe_name ds.relax_gui.analyses[data_index].pipe_bundle = pipe_bundle # Initialise the variables. ds.relax_gui.analyses[data_index].frq = '' ds.relax_gui.analyses[data_index].grid_inc = None ds.relax_gui.analyses[data_index].mc_sim_num = None ds.relax_gui.analyses[data_index].save_dir = self.gui.launch_dir # Alias the data. self.data = ds.relax_gui.analyses[data_index] self.data_index = data_index # Register the method for updating the spin count for the completion of user functions. self.observer_register() # Execute the base class method to build the panel. super(Auto_rx, self).__init__(parent, id=id, pos=pos, size=size, style=style, name=name)
def __init__(self, parent, id=-1, pos=wx.Point(-1, -1), size=wx.Size(-1, -1), style=524288, name='scrolledpanel', gui=None, analysis_name=None, pipe_name=None, pipe_bundle=None, uf_exec=[], data_index=None): """Build the automatic R1 and R2 analysis GUI frame elements. @param parent: The parent wx element. @type parent: wx object @keyword id: The unique ID number. @type id: int @keyword pos: The position. @type pos: wx.Size object @keyword size: The size. @type size: wx.Size object @keyword style: The style. @type style: int @keyword name: The name for the panel. @type name: unicode @keyword gui: The main GUI class. @type gui: gui.relax_gui.Main instance @keyword analysis_name: The name of the analysis (the name in the tab part of the notebook). @type analysis_name: str @keyword pipe_name: The name of the data pipe associated with this analysis. @type pipe_name: str @keyword pipe_bundle: The name of the data pipe bundle associated with this analysis. @type pipe_bundle: str @keyword uf_exec: The list of user function on_execute methods returned from the new analysis wizard. @type uf_exec: list of methods @keyword data_index: The index of the analysis in the relax data store (set to None if no data currently exists). @type data_index: None or int """ # Store the GUI main class. self.gui = gui # Init. self.init_flag = True # New data container. if data_index == None: # First create the data pipe if not already in existence. if not has_pipe(pipe_name): self.gui.interpreter.apply('pipe.create', pipe_name=pipe_name, pipe_type='relax_fit', bundle=pipe_bundle) # Create the data pipe bundle if needed. if not has_bundle(pipe_bundle): self.gui.interpreter.apply('pipe.bundle', bundle=pipe_bundle, pipe=pipe_name) # Generate a storage container in the relax data store, and alias it for easy access. data_index = ds.relax_gui.analyses.add(self.label) # Store the analysis and pipe names. ds.relax_gui.analyses[data_index].analysis_name = analysis_name ds.relax_gui.analyses[data_index].pipe_name = pipe_name ds.relax_gui.analyses[data_index].pipe_bundle = pipe_bundle # Initialise the variables. ds.relax_gui.analyses[data_index].frq = '' ds.relax_gui.analyses[data_index].grid_inc = None ds.relax_gui.analyses[data_index].mc_sim_num = None ds.relax_gui.analyses[ data_index].save_dir = self.gui.system_cwd_path # Alias the data. self.data = ds.relax_gui.analyses[data_index] self.data_index = data_index # Register the method for updating the spin count for the completion of user functions. self.observer_register() # Execute the base class method to build the panel. super(Auto_rx, self).__init__(parent, id=id, pos=pos, size=size, style=style, name=name)
def __init__(self, parent, id=-1, pos=wx.Point(-1, -1), size=wx.Size(-1, -1), style=524288, name='scrolledpanel', gui=None, analysis_name=None, pipe_name=None, pipe_bundle=None, uf_exec=[], data_index=None): """Build the automatic R1 and R2 analysis GUI frame elements. @param parent: The parent wx element. @type parent: wx object @keyword id: The unique ID number. @type id: int @keyword pos: The position. @type pos: wx.Size object @keyword size: The size. @type size: wx.Size object @keyword style: The style. @type style: int @keyword name: The name for the panel. @type name: unicode @keyword gui: The main GUI class. @type gui: gui.relax_gui.Main instance @keyword analysis_name: The name of the analysis (the name in the tab part of the notebook). @type analysis_name: str @keyword pipe_name: The name of the data pipe associated with this analysis. @type pipe_name: str @keyword pipe_bundle: The name of the data pipe bundle associated with this analysis. @type pipe_bundle: str @keyword uf_exec: The list of user function on_execute methods returned from the new analysis wizard. @type uf_exec: list of methods @keyword data_index: The index of the analysis in the relax data store (set to None if no data currently exists). @type data_index: None or int """ # Store the GUI main class. self.gui = gui # Init. self.init_flag = True # New data container. if data_index == None: # First create the data pipe if not already in existence. if not has_pipe(pipe_name): self.gui.interpreter.apply('pipe.create', pipe_name=pipe_name, pipe_type='relax_disp', bundle=pipe_bundle) # Create the data pipe bundle if needed. if not has_bundle(pipe_bundle): self.gui.interpreter.apply('pipe.bundle', bundle=pipe_bundle, pipe=pipe_name) # Generate a storage container in the relax data store, and alias it for easy access. data_index = ds.relax_gui.analyses.add(self.label) # Store the analysis and pipe names. ds.relax_gui.analyses[data_index].analysis_name = analysis_name ds.relax_gui.analyses[data_index].pipe_name = pipe_name ds.relax_gui.analyses[data_index].pipe_bundle = pipe_bundle # Initialise the variables. ds.relax_gui.analyses[data_index].r1_fit = False ds.relax_gui.analyses[data_index].numeric_only = False ds.relax_gui.analyses[data_index].grid_inc = None ds.relax_gui.analyses[data_index].mc_sim_num = None ds.relax_gui.analyses[data_index].exp_mc_sim_num = None ds.relax_gui.analyses[data_index].pre_run_dir = None ds.relax_gui.analyses[data_index].mc_sim_all_models = False ds.relax_gui.analyses[data_index].insignificance = 1.0 ds.relax_gui.analyses[data_index].save_dir = self.gui.launch_dir # Set the default dispersion models based on the experiment type. ds.relax_gui.analyses[data_index].disp_models = [ MODEL_R2EFF, MODEL_NOREX, MODEL_CR72, MODEL_NS_CPMG_2SITE_EXPANDED, MODEL_MP05, MODEL_NS_R1RHO_2SITE ] # Error checking. if ds.relax_gui.analyses[data_index].pipe_bundle == None: raise RelaxError("The pipe bundle must be supplied.") # Alias the data. self.data = ds.relax_gui.analyses[data_index] self.data_index = data_index # Register the method for updating the spin count for the completion of user functions. self.observer_register() # Execute the base class method to build the panel. super(Auto_relax_disp, self).__init__(parent, id=id, pos=pos, size=size, style=style, name=name) # Optimisation variables for speeding up the test suite. self.opt_func_tol = 1e-25 self.opt_max_iterations = int(1e7) # Update the isotope and cluster information. self.update_clusters()
def __init__(self, parent, id=-1, pos=wx.Point(-1, -1), size=wx.Size(-1, -1), style=524288, name='scrolledpanel', gui=None, analysis_name=None, pipe_name=None, pipe_bundle=None, uf_exec=[], data_index=None): """Build the automatic model-free protocol GUI element. @param parent: The parent wx element. @type parent: wx object @keyword id: The unique ID number. @type id: int @keyword pos: The position. @type pos: wx.Size object @keyword size: The size. @type size: wx.Size object @keyword style: The style. @type style: int @keyword name: The name for the panel. @type name: unicode @keyword gui: The main GUI class. @type gui: gui.relax_gui.Main instance @keyword analysis_name: The name of the analysis (the name in the tab part of the notebook). @type analysis_name: str @keyword pipe_name: The name of the original data pipe for this analysis. @type pipe_name: str @keyword pipe_bundle: The name of the data pipe bundle associated with this analysis. @type pipe_bundle: str @keyword uf_exec: The list of user function on_execute methods returned from the new analysis wizard. @type uf_exec: list of methods @keyword data_index: The index of the analysis in the relax data store (set to None if no data currently exists). @type data_index: None or int """ # Store the GUI main class. self.gui = gui # Init. self.init_flag = True # New data container. if data_index == None: # First create the data pipe if not already in existence. if not has_pipe(pipe_name): self.gui.interpreter.apply('pipe.create', pipe_name=pipe_name, pipe_type='mf', bundle=pipe_bundle) # Create the data pipe bundle if needed. if not has_bundle(pipe_bundle): self.gui.interpreter.apply('pipe.bundle', bundle=pipe_bundle, pipe=pipe_name) # Generate a storage container in the relax data store, and alias it for easy access. data_index = ds.relax_gui.analyses.add('model-free') # Store the analysis and pipe names. ds.relax_gui.analyses[data_index].analysis_name = analysis_name ds.relax_gui.analyses[data_index].pipe_name = pipe_name ds.relax_gui.analyses[data_index].pipe_bundle = pipe_bundle # Initialise the variables. ds.relax_gui.analyses[data_index].grid_inc = None ds.relax_gui.analyses[data_index].diff_tensor_grid_inc = { 'sphere': 11, 'prolate': 11, 'oblate': 11, 'ellipsoid': 6 } ds.relax_gui.analyses[data_index].mc_sim_num = None ds.relax_gui.analyses[ data_index].save_dir = self.gui.system_cwd_path ds.relax_gui.analyses[data_index].local_tm_models = [ 'tm0', 'tm1', 'tm2', 'tm3', 'tm4', 'tm5', 'tm6', 'tm7', 'tm8', 'tm9' ] ds.relax_gui.analyses[data_index].mf_models = [ 'm0', 'm1', 'm2', 'm3', 'm4', 'm5', 'm6', 'm7', 'm8', 'm9' ] ds.relax_gui.analyses[data_index].max_iter = 30 # Error checking. if ds.relax_gui.analyses[data_index].pipe_bundle == None: raise RelaxError("The pipe bundle must be supplied.") # Alias the data. self.data = ds.relax_gui.analyses[data_index] self.data_index = data_index # Backward compatibility. if not hasattr(self.data, 'local_tm_models'): self.data.local_tm_models = [ 'tm0', 'tm1', 'tm2', 'tm3', 'tm4', 'tm5', 'tm6', 'tm7', 'tm8', 'tm9' ] if not hasattr(self.data, 'mf_models'): self.data.mf_models = [ 'm0', 'm1', 'm2', 'm3', 'm4', 'm5', 'm6', 'm7', 'm8', 'm9' ] # Initialise the mode selection window. self.mode_win = Protocol_mode_sel_window() # Register the method for updating the spin count for the completion of user functions. self.observer_register() # Execute the base class method to build the panel. super(Auto_model_free, self).__init__(parent, id=id, pos=pos, size=size, style=style, name=name)
def __init__(self, parent, id=-1, pos=wx.Point(-1, -1), size=wx.Size(-1, -1), style=524288, name='scrolledpanel', gui=None, analysis_name=None, pipe_name=None, pipe_bundle=None, uf_exec=[], data_index=None): """Build the automatic R1 and R2 analysis GUI frame elements. @param parent: The parent wx element. @type parent: wx object @keyword id: The unique ID number. @type id: int @keyword pos: The position. @type pos: wx.Size object @keyword size: The size. @type size: wx.Size object @keyword style: The style. @type style: int @keyword name: The name for the panel. @type name: unicode @keyword gui: The main GUI class. @type gui: gui.relax_gui.Main instance @keyword analysis_name: The name of the analysis (the name in the tab part of the notebook). @type analysis_name: str @keyword pipe_name: The name of the data pipe associated with this analysis. @type pipe_name: str @keyword pipe_bundle: The name of the data pipe bundle associated with this analysis. @type pipe_bundle: str @keyword uf_exec: The list of user function on_execute methods returned from the new analysis wizard. @type uf_exec: list of methods @keyword data_index: The index of the analysis in the relax data store (set to None if no data currently exists). @type data_index: None or int """ # Store the GUI main class. self.gui = gui # Init. self.init_flag = True # New data container. if data_index == None: # First create the data pipe if not already in existence. if not has_pipe(pipe_name): self.gui.interpreter.apply('pipe.create', pipe_name=pipe_name, pipe_type='relax_disp', bundle=pipe_bundle) # Create the data pipe bundle if needed. if not has_bundle(pipe_bundle): self.gui.interpreter.apply('pipe.bundle', bundle=pipe_bundle, pipe=pipe_name) # Generate a storage container in the relax data store, and alias it for easy access. data_index = ds.relax_gui.analyses.add(self.label) # Store the analysis and pipe names. ds.relax_gui.analyses[data_index].analysis_name = analysis_name ds.relax_gui.analyses[data_index].pipe_name = pipe_name ds.relax_gui.analyses[data_index].pipe_bundle = pipe_bundle # Initialise the variables. ds.relax_gui.analyses[data_index].r1_fit = False ds.relax_gui.analyses[data_index].numeric_only = False ds.relax_gui.analyses[data_index].grid_inc = None ds.relax_gui.analyses[data_index].mc_sim_num = None ds.relax_gui.analyses[data_index].exp_mc_sim_num = None ds.relax_gui.analyses[data_index].pre_run_dir = None ds.relax_gui.analyses[data_index].mc_sim_all_models = False ds.relax_gui.analyses[data_index].insignificance = 1.0 ds.relax_gui.analyses[data_index].save_dir = self.gui.system_cwd_path # Set the default dispersion models based on the experiment type. ds.relax_gui.analyses[data_index].disp_models = [ MODEL_R2EFF, MODEL_NOREX, MODEL_CR72, MODEL_NS_CPMG_2SITE_EXPANDED, MODEL_MP05, MODEL_NS_R1RHO_2SITE ] # Error checking. if ds.relax_gui.analyses[data_index].pipe_bundle == None: raise RelaxError("The pipe bundle must be supplied.") # Alias the data. self.data = ds.relax_gui.analyses[data_index] self.data_index = data_index # Register the method for updating the spin count for the completion of user functions. self.observer_register() # Execute the base class method to build the panel. super(Auto_relax_disp, self).__init__(parent, id=id, pos=pos, size=size, style=style, name=name) # Optimisation variables for speeding up the test suite. self.opt_func_tol = 1e-25 self.opt_max_iterations = int(1e7) # Update the isotope and cluster information. self.update_clusters()
def __init__(self, parent, id=-1, pos=wx.Point(-1, -1), size=wx.Size(-1, -1), style=524288, name='scrolledpanel', gui=None, analysis_name=None, pipe_name=None, pipe_bundle=None, uf_exec=[], data_index=None): """Build the automatic model-free protocol GUI element. @param parent: The parent wx element. @type parent: wx object @keyword id: The unique ID number. @type id: int @keyword pos: The position. @type pos: wx.Size object @keyword size: The size. @type size: wx.Size object @keyword style: The style. @type style: int @keyword name: The name for the panel. @type name: unicode @keyword gui: The main GUI class. @type gui: gui.relax_gui.Main instance @keyword analysis_name: The name of the analysis (the name in the tab part of the notebook). @type analysis_name: str @keyword pipe_name: The name of the original data pipe for this analysis. @type pipe_name: str @keyword pipe_bundle: The name of the data pipe bundle associated with this analysis. @type pipe_bundle: str @keyword uf_exec: The list of user function on_execute methods returned from the new analysis wizard. @type uf_exec: list of methods @keyword data_index: The index of the analysis in the relax data store (set to None if no data currently exists). @type data_index: None or int """ # Store the GUI main class. self.gui = gui # Init. self.init_flag = True # New data container. if data_index == None: # First create the data pipe if not already in existence. if not has_pipe(pipe_name): self.gui.interpreter.apply('pipe.create', pipe_name=pipe_name, pipe_type='mf', bundle=pipe_bundle) # Create the data pipe bundle if needed. if not has_bundle(pipe_bundle): self.gui.interpreter.apply('pipe.bundle', bundle=pipe_bundle, pipe=pipe_name) # Generate a storage container in the relax data store, and alias it for easy access. data_index = ds.relax_gui.analyses.add('model-free') # Store the analysis and pipe names. ds.relax_gui.analyses[data_index].analysis_name = analysis_name ds.relax_gui.analyses[data_index].pipe_name = pipe_name ds.relax_gui.analyses[data_index].pipe_bundle = pipe_bundle # Initialise the variables. ds.relax_gui.analyses[data_index].grid_inc = None ds.relax_gui.analyses[data_index].diff_tensor_grid_inc = {'sphere': 11, 'prolate': 11, 'oblate': 11, 'ellipsoid': 6} ds.relax_gui.analyses[data_index].mc_sim_num = None ds.relax_gui.analyses[data_index].save_dir = self.gui.system_cwd_path ds.relax_gui.analyses[data_index].local_tm_models = ['tm0', 'tm1', 'tm2', 'tm3', 'tm4', 'tm5', 'tm6', 'tm7', 'tm8', 'tm9'] ds.relax_gui.analyses[data_index].mf_models = ['m0', 'm1', 'm2', 'm3', 'm4', 'm5', 'm6', 'm7', 'm8', 'm9'] ds.relax_gui.analyses[data_index].max_iter = 30 # Error checking. if ds.relax_gui.analyses[data_index].pipe_bundle == None: raise RelaxError("The pipe bundle must be supplied.") # Alias the data. self.data = ds.relax_gui.analyses[data_index] self.data_index = data_index # Backward compatibility. if not hasattr(self.data, 'local_tm_models'): self.data.local_tm_models = ['tm0', 'tm1', 'tm2', 'tm3', 'tm4', 'tm5', 'tm6', 'tm7', 'tm8', 'tm9'] if not hasattr(self.data, 'mf_models'): self.data.mf_models = ['m0', 'm1', 'm2', 'm3', 'm4', 'm5', 'm6', 'm7', 'm8', 'm9'] # Initialise the mode selection window. self.mode_win = Protocol_mode_sel_window() # Register the method for updating the spin count for the completion of user functions. self.observer_register() # Execute the base class method to build the panel. super(Auto_model_free, self).__init__(parent, id=id, pos=pos, size=size, style=style, name=name)