Package user_functions :: Module relax_disp
[hide private]
[frames] | no frames]

Source Code for Module user_functions.relax_disp

   1  ############################################################################### 
   2  #                                                                             # 
   3  # Copyright (C) 2004-2013 Edward d'Auvergne                                   # 
   4  # Copyright (C) 2009 Sebastien Morin                                          # 
   5  #                                                                             # 
   6  # This file is part of the program relax (http://www.nmr-relax.com).          # 
   7  #                                                                             # 
   8  # This program is free software: you can redistribute it and/or modify        # 
   9  # it under the terms of the GNU General Public License as published by        # 
  10  # the Free Software Foundation, either version 3 of the License, or           # 
  11  # (at your option) any later version.                                         # 
  12  #                                                                             # 
  13  # This program is distributed in the hope that it will be useful,             # 
  14  # but WITHOUT ANY WARRANTY; without even the implied warranty of              # 
  15  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               # 
  16  # GNU General Public License for more details.                                # 
  17  #                                                                             # 
  18  # You should have received a copy of the GNU General Public License           # 
  19  # along with this program.  If not, see <http://www.gnu.org/licenses/>.       # 
  20  #                                                                             # 
  21  ############################################################################### 
  22   
  23  # Module docstring. 
  24  """The relax_disp user function definitions.""" 
  25   
  26  # Python module imports. 
  27  import dep_check 
  28  if dep_check.wx_module: 
  29      from wx import FD_OPEN, FD_SAVE 
  30  else: 
  31      FD_OPEN = -1 
  32      FD_SAVE = -1 
  33   
  34  # relax module imports. 
  35  from lib.text.gui import dw, dw_AB, dw_BC, dwH, dwH_AB, dwH_BC, i0, kex, kAB, kBC, kAC, padw2, phi_ex, phi_exB, phi_exC, r1rho, r1rho_prime, r2, r2a, r2b, r2eff 
  36  from graphics import ANALYSIS_IMAGE_PATH, WIZARD_IMAGE_PATH 
  37  from pipe_control import pipes, spectrum 
  38  from pipe_control.mol_res_spin import get_spin_ids 
  39  from specific_analyses.relax_disp.catia import catia_execute, catia_input 
  40  from specific_analyses.relax_disp.cpmgfit import cpmgfit_execute, cpmgfit_input 
  41  from specific_analyses.relax_disp.disp_data import cpmg_frq, insignificance, plot_disp_curves, plot_exp_curves, r2eff_read, r2eff_read_spin, relax_time, set_exp_type, spin_lock_field, spin_lock_offset, write_disp_curves 
  42  from specific_analyses.relax_disp.nessy import nessy_input 
  43  from specific_analyses.relax_disp.parameters import copy 
  44  from specific_analyses.relax_disp.sherekhan import sherekhan_input 
  45  from specific_analyses.relax_disp.variables import EXP_TYPE_CPMG_DQ, EXP_TYPE_CPMG_MQ, EXP_TYPE_CPMG_SQ, EXP_TYPE_CPMG_ZQ, EXP_TYPE_CPMG_PROTON_MQ, EXP_TYPE_CPMG_PROTON_SQ, EXP_TYPE_R1RHO, MODEL_CR72, MODEL_CR72_FULL, MODEL_DPL94, MODEL_IT99, MODEL_LM63, MODEL_LM63_3SITE, MODEL_M61, MODEL_M61B, MODEL_MMQ_CR72, MODEL_MP05, MODEL_NOREX, MODEL_NS_CPMG_2SITE_3D, MODEL_NS_CPMG_2SITE_3D_FULL, MODEL_NS_CPMG_2SITE_EXPANDED, MODEL_NS_CPMG_2SITE_STAR, MODEL_NS_CPMG_2SITE_STAR_FULL, MODEL_NS_MMQ_2SITE, MODEL_NS_MMQ_3SITE, MODEL_NS_MMQ_3SITE_LINEAR, MODEL_NS_R1RHO_2SITE, MODEL_NS_R1RHO_3SITE, MODEL_NS_R1RHO_3SITE_LINEAR, MODEL_R2EFF, MODEL_TAP03, MODEL_TP02, MODEL_TSMFK01 
  46  from specific_analyses.setup import relax_disp_obj 
  47  from user_functions.data import Uf_info; uf_info = Uf_info() 
  48  from user_functions.objects import Desc_container 
  49   
  50   
  51  # The user function class. 
  52  uf_class = uf_info.add_class('relax_disp') 
  53  uf_class.title = "Class for relaxation curve fitting." 
  54  uf_class.menu_text = "&relax_disp" 
  55  uf_class.gui_icon = "relax.relax_disp" 
  56   
  57   
  58  # The relax_disp.catia_execute user function. 
  59  uf = uf_info.add_uf('relax_disp.catia_execute') 
  60  uf.title = "Perform a relaxation dispersion optimisation using Flemming Hansen's CATIA." 
  61  uf.title_short = "CATIA execution." 
  62  uf.add_keyarg( 
  63      name = "dir", 
  64      py_type = "str", 
  65      arg_type = "dir sel", 
  66      desc_short = "directory name", 
  67      desc = "The directory containing all of the CATIA input files.", 
  68      can_be_none = True 
  69  ) 
  70  uf.add_keyarg( 
  71      name = "binary", 
  72      default = "catia", 
  73      py_type = "str", 
  74      arg_type = "file sel", 
  75      desc_short = "CATIA executable file", 
  76      desc = "The name of the executable CATIA program file.", 
  77      wiz_filesel_style = FD_OPEN, 
  78      wiz_filesel_preview = False 
  79  ) 
  80  # Description. 
  81  uf.desc.append(Desc_container()) 
  82  uf.desc[-1].add_paragraph("CATIA will be executed as") 
  83  uf.desc[-1].add_prompt("$ catia < Fit.catia") 
  84  uf.desc[-1].add_paragraph("If you would like to use a different CATIA executable file, change the binary name to the appropriate file name.  If the file is not located within the environment's path, include the full path in front of the binary file name.") 
  85  uf.backend = catia_execute 
  86  uf.gui_icon = "oxygen.categories.applications-education" 
  87  uf.menu_text = "catia_e&xecute" 
  88  uf.wizard_size = (800, 600) 
  89  uf.wizard_apply_button = False 
  90  uf.wizard_image = ANALYSIS_IMAGE_PATH + 'relax_disp_200x200.png' 
  91   
  92   
  93  # The relax_disp.catia_input user function. 
  94  uf = uf_info.add_uf('relax_disp.catia_input') 
  95  uf.title = "Create the input files for Flemming Hansen's CATIA program." 
  96  uf.title_short = "CATIA input file creation." 
  97  uf.add_keyarg( 
  98      name = "dir", 
  99      default = "catia", 
 100      py_type = "str", 
 101      arg_type = "dir sel", 
 102      desc_short = "directory name", 
 103      desc = "The directory to place the CATIA input files, output directory, etc.", 
 104      can_be_none = True 
 105  ) 
 106  uf.add_keyarg( 
 107      name = "force", 
 108      default = False, 
 109      py_type = "bool", 
 110      desc_short = "force flag", 
 111      desc = "A flag which if set to True will cause the files to be overwritten if they already exist." 
 112  ) 
 113  # Description. 
 114  uf.desc.append(Desc_container()) 
 115  uf.desc[-1].add_paragraph("This will create all of the input file required for CATIA as well as the CATIA results output directory.") 
 116  uf.backend = catia_input 
 117  uf.gui_icon = "oxygen.actions.list-add-relax-blue" 
 118  uf.menu_text = "&catia_input" 
 119  uf.wizard_size = (800, 600) 
 120  uf.wizard_apply_button = False 
 121  uf.wizard_image = ANALYSIS_IMAGE_PATH + 'relax_disp_200x200.png' 
 122   
 123   
 124  # The relax_disp.cluster user function. 
 125  uf = uf_info.add_uf('relax_disp.cluster') 
 126  uf.title = "Define clusters of spins for joint optimisation." 
 127  uf.title_short = "Spin clustering." 
 128  uf.add_keyarg( 
 129      name = "cluster_id", 
 130      py_type = "str", 
 131      desc_short = "cluster ID", 
 132      desc = "The cluster identification string.", 
 133      wiz_element_type = 'combo', 
 134      wiz_combo_iter = relax_disp_obj._cluster_ids 
 135  ) 
 136  uf.add_keyarg( 
 137      name = "spin_id", 
 138      py_type = "str", 
 139      desc_short = "spin ID string", 
 140      desc = "The spin identifier string for the spin or group of spins to add to the cluster.", 
 141      wiz_element_type = 'combo', 
 142      wiz_combo_iter = get_spin_ids, 
 143      can_be_none = True 
 144  ) 
 145  # Description. 
 146  uf.desc.append(Desc_container()) 
 147  uf.desc[-1].add_paragraph("In a relaxation dispersion analysis, the parameters of the model of dispersion can either be optimised for each spin system separately or a number of spins can be grouped or clustered and the dispersion model parameters optimised for all spins in the cluster together.  Clusters are identified by unique ID strings.  Any spins not within a cluster will be optimised separately and individually.") 
 148  uf.desc[-1].add_paragraph("If the cluster ID string already exists, the spins will be added to that pre-existing cluster.  If no spin ID is given, then all spins will be added to the cluster.") 
 149  uf.desc[-1].add_paragraph("The special cluster ID string 'free spins' is reserved for the pool of non-clustered spins.  This can be used to remove a spin system from an already existing cluster by specifying this cluster ID and the desired spin ID.") 
 150  # Prompt examples. 
 151  uf.desc.append(Desc_container("Prompt examples")) 
 152  uf.desc[-1].add_paragraph("To add the spins ':1@N' and ':3@N' to a new cluster called 'cluster', type one of:") 
 153  uf.desc[-1].add_prompt("relax> relax_disp.cluster('cluster', ':1,3@N')") 
 154  uf.desc[-1].add_prompt("relax> relax_disp.cluster(cluster_id='cluster', spin_id=':1,3@N')") 
 155  uf.backend = relax_disp_obj._cluster 
 156  uf.menu_text = "c&luster" 
 157  uf.gui_icon = "relax.cluster" 
 158  uf.wizard_height_desc = 500 
 159  uf.wizard_size = (800, 600) 
 160  uf.wizard_image = ANALYSIS_IMAGE_PATH + 'relax_disp_200x200.png' 
 161   
 162   
 163  # The relax_disp.cpmg_frq user function. 
 164  uf = uf_info.add_uf('relax_disp.cpmg_frq') 
 165  uf.title = "Set the CPMG frequency associated with a given spectrum." 
 166  uf.title_short = "CPMG frequency setting." 
 167  uf.add_keyarg( 
 168      name = "spectrum_id", 
 169      py_type = "str", 
 170      desc_short = "spectrum ID string", 
 171      desc = "The spectrum ID string to associate the CPMG frequency to.", 
 172      wiz_element_type = 'combo', 
 173      wiz_combo_iter = spectrum.get_ids, 
 174      wiz_read_only = True 
 175  ) 
 176  uf.add_keyarg( 
 177      name = "cpmg_frq", 
 178      py_type = "num", 
 179      desc_short = "CPMG frequency (Hz)", 
 180      desc = "The frequency, in Hz, of the CPMG pulse train.", 
 181      can_be_none = True 
 182  ) 
 183  # Description. 
 184  uf.desc.append(Desc_container()) 
 185  uf.desc[-1].add_paragraph("This allows the CPMG pulse train frequency of a given spectrum to be set.  If None is given for frequency, then the spectrum will be treated as a reference spectrum.") 
 186  # Prompt examples. 
 187  uf.desc.append(Desc_container("Prompt examples")) 
 188  uf.desc[-1].add_paragraph("To identify the reference spectrum called 'reference_spectrum', type one of:") 
 189  uf.desc[-1].add_prompt("relax> relax_disp.cpmg_frq(None, 'reference_spectrum')") 
 190  uf.desc[-1].add_prompt("relax> relax_disp.cpmg_frq(cpmg_frq=None, spectrum_id='reference_spectrum')") 
 191  uf.desc[-1].add_paragraph("To set a frequency of 200 Hz for the spectrum '200_Hz_spectrum', type one of:") 
 192  uf.desc[-1].add_prompt("relax> relax_disp.cpmg_frq(200, '200_Hz_spectrum')") 
 193  uf.desc[-1].add_prompt("relax> relax_disp.cpmg_frq(cpmg_frq=200, spectrum_id='200_Hz_spectrum')") 
 194  uf.backend = cpmg_frq 
 195  uf.menu_text = "&cpmg_frq" 
 196  uf.wizard_size = (800, 500) 
 197  uf.wizard_image = ANALYSIS_IMAGE_PATH + 'relax_disp_200x200.png' 
 198   
 199   
 200  # The relax_disp.cpmgfit_execute user function. 
 201  uf = uf_info.add_uf('relax_disp.cpmgfit_execute') 
 202  uf.title = "Optimisation of the CPMG data using Art Palmer's CPMGFit program." 
 203  uf.title_short = "CPMGFit execution." 
 204  uf.add_keyarg( 
 205      name = "dir", 
 206      py_type = "str", 
 207      arg_type = "dir sel", 
 208      desc_short = "directory name", 
 209      desc = "The directory containing all of the CPMGFit input files.  If not given, this defaults to the model name in lower case.", 
 210      can_be_none = True 
 211  ) 
 212  uf.add_keyarg( 
 213      name = "force", 
 214      default = False, 
 215      py_type = "bool", 
 216      desc_short = "force flag", 
 217      desc = "A flag which if set to True will cause the results files to be overwritten if they already exist." 
 218  ) 
 219  uf.add_keyarg( 
 220      name = "binary", 
 221      default = "cpmgfit", 
 222      py_type = "str", 
 223      arg_type = "file sel", 
 224      desc_short = "CPMGFit executable file", 
 225      desc = "The name of the executable CPMGFit program file.", 
 226      wiz_filesel_style = FD_OPEN, 
 227      wiz_filesel_preview = False 
 228  ) 
 229  # Description. 
 230  uf.desc.append(Desc_container()) 
 231  uf.desc[-1].add_paragraph("CPMGFit will be executed once per spin as:") 
 232  uf.desc[-1].add_prompt("$ cpmgfit -grid -xmgr -f dir/spin_x.in | tee dir/spin_x.out") 
 233  uf.desc[-1].add_paragraph("where x is replaced by each spin ID string.  If you would like to use a different CPMGFit executable file, change the binary name to the appropriate file name.  If the file is not located within the environment's path, be sure to include the full path in front of the binary file name so it can be found.") 
 234  uf.backend = cpmgfit_execute 
 235  uf.menu_text = "&cpmgfit_execute" 
 236  uf.gui_icon = "oxygen.categories.applications-education" 
 237  uf.wizard_size = (800, 600) 
 238  uf.wizard_apply_button = False 
 239  uf.wizard_image = ANALYSIS_IMAGE_PATH + 'relax_disp_200x200.png' 
 240   
 241   
 242  # The relax_disp.cpmgfit_input user function. 
 243  uf = uf_info.add_uf('relax_disp.cpmgfit_input') 
 244  uf.title = "Create the input files for Art Palmer's CPMGFit program." 
 245  uf.title_short = "CPMGFit input file creation." 
 246  uf.add_keyarg( 
 247      name = "dir", 
 248      py_type = "str", 
 249      arg_type = "dir sel", 
 250      desc_short = "directory name", 
 251      desc = "The directory to place the files.  If not given, this defaults to the model name in lower case.", 
 252      can_be_none = True 
 253  ) 
 254  uf.add_keyarg( 
 255      name = "force", 
 256      default = False, 
 257      py_type = "bool", 
 258      desc_short = "force flag", 
 259      desc = "A flag which if set to True will cause the files to be overwritten if they already exist." 
 260  ) 
 261  uf.add_keyarg( 
 262      name = "binary", 
 263      default = "cpmgfit", 
 264      py_type = "str", 
 265      arg_type = "file sel", 
 266      desc_short = "CPMGFit executable file", 
 267      desc = "The name of the executable CPMGFit program file.", 
 268      wiz_filesel_style = FD_OPEN, 
 269      wiz_filesel_preview = False 
 270  ) 
 271  uf.add_keyarg( 
 272      name = "spin_id", 
 273      py_type = "str", 
 274      desc_short = "spin ID string", 
 275      desc = "The spin identification string.", 
 276      can_be_none = True 
 277  ) 
 278  # Description. 
 279  uf.desc.append(Desc_container()) 
 280  uf.desc[-1].add_paragraph("The following files are created:") 
 281  uf.desc[-1].add_list_element("'dir/spin_x.in',") 
 282  uf.desc[-1].add_list_element("'dir/run.sh'.") 
 283  uf.desc[-1].add_paragraph("One CPMGFit input file is created per spin and named 'dir/spin_x.in', where x is the spin ID string.  The file 'dir/run.sh' is a batch file for executing CPMGFit for all of the spin input files.  If you would like to use a different CPMGFit executable file, change the binary name to the appropriate file name.  If the file is not located within the environment's path, be sure to include the full path in front of the binary name so it can be found.") 
 284  uf.backend = cpmgfit_input 
 285  uf.menu_text = "&cpmgfit_input" 
 286  uf.gui_icon = "oxygen.actions.list-add-relax-blue" 
 287  uf.wizard_size = (800, 600) 
 288  uf.wizard_apply_button = False 
 289  uf.wizard_image = ANALYSIS_IMAGE_PATH + 'relax_disp_200x200.png' 
 290   
 291   
 292  # The relax_disp.exp_type user function. 
 293  uf = uf_info.add_uf('relax_disp.exp_type') 
 294  uf.title = "Select the relaxation dispersion experiment type." 
 295  uf.title_short = "Relaxation dispersion experiment type selection." 
 296  uf.add_keyarg( 
 297      name = "spectrum_id", 
 298      py_type = "str", 
 299      desc_short = "spectrum ID string", 
 300      desc = "The spectrum ID string to associate the spin-lock field strength to.", 
 301      wiz_element_type = 'combo', 
 302      wiz_combo_iter = spectrum.get_ids, 
 303      wiz_read_only = True 
 304  ) 
 305  uf.add_keyarg( 
 306      name = "exp_type", 
 307      default = EXP_TYPE_CPMG_SQ, 
 308      py_type = "str", 
 309      desc_short = "experiment type", 
 310      desc = "The type of relaxation dispersion experiment performed.", 
 311      wiz_element_type = "combo", 
 312      wiz_combo_choices = [ 
 313          "Single quantum (SQ) CPMG-type data", 
 314          "Zero quantum (ZQ) CPMG-type data", 
 315          "Double quantum (DQ) CPMG-type data", 
 316          "Multiple quantum (MQ) CPMG-type data", 
 317          "1H single quantum (SQ) CPMG-type data", 
 318          "1H multiple quantum (SQ) CPMG-type data", 
 319          "%s-type data" % r1rho 
 320      ], 
 321      wiz_combo_data = [ 
 322          EXP_TYPE_CPMG_SQ, 
 323          EXP_TYPE_CPMG_ZQ, 
 324          EXP_TYPE_CPMG_DQ, 
 325          EXP_TYPE_CPMG_MQ, 
 326          EXP_TYPE_CPMG_PROTON_SQ, 
 327          EXP_TYPE_CPMG_PROTON_MQ, 
 328          EXP_TYPE_R1RHO 
 329      ], 
 330      wiz_read_only = True 
 331  ) 
 332  # Description. 
 333  uf.desc.append(Desc_container()) 
 334  uf.desc[-1].add_paragraph("For each peak intensity set loaded into relax, the type of experiment it comes from needs to be specified.  By specifying this for each spectrum ID, multiple experiment types can be analysed simultaneously.  This is assuming that an appropriate dispersion model exists for the experiment combination.") 
 335  uf.desc[-1].add_paragraph("The currently supported experiments include:") 
 336  uf.desc[-1].add_item_list_element(repr(EXP_TYPE_CPMG_SQ), "The single quantum (SQ) CPMG-type experiments,") 
 337  uf.desc[-1].add_item_list_element(repr(EXP_TYPE_CPMG_ZQ), "The zero quantum (ZQ) CPMG-type experiments,") 
 338  uf.desc[-1].add_item_list_element(repr(EXP_TYPE_CPMG_DQ), "The double quantum (DQ) CPMG-type experiments,") 
 339  uf.desc[-1].add_item_list_element(repr(EXP_TYPE_CPMG_MQ), "The multiple quantum (MQ) CPMG-type experiments,") 
 340  uf.desc[-1].add_item_list_element(repr(EXP_TYPE_CPMG_PROTON_SQ), "The 1H single quantum (SQ) CPMG-type experiments,") 
 341  uf.desc[-1].add_item_list_element(repr(EXP_TYPE_CPMG_PROTON_MQ), "The 1H multiple quantum (MQ) CPMG-type experiments,") 
 342  uf.desc[-1].add_item_list_element(repr(EXP_TYPE_R1RHO), "The R1rho-type experiments.") 
 343  # Prompt examples. 
 344  uf.desc.append(Desc_container("Prompt examples")) 
 345  uf.desc[-1].add_paragraph("To set the experiment type to 'SQ CPMG' for the spectrum ID 'nu_4500.0_800MHz', type one of:") 
 346  uf.desc[-1].add_prompt("relax> relax_disp.exp_type('nu_4500.0_800MHz', 'SQ CPMG')") 
 347  uf.desc[-1].add_prompt("relax> relax_disp.exp_type(spectrum_id='nu_4500.0_800MHz', exp_type='SQ CPMG')") 
 348  uf.backend = set_exp_type 
 349  uf.menu_text = "&exp_type" 
 350  uf.wizard_height_desc = 400 
 351  uf.wizard_size = (900, 600) 
 352  uf.wizard_apply_button = False 
 353  uf.wizard_image = ANALYSIS_IMAGE_PATH + 'relax_disp_200x200.png' 
 354   
 355   
 356  # The relax_disp.insignificance user function. 
 357  uf = uf_info.add_uf('relax_disp.insignificance') 
 358  uf.title = "Deselect all spins with insignificant dispersion." 
 359  uf.title_short = "Insignificant spin deselection." 
 360  uf.add_keyarg( 
 361      name = "level", 
 362      py_type = "float", 
 363      default = 2.0, 
 364      desc_short = "insignificance level", 
 365      desc = "The R2eff/R1rho value in rad/s by which to judge insignificance.  If the maximum difference between two points on all dispersion curves for a spin is less than this value, that spin will be deselected.", 
 366      can_be_none = False 
 367  ) 
 368  # Description. 
 369  uf.desc.append(Desc_container()) 
 370  uf.desc[-1].add_paragraph("This can be used to deselect all spins which have insignificant dispersion profiles.  The insignificance value is the R2eff/R1rho value in rad/s by which to judge the dispersion curves by.  If the maximum difference between two points on all dispersion curves for a spin is less than this value, that spin will be deselected.") 
 371  uf.backend = insignificance 
 372  uf.gui_icon = "relax.spin_grey" 
 373  uf.menu_text = "&insignificance" 
 374  uf.wizard_size = (800, 550) 
 375  uf.wizard_apply_button = False 
 376  uf.wizard_image = WIZARD_IMAGE_PATH + 'deselect.png' 
 377   
 378   
 379  # The relax_disp.nessy_input user function. 
 380  uf = uf_info.add_uf('relax_disp.nessy_input') 
 381  uf.title = "Create the input files for Michael Bieri's NESSY program." 
 382  uf.title_short = "NESSY input file creation." 
 383  uf.add_keyarg( 
 384      name = "dir", 
 385      py_type = "str", 
 386      arg_type = "dir sel", 
 387      desc_short = "directory name", 
 388      desc = "The directory to place the file and to use as the NESSY project directory.  If not given, this defaults to the current directory.", 
 389      can_be_none = True 
 390  ) 
 391  uf.add_keyarg( 
 392      name = "force", 
 393      default = False, 
 394      py_type = "bool", 
 395      desc_short = "force flag", 
 396      desc = "A flag which if set to True will cause the files to be overwritten if they already exist." 
 397  ) 
 398  uf.add_keyarg( 
 399      name = "spin_id", 
 400      py_type = "str", 
 401      desc_short = "spin ID string", 
 402      desc = "The spin identification string.", 
 403      can_be_none = True 
 404  ) 
 405  # Description. 
 406  uf.desc.append(Desc_container()) 
 407  uf.desc[-1].add_paragraph("This will create a single NESSY save file called 'save.NESSY'.  This will contain all of the dispersion data currently loaded in the relax data store.  If the directory name is not supplied, this will default to the current directory.") 
 408  uf.backend = nessy_input 
 409  uf.menu_text = "&nessy_input" 
 410  uf.gui_icon = "relax.nessy" 
 411  uf.wizard_size = (800, 600) 
 412  uf.wizard_apply_button = False 
 413  uf.wizard_image = WIZARD_IMAGE_PATH + 'nessy.png' 
 414   
 415   
 416  # The relax_disp.parameter_copy user function. 
 417  uf = uf_info.add_uf('relax_disp.parameter_copy') 
 418  uf.title = "Copy dispersion specific parameters values from one data pipe to another." 
 419  uf.title_short = "Dispersion parameter copying." 
 420  uf.add_keyarg( 
 421      name = "pipe_from", 
 422      py_type = "str", 
 423      desc_short = "source data pipe", 
 424      desc = "The name of the pipe to copy from.", 
 425      wiz_element_type = 'combo', 
 426      wiz_combo_iter = pipes.pipe_names, 
 427      wiz_read_only = True 
 428  ) 
 429  uf.add_keyarg( 
 430      name = "pipe_to", 
 431      py_type = "str", 
 432      desc_short = "destination data pipe", 
 433      desc = "The name of the pipe to copy to.", 
 434      wiz_element_type = 'combo', 
 435      wiz_combo_iter = pipes.pipe_names, 
 436      wiz_read_only = True 
 437  ) 
 438  # Description. 
 439  uf.desc.append(Desc_container()) 
 440  uf.desc[-1].add_paragraph("This is a special function for copying relaxation dispersion parameters from one data pipe to another.  It is much more advanced than the value.copy user function, in that clustering is taken into account.  When the destination data pipe has spin clusters defined, then the new parameter values, when required, will be averaged.") 
 441  uf.desc[-1].add_paragraph("For the cluster specific parameters, i.e. the populations of the states and the exchange parameters, an average value will be used as the starting point.  For all other parameters, the R20 values for each spin and magnetic field, as well as the parameters related to the chemical shift difference dw, the optimised values of the previous run will be directly copied.") 
 442  uf.desc.append(Desc_container("Prompt examples")) 
 443  uf.desc[-1].add_paragraph("To copy the CSA values from the data pipe 'm1' to 'm2', type:") 
 444  uf.desc[-1].add_prompt("relax> value.parameter_copy('m1', 'm2', 'csa')") 
 445  uf.backend = copy 
 446  uf.menu_text = "&parameter_copy" 
 447  uf.gui_icon = "oxygen.actions.list-add" 
 448  uf.wizard_size = (800, 500) 
 449  uf.wizard_image = ANALYSIS_IMAGE_PATH + 'relax_disp_200x200.png' 
 450   
 451   
 452  # The relax_disp.plot_disp_curves user function. 
 453  uf = uf_info.add_uf('relax_disp.plot_disp_curves') 
 454  uf.title = "Create 2D Grace plots of the dispersion curves for each spin system." 
 455  uf.title_short = "Dispersion curve plotting." 
 456  uf.add_keyarg( 
 457      name = "dir", 
 458      default = "grace", 
 459      py_type = "str", 
 460      arg_type = "dir sel", 
 461      desc_short = "directory name", 
 462      desc = "The directory name to place all of the spin system files into.", 
 463      can_be_none = True 
 464  ) 
 465  uf.add_keyarg( 
 466      name = "num_points", 
 467      default = 1000, 
 468      min = 1, 
 469      max = 10000000, 
 470      py_type = "int", 
 471      desc_short = "total number of interpolation points", 
 472      desc = "The total number of points to generate the interpolated dispersion curves with.  This value has no effect for the numeric CPMG-based models.", 
 473      can_be_none = False 
 474  ) 
 475  uf.add_keyarg( 
 476      name = "extend", 
 477      py_type = "num", 
 478      default = 500.0, 
 479      desc_short = "interpolated dispersion curve extension (in Hz)", 
 480      desc = "How far to extend the interpolated dispersion curves beyond the last dispersion point, i.e. the nu_CPMG frequency or spin-lock field strength value, in Hertz.", 
 481      can_be_none = False 
 482  ) 
 483  uf.add_keyarg( 
 484      name = "force", 
 485      default = False, 
 486      py_type = "bool", 
 487      desc_short = "force flag", 
 488      desc = "A flag which, if set to True, will cause the files to be overwritten." 
 489  ) 
 490  # Description. 
 491  uf.desc.append(Desc_container()) 
 492  uf.desc[-1].add_paragraph("This is used to create 2D Grace plots of the dispersion curves of the nu_CPMG frequencies or spin-lock field strength verses the R2eff/R1rho values.  One file will be created per spin system with the name 'disp_x.agr', where x is related to the spin ID string.  For each file, one Grace graph will be produced for each experiment.") 
 493  uf.desc[-1].add_paragraph("Four sets of curves of R2eff/R1rho values will be produced per experiment and per magnetic field strength.  These are the experimental values, the fitted values, the interpolated dispersion curves for the fitted solution, and the residuals.  Different dispersion models result in different interpolated dispersion curves.  For the numeric models which use CPMG-type data, the maximum interpolation resolution is constrained by the frequency of a single CPMG block for the entire relaxation period.  For all other models, the interpolation resolution is not constrained and can be as fine as desired by setting the total number of interpolation points.  Interpolated curves are not produced for the 'R2eff' model as they are not necessary.") 
 494  uf.backend = plot_disp_curves 
 495  uf.menu_text = "&plot_disp_curves" 
 496  uf.gui_icon = "oxygen.actions.document-save" 
 497  uf.wizard_size = (950, 700) 
 498  uf.wizard_image = WIZARD_IMAGE_PATH + 'grace.png' 
 499   
 500   
 501  # The relax_disp.plot_exp_curves user function. 
 502  uf = uf_info.add_uf('relax_disp.plot_exp_curves') 
 503  uf.title = "Create 2D Grace plots of the exponential curves." 
 504  uf.title_short = "Exponential curve plotting." 
 505  uf.add_keyarg( 
 506      name = "file", 
 507      py_type = "str", 
 508      arg_type = "file sel", 
 509      desc_short = "file name", 
 510      desc = "The name of the file.", 
 511      wiz_filesel_wildcard = "Grace files (*.agr)|*.agr;*.AGR", 
 512      wiz_filesel_style = FD_SAVE 
 513  ) 
 514  uf.add_keyarg( 
 515      name = "dir", 
 516      default = "grace", 
 517      py_type = "str", 
 518      arg_type = "dir", 
 519      desc_short = "directory name", 
 520      desc = "The directory name.", 
 521      can_be_none = True 
 522  ) 
 523  uf.add_keyarg( 
 524      name = "force", 
 525      default = False, 
 526      py_type = "bool", 
 527      desc_short = "force flag", 
 528      desc = "A flag which, if set to True, will cause the file to be overwritten." 
 529  ) 
 530  uf.add_keyarg( 
 531      name = "norm", 
 532      default = False, 
 533      py_type = "bool", 
 534      desc_short = "normalisation flag", 
 535      desc = "A flag which, if set to True, will cause all graphs to be normalised to a starting value of 1.  This is for the normalisation of series type data." 
 536  ) 
 537  # Description. 
 538  uf.desc.append(Desc_container()) 
 539  uf.desc[-1].add_paragraph("This is used to create 2D Grace plots of the individual exponential curves used to find the R2eff or R1rho values.  This supplements the grace.write user function which is not capable of generating these curves in a reasonable format.") 
 540  uf.backend = plot_exp_curves 
 541  uf.menu_text = "&plot_exp_curves" 
 542  uf.gui_icon = "oxygen.actions.document-save" 
 543  uf.wizard_size = (800, 600) 
 544  uf.wizard_image = WIZARD_IMAGE_PATH + 'grace.png' 
 545   
 546   
 547  # The relax_disp.r2eff_read user function. 
 548  uf = uf_info.add_uf('relax_disp.r2eff_read') 
 549  uf.title = "Read R2eff/R1rho values and errors from a file." 
 550  uf.title_short = "R2eff/R1rho value reading." 
 551  uf.add_keyarg( 
 552      name = "id", 
 553      py_type = "str", 
 554      desc_short = "partial experiment ID string", 
 555      desc = "The partial experiment ID string to identify this data with.  The full ID string will be constructed as this ID followed by an underscore and then the dispersion point value from the file.", 
 556      wiz_element_type = 'combo', 
 557      wiz_combo_iter = spectrum.get_ids, 
 558      wiz_read_only = True 
 559  ) 
 560  uf.add_keyarg( 
 561      name = "file", 
 562      py_type = "str", 
 563      arg_type = "file sel", 
 564      desc_short = "file name", 
 565      desc = "The name of the file.", 
 566      wiz_filesel_style = FD_SAVE 
 567  ) 
 568  uf.add_keyarg( 
 569      name = "dir", 
 570      py_type = "str", 
 571      arg_type = "dir", 
 572      desc_short = "directory name", 
 573      desc = "The directory name.", 
 574      can_be_none = True 
 575  ) 
 576  uf.add_keyarg( 
 577      name = "disp_frq", 
 578      py_type = "num", 
 579      desc_short = "CPMG frequency or spin-lock field strength (Hz)", 
 580      desc = "For CPMG-type data, the frequency of the CPMG pulse train.  For R1rho-type data, the spin-lock field strength nu1.  The units must be Hertz", 
 581      can_be_none = True 
 582  ) 
 583  uf.add_keyarg( 
 584      name = "spin_id_col", 
 585      py_type = "int", 
 586      arg_type = "free format", 
 587      desc_short = "spin ID string column", 
 588      desc = "The spin ID string column used by the generic file format (an alternative to the mol, res, and spin name and number columns).", 
 589      can_be_none = True 
 590  ) 
 591  uf.add_keyarg( 
 592      name = "mol_name_col", 
 593      py_type = "int", 
 594      arg_type = "free format", 
 595      desc_short = "molecule name column", 
 596      desc = "The molecule name column used by the generic file format (alternative to the spin ID column).", 
 597      can_be_none = True 
 598  ) 
 599  uf.add_keyarg( 
 600      name = "res_num_col", 
 601      py_type = "int", 
 602      arg_type = "free format", 
 603      desc_short = "residue number column", 
 604      desc = "The residue number column used by the generic file format (alternative to the spin ID column).", 
 605      can_be_none = True 
 606  ) 
 607  uf.add_keyarg( 
 608      name = "res_name_col", 
 609      py_type = "int", 
 610      arg_type = "free format", 
 611      desc_short = "residue name column", 
 612      desc = "The residue name column used by the generic file format (alternative to the spin ID column).", 
 613      can_be_none = True 
 614  ) 
 615  uf.add_keyarg( 
 616      name = "spin_num_col", 
 617      py_type = "int", 
 618      arg_type = "free format", 
 619      desc_short = "spin number column", 
 620      desc = "The spin number column used by the generic file format (alternative to the spin ID column).", 
 621      can_be_none = True 
 622  ) 
 623  uf.add_keyarg( 
 624      name = "spin_name_col", 
 625      py_type = "int", 
 626      arg_type = "free format", 
 627      desc_short = "spin name column", 
 628      desc = "The spin name column used by the generic file format (alternative to the spin ID column).", 
 629      can_be_none = True 
 630  ) 
 631  uf.add_keyarg( 
 632      name = "data_col", 
 633      py_type = "int", 
 634      arg_type = "free format", 
 635      desc_short = "data column", 
 636      desc = "The RDC data column.", 
 637      can_be_none = True 
 638  ) 
 639  uf.add_keyarg( 
 640      name = "error_col", 
 641      py_type = "int", 
 642      arg_type = "free format", 
 643      desc_short = "error column", 
 644      desc = "The experimental error column.", 
 645      can_be_none = True 
 646  ) 
 647  uf.add_keyarg( 
 648      name = "sep", 
 649      py_type = "str", 
 650      arg_type = "free format", 
 651      desc_short = "column separator", 
 652      desc = "The column separator used by the generic format (the default is white space).", 
 653      can_be_none = True 
 654  ) 
 655  # Description. 
 656  uf.desc.append(Desc_container()) 
 657  uf.desc[-1].add_paragraph("This will read R2eff/R1rho data directly from a file.  The data will be associated with an experiment ID string.  A partial ID is to be supplied and then the full ID string will be constructed as this ID followed by an underscore and then the dispersion point value from the file (as '%s_%s' % (id, disp_point)).  The full IDs must already exist and have been used to set the type of dispersion experiment the data is from, spectrometer proton frequency of the data, and if needed the time of the relaxation period.") 
 658  uf.desc[-1].add_paragraph("The format of this text file must be that each row corresponds to a unique spin system and that there is one file per dispersion point (i.e. per CPMG frequency nu_CPMG or per spin-lock field strength nu1).  The file must be in columnar format and information to identify the spin must be in columns of the file.") 
 659  uf.backend = r2eff_read 
 660  uf.menu_text = "&r2eff_read" 
 661  uf.gui_icon = "oxygen.actions.document-open" 
 662  uf.wizard_size = (1000, 600) 
 663  uf.wizard_image = ANALYSIS_IMAGE_PATH + 'relax_disp_200x200.png' 
 664   
 665   
 666  # The relax_disp.r2eff_read_spin user function. 
 667  uf = uf_info.add_uf('relax_disp.r2eff_read_spin') 
 668  uf.title = "Read R2eff/R1rho values and errors for a single spin from a file." 
 669  uf.title_short = "Spin R2eff/R1rho value reading." 
 670  uf.add_keyarg( 
 671      name = "id", 
 672      py_type = "str", 
 673      desc_short = "experiment ID string", 
 674      desc = "The experiment ID string to identify this data with.", 
 675      wiz_element_type = 'combo', 
 676      wiz_combo_iter = spectrum.get_ids, 
 677      wiz_read_only = True 
 678  ) 
 679  uf.add_keyarg( 
 680      name = "spin_id", 
 681      py_type = "str", 
 682      arg_type = "spin ID", 
 683      desc_short = "spin ID string", 
 684      desc = "The spin identification string.", 
 685      can_be_none = True 
 686  ) 
 687  uf.add_keyarg( 
 688      name = "file", 
 689      py_type = "str", 
 690      arg_type = "file sel", 
 691      desc_short = "file name", 
 692      desc = "The name of the file.", 
 693      wiz_filesel_style = FD_SAVE 
 694  ) 
 695  uf.add_keyarg( 
 696      name = "dir", 
 697      py_type = "str", 
 698      arg_type = "dir", 
 699      desc_short = "directory name", 
 700      desc = "The directory name.", 
 701      can_be_none = True 
 702  ) 
 703  uf.add_keyarg( 
 704      name = "disp_point_col", 
 705      default = None, 
 706      min = 1, 
 707      py_type = "int", 
 708      desc_short = "dispersion point column", 
 709      desc = "The column containing the CPMG frequency or spin-lock field strength (Hz).", 
 710      can_be_none = True 
 711  ) 
 712  uf.add_keyarg( 
 713      name = "offset_col", 
 714      default = None, 
 715      min = 1, 
 716      py_type = "int", 
 717      desc_short = "offset column", 
 718      desc = "The column containing the offset information for R1rho-type data.", 
 719      can_be_none = True 
 720  ) 
 721  uf.add_keyarg( 
 722      name = "data_col", 
 723      default = 2, 
 724      min = 1, 
 725      py_type = "int", 
 726      desc_short = "R2eff/R1rho data column", 
 727      desc = "The column containing the R2eff or R1rho data." 
 728  ) 
 729  uf.add_keyarg( 
 730      name = "error_col", 
 731      default = 3, 
 732      min = 1, 
 733      py_type = "int", 
 734      desc_short = "R2eff/R1rho error column", 
 735      desc = "The column containing the R2eff or R1rho error." 
 736  ) 
 737  uf.add_keyarg( 
 738      name = "sep", 
 739      py_type = "str", 
 740      desc_short = "column separator", 
 741      desc = "The column separator (the default is white space).", 
 742      wiz_element_type = "combo", 
 743      wiz_combo_choices = [",", ";", "\\t"], 
 744      can_be_none = True 
 745  ) 
 746  # Description. 
 747  uf.desc.append(Desc_container()) 
 748  uf.desc[-1].add_paragraph("This will read R2eff/R1rho data for a single spin directly from a file.  The data will be associated with an experiment ID string.  This ID can be used for setting the type of dispersion experiment the data is from, spectrometer proton frequency of the data, and the time of the relaxation period.") 
 749  uf.desc[-1].add_paragraph("The format of this text file must be that each row corresponds to a dispersion point (i.e. per CPMG frequency nu_CPMG or per spin-lock field strength nu1) and that there is one file per unique spin system.  The file must be in columnar format.  For R1rho data, the dispersion point column can be substituted for the offset values in Hertz.") 
 750  uf.backend = r2eff_read_spin 
 751  uf.menu_text = "&r2eff_read_spin" 
 752  uf.gui_icon = "oxygen.actions.document-open" 
 753  uf.wizard_size = (900, 700) 
 754  uf.wizard_image = ANALYSIS_IMAGE_PATH + 'relax_disp_200x200.png' 
 755   
 756   
 757  # The relax_disp.relax_time user function. 
 758  uf = uf_info.add_uf('relax_disp.relax_time') 
 759  uf.title = "Set the relaxation delay time associated with each spectrum." 
 760  uf.title_short = "Relaxation delay time setting." 
 761  uf.add_keyarg( 
 762      name = "spectrum_id", 
 763      py_type = "str", 
 764      desc_short = "spectrum ID string", 
 765      desc = "The spectrum ID string.", 
 766      wiz_element_type = 'combo', 
 767      wiz_combo_iter = spectrum.get_ids, 
 768      wiz_read_only = True 
 769  ) 
 770  uf.add_keyarg( 
 771      name = "time", 
 772      default = 0.0, 
 773      py_type = "num", 
 774      desc_short = "relaxation time", 
 775      desc = "The time, in seconds, of the relaxation period." 
 776  ) 
 777  # Description. 
 778  uf.desc.append(Desc_container()) 
 779  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.") 
 780  uf.backend = relax_time 
 781  uf.menu_text = "&relax_time" 
 782  uf.gui_icon = "oxygen.actions.chronometer" 
 783  uf.wizard_size = (800, 500) 
 784  uf.wizard_image = ANALYSIS_IMAGE_PATH + 'relax_disp_200x200.png' 
 785   
 786   
 787  # The relax_disp.select_model user function. 
 788  uf = uf_info.add_uf('relax_disp.select_model') 
 789  uf.title = "Select the relaxation dispersion model." 
 790  uf.title_short = "Relaxation dispersion model setup." 
 791  uf.display = True 
 792  uf.add_keyarg( 
 793      name = "model", 
 794      default = MODEL_R2EFF, 
 795      py_type = "str", 
 796      desc_short = "dispersion model", 
 797      desc = "The type of relaxation dispersion model to fit.", 
 798      wiz_element_type = "combo", 
 799      wiz_combo_choices = [ 
 800          "%s: {%s/%s, %s}" % (MODEL_R2EFF, r2eff, r1rho, i0), 
 801          "%s: {%s, ...}" % (MODEL_NOREX, r2), 
 802          "%s: {%s, ..., %s, %s}" % (MODEL_LM63, r2, phi_ex, kex), 
 803          "%s: {%s, ..., %s, kB, %s, kC}" % (MODEL_LM63_3SITE, r2, phi_exB, phi_exC), 
 804          "%s: {%s, ..., pA, %s, %s}" % (MODEL_CR72, r2, dw, kex), 
 805          "%s: {%s, %s, ..., pA, %s, %s}" % (MODEL_CR72_FULL, r2a, r2b, dw, kex), 
 806          "%s: {%s, ..., pA, %s, %s}" % (MODEL_IT99, r2, dw, kex), 
 807          "%s: {%s, ..., %s, k_AB}" % (MODEL_TSMFK01, r2a, dw), 
 808          "%s: {%s, ..., pA, %s, %s}" % (MODEL_NS_CPMG_2SITE_3D, r2, dw, kex), 
 809          "%s: {%s, %s, ..., pA, %s, %s}" % (MODEL_NS_CPMG_2SITE_3D_FULL, r2a, r2b, dw, kex), 
 810          "%s: {%s, ..., pA, %s, %s}" % (MODEL_NS_CPMG_2SITE_STAR, r2, dw, kex), 
 811          "%s: {%s, %s, ..., pA, %s, %s}" % (MODEL_NS_CPMG_2SITE_STAR_FULL, r2a, r2b, dw, kex), 
 812          "%s: {%s, ..., pA, %s, %s}" % (MODEL_NS_CPMG_2SITE_EXPANDED, r2, dw, kex), 
 813          "%s: {%s, ..., pA, %s, %s, %s}" % (MODEL_MMQ_CR72, r2, dw, dwH, kex), 
 814          "%s: {%s, ..., pA, %s, %s, %s}" % (MODEL_NS_MMQ_2SITE, r2, dw, dwH, kex), 
 815          "%s: {%s, ..., pA, %s, %s, %s, pB, %s, %s, %s}" % (MODEL_NS_MMQ_3SITE_LINEAR, r2, dw_AB, dwH_AB, kAB, dw_BC, dwH_BC, kBC), 
 816          "%s: {%s, ..., pA, %s, %s, %s, pB, %s, %s, %s, %s}" % (MODEL_NS_MMQ_3SITE, r2, dw_AB, dwH_AB, kAB, dw_BC, dwH_BC, kBC, kAC), 
 817          "%s: {%s, ..., %s, %s}" % (MODEL_M61, r1rho_prime, phi_ex, kex), 
 818          "%s: {%s, ..., pA, %s, %s}" % (MODEL_M61B, r1rho_prime, dw, kex), 
 819          "%s: {%s, ..., %s, %s}" % (MODEL_DPL94, r1rho_prime, phi_ex, kex), 
 820          "%s: {%s, ..., pA, %s, %s}" % (MODEL_TP02, r1rho_prime, dw, kex), 
 821          "%s: {%s, ..., pA, %s, %s}" % (MODEL_TAP03, r1rho_prime, dw, kex), 
 822          "%s: {%s, ..., pA, %s, %s}" % (MODEL_MP05, r1rho_prime, dw, kex), 
 823          "%s: {%s, ..., pA, %s, %s}" % (MODEL_NS_R1RHO_2SITE, r1rho_prime, dw, kex), 
 824          "%s: {%s, ..., pA, %s, %s, pB, %s, %s}" % (MODEL_NS_R1RHO_3SITE_LINEAR, r2, dw_AB, kAB, dw_BC, kBC), 
 825          "%s: {%s, ..., pA, %s, %s, pB, %s, %s, %s}" % (MODEL_NS_R1RHO_3SITE, r2, dw_AB, kAB, dw_BC, kBC, kAC) 
 826      ], 
 827      wiz_combo_data = [ 
 828          MODEL_R2EFF, 
 829          MODEL_NOREX, 
 830          MODEL_LM63, 
 831          MODEL_LM63_3SITE, 
 832          MODEL_CR72, 
 833          MODEL_CR72_FULL, 
 834          MODEL_IT99, 
 835          MODEL_TSMFK01, 
 836          MODEL_NS_CPMG_2SITE_3D, 
 837          MODEL_NS_CPMG_2SITE_3D_FULL, 
 838          MODEL_NS_CPMG_2SITE_STAR, 
 839          MODEL_NS_CPMG_2SITE_STAR_FULL, 
 840          MODEL_NS_CPMG_2SITE_EXPANDED, 
 841          MODEL_MMQ_CR72, 
 842          MODEL_NS_MMQ_2SITE, 
 843          MODEL_NS_MMQ_3SITE_LINEAR, 
 844          MODEL_NS_MMQ_3SITE, 
 845          MODEL_M61, 
 846          MODEL_M61B, 
 847          MODEL_DPL94, 
 848          MODEL_TP02, 
 849          MODEL_TAP03, 
 850          MODEL_MP05, 
 851          MODEL_NS_R1RHO_2SITE, 
 852          MODEL_NS_R1RHO_3SITE_LINEAR, 
 853          MODEL_NS_R1RHO_3SITE 
 854      ], 
 855      wiz_read_only = True 
 856  ) 
 857  # Description. 
 858  uf.desc.append(Desc_container()) 
 859  uf.desc[-1].add_paragraph("A number of different dispersion models are supported.  This includes both analytic models and numerical models.  Models which are independent of the experimental data type are:") 
 860  uf.desc[-1].add_item_list_element("'%s'" % MODEL_R2EFF, "This is the model used to determine the R2eff/R1rho values and errors required as the base data for all other models,") 
 861  uf.desc[-1].add_item_list_element("'%s'" % MODEL_NOREX, "This is the model for no chemical exchange being present.") 
 862  # CPMG-type data. 
 863  uf.desc.append(Desc_container('The SQ CPMG-type experiments')) 
 864  uf.desc[-1].add_paragraph("The currently supported analytic models are:") 
 865  uf.desc[-1].add_item_list_element("'%s'" % MODEL_LM63, "The original Luz and Meiboom (1963) 2-site fast exchange equation with parameters {R20, ..., phi_ex, kex},") 
 866  uf.desc[-1].add_item_list_element("'%s'" % MODEL_LM63_3SITE, "The original Luz and Meiboom (1963) 3-site fast exchange equation with parameters {R20, ..., phi_ex, kex, phi_ex2, kex2},") 
 867  uf.desc[-1].add_item_list_element("'%s'" % MODEL_CR72, "The reduced Carver and Richards (1972) 2-site equation for most time scales whereby the simplification R20A = R20B is assumed.  The parameters are {R20, ..., pA, dw, kex},") 
 868  uf.desc[-1].add_item_list_element("'%s'" % MODEL_CR72_FULL, "The full Carver and Richards (1972) 2-site equation for most time scales with parameters {R20A, R20B, ..., pA, dw, kex},") 
 869  uf.desc[-1].add_item_list_element("'%s'" % MODEL_IT99, "The Ishima and Torchia (1999) 2-site model for all time scales with pA >> pB and with parameters {R20, ..., pA, dw, kex},") 
 870  uf.desc[-1].add_item_list_element("'%s'" % MODEL_TSMFK01, "The Tollinger, Kay et al. (2001) 2-site very-slow exchange model, range of microsecond to second time scale.  Applicable in the limit of slow exchange, when |R20A-R20B| << k_AB,kB << 1/tau_CP.  R20A is the transverse relaxation rate of site A in the absence of exchange.  2*tau_CP is is the time between successive 180 deg. pulses.  The parameters are {R20A, ..., dw, k_AB}.") 
 871  uf.desc[-1].add_paragraph("The currently supported numeric models are:") 
 872  uf.desc[-1].add_item_list_element("'%s'" % MODEL_NS_CPMG_2SITE_3D, "The reduced numerical solution for the 2-site Bloch-McConnell equations using 3D magnetisation vectors whereby the simplification R20A = R20B is assumed.  Its parameters are {R20, ..., pA, dw, kex},") 
 873  uf.desc[-1].add_item_list_element("'%s'" % MODEL_NS_CPMG_2SITE_3D_FULL, "The full numerical solution for the 2-site Bloch-McConnell equations using 3D magnetisation vectors.  Its parameters are {R20A, R20B, ..., pA, dw, kex},") 
 874  uf.desc[-1].add_item_list_element("'%s'" % MODEL_NS_CPMG_2SITE_STAR, "The reduced numerical solution for the 2-site Bloch-McConnell equations using complex conjugate matrices whereby the simplification R20A = R20B is assumed.  It has the parameters {R20, ..., pA, dw, kex},") 
 875  uf.desc[-1].add_item_list_element("'%s'" % MODEL_NS_CPMG_2SITE_STAR_FULL, "The full numerical solution for the 2-site Bloch-McConnell equations using complex conjugate matrices with parameters {R20A, R20B, ..., pA, dw, kex},") 
 876  uf.desc[-1].add_item_list_element("'%s'" % MODEL_NS_CPMG_2SITE_EXPANDED, "The numerical solution for the 2-site Bloch-McConnell equations expanded using Maple by Nikolai Skrynnikov.  It has the parameters {R20, ..., pA, dw, kex}.") 
 877  # MMQ CPMG-type data. 
 878  uf.desc.append(Desc_container('The MMQ CPMG-type experiments')) 
 879  uf.desc[-1].add_paragraph("The currently supported models are:") 
 880  uf.desc[-1].add_item_list_element("'%s'" % MODEL_MMQ_CR72, "The the Carver and Richards (1972) 2-site model for most time scales expanded for MMQ CPMG data by Korzhnev et al., 2004, whereby the simplification R20A = R20B is assumed.  Its parameters are {R20, ..., pA, dw, dwH, kex}.") 
 881  uf.desc[-1].add_item_list_element("'%s'" % MODEL_NS_MMQ_2SITE, "The numerical solution for the 2-site Bloch-McConnell equations for combined proton-heteronuclear SQ, ZQ, DQ, and MQ CPMG data whereby the simplification R20A = R20B is assumed.  Its parameters are {R20, ..., pA, dw, dwH, kex}.") 
 882  uf.desc[-1].add_item_list_element("'%s'" % MODEL_NS_MMQ_3SITE_LINEAR, "The numerical solution for the 3-site Bloch-McConnell equations linearised with kAC = kCA = 0 for combined proton-heteronuclear SQ, ZQ, DQ, and MQ CPMG data whereby the simplification R20A = R20B = R20C is assumed.  Its parameters are {R20, ..., pA, dw(AB), dwH(AB), kex(AB), pB, dw(BC), dwH(BC), kex(BC)}.") 
 883  uf.desc[-1].add_item_list_element("'%s'" % MODEL_NS_MMQ_3SITE, "The numerical solution for the 3-site Bloch-McConnell equations for combined proton-heteronuclear SQ, ZQ, DQ, and MQ CPMG data whereby the simplification R20A = R20B = R20C is assumed.  Its parameters are {R20, ..., pA, dw(AB), dwH(AB), kex(AB), pB, dw(BC), dwH(BC), kex(BC), kex(AC)}.") 
 884  # R1rho-type data. 
 885  uf.desc.append(Desc_container('The R1rho-type experiments')) 
 886  uf.desc[-1].add_paragraph("The currently supported analytic models are:") 
 887  uf.desc[-1].add_item_list_element("'%s'" % MODEL_M61, "The Meiboom (1961) 2-site fast exchange equation with parameters {R1rho', ..., phi_ex, kex},") 
 888  uf.desc[-1].add_item_list_element("'%s'" % MODEL_M61B, "The Meiboom (1961) 2-site equation for all time scales with pA >> pB and with parameters {R1rho', ..., pA, dw, kex},") 
 889  uf.desc[-1].add_item_list_element("'%s'" % MODEL_DPL94, "The Davis, Perlman and London (1994) 2-site fast exchange equation with parameters {R1rho', ..., phi_ex, kex},") 
 890  uf.desc[-1].add_item_list_element("'%s'" % MODEL_TP02, "The Trott and Palmer (2002) 2-site equation for all time scales with parameters {R1rho', ..., pA, dw, kex}.") 
 891  uf.desc[-1].add_item_list_element("'%s'" % MODEL_TAP03, "The Trott, Abergel and Palmer (2003) off-resonance 2-site equation for all time scales with parameters {R1rho', ..., pA, dw, kex}.") 
 892  uf.desc[-1].add_item_list_element("'%s'" % MODEL_MP05, "The Miloushev and Palmer (2005) 2-site off-resonance equation for all time scales with parameters {R1rho', ..., pA, dw, kex}.") 
 893  uf.desc[-1].add_paragraph("The currently supported numeric models are:") 
 894  uf.desc[-1].add_item_list_element("'%s'" % MODEL_NS_R1RHO_2SITE, "The numerical solution for the 2-site Bloch-McConnell equations using 3D magnetisation vectors whereby the simplification R20A = R20B = R20C is assumed and linearised with kAC = kCA = 0.  Its parameters are {R1rho', ..., pA, dw(AB), kex(AB), pB, dw(BC), kex(BC)}.") 
 895  uf.desc[-1].add_item_list_element("'%s'" % MODEL_NS_R1RHO_3SITE_LINEAR, "The numerical solution for the 3-site Bloch-McConnell equations using 3D magnetisation vectors whereby the simplification R20A = R20B = R20C is assumed.  Its parameters are {R1rho', ..., pA, dw, kex}.") 
 896  uf.desc[-1].add_item_list_element("'%s'" % MODEL_NS_R1RHO_3SITE, "The numerical solution for the 3-site Bloch-McConnell equations using 3D magnetisation vectors.  Its parameters are {R1rho', ..., pA, dw(AB), kex(AB), pB, dw(BC), kex(BC), kex(AC)}.") 
 897  # Prompt examples. 
 898  uf.desc.append(Desc_container("Prompt examples")) 
 899  uf.desc[-1].add_paragraph("To pick the 2-site fast exchange model for all selected spins, type one of:") 
 900  uf.desc[-1].add_prompt("relax> relax_disp.select_model('%s')" % MODEL_LM63) 
 901  uf.desc[-1].add_prompt("relax> relax_disp.select_model(model='%s')" % MODEL_LM63) 
 902  uf.backend = relax_disp_obj._select_model 
 903  uf.menu_text = "&select_model" 
 904  uf.gui_icon = "oxygen.actions.list-add" 
 905  uf.wizard_height_desc = 500 
 906  uf.wizard_size = (1000, 700) 
 907  uf.wizard_apply_button = False 
 908  uf.wizard_image = ANALYSIS_IMAGE_PATH + 'relax_disp_200x200.png' 
 909   
 910   
 911  # The relax_disp.sherekhan_input user function. 
 912  uf = uf_info.add_uf('relax_disp.sherekhan_input') 
 913  uf.title = "Create the input files for Adam Mazur's ShereKhan program." 
 914  uf.title_short = "ShereKhan input file creation." 
 915  uf.add_keyarg( 
 916      name = "force", 
 917      default = False, 
 918      py_type = "bool", 
 919      desc_short = "force flag", 
 920      desc = "A flag which if set to True will cause the files to be overwritten if they already exist." 
 921  ) 
 922  uf.add_keyarg( 
 923      name = "spin_id", 
 924      py_type = "str", 
 925      desc_short = "spin ID string", 
 926      desc = "The spin identification string.", 
 927      can_be_none = True 
 928  ) 
 929  # Description. 
 930  uf.desc.append(Desc_container()) 
 931  uf.desc[-1].add_paragraph("This creates the files required for the ShereKhan server located at http://sherekhan.bionmr.org/.  One file per spin cluster per field strength will be created.  These will be placed in the directory 'clusterx' and named 'sherekhan_frqy.in', where x is the cluster index starting from 1 and y is the magnetic field strength index starting from 1.") 
 932  uf.backend = sherekhan_input 
 933  uf.menu_text = "&sherekhan_input" 
 934  uf.gui_icon = "relax.sherekhan" 
 935  uf.wizard_size = (800, 500) 
 936  uf.wizard_apply_button = False 
 937  uf.wizard_image = WIZARD_IMAGE_PATH + 'sherekhan.png' 
 938   
 939   
 940  # The relax_disp.spin_lock_field user function. 
 941  uf = uf_info.add_uf('relax_disp.spin_lock_field') 
 942  uf.title = "Set the relaxation dispersion spin-lock field strength (nu1)." 
 943  uf.title_short = "Spin-lock field strength." 
 944  uf.add_keyarg( 
 945      name = "spectrum_id", 
 946      py_type = "str", 
 947      desc_short = "spectrum ID string", 
 948      desc = "The spectrum ID string to associate the spin-lock field strength to.", 
 949      wiz_element_type = 'combo', 
 950      wiz_combo_iter = spectrum.get_ids, 
 951      wiz_read_only = True 
 952  ) 
 953  uf.add_keyarg( 
 954      name = "field", 
 955      py_type = "num", 
 956      desc_short = "field strength nu1 (Hz)", 
 957      desc = "The spin-lock field strength, nu1, in Hz.", 
 958      can_be_none = True 
 959  ) 
 960  # Description. 
 961  uf.desc.append(Desc_container()) 
 962  uf.desc[-1].add_paragraph("This sets the spin-lock field strength, nu1, for the specified R1rho spectrum in Hertz.") 
 963  # Prompt examples. 
 964  uf.desc.append(Desc_container("Prompt examples")) 
 965  uf.desc[-1].add_paragraph("To set a spin-lock field strength of 2.1 kHz for the spectrum 'nu1_2.1kHz_relaxT_0.010', type one of:") 
 966  uf.desc[-1].add_prompt("relax> relax_disp.spin_lock_field(2100, 'nu1_2.1kHz_relaxT_0.010')") 
 967  uf.desc[-1].add_prompt("relax> relax_disp.spin_lock_field(field=2100, spectrum_id='nu1_2.1kHz_relaxT_0.010')") 
 968  uf.backend = spin_lock_field 
 969  uf.menu_text = "spin_lock_&field" 
 970  uf.wizard_size = (800, 500) 
 971  uf.wizard_image = ANALYSIS_IMAGE_PATH + 'relax_disp_200x200.png' 
 972   
 973   
 974  # The relax_disp.spin_lock_offset user function. 
 975  uf = uf_info.add_uf('relax_disp.spin_lock_offset') 
 976  uf.title = "Set the relaxation dispersion spin-lock offset (omega_rf)." 
 977  uf.title_short = "Spin-lock offset." 
 978  uf.add_keyarg( 
 979      name = "spectrum_id", 
 980      py_type = "str", 
 981      desc_short = "spectrum ID string", 
 982      desc = "The spectrum ID string to associate the spin-lock offset to.", 
 983      wiz_element_type = 'combo', 
 984      wiz_combo_iter = spectrum.get_ids, 
 985      wiz_read_only = True 
 986  ) 
 987  uf.add_keyarg( 
 988      name = "offset", 
 989      py_type = "num", 
 990      desc_short = "spin-lock offset (ppm)", 
 991      desc = "The spin-lock offset, omega_rf, in ppm.", 
 992      can_be_none = True 
 993  ) 
 994  # Description. 
 995  uf.desc.append(Desc_container()) 
 996  uf.desc[-1].add_paragraph("This sets the spin-lock offset, omega_rf, for the specified R1rho spectrum in ppm.") 
 997  # Prompt examples. 
 998  uf.desc.append(Desc_container("Prompt examples")) 
 999  uf.desc[-1].add_paragraph("To set a spin-lock offset of 110.0 ppm for the spectrum 'nu1_2.1kHz_relaxT_0.010', type one of:") 
