1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23 """Module for the reading of Bruker Dynamics Centre (DC) files."""
24
25
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
47 check_pipe()
48
49
50 if not exists_mol_res_spin_data():
51 raise RelaxNoSequenceError
52
53
54 dc_object = create_object(file=file, dir=dir)
55
56
57 name_spin(name=dc_object.sample_information.spin_name, force=False, warn_flag=False)
58
59
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
70 peak_intensity_type(ri_id=ri_id, type=dc_object.details.int_type)
71
72
73 software_select('Bruker DC', version=dc_object.version)
74