Author: bugman Date: Thu Oct 23 17:15:19 2008 New Revision: 7951 URL: http://svn.gna.org/viewcvs/relax?rev=7951&view=rev Log: Created a new noe user function class, unrelated to the previously deleted one. This contains the single user function, noe.spectrum_type(). Added: branches/spectral_errors/prompt/noe.py - copied, changed from r7949, branches/spectral_errors/prompt/relax_fit.py Copied: branches/spectral_errors/prompt/noe.py (from r7949, branches/spectral_errors/prompt/relax_fit.py) URL: http://svn.gna.org/viewcvs/relax/branches/spectral_errors/prompt/noe.py?p2=branches/spectral_errors/prompt/noe.py&p1=branches/spectral_errors/prompt/relax_fit.py&r1=7949&r2=7951&rev=7951&view=diff ============================================================================== --- branches/spectral_errors/prompt/relax_fit.py (original) +++ branches/spectral_errors/prompt/noe.py Thu Oct 23 17:15:19 2008 @@ -21,7 +21,7 @@ ############################################################################### # Module docstring. -"""Module containing the 'relax_fit' user function class.""" +"""Module containing the 'noe' user function class.""" __docformat__ = 'plaintext' # Python module imports. @@ -30,14 +30,14 @@ # relax module imports. import help from relax_errors import RelaxNumError, RelaxStrError -from specific_fns.setup import relax_fit_obj +from specific_fns.setup import noe_obj -class Relax_fit: +class Noe: def __init__(self, relax): # Help. self.__relax_help__ = \ - """Class for relaxation curve fitting.""" + """Class for calculating NOE data.""" # Add the generic help string. self.__relax_help__ = self.__relax_help__ + "\n" + help.relax_class_help @@ -46,13 +46,13 @@ self.__relax__ = relax - def relax_time(self, time=0.0, spectrum_id=None): - """Function for setting the relaxation time period associated with each spectrum. + def spectrum_type(self, spectrum_type=None, spectrum_id=None): + """Function for setting the spectrum type for pre-loaded peak intensities. Keyword Arguments ~~~~~~~~~~~~~~~~~ - time: The time, in seconds, of the relaxation period. + spectrum_type: The type of NOE spectrum, one of 'ref' or 'sat'. spectrum_id: The spectrum identification string. @@ -60,62 +60,29 @@ Description ~~~~~~~~~~~ + The spectrum_type argument can have the following values: + 'ref': The NOE reference spectrum. + 'sat': The NOE spectrum with proton saturation turned on. + Peak intensities should be loaded before calling this user function via the 'spectrum.read_intensities()' user function. The intensity values will then be associated - with a spectrum identifier. To associate each spectrum identifier with a time point in the - relaxation curve prior to optimisation, this user function should be called. + with a spectrum identifier which can be used here. """ # Function intro text. if self.__relax__.interpreter.intro: - text = sys.ps3 + "relax_fit.relax_time(" - text = text + "time=" + `time` + text = sys.ps3 + "noe.spectrum_type(" + text = text + "spectrum_type=" + `spectrum_type` text = text + ", spectrum_id=" + `spectrum_id` + ")" print text - # The relaxation time. - if type(time) != int and type(time) != float: - raise RelaxNumError, ('relaxation time', time) + # The spectrum type. + if type(spectrum_type) != int and type(spectrum_type) != float: + raise RelaxNumError, ('spectrum type', spectrum_type) # The spectrum identification string. if type(spectrum_id) != str: raise RelaxStrError, ('spectrum identification string', spectrum_id) # Execute the functional code. - relax_fit_obj.relax_time(time=time, spectrum_id=spectrum_id) - - - def select_model(self, model='exp'): - """Function for the selection of the relaxation curve type. - - Keyword Arguments - ~~~~~~~~~~~~~~~~~ - - model: The type of relaxation curve to fit. - - - The preset models - ~~~~~~~~~~~~~~~~~ - - The supported relaxation experiments include the default two parameter exponential fit, - selected by setting the 'fit_type' argument to 'exp', and the three parameter inversion - recovery experiment in which the peak intensity limit is a non-zero value, selected by - setting the argument to 'inv'. - - The parameters of these two models are - 'exp': [Rx, I0], - 'inv': [Rx, I0, Iinf]. - """ - - # Function intro text. - if self.__relax__.interpreter.intro: - text = sys.ps3 + "relax_fit.select_model(" - text = text + "model=" + `model` + ")" - print text - - # The model argument. - if type(model) != str: - raise RelaxStrError, ('model', model) - - # Execute the functional code. - relax_fit_obj.select_model(model=model) + noe_obj.spectrum_type(spectrum_type=spectrum_type, spectrum_id=spectrum_id)