Package pipe_control :: Module bruker
[hide private]
[frames] | no frames]

Source Code for Module pipe_control.bruker

 1  ############################################################################### 
 2  #                                                                             # 
 3  # Copyright (C) 2011-2013 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  """Module for the reading of Bruker Dynamics Centre (DC) files.""" 
24   
25  # relax module imports. 
26  from lib.errors import RelaxNoSequenceError 
27  from lib.physical_constants import element_from_isotope 
28  from lib.software.bruker_dc import parse_file 
29  from pipe_control import pipes 
30  from pipe_control.exp_info import software_select 
31  from pipe_control.mol_res_spin import exists_mol_res_spin_data, name_spin 
32  from pipe_control.relax_data import pack_data, peak_intensity_type 
33   
34   
35 -def read(ri_id=None, file=None, dir=None):
36 """Read the DC data file and place all the data into the relax data store. 37 38 @keyword ri_id: The relaxation data ID string. 39 @type ri_id: str 40 @keyword file: The name of the file to open. 41 @type file: str 42 @keyword dir: The directory containing the file (defaults to the current directory if None). 43 @type dir: str or None 44 """ 45 46 # Test if the current pipe exists. 47 pipes.test() 48 49 # Test if sequence data is loaded. 50 if not exists_mol_res_spin_data(): 51 raise RelaxNoSequenceError 52 53 # Extract the data from the file. 54 values, errors, res_nums, int_type, frq, ri_type, spin_name, isotope, version = parse_file(file=file, dir=dir) 55 56 # Name the spins if needed. 57 name_spin(name=spin_name, force=False) 58 59 # Modify the residue numbers by adding the heteronucleus name. 60 if isotope: 61 atom_name = element_from_isotope(isotope) 62 for i in range(len(res_nums)): 63 res_nums[i] += '@' + atom_name 64 65 # Pack the data. 66 pack_data(ri_id, ri_type, frq, values, errors, spin_ids=res_nums) 67 68 # Set the integration method. 69 peak_intensity_type(ri_id=ri_id, type=int_type) 70 71 # Set the DC as used software. 72 software_select('Bruker DC', version=version)
73