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

Source Code for Module user_functions.chemical_shift

  1  ############################################################################### 
  2  #                                                                             # 
  3  # Copyright (C) 2013 Edward d'Auvergne                                        # 
  4  #                                                                             # 
  5  # This file is part of the program relax (http://www.nmr-relax.com).          # 
  6  #                                                                             # 
  7  # This program is free software: you can redistribute it and/or modify        # 
  8  # it under the terms of the GNU General Public License as published by        # 
  9  # the Free Software Foundation, either version 3 of the License, or           # 
 10  # (at your option) any later version.                                         # 
 11  #                                                                             # 
 12  # This program is distributed in the hope that it will be useful,             # 
 13  # but WITHOUT ANY WARRANTY; without even the implied warranty of              # 
 14  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               # 
 15  # GNU General Public License for more details.                                # 
 16  #                                                                             # 
 17  # You should have received a copy of the GNU General Public License           # 
 18  # along with this program.  If not, see <http://www.gnu.org/licenses/>.       # 
 19  #                                                                             # 
 20  ############################################################################### 
 21   
 22  # Module docstring. 
 23  """The chemical_shift user function definitions.""" 
 24   
 25  # Python module imports. 
 26  import dep_check 
 27  if dep_check.wx_module: 
 28      from wx import FD_OPEN 
 29  else: 
 30      FD_OPEN = -1 
 31  from os import sep 
 32   
 33  # relax module imports. 
 34  from graphics import WIZARD_IMAGE_PATH 
 35  from pipe_control import chemical_shift 
 36  from user_functions.data import Uf_info; uf_info = Uf_info() 
 37  from user_functions.objects import Desc_container 
 38   
 39   
 40  # The user function class. 
 41  uf_class = uf_info.add_class('chemical_shift') 
 42  uf_class.title = "Class for handling chemical shifts." 
 43  uf_class.menu_text = "&chemical_shift" 
 44  uf_class.gui_icon = "relax.chemical_shift" 
 45   
 46   
 47  # The chemical_shift.read user function. 
 48  uf = uf_info.add_uf('chemical_shift.read') 
 49  uf.title = "Read chemical shifts from a file." 
 50  uf.title_short = "Chemical shift reading." 
 51  uf.add_keyarg( 
 52      name = "file", 
 53      py_type = "str", 
 54      arg_type = "file sel", 
 55      desc_short = "file name", 
 56      desc = "The name of the peak list of generic formatted file containing the chemical shifts.", 
 57      wiz_filesel_style = FD_OPEN 
 58  ) 
 59  uf.add_keyarg( 
 60      name = "dir", 
 61      py_type = "str", 
 62      arg_type = "dir", 
 63      desc_short = "directory name", 
 64      desc = "The directory where the file is located.", 
 65      can_be_none = True 
 66  ) 
 67  uf.add_keyarg( 
 68      name = "spin_id_col", 
 69      py_type = "int", 
 70      arg_type = "free format", 
 71      desc_short = "spin ID string column", 
 72      desc = "The spin ID string column used by the generic file format (an alternative to the mol, res, and spin name and number columns).", 
 73      can_be_none = True 
 74  ) 
 75  uf.add_keyarg( 
 76      name = "mol_name_col", 
 77      py_type = "int", 
 78      arg_type = "free format", 
 79      desc_short = "molecule name column", 
 80      desc = "The molecule name column used by the generic file format (alternative to the spin ID column).", 
 81      can_be_none = True 
 82  ) 
 83  uf.add_keyarg( 
 84      name = "res_num_col", 
 85      py_type = "int", 
 86      arg_type = "free format", 
 87      desc_short = "residue number column", 
 88      desc = "The residue number column used by the generic file format (alternative to the spin ID column).", 
 89      can_be_none = True 
 90  ) 
 91  uf.add_keyarg( 
 92      name = "res_name_col", 
 93      py_type = "int", 
 94      arg_type = "free format", 
 95      desc_short = "residue name column", 
 96      desc = "The residue name column used by the generic file format (alternative to the spin ID column).", 
 97      can_be_none = True 
 98  ) 
 99  uf.add_keyarg( 
100      name = "spin_num_col", 
101      py_type = "int", 
102      arg_type = "free format", 
103      desc_short = "spin number column", 
104      desc = "The spin number column used by the generic file format (alternative to the spin ID column).", 
105      can_be_none = True 
106  ) 
107  uf.add_keyarg( 
108      name = "spin_name_col", 
109      py_type = "int", 
110      arg_type = "free format", 
111      desc_short = "spin name column", 
112      desc = "The spin name column used by the generic file format (alternative to the spin ID column).", 
113      can_be_none = True 
114  ) 
115  uf.add_keyarg( 
116      name = "sep", 
117      py_type = "str", 
118      arg_type = "free format", 
119      desc_short = "column separator", 
120      desc = "The column separator used by the generic format (the default is white space).", 
121      can_be_none = True 
122  ) 
123  uf.add_keyarg( 
124      name = "spin_id", 
125      py_type = "str", 
126      desc_short = "spin ID string", 
127      desc = "The spin ID string used to restrict the loading of data to certain spin subsets.", 
128      can_be_none = True 
129  ) 
130  # Description. 
131  uf.desc.append(Desc_container()) 
132  uf.desc[-1].add_paragraph("This will read chemical shifts from a peak list or a generic column formatted file.") 
133  # Prompt examples. 
134  uf.desc.append(Desc_container("Prompt examples")) 
135  uf.desc[-1].add_paragraph("The following commands will read the chemical shifts out of the Sparky peak list '10ms.list':") 
136  uf.desc[-1].add_prompt("relax> chemical_shift.read('10ms.list')") 
137  uf.backend = chemical_shift.read 
138  uf.menu_text = "&read" 
139  uf.gui_icon = "oxygen.actions.document-open" 
140  uf.wizard_size = (800, 500) 
141  uf.wizard_image = WIZARD_IMAGE_PATH + 'spectrum' + sep + 'spectrum_200.png' 
142