├── .Rhistory
├── .gitignore
├── .idea
├── PyPOFacets.iml
├── inspectionProfiles
│ └── Project_Default.xml
├── misc.xml
├── modules.xml
├── vcs.xml
└── workspace.xml
├── BOX
├── coordinates.m
└── facets.m
├── LICENSE
├── PLATE
├── coordinates.m
└── facets.m
├── PyPOFacetsReproducibilityPackage.zip
├── README.md
├── _config.yml
├── input_data_file_001.dat
├── input_data_file_002.dat
├── mappings.xlsx
├── modular_pypofacets.py
├── monolithic_pypofacets.py
├── output
├── modular
│ ├── 20180324210344
│ │ ├── E0.dat
│ │ ├── R.dat
│ │ └── plot.png
│ ├── 20180324210456
│ │ ├── E0.dat
│ │ ├── R.dat
│ │ └── plot.png
│ └── 20180324210621
│ │ ├── E0.dat
│ │ ├── R.dat
│ │ └── plot.png
├── monolithic
│ └── 20180324204832
│ │ ├── E0.dat
│ │ ├── R.dat
│ │ └── plot.png
└── provenance
│ ├── modular.dot
│ ├── modular.pdf
│ ├── modular.png
│ ├── modular.svg
│ ├── monolithic.dot
│ ├── monolithic.pdf
│ ├── monolithic.png
│ ├── monolithic.svg
│ ├── yw.dot
│ ├── yw.pdf
│ ├── yw.png
│ └── yw.svg
├── yw.properties
└── yw_monolithic_pypofacets.py
/.Rhistory:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gems-uff/pypofacets/d8167ddd6d658fa000d24871a55d9a9b280e7c5b/.Rhistory
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | .noworkflow/
2 |
--------------------------------------------------------------------------------
/.idea/PyPOFacets.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/.idea/inspectionProfiles/Project_Default.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/.idea/workspace.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 |
161 |
162 |
163 |
164 |
165 |
166 |
167 |
168 |
169 |
170 |
171 |
172 |
173 |
174 |
175 |
176 |
177 |
178 |
179 |
180 |
181 |
182 |
183 |
184 |
185 |
186 |
187 |
188 |
189 |
190 |
191 |
192 |
193 |
194 |
195 |
196 |
197 |
198 |
199 |
200 |
201 |
202 |
203 |
204 |
205 |
206 |
207 |
208 |
209 |
210 |
211 |
212 |
213 |
214 |
215 |
216 |
217 |
218 |
219 |
220 |
221 |
222 |
223 |
224 |
225 |
226 |
227 |
228 |
229 |
230 |
231 |
232 |
233 |
234 |
235 |
236 |
237 |
238 |
239 |
240 |
241 |
242 |
243 |
244 |
245 |
246 |
247 |
248 |
249 |
250 |
251 |
252 |
253 |
254 |
255 |
256 |
257 |
258 |
259 |
260 |
261 |
262 |
263 |
264 |
265 |
266 |
267 |
268 |
269 |
270 |
271 |
272 |
273 |
274 |
275 |
276 |
277 |
278 |
279 |
280 |
281 |
282 |
283 |
284 |
285 |
286 |
287 |
288 |
289 |
290 |
291 |
292 |
293 |
294 |
295 |
296 |
297 |
298 |
299 |
300 |
301 |
302 |
303 |
304 |
305 |
306 |
307 |
308 |
309 |
310 |
311 |
312 |
313 |
314 |
315 |
316 |
317 |
318 |
319 |
320 |
321 |
322 |
323 |
324 |
325 |
326 |
327 |
328 |
329 |
330 |
331 |
332 |
333 |
334 |
335 |
336 |
337 |
338 |
339 |
340 |
345 |
346 |
347 |
348 | file
349 | ilum
350 | rs
351 | dels
352 | e0_fi
353 | # @in input_model @as InputModel
354 | input_mode
355 | timest
356 | node3
357 | calculateincidentw
358 | rad
359 | Ep
360 | corr
361 | delstd
362 | nfcv
363 | ifla
364 | phr0
365 | thr0
366 | D0
367 | sth
368 | nverts
369 | ntria
370 | vind
371 | now
372 | com
373 | R
374 | input
375 | inputpol
376 | ipol
377 | Points
378 |
379 |
380 | function
381 | plot_3d_graph_model
382 | calculate_global_angles_and_directions
383 | input_model
384 | @
385 | in
386 |
387 |
388 |
389 |
390 |
391 |
392 |
393 |
394 |
395 |
396 |
397 |
398 |
399 |
400 |
401 |
402 |
403 |
404 |
405 |
406 |
407 |
408 |
409 |
410 |
411 |
412 |
413 |
414 |
415 |
416 |
417 |
418 |
419 |
420 |
421 |
422 |
423 |
424 |
425 |
426 |
427 |
428 |
429 |
430 |
431 |
432 |
433 |
434 |
435 |
436 |
437 |
438 |
439 |
440 |
441 |
442 |
443 |
444 |
445 |
446 |
447 |
448 |
449 |
450 |
451 |
452 |
453 |
454 |
455 |
456 |
457 |
458 |
459 |
460 |
461 |
462 | Spelling
463 |
464 |
465 |
466 |
467 | SpellCheckingInspection
468 |
469 |
470 |
471 |
472 |
473 |
474 |
475 |
476 |
477 |
478 |
479 |
480 |
481 |
482 |
483 |
484 |
485 |
486 |
487 |
488 |
489 |
490 |
491 |
492 |
493 |
494 |
495 |
496 |
497 |
498 |
499 |
500 |
501 |
502 |
503 |
504 |
505 |
506 |
507 |
508 |
509 |
510 |
511 |
512 |
513 |
514 |
515 |
516 |
517 |
518 |
519 |
520 |
521 |
522 |
523 |
524 |
525 |
526 |
527 |
528 |
529 |
530 |
531 |
532 |
533 |
534 |
535 |
536 |
537 |
538 |
539 |
540 |
541 |
542 |
543 |
544 |
545 |
546 |
547 |
548 |
549 |
550 |
551 |
552 |
553 |
554 |
555 |
556 |
557 |
558 |
559 |
560 |
561 |
562 |
563 |
564 |
565 |
566 |
567 |
568 |
569 |
570 |
571 |
572 |
573 |
574 |
575 |
576 |
577 |
578 |
579 |
580 |
581 |
582 |
583 |
584 |
585 |
586 |
587 |
588 |
589 |
590 |
591 |
592 |
593 |
594 |
595 |
596 |
597 |
598 |
599 |
600 |
601 |
602 |
603 |
604 |
605 |
606 |
607 |
608 |
609 |
610 |
611 |
612 |
613 |
614 |
615 |
616 |
617 |
618 |
619 |
620 |
621 |
622 |
623 |
624 |
625 |
626 |
627 |
628 |
629 |
630 |
631 |
632 |
633 |
634 |
635 |
636 |
637 |
638 |
639 |
640 |
641 |
642 |
643 |
644 |
645 |
646 |
647 |
648 |
649 |
650 |
651 |
652 |
653 |
654 |
655 |
656 |
657 |
658 |
659 |
660 |
661 |
662 |
663 |
664 |
665 |
666 |
667 |
668 |
669 |
670 |
671 |
672 |
673 |
674 |
675 |
676 |
677 |
678 |
679 |
680 |
681 |
682 |
683 |
684 |
685 |
686 |
687 |
688 |
689 |
690 |
691 |
692 |
693 |
694 |
695 |
696 |
697 |
698 |
699 |
700 |
701 |
702 |
703 |
704 |
705 |
706 |
707 |
708 |
709 |
710 |
711 |
712 |
713 |
714 |
715 |
716 |
717 |
718 |
719 |
720 |
721 |
722 |
723 |
724 |
725 |
726 |
727 |
728 |
729 |
730 |
731 |
732 |
733 |
734 |
735 |
736 |
737 |
738 |
739 | 1508016044948
740 |
741 |
742 | 1508016044948
743 |
744 |
745 |
746 |
747 |
748 |
749 |
750 |
751 |
752 |
753 |
754 |
755 |
756 |
757 |
758 |
759 |
760 |
761 |
762 |
763 |
764 |
765 |
766 |
767 |
768 |
769 |
770 |
771 |
772 |
773 |
774 |
775 |
776 | file://$PROJECT_DIR$/../DMTrabalho2PythonvsR2/teste_classifier_naive_bayes.py
777 |
778 |
779 |
780 |
781 |
782 |
783 |
784 |
785 |
786 |
787 |
788 |
789 |
790 |
791 |
792 |
793 |
794 |
795 |
796 |
797 |
798 |
799 |
800 |
801 |
802 |
803 |
804 |
805 |
806 |
807 |
808 |
809 |
810 |
811 |
812 |
813 |
814 |
815 |
816 |
817 |
818 |
819 |
820 |
821 |
822 |
823 |
824 |
825 |
826 |
827 |
828 |
829 |
830 |
831 |
832 |
833 |
834 |
835 |
836 |
837 |
838 |
839 |
840 |
841 |
842 |
843 |
844 |
845 |
846 |
847 |
848 |
849 |
850 |
851 |
852 |
853 |
854 |
855 |
856 |
857 |
858 |
859 |
860 |
861 |
862 |
863 |
864 |
865 |
866 |
867 |
868 |
869 |
870 |
871 |
872 |
873 |
874 |
875 |
876 |
877 |
878 |
879 |
880 |
881 |
882 |
883 |
884 |
885 |
886 |
--------------------------------------------------------------------------------
/BOX/coordinates.m:
--------------------------------------------------------------------------------
1 | 1.0000000e+02 0.0000000e+00 1.0000000e+02
2 | 0.0000000e+00 0.0000000e+00 1.0000000e+02
3 | 0.0000000e+00 0.0000000e+00 0.0000000e+00
4 | 1.0000000e+02 0.0000000e+00 0.0000000e+00
5 | 1.0000000e+02 1.0000000e+02 1.0000000e+02
6 | 1.0000000e+02 1.0000000e+02 0.0000000e+00
7 | 0.0000000e+00 1.0000000e+02 0.0000000e+00
8 | 0.0000000e+00 1.0000000e+02 1.0000000e+02
9 |
--------------------------------------------------------------------------------
/BOX/facets.m:
--------------------------------------------------------------------------------
1 | 1 1 2 3 1 0
2 | 2 7 3 2 1 0
3 | 3 4 1 3 1 0
4 | 4 8 2 1 1 0
5 | 5 6 1 4 1 0
6 | 6 7 4 3 1 0
7 | 7 1 6 5 1 0
8 | 8 8 5 6 1 0
9 | 10 8 1 5 1 0
10 | 11 7 6 4 1 0
11 | 12 8 6 7 1 0
12 | 9 2 8 7 1 0
13 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2018 Universidade Federal Fluminense (UFF).
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy of
6 | this software and associated documentation files (the "Software"), to deal in
7 | the Software without restriction, including without limitation the rights to
8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9 | the Software, and to permit persons to whom the Software is furnished to do so,
10 | subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 |
--------------------------------------------------------------------------------
/PLATE/coordinates.m:
--------------------------------------------------------------------------------
1 | 1.0000000e+01 1.0000000e+01 0.0000000e+01
2 | 0.0000000e+00 1.0000000e+01 0.0000000e+01
3 | 0.0000000e+00 0.0000000e+00 0.0000000e+00
4 | 1.0000000e+01 0.0000000e+00 0.0000000e+00
5 |
--------------------------------------------------------------------------------
/PLATE/facets.m:
--------------------------------------------------------------------------------
1 | 1 1 2 3 0 .0
2 | 2 4 1 3 0 .0
3 |
--------------------------------------------------------------------------------
/PyPOFacetsReproducibilityPackage.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gems-uff/pypofacets/d8167ddd6d658fa000d24871a55d9a9b280e7c5b/PyPOFacetsReproducibilityPackage.zip
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | PyPOFacets
2 | ==========
3 |
4 | Copyright (c) 2018 Universidade Federal Fluminense (UFF).
5 |
6 | The PyPOFacets project provides three Python implementations of the Radar Cross Section simulation. Our implementations are Python translations of the original MATLAB [POFacets](https://www.mathworks.com/matlabcentral/fileexchange/35861-pofacets4-1) implementation.
7 |
8 | Monolithic implementation
9 | -------------------------
10 |
11 | * [Script](https://github.com/gems-uff/pypofacets/blob/master/monolithic_pypofacets.py)
12 | * [Provenance graph](https://github.com/gems-uff/pypofacets/blob/master/output/provenance/monolithic.pdf) generated by [noWorkflow](http://gems-uff.github.io/noworkflow/)
13 |
14 | Monolithic implementation instrumented with YesWorkflow
15 | -------------------------------------------------------
16 |
17 | * [Script](https://github.com/gems-uff/pypofacets/blob/master/yw_monolithic_pypofacets.py)
18 | * [Provenance graph](https://github.com/gems-uff/pypofacets/blob/master/output/provenance/yw.pdf) generated by [YesWorkflow](https://github.com/yesworkflow-org/yw-prototypes/wiki)
19 |
20 | Modular implementation
21 | ----------------------
22 |
23 | * [Script](https://github.com/gems-uff/pypofacets/blob/master/modular_pypofacets.py)
24 | * [Provenance graph](https://github.com/gems-uff/pypofacets/blob/master/output/provenance/modular.pdf) generated by [noWorkflow](http://gems-uff.github.io/noworkflow/)
25 |
26 | Reproducibility instructions
27 | ----------------------
28 |
29 | Reproducibility instructions are available on the [PyPOFacets project wiki page](https://github.com/gems-uff/pypofacets/wiki).
30 |
31 | Included Software
32 | -----------------
33 |
34 | Parts of the following software were used by PyPoFacets directly or in an adapted form:
35 |
36 | POFacets
37 | Copyright (c) 2012 US g, David Jenn US government work and not subject to copyright
38 | All rights reserved.
39 |
40 | License
41 | -------
42 |
43 | The MIT License (MIT)
44 |
45 | Copyright (c) 2018 Universidade Federal Fluminense (UFF).
46 |
47 | Permission is hereby granted, free of charge, to any person obtaining a copy of
48 | this software and associated documentation files (the "Software"), to deal in
49 | the Software without restriction, including without limitation the rights to
50 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
51 | the Software, and to permit persons to whom the Software is furnished to do so,
52 | subject to the following conditions:
53 |
54 | The above copyright notice and this permission notice shall be included in all
55 | copies or substantial portions of the Software.
56 |
57 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
58 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
59 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
60 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
61 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
62 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
63 |
--------------------------------------------------------------------------------
/_config.yml:
--------------------------------------------------------------------------------
1 | title: PyPOFacets
2 | theme: jekyll-theme-cayman
3 |
--------------------------------------------------------------------------------
/input_data_file_001.dat:
--------------------------------------------------------------------------------
1 | # 1 radar frequency in Hz
2 | 15000000
3 | # 2 correlation distance in meters
4 | 0
5 | # 3 standard deviation in meters
6 | 0
7 | # 4 incident wave polarization
8 | 0
9 | # 5 start phi angle in degrees
10 | 0
11 | # 6 stop phi angle in degrees
12 | 0
13 | # 7 phi increment (step) in degrees
14 | 0
15 | # 8 start theta angle in degrees
16 | 0
17 | # 9 stop theta angle in degrees
18 | 360
19 | # 10 theta increment (step) in degrees
20 | 45
21 |
--------------------------------------------------------------------------------
/input_data_file_002.dat:
--------------------------------------------------------------------------------
1 | # 1 radar frequency in Hz
2 | 15000000
3 | # 2 correlation distance in meters
4 | 0
5 | # 3 standard deviation in meters
6 | 0
7 | # 4 incident wave polarization
8 | 0
9 | # 5 start phi angle in degrees
10 | 0
11 | # 6 stop phi angle in degrees
12 | 0
13 | # 7 phi increment (step) in degrees
14 | 0
15 | # 8 start theta angle in degrees
16 | 0
17 | # 9 stop theta angle in degrees
18 | 360
19 | # 10 theta increment (step) in degrees
20 | 90
--------------------------------------------------------------------------------
/mappings.xlsx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gems-uff/pypofacets/d8167ddd6d658fa000d24871a55d9a9b280e7c5b/mappings.xlsx
--------------------------------------------------------------------------------
/modular_pypofacets.py:
--------------------------------------------------------------------------------
1 | import sys
2 | import math
3 | import numpy as np
4 | import os
5 |
6 | from datetime import datetime
7 |
8 | RAD = math.pi / 180
9 | FILENAME_R = "R.dat"
10 | FILENAME_E0 = "E0.dat"
11 | FILENAME_PLOT = "plot.png"
12 |
13 |
14 | def read_args(argv):
15 | time = datetime.now().strftime("%Y%m%d%H%M%S")
16 | program_name = argv[0]
17 | input_data_file = argv[2]
18 | input_model = argv[1]
19 | if len(argv) < 4:
20 | output_dir = os.path.join("output", "modular", str(time))
21 | else:
22 | output_dir = argv[3]
23 | if not os.path.exists(output_dir):
24 | os.makedirs(output_dir)
25 | return time, program_name, input_data_file, input_model, output_dir
26 |
27 |
28 | def read_data_file_input(input_data_file):
29 | params = open(input_data_file, 'r')
30 | param_list = []
31 | for line in params:
32 | if not line.startswith("#"):
33 | param_list.append(int(line))
34 | params.close()
35 | return param_list
36 |
37 |
38 | def calculate_wavelength(freq):
39 | c = 3e8
40 | waveL = c / freq
41 | return waveL
42 |
43 |
44 | def calculate_incident_wave_polarization(ipol, waveL):
45 | if ipol == 0:
46 | et = 1 + 0j
47 | ep = 0 + 0j
48 | elif ipol == 1:
49 | et = 0 + 0j
50 | ep = 1 + 0j
51 | return (et, ep)
52 |
53 |
54 | def read_model_coordinates(input_model):
55 | fname = input_model + "/coordinates.m"
56 | coordinates = np.around(np.loadtxt(fname)).astype(int)
57 | xpts = coordinates[:, 0]
58 | ypts = coordinates[:, 1]
59 | zpts = coordinates[:, 2]
60 | nverts = len(xpts)
61 | return xpts, ypts, zpts, nverts
62 |
63 |
64 | def read_facets_model(input_model):
65 | fname2 = input_model + "/facets.m"
66 | facets = np.around(np.loadtxt(fname2)).astype(int)
67 | return facets
68 |
69 |
70 | def generate_transpose_matrix(facets):
71 | node1 = facets[:, 1]
72 | node2 = facets[:, 2]
73 | node3 = facets[:, 3]
74 | return node1, node2, node3
75 |
76 |
77 | def generate_coordinates_points(xpts, ypts, zpts, nverts):
78 | # r = list(zip(xpts, ypts, zpts))
79 | x = xpts
80 | y = ypts
81 | z = zpts
82 | r = [[x[i], y[i], z[i]]
83 | for i in range(nverts)]
84 | return r
85 |
86 |
87 | def plot_model(node1, node2, node3, r, output_dir):
88 | from mpl_toolkits.mplot3d import Axes3D
89 | import matplotlib.pyplot as plt
90 | ntria = len(node3)
91 | vind = [[node1[i], node2[i], node3[i]]
92 | for i in range(ntria)]
93 | fig1 = plt.figure()
94 | ax = Axes3D(fig1)
95 | for i in range(ntria):
96 | Xa = [int(r[int(vind[i][0]) - 1][0]), int(r[int(vind[i][1]) - 1][0]), int(r[int(vind[i][2]) - 1][0]),
97 | int(r[int(vind[i][0]) - 1][0])]
98 | Ya = [int(r[int(vind[i][0]) - 1][1]), int(r[int(vind[i][1]) - 1][1]), int(r[int(vind[i][2]) - 1][1]),
99 | int(r[int(vind[i][0]) - 1][1])]
100 | Za = [int(r[int(vind[i][0]) - 1][2]), int(r[int(vind[i][1]) - 1][2]), int(r[int(vind[i][2]) - 1][2]),
101 | int(r[int(vind[i][0]) - 1][2])]
102 | ax.plot3D(Xa, Ya, Za)
103 | ax.set_xlabel("X Axis")
104 | ax.set_title("3D Model: " + input_model)
105 | plt.savefig(os.path.join(output_dir, FILENAME_PLOT))
106 | plt.close()
107 |
108 |
109 | def calculate_refs_geometry_model(pstart, pstop, delp, tstart, tstop, delt):
110 | if delp == 0:
111 | delp = 1
112 | if pstart == pstop:
113 | phr0 = pstart * RAD
114 | if delt == 0:
115 | delt = 1
116 | if tstart == tstop:
117 | thr0 = tstart * RAD
118 | it = math.floor((tstop-tstart)/delt)+1
119 | ip = math.floor((pstop-pstart)/delp)+1
120 |
121 | return it, ip, delp, delt
122 |
123 |
124 | def prepare_output(time, program_name, input_data_file, input_model, output_dir, corr, delp, delstd, delt, freq, ipol, pstart, pstop, tstart, tstop):
125 | r_data = [
126 | time, program_name, input_data_file, input_model,
127 | freq, corr, delstd, ipol, pstart, pstop,
128 | delp, tstart, tstop, delt
129 | ]
130 | header = '\n'.join(map(str, r_data)) + '\n'
131 | fileE0 = open(os.path.join(output_dir, FILENAME_E0), 'w')
132 | fileR = open(os.path.join(output_dir, FILENAME_R), 'w')
133 | fileE0.write(header)
134 | fileR.write(header)
135 | fileR.close()
136 | fileE0.close()
137 |
138 | def calculate_global_angles_and_directions(ip, it, pstart, delp, tstart, delt):
139 | i2s = []
140 | D0 = []
141 | phi = []
142 | theta = []
143 | E = []
144 | for i1 in range(0, int(ip)):
145 | phi.append([])
146 | theta.append([])
147 | for i2 in range(0, int(it)):
148 | i2s.append((i1, i2))
149 | phi[i1].append(pstart + i1 * delp)
150 | phr = phi[i1][i2] * RAD
151 | theta[i1].append(tstart + i2 * delt)
152 | thr = theta[i1][i2] * RAD
153 | st = math.sin(thr)
154 | ct = math.cos(thr)
155 | cp = math.cos(phr)
156 | sp = math.sin(phr)
157 | D0.append([st * cp, st * sp, ct])
158 | E.append([ct * cp, ct * sp, -st, sp, cp])
159 |
160 | return i2s, D0, E
161 |
162 |
163 | def calculate_spherical_coordinate_system_radial_unit_vector(i2s, D0, output_dir):
164 | fileR = open(os.path.join(output_dir, FILENAME_R), 'a')
165 | for (i1, i2), elements in zip(i2s, D0):
166 | u, v, w = elements
167 | fileR.write(str(i2))
168 | fileR.write(" ")
169 | fileR.write(str(elements))
170 | fileR.write("\n")
171 | fileR.close()
172 |
173 |
174 | def calculate_incident_field_in_global_cartesian_coordinates(i2s, E, Et, Ep, output_dir):
175 | fileE0 = open(os.path.join(output_dir, FILENAME_E0), 'a')
176 | for (i1, i2), elements in zip(i2s, E):
177 | uu, vv, ww, sp, cp = elements
178 | incident_field = [(uu * Et - sp * Ep), (vv * Et + cp * Ep), (ww * Et)]
179 | fileE0.write(str(i2))
180 | fileE0.write(" ")
181 | fileE0.write(str(incident_field))
182 | fileE0.write("\n")
183 | fileE0.close()
184 |
185 |
186 | argv = sys.argv
187 |
188 | time, program_name, input_data_file, input_model, output_dir = read_args(argv)
189 |
190 | freq, corr, delstd, ipol, pstart, pstop, delp, tstart, tstop, delt = read_data_file_input(input_data_file)
191 |
192 | waveL = calculate_wavelength(freq)
193 |
194 | et, ep = calculate_incident_wave_polarization(ipol, waveL)
195 |
196 | xpts, ypts, zpts, nverts = read_model_coordinates(input_model)
197 |
198 | facets = read_facets_model(input_model)
199 |
200 | node1, node2, node3 = generate_transpose_matrix(facets)
201 |
202 | points = generate_coordinates_points(xpts, ypts, zpts, nverts)
203 |
204 | plot_model(node1, node2, node3, points, output_dir)
205 |
206 | it, ip, delp, delt = calculate_refs_geometry_model(pstart, pstop, delp, tstart, tstop, delt)
207 |
208 | prepare_output(time, program_name, input_data_file, input_model, output_dir, corr, delp, delstd, delt, freq, ipol, pstart, pstop, tstart, tstop)
209 |
210 | i2s, D0, E = calculate_global_angles_and_directions(ip, it, pstart, delp, tstart, delt)
211 |
212 | calculate_spherical_coordinate_system_radial_unit_vector(i2s, D0, output_dir)
213 |
214 | calculate_incident_field_in_global_cartesian_coordinates(i2s, E, et, ep, output_dir)
215 |
--------------------------------------------------------------------------------
/monolithic_pypofacets.py:
--------------------------------------------------------------------------------
1 | import sys
2 | import math
3 | import numpy as np
4 | import os
5 |
6 | from datetime import datetime
7 | from mpl_toolkits.mplot3d import Axes3D
8 | import matplotlib.pyplot as plt
9 |
10 | RAD = math.pi / 180
11 | FILENAME_R = "R.dat"
12 | FILENAME_E0 = "E0.dat"
13 | FILENAME_PLOT = "plot.png"
14 |
15 |
16 | argv = sys.argv
17 | time = datetime.now().strftime("%Y%m%d%H%M%S")
18 | program_name = argv[0]
19 | input_data_file = argv[2]
20 | input_model = argv[1]
21 | if len(argv) < 4:
22 | output_dir = os.path.join("output", "monolithic", str(time))
23 | else:
24 | output_dir = argv[3]
25 | if not os.path.exists(output_dir):
26 | os.makedirs(output_dir)
27 |
28 |
29 | params = open(input_data_file, 'r')
30 | param_list = []
31 | for line in params:
32 | if not line.startswith("#"):
33 | param_list.append(int(line))
34 | freq, corr, delstd, ipol, pstart, pstop, delp, tstart, tstop, delt = param_list
35 | params.close()
36 |
37 |
38 | c = 3e8
39 | waveL = c / freq
40 |
41 |
42 | if ipol == 0:
43 | et = 1 + 0j
44 | ep = 0 + 0j
45 | elif ipol == 1:
46 | et = 0 + 0j
47 | ep = 1 + 0j
48 |
49 |
50 | fname = input_model + "/coordinates.m"
51 | coordinates = np.loadtxt(fname)
52 | xpts = coordinates[:, 0]
53 | ypts = coordinates[:, 1]
54 | zpts = coordinates[:, 2]
55 | nverts = len(xpts)
56 |
57 |
58 | fname2 = input_model + "/facets.m"
59 | facets = np.loadtxt(fname2)
60 |
61 |
62 | node1 = facets[:, 1]
63 | node2 = facets[:, 2]
64 | node3 = facets[:, 3]
65 |
66 |
67 | x = xpts
68 | y = ypts
69 | z = zpts
70 | r = [[x[i], y[i], z[i]]
71 | for i in range(nverts)]
72 |
73 |
74 | ntria = len(node3)
75 | vind = [[node1[i], node2[i], node3[i]]
76 | for i in range(ntria)]
77 | now = datetime.now().strftime("%Y%m%d%H%M%S")
78 | fig1 = plt.figure()
79 | ax = Axes3D(fig1)
80 | for i in range(ntria):
81 | Xa = [int(r[int(vind[i][0])-1][0]), int(r[int(vind[i][1])-1][0]), int(r[int(vind[i][2])-1][0]), int(r[int(vind[i][0])-1][0])]
82 | Ya = [int(r[int(vind[i][0])-1][1]), int(r[int(vind[i][1])-1][1]), int(r[int(vind[i][2])-1][1]), int(r[int(vind[i][0])-1][1])]
83 | Za = [int(r[int(vind[i][0])-1][2]), int(r[int(vind[i][1])-1][2]), int(r[int(vind[i][2])-1][2]), int(r[int(vind[i][0])-1][2])]
84 | ax.plot3D(Xa, Ya, Za)
85 | ax.set_xlabel("X Axis")
86 | ax.set_title("3D Model: " + input_model)
87 | plt.savefig(os.path.join(output_dir, FILENAME_PLOT))
88 | plt.close()
89 |
90 |
91 | if delp == 0:
92 | delp = 1
93 | if pstart == pstop:
94 | phr0 = pstart*RAD
95 |
96 | if delt == 0:
97 | delt = 1
98 | if tstart == tstop:
99 | thr0 = tstart*RAD
100 |
101 | it = math.floor((tstop-tstart)/delt)+1
102 | ip = math.floor((pstop-pstart)/delp)+1
103 |
104 |
105 | r_data = [
106 | now, program_name, input_data_file, input_model,
107 | freq, corr, delstd, ipol, pstart, pstop,
108 | delp, tstart, tstop, delt
109 | ]
110 | header = '\n'.join(map(str, r_data)) + '\n'
111 | fileR = open(os.path.join(output_dir, FILENAME_R), 'w')
112 | fileE0 = open(os.path.join(output_dir, FILENAME_E0), 'w')
113 |
114 | fileR.write(header)
115 | fileE0.write(header)
116 |
117 |
118 | phi = []
119 | theta = []
120 | R = []
121 | e0 = []
122 | for i1 in range(0, int(ip)):
123 | for i2 in range(0, int(it)):
124 | phi.append(pstart + i1 * delp)
125 | phr = phi[i2] * RAD
126 | theta.append(tstart + i2 * delt)
127 | thr = theta[i2] * RAD
128 | st = math.sin(thr)
129 | ct = math.cos(thr)
130 | cp = math.cos(phr)
131 | sp = math.sin(phr)
132 | D0 = [st*cp, st*sp, ct]
133 | E = [ct*cp, ct*sp, -st, sp, cp]
134 | u, v, w = D0
135 | fileR.write(str(i2))
136 | fileR.write(" ")
137 | fileR.write(str([u, v, w]))
138 | fileR.write("\n")
139 | uu, vv, ww, sp, cp = E
140 | fileE0.write(str(i2))
141 | fileE0.write(" ")
142 | fileE0.write(str([(uu * et - sp * ep), (vv * et + cp * ep), (ww * et)]))
143 | fileE0.write("\n")
144 | fileR.close()
145 | fileE0.close()
146 |
--------------------------------------------------------------------------------
/output/modular/20180324210344/E0.dat:
--------------------------------------------------------------------------------
1 | 20180324210344
2 | modular_pypofacets.py
3 | input_data_file_002.dat
4 | BOX
5 | 15000000
6 | 0
7 | 0
8 | 0
9 | 0
10 | 0
11 | 1
12 | 0
13 | 360
14 | 90
15 | 0 [(1+0j), 0j, (-0+0j)]
16 | 1 [(6.123233995736766e-17+0j), 0j, (-1+0j)]
17 | 2 [(-1+0j), 0j, (-1.2246467991473532e-16+0j)]
18 | 3 [(-1.8369701987210297e-16+0j), 0j, (1+0j)]
19 | 4 [(1+0j), 0j, (2.4492935982947064e-16+0j)]
20 |
--------------------------------------------------------------------------------
/output/modular/20180324210344/R.dat:
--------------------------------------------------------------------------------
1 | 20180324210344
2 | modular_pypofacets.py
3 | input_data_file_002.dat
4 | BOX
5 | 15000000
6 | 0
7 | 0
8 | 0
9 | 0
10 | 0
11 | 1
12 | 0
13 | 360
14 | 90
15 | 0 [0.0, 0.0, 1.0]
16 | 1 [1.0, 0.0, 6.123233995736766e-17]
17 | 2 [1.2246467991473532e-16, 0.0, -1.0]
18 | 3 [-1.0, -0.0, -1.8369701987210297e-16]
19 | 4 [-2.4492935982947064e-16, -0.0, 1.0]
20 |
--------------------------------------------------------------------------------
/output/modular/20180324210344/plot.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gems-uff/pypofacets/d8167ddd6d658fa000d24871a55d9a9b280e7c5b/output/modular/20180324210344/plot.png
--------------------------------------------------------------------------------
/output/modular/20180324210456/E0.dat:
--------------------------------------------------------------------------------
1 | 20180324210456
2 | modular_pypofacets.py
3 | input_data_file_002.dat
4 | BOX
5 | 15000000
6 | 0
7 | 0
8 | 0
9 | 0
10 | 0
11 | 1
12 | 0
13 | 360
14 | 90
15 | 0 [(1+0j), 0j, (-0+0j)]
16 | 1 [(6.123233995736766e-17+0j), 0j, (-1+0j)]
17 | 2 [(-1+0j), 0j, (-1.2246467991473532e-16+0j)]
18 | 3 [(-1.8369701987210297e-16+0j), 0j, (1+0j)]
19 | 4 [(1+0j), 0j, (2.4492935982947064e-16+0j)]
20 |
--------------------------------------------------------------------------------
/output/modular/20180324210456/R.dat:
--------------------------------------------------------------------------------
1 | 20180324210456
2 | modular_pypofacets.py
3 | input_data_file_002.dat
4 | BOX
5 | 15000000
6 | 0
7 | 0
8 | 0
9 | 0
10 | 0
11 | 1
12 | 0
13 | 360
14 | 90
15 | 0 [0.0, 0.0, 1.0]
16 | 1 [1.0, 0.0, 6.123233995736766e-17]
17 | 2 [1.2246467991473532e-16, 0.0, -1.0]
18 | 3 [-1.0, -0.0, -1.8369701987210297e-16]
19 | 4 [-2.4492935982947064e-16, -0.0, 1.0]
20 |
--------------------------------------------------------------------------------
/output/modular/20180324210456/plot.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gems-uff/pypofacets/d8167ddd6d658fa000d24871a55d9a9b280e7c5b/output/modular/20180324210456/plot.png
--------------------------------------------------------------------------------
/output/modular/20180324210621/E0.dat:
--------------------------------------------------------------------------------
1 | 20180324210621
2 | modular_pypofacets.py
3 | input_data_file_002.dat
4 | BOX
5 | 15000000
6 | 0
7 | 0
8 | 0
9 | 0
10 | 0
11 | 1
12 | 0
13 | 360
14 | 90
15 | 0 [(1+0j), 0j, (-0+0j)]
16 | 1 [(6.123233995736766e-17+0j), 0j, (-1+0j)]
17 | 2 [(-1+0j), 0j, (-1.2246467991473532e-16+0j)]
18 | 3 [(-1.8369701987210297e-16+0j), 0j, (1+0j)]
19 | 4 [(1+0j), 0j, (2.4492935982947064e-16+0j)]
20 |
--------------------------------------------------------------------------------
/output/modular/20180324210621/R.dat:
--------------------------------------------------------------------------------
1 | 20180324210621
2 | modular_pypofacets.py
3 | input_data_file_002.dat
4 | BOX
5 | 15000000
6 | 0
7 | 0
8 | 0
9 | 0
10 | 0
11 | 1
12 | 0
13 | 360
14 | 90
15 | 0 [0.0, 0.0, 1.0]
16 | 1 [1.0, 0.0, 6.123233995736766e-17]
17 | 2 [1.2246467991473532e-16, 0.0, -1.0]
18 | 3 [-1.0, -0.0, -1.8369701987210297e-16]
19 | 4 [-2.4492935982947064e-16, -0.0, 1.0]
20 |
--------------------------------------------------------------------------------
/output/modular/20180324210621/plot.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gems-uff/pypofacets/d8167ddd6d658fa000d24871a55d9a9b280e7c5b/output/modular/20180324210621/plot.png
--------------------------------------------------------------------------------
/output/monolithic/20180324204832/E0.dat:
--------------------------------------------------------------------------------
1 | 20180324204832
2 | monolithic_pypofacets.py
3 | input_data_file_002.dat
4 | BOX
5 | 15000000
6 | 0
7 | 0
8 | 0
9 | 0
10 | 0
11 | 1
12 | 0
13 | 360
14 | 90
15 | 0 [(1+0j), 0j, (-0+0j)]
16 | 1 [(6.123233995736766e-17+0j), 0j, (-1+0j)]
17 | 2 [(-1+0j), 0j, (-1.2246467991473532e-16+0j)]
18 | 3 [(-1.8369701987210297e-16+0j), 0j, (1+0j)]
19 | 4 [(1+0j), 0j, (2.4492935982947064e-16+0j)]
20 |
--------------------------------------------------------------------------------
/output/monolithic/20180324204832/R.dat:
--------------------------------------------------------------------------------
1 | 20180324204832
2 | monolithic_pypofacets.py
3 | input_data_file_002.dat
4 | BOX
5 | 15000000
6 | 0
7 | 0
8 | 0
9 | 0
10 | 0
11 | 1
12 | 0
13 | 360
14 | 90
15 | 0 [0.0, 0.0, 1.0]
16 | 1 [1.0, 0.0, 6.123233995736766e-17]
17 | 2 [1.2246467991473532e-16, 0.0, -1.0]
18 | 3 [-1.0, -0.0, -1.8369701987210297e-16]
19 | 4 [-2.4492935982947064e-16, -0.0, 1.0]
20 |
--------------------------------------------------------------------------------
/output/monolithic/20180324204832/plot.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gems-uff/pypofacets/d8167ddd6d658fa000d24871a55d9a9b280e7c5b/output/monolithic/20180324204832/plot.png
--------------------------------------------------------------------------------
/output/provenance/modular.dot:
--------------------------------------------------------------------------------
1 | digraph dependency {
2 | rankdir=BT;
3 | ranksep=1;
4 | fontname=Helvetica;
5 | node[fontsize=26]
6 | v_1_38 [label="188 read_args" fillcolor="#3A85B9" fontcolor="white" shape="box" style="filled"];
7 | v_1_34 [label="186 argv" fillcolor="#85CBD0" fontcolor="black" shape="box" style="rounded,filled"];
8 | v_1_39 [label="188 input_data_file" fillcolor="#85CBD0" fontcolor="black" shape="box" style="rounded,filled"];
9 | v_1_40 [label="188 output_dir" fillcolor="#85CBD0" fontcolor="black" shape="box" style="rounded,filled"];
10 | v_1_41 [label="188 time" fillcolor="#85CBD0" fontcolor="black" shape="box" style="rounded,filled"];
11 | v_1_42 [label="188 input_model" fillcolor="#85CBD0" fontcolor="black" shape="box" style="rounded,filled"];
12 | v_1_43 [label="188 program_name" fillcolor="#85CBD0" fontcolor="black" shape="box" style="rounded,filled"];
13 | a_1 [label="input_data_file_002.dat" fillcolor="white" fontcolor="black" shape="box" style="rounded,filled"];
14 | v_1_46 [label="190 read_data_file_input" fillcolor="#3A85B9" fontcolor="white" shape="box" style="filled"];
15 | v_1_47 [label="190 delstd" fillcolor="#85CBD0" fontcolor="black" shape="box" style="rounded,filled"];
16 | v_1_48 [label="190 ipol" fillcolor="#85CBD0" fontcolor="black" shape="box" style="rounded,filled"];
17 | v_1_49 [label="190 tstart" fillcolor="#85CBD0" fontcolor="black" shape="box" style="rounded,filled"];
18 | v_1_50 [label="190 pstart" fillcolor="#85CBD0" fontcolor="black" shape="box" style="rounded,filled"];
19 | v_1_51 [label="190 delp" fillcolor="#85CBD0" fontcolor="black" shape="box" style="rounded,filled"];
20 | v_1_52 [label="190 delt" fillcolor="#85CBD0" fontcolor="black" shape="box" style="rounded,filled"];
21 | v_1_53 [label="190 corr" fillcolor="#85CBD0" fontcolor="black" shape="box" style="rounded,filled"];
22 | v_1_54 [label="190 tstop" fillcolor="#85CBD0" fontcolor="black" shape="box" style="rounded,filled"];
23 | v_1_55 [label="190 freq" fillcolor="#85CBD0" fontcolor="black" shape="box" style="rounded,filled"];
24 | v_1_56 [label="190 pstop" fillcolor="#85CBD0" fontcolor="black" shape="box" style="rounded,filled"];
25 | v_1_59 [label="192 calculate_wavelength" fillcolor="#3A85B9" fontcolor="white" shape="box" style="filled"];
26 | v_1_60 [label="192 waveL" fillcolor="#85CBD0" fontcolor="black" shape="box" style="rounded,filled"];
27 | v_1_63 [label="194 calculate_incident_wave_polarization" fillcolor="#3A85B9" fontcolor="white" shape="box" style="filled"];
28 | v_1_64 [label="194 et" fillcolor="#85CBD0" fontcolor="black" shape="box" style="rounded,filled"];
29 | v_1_65 [label="194 ep" fillcolor="#85CBD0" fontcolor="black" shape="box" style="rounded,filled"];
30 | a_2 [label="BOX/coordinates.m" fillcolor="white" fontcolor="black" shape="box" style="rounded,filled"];
31 | v_1_68 [label="196 read_model_coordinates" fillcolor="#3A85B9" fontcolor="white" shape="box" style="filled"];
32 | v_1_69 [label="196 ypts" fillcolor="#85CBD0" fontcolor="black" shape="box" style="rounded,filled"];
33 | v_1_70 [label="196 nverts" fillcolor="#85CBD0" fontcolor="black" shape="box" style="rounded,filled"];
34 | v_1_71 [label="196 xpts" fillcolor="#85CBD0" fontcolor="black" shape="box" style="rounded,filled"];
35 | v_1_72 [label="196 zpts" fillcolor="#85CBD0" fontcolor="black" shape="box" style="rounded,filled"];
36 | a_3 [label="BOX/facets.m" fillcolor="white" fontcolor="black" shape="box" style="rounded,filled"];
37 | v_1_75 [label="198 read_facets_model" fillcolor="#3A85B9" fontcolor="white" shape="box" style="filled"];
38 | v_1_76 [label="198 facets" fillcolor="#85CBD0" fontcolor="black" shape="box" style="rounded,filled"];
39 | v_1_80 [label="200 generate_transpose_matrix" fillcolor="#3A85B9" fontcolor="white" shape="box" style="filled"];
40 | v_1_81 [label="200 node1" fillcolor="#85CBD0" fontcolor="black" shape="box" style="rounded,filled"];
41 | v_1_82 [label="200 node3" fillcolor="#85CBD0" fontcolor="black" shape="box" style="rounded,filled"];
42 | v_1_83 [label="200 node2" fillcolor="#85CBD0" fontcolor="black" shape="box" style="rounded,filled"];
43 | v_1_89 [label="202 generate_coordinates_points" fillcolor="#3A85B9" fontcolor="white" shape="box" style="filled"];
44 | v_1_90 [label="202 points" fillcolor="#85CBD0" fontcolor="black" shape="box" style="rounded,filled"];
45 | a_6 [label="output/modular/20180324210456/plot.png" fillcolor="white" fontcolor="black" shape="box" style="rounded,filled"];
46 | v_1_96 [label="204 plot_model" fillcolor="#3A85B9" fontcolor="white" shape="box" style="filled"];
47 | v_1_99 [label="206 calculate_refs_geometry_model" fillcolor="#3A85B9" fontcolor="white" shape="box" style="filled"];
48 | v_1_100 [label="206 ip" fillcolor="#85CBD0" fontcolor="black" shape="box" style="rounded,filled"];
49 | v_1_101 [label="206 it" fillcolor="#85CBD0" fontcolor="black" shape="box" style="rounded,filled"];
50 | v_1_102 [label="206 delt" fillcolor="#85CBD0" fontcolor="black" shape="box" style="rounded,filled"];
51 | v_1_103 [label="206 delp" fillcolor="#85CBD0" fontcolor="black" shape="box" style="rounded,filled"];
52 | a_7 [label="output/modular/20180324210456/E0.dat" fillcolor="white" fontcolor="black" shape="box" style="rounded,filled"];
53 | a_8 [label="output/modular/20180324210456/R.dat" fillcolor="white" fontcolor="black" shape="box" style="rounded,filled"];
54 | v_1_106 [label="208 prepare_output" fillcolor="#3A85B9" fontcolor="white" shape="box" style="filled"];
55 | v_1_109 [label="210 calculate_global_angles_and_directions" fillcolor="#3A85B9" fontcolor="white" shape="box" style="filled"];
56 | v_1_110 [label="210 i2s" fillcolor="#85CBD0" fontcolor="black" shape="box" style="rounded,filled"];
57 | v_1_111 [label="210 E" fillcolor="#85CBD0" fontcolor="black" shape="box" style="rounded,filled"];
58 | v_1_112 [label="210 D0" fillcolor="#85CBD0" fontcolor="black" shape="box" style="rounded,filled"];
59 | v_1_117 [label="212 calculate_spherical_coord ... system_radial_unit_vector" fillcolor="#3A85B9" fontcolor="white" shape="box" style="filled"];
60 | v_1_122 [label="214 calculate_incident_field_ ... bal_cartesian_coordinates" fillcolor="#3A85B9" fontcolor="white" shape="box" style="filled"];
61 | v_1_49 -> v_1_46 [style=""];
62 | v_1_68 -> v_1_42 [style="dashed"];
63 | v_1_75 -> v_1_42 [style="dashed"];
64 | v_1_53 -> v_1_46 [style=""];
65 | v_1_64 -> v_1_63 [style=""];
66 | a_8 -> v_1_117 [style="dashed"];
67 | v_1_40 -> v_1_38 [style=""];
68 | v_1_96 -> v_1_81 [style="dashed"];
69 | v_1_106 -> v_1_43 [style="dashed"];
70 | v_1_71 -> v_1_68 [style=""];
71 | v_1_96 -> v_1_90 [style="dashed"];
72 | v_1_96 -> v_1_40 [style="dashed"];
73 | v_1_82 -> v_1_80 [style=""];
74 | a_7 -> v_1_122 [style="dashed"];
75 | v_1_106 -> v_1_103 [style="dashed"];
76 | v_1_75 -> a_3 [style="dashed"];
77 | v_1_39 -> v_1_38 [style=""];
78 | v_1_43 -> v_1_38 [style=""];
79 | v_1_106 -> v_1_49 [style="dashed"];
80 | v_1_99 -> v_1_52 [style="dashed"];
81 | v_1_106 -> v_1_53 [style="dashed"];
82 | v_1_109 -> v_1_102 [style="dashed"];
83 | v_1_89 -> v_1_70 [style="dashed"];
84 | v_1_52 -> v_1_46 [style=""];
85 | v_1_80 -> v_1_76 [style="dashed"];
86 | v_1_100 -> v_1_99 [style=""];
87 | v_1_122 -> v_1_40 [style="dashed"];
88 | v_1_89 -> v_1_69 [style="dashed"];
89 | v_1_42 -> v_1_38 [style=""];
90 | v_1_106 -> v_1_102 [style="dashed"];
91 | v_1_106 -> v_1_56 [style="dashed"];
92 | v_1_109 -> v_1_101 [style="dashed"];
93 | v_1_101 -> v_1_99 [style=""];
94 | v_1_117 -> v_1_110 [style="dashed"];
95 | v_1_106 -> v_1_47 [style="dashed"];
96 | v_1_122 -> v_1_110 [style="dashed"];
97 | v_1_69 -> v_1_68 [style=""];
98 | v_1_106 -> v_1_55 [style="dashed"];
99 | a_8 -> v_1_106 [style="dashed"];
100 | v_1_122 -> v_1_64 [style="dashed"];
101 | v_1_60 -> v_1_59 [style=""];
102 | v_1_56 -> v_1_46 [style=""];
103 | v_1_106 -> v_1_40 [style="dashed"];
104 | v_1_109 -> v_1_49 [style="dashed"];
105 | v_1_103 -> v_1_99 [style=""];
106 | v_1_46 -> a_1 [style="dashed"];
107 | v_1_48 -> v_1_46 [style=""];
108 | v_1_90 -> v_1_89 [style=""];
109 | v_1_99 -> v_1_51 [style="dashed"];
110 | v_1_117 -> v_1_112 [style="dashed"];
111 | v_1_89 -> v_1_71 [style="dashed"];
112 | v_1_117 -> v_1_40 [style="dashed"];
113 | v_1_51 -> v_1_46 [style=""];
114 | v_1_81 -> v_1_80 [style=""];
115 | v_1_76 -> v_1_75 [style=""];
116 | v_1_41 -> v_1_38 [style=""];
117 | v_1_99 -> v_1_54 [style="dashed"];
118 | v_1_109 -> v_1_100 [style="dashed"];
119 | v_1_70 -> v_1_68 [style=""];
120 | v_1_50 -> v_1_46 [style=""];
121 | v_1_112 -> v_1_109 [style=""];
122 | v_1_55 -> v_1_46 [style=""];
123 | v_1_106 -> v_1_42 [style="dashed"];
124 | v_1_106 -> v_1_39 [style="dashed"];
125 | v_1_106 -> v_1_54 [style="dashed"];
126 | v_1_122 -> v_1_65 [style="dashed"];
127 | v_1_63 -> v_1_60 [style="dashed"];
128 | v_1_96 -> v_1_83 [style="dashed"];
129 | v_1_106 -> v_1_41 [style="dashed"];
130 | v_1_54 -> v_1_46 [style=""];
131 | v_1_109 -> v_1_50 [style="dashed"];
132 | v_1_68 -> a_2 [style="dashed"];
133 | v_1_65 -> v_1_63 [style=""];
134 | v_1_110 -> v_1_109 [style=""];
135 | v_1_46 -> v_1_39 [style="dashed"];
136 | v_1_47 -> v_1_46 [style=""];
137 | v_1_111 -> v_1_109 [style=""];
138 | v_1_99 -> v_1_50 [style="dashed"];
139 | a_6 -> v_1_96 [style="dashed"];
140 | v_1_89 -> v_1_72 [style="dashed"];
141 | v_1_102 -> v_1_99 [style=""];
142 | v_1_63 -> v_1_48 [style="dashed"];
143 | v_1_106 -> v_1_48 [style="dashed"];
144 | v_1_106 -> v_1_50 [style="dashed"];
145 | v_1_109 -> v_1_103 [style="dashed"];
146 | v_1_83 -> v_1_80 [style=""];
147 | v_1_122 -> v_1_111 [style="dashed"];
148 | v_1_59 -> v_1_55 [style="dashed"];
149 | v_1_38 -> v_1_34 [style="dashed"];
150 | v_1_99 -> v_1_56 [style="dashed"];
151 | a_7 -> v_1_106 [style="dashed"];
152 | v_1_72 -> v_1_68 [style=""];
153 | v_1_99 -> v_1_49 [style="dashed"];
154 | v_1_96 -> v_1_82 [style="dashed"];
155 | }
156 |
--------------------------------------------------------------------------------
/output/provenance/modular.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gems-uff/pypofacets/d8167ddd6d658fa000d24871a55d9a9b280e7c5b/output/provenance/modular.pdf
--------------------------------------------------------------------------------
/output/provenance/modular.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gems-uff/pypofacets/d8167ddd6d658fa000d24871a55d9a9b280e7c5b/output/provenance/modular.png
--------------------------------------------------------------------------------
/output/provenance/modular.svg:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
908 |
--------------------------------------------------------------------------------
/output/provenance/monolithic.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gems-uff/pypofacets/d8167ddd6d658fa000d24871a55d9a9b280e7c5b/output/provenance/monolithic.pdf
--------------------------------------------------------------------------------
/output/provenance/monolithic.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gems-uff/pypofacets/d8167ddd6d658fa000d24871a55d9a9b280e7c5b/output/provenance/monolithic.png
--------------------------------------------------------------------------------
/output/provenance/yw.dot:
--------------------------------------------------------------------------------
1 |
2 | /* Start of top-level graph */
3 | digraph Workflow {
4 | rankdir=TB
5 |
6 | /* Title for graph */
7 | fontname=Helvetica; fontsize=18; labelloc=t
8 | label=yw_monolithic_pypofacets
9 |
10 | /* Start of double cluster for drawing box around nodes in workflow */
11 | subgraph cluster_workflow_box_outer { label=""; color=black; penwidth=2
12 | subgraph cluster_workflow_box_inner { label=""; penwidth=0
13 |
14 | /* Style for nodes representing atomic programs in workflow */
15 | node[shape=box style=filled fillcolor="#CCFFCC" peripheries=1 fontname=Helvetica]
16 |
17 | /* Nodes representing atomic programs in workflow */
18 | ReadArgs
19 | ReadDataFileInput
20 | CalculateWaveLength
21 | CalculateIncidentWavePolarization
22 | ReadModelCoordinates
23 | ReadFacetsModel
24 | GenerateTransposeMatrix
25 | GenerateCoordinatesPoints
26 | PlotModel
27 | CalculateRefsGeometryModel
28 | PrepareOutput
29 | CalculateGlobalAnglesAndDirections
30 | CalculateSphericalCoordinateSystemRadialUnitVector
31 | CalculateIncidentFieldInGlobalCartesianCoordinates
32 |
33 | /* Style for nodes representing non-parameter data channels in workflow */
34 | node[shape=box style="rounded,filled" fillcolor="#FFFFCC" peripheries=1 fontname=Helvetica]
35 |
36 | /* Nodes for non-parameter data channels in workflow */
37 | R_Output [shape=record rankdir=LR label="{ R_Output | file\:\{\{OutputDir\}/R.dat\}}"];
38 | E0_Output [shape=record rankdir=LR label="{ E0_Output | file\:\{\{OutputDir\}/E0.dat\}}"];
39 | PlotOutput [shape=record rankdir=LR label="{ PlotOutput | file\:\{\{OutputDir\}/plot.png\}}"];
40 | Arguments
41 | InputDataFileName
42 | InputDataFile [shape=record rankdir=LR label="{ InputDataFile | file\:\{InputDataFileName\}}"];
43 | Freq
44 | InputPolarization
45 | WaveLength
46 | InputModel
47 | CoordinatesFile [shape=record rankdir=LR label="{ CoordinatesFile | file\:\{InputModel\}/coordinates.m}"];
48 | FacetsFile [shape=record rankdir=LR label="{ FacetsFile | file\:\{InputModel\}/facets.m}"];
49 | Facets
50 | XPoints
51 | YPoints
52 | ZPoints
53 | Nverts
54 | Node1
55 | Node2
56 | Node3
57 | Points
58 | OutputDir
59 | PStart
60 | PStop
61 | InputDelP
62 | TStart
63 | TStop
64 | InputDelT
65 | Time
66 | ProgramName
67 | Corr
68 | Delstd
69 | IP
70 | IT
71 | DelP
72 | DelT
73 | D0
74 | E
75 | Et
76 | Ep
77 |
78 | /* Style for nodes representing parameter channels in workflow */
79 | node[shape=box style="rounded,filled" fillcolor="#FCFCFC" peripheries=1 fontname=Helvetica]
80 |
81 | /* Nodes representing parameter channels in workflow */
82 |
83 | /* Edges representing connections between programs and channels */
84 | ReadArgs -> Time
85 | ReadArgs -> ProgramName
86 | ReadArgs -> InputModel
87 | ReadArgs -> InputDataFileName
88 | ReadArgs -> OutputDir
89 | Arguments -> ReadArgs
90 | ReadDataFileInput -> Freq
91 | ReadDataFileInput -> Corr
92 | ReadDataFileInput -> Delstd
93 | ReadDataFileInput -> InputPolarization
94 | ReadDataFileInput -> PStart
95 | ReadDataFileInput -> PStop
96 | ReadDataFileInput -> InputDelP
97 | ReadDataFileInput -> TStart
98 | ReadDataFileInput -> TStop
99 | ReadDataFileInput -> InputDelT
100 | InputDataFileName -> ReadDataFileInput
101 | InputDataFile -> ReadDataFileInput
102 | CalculateWaveLength -> WaveLength
103 | Freq -> CalculateWaveLength
104 | CalculateIncidentWavePolarization -> Et
105 | CalculateIncidentWavePolarization -> Ep
106 | InputPolarization -> CalculateIncidentWavePolarization
107 | WaveLength -> CalculateIncidentWavePolarization
108 | ReadModelCoordinates -> XPoints
109 | ReadModelCoordinates -> YPoints
110 | ReadModelCoordinates -> ZPoints
111 | ReadModelCoordinates -> Nverts
112 | InputModel -> ReadModelCoordinates
113 | CoordinatesFile -> ReadModelCoordinates
114 | ReadFacetsModel -> Facets
115 | InputModel -> ReadFacetsModel
116 | FacetsFile -> ReadFacetsModel
117 | GenerateTransposeMatrix -> Node1
118 | GenerateTransposeMatrix -> Node2
119 | GenerateTransposeMatrix -> Node3
120 | Facets -> GenerateTransposeMatrix
121 | GenerateCoordinatesPoints -> Points
122 | XPoints -> GenerateCoordinatesPoints
123 | YPoints -> GenerateCoordinatesPoints
124 | ZPoints -> GenerateCoordinatesPoints
125 | Nverts -> GenerateCoordinatesPoints
126 | PlotModel -> PlotOutput
127 | Node1 -> PlotModel
128 | Node2 -> PlotModel
129 | Node3 -> PlotModel
130 | Points -> PlotModel
131 | OutputDir -> PlotModel
132 | CalculateRefsGeometryModel -> IT
133 | CalculateRefsGeometryModel -> IP
134 | CalculateRefsGeometryModel -> DelP
135 | CalculateRefsGeometryModel -> DelT
136 | PStart -> CalculateRefsGeometryModel
137 | PStop -> CalculateRefsGeometryModel
138 | InputDelP -> CalculateRefsGeometryModel
139 | TStart -> CalculateRefsGeometryModel
140 | TStop -> CalculateRefsGeometryModel
141 | InputDelT -> CalculateRefsGeometryModel
142 | PrepareOutput -> E0_Output
143 | PrepareOutput -> R_Output
144 | Time -> PrepareOutput
145 | ProgramName -> PrepareOutput
146 | InputDataFileName -> PrepareOutput
147 | InputModel -> PrepareOutput
148 | OutputDir -> PrepareOutput
149 | Corr -> PrepareOutput
150 | InputDelP -> PrepareOutput
151 | Delstd -> PrepareOutput
152 | InputDelT -> PrepareOutput
153 | Freq -> PrepareOutput
154 | InputPolarization -> PrepareOutput
155 | PStart -> PrepareOutput
156 | PStop -> PrepareOutput
157 | TStart -> PrepareOutput
158 | TStop -> PrepareOutput
159 | CalculateGlobalAnglesAndDirections -> D0
160 | CalculateGlobalAnglesAndDirections -> E
161 | IP -> CalculateGlobalAnglesAndDirections
162 | IT -> CalculateGlobalAnglesAndDirections
163 | PStart -> CalculateGlobalAnglesAndDirections
164 | DelP -> CalculateGlobalAnglesAndDirections
165 | TStart -> CalculateGlobalAnglesAndDirections
166 | DelT -> CalculateGlobalAnglesAndDirections
167 | CalculateSphericalCoordinateSystemRadialUnitVector -> R_Output
168 | IP -> CalculateSphericalCoordinateSystemRadialUnitVector
169 | IT -> CalculateSphericalCoordinateSystemRadialUnitVector
170 | D0 -> CalculateSphericalCoordinateSystemRadialUnitVector
171 | OutputDir -> CalculateSphericalCoordinateSystemRadialUnitVector
172 | CalculateIncidentFieldInGlobalCartesianCoordinates -> E0_Output
173 | IP -> CalculateIncidentFieldInGlobalCartesianCoordinates
174 | IT -> CalculateIncidentFieldInGlobalCartesianCoordinates
175 | E -> CalculateIncidentFieldInGlobalCartesianCoordinates
176 | Et -> CalculateIncidentFieldInGlobalCartesianCoordinates
177 | Ep -> CalculateIncidentFieldInGlobalCartesianCoordinates
178 | OutputDir -> CalculateIncidentFieldInGlobalCartesianCoordinates
179 |
180 | /* End of double cluster for drawing box around nodes in workflow */
181 | }}
182 |
183 | /* Style for nodes representing workflow input ports */
184 | node[shape=circle style="rounded,filled" fillcolor="#FFFFFF" peripheries=1 fontname=Helvetica width=0.2]
185 |
186 | /* Nodes representing workflow input ports */
187 | Arguments_input_port [label=""]
188 | CoordinatesFile_input_port [label=""]
189 | FacetsFile_input_port [label=""]
190 | InputDataFile_input_port [label=""]
191 |
192 | /* Style for nodes representing workflow output ports */
193 | node[shape=circle style="rounded,filled" fillcolor="#FFFFFF" peripheries=1 fontname=Helvetica width=0.2]
194 |
195 | /* Nodes representing workflow output ports */
196 | R_Output_output_port [label=""]
197 | E0_Output_output_port [label=""]
198 | PlotOutput_output_port [label=""]
199 |
200 | /* Edges from input ports to channels */
201 | Arguments_input_port -> Arguments
202 | CoordinatesFile_input_port -> CoordinatesFile
203 | FacetsFile_input_port -> FacetsFile
204 | InputDataFile_input_port -> InputDataFile
205 |
206 | /* Edges from channels to output ports */
207 | R_Output -> R_Output_output_port
208 | E0_Output -> E0_Output_output_port
209 | PlotOutput -> PlotOutput_output_port
210 |
211 | /* End of top-level graph */
212 | {rank=same R_Output_output_port E0_Output_output_port PlotOutput_output_port}
213 | {rank=same Arguments_input_port CoordinatesFile_input_port FacetsFile_input_port InputDataFile_input_port}
214 | }
215 |
--------------------------------------------------------------------------------
/output/provenance/yw.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gems-uff/pypofacets/d8167ddd6d658fa000d24871a55d9a9b280e7c5b/output/provenance/yw.pdf
--------------------------------------------------------------------------------
/output/provenance/yw.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gems-uff/pypofacets/d8167ddd6d658fa000d24871a55d9a9b280e7c5b/output/provenance/yw.png
--------------------------------------------------------------------------------
/yw.properties:
--------------------------------------------------------------------------------
1 | # graph configuration
2 | graph.view = combined
3 | graph.layout = tb
4 | graph.workflowbox = show
5 | graph.portlayout = relax
6 | graph.datalabel = both
--------------------------------------------------------------------------------
/yw_monolithic_pypofacets.py:
--------------------------------------------------------------------------------
1 |
2 | import sys
3 | import math
4 | import numpy as np
5 | import os
6 |
7 | from datetime import datetime
8 | from mpl_toolkits.mplot3d import Axes3D
9 | import matplotlib.pyplot as plt
10 |
11 | RAD = math.pi / 180
12 | FILENAME_R = "R.dat"
13 | FILENAME_E0 = "E0.dat"
14 | FILENAME_PLOT = "plot.png"
15 |
16 |
17 | # @begin yw_monolithic_pypofacets
18 | # @in argv @as Arguments
19 | # @in fname @as CoordinatesFile @URI file:{InputModel}/coordinates.m
20 | # @in fname2 @as FacetsFile @URI file:{InputModel}/facets.m
21 | # @in fname3 @as InputDataFile @URI file:{InputDataFileName}
22 | # @out r_file @as R_Output @URI file:{{OutputDir}/R.dat}
23 | # @out e0_file @as E0_Output @URI file:{{OutputDir}/E0.dat}
24 | # @out plot_file @as PlotOutput @URI file:{{OutputDir}/plot.png}
25 |
26 |
27 | # @begin ReadArgs
28 | # @in argv @as Arguments
29 | # @out time @as Time
30 | # @out program_name @as ProgramName
31 | # @out input_model @as InputModel
32 | # @out input_data_file @as InputDataFileName
33 | # @out output_dir @as OutputDir
34 | argv = sys.argv
35 | time = datetime.now().strftime("%Y%m%d%H%M%S")
36 | program_name = argv[0]
37 | input_data_file = argv[2]
38 | input_model = argv[1]
39 | if len(argv) < 4:
40 | output_dir = os.path.join("output", "yw_monolithic", str(time))
41 | else:
42 | output_dir = argv[3]
43 | if not os.path.exists(output_dir):
44 | os.makedirs(output_dir)
45 | # @end ReadArgs
46 |
47 |
48 | # @begin ReadDataFileInput
49 | # @in input_data_file @as InputDataFileName
50 | # @in fname3 @as InputDataFile @URI file:{input_data_file}
51 | # @out freq @as Freq
52 | # @out corr @as Corr
53 | # @out delstd @as Delstd
54 | # @out ipol @as InputPolarization
55 | # @out pstart @as PStart
56 | # @out pstop @as PStop
57 | # @out delp @as InputDelP
58 | # @out tstart @as TStart
59 | # @out tstop @as TStop
60 | # @out delt @as InputDelT
61 | params = open(input_data_file, 'r')
62 | param_list = []
63 | for line in params:
64 | if not line.startswith("#"):
65 | param_list.append(int(line))
66 | freq, corr, delstd, ipol, pstart, pstop, delp, tstart, tstop, delt = param_list
67 | params.close()
68 | # @end ReadDataFileInput
69 |
70 |
71 | # @begin CalculateWaveLength
72 | # @in freq @as Freq
73 | # @out waveL @as WaveLength
74 | c = 3e8
75 | waveL = c / freq
76 | # @end CalculateWaveLength
77 |
78 |
79 | # @begin CalculateIncidentWavePolarization
80 | # @in ipol @as InputPolarization
81 | # @in waveL @as WaveLength
82 | # @out et @as Et
83 | # @out ep @as Ep
84 | if ipol == 0:
85 | et = 1 + 0j
86 | ep = 0 + 0j
87 | elif ipol == 1:
88 | et = 0 + 0j
89 | ep = 1 + 0j
90 | # @end CalculateIncidentWavePolarization
91 |
92 |
93 | # @begin ReadModelCoordinates
94 | # @in input_model @as InputModel
95 | # @in fname @as CoordinatesFile @URI file:{input_model}/coordinates.m
96 | # @out xpts @as XPoints
97 | # @out ypts @as YPoints
98 | # @out zpts @as ZPoints
99 | # @out nverts @as Nverts
100 | fname = input_model + "/coordinates.m"
101 | coordinates = np.loadtxt(fname)
102 | xpts = coordinates[:, 0]
103 | ypts = coordinates[:, 1]
104 | zpts = coordinates[:, 2]
105 | nverts = len(xpts)
106 | # @end ReadModelCoordinates
107 |
108 |
109 | # @begin ReadFacetsModel
110 | # @in input_model @as InputModel
111 | # @in fname2 @as FacetsFile @URI file:{input_model}/facets.m
112 | # @out facets @as Facets
113 | fname2 = input_model + "/facets.m"
114 | facets = np.loadtxt(fname2)
115 | # @end ReadFacetsModel
116 |
117 |
118 | # @begin GenerateTransposeMatrix
119 | # @in facets @as Facets
120 | # @out node1 @as Node1
121 | # @out node2 @as Node2
122 | # @out node3 @as Node3
123 | node1 = facets[:, 1]
124 | node2 = facets[:, 2]
125 | node3 = facets[:, 3]
126 | # @end GenerateTransposeMatrix
127 |
128 |
129 | # @begin GenerateCoordinatesPoints
130 | # @in xpts @as XPoints
131 | # @in ypts @as YPoints
132 | # @in zpts @as ZPoints
133 | # @in nverts @as Nverts
134 | # @out r @as Points
135 | x = xpts
136 | y = ypts
137 | z = zpts
138 | r = [[x[i], y[i], z[i]]
139 | for i in range(nverts)]
140 | # @end GenerateCoordinatesPoints
141 |
142 |
143 | # @begin PlotModel
144 | # @in node1 @as Node1
145 | # @in node1 @as Node2
146 | # @in node3 @as Node3
147 | # @in r @as Points
148 | # @in output_dir @as OutputDir
149 | # @out plot_file @as PlotOutput @URI file:{{OutputDir}/plot.png}
150 | ntria = len(node3)
151 | vind = [[node1[i], node2[i], node3[i]]
152 | for i in range(ntria)]
153 | fig1 = plt.figure()
154 | ax = Axes3D(fig1)
155 | for i in range(ntria):
156 | Xa = [int(r[int(vind[i][0])-1][0]), int(r[int(vind[i][1])-1][0]), int(r[int(vind[i][2])-1][0]), int(r[int(vind[i][0])-1][0])]
157 | Ya = [int(r[int(vind[i][0])-1][1]), int(r[int(vind[i][1])-1][1]), int(r[int(vind[i][2])-1][1]), int(r[int(vind[i][0])-1][1])]
158 | Za = [int(r[int(vind[i][0])-1][2]), int(r[int(vind[i][1])-1][2]), int(r[int(vind[i][2])-1][2]), int(r[int(vind[i][0])-1][2])]
159 | ax.plot3D(Xa, Ya, Za)
160 | ax.set_xlabel("X Axis")
161 | ax.set_title("3D Model: " + input_model)
162 | plt.savefig(os.path.join(output_dir, FILENAME_PLOT))
163 | plt.close()
164 | # @end PlotModel
165 |
166 |
167 | # @begin CalculateRefsGeometryModel
168 | # @in pstart @as PStart
169 | # @in pstop @as PStop
170 | # @in delp @as InputDelP
171 | # @in tstart @as TStart
172 | # @in tstop @as TStop
173 | # @in delt @as InputDelT
174 | # @out it @as IT
175 | # @out ip @as IP
176 | # @out delp @as DelP
177 | # @out delt @as DelT
178 | if delp == 0:
179 | delp = 1
180 | if pstart == pstop:
181 | phr0 = pstart*RAD
182 |
183 | if delt == 0:
184 | delt = 1
185 | if tstart == tstop:
186 | thr0 = tstart*RAD
187 |
188 | it = math.floor((tstop-tstart)/delt)+1
189 | ip = math.floor((pstop-pstart)/delp)+1
190 | # @end CalculateRefsGeometryModel
191 |
192 |
193 | # @begin PrepareOutput
194 | # @in time @as Time
195 | # @in program_name @as ProgramName
196 | # @in input_data_file @as InputDataFileName
197 | # @in input_model @as InputModel
198 | # @in output_dir @as OutputDir
199 | # @in corr @as Corr
200 | # @in delp @as InputDelP
201 | # @in delstd @as Delstd
202 | # @in delt @as InputDelT
203 | # @in freq @as Freq
204 | # @in ipol @as InputPolarization
205 | # @in pstart @as PStart
206 | # @in pstop @as PStop
207 | # @in tstart @as TStart
208 | # @in tstop @as TStop
209 | # @out e0_file @as E0_Output @URI file:{{OutputDir}/E0.dat}
210 | # @out r_file @as R_Output @URI file:{{OutputDir}/R.dat}
211 | r_data = [
212 | time, program_name, input_data_file, input_model,
213 | freq, corr, delstd, ipol, pstart, pstop,
214 | delp, tstart, tstop, delt
215 | ]
216 | header = '\n'.join(map(str, r_data)) + '\n'
217 | fileR = open(os.path.join(output_dir, FILENAME_R), 'w')
218 | fileE0 = open(os.path.join(output_dir, FILENAME_E0), 'w')
219 |
220 | fileE0.write(header)
221 | fileR.write(header)
222 | # @end PrepareOutput
223 |
224 | phi = []
225 | theta = []
226 | R = []
227 | e0 = []
228 | for i1 in range(0, int(ip)):
229 | for i2 in range(0, int(it)):
230 | # @begin CalculateGlobalAnglesAndDirections
231 | # @in ip @as IP
232 | # @in it @as IT
233 | # @in pstart @as PStart
234 | # @in delp @as DelP
235 | # @in tstart @as TStart
236 | # @in delt @as DelT
237 | # @out D0 @as D0
238 | # @out E @as E
239 | phi.append(pstart + i1 * delp)
240 | phr = phi[i2] * RAD
241 | theta.append(tstart + i2 * delt)
242 | thr = theta[i2] * RAD
243 | st = math.sin(thr)
244 | ct = math.cos(thr)
245 | cp = math.cos(phr)
246 | sp = math.sin(phr)
247 | D0 = [st*cp, st*sp, ct]
248 | E = [ct*cp, ct*sp, -st, sp, cp]
249 | # @end CalculateGlobalAnglesAndDirections
250 |
251 | # @begin CalculateSphericalCoordinateSystemRadialUnitVector
252 | # @in ip @as IP
253 | # @in it @as IT
254 | # @in D0 @as D0
255 | # @in output_dir @as OutputDir
256 | # @out r_file @as R_Output @URI file:{{OutputDir}/R.dat}
257 | u, v, w = D0
258 | fileR.write(str(i2))
259 | fileR.write(" ")
260 | fileR.write(str(D0))
261 | fileR.write("\n")
262 | # @end CalculateSphericalCoordinateSystemRadialUnitVector
263 |
264 | # @begin CalculateIncidentFieldInGlobalCartesianCoordinates
265 | # @in ip @as IP
266 | # @in it @as IT
267 | # @in E @as E
268 | # @in et @as Et
269 | # @in ep @as Ep
270 | # @in output_dir @as OutputDir
271 | # @out e0_file @as E0_Output @URI file:{{OutputDir}/E0.dat}
272 | uu, vv, ww, sp, cp = E
273 | fileE0.write(str(i2))
274 | fileE0.write(" ")
275 | fileE0.write(str([(uu * et - sp * ep), (vv * et + cp * ep), (ww * et)]))
276 | fileE0.write("\n")
277 | # @end CalculateIncidentFieldInGlobalCartesianCoordinates
278 |
279 | fileR.close()
280 | fileE0.close()
281 |
282 | # @end yw_monolithic_pypofacets
283 |
--------------------------------------------------------------------------------