Author: bugman Date: Sun Dec 9 12:15:34 2007 New Revision: 4137 URL: http://svn.gna.org/viewcvs/relax?rev=4137&view=rev Log: Updated the value.set() user function to the new relax design. Modified: 1.3/prompt/value.py Modified: 1.3/prompt/value.py URL: http://svn.gna.org/viewcvs/relax/1.3/prompt/value.py?rev=4137&r1=4136&r2=4137&view=diff ============================================================================== --- 1.3/prompt/value.py (original) +++ 1.3/prompt/value.py Sun Dec 9 12:15:34 2007 @@ -248,27 +248,23 @@ self.__relax__.generic.value.read(run=run, param=param, scaling=scaling, file=file, num_col=num_col, name_col=name_col, data_col=data_col, error_col=error_col, sep=sep) - def set(self, run=None, value=None, param=None, res_num=None, res_name=None): - """Function for setting residue specific data values. + def set(self, value=None, param=None, spin_id=None): + """Function for setting spin specific data values. Keyword arguments ~~~~~~~~~~~~~~~~~ - run: The run to assign the values to. - value: The value(s). param: The parameter(s). - res_num: The residue number. - - res_name: The residue name. + spin_id: The spin identifier. Description ~~~~~~~~~~~ - If this function is used to change values of previously minimised runs, then the + If this function is used to change values of previously minimised results, then the minimisation statistics (chi-squared value, iteration count, function count, gradient count, and Hessian count) will be reset to None. @@ -311,86 +307,73 @@ |_______|_______|__________________________________________________________________________| - Residue number and name argument - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - - If the 'res_num' and 'res_name' arguments are left as the defaults of None, then the - function will be applied to all residues. Otherwise the residue number can be set to either - an integer for selecting a single residue or a python regular expression string for - selecting multiple residues. The residue name argument must be a string and can use regular - expression as well. If the data is global non-residue specific data, such as diffusion - tensor parameters, supplying the residue number and name will terminate the program with an - error. + Spin identification + ~~~~~~~~~~~~~~~~~~~ + + If the 'spin_id' argument is left as the default of None, then the function will be applied + to all spins. If the data is global non-residue specific data, such as diffusion tensor + parameters, supplying the spin identifier will terminate the program with an error. Examples ~~~~~~~~ - To set the parameter values for the run 'test' to the default values, for all residues, + To set the parameter values for the current data pipe to the default values, for all spins, type: - relax> value.set('test') - - - To set the parameter values of residue 10, which is the model-free run 'm4' and has the - parameters {S2, te, Rex}, the following can be used. Rex term is the value for the first - given field strength. - - relax> value.set('m4', [0.97, 2.048*1e-9, 0.149], res_num=10) - relax> value.set('m4', value=[0.97, 2.048*1e-9, 0.149], res_num=10) - - - To set the CSA value for the model-free run 'tm3' to the default value, type: - - relax> value.set('tm3', param='csa') - - - To set the CSA value of all residues in the reduced spectral density mapping run '600MHz' to - -172 ppm, type: - - relax> value.set('600MHz', -172 * 1e-6, 'csa') - relax> value.set('600MHz', value=-172 * 1e-6, param='csa') - - - To set the NH bond length of all residues in the model-free run 'm5' to 1.02 Angstroms, - type: - - relax> value.set('m5', 1.02 * 1e-10, 'bond_length') - relax> value.set('m5', value=1.02 * 1e-10, param='r') - - - To set both the bond length and the CSA value for the run 'new' to the default values, type: - - relax> value.set('new', param=['bond length', 'csa']) - - - To set both tf and ts in the model-free run 'm6' to 100 ps, type: - - relax> value.set('m6', 100e-12, ['tf', 'ts']) - relax> value.set('m6', value=100e-12, param=['tf', 'ts']) - - - To set the S2 and te parameter values for model-free run 'm4' which has the parameters - {S2, te, Rex} to 0.56 and 13 ps, type: - - relax> value.set('m4', [0.56, 13e-12], ['S2', 'te'], 10) - relax> value.set('m4', value=[0.56, 13e-12], param=['S2', 'te'], res_num=10) - relax> value.set(run='m4', value=[0.56, 13e-12], param=['S2', 'te'], res_num=10) + relax> value.set() + + + To set the parameter values of residue 10, which is in the current model-free data pipe 'm4' + and has the parameters {S2, te, Rex}, the following can be used. Rex term is the value for + the first given field strength. + + relax> value.set([0.97, 2.048*1e-9, 0.149], spin_id=':10') + relax> value.set(value=[0.97, 2.048*1e-9, 0.149], spin_id=':10') + + + To set the CSA value of all spins to the default value, type: + + relax> value.set(param='csa') + + + To set the CSA value of all spins to -172 ppm, type: + + relax> value.set(-172 * 1e-6, 'csa') + relax> value.set(value=-172 * 1e-6, param='csa') + + + To set the NH bond length of all spins to 1.02 Angstroms, type: + + relax> value.set(1.02 * 1e-10, 'bond_length') + relax> value.set(value=1.02 * 1e-10, param='r') + + + To set both the bond length and the CSA value to the default values, type: + + relax> value.set(param=['bond length', 'csa']) + + + To set both tf and ts to 100 ps, type: + + relax> value.set(100e-12, ['tf', 'ts']) + relax> value.set(value=100e-12, param=['tf', 'ts']) + + + To set the S2 and te parameter values of residue 126, Ca spins to 0.56 and 13 ps, type: + + relax> value.set([0.56, 13e-12], ['S2', 'te'], ':126@Ca') + relax> value.set(value=[0.56, 13e-12], param=['S2', 'te'], spin_id=':126@Ca') + relax> value.set(value=[0.56, 13e-12], param=['S2', 'te'], spin_id=':126@Ca') """ # Function intro text. if self.__relax__.interpreter.intro: text = sys.ps3 + "value.set(" - text = text + "run=" + `run` - text = text + ", value=" + `value` + text = text + "value=" + `value` text = text + ", param=" + `param` - text = text + ", res_num=" + `res_num` - text = text + ", res_name=" + `res_name` + ")" + text = text + ", spin_id=" + `spin_id` + ")" print text - - # The run name. - if type(run) != str: - raise RelaxStrError, ('run', run) # The value. if value != None and type(value) != float and type(value) != int and type(value) != list: @@ -420,16 +403,12 @@ if type(value) == list and type(param) == list and len(value) != len(param): raise RelaxError, "Both the value array and parameter array must be of equal length." - # Residue number. - if res_num != None and type(res_num) != int and type(res_num) != str: - raise RelaxNoneIntStrError, ('residue number', res_num) - - # Residue name. - if res_name != None and type(res_name) != str: - raise RelaxNoneStrError, ('residue name', res_name) + # Spin identifier. + if spin_id != None and type(spin_id) != str: + raise RelaxNoneStrError, ('spin identifier', spin_id) # Execute the functional code. - self.__relax__.generic.value.set(run=run, value=value, param=param, res_num=res_num, res_name=res_name) + value.set(value=value, param=param, spin_id=spin_id) def write(self, run=None, param=None, file=None, dir=None, force=0):