mailr16691 - in /branches/uf_redesign: generic_fns/relax_data.py user_functions/relax_data.py


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

Header


Content

Posted by edward on June 06, 2012 - 12:59:
Author: bugman
Date: Wed Jun  6 12:59:41 2012
New Revision: 16691

URL: http://svn.gna.org/viewcvs/relax?rev=16691&view=rev
Log:
Implemented the relax_data.frq and relax_data.type user function definitions 
and backends.


Modified:
    branches/uf_redesign/generic_fns/relax_data.py
    branches/uf_redesign/user_functions/relax_data.py

Modified: branches/uf_redesign/generic_fns/relax_data.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/uf_redesign/generic_fns/relax_data.py?rev=16691&r1=16690&r2=16691&view=diff
==============================================================================
--- branches/uf_redesign/generic_fns/relax_data.py (original)
+++ branches/uf_redesign/generic_fns/relax_data.py Wed Jun  6 12:59:41 2012
@@ -534,6 +534,37 @@
 
     # Print the data.
     value.write_data(param=ri_id, file=sys.stdout, return_value=return_value)
+
+
+def frq(ri_id=None, frq=None):
+    """Set or reset the frequency associated with the ID.
+
+    @param ri_id:   The relaxation data ID string.
+    @type ri_id:    str
+    @param frq:     The spectrometer proton frequency in Hz.
+    @type frq:      float
+    """
+
+    # Test if the current data pipe exists.
+    pipes.test()
+
+    # Test if sequence data exists.
+    if not exists_mol_res_spin_data():
+        raise RelaxNoSequenceError
+
+    # Test if data exists.
+    if not hasattr(cdp, 'ri_ids') or ri_id not in cdp.ri_ids:
+        raise RelaxNoRiError(ri_id)
+
+    # Frequency checks.
+    frq_checks(frq)
+
+    # Initialise if needed.
+    if not hasattr(cdp, 'frq'):
+        cdp.frq = {}
+
+    # Set the value.
+    cdp.frq[ri_id] = frq
 
 
 def frq_checks(frq):
@@ -1005,6 +1036,38 @@
     cdp.exp_info.temp_control_setup(ri_id, method)
 
 
+def type(ri_id=None, ri_type=None):
+    """Set or reset the frequency associated with the ID.
+
+    @param ri_id:   The relaxation data ID string.
+    @type ri_id:    str
+    @param ri_type: The relaxation data type, ie 'R1', 'R2', or 'NOE'.
+    @type ri_type:  str
+    """
+
+    # Test if the current data pipe exists.
+    pipes.test()
+
+    # Test if sequence data exists.
+    if not exists_mol_res_spin_data():
+        raise RelaxNoSequenceError
+
+    # Test if data exists.
+    if not hasattr(cdp, 'ri_ids') or ri_id not in cdp.ri_ids:
+        raise RelaxNoRiError(ri_id)
+
+    # Check if the type is valid.
+    if ri_type not in VALID_TYPES:
+        raise RelaxError("The relaxation data type '%s' must be one of %s." 
% (ri_type, VALID_TYPES))
+
+    # Initialise if needed.
+    if not hasattr(cdp, 'ri_type'):
+        cdp.ri_type = {}
+
+    # Set the type.
+    cdp.ri_type[ri_id] = ri_type
+
+
 def write(ri_id=None, file=None, dir=None, bc=False, force=False):
     """Write relaxation data to a file.
 

Modified: branches/uf_redesign/user_functions/relax_data.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/uf_redesign/user_functions/relax_data.py?rev=16691&r1=16690&r2=16691&view=diff
==============================================================================
--- branches/uf_redesign/user_functions/relax_data.py (original)
+++ branches/uf_redesign/user_functions/relax_data.py Wed Jun  6 12:59:41 2012
@@ -187,6 +187,36 @@
 uf.wizard_image = WIZARD_IMAGE_PATH + 'fid.png'
 
 
+# The relax_data.frq user function.
+uf = uf_info.add_uf('relax_data.frq')
+uf.title = "Set the spectrometer proton frequency of the relaxation data in 
Hz."
+uf.title_short = "Relaxation data frequency setting."
+uf.add_keyarg(
+    name = "ri_id",
+    py_type = "str",
+    desc_short = "relaxation ID string",
+    desc = "The relaxation data ID string of the data to set the frequency 
of.",
+    wiz_element_type = 'combo',
+    wiz_combo_iter = relax_data.get_ids,
+    wiz_read_only = True
+)
+uf.add_keyarg(
+    name = "frq",
+    py_type = "num",
+    desc_short = "frequency in Hz",
+    desc = "The exact proton frequency of the spectrometer in Hertz.  See 
the 'sfrq' parameter in the Varian procpar file or the 'SFO1' parameter in 
the Bruker acqus file."
+)
+# Description.
+uf.desc.append(Desc_container())
+uf.desc[-1].add_paragraph("This allows the relaxation data type to be either 
set or reset.  The frequency must be the that of the proton in Hertz.  This 
value must be exact and match that of the 'sfrq' parameter in the Varian 
procpar file or the 'SFO1' parameter in the Bruker acqus file.")
+uf.backend = relax_data.frq
+uf.menu_text = "&frq"
+uf.gui_icon = "relax.frq"
+uf.wizard_size = (700, 500)
+uf.wizard_image = WIZARD_IMAGE_PATH + 'fid.png'
+
+
+
 # The relax_data.peak_intensity_type user function.
 uf = uf_info.add_uf('relax_data.peak_intensity_type')
 uf.title = "Specify the type of peak intensity measurement used - i.e. 
height or volume."
@@ -445,6 +475,38 @@
 uf.wizard_image = WIZARD_IMAGE_PATH + 'fid.png'
 
 
+# The relax_data.type user function.
+uf = uf_info.add_uf('relax_data.type')
+uf.title = "Set the type of relaxation data."
+uf.title_short = "Relaxation data type setting."
+uf.add_keyarg(
+    name = "ri_id",
+    py_type = "str",
+    desc_short = "relaxation ID string",
+    desc = "The relaxation data ID string of the data to set the frequency 
of.",
+    wiz_element_type = 'combo',
+    wiz_combo_iter = relax_data.get_ids,
+    wiz_read_only = True
+)
+uf.add_keyarg(
+    name = "ri_type",
+    py_type = "str",
+    desc_short = "relaxation type",
+    desc = "The relaxation data type, i.e. 'R1', 'R2', or 'NOE'.",
+    wiz_element_type = "combo",
+    wiz_combo_choices = ["R1", "R2", "NOE"],
+    wiz_read_only = True
+)
+# Description.
+uf.desc.append(Desc_container())
+uf.desc[-1].add_paragraph("This allows the type associated with the 
relaxation data to be either set or reset.  This type must be one of 'R1', 
'R2', or 'NOE'.")
+uf.backend = relax_data.type
+uf.menu_text = "&type"
+uf.gui_icon = "oxygen.actions.edit-rename"
+uf.wizard_image = WIZARD_IMAGE_PATH + 'fid.png'
+
+
+
 # The relax_data.write user function.
 uf = uf_info.add_uf('relax_data.write')
 uf.title = "Write relaxation data to a file."




Related Messages


Powered by MHonArc, Updated Wed Jun 06 15:00:02 2012