Package bmrblib :: Package kinetics :: Module auto_relaxation
[hide private]
[frames] | no frames]

Source Code for Module bmrblib.kinetics.auto_relaxation

  1  ############################################################################# 
  2  #                                                                           # 
  3  # The BMRB library.                                                         # 
  4  #                                                                           # 
  5  # Copyright (C) 2009-2013 Edward d'Auvergne                                 # 
  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 Auto relaxation data saveframe category. 
 24   
 25  This file is part of the U{BMRB library<https://sourceforge.net/projects/bmrblib>}. 
 26   
 27  For example, see http://www.bmrb.wisc.edu/dictionary/3.1html/SaveFramePage.html#auto_relaxation. 
 28  """ 
 29   
 30  # relax module imports. 
 31  from bmrblib.base_classes import BaseSaveframe, TagCategory, TagCategoryFree 
 32   
 33   
34 -class AutoRelaxationSaveframe(BaseSaveframe):
35 """The Auto relaxation data saveframe class.""" 36 37 # Class variables. 38 name = 'auto' 39 sf_label = 'auto_relaxation' 40
41 - def add_tag_categories(self):
42 """Create the tag categories.""" 43 44 # The tag category objects. 45 self.tag_categories.append(AutoRelaxationList(self)) 46 self.tag_categories.append(AutoRelaxationExperiment(self)) 47 self.tag_categories.append(AutoRelaxationSoftware(self)) 48 self.tag_categories.append(AutoRelaxation(self))
49 50
51 - def pre_ops(self):
52 """Perform some saveframe specific operations prior to XML creation.""" 53 54 # The operators of the relaxation superoperator. 55 if self.data_type == 'R1': 56 self.coherence = 'Iz' 57 self.coherence_common_name = 'R1' 58 elif self.data_type == 'R2': 59 self.coherence = 'I+' 60 self.coherence_common_name = 'R2' 61 else: 62 raise NameError("The data type '%s' is not one of ['R1', 'R2']." % data_type) 63 64 # The saveframe description. 65 self.sf_framecode = '%s MHz %s relaxation %s' % (self.frq, self.data_type, self.count)
66 67
68 -class AutoRelaxationList(TagCategoryFree):
69 """Base class for the AutoRelaxationList tag category.""" 70
71 - def __init__(self, sf):
72 """Setup the AutoRelaxationList tag category. 73 74 @param sf: The saveframe object. 75 @type sf: saveframe instance 76 """ 77 78 # Initialise the baseclass. 79 super(AutoRelaxationList, self).__init__(sf) 80 81 # The category name. 82 self.tag_category_label = 'Auto_relaxation_list' 83 84 # Add the tag info. 85 self.add(key='EntryID', var_name='entry_id', format='str') 86 self.add(key='AutoRelaxationListID', var_name='count_str', format='int') 87 self.add(key='DataFileName', var_name='data_file_name', format='str') 88 self.add(key='SampleConditionListID', var_name='sample_cond_list_id', format='int') 89 self.add(key='SampleConditionListLabel', var_name='sample_cond_list_label', format='str', default='$conditions_1') 90 self.add(key='TempCalibrationMethod', var_name='temp_calibration', format='str', missing=False) 91 self.add(key='TempControlMethod', var_name='temp_control', format='str', missing=False) 92 self.add(key='SpectrometerFrequency1H', var_name='frq', format='float') 93 self.add(key='CommonRelaxationTypeName', var_name='coherence_common_name', format='str') 94 self.add(key='RelaxationCoherenceType', var_name='coherence', format='str') 95 self.add(key='RelaxationValUnits', var_name='units', format='str', default='s-1') 96 self.add(key='RelaxationValType', var_name='peak_intensity_type', format='str', missing=False) 97 self.add(key='RexUnits', var_name='rex_units', format='str') 98 self.add(key='Details', var_name='details', format='str') 99 self.add(key='TextDataFormat', var_name='text_data_format', format='str') 100 self.add(key='TextData', var_name='text_data', format='str')
101 102 103
104 -class AutoRelaxationExperiment(TagCategory):
105 """Base class for the AutoRelaxationExperiment tag category.""" 106
107 - def __init__(self, sf):
108 """Setup the AutoRelaxationExperiment tag category. 109 110 @param sf: The saveframe object. 111 @type sf: saveframe instance 112 """ 113 114 # Initialise the baseclass. 115 super(AutoRelaxationExperiment, self).__init__(sf) 116 117 # The category name. 118 self.tag_category_label = 'Auto_relaxation_experiment' 119 120 # Add the tag info. 121 self.add(key='ExperimentID', var_name='experiment_id', format='int') 122 self.add(key='ExperimentName', var_name='experiment_name', format='str') 123 self.add(key='SampleID', var_name='sample_id', format='int') 124 self.add(key='SampleLabel', var_name='sample_label', format='str', default='$sample_1') 125 self.add(key='SampleState', var_name='sample_state', format='str') 126 self.add(key='EntryID', var_name='entry_id', format='str') 127 self.add(key='AutoRelaxationListID', var_name='heteronucl_t1_list_id', format='int')
128 129 130
131 -class AutoRelaxationSoftware(TagCategory):
132 """Base class for the AutoRelaxationSoftware tag category.""" 133
134 - def __init__(self, sf):
135 """Setup the AutoRelaxationSoftware tag category. 136 137 @param sf: The saveframe object. 138 @type sf: saveframe instance 139 """ 140 141 # Initialise the baseclass. 142 super(AutoRelaxationSoftware, self).__init__(sf) 143 144 # The category name. 145 self.tag_category_label = 'Auto_relaxation_software' 146 147 # Add the tag info. 148 self.add(key='SoftwareID', var_name='software_id', format='int') 149 self.add(key='SoftwareLabel', var_name='software_label', format='str') 150 self.add(key='MethodID', var_name='method_id', format='int') 151 self.add(key='MethodLabel', var_name='method_label', format='str') 152 self.add(key='EntryID', var_name='entry_id', format='str') 153 self.add(key='AutoRelaxationListID', var_name='heteronucl_t1_list_id', format='int')
154 155 156
157 -class AutoRelaxation(TagCategory):
158 """Base class for the AutoRelaxation tag category.""" 159
160 - def __init__(self, sf):
161 """Setup the AutoRelaxation tag category. 162 163 @param sf: The saveframe object. 164 @type sf: saveframe instance 165 """ 166 167 # Initialise the baseclass. 168 super(AutoRelaxation, self).__init__(sf) 169 170 # The category name. 171 self.tag_category_label = 'Auto_relaxation' 172 173 # Add the tag info. 174 self.add(key='AutoRelaxationID', var_name='data_ids', format='int') 175 self.add(key='AssemblyID', var_name='assembly_ids', format='int') 176 self.add(key='AssemblyAtomID', var_name='assembly_atom_ids', format='int') 177 self.add(key='EntityAssemblyID', var_name='entity_assembly_ids', format='int') 178 self.add(key='EntityID', var_name='entity_ids', format='int', missing=False) 179 self.add(key='CompIndexID', var_name='res_nums', format='int', missing=False) 180 self.add(key='SeqID', var_name='seq_id', format='int') 181 self.add(key='CompID', var_name='res_names', format='str', missing=False) 182 self.add(key='AtomID', var_name='atom_names', format='str', missing=False) 183 self.add(key='AtomType', var_name='atom_types', format='str') 184 self.add(key='AtomIsotopeNumber', var_name='isotope', format='int') 185 self.add(key='Val', var_name='data', format='float') 186 self.add(key='ValErr', var_name='errors', format='float') 187 self.add(key='RexVal', var_name='rex_val', format='float') 188 self.add(key='RexErr', var_name='rex_err', format='float') 189 self.add(key='ResonanceID', var_name='resonance_id', format='int') 190 self.add(key='AuthEntityAssemblyID', var_name='auth_entity_assembly_id', format='str') 191 self.add(key='AuthSeqID', var_name='auth_seq_id', format='str') 192 self.add(key='AuthCompID', var_name='auth_atom_id', format='str') 193 self.add(key='AuthAtomID', var_name='auth_atom_id', format='str') 194 self.add(key='EntryID', var_name='entry_id', format='str') 195 self.add(key='AutoRelaxationListID', var_name='count_str', format='int')
196