1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24 """The relax_fit user function definitions."""
25
26
27 from graphics import ANALYSIS_IMAGE_PATH
28 from lib.text.gui import i0, iinf, rx
29 from pipe_control import spectrum
30 from specific_analyses.relax_fit.uf import relax_time, select_model
31 from user_functions.data import Uf_info; uf_info = Uf_info()
32 from user_functions.objects import Desc_container
33
34
35
36 uf_class = uf_info.add_class('relax_fit')
37 uf_class.title = "Class for relaxation curve fitting."
38 uf_class.menu_text = "&relax_fit"
39 uf_class.gui_icon = "relax.relax_fit"
40
41
42
43 uf = uf_info.add_uf('relax_fit.relax_time')
44 uf.title = "Set the relaxation delay time associated with each spectrum."
45 uf.title_short = "Relaxation delay time setting."
46 uf.add_keyarg(
47 name = "time",
48 default = 0.0,
49 py_type = "num",
50 desc_short = "relaxation time",
51 desc = "The time, in seconds, of the relaxation period."
52 )
53 uf.add_keyarg(
54 name = "spectrum_id",
55 py_type = "str",
56 desc_short = "spectrum identification string",
57 desc = "The spectrum identification string.",
58 wiz_element_type = 'combo',
59 wiz_combo_iter = spectrum.get_ids,
60 wiz_read_only = True
61 )
62
63 uf.desc.append(Desc_container())
64 uf.desc[-1].add_paragraph("Peak intensities should be loaded before calling this user function via the spectrum.read_intensities user function. The intensity values will then be associated with a spectrum identifier. To associate each spectrum identifier with a time point in the relaxation curve prior to optimisation, this user function should be called.")
65 uf.backend = relax_time
66 uf.menu_text = "&relax_time"
67 uf.gui_icon = "oxygen.actions.chronometer"
68 uf.wizard_size = (700, 500)
69 uf.wizard_image = ANALYSIS_IMAGE_PATH + 'r1_200x200.png'
70
71
72
73 uf = uf_info.add_uf('relax_fit.select_model')
74 uf.title = "Select the relaxation curve type."
75 uf.title_short = "Relaxation curve type selection."
76 uf.display = True
77 uf.add_keyarg(
78 name = "model",
79 default = "exp",
80 py_type = "str",
81 desc_short = "model",
82 desc = "The type of relaxation curve to fit.",
83 wiz_element_type = "combo",
84 wiz_combo_choices = [
85 "Two parameter exponential fit: [%s, %s]" % (rx, i0),
86 "Inversion recovery: [%s, %s, %s]" % (rx, i0, iinf),
87 "Saturation recovery: [%s, %s]" % (rx, iinf)
88 ],
89 wiz_combo_data = [
90 "exp",
91 "inv",
92 "sat"
93 ],
94 wiz_read_only = True
95 )
96
97 uf.desc.append(Desc_container())
98 uf.desc[-1].add_paragraph("A number of relaxation experiments are supported and include:")
99 uf.desc[-1].add_paragraph("The 'exp' model. This is the default two parameter exponential fit. The magnetisation starts at I0 and decays to zero. The parameters are [Rx, I0] and the equation is I(t) = I0*exp(-Rx*t).")
100 uf.desc[-1].add_paragraph("The 'inv' model. This is the inversion recovery experiment (IR). The magnetisation starts at a negative value at -I0 and relaxes to a positive Iinf value. The parameters are [Rx, I0, Iinf] and the equation is I(t) = Iinf - I0*exp(-Rx*t).")
101 uf.desc[-1].add_paragraph("The 'sat' model. This is the saturation recovery experiment (SR). The magnetisation starts at zero and relaxes to a positive Iinf value. The parameters are [Rx, Iinf] and the equation is I(t) = Iinf*(1 - exp(-Rx*t)).")
102 uf.backend = select_model
103 uf.menu_text = "&select_model"
104 uf.gui_icon = "oxygen.actions.list-add"
105 uf.wizard_height_desc = 500
106 uf.wizard_size = (900, 600)
107 uf.wizard_apply_button = False
108 uf.wizard_image = ANALYSIS_IMAGE_PATH + 'r1_200x200.png'
109