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-2014 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  from user_functions.wildcards import WILDCARD_SPECTRUM_PEAKLIST 
 39   
 40   
 41  # The user function class. 
 42  uf_class = uf_info.add_class('chemical_shift') 
 43  uf_class.title = "Class for handling chemical shifts." 
 44  uf_class.menu_text = "&chemical_shift" 
 45  uf_class.gui_icon = "relax.chemical_shift" 
 46   
 47   
 48  # The chemical_shift.read user function. 
 49  uf = uf_info.add_uf('chemical_shift.read') 
 50  uf.title = "Read chemical shifts from a file." 
 51  uf.title_short = "Chemical shift reading." 
 52  uf.add_keyarg( 
 53      name = "file", 
 54      py_type = "str", 
 55      arg_type = "file sel", 
 56      desc_short = "file name", 
 57      desc = "The name of the peak list of generic formatted file containing the chemical shifts.", 
 58      wiz_filesel_wildcard = WILDCARD_SPECTRUM_PEAKLIST, 
 59      wiz_filesel_style = FD_OPEN 
 60  ) 
 61  uf.add_keyarg( 
 62      name = "dir", 
 63      py_type = "str", 
 64      arg_type = "dir", 
 65      desc_short = "directory name", 
 66      desc = "The directory where the file is located.", 
 67      can_be_none = True 
 68  ) 
 69  uf.add_keyarg( 
 70      name = "spin_id_col", 
 71      py_type = "int", 
 72      arg_type = "free format", 
 73      desc_short = "spin ID string column", 
 74      desc = "The spin ID string column used by the generic file format (an alternative to the mol, res, and spin name and number columns).", 
 75      can_be_none = True 
 76  ) 
 77  uf.add_keyarg( 
 78      name = "mol_name_col", 
 79      py_type = "int", 
 80      arg_type = "free format", 
 81      desc_short = "molecule name column", 
 82      desc = "The molecule name column used by the generic file format (alternative to the spin ID column).", 
 83      can_be_none = True 
 84  ) 
 85  uf.add_keyarg( 
 86      name = "res_num_col", 
 87      py_type = "int", 
 88      arg_type = "free format", 
 89      desc_short = "residue number column", 
 90      desc = "The residue number column used by the generic file format (alternative to the spin ID column).", 
 91      can_be_none = True 
 92  ) 
 93  uf.add_keyarg( 
 94      name = "res_name_col", 
 95      py_type = "int", 
 96      arg_type = "free format", 
 97      desc_short = "residue name column", 
 98      desc = "The residue name column used by the generic file format (alternative to the spin ID column).", 
 99      can_be_none = True 
100  ) 
101  uf.add_keyarg( 
102      name = "spin_num_col", 
103      py_type = "int", 
104      arg_type = "free format", 
105      desc_short = "spin number column", 
106      desc = "The spin number column used by the generic file format (alternative to the spin ID column).", 
107      can_be_none = True 
108  ) 
109  uf.add_keyarg( 
110      name = "spin_name_col", 
111      py_type = "int", 
112      arg_type = "free format", 
113      desc_short = "spin name column", 
114      desc = "The spin name column used by the generic file format (alternative to the spin ID column).", 
115      can_be_none = True 
116  ) 
117  uf.add_keyarg( 
118      name = "sep", 
119      py_type = "str", 
120      arg_type = "free format", 
121      desc_short = "column separator", 
122      desc = "The column separator used by the generic format (the default is white space).", 
123      can_be_none = True 
124  ) 
125  uf.add_keyarg( 
126      name = "spin_id", 
127      py_type = "str", 
128      desc_short = "spin ID string", 
129      desc = "The spin ID string used to restrict the loading of data to certain spin subsets.", 
130      can_be_none = True 
131  ) 
132  # Description. 
133  uf.desc.append(Desc_container()) 
134  uf.desc[-1].add_paragraph("This will read chemical shifts from a peak list or a generic column formatted file.") 
135  # Prompt examples. 
136  uf.desc.append(Desc_container("Prompt examples")) 
137  uf.desc[-1].add_paragraph("The following commands will read the chemical shifts out of the Sparky peak list '10ms.list':") 
138  uf.desc[-1].add_prompt("relax> chemical_shift.read('10ms.list')") 
139  uf.backend = chemical_shift.read 
140  uf.menu_text = "&read" 
141  uf.gui_icon = "oxygen.actions.document-open" 
142  uf.wizard_size = (800, 500) 
143  uf.wizard_image = WIZARD_IMAGE_PATH + 'spectrum' + sep + 'spectrum_200.png' 
144