Package specific_analyses :: Package frame_order :: Module parameter_object
[hide private]
[frames] | no frames]

Source Code for Module specific_analyses.frame_order.parameter_object

  1  ############################################################################### 
  2  #                                                                             # 
  3  # Copyright (C) 2009-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 module for the frame order parameter list object.""" 
 24   
 25  # Python module imports. 
 26  from math import pi 
 27   
 28  # relax module imports. 
 29  from lib.errors import RelaxError 
 30  from specific_analyses.parameter_object import Param_list 
 31   
 32   
33 -def angle_upper_excluding_bound(incs=None, model_info=None):
34 """Determine the upper grid bound for the angular parameters, excluding the bound value. 35 36 @keyword incs: The number of grid search increments. 37 @type incs: int 38 @keyword model_info: The model information from model_loop(). This is unused. 39 @type model_info: None 40 @return: The upper grid search bound for the angular parameters, excluding the bound value. 41 @rtype: float 42 """ 43 44 # Handle inc values of None or 1. 45 if incs in [None, 1]: 46 return 2.0 * pi 47 48 # Return the upper limit which is one inc before 2pi. 49 return 2.0*pi * (1.0 - 1.0/incs)
50 51
52 -def axis_alpha_upper(incs=None, model_info=None):
53 """Determine the upper grid bound for the axis alpha angle. 54 55 @keyword incs: The number of grid search increments. 56 @type incs: int 57 @keyword model_info: The model information from model_loop(). This is unused. 58 @type model_info: None 59 @return: The upper grid search bound for the axis alpha angle. 60 @rtype: float 61 """ 62 63 # Handle inc values of None or 1. 64 if incs in [None, 1]: 65 return pi 66 67 # Return the upper limit which is one inc before pi. 68 return pi * (1.0 - 2.0/incs)
69 70
71 -def cone_angle_lower(incs=None, model_info=None):
72 """Determine the lower grid bound for the cone and torsion angles. 73 74 @keyword incs: The number of grid search increments. 75 @type incs: int 76 @keyword model_info: The model information from model_loop(). This is unused. 77 @type model_info: None 78 @return: The lower grid search bound for the cone and torsion angles. 79 @rtype: float 80 """ 81 82 # Handle inc values of None or 1. 83 if incs in [None, 1]: 84 return 0.0 85 86 # Return the lower limit, excluding the first point. 87 return pi * (1.0/(incs+1))
88 89
90 -def cone_angle_upper(incs=None, model_info=None):
91 """Determine the upper grid bound for the cone and torsion angles. 92 93 @keyword incs: The number of grid search increments. 94 @type incs: int 95 @keyword model_info: The model information from model_loop(). This is unused. 96 @type model_info: None 97 @return: The upper grid search bound for the cone and torsion angles. 98 @rtype: float 99 """ 100 101 # Handle inc values of None or 1. 102 if incs in [None, 1]: 103 return pi 104 105 # Return the upper limit, excluding the last point. 106 return pi * (1.0 - 1.0/(incs+1))
107 108
109 -def pivot_grid_bound(param=None, extent=10.0):
110 """Determine the grid bounds for the pivot coordinates. 111 112 @keyword param: The parameter to find the bound for. This should be one of 'pivot_x', 'pivot_y', or 'pivot_z'. 113 @type param: str 114 @keyword extent: The length in Angstrom to extend out from the current coordinate to reach the grid bound. 115 @type extent: float 116 @return: The grid search bound for the given coordinate. 117 @rtype: float 118 """ 119 120 # No pivot set. 121 if not hasattr(cdp, param): 122 raise RelaxError("The pivot point has not been set, cannot determine the grid search bounds.") 123 124 # The value. 125 val = getattr(cdp, param) 126 127 # Return the bound. 128 return val + extent
129 130
131 -def pivot_x_lower(incs=None, model_info=None, size=10.0):
132 """Determine the lower grid bound for the pivot X coordinate. 133 134 @keyword incs: The number of grid search increments. 135 @type incs: int 136 @keyword model_info: The model information from model_loop(). This is unused. 137 @type model_info: None 138 @keyword size: The half grid size in Angstrom. 139 @type size: float 140 @return: The lower grid search bound for the coordinate. 141 @rtype: float 142 """ 143 144 # Return the value. 145 return pivot_grid_bound(param='pivot_x', extent=-size)
146 147
148 -def pivot_x_upper(incs=None, model_info=None, size=10.0):
149 """Determine the upper grid bound for the pivot X coordinate. 150 151 @keyword incs: The number of grid search increments. 152 @type incs: int 153 @keyword model_info: The model information from model_loop(). This is unused. 154 @type model_info: None 155 @keyword size: The half grid size in Angstrom. 156 @type size: float 157 @return: The upper grid search bound for the coordinate. 158 @rtype: float 159 """ 160 161 # Return the value. 162 return pivot_grid_bound(param='pivot_x', extent=size)
163 164
165 -def pivot_y_lower(incs=None, model_info=None, size=10.0):
166 """Determine the lower grid bound for the pivot Y coordinate. 167 168 @keyword incs: The number of grid search increments. 169 @type incs: int 170 @keyword model_info: The model information from model_loop(). This is unused. 171 @type model_info: None 172 @keyword size: The half grid size in Angstrom. 173 @type size: float 174 @return: The lower grid search bound for the coordinate. 175 @rtype: float 176 """ 177 178 # Return the value. 179 return pivot_grid_bound(param='pivot_y', extent=-size)
180 181
182 -def pivot_y_upper(incs=None, model_info=None, size=10.0):
183 """Determine the upper grid bound for the pivot Y coordinate. 184 185 @keyword incs: The number of grid search increments. 186 @type incs: int 187 @keyword model_info: The model information from model_loop(). This is unused. 188 @type model_info: None 189 @keyword size: The half grid size in Angstrom. 190 @type size: float 191 @return: The upper grid search bound for the coordinate. 192 @rtype: float 193 """ 194 195 # Return the value. 196 return pivot_grid_bound(param='pivot_y', extent=size)
197 198
199 -def pivot_z_lower(incs=None, model_info=None, size=10.0):
200 """Determine the lower grid bound for the pivot Z coordinate. 201 202 @keyword incs: The number of grid search increments. 203 @type incs: int 204 @keyword model_info: The model information from model_loop(). This is unused. 205 @type model_info: None 206 @keyword size: The half grid size in Angstrom. 207 @type size: float 208 @return: The lower grid search bound for the coordinate. 209 @rtype: float 210 """ 211 212 # Return the value. 213 return pivot_grid_bound(param='pivot_z', extent=-size)
214 215
216 -def pivot_z_upper(incs=None, model_info=None, size=10.0):
217 """Determine the upper grid bound for the pivot Z coordinate. 218 219 @keyword incs: The number of grid search increments. 220 @type incs: int 221 @keyword model_info: The model information from model_loop(). This is unused. 222 @type model_info: None 223 @keyword size: The half grid size in Angstrom. 224 @type size: float 225 @return: The upper grid search bound for the coordinate. 226 @rtype: float 227 """ 228 229 # Return the value. 230 return pivot_grid_bound(param='pivot_z', extent=size)
231 232 233
234 -class Frame_order_params(Param_list):
235 """The frame order parameter list singleton.""" 236 237 # Class variable for storing the class instance (for the singleton design pattern). 238 _instance = None 239
240 - def __init__(self):
241 """Define all the parameters of the analysis.""" 242 243 # The object is already initialised. 244 if self._initialised: return 245 246 # Execute the base class __init__ method. 247 Param_list.__init__(self) 248 249 # Add the model variables. 250 self._add_model_info() 251 252 # Add the base data. 253 self._add_align_data() 254 255 # Add the parameters of all models. 256 self._add( 257 'pivot_x', 258 scope = 'global', 259 units = 'Angstrom', 260 desc = 'The pivot point position x coordinate', 261 py_type = float, 262 set = 'params', 263 scaling = 1e2, 264 grid_lower = pivot_x_lower, 265 grid_upper = pivot_x_upper, 266 err = True, 267 sim = True 268 ) 269 self._add( 270 'pivot_y', 271 scope = 'global', 272 units = 'Angstrom', 273 desc = 'The pivot point position y coordinate', 274 py_type = float, 275 set = 'params', 276 scaling = 1e2, 277 grid_lower = pivot_y_lower, 278 grid_upper = pivot_y_upper, 279 err = True, 280 sim = True 281 ) 282 self._add( 283 'pivot_z', 284 scope = 'global', 285 units = 'Angstrom', 286 desc = 'The pivot point position z coordinate', 287 py_type = float, 288 set = 'params', 289 scaling = 1e2, 290 grid_lower = pivot_z_lower, 291 grid_upper = pivot_z_upper, 292 err = True, 293 sim = True 294 ) 295 self._add( 296 'ave_pos_x', 297 scope = 'global', 298 units = 'Angstrom', 299 desc = 'The average position x translation', 300 py_type = float, 301 set = 'params', 302 grid_lower = -5, 303 grid_upper = 5, 304 err = True, 305 sim = True 306 ) 307 self._add( 308 'ave_pos_y', 309 scope = 'global', 310 units = 'Angstrom', 311 desc = 'The average position y translation', 312 py_type = float, 313 set = 'params', 314 grid_lower = -5, 315 grid_upper = 5, 316 err = True, 317 sim = True 318 ) 319 self._add( 320 'ave_pos_z', 321 scope = 'global', 322 units = 'Angstrom', 323 desc = 'The average position z translation', 324 py_type = float, 325 set = 'params', 326 grid_lower = -5, 327 grid_upper = 5, 328 err = True, 329 sim = True 330 ) 331 self._add( 332 'ave_pos_alpha', 333 scope = 'global', 334 units = 'rad', 335 desc = 'The average position alpha Euler angle', 336 py_type = float, 337 set = 'params', 338 grid_lower = 0.0, 339 grid_upper = angle_upper_excluding_bound, 340 err = True, 341 sim = True 342 ) 343 self._add( 344 'ave_pos_beta', 345 scope = 'global', 346 units = 'rad', 347 desc = 'The average position beta Euler angle', 348 py_type = float, 349 set = 'params', 350 grid_lower = 0.0, 351 grid_upper = pi, 352 err = True, 353 sim = True 354 ) 355 self._add( 356 'ave_pos_gamma', 357 scope = 'global', 358 units = 'rad', 359 desc = 'The average position gamma Euler angle', 360 py_type = float, 361 set = 'params', 362 grid_lower = 0.0, 363 grid_upper = angle_upper_excluding_bound, 364 err = True, 365 sim = True 366 ) 367 self._add( 368 'eigen_alpha', 369 scope = 'global', 370 units = 'rad', 371 desc = 'The Eigenframe alpha Euler angle', 372 py_type = float, 373 set = 'params', 374 grid_lower = 0.0, 375 grid_upper = angle_upper_excluding_bound, 376 err = True, 377 sim = True 378 ) 379 self._add( 380 'eigen_beta', 381 scope = 'global', 382 units = 'rad', 383 desc = 'The Eigenframe beta Euler angle', 384 py_type = float, 385 set = 'params', 386 grid_lower = 0.0, 387 grid_upper = pi, 388 err = True, 389 sim = True 390 ) 391 self._add( 392 'eigen_gamma', 393 scope = 'global', 394 units = 'rad', 395 desc = 'The Eigenframe gamma Euler angle', 396 py_type = float, 397 set = 'params', 398 grid_lower = 0.0, 399 grid_upper = angle_upper_excluding_bound, 400 err = True, 401 sim = True 402 ) 403 self._add( 404 'axis_theta', 405 scope = 'global', 406 units = 'rad', 407 desc = 'The cone axis polar angle (for the isotropic cone model)', 408 py_type = float, 409 set = 'params', 410 grid_lower = 0.0, 411 grid_upper = pi, 412 err = True, 413 sim = True 414 ) 415 self._add( 416 'axis_phi', 417 scope = 'global', 418 units = 'rad', 419 desc = 'The cone axis azimuthal angle (for the isotropic cone model)', 420 py_type = float, 421 set = 'params', 422 grid_lower = 0.0, 423 grid_upper = angle_upper_excluding_bound, 424 err = True, 425 sim = True 426 ) 427 self._add( 428 'axis_alpha', 429 scope = 'global', 430 units = 'rad', 431 desc = 'The rotor axis alpha angle (the rotation angle out of the xy plane)', 432 py_type = float, 433 set = 'params', 434 grid_lower = -pi, 435 grid_upper = axis_alpha_upper, 436 err = True, 437 sim = True 438 ) 439 self._add( 440 'cone_theta_x', 441 scope = 'global', 442 units = 'rad', 443 desc = 'The pseudo-ellipse cone opening half-angle for the x-axis', 444 py_type = float, 445 set = 'params', 446 grid_lower = cone_angle_lower, 447 grid_upper = cone_angle_upper, 448 err = True, 449 sim = True 450 ) 451 self._add( 452 'cone_theta_y', 453 scope = 'global', 454 units = 'rad', 455 desc = 'The pseudo-ellipse cone opening half-angle for the y-axis', 456 py_type = float, 457 set = 'params', 458 grid_lower = cone_angle_lower, 459 grid_upper = cone_angle_upper, 460 err = True, 461 sim = True 462 ) 463 self._add( 464 'cone_theta', 465 scope = 'global', 466 units = 'rad', 467 desc = 'The isotropic cone opening half-angle', 468 py_type = float, 469 set = 'params', 470 grid_lower = cone_angle_lower, 471 grid_upper = cone_angle_upper, 472 err = True, 473 sim = True 474 ) 475 self._add( 476 'cone_s1', 477 scope = 'global', 478 units = '', 479 desc = 'The isotropic cone order parameter', 480 py_type = float, 481 set = 'params', 482 grid_lower = -0.125, 483 grid_upper = 1.0, 484 err = True, 485 sim = True 486 ) 487 self._add( 488 'cone_sigma_max', 489 scope = 'global', 490 units = 'rad', 491 desc = 'The torsion angle', 492 py_type = float, 493 set = 'params', 494 grid_lower = cone_angle_lower, 495 grid_upper = cone_angle_upper, 496 err = True, 497 sim = True 498 ) 499 500 # Add minimisation structures. 501 self._add_min_data(min_stats_global=True) 502 503 # Set up the user function documentation. 504 self._set_uf_title("Frame order parameters") 505 self._uf_param_table(label="table: frame order parameters", caption="Frame order parameters.", scope='global') 506 self._uf_param_table(label="table: frame order parameter value setting with defaults", caption="Frame order parameter value setting.", scope='global', default=True)
507