1000  uf.desc[-1].add_prompt("relax> relax_disp.spin_lock_offset('nu1_2.1kHz_relaxT_0.010', 110.0)") 
1001  uf.desc[-1].add_prompt("relax> relax_disp.spin_lock_offset(spectrum_id='nu1_2.1kHz_relaxT_0.010', offset=110.0)") 
1002  uf.backend = spin_lock_offset 
1003  uf.menu_text = "spin_lock_&offset" 
1004  uf.wizard_size = (800, 500) 
1005  uf.wizard_image = ANALYSIS_IMAGE_PATH + 'relax_disp_200x200.png' 
1006   
1007   
1008  # The relax_disp.write_disp_curves user function. 
1009  uf = uf_info.add_uf('relax_disp.write_disp_curves') 
1010  uf.title = "Create text files of the dispersion curves for each spin system." 
1011  uf.title_short = "Dispersion curve writing." 
1012  uf.add_keyarg( 
1013      name = "dir", 
1014      py_type = "str", 
1015      arg_type = "dir sel", 
1016      desc_short = "directory name", 
1017      desc = "The directory name to place all of the spin system files into.", 
1018      can_be_none = True 
1019  ) 
1020  uf.add_keyarg( 
1021      name = "force", 
1022      default = False, 
1023      py_type = "bool", 
1024      desc_short = "force flag", 
1025      desc = "A flag which, if set to True, will cause the files to be overwritten." 
1026  ) 
1027  # Description. 
1028  uf.desc.append(Desc_container()) 
1029  uf.desc[-1].add_paragraph("This is used to created text files of the dispersion curves of R2eff/R1rho values, both measured and back calculated from the optimised dispersion model.  The columns of the text file will be the experiment name, the magnetic field strength (as the proton frequency in MHz), dispersion point (nu_CPMG or the spin-lock field strength), the experimental R2eff value, the back-calculated R2eff value, and the experimental R2eff error.  One file will be created per spin system with the name 'disp_x.out', where x is the spin ID string.") 
1030  uf.backend = write_disp_curves 
1031  uf.menu_text = "&write_disp_curves" 
1032  uf.gui_icon = "oxygen.actions.document-save" 
1033  uf.wizard_size = (700, 500) 
1034  uf.wizard_image = ANALYSIS_IMAGE_PATH + 'relax_disp_200x200.png' 
1035