Author: bugman Date: Tue Mar 1 18:33:40 2011 New Revision: 12669 URL: http://svn.gna.org/viewcvs/relax?rev=12669&view=rev Log: Converted the relax_data.write() user function back and front end to the new design. Modified: branches/relax_data/generic_fns/relax_data.py branches/relax_data/prompt/relax_data.py Modified: branches/relax_data/generic_fns/relax_data.py URL: http://svn.gna.org/viewcvs/relax/branches/relax_data/generic_fns/relax_data.py?rev=12669&r1=12668&r2=12669&view=diff ============================================================================== --- branches/relax_data/generic_fns/relax_data.py (original) +++ branches/relax_data/generic_fns/relax_data.py Tue Mar 1 18:33:40 2011 @@ -931,8 +931,18 @@ spin.noe_r1_table[j] = spin.num_ri - 1 -def write(ri_label=None, frq_label=None, file=None, dir=None, force=False): - """Write relaxation data to a file.""" +def write(ri_id=None, file=None, dir=None, force=False): + """Write relaxation data to a file. + + @keyword ri_id: The relaxation data ID string. + @type ri_label: str + @keyword file: The name of the file to create. + @type file: str + @keyword dir: The directory to write to. + @type dir: str or None + @keyword force: A flag which if True will cause any pre-existing file to be overwritten. + @type force: bool + """ # Test if the current pipe exists. pipes.test() @@ -941,13 +951,13 @@ if not exists_mol_res_spin_data(): raise RelaxNoSequenceError - # Test if data corresponding to 'ri_label' and 'frq_label' exists. - if not test_labels(ri_label, frq_label): - raise RelaxNoRiError(ri_label, frq_label) + # Test if data exists. + if not hasattr(cdp, 'ri_ids') or ri_id not in cdp.ri_ids: + raise RelaxNoRiError(ri_id) # Create the file name if none is given. if file == None: - file = ri_label + "." + frq_label + ".out" + file = ri_id + ".out" # Write the data. - value.write(param=(ri_label, frq_label), file=file, dir=dir, force=force, return_value=return_value) + value.write(param=ri_id, file=file, dir=dir, force=force, return_value=return_value) Modified: branches/relax_data/prompt/relax_data.py URL: http://svn.gna.org/viewcvs/relax/branches/relax_data/prompt/relax_data.py?rev=12669&r1=12668&r2=12669&view=diff ============================================================================== --- branches/relax_data/prompt/relax_data.py (original) +++ branches/relax_data/prompt/relax_data.py Tue Mar 1 18:33:40 2011 @@ -420,15 +420,13 @@ relax_data.temp_control(ri_id=ri_id, method=method) - def write(self, ri_label=None, frq_label=None, file=None, dir=None, force=False): - """Function for writing R1, R2, or NOE relaxation data to a file. - - Keyword Arguments - ~~~~~~~~~~~~~~~~~ - - ri_label: The relaxation data type, ie 'R1', 'R2', or 'NOE'. - - frq_label: The field strength label. + def write(self, ri_id=None, frq_id=None, file=None, dir=None, force=False): + """Write relaxation data to a file. + + Keyword Arguments + ~~~~~~~~~~~~~~~~~ + + ri_id: The relaxation data ID string. file: The name of the file. @@ -441,26 +439,23 @@ ~~~~~~~~~~~ If no directory name is given, the file will be placed in the current working directory. - The 'ri_label' and 'frq_label' arguments are required for selecting which relaxation data - to write to file. + The 'ri_id' argument is required for selecting which relaxation data to write to file. """ # Function intro text. if self._exec_info.intro: text = self._exec_info.ps3 + "relax_data.write(" - text = text + "ri_label=" + repr(ri_label) - text = text + ", frq_label=" + repr(frq_label) + text = text + "ri_id=" + repr(ri_id) text = text + ", file=" + repr(file) text = text + ", dir=" + repr(dir) text = text + ", force=" + repr(force) + ")" 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 label') arg_check.is_str(file, 'file name') arg_check.is_str(dir, 'directory name', can_be_none=True) arg_check.is_bool(force, 'force flag') # Execute the functional code. - relax_data.write(ri_label=ri_label, frq_label=frq_label, file=file, dir=dir, force=force) + relax_data.write(ri_id=ri_id, file=file, dir=dir, force=force)