Author: bugman Date: Tue Oct 21 16:01:01 2008 New Revision: 7881 URL: http://svn.gna.org/viewcvs/relax?rev=7881&view=rev Log: Created the empty user function class 'spectrum'. Added: branches/spectral_errors/prompt/spectrum.py - copied, changed from r7879, branches/spectral_errors/prompt/model_free.py Modified: branches/spectral_errors/prompt/interpreter.py Modified: branches/spectral_errors/prompt/interpreter.py URL: http://svn.gna.org/viewcvs/relax/branches/spectral_errors/prompt/interpreter.py?rev=7881&r1=7880&r2=7881&view=diff ============================================================================== --- branches/spectral_errors/prompt/interpreter.py (original) +++ branches/spectral_errors/prompt/interpreter.py Tue Oct 21 16:01:01 2008 @@ -82,6 +82,7 @@ from pipe import Pipe from select import Select from sequence import Sequence +from spectrum import Spectrum from spin import Spin from state import State from deselect import Deselect @@ -166,6 +167,7 @@ self._Pipe = Pipe(relax) self._Select = Select(relax) self._Sequence = Sequence(relax) + self._Spectrum = Spectrum(relax) self._Spin = Spin(relax) self._State = State(relax) self._Deselect = Deselect(relax) @@ -235,6 +237,7 @@ pipe = self._Pipe select = self._Select sequence = self._Sequence + spectrum = self._Spectrum spin = self._Spin state = self._State deselect = self._Deselect Copied: branches/spectral_errors/prompt/spectrum.py (from r7879, branches/spectral_errors/prompt/model_free.py) URL: http://svn.gna.org/viewcvs/relax/branches/spectral_errors/prompt/spectrum.py?p2=branches/spectral_errors/prompt/spectrum.py&p1=branches/spectral_errors/prompt/model_free.py&r1=7879&r2=7881&rev=7881&view=diff ============================================================================== --- branches/spectral_errors/prompt/model_free.py (original) +++ branches/spectral_errors/prompt/spectrum.py Tue Oct 21 16:01:01 2008 @@ -26,10 +26,9 @@ # relax module imports. import help from relax_errors import RelaxIntError, RelaxListError, RelaxListStrError, RelaxNoneStrError, RelaxStrError -from specific_fns.setup import model_free_obj -class Model_free: +class Spectrum: def __init__(self, relax): # Help. self.__relax_help__ = \ @@ -40,333 +39,3 @@ # Place relax in the class namespace. self.__relax__ = relax - - - def create_model(self, model=None, equation=None, params=None, spin_id=None): - """Function to create a model-free model. - - Keyword Arguments - ~~~~~~~~~~~~~~~~~ - - model: The name of the model-free model. - - equation: The model-free equation. - - params: The array of parameter names of the model. - - spin_id: The spin identification string. - - - Model-free equation - ~~~~~~~~~~~~~~~~~~~ - - 'mf_orig' selects the original model-free equations with parameters {S2, te}. - 'mf_ext' selects the extended model-free equations with parameters {S2f, tf, S2, ts}. - 'mf_ext2' selects the extended model-free equations with parameters {S2f, tf, S2s, ts}. - - - Model-free parameters - ~~~~~~~~~~~~~~~~~~~~~ - - The following parameters are accepted for the original model-free equation: - - 'S2': The square of the generalised order parameter. - 'te': The effective correlation time. - - The following parameters are accepted for the extended model-free equation: - - 'S2f': The square of the generalised order parameter of the faster motion. - 'tf': The effective correlation time of the faster motion. - 'S2': The square of the generalised order parameter S2 = S2f * S2s. - 'ts': The effective correlation time of the slower motion. - - The following parameters are accepted for the extended 2 model-free equation: - - 'S2f': The square of the generalised order parameter of the faster motion. - 'tf': The effective correlation time of the faster motion. - 'S2s': The square of the generalised order parameter of the slower motion. - 'ts': The effective correlation time of the slower motion. - - The following parameters are accepted for all equations: - - 'Rex': The chemical exchange relaxation. - 'r': The average bond length <r>. - 'CSA': The chemical shift anisotropy. - - - Spin identification string - ~~~~~~~~~~~~~~~~~~~~~~~~~~ - - If 'spin_id' is supplied then the model will only be created for the corresponding spins. - Otherwise the model will be created for all spins. - - - Examples - ~~~~~~~~ - - The following commands will create the model-free model 'm1' which is based on the original - model-free equation and contains the single parameter 'S2'. - - relax> model_free.create_model('m1', 'mf_orig', ['S2']) - relax> model_free.create_model(model='m1', params=['S2'], equation='mf_orig') - - - The following commands will create the model-free model 'large_model' which is based on the - extended model-free equation and contains the seven parameters 'S2f', 'tf', 'S2', 'ts', - 'Rex', 'CSA', 'r'. - - relax> model_free.create_model('large_model', 'mf_ext', ['S2f', 'tf', 'S2', 'ts', 'Rex', - 'CSA', 'r']) - relax> model_free.create_model(model='large_model', params=['S2f', 'tf', 'S2', 'ts', 'Rex', - 'CSA', 'r'], equation='mf_ext') - """ - - # Function intro text. - if self.__relax__.interpreter.intro: - text = sys.ps3 + "model_free.create_model(" - text = text + "model=" + `model` - text = text + ", equation=" + `equation` - text = text + ", params=" + `params` - text = text + ", spin_id=" + `spin_id` + ")" - print text - - # Model argument. - if type(model) != str: - raise RelaxStrError, ('model', model) - - # Equation. - if type(equation) != str: - raise RelaxStrError, ('model-free equation', equation) - - # Parameter types. - if type(params) != list: - raise RelaxListStrError, ('parameters', params) - else: - # Empty list. - if params == []: - raise RelaxListStrError, ('parameters', params) - - # Check the values. - for i in xrange(len(params)): - if type(params[i]) != str: - raise RelaxListStrError, ('parameters', params) - - # Spin identification string. - if spin_id != None and type(spin_id) != str: - raise RelaxNoneStrError, ('spin identification string', spin_id) - - # Execute the functional code. - model_free_obj.create_model(model=model, equation=equation, params=params, spin_id=spin_id) - - - def delete(self): - """Function for deleting all model-free data from the current data pipe. - - Examples - ~~~~~~~~ - - To delete all model-free data, type: - - relax> model_free.delete() - """ - - # Function intro text. - if self.__relax__.interpreter.intro: - text = sys.ps3 + "model_free.delete()" - print text - - # Execute the functional code. - model_free_obj.delete() - - - def remove_tm(self, spin_id=None): - """Function for removing the local tm parameter from a model. - - Keyword Arguments - ~~~~~~~~~~~~~~~~~ - - spin_id: The spin identification string. - - - Description - ~~~~~~~~~~~ - - This function will remove the local tm parameter from the model-free parameter set. If - there is no local tm parameter within the set nothing will happen. - - If no spin identification string is given, then the function will apply to all spins. - - - Examples - ~~~~~~~~ - - The following command will remove the parameter 'tm': - - relax> model_free.remove_tm() - """ - - # Function intro text. - if self.__relax__.interpreter.intro: - text = sys.ps3 + "model_free.remove_tm(" - text = text + "spin_id=" + `spin_id` + ")" - print text - - # Spin identification string. - if spin_id != None and type(spin_id) != str: - raise RelaxNoneStrError, ('spin identification string', spin_id) - - # Execute the functional code. - model_free_obj.remove_tm(spin_id=spin_id) - - - def select_model(self, model=None, spin_id=None): - """Function for the selection of a preset model-free model. - - Keyword Arguments - ~~~~~~~~~~~~~~~~~ - - model: The name of the preset model. - - - The preset models - ~~~~~~~~~~~~~~~~~ - - The standard preset model-free models are - 'm0' = {}, - 'm1' = {S2}, - 'm2' = {S2, te}, - 'm3' = {S2, Rex}, - 'm4' = {S2, te, Rex}, - 'm5' = {S2f, S2, ts}, - 'm6' = {S2f, tf, S2, ts}, - 'm7' = {S2f, S2, ts, Rex}, - 'm8' = {S2f, tf, S2, ts, Rex}, - 'm9' = {Rex}. - - The preset model-free models with optimisation of the CSA value are - 'm10' = {CSA}, - 'm11' = {CSA, S2}, - 'm12' = {CSA, S2, te}, - 'm13' = {CSA, S2, Rex}, - 'm14' = {CSA, S2, te, Rex}, - 'm15' = {CSA, S2f, S2, ts}, - 'm16' = {CSA, S2f, tf, S2, ts}, - 'm17' = {CSA, S2f, S2, ts, Rex}, - 'm18' = {CSA, S2f, tf, S2, ts, Rex}, - 'm19' = {CSA, Rex}. - - The preset model-free models with optimisation of the bond length are - 'm20' = {r}, - 'm21' = {r, S2}, - 'm22' = {r, S2, te}, - 'm23' = {r, S2, Rex}, - 'm24' = {r, S2, te, Rex}, - 'm25' = {r, S2f, S2, ts}, - 'm26' = {r, S2f, tf, S2, ts}, - 'm27' = {r, S2f, S2, ts, Rex}, - 'm28' = {r, S2f, tf, S2, ts, Rex}, - 'm29' = {r, CSA, Rex}. - - The preset model-free models with both optimisation of the bond length and CSA are - 'm30' = {r, CSA}, - 'm31' = {r, CSA, S2}, - 'm32' = {r, CSA, S2, te}, - 'm33' = {r, CSA, S2, Rex}, - 'm34' = {r, CSA, S2, te, Rex}, - 'm35' = {r, CSA, S2f, S2, ts}, - 'm36' = {r, CSA, S2f, tf, S2, ts}, - 'm37' = {r, CSA, S2f, S2, ts, Rex}, - 'm38' = {r, CSA, S2f, tf, S2, ts, Rex}, - 'm39' = {r, CSA, Rex}. - - Warning: The models in the thirties range fail when using standard R1, R2, and NOE - relaxation data. This is due to the extreme flexibly of these models where a change in the - parameter 'r' is compensated by a corresponding change in the parameter 'CSA' and - vice versa. - - - Additional preset model-free models, which are simply extensions of the above models with - the addition of a local tm parameter are: - 'tm0' = {tm}, - 'tm1' = {tm, S2}, - 'tm2' = {tm, S2, te}, - 'tm3' = {tm, S2, Rex}, - 'tm4' = {tm, S2, te, Rex}, - 'tm5' = {tm, S2f, S2, ts}, - 'tm6' = {tm, S2f, tf, S2, ts}, - 'tm7' = {tm, S2f, S2, ts, Rex}, - 'tm8' = {tm, S2f, tf, S2, ts, Rex}, - 'tm9' = {tm, Rex}. - - The preset model-free models with optimisation of the CSA value are - 'tm10' = {tm, CSA}, - 'tm11' = {tm, CSA, S2}, - 'tm12' = {tm, CSA, S2, te}, - 'tm13' = {tm, CSA, S2, Rex}, - 'tm14' = {tm, CSA, S2, te, Rex}, - 'tm15' = {tm, CSA, S2f, S2, ts}, - 'tm16' = {tm, CSA, S2f, tf, S2, ts}, - 'tm17' = {tm, CSA, S2f, S2, ts, Rex}, - 'tm18' = {tm, CSA, S2f, tf, S2, ts, Rex}, - 'tm19' = {tm, CSA, Rex}. - - The preset model-free models with optimisation of the bond length are - 'tm20' = {tm, r}, - 'tm21' = {tm, r, S2}, - 'tm22' = {tm, r, S2, te}, - 'tm23' = {tm, r, S2, Rex}, - 'tm24' = {tm, r, S2, te, Rex}, - 'tm25' = {tm, r, S2f, S2, ts}, - 'tm26' = {tm, r, S2f, tf, S2, ts}, - 'tm27' = {tm, r, S2f, S2, ts, Rex}, - 'tm28' = {tm, r, S2f, tf, S2, ts, Rex}, - 'tm29' = {tm, r, CSA, Rex}. - - The preset model-free models with both optimisation of the bond length and CSA are - 'tm30' = {tm, r, CSA}, - 'tm31' = {tm, r, CSA, S2}, - 'tm32' = {tm, r, CSA, S2, te}, - 'tm33' = {tm, r, CSA, S2, Rex}, - 'tm34' = {tm, r, CSA, S2, te, Rex}, - 'tm35' = {tm, r, CSA, S2f, S2, ts}, - 'tm36' = {tm, r, CSA, S2f, tf, S2, ts}, - 'tm37' = {tm, r, CSA, S2f, S2, ts, Rex}, - 'tm38' = {tm, r, CSA, S2f, tf, S2, ts, Rex}, - 'tm39' = {tm, r, CSA, Rex}. - - - - Spin identification string - ~~~~~~~~~~~~~~~~~~~~~~~~~~ - - If 'spin_id' is supplied then the model will only be selected for the corresponding spins. - Otherwise the model will be selected for all spins. - - - - Examples - ~~~~~~~~ - - To pick model 'm1' for all selected spins, type: - - relax> model_free.select_model('m1') - relax> model_free.select_model(model='m1') - """ - - # Function intro text. - if self.__relax__.interpreter.intro: - text = sys.ps3 + "model_free.select_model(" - text = text + "model=" + `model` - text = text + ", spin_id=" + `spin_id` + ")" - print text - - # Model argument. - if type(model) != str: - raise RelaxStrError, ('model', model) - - # Spin identification string. - if spin_id != None and type(spin_id) != str: - raise RelaxNoneStrError, ('spin identification string', spin_id) - - # Execute the functional code. - model_free_obj.select_model(model=model, spin_id=spin_id)