def test_svd_argfail_basis_set(self): """The proper failure of the align_tensor.svd() user function for the basis_set argument.""" # Add an alignment tensor. align_tensor.init(align_id='a', params=(0.0, 0.0, 0.0, 0.0, 0.0)) # Loop over the data types. for data in DATA_TYPES: # Catch the int and bin arguments, and skip them. if data[0] == 'int' or data[0] == 'bin': continue # The argument test. self.assertRaises(RelaxIntError, self.align_tensor_fns.svd, basis_set=data[1])
def test_svd_argfail_basis_tensors(self): """The tensors arg unit test of the align_tensor.svd() user function.""" # Add an alignment tensor. align_tensor.init(align_id='a', params=(0.0, 0.0, 0.0, 0.0, 0.0)) # Loop over the data types. for data in DATA_TYPES: # Catch the None and str list arguments, and skip them. if data[0] == 'None' or data[0] == 'str list': continue # The argument test. self.assertRaises(RelaxNoneListStrError, self.align_tensor_fns.svd, tensors=data[1])
def test_matrix_angles_argfail_basis_set(self): """The proper failure of the align_tensor.matrix_angles() user function for the basis_set argument.""" # Add an alignment tensor. align_tensor.init(align_id='a', params=(0.0, 0.0, 0.0, 0.0, 0.0)) # Loop over the data types. for data in DATA_TYPES: # Catch the str argument, and skip it. if data[0] == 'str': continue # The argument test. self.assertRaises(RelaxStrError, self.align_tensor_fns.matrix_angles, basis_set=data[1])
def test_svd_argfail_basis_set(self): """The proper failure of the align_tensor.svd() user function for the basis_set argument.""" # Add an alignment tensor. align_tensor.init(align_id='a', params=(0.0, 0.0, 0.0, 0.0, 0.0)) # Loop over the data types. for data in DATA_TYPES: # Catch the str argument, and skip it. if data[0] == 'str': continue # The argument test. self.assertRaises(RelaxStrError, self.align_tensor_fns.svd, basis_set=data[1])
def update_model(): """Update the model parameters as necessary.""" # Initialise the list of model parameters. if not hasattr(cdp, 'params'): cdp.params = [] # Determine the number of states (loaded as structural models), if not already set. if not hasattr(cdp, 'N'): # Set the number. if hasattr(cdp, 'structure'): cdp.N = cdp.structure.num_models() # Otherwise return as the rest cannot be updated without N. else: return # Set up the parameter arrays. if not cdp.params: # Add the probability or population weight parameters. if cdp.model in ['2-domain', 'population']: for i in range(cdp.N - 1): cdp.params.append('p' + repr(i)) # Add the Euler angle parameters. if cdp.model == '2-domain': for i in range(cdp.N): cdp.params.append('alpha' + repr(i)) cdp.params.append('beta' + repr(i)) cdp.params.append('gamma' + repr(i)) # Initialise the probability and Euler angle arrays. if cdp.model in ['2-domain', 'population']: if not hasattr(cdp, 'probs'): cdp.probs = [None] * cdp.N if cdp.model == '2-domain': if not hasattr(cdp, 'alpha'): cdp.alpha = [None] * cdp.N if not hasattr(cdp, 'beta'): cdp.beta = [None] * cdp.N if not hasattr(cdp, 'gamma'): cdp.gamma = [None] * cdp.N # Determine the data type. data_types = base_data_types() # Set up tensors for each alignment. if hasattr(cdp, 'align_ids'): for id in cdp.align_ids: # No tensors initialised. if not hasattr(cdp, 'align_tensors'): align_tensor.init(tensor=id, align_id=id) # Find if the tensor corresponding to the id exists. exists = False for tensor in cdp.align_tensors: if id == tensor.align_id: exists = True # Initialise the tensor. if not exists: align_tensor.init(tensor=id, align_id=id)
def update_model(): """Update the model parameters as necessary.""" # Initialise the list of model parameters. if not hasattr(cdp, 'params'): cdp.params = [] # Determine the number of states (loaded as structural models), if not already set. if not hasattr(cdp, 'N'): # Set the number. if hasattr(cdp, 'structure'): cdp.N = cdp.structure.num_models() # Otherwise return as the rest cannot be updated without N. else: return # Set up the parameter arrays. if not cdp.params: # Add the probability or population weight parameters. if cdp.model in ['2-domain', 'population']: for i in range(cdp.N-1): cdp.params.append('p' + repr(i)) # Add the Euler angle parameters. if cdp.model == '2-domain': for i in range(cdp.N): cdp.params.append('alpha' + repr(i)) cdp.params.append('beta' + repr(i)) cdp.params.append('gamma' + repr(i)) # Initialise the probability and Euler angle arrays. if cdp.model in ['2-domain', 'population']: if not hasattr(cdp, 'probs'): cdp.probs = [None] * cdp.N if cdp.model == '2-domain': if not hasattr(cdp, 'alpha'): cdp.alpha = [None] * cdp.N if not hasattr(cdp, 'beta'): cdp.beta = [None] * cdp.N if not hasattr(cdp, 'gamma'): cdp.gamma = [None] * cdp.N # Determine the data type. data_types = base_data_types() # Set up tensors for each alignment. if hasattr(cdp, 'align_ids'): for id in cdp.align_ids: # No tensors initialised. if not hasattr(cdp, 'align_tensors'): align_tensor.init(tensor=id, align_id=id, params=[0.0, 0.0, 0.0, 0.0, 0.0]) # Find if the tensor corresponding to the id exists. exists = False for tensor in cdp.align_tensors: if id == tensor.align_id: exists = True # Initialise the tensor. if not exists: align_tensor.init(tensor=id, align_id=id, params=[0.0, 0.0, 0.0, 0.0, 0.0])