mailr19324 - in /branches/relax_disp: specific_analyses/relax_disp.py user_functions/relax_disp.py


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by edward on April 03, 2013 - 14:11:
Author: bugman
Date: Wed Apr  3 14:11:23 2013
New Revision: 19324

URL: http://svn.gna.org/viewcvs/relax?rev=19324&view=rev
Log:
Created the relax_disp.relax_time user function.

This is almost a direct copy of the relax_fit.relax_time user function, but 
has been modernised.


Modified:
    branches/relax_disp/specific_analyses/relax_disp.py
    branches/relax_disp/user_functions/relax_disp.py

Modified: branches/relax_disp/specific_analyses/relax_disp.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/relax_disp/specific_analyses/relax_disp.py?rev=19324&r1=19323&r2=19324&view=diff
==============================================================================
--- branches/relax_disp/specific_analyses/relax_disp.py (original)
+++ branches/relax_disp/specific_analyses/relax_disp.py Wed Apr  3 14:11:23 
2013
@@ -217,6 +217,30 @@
         # Invalid relaxation dispersion experiment.
         else:
             raise RelaxError("The relaxation dispersion experiment '%s' is 
invalid." % exp_type)
+
+
+    def _relax_time(self, time=0.0, spectrum_id=None):
+        """Set the relaxation time period associated with a given spectrum.
+
+        @keyword time:          The time, in seconds, of the relaxation 
period.
+        @type time:             float
+        @keyword spectrum_id:   The spectrum identification string.
+        @type spectrum_id:      str
+        """
+
+        # Test if the spectrum id exists.
+        if spectrum_id not in cdp.spectrum_ids:
+            raise RelaxNoSpectraError(spectrum_id)
+
+        # Initialise the global relaxation time data structure if needed.
+        if not hasattr(cdp, 'relax_times'):
+            cdp.relax_times = {}
+
+        # Add the time, converting to a float if needed.
+        cdp.relax_times[spectrum_id] = float(time)
+
+        # Printout.
+        print("Setting the '%s' spectrum relaxation time period to %s s." % 
(spectrum_id, cdp.relax_times[spectrum_id]/1000.0))
 
 
     def _select_model(self, model='fast 2-site'):

Modified: branches/relax_disp/user_functions/relax_disp.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/relax_disp/user_functions/relax_disp.py?rev=19324&r1=19323&r2=19324&view=diff
==============================================================================
--- branches/relax_disp/user_functions/relax_disp.py (original)
+++ branches/relax_disp/user_functions/relax_disp.py Wed Apr  3 14:11:23 2013
@@ -203,6 +203,35 @@
 uf.backend = relax_disp_obj._exp_type
 uf.menu_text = "&exp_type"
 uf.wizard_size = (800, 400)
+
+
+# The relax_disp.relax_time user function.
+uf = uf_info.add_uf('relax_disp.relax_time')
+uf.title = "Set the relaxation delay time associated with each spectrum."
+uf.title_short = "Relaxation delay time setting."
+uf.add_keyarg(
+    name = "spectrum_id",
+    py_type = "str",
+    desc_short = "spectrum ID string",
+    desc = "The spectrum ID string.",
+    wiz_element_type = 'combo',
+    wiz_combo_iter = spectrum.get_ids,
+    wiz_read_only = True
+)
+uf.add_keyarg(
+    name = "time",
+    default = 0.0,
+    py_type = "num",
+    desc_short = "relaxation time",
+    desc = "The time, in seconds, of the relaxation period."
+)
+# Description.
+uf.desc.append(Desc_container())
+uf.desc[-1].add_paragraph("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.")
+uf.backend = relax_disp_obj._relax_time
+uf.menu_text = "&relax_time"
+uf.gui_icon = "oxygen.actions.chronometer"
+uf.wizard_size = (800, 500)
 
 
 # The relax_disp.select_model user function.




Related Messages


Powered by MHonArc, Updated Wed Apr 03 14:20:01 2013