1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24 from Numeric import Float64, zeros
25 from time import asctime, localtime
26
27 from base_map import Base_Map
28
29
32 """3D isosurface class."""
33
34 self.relax = relax
35
36
38 """Function for creating the OpenDX program configuration file."""
39
40
41 if self.dir:
42 config_file = open(self.dir + "/" + self.file + ".cfg", "w")
43 else:
44 config_file = open(self.file + ".cfg", "w")
45
46
47 date = self.get_date()
48
49
50
51 text = """//
52 //
53 // time: """ + date + """
54 //
55 // version: 3.2.0 (format), 4.3.2 (DX)
56 //
57 //
58 // panel[0]: position = (0.0164,0.0000), size = 0.2521x0.1933, startup = 1, devstyle = 1
59 // title: value = Control Panel
60 //
61 // workspace: width = 251, height = 142
62 // layout: snap = 0, width = 50, height = 50, align = NN
63 //
64 // interactor Selector[1]: num_components = 1, value = 1
65 // selections: maximum = 2, current = 0
66 // option[0]: name = "Colour", value = 1
67 // option[1]: name = "Grey", value = 2
68 // instance: panel = 0, x = 81, y = 6, style = Scrolled List, vertical = 1, size = 170x136
69 // label: value = Colour Selector
70 //
71 // node Image[3]:
72 // title: value = Surface
73 // depth: value = 24
74 // window: position = (0.0000,0.0400), size = 0.9929x0.9276
75 """
76
77 config_file.write(text)
78
79
80 config_file.close()
81
82
84 """Function for creating a 3D map."""
85
86
87 if self.dir:
88 map_file = open(self.dir + "/" + self.file, "w")
89 else:
90 map_file = open(self.file, "w")
91
92
93 values = zeros(3, Float64)
94 self.percent = 0.0
95 self.percent_inc = 100.0 / (self.inc + 1.0)**(self.n - 1.0)
96 print "%-10s%8.3f%-1s" % ("Progress:", self.percent, "%")
97
98
99 values[self.swap[0]] = self.bounds[self.swap[0], 0]
100 for i in xrange((self.inc + 1)):
101 values[self.swap[1]] = self.bounds[self.swap[1], 0]
102 for j in xrange((self.inc + 1)):
103 values[self.swap[2]] = self.bounds[self.swap[2], 0]
104 for k in xrange((self.inc + 1)):
105
106 if self.remap:
107 values = self.remap(values)
108
109
110 for l in xrange(self.n):
111 self.relax.generic.value.set(run=self.run, value=values[l], data_type=self.relax.data.res[self.run][self.index].params[l], res_num=self.relax.data.res[self.run][self.index].num, force=1)
112
113
114 self.calculate(run=self.run, res_num=self.relax.data.res[self.run][self.index].num, print_flag=0)
115
116
117 if self.relax.data.res[self.run][self.index].chi2 > 1e20:
118 map_file.write("%30f\n" % 1e20)
119 else:
120 map_file.write("%30f\n" % self.relax.data.res[self.run][self.index].chi2)
121
122 values[self.swap[2]] = values[self.swap[2]] + self.step_size[self.swap[2]]
123 self.percent = self.percent + self.percent_inc
124 print "%-10s%8.3f%-8s%-8g" % ("Progress:", self.percent, "%, " + `values` + ", f(x): ", self.relax.data.res[self.run][self.index].chi2)
125 values[self.swap[1]] = values[self.swap[1]] + self.step_size[self.swap[1]]
126 values[self.swap[0]] = values[self.swap[0]] + self.step_size[self.swap[0]]
127
128
129 map_file.close()
130
131
133 """Function for creating a sphere at a given position within the 3D map.
134
135 The formula used to calculate the coordinate position is:
136
137 V - L
138 coord = Inc * -----
139 U - L
140
141 where:
142 V is the coordinate or parameter value.
143 L is the lower bound value.
144 U is the upper bound value.
145 Inc is the number of increments.
146
147 Both a data file and .general file will be created.
148 """
149
150
151 if self.dir:
152 point_file = open(self.dir + "/" + self.point_file, "w")
153 general_file = open(self.dir + "/" + self.point_file + ".general", "w")
154 else:
155 point_file = open(self.point_file, "w")
156 general_file = open(self.point_file + ".general", "w")
157
158
159 coords = self.inc * (self.point - self.bounds[:, 0]) / (self.bounds[:, 1] - self.bounds[:, 0])
160 for i in xrange(self.n):
161 point_file.write("%-15.5g" % coords[self.swap[i]])
162 point_file.write("1\n")
163
164
165 general_file.write("file = " + self.point_file + "\n")
166 general_file.write("points = 1\n")
167 general_file.write("format = ascii\n")
168 general_file.write("interleaving = field\n")
169 general_file.write("field = locations, field0\n")
170 general_file.write("structure = 3-vector, scalar\n")
171 general_file.write("type = float, float\n\n")
172 general_file.write("end\n")
173
174
175 point_file.close()
176 general_file.close()
177
178
180 """Function for creating the OpenDX .general file for a 3D map."""
181
182
183 if self.dir:
184 general_file = open(self.dir + "/" + self.file + ".general", "w")
185 else:
186 general_file = open(self.file + ".general", "w")
187
188
189 general_file.write("file = " + self.file + "\n")
190 general_file.write("grid = " + `(self.inc + 1)` + " x " + `(self.inc + 1)` + " x " + `(self.inc + 1)` + "\n")
191 general_file.write("format = ascii\n")
192 general_file.write("interleaving = field\n")
193 general_file.write("majority = row\n")
194 general_file.write("field = data\n")
195 general_file.write("structure = scalar\n")
196 general_file.write("type = float\n")
197 general_file.write("dependency = positions\n")
198 general_file.write("positions = regular, regular, regular, 0, 1, 0, 1, 0, 1\n\n")
199 general_file.write("end\n")
200
201
202 general_file.close()
203
204
206 """Function for creating a date string."""
207
208 return asctime(localtime())
209
210
212 """Function for creating the OpenDX program for a 3D map."""
213
214
215 if self.dir:
216 program_file = open(self.dir + "/" + self.file + ".net", "w")
217 else:
218 program_file = open(self.file + ".net", "w")
219
220
221
222
223
224 if self.map_labels == None or self.labels != None:
225
226 axis_incs = 5
227
228
229 if self.labels:
230 labels = "{\"" + self.labels[self.swap[0]] + "\" \""
231 labels = labels + self.labels[self.swap[1]] + "\" \""
232 labels = labels + self.labels[self.swap[2]] + "\"}"
233 else:
234 labels = "{\"" + self.relax.data.res[self.run][self.index].params[self.swap[0]] + "\" \""
235 labels = labels + self.relax.data.res[self.run][self.index].params[self.swap[1]] + "\" \""
236 labels = labels + self.relax.data.res[self.run][self.index].params[self.swap[2]] + "\"}"
237
238
239 tick_locations = []
240 for i in xrange(3):
241 string = "{"
242 inc = self.inc / float(axis_incs)
243 val = 0.0
244 for i in xrange(axis_incs + 1):
245 string = string + " " + `val`
246 val = val + inc
247 string = string + " }"
248 tick_locations.append(string)
249
250
251 tick_values = []
252 inc = (self.bounds[:, 1] - self.bounds[:, 0]) / float(axis_incs)
253 for i in xrange(3):
254 vals = self.bounds[self.swap[i], 0] * 1.0
255 string = "{"
256 for j in xrange(axis_incs + 1):
257 string = string + "\"" + "%.2g" % vals + "\" "
258 vals = vals + inc[self.swap[i]]
259 string = string + "}"
260 tick_values.append(string)
261
262
263 else:
264 labels, tick_locations, tick_values = self.map_labels(self.run, self.index, self.relax.data.res[self.run][self.index].params, self.bounds, self.swap, self.inc)
265
266
267
268 corners = "{[0 0 0] [" + `self.inc` + " " + `self.inc` + " " + `self.inc` + "]}"
269
270
271 image_array1 = "[" + `0.6 * (self.inc + 1.0)` + " " + `0.3 * (self.inc + 1.0)` + " " + `0.6 * (self.inc + 1.0)` + "]"
272 image_array2 = "[" + `0.6 * (self.inc + 1.0)` + " " + `0.3 * (self.inc + 1.0)` + " " + `6.0 * (self.inc + 1.0)` + "]"
273 image_val = `3.0 * (self.inc + 1.0)`
274
275
276 sphere_size = `0.025 * (self.inc + 1.0)`
277
278
279 date = self.get_date()
280
281
282
283 text = """//
284 // time: """ + date + """
285 //
286 // version: 3.2.0 (format), 4.3.2 (DX)
287 //
288 //
289 // MODULE main"""
290
291
292 if self.num_points == 1:
293 text = text + """
294 // page assignment: Colour Space order=3, windowed=0, showing=0
295 // page assignment: ColourScene order=5, windowed=0, showing=0
296 // page assignment: Glyph order=2, windowed=0, showing=0
297 // page assignment: Grey Space order=4, windowed=0, showing=0
298 // page assignment: GreyScene order=6, windowed=0, showing=0
299 // page assignment: Image order=7, windowed=0, showing=0
300 // page assignment: Isosurfaces order=1, windowed=0, showing=1"""
301
302 else:
303 text = text + """
304 // page assignment: Colour Space order=4, windowed=0, showing=0
305 // page assignment: ColourScene order=6, windowed=0, showing=0
306 // page assignment: Grey Space order=5, windowed=0, showing=0
307 // page assignment: GreyScene order=7, windowed=0, showing=0
308 // page assignment: Image order=8, windowed=0, showing=0
309 // page assignment: Isosurfaces order=2, windowed=0, showing=1"""
310
311
312 text = text + """
313 // workspace: width = 474, height = 354
314 // layout: snap = 0, width = 50, height = 50, align = NN
315 //
316 macro main(
317 ) -> (
318 ) {
319 // """
320
321
322 if self.num_points == 1:
323 text = text + """
324 // node Import[4]: x = 177, y = 62, inputs = 6, label = """ + self.point_file + """
325 // input[1]: defaulting = 0, visible = 1, type = 32, value = \"""" + self.point_file + """.general"
326 // input[3]: defaulting = 1, visible = 1, type = 32, value = "general"
327 // page group: Glyph
328 //
329 main_Import_4_out_1 =
330 Import(
331 main_Import_4_in_1,
332 main_Import_4_in_2,
333 main_Import_4_in_3,
334 main_Import_4_in_4,
335 main_Import_4_in_5,
336 main_Import_4_in_6
337 ) [instance: 4, cache: 1];
338 //
339 // node Glyph[2]: x = 201, y = 182, inputs = 7, label = Glyph
340 // input[2]: defaulting = 0, visible = 1, type = 32, value = "sphere"
341 // input[3]: defaulting = 1, visible = 1, type = 5, value = 10.0
342 // input[4]: defaulting = 0, visible = 1, type = 5, value = """ + sphere_size + """
343 // input[5]: defaulting = 0, visible = 1, type = 5, value = 0.0
344 // page group: Glyph
345 //
346 main_Glyph_2_out_1 =
347 Glyph(
348 main_Import_4_out_1,
349 main_Glyph_2_in_2,
350 main_Glyph_2_in_3,
351 main_Glyph_2_in_4,
352 main_Glyph_2_in_5,
353 main_Glyph_2_in_6,
354 main_Glyph_2_in_7
355 ) [instance: 2, cache: 1];
356 //
357 // node Color[10]: x = 357, y = 278, inputs = 5, label = Color
358 // input[2]: defaulting = 0, visible = 1, type = 8, value = [0 0 0]
359 // input[3]: defaulting = 0, visible = 1, type = 5, value = 1.0
360 // page group: Glyph
361 //
362 main_Color_10_out_1 =
363 Color(
364 main_Glyph_2_out_1,
365 main_Color_10_in_2,
366 main_Color_10_in_3,
367 main_Color_10_in_4,
368 main_Color_10_in_5
369 ) [instance: 10, cache: 1];
370 //
371 // node Transmitter[1]: x = 352, y = 386, inputs = 1, label = GreySphere
372 // page group: Glyph
373 //
374 GreySphere = main_Color_10_out_1;
375 //
376 // node Receiver[2]: x = 190, y = 350, inputs = 1, label = GreySphere
377 // page group: Grey Space
378 //
379 main_Receiver_2_out_1[cache: 0] = GreySphere;"""
380
381
382 text = text + """
383 //
384 // node Import[3]: x = 225, y = 84, inputs = 6, label = """ + self.file + """
385 // input[1]: defaulting = 0, visible = 1, type = 32, value = \"""" + self.file + """.general"
386 // input[3]: defaulting = 1, visible = 1, type = 32, value = "general"
387 // page group: Isosurfaces
388 //
389 main_Import_3_out_1 =
390 Import(
391 main_Import_3_in_1,
392 main_Import_3_in_2,
393 main_Import_3_in_3,
394 main_Import_3_in_4,
395 main_Import_3_in_5,
396 main_Import_3_in_6
397 ) [instance: 3, cache: 1];
398 //
399 // node Isosurface[5]: x = 102, y = 191, inputs = 6, label = Outer Isosurface
400 // input[2]: defaulting = 0, visible = 1, type = 5, value = 500.0
401 // page group: Isosurfaces
402 //
403 main_Isosurface_5_out_1 =
404 Isosurface(
405 main_Import_3_out_1,
406 main_Isosurface_5_in_2,
407 main_Isosurface_5_in_3,
408 main_Isosurface_5_in_4,
409 main_Isosurface_5_in_5,
410 main_Isosurface_5_in_6
411 ) [instance: 5, cache: 1];
412 //
413 // node Transmitter[7]: x = 110, y = 292, inputs = 1, label = Surface4
414 // page group: Isosurfaces
415 //
416 Surface4 = main_Isosurface_5_out_1;
417 //
418 // node Receiver[14]: x = 123, y = 51, inputs = 1, label = Surface4
419 // page group: Grey Space
420 //
421 main_Receiver_14_out_1[cache: 0] = Surface4;
422 //
423 // node Color[6]: x = 142, y = 145, inputs = 5, label = Color
424 // input[2]: defaulting = 0, visible = 1, type = 8, value = [0 0 0]
425 // input[3]: defaulting = 0, visible = 1, type = 5, value = 0.2
426 // page group: Grey Space
427 //
428 main_Color_6_out_1 =
429 Color(
430 main_Receiver_14_out_1,
431 main_Color_6_in_2,
432 main_Color_6_in_3,
433 main_Color_6_in_4,
434 main_Color_6_in_5
435 ) [instance: 6, cache: 1];
436 //
437 // node Isosurface[6]: x = 200, y = 191, inputs = 6, label = Middle Isosurface
438 // input[2]: defaulting = 0, visible = 1, type = 5, value = 100.0
439 // page group: Isosurfaces
440 //
441 main_Isosurface_6_out_1 =
442 Isosurface(
443 main_Import_3_out_1,
444 main_Isosurface_6_in_2,
445 main_Isosurface_6_in_3,
446 main_Isosurface_6_in_4,
447 main_Isosurface_6_in_5,
448 main_Isosurface_6_in_6
449 ) [instance: 6, cache: 1];
450 //
451 // node Transmitter[8]: x = 208, y = 292, inputs = 1, label = Surface3
452 // page group: Isosurfaces
453 //
454 Surface3 = main_Isosurface_6_out_1;
455 //
456 // node Receiver[13]: x = 227, y = 51, inputs = 1, label = Surface3
457 // page group: Grey Space
458 //
459 main_Receiver_13_out_1[cache: 0] = Surface3;
460 //
461 // node Color[7]: x = 246, y = 145, inputs = 5, label = Color
462 // input[2]: defaulting = 0, visible = 1, type = 8, value = [0.2 0.2 0.2]
463 // input[3]: defaulting = 0, visible = 1, type = 5, value = 0.2
464 // page group: Grey Space
465 //
466 main_Color_7_out_1 =
467 Color(
468 main_Receiver_13_out_1,
469 main_Color_7_in_2,
470 main_Color_7_in_3,
471 main_Color_7_in_4,
472 main_Color_7_in_5
473 ) [instance: 7, cache: 1];
474 //
475 // node Collect[5]: x = 203, y = 236, inputs = 2, label = Collect
476 // page group: Grey Space
477 //
478 main_Collect_5_out_1 =
479 Collect(
480 main_Color_6_out_1,
481 main_Color_7_out_1
482 ) [instance: 5, cache: 1];
483 //
484 // node Isosurface[7]: x = 298, y = 191, inputs = 6, label = Inner Isosurface
485 // input[2]: defaulting = 0, visible = 1, type = 5, value = 20.0
486 // page group: Isosurfaces
487 //
488 main_Isosurface_7_out_1 =
489 Isosurface(
490 main_Import_3_out_1,
491 main_Isosurface_7_in_2,
492 main_Isosurface_7_in_3,
493 main_Isosurface_7_in_4,
494 main_Isosurface_7_in_5,
495 main_Isosurface_7_in_6
496 ) [instance: 7, cache: 1];
497 //
498 // node Transmitter[9]: x = 306, y = 292, inputs = 1, label = Surface2
499 // page group: Isosurfaces
500 //
501 Surface2 = main_Isosurface_7_out_1;
502 //
503 // node Receiver[12]: x = 331, y = 51, inputs = 1, label = Surface2
504 // page group: Grey Space
505 //
506 main_Receiver_12_out_1[cache: 0] = Surface2;
507 //
508 // node Color[8]: x = 350, y = 145, inputs = 5, label = Color
509 // input[2]: defaulting = 0, visible = 1, type = 8, value = [0.5 0.5 0.5]
510 // input[3]: defaulting = 0, visible = 1, type = 5, value = 0.2
511 // page group: Grey Space
512 //
513 main_Color_8_out_1 =
514 Color(
515 main_Receiver_12_out_1,
516 main_Color_8_in_2,
517 main_Color_8_in_3,
518 main_Color_8_in_4,
519 main_Color_8_in_5
520 ) [instance: 8, cache: 1];
521 //
522 // node Isosurface[8]: x = 396, y = 191, inputs = 6, label = Innermost Isosurface
523 // input[2]: defaulting = 0, visible = 1, type = 5, value = 7.0
524 // page group: Isosurfaces
525 //
526 main_Isosurface_8_out_1 =
527 Isosurface(
528 main_Import_3_out_1,
529 main_Isosurface_8_in_2,
530 main_Isosurface_8_in_3,
531 main_Isosurface_8_in_4,
532 main_Isosurface_8_in_5,
533 main_Isosurface_8_in_6
534 ) [instance: 8, cache: 1];
535 //
536 // node Transmitter[10]: x = 404, y = 292, inputs = 1, label = Surface1
537 // page group: Isosurfaces
538 //
539 Surface1 = main_Isosurface_8_out_1;
540 //
541 // node Receiver[11]: x = 434, y = 51, inputs = 1, label = Surface1
542 // page group: Grey Space
543 //
544 main_Receiver_11_out_1[cache: 0] = Surface1;
545 //
546 // node Color[9]: x = 453, y = 145, inputs = 5, label = Color
547 // input[2]: defaulting = 0, visible = 1, type = 32, value = "white"
548 // input[3]: defaulting = 0, visible = 1, type = 5, value = 0.7
549 // page group: Grey Space
550 //
551 main_Color_9_out_1 =
552 Color(
553 main_Receiver_11_out_1,
554 main_Color_9_in_2,
555 main_Color_9_in_3,
556 main_Color_9_in_4,
557 main_Color_9_in_5
558 ) [instance: 9, cache: 1];
559 //
560 // node Collect[6]: x = 409, y = 236, inputs = 2, label = Collect
561 // page group: Grey Space
562 //
563 main_Collect_6_out_1 =
564 Collect(
565 main_Color_8_out_1,
566 main_Color_9_out_1
567 ) [instance: 6, cache: 1];
568 //
569 // node Collect[7]: x = 307, y = 327, inputs = 2, label = Collect
570 // page group: Grey Space
571 //
572 main_Collect_7_out_1 =
573 Collect(
574 main_Collect_5_out_1,
575 main_Collect_6_out_1
576 ) [instance: 7, cache: 1];
577 // """
578
579
580 if self.num_points == 1:
581 text = text + """
582 // node Collect[8]: x = 293, y = 431, inputs = 2, label = Collect
583 // page group: Grey Space
584 //
585 main_Collect_8_out_1 =
586 Collect(
587 main_Receiver_2_out_1,
588 main_Collect_7_out_1
589 ) [instance: 8, cache: 1];
590 //
591 // node Transmitter[4]: x = 282, y = 517, inputs = 1, label = GreySpace"""
592
593
594 else:
595 text = text + """
596 // node Transmitter[4]: x = 296, y = 439, inputs = 1, label = GreySpace"""
597
598
599 text = text + """
600 // page group: Grey Space
601 // """
602
603
604 if self.num_points == 1:
605 text = text + """
606 GreySpace = main_Collect_8_out_1;"""
607
608
609 else:
610 text = text + """
611 GreySpace = main_Collect_7_out_1;"""
612
613
614 text = text + """
615 //
616 // node Receiver[3]: x = 137, y = 57, inputs = 1, label = GreySpace
617 // page group: GreyScene
618 //
619 main_Receiver_3_out_1[cache: 0] = GreySpace;
620 //
621 // node Scale[3]: x = 163, y = 159, inputs = 2, label = Scale
622 // input[2]: defaulting = 0, visible = 1, type = 8, value = [1 1 1]
623 // page group: GreyScene
624 //
625 main_Scale_3_out_1 =
626 Scale(
627 main_Receiver_3_out_1,
628 main_Scale_3_in_2
629 ) [instance: 3, cache: 1];
630 //
631 // node AutoCamera[2]: x = 273, y = 264, inputs = 9, label = AutoCamera
632 // input[2]: defaulting = 0, visible = 1, type = 8, value = [1 -1 1]
633 // input[3]: defaulting = 0, visible = 1, type = 5, value = 500.0
634 // input[4]: defaulting = 0, visible = 0, type = 1, value = 640
635 // input[5]: defaulting = 0, visible = 0, type = 5, value = .75
636 // input[6]: defaulting = 0, visible = 0, type = 8, value = [-1 1 0 ]
637 // input[7]: defaulting = 0, visible = 0, type = 3, value = 0
638 // input[8]: defaulting = 0, visible = 0, type = 5, value = 30.0
639 // input[9]: defaulting = 0, visible = 1, type = 32, value = "white"
640 // page group: GreyScene
641 //
642 main_AutoCamera_2_out_1 =
643 AutoCamera(
644 main_Scale_3_out_1,
645 main_AutoCamera_2_in_2,
646 main_AutoCamera_2_in_3,
647 main_AutoCamera_2_in_4,
648 main_AutoCamera_2_in_5,
649 main_AutoCamera_2_in_6,
650 main_AutoCamera_2_in_7,
651 main_AutoCamera_2_in_8,
652 main_AutoCamera_2_in_9
653 ) [instance: 2, cache: 1];
654 //
655 // node AutoAxes[2]: x = 175, y = 379, inputs = 19, label = AutoAxes
656 // input[3]: defaulting = 0, visible = 1, type = 16777248, value = """ + labels + """
657 // input[4]: defaulting = 0, visible = 0, type = 1, value = 30
658 // input[5]: defaulting = 0, visible = 1, type = 16777224, value = """ + corners + """
659 // input[6]: defaulting = 0, visible = 1, type = 3, value = 1
660 // input[7]: defaulting = 1, visible = 0, type = 3, value = 1
661 // input[9]: defaulting = 0, visible = 1, type = 3, value = 1
662 // input[10]: defaulting = 0, visible = 1, type = 16777224, value = {[1 1 1] [0.1 0.1 0.1] [0 0 0] [0 0 0]}
663 // input[11]: defaulting = 0, visible = 1, type = 16777248, value = {"background" "grid" "labels" "ticks"}
664 // input[12]: defaulting = 0, visible = 0, type = 5, value = 0.4
665 // input[13]: defaulting = 0, visible = 0, type = 32, value = "area"
666 // input[14]: defaulting = 0, visible = 1, type = 16777221, value = """ + tick_locations[0] + """
667 // input[15]: defaulting = 0, visible = 1, type = 16777221, value = """ + tick_locations[1] + """
668 // input[16]: defaulting = 0, visible = 1, type = 16777221, value = """ + tick_locations[2] + """
669 // input[17]: defaulting = 0, visible = 1, type = 16777248, value = """ + tick_values[0] + """
670 // input[18]: defaulting = 0, visible = 1, type = 16777248, value = """ + tick_values[1] + """
671 // input[19]: defaulting = 0, visible = 1, type = 16777248, value = """ + tick_values[2] + """
672 // page group: GreyScene
673 //
674 main_AutoAxes_2_out_1 =
675 AutoAxes(
676 main_Scale_3_out_1,
677 main_AutoCamera_2_out_1,
678 main_AutoAxes_2_in_3,
679 main_AutoAxes_2_in_4,
680 main_AutoAxes_2_in_5,
681 main_AutoAxes_2_in_6,
682 main_AutoAxes_2_in_7,
683 main_AutoAxes_2_in_8,
684 main_AutoAxes_2_in_9,
685 main_AutoAxes_2_in_10,
686 main_AutoAxes_2_in_11,
687 main_AutoAxes_2_in_12,
688 main_AutoAxes_2_in_13,
689 main_AutoAxes_2_in_14,
690 main_AutoAxes_2_in_15,
691 main_AutoAxes_2_in_16,
692 main_AutoAxes_2_in_17,
693 main_AutoAxes_2_in_18,
694 main_AutoAxes_2_in_19
695 ) [instance: 2, cache: 1];
696 // """
697
698
699 if self.num_points == 1:
700 text = text + """
701 // node Color[11]: x = 133, y = 278, inputs = 5, label = Color
702 // input[2]: defaulting = 0, visible = 1, type = 8, value = [1 0 0]
703 // input[3]: defaulting = 0, visible = 1, type = 5, value = 1.0
704 // page group: Glyph
705 //
706 main_Color_11_out_1 =
707 Color(
708 main_Glyph_2_out_1,
709 main_Color_11_in_2,
710 main_Color_11_in_3,
711 main_Color_11_in_4,
712 main_Color_11_in_5
713 ) [instance: 11, cache: 1];
714 //
715 // node Transmitter[2]: x = 122, y = 386, inputs = 1, label = ColourSphere
716 // page group: Glyph
717 //
718 ColourSphere = main_Color_11_out_1;
719 //
720 // node Receiver[1]: x = 179, y = 349, inputs = 1, label = ColourSphere
721 // page group: Colour Space
722 //
723 main_Receiver_1_out_1[cache: 0] = ColourSphere;"""
724
725
726 text = text + """
727 //
728 // node Receiver[10]: x = 123, y = 51, inputs = 1, label = Surface4
729 // page group: Colour Space
730 //
731 main_Receiver_10_out_1[cache: 0] = Surface4;
732 //
733 // node Color[12]: x = 142, y = 145, inputs = 5, label = Color
734 // input[2]: defaulting = 0, visible = 1, type = 8, value = [0 0 0.2]
735 // input[3]: defaulting = 0, visible = 1, type = 5, value = 0.4
736 // input[4]: defaulting = 1, visible = 0, type = 32, value = NULL
737 // input[5]: defaulting = 1, visible = 0, type = 3, value = NULL
738 // page group: Colour Space
739 //
740 main_Color_12_out_1 =
741 Color(
742 main_Receiver_10_out_1,
743 main_Color_12_in_2,
744 main_Color_12_in_3,
745 main_Color_12_in_4,
746 main_Color_12_in_5
747 ) [instance: 12, cache: 1];
748 //
749 // node Receiver[9]: x = 227, y = 51, inputs = 1, label = Surface3
750 // page group: Colour Space
751 //
752 main_Receiver_9_out_1[cache: 0] = Surface3;
753 //
754 // node Color[13]: x = 246, y = 145, inputs = 5, label = Color
755 // input[2]: defaulting = 0, visible = 1, type = 32, value = "blue"
756 // input[3]: defaulting = 0, visible = 1, type = 5, value = 0.45
757 // page group: Colour Space
758 //
759 main_Color_13_out_1 =
760 Color(
761 main_Receiver_9_out_1,
762 main_Color_13_in_2,
763 main_Color_13_in_3,
764 main_Color_13_in_4,
765 main_Color_13_in_5
766 ) [instance: 13, cache: 1];
767 //
768 // node Collect[9]: x = 203, y = 236, inputs = 2, label = Collect
769 // page group: Colour Space
770 //
771 main_Collect_9_out_1 =
772 Collect(
773 main_Color_12_out_1,
774 main_Color_13_out_1
775 ) [instance: 9, cache: 1];
776 //
777 // node Receiver[8]: x = 331, y = 51, inputs = 1, label = Surface2
778 // page group: Colour Space
779 //
780 main_Receiver_8_out_1[cache: 0] = Surface2;
781 //
782 // node Color[14]: x = 350, y = 145, inputs = 5, label = Color
783 // input[2]: defaulting = 0, visible = 1, type = 8, value = [0.5 0.5 1]
784 // input[3]: defaulting = 0, visible = 1, type = 5, value = 0.3
785 // page group: Colour Space
786 //
787 main_Color_14_out_1 =
788 Color(
789 main_Receiver_8_out_1,
790 main_Color_14_in_2,
791 main_Color_14_in_3,
792 main_Color_14_in_4,
793 main_Color_14_in_5
794 ) [instance: 14, cache: 1];
795 //
796 // node Receiver[7]: x = 434, y = 51, inputs = 1, label = Surface1
797 // page group: Colour Space
798 //
799 main_Receiver_7_out_1[cache: 0] = Surface1;
800 //
801 // node Color[15]: x = 453, y = 145, inputs = 5, label = Color
802 // input[2]: defaulting = 0, visible = 1, type = 32, value = "white"
803 // input[3]: defaulting = 0, visible = 1, type = 5, value = 0.55
804 // input[4]: defaulting = 1, visible = 0, type = 32, value = "positions"
805 // page group: Colour Space
806 //
807 main_Color_15_out_1 =
808 Color(
809 main_Receiver_7_out_1,
810 main_Color_15_in_2,
811 main_Color_15_in_3,
812 main_Color_15_in_4,
813 main_Color_15_in_5
814 ) [instance: 15, cache: 1];
815 //
816 // node Collect[10]: x = 409, y = 236, inputs = 2, label = Collect
817 // page group: Colour Space
818 //
819 main_Collect_10_out_1 =
820 Collect(
821 main_Color_14_out_1,
822 main_Color_15_out_1
823 ) [instance: 10, cache: 1];
824 //
825 // node Collect[11]: x = 307, y = 327, inputs = 2, label = Collect
826 // page group: Colour Space
827 //
828 main_Collect_11_out_1 =
829 Collect(
830 main_Collect_9_out_1,
831 main_Collect_10_out_1
832 ) [instance: 11, cache: 1];
833 // """
834
835
836 if self.num_points == 1:
837 text = text + """
838 // node Collect[12]: x = 293, y = 431, inputs = 2, label = Collect
839 // page group: Colour Space
840 //
841 main_Collect_12_out_1 =
842 Collect(
843 main_Receiver_1_out_1,
844 main_Collect_11_out_1
845 ) [instance: 12, cache: 1];
846 //
847 // node Transmitter[3]: x = 276, y = 517, inputs = 1, label = ColourSpace"""
848
849
850 else:
851 text = text + """
852 // node Transmitter[3]: x = 290, y = 440, inputs = 1, label = ColourSpace"""
853
854
855 text = text + """
856 // page group: Colour Space
857 // """
858
859
860 if self.num_points == 1:
861 text = text + """
862 ColourSpace = main_Collect_12_out_1;"""
863
864
865 else:
866 text = text + """
867 ColourSpace = main_Collect_11_out_1;"""
868
869
870 text = text + """
871 //
872 // node Receiver[4]: x = 131, y = 58, inputs = 1, label = ColourSpace
873 // page group: ColourScene
874 //
875 main_Receiver_4_out_1[cache: 0] = ColourSpace;
876 //
877 // node Scale[5]: x = 163, y = 159, inputs = 2, label = Scale
878 // input[2]: defaulting = 0, visible = 1, type = 8, value = [1 1 1]
879 // page group: ColourScene
880 //
881 main_Scale_5_out_1 =
882 Scale(
883 main_Receiver_4_out_1,
884 main_Scale_5_in_2
885 ) [instance: 5, cache: 1];
886 //
887 // node AutoCamera[4]: x = 273, y = 264, inputs = 9, label = AutoCamera
888 // input[2]: defaulting = 0, visible = 1, type = 8, value = [1 -1 1]
889 // input[3]: defaulting = 0, visible = 1, type = 5, value = 500.0
890 // input[5]: defaulting = 0, visible = 0, type = 5, value = .75
891 // input[6]: defaulting = 0, visible = 0, type = 8, value = [-1 1 0 ]
892 // input[7]: defaulting = 0, visible = 0, type = 3, value = 0
893 // input[8]: defaulting = 0, visible = 0, type = 5, value = 30.0
894 // input[9]: defaulting = 0, visible = 1, type = 32, value = "black"
895 // page group: ColourScene
896 //
897 main_AutoCamera_4_out_1 =
898 AutoCamera(
899 main_Scale_5_out_1,
900 main_AutoCamera_4_in_2,
901 main_AutoCamera_4_in_3,
902 main_AutoCamera_4_in_4,
903 main_AutoCamera_4_in_5,
904 main_AutoCamera_4_in_6,
905 main_AutoCamera_4_in_7,
906 main_AutoCamera_4_in_8,
907 main_AutoCamera_4_in_9
908 ) [instance: 4, cache: 1];
909 //
910 // node AutoAxes[4]: x = 175, y = 379, inputs = 19, label = AutoAxes
911 // input[3]: defaulting = 0, visible = 1, type = 16777248, value = """ + labels + """
912 // input[4]: defaulting = 0, visible = 0, type = 1, value = 30
913 // input[5]: defaulting = 0, visible = 1, type = 16777224, value = """ + corners + """
914 // input[6]: defaulting = 0, visible = 1, type = 3, value = 1
915 // input[7]: defaulting = 1, visible = 0, type = 3, value = 1
916 // input[9]: defaulting = 0, visible = 1, type = 3, value = 1
917 // input[10]: defaulting = 0, visible = 1, type = 16777224, value = {[0.05 0.05 0.05] [0.3 0.3 0.3] [1 1 1] [1 1 0]}
918 // input[11]: defaulting = 0, visible = 1, type = 16777248, value = {"background" "grid" "labels" "ticks"}
919 // input[12]: defaulting = 0, visible = 0, type = 5, value = 0.4
920 // input[13]: defaulting = 0, visible = 0, type = 32, value = "area"
921 // input[14]: defaulting = 0, visible = 1, type = 16777221, value = """ + tick_locations[0] + """
922 // input[15]: defaulting = 0, visible = 1, type = 16777221, value = """ + tick_locations[1] + """
923 // input[16]: defaulting = 0, visible = 1, type = 16777221, value = """ + tick_locations[2] + """
924 // input[17]: defaulting = 0, visible = 1, type = 16777248, value = """ + tick_values[0] + """
925 // input[18]: defaulting = 0, visible = 1, type = 16777248, value = """ + tick_values[1] + """
926 // input[19]: defaulting = 0, visible = 1, type = 16777248, value = """ + tick_values[2] + """
927 // page group: ColourScene
928 //
929 main_AutoAxes_4_out_1 =
930 AutoAxes(
931 main_Scale_5_out_1,
932 main_AutoCamera_4_out_1,
933 main_AutoAxes_4_in_3,
934 main_AutoAxes_4_in_4,
935 main_AutoAxes_4_in_5,
936 main_AutoAxes_4_in_6,
937 main_AutoAxes_4_in_7,
938 main_AutoAxes_4_in_8,
939 main_AutoAxes_4_in_9,
940 main_AutoAxes_4_in_10,
941 main_AutoAxes_4_in_11,
942 main_AutoAxes_4_in_12,
943 main_AutoAxes_4_in_13,
944 main_AutoAxes_4_in_14,
945 main_AutoAxes_4_in_15,
946 main_AutoAxes_4_in_16,
947 main_AutoAxes_4_in_17,
948 main_AutoAxes_4_in_18,
949 main_AutoAxes_4_in_19
950 ) [instance: 4, cache: 1];
951 //
952 // node Selector[1]: x = 245, y = 66, inputs = 7, label = Selector
953 // input[1]: defaulting = 0, visible = 0, type = 32, value = "Selector_1"
954 // input[2]: defaulting = 0, visible = 0, type = 32, value = "Colour"
955 // input[3]: defaulting = 0, visible = 0, type = 29, value = 1
956 // input[4]: defaulting = 1, visible = 1, type = 16777248, value = { "Colour" "Grey" }
957 // input[5]: defaulting = 1, visible = 0, type = 16777245, value = { 1 2 }
958 // output[1]: visible = 1, type = 29, value = 1
959 // output[2]: visible = 1, type = 32, value = "Colour"
960 // page group: Image
961 //
962 //
963 // node Transmitter[6]: x = 299, y = 487, inputs = 1, label = ColourImage
964 // page group: ColourScene
965 //
966 ColourImage = main_AutoAxes_4_out_1;
967 //
968 // node Receiver[5]: x = 76, y = 190, inputs = 1, label = ColourImage
969 // page group: Image
970 //
971 main_Receiver_5_out_1[cache: 0] = ColourImage;
972 //
973 // node Transmitter[5]: x = 305, y = 489, inputs = 1, label = GreyImage
974 // page group: GreyScene
975 //
976 GreyImage = main_AutoAxes_2_out_1;
977 //
978 // node Receiver[6]: x = 199, y = 190, inputs = 1, label = GreyImage
979 // page group: Image
980 //
981 main_Receiver_6_out_1[cache: 0] = GreyImage;
982 //
983 // node Switch[1]: x = 177, y = 293, inputs = 3, label = Switch
984 // page group: Image
985 //
986 main_Switch_1_out_1 =
987 Switch(
988 main_Selector_1_out_1,
989 main_Receiver_5_out_1,
990 main_Receiver_6_out_1
991 ) [instance: 1, cache: 1];
992 //
993 // node Switch[14]: x = 325, y = 293, inputs = 3, label = Switch
994 // input[2]: defaulting = 0, visible = 1, type = 67108863, value = "black"
995 // input[3]: defaulting = 0, visible = 1, type = 67108863, value = "white"
996 // page group: Image
997 //
998 main_Switch_14_out_1 =
999 Switch(
1000 main_Selector_1_out_1,
1001 main_Switch_14_in_2,
1002 main_Switch_14_in_3
1003 ) [instance: 14, cache: 1];
1004 //
1005 // node Image[3]: x = 252, y = 424, inputs = 49, label = Image
1006 // input[1]: defaulting = 0, visible = 0, type = 67108863, value = "Image_3"
1007 // input[4]: defaulting = 0, visible = 0, type = 1, value = 1
1008 // input[5]: defaulting = 0, visible = 0, type = 8, value = """ + image_array1 + """
1009 // input[6]: defaulting = 0, visible = 0, type = 8, value = """ + image_array2 + """
1010 // input[7]: defaulting = 0, visible = 0, type = 5, value = """ + image_val + """
1011 // input[8]: defaulting = 0, visible = 0, type = 1, value = 1376
1012 // input[9]: defaulting = 0, visible = 0, type = 5, value = 0.678
1013 // input[10]: defaulting = 0, visible = 0, type = 8, value = [-0.109685 0.243133 0.963772]
1014 // input[11]: defaulting = 1, visible = 0, type = 5, value = 30.9877
1015 // input[12]: defaulting = 0, visible = 0, type = 1, value = 0
1016 // input[14]: defaulting = 0, visible = 0, type = 1, value = 1
1017 // input[15]: defaulting = 0, visible = 0, type = 32, value = "none"
1018 // input[16]: defaulting = 0, visible = 0, type = 32, value = "none"
1019 // input[17]: defaulting = 1, visible = 0, type = 1, value = 1
1020 // input[18]: defaulting = 1, visible = 0, type = 1, value = 1
1021 // input[19]: defaulting = 0, visible = 0, type = 1, value = 0
1022 // input[22]: defaulting = 1, visible = 1, type = 32, value = "black"
1023 // input[25]: defaulting = 0, visible = 0, type = 32, value = "iso"
1024 // input[26]: defaulting = 0, visible = 0, type = 32, value = "tiff"
1025 // input[29]: defaulting = 0, visible = 0, type = 3, value = 0
1026 // input[30]: defaulting = 1, visible = 0, type = 16777248, value = """ + labels + """
1027 // input[32]: defaulting = 1, visible = 0, type = 16777224, value = """ + corners + """
1028 // input[33]: defaulting = 0, visible = 0, type = 3, value = 1
1029 // input[34]: defaulting = 0, visible = 0, type = 3, value = 0
1030 // input[36]: defaulting = 0, visible = 0, type = 3, value = 1
1031 // input[41]: defaulting = 0, visible = 0, type = 32, value = "rotate"
1032 // input[42]: defaulting = 0, visible = 0, type = 32, value = "Surface"
1033 // page group: Image
1034 // title: value = Surface
1035 // depth: value = 24
1036 // window: position = (0.0000,0.0400), size = 0.9929x0.9276
1037 // internal caching: 1
1038 //
1039 main_Image_3_out_1,
1040 main_Image_3_out_2,
1041 main_Image_3_out_3 =
1042 Image(
1043 main_Image_3_in_1,
1044 main_Switch_1_out_1,
1045 main_Image_3_in_3,
1046 main_Image_3_in_4,
1047 main_Image_3_in_5,
1048 main_Image_3_in_6,
1049 main_Image_3_in_7,
1050 main_Image_3_in_8,
1051 main_Image_3_in_9,
1052 main_Image_3_in_10,
1053 main_Image_3_in_11,
1054 main_Image_3_in_12,
1055 main_Image_3_in_13,
1056 main_Image_3_in_14,
1057 main_Image_3_in_15,
1058 main_Image_3_in_16,
1059 main_Image_3_in_17,
1060 main_Image_3_in_18,
1061 main_Image_3_in_19,
1062 main_Image_3_in_20,
1063 main_Image_3_in_21,
1064 main_Switch_14_out_1,
1065 main_Image_3_in_23,
1066 main_Image_3_in_24,
1067 main_Image_3_in_25,
1068 main_Image_3_in_26,
1069 main_Image_3_in_27,
1070 main_Image_3_in_28,
1071 main_Image_3_in_29,
1072 main_Image_3_in_30,
1073 main_Image_3_in_31,
1074 main_Image_3_in_32,
1075 main_Image_3_in_33,
1076 main_Image_3_in_34,
1077 main_Image_3_in_35,
1078 main_Image_3_in_36,
1079 main_Image_3_in_37,
1080 main_Image_3_in_38,
1081 main_Image_3_in_39,
1082 main_Image_3_in_40,
1083 main_Image_3_in_41,
1084 main_Image_3_in_42,
1085 main_Image_3_in_43,
1086 main_Image_3_in_44,
1087 main_Image_3_in_45,
1088 main_Image_3_in_46,
1089 main_Image_3_in_47,
1090 main_Image_3_in_48,
1091 main_Image_3_in_49
1092 ) [instance: 3, cache: 1];
1093 // network: end of macro body
1094 CacheScene(main_Image_3_in_1, main_Image_3_out_1, main_Image_3_out_2);
1095 }"""
1096
1097
1098 if self.num_points == 1:
1099 text = text + """
1100 main_Import_4_in_1 = \"""" + self.point_file + """.general";
1101 main_Import_4_in_2 = NULL;
1102 main_Import_4_in_3 = NULL;
1103 main_Import_4_in_4 = NULL;
1104 main_Import_4_in_5 = NULL;
1105 main_Import_4_in_6 = NULL;
1106 main_Import_4_out_1 = NULL;
1107 main_Glyph_2_in_2 = "sphere";
1108 main_Glyph_2_in_3 = NULL;
1109 main_Glyph_2_in_4 = """ + sphere_size + """;
1110 main_Glyph_2_in_5 = 0.0;
1111 main_Glyph_2_in_6 = NULL;
1112 main_Glyph_2_in_7 = NULL;
1113 main_Glyph_2_out_1 = NULL;
1114 main_Color_10_in_2 = [0 0 0];
1115 main_Color_10_in_3 = 1.0;
1116 main_Color_10_in_4 = NULL;
1117 main_Color_10_in_5 = NULL;
1118 main_Color_10_out_1 = NULL;
1119 main_Transmitter_1_out_1 = NULL;
1120 main_Receiver_2_out_1 = NULL;"""
1121
1122
1123 text = text + """
1124 main_Import_3_in_1 = \"""" + self.file + """.general";
1125 main_Import_3_in_2 = NULL;
1126 main_Import_3_in_3 = NULL;
1127 main_Import_3_in_4 = NULL;
1128 main_Import_3_in_5 = NULL;
1129 main_Import_3_in_6 = NULL;
1130 main_Import_3_out_1 = NULL;
1131 main_Isosurface_5_in_2 = 500.0;
1132 main_Isosurface_5_in_3 = NULL;
1133 main_Isosurface_5_in_4 = NULL;
1134 main_Isosurface_5_in_5 = NULL;
1135 main_Isosurface_5_in_6 = NULL;
1136 main_Isosurface_5_out_1 = NULL;
1137 main_Transmitter_7_out_1 = NULL;
1138 main_Receiver_14_out_1 = NULL;
1139 main_Color_6_in_2 = [0 0 0];
1140 main_Color_6_in_3 = 0.2;
1141 main_Color_6_in_4 = NULL;
1142 main_Color_6_in_5 = NULL;
1143 main_Color_6_out_1 = NULL;
1144 main_Isosurface_6_in_2 = 100.0;
1145 main_Isosurface_6_in_3 = NULL;
1146 main_Isosurface_6_in_4 = NULL;
1147 main_Isosurface_6_in_5 = NULL;
1148 main_Isosurface_6_in_6 = NULL;
1149 main_Isosurface_6_out_1 = NULL;
1150 main_Transmitter_8_out_1 = NULL;
1151 main_Receiver_13_out_1 = NULL;
1152 main_Color_7_in_2 = [0.2 0.2 0.2];
1153 main_Color_7_in_3 = 0.2;
1154 main_Color_7_in_4 = NULL;
1155 main_Color_7_in_5 = NULL;
1156 main_Color_7_out_1 = NULL;
1157 main_Collect_5_out_1 = NULL;
1158 main_Isosurface_7_in_2 = 20.0;
1159 main_Isosurface_7_in_3 = NULL;
1160 main_Isosurface_7_in_4 = NULL;
1161 main_Isosurface_7_in_5 = NULL;
1162 main_Isosurface_7_in_6 = NULL;
1163 main_Isosurface_7_out_1 = NULL;
1164 main_Transmitter_9_out_1 = NULL;
1165 main_Receiver_12_out_1 = NULL;
1166 main_Color_8_in_2 = [0.5 0.5 0.5];
1167 main_Color_8_in_3 = 0.2;
1168 main_Color_8_in_4 = NULL;
1169 main_Color_8_in_5 = NULL;
1170 main_Color_8_out_1 = NULL;
1171 main_Isosurface_8_in_2 = 7.0;
1172 main_Isosurface_8_in_3 = NULL;
1173 main_Isosurface_8_in_4 = NULL;
1174 main_Isosurface_8_in_5 = NULL;
1175 main_Isosurface_8_in_6 = NULL;
1176 main_Isosurface_8_out_1 = NULL;
1177 main_Transmitter_10_out_1 = NULL;
1178 main_Receiver_11_out_1 = NULL;
1179 main_Color_9_in_2 = "white";
1180 main_Color_9_in_3 = 0.7;
1181 main_Color_9_in_4 = NULL;
1182 main_Color_9_in_5 = NULL;
1183 main_Color_9_out_1 = NULL;
1184 main_Collect_6_out_1 = NULL;
1185 main_Collect_7_out_1 = NULL;"""
1186
1187
1188 if self.num_points == 1:
1189 text = text + """
1190 main_Collect_8_out_1 = NULL;"""
1191
1192
1193 text = text + """
1194 main_Transmitter_4_out_1 = NULL;
1195 main_Receiver_3_out_1 = NULL;
1196 main_Scale_3_in_2 = [1 1 1];
1197 main_Scale_3_out_1 = NULL;
1198 main_AutoCamera_2_in_2 = [1 -1 1];
1199 main_AutoCamera_2_in_3 = 500.0;
1200 main_AutoCamera_2_in_4 = 640;
1201 main_AutoCamera_2_in_5 = .75;
1202 main_AutoCamera_2_in_6 = [-1 1 0 ];
1203 main_AutoCamera_2_in_7 = 0;
1204 main_AutoCamera_2_in_8 = 30.0;
1205 main_AutoCamera_2_in_9 = "white";
1206 main_AutoCamera_2_out_1 = NULL;
1207 main_AutoAxes_2_in_3 = """ + labels + """;
1208 main_AutoAxes_2_in_4 = 30;
1209 main_AutoAxes_2_in_5 = """ + corners + """;
1210 main_AutoAxes_2_in_6 = 1;
1211 main_AutoAxes_2_in_7 = NULL;
1212 main_AutoAxes_2_in_8 = NULL;
1213 main_AutoAxes_2_in_9 = 1;
1214 main_AutoAxes_2_in_10 = {[1 1 1] [0.1 0.1 0.1] [0 0 0] [0 0 0]};
1215 main_AutoAxes_2_in_11 = {"background" "grid" "labels" "ticks"};
1216 main_AutoAxes_2_in_12 = 0.4;
1217 main_AutoAxes_2_in_13 = "area";
1218 main_AutoAxes_2_in_14 = """ + tick_locations[0] + """;
1219 main_AutoAxes_2_in_15 = """ + tick_locations[1] + """;
1220 main_AutoAxes_2_in_16 = """ + tick_locations[2] + """;
1221 main_AutoAxes_2_in_17 = """ + tick_values[0] + """;
1222 main_AutoAxes_2_in_18 = """ + tick_values[1] + """;
1223 main_AutoAxes_2_in_19 = """ + tick_values[2] + """;
1224 main_AutoAxes_2_out_1 = NULL;"""
1225
1226
1227 if self.num_points == 1:
1228 text = text + """
1229 main_Color_11_in_2 = [1 0 0];
1230 main_Color_11_in_3 = 1.0;
1231 main_Color_11_in_4 = NULL;
1232 main_Color_11_in_5 = NULL;
1233 main_Color_11_out_1 = NULL;
1234 main_Transmitter_2_out_1 = NULL;
1235 main_Receiver_1_out_1 = NULL;"""
1236
1237
1238 text = text + """
1239 main_Receiver_10_out_1 = NULL;
1240 main_Color_12_in_2 = [0 0 0.2];
1241 main_Color_12_in_3 = 0.4;
1242 main_Color_12_in_4 = NULL;
1243 main_Color_12_in_5 = NULL;
1244 main_Color_12_out_1 = NULL;
1245 main_Receiver_9_out_1 = NULL;
1246 main_Color_13_in_2 = "blue";
1247 main_Color_13_in_3 = 0.45;
1248 main_Color_13_in_4 = NULL;
1249 main_Color_13_in_5 = NULL;
1250 main_Color_13_out_1 = NULL;
1251 main_Collect_9_out_1 = NULL;
1252 main_Receiver_8_out_1 = NULL;
1253 main_Color_14_in_2 = [0.5 0.5 1];
1254 main_Color_14_in_3 = 0.3;
1255 main_Color_14_in_4 = NULL;
1256 main_Color_14_in_5 = NULL;
1257 main_Color_14_out_1 = NULL;
1258 main_Receiver_7_out_1 = NULL;
1259 main_Color_15_in_2 = "white";
1260 main_Color_15_in_3 = 0.55;
1261 main_Color_15_in_4 = NULL;
1262 main_Color_15_in_5 = NULL;
1263 main_Color_15_out_1 = NULL;
1264 main_Collect_10_out_1 = NULL;
1265 main_Collect_11_out_1 = NULL;"""
1266
1267
1268 if self.num_points == 1:
1269 text = text + """
1270 main_Collect_12_out_1 = NULL;"""
1271
1272
1273 text = text + """
1274 main_Transmitter_3_out_1 = NULL;
1275 main_Receiver_4_out_1 = NULL;
1276 main_Scale_5_in_2 = [1 1 1];
1277 main_Scale_5_out_1 = NULL;
1278 main_AutoCamera_4_in_2 = [1 -1 1];
1279 main_AutoCamera_4_in_3 = 500.0;
1280 main_AutoCamera_4_in_4 = NULL;
1281 main_AutoCamera_4_in_5 = .75;
1282 main_AutoCamera_4_in_6 = [-1 1 0 ];
1283 main_AutoCamera_4_in_7 = 0;
1284 main_AutoCamera_4_in_8 = 30.0;
1285 main_AutoCamera_4_in_9 = "black";
1286 main_AutoCamera_4_out_1 = NULL;
1287 main_AutoAxes_4_in_3 = """ + labels + """;
1288 main_AutoAxes_4_in_4 = 30;
1289 main_AutoAxes_4_in_5 = """ + corners + """;
1290 main_AutoAxes_4_in_6 = 1;
1291 main_AutoAxes_4_in_7 = NULL;
1292 main_AutoAxes_4_in_8 = NULL;
1293 main_AutoAxes_4_in_9 = 1;
1294 main_AutoAxes_4_in_10 = {[0.05 0.05 0.05] [0.3 0.3 0.3] [1 1 1] [1 1 0]};
1295 main_AutoAxes_4_in_11 = {"background" "grid" "labels" "ticks"};
1296 main_AutoAxes_4_in_12 = 0.4;
1297 main_AutoAxes_4_in_13 = "area";
1298 main_AutoAxes_4_in_14 = """ + tick_locations[0] + """;
1299 main_AutoAxes_4_in_15 = """ + tick_locations[1] + """;
1300 main_AutoAxes_4_in_16 = """ + tick_locations[2] + """;
1301 main_AutoAxes_4_in_17 = """ + tick_values[0] + """;
1302 main_AutoAxes_4_in_18 = """ + tick_values[1] + """;
1303 main_AutoAxes_4_in_19 = """ + tick_values[2] + """;
1304 main_AutoAxes_4_out_1 = NULL;
1305 main_Selector_1_in_1 = "Selector_1";
1306 main_Selector_1_in_2 = "Colour" ;
1307 main_Selector_1_in_3 = 1 ;
1308 main_Selector_1_in_4 = NULL;
1309 main_Selector_1_in_5 = NULL;
1310 main_Selector_1_in_6 = NULL;
1311 main_Selector_1_in_7 = NULL;
1312 main_Selector_1_out_1 = 1 ;
1313 main_Transmitter_6_out_1 = NULL;
1314 main_Receiver_5_out_1 = NULL;
1315 main_Transmitter_5_out_1 = NULL;
1316 main_Receiver_6_out_1 = NULL;
1317 main_Switch_1_out_1 = NULL;
1318 main_Switch_14_in_2 = "black";
1319 main_Switch_14_in_3 = "white";
1320 main_Switch_14_out_1 = NULL;
1321 macro Image(
1322 id,
1323 object,
1324 where,
1325 useVector,
1326 to,
1327 from,
1328 width,
1329 resolution,
1330 aspect,
1331 up,
1332 viewAngle,
1333 perspective,
1334 options,
1335 buttonState = 1,
1336 buttonUpApprox = "none",
1337 buttonDownApprox = "none",
1338 buttonUpDensity = 1,
1339 buttonDownDensity = 1,
1340 renderMode = 0,
1341 defaultCamera,
1342 reset,
1343 backgroundColor,
1344 throttle,
1345 RECenable = 0,
1346 RECfile,
1347 RECformat,
1348 RECresolution,
1349 RECaspect,
1350 AAenable = 0,
1351 AAlabels,
1352 AAticks,
1353 AAcorners,
1354 AAframe,
1355 AAadjust,
1356 AAcursor,
1357 AAgrid,
1358 AAcolors,
1359 AAannotation,
1360 AAlabelscale,
1361 AAfont,
1362 interactionMode,
1363 title,
1364 AAxTickLocs,
1365 AAyTickLocs,
1366 AAzTickLocs,
1367 AAxTickLabels,
1368 AAyTickLabels,
1369 AAzTickLabels,
1370 webOptions) -> (
1371 object,
1372 camera,
1373 where)
1374 {
1375 ImageMessage(
1376 id,
1377 backgroundColor,
1378 throttle,
1379 RECenable,
1380 RECfile,
1381 RECformat,
1382 RECresolution,
1383 RECaspect,
1384 AAenable,
1385 AAlabels,
1386 AAticks,
1387 AAcorners,
1388 AAframe,
1389 AAadjust,
1390 AAcursor,
1391 AAgrid,
1392 AAcolors,
1393 AAannotation,
1394 AAlabelscale,
1395 AAfont,
1396 AAxTickLocs,
1397 AAyTickLocs,
1398 AAzTickLocs,
1399 AAxTickLabels,
1400 AAyTickLabels,
1401 AAzTickLabels,
1402 interactionMode,
1403 title,
1404 renderMode,
1405 buttonUpApprox,
1406 buttonDownApprox,
1407 buttonUpDensity,
1408 buttonDownDensity) [instance: 1, cache: 1];
1409 autoCamera =
1410 AutoCamera(
1411 object,
1412 "front",
1413 object,
1414 resolution,
1415 aspect,
1416 [0,1,0],
1417 perspective,
1418 viewAngle,
1419 backgroundColor) [instance: 1, cache: 1];
1420 realCamera =
1421 Camera(
1422 to,
1423 from,
1424 width,
1425 resolution,
1426 aspect,
1427 up,
1428 perspective,
1429 viewAngle,
1430 backgroundColor) [instance: 1, cache: 1];
1431 coloredDefaultCamera =
1432 UpdateCamera(defaultCamera,
1433 background=backgroundColor) [instance: 1, cache: 1];
1434 nullDefaultCamera =
1435 Inquire(defaultCamera,
1436 "is null + 1") [instance: 1, cache: 1];
1437 resetCamera =
1438 Switch(
1439 nullDefaultCamera,
1440 coloredDefaultCamera,
1441 autoCamera) [instance: 1, cache: 1];
1442 resetNull =
1443 Inquire(
1444 reset,
1445 "is null + 1") [instance: 2, cache: 1];
1446 reset =
1447 Switch(
1448 resetNull,
1449 reset,
1450 0) [instance: 2, cache: 1];
1451 whichCamera =
1452 Compute(
1453 "($0 != 0 || $1 == 0) ? 1 : 2",
1454 reset,
1455 useVector) [instance: 1, cache: 1];
1456 camera = Switch(
1457 whichCamera,
1458 resetCamera,
1459 realCamera) [instance: 3, cache: 1];
1460 AAobject =
1461 AutoAxes(
1462 object,
1463 camera,
1464 AAlabels,
1465 AAticks,
1466 AAcorners,
1467 AAframe,
1468 AAadjust,
1469 AAcursor,
1470 AAgrid,
1471 AAcolors,
1472 AAannotation,
1473 AAlabelscale,
1474 AAfont,
1475 AAxTickLocs,
1476 AAyTickLocs,
1477 AAzTickLocs,
1478 AAxTickLabels,
1479 AAyTickLabels,
1480 AAzTickLabels) [instance: 1, cache: 1];
1481 switchAAenable = Compute("$0+1",
1482 AAenable) [instance: 2, cache: 1];
1483 object = Switch(
1484 switchAAenable,
1485 object,
1486 AAobject) [instance:4, cache: 1];
1487 SWapproximation_options =
1488 Switch(
1489 buttonState,
1490 buttonUpApprox,
1491 buttonDownApprox) [instance: 5, cache: 1];
1492 SWdensity_options =
1493 Switch(
1494 buttonState,
1495 buttonUpDensity,
1496 buttonDownDensity) [instance: 6, cache: 1];
1497 HWapproximation_options =
1498 Format(
1499 "%s,%s",
1500 buttonDownApprox,
1501 buttonUpApprox) [instance: 1, cache: 1];
1502 HWdensity_options =
1503 Format(
1504 "%d,%d",
1505 buttonDownDensity,
1506 buttonUpDensity) [instance: 2, cache: 1];
1507 switchRenderMode = Compute(
1508 "$0+1",
1509 renderMode) [instance: 3, cache: 1];
1510 approximation_options = Switch(
1511 switchRenderMode,
1512 SWapproximation_options,
1513 HWapproximation_options) [instance: 7, cache: 1];
1514 density_options = Switch(
1515 switchRenderMode,
1516 SWdensity_options,
1517 HWdensity_options) [instance: 8, cache: 1];
1518 renderModeString = Switch(
1519 switchRenderMode,
1520 "software",
1521 "hardware")[instance: 9, cache: 1];
1522 object_tag = Inquire(
1523 object,
1524 "object tag")[instance: 3, cache: 1];
1525 annoted_object =
1526 Options(
1527 object,
1528 "send boxes",
1529 0,
1530 "cache",
1531 1,
1532 "object tag",
1533 object_tag,
1534 "ddcamera",
1535 whichCamera,
1536 "rendering approximation",
1537 approximation_options,
1538 "render every",
1539 density_options,
1540 "button state",
1541 buttonState,
1542 "rendering mode",
1543 renderModeString) [instance: 1, cache: 1];
1544 RECresNull =
1545 Inquire(
1546 RECresolution,
1547 "is null + 1") [instance: 4, cache: 1];
1548 ImageResolution =
1549 Inquire(
1550 camera,
1551 "camera resolution") [instance: 5, cache: 1];
1552 RECresolution =
1553 Switch(
1554 RECresNull,
1555 RECresolution,
1556 ImageResolution) [instance: 10, cache: 1];
1557 RECaspectNull =
1558 Inquire(
1559 RECaspect,
1560 "is null + 1") [instance: 6, cache: 1];
1561 ImageAspect =
1562 Inquire(
1563 camera,
1564 "camera aspect") [instance: 7, cache: 1];
1565 RECaspect =
1566 Switch(
1567 RECaspectNull,
1568 RECaspect,
1569 ImageAspect) [instance: 11, cache: 1];
1570 switchRECenable = Compute(
1571 "$0 == 0 ? 1 : (($2 == $3) && ($4 == $5)) ? ($1 == 1 ? 2 : 3) : 4",
1572 RECenable,
1573 switchRenderMode,
1574 RECresolution,
1575 ImageResolution,
1576 RECaspect,
1577 ImageAspect) [instance: 4, cache: 1];
1578 NoRECobject, RECNoRerenderObject, RECNoRerHW, RECRerenderObject = Route(switchRECenable, annoted_object);
1579 Display(
1580 NoRECobject,
1581 camera,
1582 where,
1583 throttle) [instance: 1, cache: 1];
1584 image =
1585 Render(
1586 RECNoRerenderObject,
1587 camera) [instance: 1, cache: 1];
1588 Display(
1589 image,
1590 NULL,
1591 where,
1592 throttle) [instance: 2, cache: 1];
1593 WriteImage(
1594 image,
1595 RECfile,
1596 RECformat) [instance: 1, cache: 1];
1597 rec_where = Display(
1598 RECNoRerHW,
1599 camera,
1600 where,
1601 throttle) [instance: 1, cache: 0];
1602 rec_image = ReadImageWindow(
1603 rec_where) [instance: 1, cache: 1];
1604 WriteImage(
1605 rec_image,
1606 RECfile,
1607 RECformat) [instance: 1, cache: 1];
1608 RECupdateCamera =
1609 UpdateCamera(
1610 camera,
1611 resolution=RECresolution,
1612 aspect=RECaspect) [instance: 2, cache: 1];
1613 Display(
1614 RECRerenderObject,
1615 camera,
1616 where,
1617 throttle) [instance: 1, cache: 1];
1618 RECRerenderObject =
1619 ScaleScreen(
1620 RECRerenderObject,
1621 NULL,
1622 RECresolution,
1623 camera) [instance: 1, cache: 1];
1624 image =
1625 Render(
1626 RECRerenderObject,
1627 RECupdateCamera) [instance: 2, cache: 1];
1628 WriteImage(
1629 image,
1630 RECfile,
1631 RECformat) [instance: 2, cache: 1];
1632 }
1633 main_Image_3_in_1 = "Image_3";
1634 main_Image_3_in_3 = "X24,,Surface";
1635 main_Image_3_in_4 = 1;
1636 main_Image_3_in_5 = """ + image_array1 + """;
1637 main_Image_3_in_6 = """ + image_array2 + """;
1638 main_Image_3_in_7 = """ + image_val + """;
1639 main_Image_3_in_8 = 1376;
1640 main_Image_3_in_9 = 0.678;
1641 main_Image_3_in_10 = [-0.109685 0.243133 0.963772];
1642 main_Image_3_in_11 = NULL;
1643 main_Image_3_in_12 = 0;
1644 main_Image_3_in_13 = NULL;
1645 main_Image_3_in_14 = 1;
1646 main_Image_3_in_15 = "none";
1647 main_Image_3_in_16 = "none";
1648 main_Image_3_in_17 = NULL;
1649 main_Image_3_in_18 = NULL;
1650 main_Image_3_in_19 = 0;
1651 main_Image_3_in_20 = NULL;
1652 main_Image_3_in_21 = NULL;
1653 main_Image_3_in_23 = NULL;
1654 main_Image_3_in_25 = "iso";
1655 main_Image_3_in_26 = "tiff";
1656 main_Image_3_in_27 = NULL;
1657 main_Image_3_in_28 = NULL;
1658 main_Image_3_in_29 = 0;
1659 main_Image_3_in_30 = NULL;
1660 main_Image_3_in_31 = NULL;
1661 main_Image_3_in_32 = NULL;
1662 main_Image_3_in_33 = 1;
1663 main_Image_3_in_34 = 0;
1664 main_Image_3_in_35 = NULL;
1665 main_Image_3_in_36 = 1;
1666 main_Image_3_in_37 = NULL;
1667 main_Image_3_in_38 = NULL;
1668 main_Image_3_in_39 = NULL;
1669 main_Image_3_in_40 = NULL;
1670 main_Image_3_in_41 = "rotate";
1671 main_Image_3_in_42 = "Surface";
1672 main_Image_3_in_43 = NULL;
1673 main_Image_3_in_44 = NULL;
1674 main_Image_3_in_45 = NULL;
1675 main_Image_3_in_46 = NULL;
1676 main_Image_3_in_47 = NULL;
1677 main_Image_3_in_48 = NULL;
1678 main_Image_3_in_49 = NULL;
1679 Executive("product version 4 3 2");
1680 $sync
1681 main();
1682 """
1683
1684 program_file.write(text)
1685
1686
1687 program_file.close()
1688