Author: bugman
Date: Sun Dec  9 19:28:06 2007
New Revision: 4160
URL: http://svn.gna.org/viewcvs/relax?rev=4160&view=rev
Log:
Created the get_instance() function to return the appropriate class instance.
Modified:
    1.3/specific_fns/__init__.py
Modified: 1.3/specific_fns/__init__.py
URL: 
http://svn.gna.org/viewcvs/relax/1.3/specific_fns/__init__.py?rev=4160&r1=4159&r2=4160&view=diff
==============================================================================
--- 1.3/specific_fns/__init__.py (original)
+++ 1.3/specific_fns/__init__.py Sun Dec  9 19:28:06 2007
@@ -56,6 +56,33 @@
     """The function for returning the requested specific function."""
 
 
+def get_instance(function_type):
+    """Function for returning the class instance corresponding to the 
function type."""
+
+    # NOE calculation.
+    if function_type == 'noe':
+        return noe
+
+    # Relaxation curve fitting.
+    if function_type == 'relax_fit':
+        return relax_fit
+
+    # Reduced spectral density mapping.
+    if function_type == 'jw':
+        return jw_mapping
+
+    # Model-free analysis.
+    if function_type == 'mf':
+        return model_free
+
+    # Hybrid models.
+    if function_type == 'hybrid':
+        return hybrid
+
+    # Unknown analysis.
+    raise RelaxError, "The function_type " + `function_type` + " is unknown."
+
+
 def get_string(function_type):
     """Function for returning a string corresponding to the function type."""