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