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