Author: bugman Date: Thu Oct 8 18:50:04 2009 New Revision: 9669 URL: http://svn.gna.org/viewcvs/relax?rev=9669&view=rev Log: Clean up of the relaxation data bmrb_write() method. The abstracted bmrblib API is now being called for all relaxation data. Modified: branches/bmrb/bmrblib/kinetics/general_relaxation.py branches/bmrb/generic_fns/relax_data.py Modified: branches/bmrb/bmrblib/kinetics/general_relaxation.py URL: http://svn.gna.org/viewcvs/relax/branches/bmrb/bmrblib/kinetics/general_relaxation.py?rev=9669&r1=9668&r2=9669&view=diff ============================================================================== --- branches/bmrb/bmrblib/kinetics/general_relaxation.py (original) +++ branches/bmrb/bmrblib/kinetics/general_relaxation.py Thu Oct 8 18:50:04 2009 @@ -58,9 +58,11 @@ self.add_tag_categories() - def add(self, frq=None, res_nums=None, res_names=None, atom_names=None, isotope=None, data=None, errors=None): + def add(self, data_type=None, frq=None, res_nums=None, res_names=None, atom_names=None, isotope=None, data=None, errors=None): """Add relaxation data to the data nodes. + @keyword data_type: The relaxation data type (one of 'R1' or 'R2'). + @type data_type: str @keyword frq: The spectrometer proton frequency, in Hz. @type frq: float @keyword res_nums: The residue number list. @@ -99,6 +101,14 @@ self.rx_inc_list = translate([self.r1_inc] * self.N) self.generate_data_ids(self.N) + # The operators of the relaxation superoperator. + operator_pair = [] + for i in range(cdp.num_ri): + if cdp.ri_labels[i] == 'R1': + operator_pair.append(['Iz', 'Iz']) + elif cdp.ri_labels[i] == 'R2': + operator_pair.append(['I+', 'I+']) + # Set up the version specific variables. self.specific_setup() Modified: branches/bmrb/generic_fns/relax_data.py URL: http://svn.gna.org/viewcvs/relax/branches/bmrb/generic_fns/relax_data.py?rev=9669&r1=9668&r2=9669&view=diff ============================================================================== --- branches/bmrb/generic_fns/relax_data.py (original) +++ branches/bmrb/generic_fns/relax_data.py Thu Oct 8 18:50:04 2009 @@ -228,13 +228,11 @@ -def bmrb_write(star, version='3.1'): +def bmrb_write(star): """Generate the relaxation data saveframes for the NMR-STAR dictionary object. - @param star: The NMR-STAR dictionary object. - @type star: NMR_STAR instance - @keyword version: The BMRB NMR-STAR dictionary format to output to. - @type version: str + @param star: The NMR-STAR dictionary object. + @type star: NMR_STAR instance """ # Get the current data pipe. @@ -284,33 +282,9 @@ # Other info. isotope_list.append(int(string.strip(spin.heteronuc_type, string.ascii_letters))) - # The operators of the relaxation superoperator. - operator_pair = [] - for i in range(cdp.num_ri): - if cdp.ri_labels[i] == 'R1': - operator_pair.append(['Iz', 'Iz']) - elif cdp.ri_labels[i] == 'R2': - operator_pair.append(['I+', 'I+']) - elif cdp.ri_labels[i] == 'NOE': - operator_pair.append(['Iz', 'Sz']) - # Add the relaxation data. for i in range(cdp.num_ri): - # The general relaxation saveframe versions. - if version in ['3.2']: - if cdp.ri_labels[i] in ['R1', 'R2']: - star.relaxation.add(operator_pair=operator_pair[i], frq=cdp.frq[cdp.remap_table[i]], res_nums=res_num_list, res_names=res_name_list, atom_names=atom_name_list, isotope=isotope_list, data=relax_data_list[i], errors=relax_error_list[i]) - elif cdp.ri_labels[i] == 'NOE': - star.heteronucl_NOEs.add(frq=cdp.frq[cdp.remap_table[i]], res_nums=res_num_list, res_names=res_name_list, atom_names=atom_name_list, isotope=isotope_list, data=relax_data_list[i], errors=relax_error_list[i]) - - # Older versions. - if version in ['3.0', '3.1']: - if cdp.ri_labels[i] == 'R1': - star.heteronucl_T1_relaxation.add(frq=cdp.frq[cdp.remap_table[i]], res_nums=res_num_list, res_names=res_name_list, atom_names=atom_name_list, isotope=isotope_list, data=relax_data_list[i], errors=relax_error_list[i]) - elif cdp.ri_labels[i] == 'R2': - star.heteronucl_T2_relaxation.add(frq=cdp.frq[cdp.remap_table[i]], res_nums=res_num_list, res_names=res_name_list, atom_names=atom_name_list, isotope=isotope_list, data=relax_data_list[i], errors=relax_error_list[i]) - elif cdp.ri_labels[i] == 'NOE': - star.heteronucl_NOEs.add(frq=cdp.frq[cdp.remap_table[i]], res_nums=res_num_list, res_names=res_name_list, atom_names=atom_name_list, isotope=isotope_list, data=relax_data_list[i], errors=relax_error_list[i]) + star.relaxation.add(data_type=cdp.ri_labels[i], frq=cdp.frq[cdp.remap_table[i]], res_nums=res_num_list, res_names=res_name_list, atom_names=atom_name_list, isotope=isotope_list, data=relax_data_list[i], errors=relax_error_list[i]) def copy(pipe_from=None, pipe_to=None, ri_label=None, frq_label=None):