1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23 """Module containing functions related to basic NMR concepts."""
24
25
26 from math import pi
27
28
29 from lib.physical_constants import g1H, return_gyromagnetic_ratio
30
31
33 """Convert the given frequency from ppm to Hertz units.
34
35 @keyword frq: The frequency in ppm.
36 @type frq: float
37 @keyword B0: The magnetic field strength as the proton frequency in Hertz.
38 @type B0: float
39 @keyword isotope: The isotope type of the nucleus of interest.
40 @type isotope: str
41 @return: The frequency in Hertz.
42 @rtype: float
43 """
44
45
46 return frq * B0 / g1H * return_gyromagnetic_ratio(isotope) * 1e-6
47
48
50 """Convert the given frequency from Hertz to ppm units.
51
52 @keyword frq: The frequency in Hertz.
53 @type frq: float
54 @keyword B0: The magnetic field strength as the proton frequency in Hertz.
55 @type B0: float
56 @keyword isotope: The isotope type of the nucleus of interest.
57 @type isotope: str
58 @return: The frequency in ppm.
59 @rtype: float
60 """
61
62
63 return frq / B0 * g1H / return_gyromagnetic_ratio(isotope) / 1e-6
64
65
67 """Convert the given frequency from ppm to rad/s units.
68
69 @keyword frq: The frequency in ppm.
70 @type frq: float
71 @keyword B0: The magnetic field strength as the proton frequency in Hertz.
72 @type B0: float
73 @keyword isotope: The isotope type of the nucleus of interest.
74 @type isotope: str
75 @return: The frequency in rad/s.
76 @rtype: float
77 """
78
79
80 return frq * 2.0 * pi * B0 / g1H * return_gyromagnetic_ratio(isotope) * 1e-6
81