Author: bugman Date: Mon Jan 7 16:28:13 2008 New Revision: 4434 URL: http://svn.gna.org/viewcvs/relax?rev=4434&view=rev Log: Merged revisions 4430-4433 via svnmerge from svn+ssh://bugman@xxxxxxxxxxx/svn/relax/1.3 ........ r4430 | bugman | 2008-01-07 15:52:55 +0100 (Mon, 07 Jan 2008) | 5 lines Bug fix for the read() and test_labels() methods of the specific_fns.relax_data.Rx_data class. The arguments are not placed into self! ........ r4431 | bugman | 2008-01-07 15:58:52 +0100 (Mon, 07 Jan 2008) | 5 lines Many fixes for the specific_fns.relax_data.find_index() function. This function now fits into the new relax design. ........ r4432 | bugman | 2008-01-07 16:01:23 +0100 (Mon, 07 Jan 2008) | 3 lines Bug fix. Updated all the calls to self.find_index(). ........ r4433 | bugman | 2008-01-07 16:06:07 +0100 (Mon, 07 Jan 2008) | 6 lines Bug fix for the J(w) mapping system tests trying to set the nucleus type. The call to self.relax.interpreter._Nuclei.nuclei() has been replaced with a call to self.relax.interpreter._Value.set(). ........ Modified: branches/N_state_model/ (props changed) branches/N_state_model/specific_fns/relax_data.py branches/N_state_model/test_suite/system_tests/jw_mapping.py Propchange: branches/N_state_model/ ------------------------------------------------------------------------------ Binary property 'svnmerge-integrated' - no diff available. Modified: branches/N_state_model/specific_fns/relax_data.py URL: http://svn.gna.org/viewcvs/relax/branches/N_state_model/specific_fns/relax_data.py?rev=4434&r1=4433&r2=4434&view=diff ============================================================================== --- branches/N_state_model/specific_fns/relax_data.py (original) +++ branches/N_state_model/specific_fns/relax_data.py Mon Jan 7 16:28:13 2008 @@ -284,8 +284,8 @@ data1 = relax_data_store.res[run1][i] data2 = relax_data_store.res[run2][i] - # Find the index corresponding to 'self.ri_label' and 'self.frq_label'. - index = self.find_index(data1) + # Find the index corresponding to 'ri_label' and 'frq_label'. + index = self.find_index(data1, ri_label, frq_label) # Catch any problems. if index == None: @@ -414,8 +414,8 @@ # Global data flag. self.global_flag = 0 - # Find the index corresponding to 'self.ri_label' and 'self.frq_label'. - index = self.find_index(data) + # Find the index corresponding to 'ri_label' and 'frq_label'. + index = self.find_index(data, ri_label, frq_label) # Catch any problems. if index == None: @@ -480,29 +480,31 @@ self.relax.generic.value.write_data(self.run, (self.ri_label, self.frq_label), sys.stdout, return_value=self.return_value) - def find_index(self, data): - """Function for finding the index corresponding to self.ri_label and self.frq_label.""" + def find_index(self, data, ri_label, frq_label): + """Function for finding the index corresponding to ri_label and frq_label. + + @param data: The class instance containing the ri_label and frq_label variables. + @type data: PipeContainer or SpinContainer + @param ri_label: The relaxation data type, ie 'R1', 'R2', or 'NOE'. + @type ri_label: str + @param frq_label: The field strength label. + @type frq_label: str + @return: The index corresponding to the relaxation data. If there is no + relaxation data corresponding to the labels, None is returned. + @type return: None or int + """ # No data.num_ri data structure. - if self.global_flag == 1: - if not data.num_ri.has_key(self.relax): - return None - else: - if not hasattr(data, 'num_ri'): - return None + if not hasattr(data, 'num_ri'): + return None # Initialise. index = None # Find the index. - if self.global_flag == 1: - for j in xrange(data.num_ri[self.run]): - if self.ri_label == data.ri_labels[self.run][j] and self.frq_label == data.frq_labels[self.run][data.remap_table[self.run][j]]: - index = j - else: - for j in xrange(data.num_ri): - if self.ri_label == data.ri_labels[j] and self.frq_label == data.frq_labels[data.remap_table[j]]: - index = j + for j in xrange(data.num_ri): + if ri_label == data.ri_labels[j] and frq_label == data.frq_labels[data.remap_table[j]]: + index = j # Return the index. return index @@ -547,9 +549,9 @@ if not exists_mol_res_spin_data(): raise RelaxNoSequenceError - # Test if relaxation data corresponding to 'self.ri_label' and 'self.frq_label' already exists. - if self.test_labels(): - raise RelaxRiError, (self.ri_label, self.frq_label) + # Test if relaxation data corresponding to 'ri_label' and 'frq_label' already exists. + if self.test_labels(ri_label, frq_label): + raise RelaxRiError, (ri_label, frq_label) # Minimum number of columns. min_col_num = max(mol_name_col, res_num_col, res_name_col, spin_num_col, spin_name_col, data_col, error_col) @@ -654,7 +656,7 @@ value = None error = None - # Find the index corresponding to 'self.ri_label' and 'self.frq_label'. + # Find the index corresponding to 'ri_label' and 'frq_label'. index = self.find_index(relax_data_store.res[self.run][i]) # Get the data. @@ -666,8 +668,8 @@ return value, error - def test_labels(self): - """Test if data corresponding to 'self.ri_label' and 'self.frq_label' currently exists. + def test_labels(self, ri_label, frq_label): + """Test if data corresponding to 'ri_label' and 'frq_label' currently exists. @return: The answer to the question of whether relaxation data exists corresponding to the given labels. @@ -682,8 +684,8 @@ # Loop over the relaxation data. for j in xrange(spin.num_ri): - # Test if the relaxation data matches 'self.ri_label' and 'self.frq_label'. - if self.ri_label == spin.ri_labels[j] and self.frq_label == spin.frq_labels[spin.remap_table[j]]: + # Test if the relaxation data matches 'ri_label' and 'frq_label'. + if ri_label == spin.ri_labels[j] and frq_label == spin.frq_labels[spin.remap_table[j]]: return True # No match. @@ -776,7 +778,7 @@ self.data_init(spin) # Find the index corresponding to 'ri_label' and 'frq_label'. - index = self.find_index(spin) + index = self.find_index(spin, ri_label, frq_label) # Append empty data. if index == None: Modified: branches/N_state_model/test_suite/system_tests/jw_mapping.py URL: http://svn.gna.org/viewcvs/relax/branches/N_state_model/test_suite/system_tests/jw_mapping.py?rev=4434&r1=4433&r2=4434&view=diff ============================================================================== --- branches/N_state_model/test_suite/system_tests/jw_mapping.py (original) +++ branches/N_state_model/test_suite/system_tests/jw_mapping.py Mon Jan 7 16:28:13 2008 @@ -75,12 +75,10 @@ for dataSet in xrange(len(dataPaths)): self.relax.interpreter._Relax_data.read(dataTypes[dataSet][0], dataTypes[dataSet][1], dataTypes[dataSet][2], dataPaths[dataSet]) - # Nuclei type. - self.relax.interpreter._Nuclei.nuclei('N') - - # Set r and csa. + # Set r, csa, and the nucleus type. self.relax.interpreter._Value.set(NH_BOND_LENGTH, 'bond_length') self.relax.interpreter._Value.set(N15_CSA, 'csa') + self.relax.interpreter._Value.set('N', 'nucleus') # Select the frequency. self.relax.interpreter._Jw_mapping.set_frq(frq=600.0 * 1e6)