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 results user function definitions."""
25
26
27 from pipe_control import results
28 from user_functions.data import Uf_info; uf_info = Uf_info()
29 from user_functions.objects import Desc_container
30 from user_functions.wildcards import WILDCARD_RELAX_RESULT
31
32
33
34 uf_class = uf_info.add_class('results')
35 uf_class.title = "Class for manipulating results."
36 uf_class.menu_text = "&results"
37 uf_class.gui_icon = "relax.relax"
38
39
40
41 uf = uf_info.add_uf('results.display')
42 uf.title = "Display the results."
43 uf.title_short = "Results display."
44 uf.display = True
45
46 uf.desc.append(Desc_container())
47 uf.desc[-1].add_paragraph("This will print to screen (STDOUT) the results contained within the current data pipe.")
48 uf.backend = results.display
49 uf.menu_text = "&display"
50 uf.gui_icon = "oxygen.actions.document-preview"
51 uf.wizard_size = (600, 300)
52 uf.wizard_apply_button = False
53
54
55
56 uf = uf_info.add_uf('results.read')
57 uf.title = "Read the contents of a relax results file into the relax data store."
58 uf.title_short = "Results reading."
59 uf.add_keyarg(
60 name = "file",
61 default = "results",
62 arg_type = "file sel read",
63 desc_short = "file name",
64 desc = "The name of the file to read results from.",
65 wiz_filesel_wildcard = WILDCARD_RELAX_RESULT,
66 wiz_filesel_preview = False
67 )
68 uf.add_keyarg(
69 name = "dir",
70 arg_type = "dir",
71 desc_short = "directory name",
72 desc = "The directory where the file is located.",
73 can_be_none = True
74 )
75
76 uf.desc.append(Desc_container())
77 uf.desc[-1].add_paragraph("This is able to handle uncompressed, bzip2 compressed files, or gzip compressed files automatically. The full file name including extension can be supplied, however, if the file cannot be found the file with '.bz2' appended followed by the file name with '.gz' appended will be searched for.")
78 uf.backend = results.read
79 uf.menu_text = "&read"
80 uf.gui_icon = "oxygen.actions.document-open"
81 uf.wizard_size = (700, 500)
82 uf.wizard_apply_button = False
83
84
85
86 uf = uf_info.add_uf('results.write')
87 uf.title = "Write the results to a file."
88 uf.title_short = "Results writing."
89 uf.add_keyarg(
90 name = "file",
91 default = "results",
92 arg_type = "file sel write",
93 desc_short = "file name",
94 desc = "The name of the file to output results to. The default is 'results'. Optionally this can be a file object, or any object with a write() method.",
95 wiz_filesel_wildcard = WILDCARD_RELAX_RESULT,
96 )
97 uf.add_keyarg(
98 name = "dir",
99 default = "pipe_name",
100 arg_type = "dir",
101 desc_short = "directory name",
102 desc = "The directory name.",
103 can_be_none = True
104 )
105 uf.add_keyarg(
106 name = "compress_type",
107 default = 1,
108 basic_types = ["int"],
109 desc_short = "compression type",
110 desc = "The type of compression to use when creating the file.",
111 wiz_element_type = "combo",
112 wiz_combo_choices = [
113 "No compression",
114 "bzip2 compression",
115 "gzip compression"
116 ],
117 wiz_combo_data = [
118 0,
119 1,
120 2
121 ],
122 wiz_read_only = True,
123 )
124 uf.add_keyarg(
125 name = "force",
126 default = False,
127 basic_types = ["bool"],
128 desc_short = "force flag",
129 desc = "A flag which if True will cause the results file to be overwritten."
130 )
131
132 uf.desc.append(Desc_container())
133 uf.desc[-1].add_paragraph("This will write the entire contents of the current data pipe into an XML formatted file. This results file can then be read back into relax at a later point in time, or transfered to another machine. This is in contrast to the state.save user function whereby the entire data store, including all data pipes, are saved into a similarly XML formatted file.")
134 uf.desc[-1].add_paragraph("To place the results file in the current working directory in the prompt and scripting modes, leave the directory unset. If the directory is set to the special name 'pipe_name', then the results file will be placed into a directory with the same name as the current data pipe.")
135 uf.desc[-1].add_paragraph("The default behaviour of this function is to compress the file using bzip2 compression. If the extension '.bz2' is not included in the file name, it will be added. The compression can, however, be changed to either no compression or gzip compression. This is controlled by the compression type which can be set to")
136 uf.desc[-1].add_item_list_element("0", "No compression (no file extension),")
137 uf.desc[-1].add_item_list_element("1", "bzip2 compression ('.bz2' file extension),")
138 uf.desc[-1].add_item_list_element("2", "gzip compression ('.gz' file extension).")
139 uf.desc[-1].add_paragraph("The complementary read function will automatically handle the compressed files.")
140 uf.backend = results.write
141 uf.menu_text = "&write"
142 uf.gui_icon = "oxygen.actions.document-save"
143 uf.wizard_height_desc = 450
144 uf.wizard_size = (1000, 750)
145 uf.wizard_apply_button = False
146