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 import wx
28
29
30 from generic_fns import results
31 from graphics import WIZARD_IMAGE_PATH
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('results')
38 uf_class.title = "Class for manipulating results."
39 uf_class.menu_text = "&results"
40 uf_class.gui_icon = "relax.relax"
41
42
43
44 uf = uf_info.add_uf('results.display')
45 uf.title = "Display the results."
46 uf.title_short = "Results display."
47 uf.display = True
48
49 uf.desc.append(Desc_container())
50 uf.desc[-1].add_paragraph("This will print to screen (STDOUT) the results contained within the current data pipe.")
51 uf.backend = results.display
52 uf.menu_text = "&display"
53 uf.gui_icon = "oxygen.actions.document-preview"
54 uf.wizard_size = (600, 300)
55 uf.wizard_apply_button = False
56
57
58
59 uf = uf_info.add_uf('results.read')
60 uf.title = "Read the contents of a relax results file into the relax data store."
61 uf.title_short = "Results reading."
62 uf.add_keyarg(
63 name = "file",
64 default = "results",
65 py_type = "str",
66 arg_type = "file sel",
67 desc_short = "file name",
68 desc = "The name of the file to read results from.",
69 wiz_filesel_wildcard = "relax results files (*.bz2)|*.bz2|relax results files (*.gz)|*.gz|relax results files (*.*)|*.*",
70 wiz_filesel_style = wx.FD_OPEN
71 )
72 uf.add_keyarg(
73 name = "dir",
74 py_type = "str",
75 arg_type = "dir",
76 desc_short = "directory name",
77 desc = "The directory where the file is located.",
78 can_be_none = True
79 )
80
81 uf.desc.append(Desc_container())
82 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.")
83 uf.backend = results.read
84 uf.menu_text = "&read"
85 uf.gui_icon = "oxygen.actions.document-open"
86 uf.wizard_size = (700, 500)
87 uf.wizard_apply_button = False
88
89
90
91 uf = uf_info.add_uf('results.write')
92 uf.title = "Write the results to a file."
93 uf.title_short = "Results writing."
94 uf.add_keyarg(
95 name = "file",
96 default = "results",
97 py_type = "str_or_inst",
98 arg_type = "file sel",
99 desc_short = "file name",
100 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.",
101 wiz_filesel_wildcard = "relax results files (*.bz2)|*.bz2|relax results files (*.gz)|*.gz|relax results files (*.*)|*.*",
102 wiz_filesel_style = wx.FD_SAVE
103 )
104 uf.add_keyarg(
105 name = "dir",
106 default = "pipe_name",
107 py_type = "str",
108 arg_type = "dir",
109 desc_short = "directory name",
110 desc = "The directory name.",
111 can_be_none = True
112 )
113 uf.add_keyarg(
114 name = "compress_type",
115 default = 1,
116 py_type = "int",
117 desc_short = "compression type",
118 desc = "The type of compression to use when creating the file.",
119 wiz_element_type = "combo",
120 wiz_combo_choices = [
121 "No compression",
122 "bzip2 compression",
123 "gzip compression"
124 ],
125 wiz_combo_data = [
126 0,
127 1,
128 2
129 ],
130 wiz_read_only = True,
131 )
132 uf.add_keyarg(
133 name = "force",
134 default = False,
135 py_type = "bool",
136 desc_short = "force flag",
137 desc = "A flag which if True will cause the results file to be overwritten."
138 )
139
140 uf.desc.append(Desc_container())
141 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.")
142 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.")
143 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")
144 uf.desc[-1].add_item_list_element("0", "No compression (no file extension),")
145 uf.desc[-1].add_item_list_element("1", "bzip2 compression ('.bz2' file extension),")
146 uf.desc[-1].add_item_list_element("2", "gzip compression ('.gz' file extension).")
147 uf.desc[-1].add_paragraph("The complementary read function will automatically handle the compressed files.")
148 uf.backend = results.write
149 uf.menu_text = "&write"
150 uf.gui_icon = "oxygen.actions.document-save"
151 uf.wizard_height_desc = 450
152 uf.wizard_size = (1000, 750)
153 uf.wizard_apply_button = False
154