Commit d9f9c3058609e08796aecc3071c9001bb2930e3d
1 parent
9e798781
Exists in
dev
troisieme commit après le rearangement des fichiers de config.
Showing
18 changed files
with
717 additions
and
792 deletions
Show diff stats
... | ... | @@ -0,0 +1,115 @@ |
1 | +- attribute: | |
2 | + key: manufacturer | |
3 | + is_container: False | |
4 | + value: Panasonic | |
5 | + is_editable: True | |
6 | + unit: "" | |
7 | + label: manufacturer | |
8 | + | |
9 | +- attribute: | |
10 | + key: _model | |
11 | + is_container: False | |
12 | + value: MN34230 | |
13 | + unit: "" | |
14 | + is_editable: False | |
15 | + label: "model" | |
16 | + | |
17 | +- attribute: | |
18 | + key: _type | |
19 | + is_enum: True | |
20 | + value: ["CMOS","CCD"] | |
21 | + unit: "" | |
22 | + is_editable: True | |
23 | + label: "type" | |
24 | + | |
25 | +- attribute: | |
26 | + key: _celldimx | |
27 | + is_container: False | |
28 | + value : 3.8e-6 | |
29 | + unit: "m" | |
30 | + is_editable: False | |
31 | + label: "celldimx" | |
32 | + | |
33 | +- attribute: | |
34 | + key: _celldimy | |
35 | + is_container: False | |
36 | + value : 3.8e-6 | |
37 | + unit: "m" | |
38 | + is_editable: False | |
39 | + label: "celldimy" | |
40 | + | |
41 | +- attribute: | |
42 | + key: _cellnbx | |
43 | + is_container: False | |
44 | + value : 4656 | |
45 | + unit: "pix" | |
46 | + is_editable: False | |
47 | + label: "cellnbx" | |
48 | + | |
49 | +- attribute: | |
50 | + key: _cellnby | |
51 | + is_container: False | |
52 | + value : 3520 | |
53 | + unit: "pix" | |
54 | + is_editable: False | |
55 | + label: "celldnby" | |
56 | + | |
57 | +- attribute: | |
58 | + key: _color | |
59 | + is_enum: True | |
60 | + value : [ None, "bayerCFA"] | |
61 | + unit: "" | |
62 | + is_editable: True | |
63 | + label: "color" | |
64 | + | |
65 | +- attribute : | |
66 | + key : _qdes | |
67 | + is_container: True | |
68 | + value: | |
69 | + _wavelengths: [379e-9, 380e-9, 1100e-9, 1101e-9] | |
70 | + _qde: [0.0, 0.9, 0.9, 0.0] | |
71 | + unit: | |
72 | + _wavelengths: "m" | |
73 | + _qde: "electron/photon" | |
74 | + is_editable: False | |
75 | + label: "dqe response" | |
76 | + | |
77 | +- attribute: | |
78 | + key: _exposuretime | |
79 | + is_container: False | |
80 | + value: 1.0 | |
81 | + liminf: 0.001 | |
82 | + limsup: 600 | |
83 | + unit: "s" | |
84 | + is_editable: False | |
85 | + label: "exposure time" | |
86 | + | |
87 | +- attribute: | |
88 | + key: binnings | |
89 | + is_container: True | |
90 | + value: | |
91 | + _binxy: [ [1,1], [2,2], [3,3], [4,4] ] # form | |
92 | + _readouttime: [ 6, 4, 3, 1 ] | |
93 | + unit: | |
94 | + _binxy: "" | |
95 | + _readouttime: "s" | |
96 | + is_editable: False | |
97 | + label: "binning" | |
98 | + | |
99 | +- attribute: | |
100 | + key: electronic | |
101 | + is_container: True | |
102 | + value: | |
103 | + _gain_manufacturer: [0, 1, 20] | |
104 | + _gain_eadu: [1.0, 2.0, 5.0] # form | |
105 | + _readout_noise: [2.0, 2.0, 2.0] | |
106 | + _readout_signal: [250, 250, 250] | |
107 | + _saturation_level: [65535, 65535, 65535] | |
108 | + unit: | |
109 | + _gain_manufacturer: "" | |
110 | + _gain_eadu: "electron/adu" | |
111 | + _readout_noise: "electron/cell" | |
112 | + _readout_signal: "adu" | |
113 | + _saturation_level: "adu" | |
114 | + is_editable: False | |
115 | + label: "electronic" | |
0 | 116 | \ No newline at end of file | ... | ... |
... | ... | @@ -0,0 +1,47 @@ |
1 | +- attribute: | |
2 | + key: manufacturer | |
3 | + is_container: False | |
4 | + value: Panasonic | |
5 | + is_editable: False | |
6 | + unit: "" | |
7 | + label: manufacturer | |
8 | + | |
9 | +- attribute: | |
10 | + key: _model | |
11 | + is_container: False | |
12 | + value: MN34230 | |
13 | + unit: "" | |
14 | + is_editable: False | |
15 | + label: "model" | |
16 | + | |
17 | +- attribute: | |
18 | + key: _type | |
19 | + is_enum: True | |
20 | + value: [None, "iris", "rolling"] | |
21 | + unit: "" | |
22 | + is_editable: False | |
23 | + label: "type" | |
24 | + | |
25 | +- attribute: | |
26 | + key: _modes | |
27 | + is_enum: True | |
28 | + value: ["opened", "closed", "synchro"] | |
29 | + unit: "" | |
30 | + is_editable: True | |
31 | + label: "type" | |
32 | + | |
33 | +- attribute: | |
34 | + key: _delayopening | |
35 | + is_container: False | |
36 | + value : 0 | |
37 | + unit: "s" | |
38 | + is_editable: False | |
39 | + label: "Delay to sweep charges after opening signal" | |
40 | + | |
41 | +- attribute: | |
42 | + key: _delayclosing | |
43 | + is_container: False | |
44 | + value : 0 | |
45 | + unit: "s" | |
46 | + is_editable: False | |
47 | + label: "Delay to read charges after closing signal" | ... | ... |
... | ... | @@ -0,0 +1,48 @@ |
1 | +# Equivalent focal length (m) | |
2 | +- attribute : | |
3 | + key : _foclen | |
4 | + is_editable: False | |
5 | + is_container: False | |
6 | + value : 0.503 | |
7 | + unit: "m" | |
8 | + label: "Equivalent focal length" | |
9 | + | |
10 | +# Total tranmission | |
11 | +- attribute : | |
12 | + key : _transmissions | |
13 | + is_editable: False | |
14 | + is_container: True | |
15 | + value: | |
16 | + _wavelengths: [379e-9, 380e-9, 1100e-9, 1101e-9] | |
17 | + _transmission: [0.0, 0.9, 0.9, 0.0] | |
18 | + unit: | |
19 | + _wavelengths: "m" | |
20 | + _transmission: "" | |
21 | + label: "Equivalent focal length" | |
22 | + | |
23 | +# Equivalent apperture diameter (m) | |
24 | +- attribute: | |
25 | + key: _appdiam | |
26 | + is_editable: False | |
27 | + is_container: False | |
28 | + value: 0.08 | |
29 | + unit: "m" | |
30 | + label: "Equivalent apperture diameter" | |
31 | + | |
32 | +# Mean sigma value of a Gaussian model of the psf (m) | |
33 | +- attribute: | |
34 | + key: _psf_sigma | |
35 | + is_editable: False | |
36 | + is_container: False | |
37 | + value : 10.0e-6 | |
38 | + unit: "m" | |
39 | + label: "Gaussian sigma of the PSF" | |
40 | + | |
41 | +# Focal reducer | |
42 | +- attribute : | |
43 | + key: reducer | |
44 | + is_editable: False | |
45 | + is_enum: True | |
46 | + value: ["x1","x0.7"] | |
47 | + unit: "" | |
48 | + label: "Focal reducer" | ... | ... |
privatedev/config/definitions.txt renamed to config/definitions.txt
privatedev/config/schema_computer-2.0.yml renamed to config/schema_computer-2.0.yml
privatedev/config/schema_device-2.0.yml renamed to config/schema_device-2.0.yml
1 | -schema;schema_component_attributes: | |
2 | - type: map | |
3 | - required: True | |
4 | - mapping: | |
5 | - key: | |
6 | - type: str | |
7 | - required: True | |
8 | - # is_* are False by default | |
9 | - is_editable: | |
10 | - type: bool | |
11 | - is_container: | |
12 | - type: bool | |
13 | - is_enum: | |
14 | - type: bool | |
15 | - value: | |
16 | - type: any | |
17 | - required: True | |
18 | - liminf: | |
19 | - type: number | |
20 | - limsup: | |
21 | - type: number | |
22 | - label: | |
23 | - type: any | |
24 | - unit: | |
25 | - type: any | |
26 | - | |
27 | -schema;schema_capability: | |
28 | - type: map | |
29 | - required: True | |
30 | - mapping: | |
31 | - component: | |
32 | - type: str | |
33 | - required: True | |
34 | - attributes: | |
35 | - type: seq | |
36 | - required: False # True if we're not using default values | |
37 | - seq: | |
38 | - - include : schema_component_attributes | |
39 | - | |
40 | -# old version | |
41 | -# schema;schema_capability: | |
42 | -# type: map | |
43 | -# required: True | |
44 | -# mapping: | |
45 | - | |
46 | -schema;schema_capabilities: | |
47 | - type: seq | |
48 | - sequence: | |
49 | - - type: map | |
50 | - mapping: | |
51 | - CAPABILITY: | |
52 | - include: schema_capability | |
53 | - | |
54 | -schema;schema_device: | |
55 | - type: map | |
56 | - required: True | |
57 | - mapping: | |
58 | - _inventory_label: | |
59 | - type: str | |
60 | - required: True | |
61 | - _manufacturer: | |
62 | - type: str | |
63 | - required: True | |
64 | - _model: | |
65 | - type: str | |
66 | - required: True | |
67 | - _description: | |
68 | - type: str | |
69 | - required: True | |
70 | - _sn: | |
71 | - type: text | |
72 | - required: True | |
73 | - _power: | |
74 | - type: map | |
75 | - required: True | |
76 | - mapping: | |
77 | - _voltage: | |
78 | - type: int | |
79 | - _intensity: | |
80 | - type: int | |
81 | - _socket: | |
82 | - type: str | |
83 | - | |
84 | - _connector: | |
85 | - type: map | |
86 | - | |
87 | - mapping: | |
88 | - _input: | |
89 | - type: str | |
90 | - | |
91 | - _output: | |
92 | - type: str | |
93 | - | |
94 | - _os: | |
95 | - type: str | |
96 | - | |
97 | - _os_version: | |
98 | - type: str | |
99 | - | |
100 | - _protocol: | |
101 | - type: map | |
102 | - | |
103 | - mapping: | |
104 | - _transport: | |
105 | - type: str | |
106 | - | |
107 | - _langage: | |
108 | - type: str | |
109 | - | |
110 | - _read: | |
111 | - type: bool | |
112 | - | |
113 | - _write: | |
114 | - type: bool | |
115 | - | |
116 | - CAPABILITIES: | |
117 | - include: schema_capabilities | |
118 | - required: True | |
119 | - | |
120 | -type: map | |
121 | -mapping: | |
122 | - schema: | |
123 | - type: str | |
124 | - required: True | |
125 | - DEVICE: | |
1 | +schema;schema_component_attributes: | |
2 | + type: map | |
3 | + required: True | |
4 | + mapping: | |
5 | + key: | |
6 | + type: str | |
7 | + required: True | |
8 | + # is_* are False by default | |
9 | + is_editable: | |
10 | + type: bool | |
11 | + is_container: | |
12 | + type: bool | |
13 | + is_enum: | |
14 | + type: bool | |
15 | + value: | |
16 | + type: any | |
17 | + required: True | |
18 | + liminf: | |
19 | + type: number | |
20 | + limsup: | |
21 | + type: number | |
22 | + label: | |
23 | + type: any | |
24 | + unit: | |
25 | + type: any | |
26 | + | |
27 | +schema;schema_capability: | |
28 | + type: map | |
29 | + required: True | |
30 | + mapping: | |
31 | + component: | |
32 | + type: str | |
33 | + required: True | |
34 | + attributes: | |
35 | + type: seq | |
36 | + required: False # True if we're not using default values | |
37 | + seq: | |
38 | + - include : schema_component_attributes | |
39 | + | |
40 | +# old version | |
41 | +# schema;schema_capability: | |
42 | +# type: map | |
43 | +# required: True | |
44 | +# mapping: | |
45 | + | |
46 | +schema;schema_capabilities: | |
47 | + type: seq | |
48 | + sequence: | |
49 | + - type: map | |
50 | + mapping: | |
51 | + CAPABILITY: | |
52 | + include: schema_capability | |
53 | + | |
54 | +schema;schema_device: | |
55 | + type: map | |
56 | + required: True | |
57 | + mapping: | |
58 | + _inventory_label: | |
59 | + type: str | |
60 | + required: True | |
61 | + _manufacturer: | |
62 | + type: str | |
63 | + required: True | |
64 | + _model: | |
65 | + type: str | |
66 | + required: True | |
67 | + _description: | |
68 | + type: str | |
69 | + required: True | |
70 | + _sn: | |
71 | + type: text | |
72 | + required: True | |
73 | + _power: | |
74 | + type: map | |
75 | + required: True | |
76 | + mapping: | |
77 | + _voltage: | |
78 | + type: int | |
79 | + _intensity: | |
80 | + type: int | |
81 | + _socket: | |
82 | + type: str | |
83 | + | |
84 | + _connector: | |
85 | + type: map | |
86 | + | |
87 | + mapping: | |
88 | + _input: | |
89 | + type: str | |
90 | + | |
91 | + _output: | |
92 | + type: str | |
93 | + | |
94 | + _os: | |
95 | + type: str | |
96 | + | |
97 | + _os_version: | |
98 | + type: str | |
99 | + | |
100 | + _protocol: | |
101 | + type: map | |
102 | + | |
103 | + mapping: | |
104 | + _transport: | |
105 | + type: str | |
106 | + | |
107 | + _langage: | |
108 | + type: str | |
109 | + | |
110 | + _read: | |
111 | + type: bool | |
112 | + | |
113 | + _write: | |
114 | + type: bool | |
115 | + | |
116 | + CAPABILITIES: | |
117 | + include: schema_capabilities | |
118 | + required: True | |
119 | + | |
120 | +type: map | |
121 | +mapping: | |
122 | + schema: | |
123 | + type: str | |
124 | + required: True | |
125 | + DEVICE: | |
126 | 126 | include: schema_device |
127 | 127 | \ No newline at end of file | ... | ... |
privatedev/config/schema_observatory-2.0.yml renamed to config/schema_observatory-2.0.yml
1 | -schema;schema_DATABASE: | |
2 | - required: True | |
3 | - type: map | |
4 | - mapping: | |
5 | - _computer: | |
6 | - type: str | |
7 | - required: True | |
8 | - _file: | |
9 | - type: str | |
10 | - required: True | |
11 | - | |
12 | -schema;schema_AGENT_DEVICE: | |
13 | - type: map | |
14 | - required: True | |
15 | - mapping: | |
16 | - _computer: | |
17 | - type: str | |
18 | - required: True | |
19 | - _name: | |
20 | - type: str | |
21 | - required: True | |
22 | - _path: | |
23 | - type: str | |
24 | - _device: | |
25 | - type: str | |
26 | - _protocol: | |
27 | - type: str | |
28 | - | |
29 | -schema;schema_AGENT: | |
30 | - type: map | |
31 | - required: True | |
32 | - mapping: | |
33 | - _computer: | |
34 | - type: str | |
35 | - required: True | |
36 | - _name: | |
37 | - type: str | |
38 | - required: True | |
39 | - _path: | |
40 | - type: str | |
41 | - | |
42 | -schema;schema_GROUP: | |
43 | - type: map | |
44 | - required: True | |
45 | - mapping: | |
46 | - GROUP: | |
47 | - type: map | |
48 | - mapping: | |
49 | - _logic: | |
50 | - type: str | |
51 | - _channels: | |
52 | - type: seq | |
53 | - required: True | |
54 | - sequence: | |
55 | - - type: str | |
56 | - | |
57 | -schema;schema_CHANNEL_GROUPS: | |
58 | - type: map | |
59 | - required: True | |
60 | - mapping: | |
61 | - _logic: | |
62 | - type: str | |
63 | - GROUPS: | |
64 | - type: seq | |
65 | - sequence: | |
66 | - - include: schema_GROUP | |
67 | - | |
68 | -schema;schema_MOUNT: | |
69 | - type: map | |
70 | - mapping: | |
71 | - _name: | |
72 | - type: str | |
73 | - required: True | |
74 | - COMPONENT_AGENTS: | |
75 | - type: seq | |
76 | - required: True | |
77 | - sequence: | |
78 | - - type: any | |
79 | - | |
80 | -schema;schema_CHANNEL: | |
81 | - type: map | |
82 | - mapping: | |
83 | - _name: | |
84 | - type: str | |
85 | - required: True | |
86 | - COMPONENT_AGENTS: | |
87 | - type: seq | |
88 | - required: True | |
89 | - sequence: | |
90 | - - type: any | |
91 | - | |
92 | - | |
93 | -schema;schema_SECURITY: | |
94 | - type: map | |
95 | - required: True | |
96 | - mapping: | |
97 | - _name: | |
98 | - type: str | |
99 | - required: True | |
100 | - COMPONENT_AGENTS: | |
101 | - type: seq | |
102 | - required: True | |
103 | - sequence: | |
104 | - - type: any | |
105 | - | |
106 | - | |
107 | -schema;schema_TOPOLOGY: | |
108 | - required: True | |
109 | - type: map | |
110 | - mapping: | |
111 | - SECURITY: | |
112 | - include: schema_SECURITY | |
113 | - MOUNT: | |
114 | - include: schema_MOUNT | |
115 | - CHANNELS: | |
116 | - include: schema_CHANNELS | |
117 | - CHANNEL_GROUPS: | |
118 | - include: schema_CHANNEL_GROUPS | |
119 | - | |
120 | - | |
121 | - | |
122 | -schema;schema_COMPUTER: | |
123 | - type: map | |
124 | - mapping: | |
125 | - _name: | |
126 | - type: str | |
127 | - required: True | |
128 | - _file: | |
129 | - type: str | |
130 | - required: True | |
131 | - _role: | |
132 | - type: str | |
133 | - required: False | |
134 | - _network_interface_index: | |
135 | - type: text | |
136 | - _network_ip: | |
137 | - type: str | |
138 | - | |
139 | - | |
140 | -schema;schema_AGENTS: | |
141 | - required: True | |
142 | - type: seq | |
143 | - matching: "any" | |
144 | - sequence: | |
145 | - - type: map | |
146 | - mapping: | |
147 | - AGENT_DEVICE: | |
148 | - include: schema_AGENT_DEVICE | |
149 | - - type: map | |
150 | - mapping: | |
151 | - AGENT: | |
152 | - include: schema_AGENT | |
153 | - | |
154 | -schema;schema_COMPUTERS: | |
155 | - type: seq | |
156 | - sequence: | |
157 | - - type: map | |
158 | - mapping: | |
159 | - COMPUTER: | |
160 | - include: schema_COMPUTER | |
161 | - | |
162 | -schema;schema_UNIT: | |
163 | - type: map | |
164 | - required: True | |
165 | - mapping: | |
166 | - _name: | |
167 | - type: str | |
168 | - required: True | |
169 | - DATABASE: | |
170 | - include: schema_DATABASE | |
171 | - AGENTS: | |
172 | - include: schema_AGENTS | |
173 | - TOPOLOGY: | |
174 | - include: schema_TOPOLOGY | |
175 | - | |
176 | - | |
177 | -schema;schema_UNITS: | |
178 | - type: seq | |
179 | - required: True | |
180 | - sequence: | |
181 | - - type: map | |
182 | - mapping : | |
183 | - UNIT: | |
184 | - include: schema_UNIT | |
185 | - | |
186 | - | |
187 | - | |
188 | -schema;schema_CHANNELS: | |
189 | - type: seq | |
190 | - required: True | |
191 | - sequence: | |
192 | - - type : map | |
193 | - mapping: | |
194 | - CHANNEL: | |
195 | - include: schema_CHANNEL | |
196 | - | |
197 | - | |
198 | - | |
199 | -schema;schema_DEVICE: | |
200 | - type: map | |
201 | - required: True | |
202 | - mapping: | |
203 | - _name: | |
204 | - type: str | |
205 | - required: True | |
206 | - _file: | |
207 | - type: str | |
208 | - required: True | |
209 | - _network_interface_index: | |
210 | - type: text | |
211 | - _network_ip: | |
212 | - type: str | |
213 | - | |
214 | - | |
215 | -schema;schema_DEVICES: | |
216 | - type: seq | |
217 | - required: True | |
218 | - sequence: | |
219 | - - type: map | |
220 | - mapping: | |
221 | - DEVICE: | |
222 | - include: schema_DEVICE | |
223 | - | |
224 | - | |
225 | -schema;schema_OBSERVATORY: | |
226 | - type: map | |
227 | - required: True | |
228 | - mapping: | |
229 | - _name: | |
230 | - type: str | |
231 | - DEVICES: | |
232 | - include: schema_DEVICES | |
233 | - COMPUTERS: | |
234 | - include: schema_COMPUTERS | |
235 | - UNITS: | |
236 | - include: schema_UNITS | |
237 | - | |
238 | -type: map | |
239 | -mapping: | |
240 | - schema: | |
241 | - type: str | |
242 | - required: True | |
243 | - OBSERVATORY: | |
244 | - include: schema_OBSERVATORY | |
1 | +schema;schema_DATABASE: | |
2 | + required: True | |
3 | + type: map | |
4 | + mapping: | |
5 | + _computer: | |
6 | + type: str | |
7 | + required: True | |
8 | + _file: | |
9 | + type: str | |
10 | + required: True | |
11 | + | |
12 | +schema;schema_AGENT_DEVICE: | |
13 | + type: map | |
14 | + required: True | |
15 | + mapping: | |
16 | + _computer: | |
17 | + type: str | |
18 | + required: True | |
19 | + _name: | |
20 | + type: str | |
21 | + required: True | |
22 | + _path: | |
23 | + type: str | |
24 | + _device: | |
25 | + type: str | |
26 | + _protocol: | |
27 | + type: str | |
28 | + | |
29 | +schema;schema_AGENT: | |
30 | + type: map | |
31 | + required: True | |
32 | + mapping: | |
33 | + _computer: | |
34 | + type: str | |
35 | + required: True | |
36 | + _name: | |
37 | + type: str | |
38 | + required: True | |
39 | + _path: | |
40 | + type: str | |
41 | + | |
42 | +schema;schema_GROUP: | |
43 | + type: map | |
44 | + required: True | |
45 | + mapping: | |
46 | + GROUP: | |
47 | + type: map | |
48 | + mapping: | |
49 | + _logic: | |
50 | + type: str | |
51 | + _channels: | |
52 | + type: seq | |
53 | + required: True | |
54 | + sequence: | |
55 | + - type: str | |
56 | + | |
57 | +schema;schema_CHANNEL_GROUPS: | |
58 | + type: map | |
59 | + required: True | |
60 | + mapping: | |
61 | + _logic: | |
62 | + type: str | |
63 | + GROUPS: | |
64 | + type: seq | |
65 | + sequence: | |
66 | + - include: schema_GROUP | |
67 | + | |
68 | +schema;schema_MOUNT: | |
69 | + type: map | |
70 | + mapping: | |
71 | + _name: | |
72 | + type: str | |
73 | + required: True | |
74 | + COMPONENT_AGENTS: | |
75 | + type: seq | |
76 | + required: True | |
77 | + sequence: | |
78 | + - type: any | |
79 | + | |
80 | +schema;schema_CHANNEL: | |
81 | + type: map | |
82 | + mapping: | |
83 | + _name: | |
84 | + type: str | |
85 | + required: True | |
86 | + COMPONENT_AGENTS: | |
87 | + type: seq | |
88 | + required: True | |
89 | + sequence: | |
90 | + - type: any | |
91 | + | |
92 | + | |
93 | +schema;schema_SECURITY: | |
94 | + type: map | |
95 | + required: True | |
96 | + mapping: | |
97 | + _name: | |
98 | + type: str | |
99 | + required: True | |
100 | + COMPONENT_AGENTS: | |
101 | + type: seq | |
102 | + required: True | |
103 | + sequence: | |
104 | + - type: any | |
105 | + | |
106 | + | |
107 | +schema;schema_TOPOLOGY: | |
108 | + required: True | |
109 | + type: map | |
110 | + mapping: | |
111 | + SECURITY: | |
112 | + include: schema_SECURITY | |
113 | + MOUNT: | |
114 | + include: schema_MOUNT | |
115 | + CHANNELS: | |
116 | + include: schema_CHANNELS | |
117 | + CHANNEL_GROUPS: | |
118 | + include: schema_CHANNEL_GROUPS | |
119 | + | |
120 | + | |
121 | + | |
122 | +schema;schema_COMPUTER: | |
123 | + type: map | |
124 | + mapping: | |
125 | + _name: | |
126 | + type: str | |
127 | + required: True | |
128 | + _file: | |
129 | + type: str | |
130 | + required: True | |
131 | + _role: | |
132 | + type: str | |
133 | + required: False | |
134 | + _network_interface_index: | |
135 | + type: text | |
136 | + _network_ip: | |
137 | + type: str | |
138 | + | |
139 | + | |
140 | +schema;schema_AGENTS: | |
141 | + required: True | |
142 | + type: seq | |
143 | + matching: "any" | |
144 | + sequence: | |
145 | + - type: map | |
146 | + mapping: | |
147 | + AGENT_DEVICE: | |
148 | + include: schema_AGENT_DEVICE | |
149 | + - type: map | |
150 | + mapping: | |
151 | + AGENT: | |
152 | + include: schema_AGENT | |
153 | + | |
154 | +schema;schema_COMPUTERS: | |
155 | + type: seq | |
156 | + sequence: | |
157 | + - type: map | |
158 | + mapping: | |
159 | + COMPUTER: | |
160 | + include: schema_COMPUTER | |
161 | + | |
162 | +schema;schema_UNIT: | |
163 | + type: map | |
164 | + required: True | |
165 | + mapping: | |
166 | + _name: | |
167 | + type: str | |
168 | + required: True | |
169 | + DATABASE: | |
170 | + include: schema_DATABASE | |
171 | + AGENTS: | |
172 | + include: schema_AGENTS | |
173 | + TOPOLOGY: | |
174 | + include: schema_TOPOLOGY | |
175 | + | |
176 | + | |
177 | +schema;schema_UNITS: | |
178 | + type: seq | |
179 | + required: True | |
180 | + sequence: | |
181 | + - type: map | |
182 | + mapping : | |
183 | + UNIT: | |
184 | + include: schema_UNIT | |
185 | + | |
186 | + | |
187 | + | |
188 | +schema;schema_CHANNELS: | |
189 | + type: seq | |
190 | + required: True | |
191 | + sequence: | |
192 | + - type : map | |
193 | + mapping: | |
194 | + CHANNEL: | |
195 | + include: schema_CHANNEL | |
196 | + | |
197 | + | |
198 | + | |
199 | +schema;schema_DEVICE: | |
200 | + type: map | |
201 | + required: True | |
202 | + mapping: | |
203 | + _name: | |
204 | + type: str | |
205 | + required: True | |
206 | + _file: | |
207 | + type: str | |
208 | + required: True | |
209 | + _network_interface_index: | |
210 | + type: text | |
211 | + _network_ip: | |
212 | + type: str | |
213 | + | |
214 | + | |
215 | +schema;schema_DEVICES: | |
216 | + type: seq | |
217 | + required: True | |
218 | + sequence: | |
219 | + - type: map | |
220 | + mapping: | |
221 | + DEVICE: | |
222 | + include: schema_DEVICE | |
223 | + | |
224 | + | |
225 | +schema;schema_OBSERVATORY: | |
226 | + type: map | |
227 | + required: True | |
228 | + mapping: | |
229 | + _name: | |
230 | + type: str | |
231 | + DEVICES: | |
232 | + include: schema_DEVICES | |
233 | + COMPUTERS: | |
234 | + include: schema_COMPUTERS | |
235 | + UNITS: | |
236 | + include: schema_UNITS | |
237 | + | |
238 | +type: map | |
239 | +mapping: | |
240 | + schema: | |
241 | + type: str | |
242 | + required: True | |
243 | + OBSERVATORY: | |
244 | + include: schema_OBSERVATORY | ... | ... |
privatedev/config/schema_observatory_verify.py renamed to config/schema_observatory_verify.py
privatedev/config/computer_XCY_X26A_snAA478.yml renamed to privatedev/config/guitalens/computer_XCY_X26A_snAA478.yml
privatedev/config/device_Astromecca_TM350_sn001.yml renamed to privatedev/config/guitalens/device_Astromecca_TM350_sn001.yml
privatedev/config/device_Raspberry_MiFe_sn004.yml renamed to privatedev/config/guitalens/device_Raspberry_MiFe_sn004.yml
privatedev/config/device_SkyWatcher_L80_snxx1.yml renamed to privatedev/config/guitalens/device_SkyWatcher_L80_snxx1.yml
privatedev/config/device_ZWO_ASI1600MM_snxx1.yml renamed to privatedev/config/guitalens/device_ZWO_ASI1600MM_snxx1.yml
privatedev/config/observatory_guitalens.yml renamed to privatedev/config/guitalens/observatory_guitalens.yml
1 | -# Schema file to check the syntax of this config file | |
2 | -schema: schema_observatory-2.0.yml | |
3 | - | |
4 | -# Here is the description of the configuration of an observatory | |
5 | -OBSERVATORY: | |
6 | - | |
7 | - _name: Guitalens | |
8 | - | |
9 | - # === Inventory of available devices | |
10 | - # A device is a hardware with a maximum of one connection to drive it with a computer. | |
11 | - # As a device can be shared with various units, it is defined at the observatory level. | |
12 | - DEVICES: | |
13 | - | |
14 | - # Each device is defined by a specific configuration file that enumarate the components. | |
15 | - | |
16 | - - DEVICE: | |
17 | - _name: AstroMecCA-TM350 | |
18 | - _file: device_Astromecca_TM350_sn001.yml | |
19 | - | |
20 | - - DEVICE: | |
21 | - _name: PLC-meteo | |
22 | - _file: device_Raspberry_MiFe_sn004.yml | |
23 | - # Describe here the configuration of the device in operation | |
24 | - _network_interface_index: 0 | |
25 | - _network_ip: 192.168.0.2 | |
26 | - | |
27 | - - DEVICE: | |
28 | - _name: SkyWatcher-refractor | |
29 | - _file: device_SkyWatcher_L80_snxx1.yml | |
30 | - | |
31 | - - DEVICE: | |
32 | - _name: Celestron-C11 | |
33 | - _file: device_Celestron_C11_sn974234.yml | |
34 | - | |
35 | - - DEVICE: | |
36 | - _name: ZWO-ASI1600MMPro | |
37 | - _file: device_ZWO_ASI1600MM_snxx1.yml | |
38 | - | |
39 | - - DEVICE: | |
40 | - _name: FLI-Kepler4040 | |
41 | - _file: device_FLI_Kepler4040_sn2821221.yml | |
42 | - | |
43 | - - DEVICE: | |
44 | - _name: FLI-KeplerGPS | |
45 | - _file: device_FLI_KITS_sn0x1.yml | |
46 | - | |
47 | - # === Inventory of available computers | |
48 | - # A computer is a hardware of a virtual machine. | |
49 | - # As a computer can be shared with various units, it is defined at the observatory level. | |
50 | - COMPUTERS: | |
51 | - | |
52 | - - COMPUTER: | |
53 | - | |
54 | - _name: MainComputer | |
55 | - _file: computer_XCY_X26A_snAA478.yml | |
56 | - # Describe here the configuration of the computer in operation | |
57 | - _role: Main | |
58 | - # Choice of the interface to connect the computer to the network (cf. _network_interfaces in _file) | |
59 | - _network_interface_index: 0 | |
60 | - # IP attributed by the Router | |
61 | - _network_ip: 192.168.0.11 | |
62 | - | |
63 | - # === Assembly of devices into units | |
64 | - # A unit is a robotic telescope | |
65 | - UNITS: | |
66 | - | |
67 | - - UNIT: | |
68 | - _name: TNC-prototype | |
69 | - | |
70 | - DATABASE: | |
71 | - _computer: MainComputer | |
72 | - _file: pyros/docker/.env | |
73 | - | |
74 | - AGENTS: | |
75 | - | |
76 | - - AGENT_DEVICE: | |
77 | - _computer: MainComputer | |
78 | - _name: plc | |
79 | - _path: private/plugin/agent_devices | |
80 | - _device: PLC-meteo | |
81 | - _protocol: private/plugin/agent_devices/plc_protocol.py | |
82 | - | |
83 | - - AGENT_DEVICE: | |
84 | - _computer: MainComputer | |
85 | - _name: mount | |
86 | - _path: private/plugin/agent_devices | |
87 | - _device: AstroMecCA-TM350 | |
88 | - _protocol: private/plugin/agent_devices/mount_protocol.py | |
89 | - | |
90 | - - AGENT_DEVICE: | |
91 | - _computer: None | |
92 | - _name: optic_up | |
93 | - _path: ~ | |
94 | - _device: Celestron-C11 | |
95 | - | |
96 | - - AGENT_DEVICE: | |
97 | - _computer: MainComputer | |
98 | - _name: camera_up | |
99 | - _path: private/plugin/agent_devices | |
100 | - _device: FLI-Kepler4040 | |
101 | - _protocol: private/plugin/agent_devices/camera_protocol.py | |
102 | - | |
103 | - - AGENT: | |
104 | - _computer: MainComputer | |
105 | - _name: majordome | |
106 | - _path: ~ | |
107 | - | |
108 | - TOPOLOGY: | |
109 | - | |
110 | - SECURITY: | |
111 | - _name: PLC | |
112 | - COMPONENT_AGENTS: | |
113 | - - WeatherStation: plc | |
114 | - - BuildingCover: plc | |
115 | - | |
116 | - MOUNT: | |
117 | - _name: TM350-prototype | |
118 | - COMPONENT_AGENTS: | |
119 | - - MountPointing: mount | |
120 | - | |
121 | - CHANNELS: | |
122 | - | |
123 | - - CHANNEL: | |
124 | - _name: OpticalChannel-up | |
125 | - COMPONENT_AGENTS: | |
126 | - - OpticImager: optic_up | |
127 | - - DetectorSensor: camera_up | |
128 | - - DetectorShutter: camera_up | |
129 | - - DetectorTimer: camera_up | |
130 | - | |
131 | - CHANNEL_GROUPS: | |
132 | - | |
133 | - _logic: 'or' # opt | |
134 | - GROUPS: | |
135 | - - GROUP: | |
136 | - _logic: 'and' # opt | |
137 | - _channels: | |
138 | - - OpticalChannel-up | |
1 | +# Schema file to check the syntax of this config file | |
2 | +schema: schema_observatory-2.0.yml | |
3 | + | |
4 | +# Here is the description of the configuration of an observatory | |
5 | +OBSERVATORY: | |
6 | + | |
7 | + _name: Guitalens | |
8 | + | |
9 | + # === Inventory of available devices | |
10 | + # A device is a hardware with a maximum of one connection to drive it with a computer. | |
11 | + # As a device can be shared with various units, it is defined at the observatory level. | |
12 | + DEVICES: | |
13 | + | |
14 | + # Each device is defined by a specific configuration file that enumarate the components. | |
15 | + | |
16 | + - DEVICE: | |
17 | + _name: AstroMecCA-TM350 | |
18 | + _file: device_Astromecca_TM350_sn001.yml | |
19 | + | |
20 | + - DEVICE: | |
21 | + _name: PLC-meteo | |
22 | + _file: device_Raspberry_MiFe_sn004.yml | |
23 | + # Describe here the configuration of the device in operation | |
24 | + _network_interface_index: 0 | |
25 | + _network_ip: 192.168.0.2 | |
26 | + | |
27 | + - DEVICE: | |
28 | + _name: SkyWatcher-refractor | |
29 | + _file: device_SkyWatcher_L80_snxx1.yml | |
30 | + | |
31 | + - DEVICE: | |
32 | + _name: Celestron-C11 | |
33 | + _file: device_Celestron_C11_sn974234.yml | |
34 | + | |
35 | + - DEVICE: | |
36 | + _name: ZWO-ASI1600MMPro | |
37 | + _file: device_ZWO_ASI1600MM_snxx1.yml | |
38 | + | |
39 | + - DEVICE: | |
40 | + _name: FLI-Kepler4040 | |
41 | + _file: device_FLI_Kepler4040_sn2821221.yml | |
42 | + | |
43 | + - DEVICE: | |
44 | + _name: FLI-KeplerGPS | |
45 | + _file: device_FLI_KITS_sn0x1.yml | |
46 | + | |
47 | + # === Inventory of available computers | |
48 | + # A computer is a hardware of a virtual machine. | |
49 | + # As a computer can be shared with various units, it is defined at the observatory level. | |
50 | + COMPUTERS: | |
51 | + | |
52 | + - COMPUTER: | |
53 | + | |
54 | + _name: MainComputer | |
55 | + _file: computer_XCY_X26A_snAA478.yml | |
56 | + # Describe here the configuration of the computer in operation | |
57 | + _role: Main | |
58 | + # Choice of the interface to connect the computer to the network (cf. _network_interfaces in _file) | |
59 | + _network_interface_index: 0 | |
60 | + # IP attributed by the Router | |
61 | + _network_ip: 192.168.0.11 | |
62 | + | |
63 | + # === Assembly of devices into units | |
64 | + # A unit is a robotic telescope | |
65 | + UNITS: | |
66 | + | |
67 | + - UNIT: | |
68 | + _name: TNC-prototype | |
69 | + | |
70 | + DATABASE: | |
71 | + _computer: MainComputer | |
72 | + _file: pyros/docker/.env | |
73 | + | |
74 | + AGENTS: | |
75 | + | |
76 | + - AGENT_DEVICE: | |
77 | + _computer: MainComputer | |
78 | + _name: plc | |
79 | + _path: private/plugin/agent_devices | |
80 | + _device: PLC-meteo | |
81 | + _protocol: private/plugin/agent_devices/plc_protocol.py | |
82 | + | |
83 | + - AGENT_DEVICE: | |
84 | + _computer: MainComputer | |
85 | + _name: mount | |
86 | + _path: private/plugin/agent_devices | |
87 | + _device: AstroMecCA-TM350 | |
88 | + _protocol: private/plugin/agent_devices/mount_protocol.py | |
89 | + | |
90 | + - AGENT_DEVICE: | |
91 | + _computer: None | |
92 | + _name: optic_up | |
93 | + _path: ~ | |
94 | + _device: Celestron-C11 | |
95 | + | |
96 | + - AGENT_DEVICE: | |
97 | + _computer: MainComputer | |
98 | + _name: camera_up | |
99 | + _path: private/plugin/agent_devices | |
100 | + _device: FLI-Kepler4040 | |
101 | + _protocol: private/plugin/agent_devices/camera_protocol.py | |
102 | + | |
103 | + - AGENT: | |
104 | + _computer: MainComputer | |
105 | + _name: majordome | |
106 | + _path: ~ | |
107 | + | |
108 | + TOPOLOGY: | |
109 | + | |
110 | + SECURITY: | |
111 | + _name: PLC | |
112 | + COMPONENT_AGENTS: | |
113 | + - WeatherStation: plc | |
114 | + - BuildingCover: plc | |
115 | + | |
116 | + MOUNT: | |
117 | + _name: TM350-prototype | |
118 | + COMPONENT_AGENTS: | |
119 | + - MountPointing: mount | |
120 | + | |
121 | + CHANNELS: | |
122 | + | |
123 | + - CHANNEL: | |
124 | + _name: OpticalChannel-up | |
125 | + COMPONENT_AGENTS: | |
126 | + - OpticImager: optic_up | |
127 | + - DetectorSensor: camera_up | |
128 | + - DetectorShutter: camera_up | |
129 | + - DetectorTimer: camera_up | |
130 | + | |
131 | + CHANNEL_GROUPS: | |
132 | + | |
133 | + _logic: 'or' # opt | |
134 | + GROUPS: | |
135 | + - GROUP: | |
136 | + _logic: 'and' # opt | |
137 | + _channels: | |
138 | + - OpticalChannel-up | ... | ... |
privatedev/config/info_observatory.py deleted
... | ... | @@ -1,57 +0,0 @@ |
1 | -# -*- coding: utf-8 -*- | |
2 | - | |
3 | -import pykwalify.core | |
4 | -from pykwalify.errors import SchemaError | |
5 | - | |
6 | -import yaml | |
7 | -filename = "observatory_guitalens.yml" | |
8 | -with open(filename, 'r') as stream: | |
9 | - try: | |
10 | - config = yaml.safe_load(stream) | |
11 | - #print(config) | |
12 | - except yaml.YAMLError as exc: | |
13 | - print(exc) | |
14 | - | |
15 | -t = config['OBSERVATORY']['_name'] | |
16 | -print("="*20) | |
17 | -print(f"Configuration of the observatory : {t}") | |
18 | - | |
19 | -ts = config['OBSERVATORY']['DEVICES'] | |
20 | -nt = len(ts) | |
21 | -print("="*20) | |
22 | -print(f"There are {nt} available devices:") | |
23 | -print("-"*20) | |
24 | -for kd in range(nt): | |
25 | - texte = "" | |
26 | - t = config['OBSERVATORY']['DEVICES'][kd]['DEVICE']['_name'] | |
27 | - texte += f"Device {t}: " | |
28 | - | |
29 | - filename = config['OBSERVATORY']['DEVICES'][kd]['DEVICE']['_file'] | |
30 | - with open(filename, 'r') as stream: | |
31 | - try: | |
32 | - subconfig = yaml.safe_load(stream) | |
33 | - #print(config) | |
34 | - except yaml.YAMLError as exc: | |
35 | - print(exc) | |
36 | - | |
37 | - # --- list of keys | |
38 | - cs = subconfig['DEVICE']['CAPABILITIES'] | |
39 | - nc = len(cs) | |
40 | - for kc in range(nc): | |
41 | - t = subconfig['DEVICE']['CAPABILITIES'][kc]['CAPABILITY']['component'] | |
42 | - texte += f" {t} " | |
43 | - | |
44 | - print(texte) | |
45 | - | |
46 | -ts = config['OBSERVATORY']['UNITS'] | |
47 | -nt = len(ts) | |
48 | -print("="*20) | |
49 | -print(f"There are {nt} units:") | |
50 | -ku = 0 | |
51 | -ts = config['OBSERVATORY']['UNITS'][ku]['UNIT']['_name'] | |
52 | -print(f"First unit is {ts}:") | |
53 | -print("-"*20) | |
54 | -ts = config['OBSERVATORY']['UNITS'][ku]['UNIT']['TOPOLOGY']['SECURITY']['_name'] | |
55 | -print(f"Security is {ts}:") | |
56 | -ts = config['OBSERVATORY']['UNITS'][ku]['UNIT']['TOPOLOGY']['MOUNT']['_name'] | |
57 | -print(f"Mount is {ts}:") |
privatedev/config/observatory_v1.yml deleted
... | ... | @@ -1,69 +0,0 @@ |
1 | -# To verify this configuration file: | |
2 | -# yaml_schema: schema_observatory-1.0.yaml | |
3 | -OBSERVATORY: | |
4 | - _name: TNC | |
5 | - | |
6 | - UNITS: | |
7 | - - UNIT: | |
8 | - _name: TNC-Telescope | |
9 | - # _Site: (home, ligne d'horizon) | |
10 | - | |
11 | - MOUNT: | |
12 | - _name: TNC-Mount | |
13 | - _components: | |
14 | - - Mount_TM350-Astromecca_sn459.yml | |
15 | - | |
16 | - CHANNELS: | |
17 | - | |
18 | - - CHANNEL: | |
19 | - _name: TNC-NW | |
20 | - _components: | |
21 | - - Camera_FLIKepler4040_sn123.yml | |
22 | - - Focuser_Optec_sn341.yml | |
23 | - - Optic_TakahashiED180_sn445.yml | |
24 | - | |
25 | - - CHANNEL: | |
26 | - _name: TNC-NE | |
27 | - | |
28 | - - CHANNEL: | |
29 | - _name: TNC-SW | |
30 | - | |
31 | - - CHANNEL: | |
32 | - _name: TNC-SE | |
33 | - | |
34 | - COMPUTERS: | |
35 | - | |
36 | - - COMPUTER: | |
37 | - _name: PyROS_bdd | |
38 | - _file: Computer_DELL_PowerEdge7000_sn599.yml | |
39 | - _hostname: TNC_PC_DB | |
40 | - database: | |
41 | - name: MySQL | |
42 | - port: 3306 | |
43 | - | |
44 | - - COMPUTER: | |
45 | - _name: PyROS_principal | |
46 | - _file: Computer_DELL_E6430_sn000.yml | |
47 | - _hostname: TNC_PC1 | |
48 | - _role: Main | |
49 | - agents: | |
50 | - - Majordome: /home/pyros/private/majordome_perso | |
51 | - - Monitoring: ~ | |
52 | - | |
53 | - - COMPUTER: | |
54 | - _name: PyROS_spare | |
55 | - _file: Computer_DELL_E6430_sn001.yml | |
56 | - _hostname: TNC_PC2 | |
57 | - _role: Spare | |
58 | - _main: TNC_PC1 | |
59 | - agents: | |
60 | - - Majordome: ~ | |
61 | - - Monitoring: ~ | |
62 | - | |
63 | - - COMPUTER: | |
64 | - _name: PyROS_channel | |
65 | - _file: Computer_DELL_MiniPC_s772.yml | |
66 | - _hostname: TNC_MINIPC_SW | |
67 | - _role: Main | |
68 | - agents: | |
69 | - - Camera: ~ |
privatedev/config/schema_observatory-1.0.yml deleted
... | ... | @@ -1,108 +0,0 @@ |
1 | -schema;schema_UNIT: | |
2 | - type: map | |
3 | - required: True | |
4 | - mapping: | |
5 | - _name: | |
6 | - type: str | |
7 | - required: True | |
8 | - MOUNT: | |
9 | - include: schema_MOUNT | |
10 | - CHANNELS: | |
11 | - include: schema_CHANNELS | |
12 | - COMPUTERS: | |
13 | - include: schema_COMPUTERS | |
14 | - | |
15 | -schema;schema_MOUNT: | |
16 | - type: map | |
17 | - mapping: | |
18 | - _name: | |
19 | - type: str | |
20 | - required: True | |
21 | - _components: | |
22 | - type: seq | |
23 | - required: True | |
24 | - sequence: | |
25 | - - type: str | |
26 | - | |
27 | -schema;schema_CHANNEL: | |
28 | - type: map | |
29 | - mapping: | |
30 | - _name: | |
31 | - type: str | |
32 | - required: True | |
33 | - _components: | |
34 | - type: seq | |
35 | - required: False | |
36 | - sequence: | |
37 | - - type: str | |
38 | - | |
39 | -schema;schema_COMPUTER: | |
40 | - type: map | |
41 | - mapping: | |
42 | - _name: | |
43 | - type: str | |
44 | - required: True | |
45 | - _file: | |
46 | - type: str | |
47 | - required: True | |
48 | - _hostname: | |
49 | - type: str | |
50 | - required: False | |
51 | - _role: | |
52 | - type: str | |
53 | - required: False | |
54 | - database: | |
55 | - type: map | |
56 | - required: False | |
57 | - mapping: | |
58 | - name: | |
59 | - type: str | |
60 | - port: | |
61 | - type: int | |
62 | - _main: | |
63 | - type: str | |
64 | - required: False | |
65 | - agents: | |
66 | - type: any | |
67 | - required: False | |
68 | - | |
69 | -schema;schema_COMPUTERS: | |
70 | -# TODO: can be improved if we switch to sequence -> we can have any number of computers | |
71 | - type: seq | |
72 | - sequence: | |
73 | - - type: map | |
74 | - mapping: | |
75 | - COMPUTER: | |
76 | - include: schema_COMPUTER | |
77 | - | |
78 | -schema;schema_UNITS: | |
79 | - type: seq | |
80 | - required: True | |
81 | - sequence: | |
82 | - - type: map | |
83 | - mapping : | |
84 | - UNIT: | |
85 | - include: schema_UNIT | |
86 | - | |
87 | - | |
88 | - | |
89 | -schema;schema_CHANNELS: | |
90 | - type: seq | |
91 | - required: True | |
92 | - sequence: | |
93 | - - type : map | |
94 | - mapping: | |
95 | - CHANNEL: | |
96 | - include: schema_CHANNEL | |
97 | - | |
98 | - | |
99 | -type: map | |
100 | -mapping: | |
101 | - OBSERVATORY: | |
102 | - type: map | |
103 | - required: True | |
104 | - mapping: | |
105 | - _name: | |
106 | - type: str | |
107 | - UNITS: | |
108 | - include: schema_UNITS | |
109 | 0 | \ No newline at end of file |
privatedev/config/veirify_config.py deleted
... | ... | @@ -1,51 +0,0 @@ |
1 | -import pykwalify.core | |
2 | -import yaml,sys,logging | |
3 | -from pykwalify.errors import PyKwalifyException,SchemaError | |
4 | - | |
5 | - | |
6 | -def check_and_return_config(yaml_file:str,schema_file:str)->dict: | |
7 | - """ | |
8 | - Check if yaml_file is valid for the schema_file and return an dictionnary of the config file | |
9 | - | |
10 | - Args: | |
11 | - yaml_file (str): Path to the config_file to be validated | |
12 | - schema_file (str): Path to the schema file | |
13 | - | |
14 | - Returns: | |
15 | - dict: Dictionnary of the config file (with values) | |
16 | - """ | |
17 | - # disable pykwalify error to clean the output | |
18 | - logging.disable(logging.ERROR) | |
19 | - try: | |
20 | - c = pykwalify.core.Core(source_file=yaml_file, schema_files=[schema_file]) | |
21 | - return c.validate(raise_exception=True) | |
22 | - except SchemaError: | |
23 | - for error in c.errors: | |
24 | - print("Error :",str(error).split(". Path")[0]) | |
25 | - print("Path to error :",error.path) | |
26 | - # error.value is the value causing the error | |
27 | - # print(error.value) | |
28 | - # error.scalar_type is the type (defined by schema) that the value should match | |
29 | - # print(error.scalar_type) | |
30 | - # error.path is the path to the error in the yaml file | |
31 | - # print(error.path) | |
32 | -def read_and_check_config_file(yaml_file:str): | |
33 | - """ | |
34 | - Read the schema key of the config file to retrieve schema name and proceed to the checking of that config file | |
35 | - Call check_and_return_config function and print its return. | |
36 | - | |
37 | - Args: | |
38 | - yaml_file (str): path to the config file | |
39 | - """ | |
40 | - with open(yaml_file, 'r') as stream: | |
41 | - try: | |
42 | - config_file = yaml.safe_load(stream) | |
43 | - result = check_and_return_config(yaml_file,config_file["schema"]) | |
44 | - if result is None: | |
45 | - print("Error when reading and validating config file, please check the errors right above") | |
46 | - else: | |
47 | - print(result) | |
48 | - except yaml.YAMLError as exc: | |
49 | - print(exc) | |
50 | - | |
51 | -read_and_check_config_file(sys.argv[1]) | |
52 | 0 | \ No newline at end of file |