Package prompt :: Module model_free
[hide private]
[frames] | no frames]

Source Code for Module prompt.model_free

  1  ############################################################################### 
  2  #                                                                             # 
  3  # Copyright (C) 2003-2012 Edward d'Auvergne                                   # 
  4  #                                                                             # 
  5  # This file is part of the program relax.                                     # 
  6  #                                                                             # 
  7  # relax 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 2 of the License, or           # 
 10  # (at your option) any later version.                                         # 
 11  #                                                                             # 
 12  # relax 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 relax; if not, write to the Free Software                        # 
 19  # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA   # 
 20  #                                                                             # 
 21  ############################################################################### 
 22   
 23  # Module docstring. 
 24  """Module containing the model-free analysis 'model_free' user function class.""" 
 25  __docformat__ = 'plaintext' 
 26   
 27  # relax module imports. 
 28  from base_class import User_fn_class 
 29  import arg_check 
 30  from specific_fns.setup import model_free_obj 
 31   
 32   
33 -class Model_free(User_fn_class):
34 """Class for holding the preset model functions.""" 35
36 - def create_model(self, model=None, equation=None, params=None, spin_id=None):
37 """Function to create a model-free model. 38 39 Keyword Arguments 40 ~~~~~~~~~~~~~~~~~ 41 42 model: The name of the model-free model. 43 44 equation: The model-free equation. 45 46 params: The array of parameter names of the model. 47 48 spin_id: The spin identification string. 49 50 51 Model-free equation 52 ~~~~~~~~~~~~~~~~~~~ 53 54 'mf_orig' selects the original model-free equations with parameters {S2, te}. 55 'mf_ext' selects the extended model-free equations with parameters {S2f, tf, S2, ts}. 56 'mf_ext2' selects the extended model-free equations with parameters {S2f, tf, S2s, ts}. 57 58 59 Model-free parameters 60 ~~~~~~~~~~~~~~~~~~~~~ 61 62 The following parameters are accepted for the original model-free equation: 63 64 's2': The square of the generalised order parameter. 65 'te': The effective correlation time. 66 67 The following parameters are accepted for the extended model-free equation: 68 69 's2f': The square of the generalised order parameter of the faster motion. 70 'tf': The effective correlation time of the faster motion. 71 's2': The square of the generalised order parameter S2 = S2f * S2s. 72 'ts': The effective correlation time of the slower motion. 73 74 The following parameters are accepted for the extended 2 model-free equation: 75 76 's2f': The square of the generalised order parameter of the faster motion. 77 'tf': The effective correlation time of the faster motion. 78 's2s': The square of the generalised order parameter of the slower motion. 79 'ts': The effective correlation time of the slower motion. 80 81 The following parameters are accepted for all equations: 82 83 'rex': The chemical exchange relaxation. 84 'r': The average bond length <r>. 85 'csa': The chemical shift anisotropy. 86 87 88 Spin identification string 89 ~~~~~~~~~~~~~~~~~~~~~~~~~~ 90 91 If 'spin_id' is supplied then the model will only be created for the corresponding spins. 92 Otherwise the model will be created for all spins. 93 94 95 Examples 96 ~~~~~~~~ 97 98 The following commands will create the model-free model 'm1' which is based on the original 99 model-free equation and contains the single parameter 's2'. 100 101 relax> model_free.create_model('m1', 'mf_orig', ['s2']) 102 relax> model_free.create_model(model='m1', params=['s2'], equation='mf_orig') 103 104 105 The following commands will create the model-free model 'large_model' which is based on the 106 extended model-free equation and contains the seven parameters 's2f', 'tf', 's2', 'ts', 107 'rex', 'csa', 'r'. 108 109 relax> model_free.create_model('large_model', 'mf_ext', ['s2f', 'tf', 's2', 'ts', 'rex', 110 'csa', 'r']) 111 relax> model_free.create_model(model='large_model', params=['s2f', 'tf', 's2', 'ts', 'rex', 112 'csa', 'r'], equation='mf_ext') 113 """ 114 115 # Function intro text. 116 if self._exec_info.intro: 117 text = self._exec_info.ps3 + "model_free.create_model(" 118 text = text + "model=" + repr(model) 119 text = text + ", equation=" + repr(equation) 120 text = text + ", params=" + repr(params) 121 text = text + ", spin_id=" + repr(spin_id) + ")" 122 print(text) 123 124 # The argument checks. 125 arg_check.is_str(model, 'model-free model') 126 arg_check.is_str(equation, 'model-free equation') 127 arg_check.is_str_list(params, 'model-free parameters') 128 arg_check.is_str(spin_id, 'spin identification string', can_be_none=True) 129 130 # Execute the functional code. 131 model_free_obj._create_model(model=model, equation=equation, params=params, spin_id=spin_id)
132 133
134 - def delete(self):
135 """Function for deleting all model-free data from the current data pipe. 136 137 Examples 138 ~~~~~~~~ 139 140 To delete all model-free data, type: 141 142 relax> model_free.delete() 143 """ 144 145 # Function intro text. 146 if self._exec_info.intro: 147 text = self._exec_info.ps3 + "model_free.delete()" 148 print(text) 149 150 # Execute the functional code. 151 model_free_obj._delete()
152 153
154 - def remove_tm(self, spin_id=None):
155 """Function for removing the local tm parameter from a model. 156 157 Keyword Arguments 158 ~~~~~~~~~~~~~~~~~ 159 160 spin_id: The spin identification string. 161 162 163 Description 164 ~~~~~~~~~~~ 165 166 This function will remove the local tm parameter from the model-free parameter set. If 167 there is no local tm parameter within the set nothing will happen. 168 169 If no spin identification string is given, then the function will apply to all spins. 170 171 172 Examples 173 ~~~~~~~~ 174 175 The following command will remove the parameter 'tm': 176 177 relax> model_free.remove_tm() 178 """ 179 180 # Function intro text. 181 if self._exec_info.intro: 182 text = self._exec_info.ps3 + "model_free.remove_tm(" 183 text = text + "spin_id=" + repr(spin_id) + ")" 184 print(text) 185 186 # The argument checks. 187 arg_check.is_str(spin_id, 'spin identification string', can_be_none=True) 188 189 # Execute the functional code. 190 model_free_obj._remove_tm(spin_id=spin_id)
191 192
193 - def select_model(self, model=None, spin_id=None):
194 """Function for the selection of a preset model-free model. 195 196 Keyword Arguments 197 ~~~~~~~~~~~~~~~~~ 198 199 model: The name of the preset model. 200 201 202 The preset models 203 ~~~~~~~~~~~~~~~~~ 204 205 The standard preset model-free models are 206 'm0' = {}, 207 'm1' = {S2}, 208 'm2' = {S2, te}, 209 'm3' = {S2, Rex}, 210 'm4' = {S2, te, Rex}, 211 'm5' = {S2f, S2, ts}, 212 'm6' = {S2f, tf, S2, ts}, 213 'm7' = {S2f, S2, ts, Rex}, 214 'm8' = {S2f, tf, S2, ts, Rex}, 215 'm9' = {Rex}. 216 217 The preset model-free models with optimisation of the CSA value are 218 'm10' = {CSA}, 219 'm11' = {CSA, S2}, 220 'm12' = {CSA, S2, te}, 221 'm13' = {CSA, S2, Rex}, 222 'm14' = {CSA, S2, te, Rex}, 223 'm15' = {CSA, S2f, S2, ts}, 224 'm16' = {CSA, S2f, tf, S2, ts}, 225 'm17' = {CSA, S2f, S2, ts, Rex}, 226 'm18' = {CSA, S2f, tf, S2, ts, Rex}, 227 'm19' = {CSA, Rex}. 228 229 The preset model-free models with optimisation of the bond length are 230 'm20' = {r}, 231 'm21' = {r, S2}, 232 'm22' = {r, S2, te}, 233 'm23' = {r, S2, Rex}, 234 'm24' = {r, S2, te, Rex}, 235 'm25' = {r, S2f, S2, ts}, 236 'm26' = {r, S2f, tf, S2, ts}, 237 'm27' = {r, S2f, S2, ts, Rex}, 238 'm28' = {r, S2f, tf, S2, ts, Rex}, 239 'm29' = {r, CSA, Rex}. 240 241 The preset model-free models with both optimisation of the bond length and CSA are 242 'm30' = {r, CSA}, 243 'm31' = {r, CSA, S2}, 244 'm32' = {r, CSA, S2, te}, 245 'm33' = {r, CSA, S2, Rex}, 246 'm34' = {r, CSA, S2, te, Rex}, 247 'm35' = {r, CSA, S2f, S2, ts}, 248 'm36' = {r, CSA, S2f, tf, S2, ts}, 249 'm37' = {r, CSA, S2f, S2, ts, Rex}, 250 'm38' = {r, CSA, S2f, tf, S2, ts, Rex}, 251 'm39' = {r, CSA, Rex}. 252 253 Warning: The models in the thirties range fail when using standard R1, R2, and NOE 254 relaxation data. This is due to the extreme flexibly of these models where a change in the 255 parameter 'r' is compensated by a corresponding change in the parameter 'csa' and 256 vice versa. 257 258 259 Additional preset model-free models, which are simply extensions of the above models with 260 the addition of a local tm parameter are: 261 'tm0' = {tm}, 262 'tm1' = {tm, S2}, 263 'tm2' = {tm, S2, te}, 264 'tm3' = {tm, S2, Rex}, 265 'tm4' = {tm, S2, te, Rex}, 266 'tm5' = {tm, S2f, S2, ts}, 267 'tm6' = {tm, S2f, tf, S2, ts}, 268 'tm7' = {tm, S2f, S2, ts, Rex}, 269 'tm8' = {tm, S2f, tf, S2, ts, Rex}, 270 'tm9' = {tm, Rex}. 271 272 The preset model-free models with optimisation of the CSA value are 273 'tm10' = {tm, CSA}, 274 'tm11' = {tm, CSA, S2}, 275 'tm12' = {tm, CSA, S2, te}, 276 'tm13' = {tm, CSA, S2, Rex}, 277 'tm14' = {tm, CSA, S2, te, Rex}, 278 'tm15' = {tm, CSA, S2f, S2, ts}, 279 'tm16' = {tm, CSA, S2f, tf, S2, ts}, 280 'tm17' = {tm, CSA, S2f, S2, ts, Rex}, 281 'tm18' = {tm, CSA, S2f, tf, S2, ts, Rex}, 282 'tm19' = {tm, CSA, Rex}. 283 284 The preset model-free models with optimisation of the bond length are 285 'tm20' = {tm, r}, 286 'tm21' = {tm, r, S2}, 287 'tm22' = {tm, r, S2, te}, 288 'tm23' = {tm, r, S2, Rex}, 289 'tm24' = {tm, r, S2, te, Rex}, 290 'tm25' = {tm, r, S2f, S2, ts}, 291 'tm26' = {tm, r, S2f, tf, S2, ts}, 292 'tm27' = {tm, r, S2f, S2, ts, Rex}, 293 'tm28' = {tm, r, S2f, tf, S2, ts, Rex}, 294 'tm29' = {tm, r, CSA, Rex}. 295 296 The preset model-free models with both optimisation of the bond length and CSA are 297 'tm30' = {tm, r, CSA}, 298 'tm31' = {tm, r, CSA, S2}, 299 'tm32' = {tm, r, CSA, S2, te}, 300 'tm33' = {tm, r, CSA, S2, Rex}, 301 'tm34' = {tm, r, CSA, S2, te, Rex}, 302 'tm35' = {tm, r, CSA, S2f, S2, ts}, 303 'tm36' = {tm, r, CSA, S2f, tf, S2, ts}, 304 'tm37' = {tm, r, CSA, S2f, S2, ts, Rex}, 305 'tm38' = {tm, r, CSA, S2f, tf, S2, ts, Rex}, 306 'tm39' = {tm, r, CSA, Rex}. 307 308 309 310 Spin identification string 311 ~~~~~~~~~~~~~~~~~~~~~~~~~~ 312 313 If 'spin_id' is supplied then the model will only be selected for the corresponding spins. 314 Otherwise the model will be selected for all spins. 315 316 317 318 Examples 319 ~~~~~~~~ 320 321 To pick model 'm1' for all selected spins, type: 322 323 relax> model_free.select_model('m1') 324 relax> model_free.select_model(model='m1') 325 """ 326 327 # Function intro text. 328 if self._exec_info.intro: 329 text = self._exec_info.ps3 + "model_free.select_model(" 330 text = text + "model=" + repr(model) 331 text = text + ", spin_id=" + repr(spin_id) + ")" 332 print(text) 333 334 # The argument checks. 335 arg_check.is_str(model, 'preset model name') 336 arg_check.is_str(spin_id, 'spin identification string', can_be_none=True) 337 338 # Execute the functional code. 339 model_free_obj._select_model(model=model, spin_id=spin_id)
340