Author: bugman Date: Tue Mar 1 15:36:46 2011 New Revision: 12647 URL: http://svn.gna.org/viewcvs/relax?rev=12647&view=rev Log: Redesigned the relax_data.read() user function front end for handling data ID strings. Modified: branches/relax_data/prompt/relax_data.py Modified: branches/relax_data/prompt/relax_data.py URL: http://svn.gna.org/viewcvs/relax/branches/relax_data/prompt/relax_data.py?rev=12647&r1=12646&r2=12647&view=diff ============================================================================== --- branches/relax_data/prompt/relax_data.py (original) +++ branches/relax_data/prompt/relax_data.py Tue Mar 1 15:36:46 2011 @@ -1,6 +1,6 @@ ############################################################################### # # -# Copyright (C) 2003-2005,2007-2010 Edward d'Auvergne # +# Copyright (C) 2003-2005,2007-2011 Edward d'Auvergne # # # # This file is part of the program relax. # # # @@ -234,15 +234,15 @@ relax_data.peak_intensity_type(ri_label=ri_label, frq_label=frq_label, type=type) - def read(self, ri_label=None, frq_label=None, frq=None, file=None, dir=None, spin_id_col=None, mol_name_col=None, res_num_col=None, res_name_col=None, spin_num_col=None, spin_name_col=None, data_col=None, error_col=None, sep=None, spin_id=None): - """Function for reading R1, R2, or NOE relaxation data from a file. - - Keyword Arguments - ~~~~~~~~~~~~~~~~~ - - ri_label: The relaxation data type, ie 'R1', 'R2', or 'NOE'. - - frq_label: The field strength label. + def read(self, ri_id=None, ri_type=None, frq=None, file=None, dir=None, spin_id_col=None, mol_name_col=None, res_num_col=None, res_name_col=None, spin_num_col=None, spin_name_col=None, data_col=None, error_col=None, sep=None, spin_id=None): + """Read R1, R2, or NOE relaxation data from a file. + + Keyword Arguments + ~~~~~~~~~~~~~~~~~ + + ri_id: The relaxation data ID string. + + ri_type: The relaxation data type, ie 'R1', 'R2', or 'NOE'. frq: The spectrometer frequency in Hz. @@ -294,9 +294,9 @@ a file called 'noe.600.out' where the residue numbers, residue names, data, errors are in the first, second, third, and forth columns respectively. - relax> relax_data.read('NOE', '600', 599.7 * 1e6, 'noe.600.out', res_num_col=1, + relax> relax_data.read('NOE_600', 'NOE', 599.7 * 1e6, 'noe.600.out', res_num_col=1, res_name_col=2, data_col=3, error_col=4) - relax> relax_data.read(ri_label='NOE', frq_label='600', frq=600.0 * 1e6, file='noe.600.out', + relax> relax_data.read(ri_id='NOE_600', ri_type='NOE', frq=600.0 * 1e6, file='noe.600.out', res_num_col=1, res_name_col=2, data_col=3, error_col=4) @@ -304,23 +304,23 @@ numbers, residue names, data, errors are in the second, third, fifth, and sixth columns respectively. The columns are separated by commas. - relax> relax_data.read('R2', '800 MHz', 8.0 * 1e8, 'r2.out', res_num_col=2, - res_name_col=3, data_col=5, error_col=6, sep=',') - relax> relax_data.read(ri_label='R2', frq_label='800 MHz', frq=8.0*1e8, file='r2.out', + relax> relax_data.read('R2_800', 'R2', 8.0 * 1e8, 'r2.out', res_num_col=2, res_name_col=3, + data_col=5, error_col=6, sep=',') + relax> relax_data.read(ri_id='R2_800', ri_type='R2', frq=8.0*1e8, file='r2.out', res_num_col=2, res_name_col=3, data_col=5, error_col=6, sep=',') The following commands will read the R1 data out of the file 'r1.out' where the columns are separated by the symbol '%' - relax> relax_data.read('R1', '300', 300.1 * 1e6, 'r1.out', sep='%') + relax> relax_data.read('R1_300', 'R1', 300.1 * 1e6, 'r1.out', sep='%') """ # Function intro text. if self._exec_info.intro: text = self._exec_info.ps3 + "relax_data.read(" - text = text + "ri_label=" + repr(ri_label) - text = text + ", frq_label=" + repr(frq_label) + text = text + "ri_id=" + repr(ri_id) + text = text + ", ri_type=" + repr(ri_type) text = text + ", frq=" + repr(frq) text = text + ", file=" + repr(file) text = text + ", dir=" + repr(dir) @@ -337,8 +337,8 @@ print(text) # The argument checks. - arg_check.is_str(ri_label, 'relaxation label') - arg_check.is_str(frq_label, 'frequency label') + arg_check.is_str(ri_id, 'relaxation ID string') + arg_check.is_str(ri_type, 'relaxation type') arg_check.is_num(frq, 'frequency') arg_check.is_str(file, 'file name') arg_check.is_str(dir, 'directory name', can_be_none=True) @@ -354,7 +354,7 @@ arg_check.is_str(spin_id, 'spin ID string', can_be_none=True) # Execute the functional code. - relax_data.read(ri_label=ri_label, frq_label=frq_label, frq=frq, file=file, dir=dir, spin_id_col=spin_id_col, mol_name_col=mol_name_col, res_num_col=res_num_col, res_name_col=res_name_col, spin_num_col=spin_num_col, spin_name_col=spin_name_col, data_col=data_col, error_col=error_col, sep=sep, spin_id=spin_id) + relax_data.read(ri_id=ri_id, ri_type=ri_type, frq=frq, file=file, dir=dir, spin_id_col=spin_id_col, mol_name_col=mol_name_col, res_num_col=res_num_col, res_name_col=res_name_col, spin_num_col=spin_num_col, spin_name_col=spin_name_col, data_col=data_col, error_col=error_col, sep=sep, spin_id=spin_id) def temp_calibration(self, ri_label=None, frq_label=None, method=None):