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

Source Code for Module pipe_control.bruker

 1  ############################################################################### 
 2  #                                                                             # 
 3  # Copyright (C) 2011-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  """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 create_object 
29  from pipe_control.exp_info import software_select 
30  from pipe_control.mol_res_spin import exists_mol_res_spin_data, name_spin 
31  from pipe_control.pipes import check_pipe 
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 check_pipe() 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 dc_object = create_object(file=file, dir=dir) 55 56 # Name the spins if needed. 57 name_spin(name=dc_object.sample_information.spin_name, force=False, warn_flag=False) 58 59 # Pack the data. 60 values = [] 61 errors = [] 62 spin_ids = [] 63 for res_id in dc_object.results.sequence: 64 spin_ids.append('%s@%s' % (res_id, dc_object.sample_information.atom_name)) 65 values.append(dc_object.results.Rx[res_id]) 66 errors.append(dc_object.results.Rx_err[res_id]) 67 pack_data(ri_id, dc_object.ri_type, dc_object.parameters.frq, values, errors, spin_ids=spin_ids) 68 69 # Set the integration method. 70 peak_intensity_type(ri_id=ri_id, type=dc_object.details.int_type) 71 72 # Set the DC as used software. 73 software_select('Bruker DC', version=dc_object.version)
74