-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.py
2706 lines (2173 loc) · 122 KB
/
main.py
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
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
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
463
464
465
466
467
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
740
741
742
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
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
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
"""
PyWolf version 2.0.2
*
Software to perform simulations of the propagation of partially coherent light
using parallel computing devices through PyOpenCL
*
Tiago E. C. Magalhaes
2023
"""
#===============================================================================
# Importing Packages
#===============================================================================
# PyQT5:
from PyQt5 import QtCore, QtGui, QtWidgets
from PyQt5.QtWidgets import QDialog, QInputDialog, QFileDialog, QLabel, QHBoxLayout, QMainWindow
# Numpy
import numpy
from numpy import ones
# Functools
import functools
# Decimal
from decimal import Decimal
# Matplotlib
from matplotlib import rc
# PyOpenCL
import pyopencl
# OS
import os
from os import getcwd, chdir
# Sys
import sys
# psutil - for RAM
import psutil
# Glob
import glob
# Adding directories to import packages
current_dir = os.path.dirname(__file__)
sys.path.append(os.path.join(current_dir,"plot_functions"))
sys.path.append(os.path.join(current_dir,"app_functions"))
sys.path.append(os.path.join(current_dir,"styles"))
sys.path.append(os.path.join(current_dir,"logos"))
# PyWolf packages
from palettes import *
from fonts import *
from color import *
from platdev import *
from testPars import *
from startSim import *
from mainFunctions import *
from save_load import *
from windowPlot_sourceSpectrumPreview import *
#===============================================================================
#///////////////////////////////////////////////////////////////////////////////
#===============================================================================
#===============================================================================
# Object - PyQT5 Window
#===============================================================================
class Ui_MainWindow(QMainWindow):
def setupUi(self, MainWindow,appname,rect,current_dir,log_txt,output_txt):
#=======================================================================
# parameters
#=======================================================================
# version
self.version = "PyWolf v2.0.2"
# simulation successful
self.sim = False
# Spectrum Plot Showed
self.source_spec_plot = False
self.d_omega = None
# load project
self.final_list = None
# messages
self.warning_fresnel = False
self.log_txt = log_txt
self.output_txt = output_txt
self.rect = rect
self.current_dir = current_dir
self.simulationFinish = False
# spatial resolution
self.dx_list=[]
# directories
self.dir_examples = None
# resize
#self.resized.connect(self.update_resize)
#self.resizeEvent(self.update_resize)
#=======================================================================
#///////////////////////////////////////////////////////////////////////
#=======================================================================
#=======================================================================
# Main Window
#=======================================================================
# setting app name
MainWindow.setObjectName("MainWindow")
# setting app window size
MainWindow.resize(int(2*rect.width()/3), int(2*rect.height()/3))
# MainWindows Color palette
MainWindow.setPalette(palette_mainwindow)
# not a document
MainWindow.setDocumentMode(False)
# icon directory
icon_dir = self.current_dir
icon_dir = icon_dir.replace("\\","/")
icon = QtGui.QIcon()
icon.addPixmap(QtGui.QPixmap(icon_dir+"/logos/wolf_icon.png"), QtGui.QIcon.Selected, QtGui.QIcon.On)
MainWindow.setWindowIcon(icon)
#=======================================================================
#///////////////////////////////////////////////////////////////////////
#=======================================================================
#=======================================================================
# Central Widget
#=======================================================================
# MainWindow -> Central Widget
self.centralwidget = QtWidgets.QWidget(MainWindow)
self.centralwidget.setObjectName("centralwidget")
# adding grid to central widget
self.gridLayout_main = QtWidgets.QGridLayout(self.centralwidget)
self.gridLayout_main.setObjectName("gridLayout_main")
#=======================================================================
#///////////////////////////////////////////////////////////////////////
#=======================================================================
#=======================================================================
# groupBox
#=======================================================================
# MainWindow -> Central Widget -> groupBox Project
# adding groupbox to central widget
self.groupBox_project = QtWidgets.QGroupBox(self.centralwidget)
# settings
self.groupBox_project.setFont(font_title)
self.groupBox_project.setAlignment(QtCore.Qt.AlignCenter)
self.groupBox_project.setCheckable(False)
self.groupBox_project.setObjectName("groupBox_project")
self.groupBox_project.setPalette(palette_groupBoxProject)
# creating layout
self.gridLayout_main_project = QtWidgets.QGridLayout(self.groupBox_project)
self.gridLayout_main_project.setObjectName("gridLayout_main_project")
# background color
##self.groupBox_project.setStyleSheet('QGroupBox:title {color: rgb(255, 255, 255);}')
#=======================================================================
#///////////////////////////////////////////////////////////////////////
#=======================================================================
#=======================================================================
# gridLayout Project
#=======================================================================
# MainWindow -> Central Widget -> groupBox Project -> gridLayout Project
# Creating grid layout for the project
self.gridLayout_project = QtWidgets.QGridLayout()
self.gridLayout_project.setObjectName("gridLayout_project")
spacerItem = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
self.gridLayout_project.addItem(spacerItem, 1, 1, 1, 1)
# Defines the height of line 1 of the layout
##self.gridLayout_project.setRowMinimumHeight(1, int(0.5*self.rect.height()))
#=======================================================================
#///////////////////////////////////////////////////////////////////////
#=======================================================================
#=======================================================================
# Message Scroll Area Color palette #
#=======================================================================
# MainWindow -> Central Widget -> groupBox project -> Message area
# To define
###self.gridLayout_project.setRowStretch(1, int(self.rect.height()*0.7))
# Creating Widget for Message area
self.scrollArea_messages = QtWidgets.QScrollArea(self.groupBox_project)
# Customizing
self.scrollArea_messages.setPalette(palette_messageArea)
self.scrollArea_messages.setWidgetResizable(True)
self.scrollArea_messages.setObjectName("scrollArea_messages")
##*self.scrollArea_messages.setMaximumHeight(2*rect.height()/10)
# Size
percentage = 0.22
self.scrollArea_messages.setMaximumHeight(int(MainWindow.frameGeometry().height()*percentage))
# Scroll Area Message
self.scrollAreaWidgetContents_messages = QtWidgets.QWidget()
self.scrollAreaWidgetContents_messages.setObjectName("scrollAreaWidgetContents_9")
# Creating gridLayout in Scroll Area
self.gridLayout_messages = QtWidgets.QGridLayout(self.scrollAreaWidgetContents_messages)
self.gridLayout_messages.setObjectName("gridLayout_messages")
# Adding Scroll Area Messages do Project
self.gridLayout_project.addWidget(self.scrollArea_messages, 0, 2, 1, 1)
# scrollArea_messages -> scrollAreaWidgetContents_messages -> gridLayout_messages
#=======================================================================
#///////////////////////////////////////////////////////////////////////
#=======================================================================
#=======================================================================
# Output Text Box
#=======================================================================
# scrollArea_messages -> scrollAreaWidgetContents_messages -> textBrowser
# Creating text browser
self.textBrowser = QtWidgets.QTextBrowser(self.scrollAreaWidgetContents_messages)
self.textBrowser.setPalette(palette_outputText)
##*self.textBrowser.setMinimumHeight(2*rect.height()/14)
##*self.textBrowser.setMaximumHeight(2*rect.height()/12.5)
# adding font
self.textBrowser.setFont(font_outText)
# adding to grid layout
self.textBrowser.setObjectName("textBrowser")
self.gridLayout_messages.addWidget(self.textBrowser, 1, 0, 1, 1)
# adding text
self.textBrowser.append(str(output_txt))
#=======================================================================
#///////////////////////////////////////////////////////////////////////
#=======================================================================
#=======================================================================
# Adding Messages to Project Layout
#=======================================================================
# creatins spacers
##spacerItem2 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
##spacerItem3 = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
# adding spacer to gridLayout messages
##self.gridLayout_messages.addItem(spacerItem2, 2, 0, 1, 1)
# set <scrollAreaWidgetContents_messages> to <scrollArea_messages>
self.scrollArea_messages.setWidget(self.scrollAreaWidgetContents_messages)
# adding things to gridLayout project
##self.gridLayout_project.addItem(spacerItem3, 0, 1, 1, 1)
#=======================================================================
#///////////////////////////////////////////////////////////////////////
#=======================================================================
#=======================================================================
# Matplotlib Scroll Area Color Palette
#=======================================================================
temp_dir = os.path.dirname(__file__)
temp_dir = os.path.join(temp_dir, "logos", "wolf.png")
temp_dir = str(temp_dir)
temp_dir = temp_dir.replace("\\","/")
stylesheet_pywolf = """
background-image: url('"""+temp_dir+"""');
background-position: upper center;
background-repeat: no-repeat;
"""
# Creating Scroll Area Matplotlib
self.scrollArea_matplot = QtWidgets.QScrollArea(self.groupBox_project)
# Customizing
self.scrollArea_matplot.setPalette(palette_matplotScroll)
self.scrollArea_matplot.setWidgetResizable(True)
self.scrollArea_matplot.setObjectName("scrollArea_matplot")
# Creating Widget
self.scrollAreaWidgetContents_plots = QtWidgets.QWidget()
self.scrollAreaWidgetContents_plots.setObjectName("scrollAreaWidgetContents_plots")
# Setting Widget to scrollArea_matplot
self.scrollArea_matplot.setWidget(self.scrollAreaWidgetContents_plots)
# Grid Layout matplot
self.gridLayout_matplot = QtWidgets.QGridLayout(self.scrollAreaWidgetContents_plots)
self.gridLayout_matplot.setObjectName("gridLayout_matplot")
# Adding Grid Layout
self.gridLayout_project.addWidget(self.scrollArea_matplot, 1, 2, 4, 1)
#=======================================================================
#///////////////////////////////////////////////////////////////////////
#=======================================================================
#=======================================================================
# Table with Plots - Widget
#=======================================================================
# scrollAreaWidgetContents_plots -> tabWidget_plots
# Creating Tav Widget
self.tabWidget_plots = QtWidgets.QTabWidget(self.scrollAreaWidgetContents_plots)
# Customizing
self.tabWidget_plots.setPalette(palette_TabPlots)
self.tabWidget_plots.setObjectName("tabWidget_plots")
#self.tabWidget_plots.setMinimumHeight(2*self.rect.height()/3)
self.tabWidget_plots.setFont(font_semititle)
# adding tabWidget plots to gridlayout matplot
self.gridLayout_matplot.addWidget(self.tabWidget_plots, 10,0,20,20)
self.tabWidget_plots.setStyleSheet(stylesheet_pywolf)
#=======================================================================
#///////////////////////////////////////////////////////////////////////
#=======================================================================
#=======================================================================
# List of tables in Tab Plots
#=======================================================================
# list of tabs
self.list_of_tabs = []
# list of grids of tabs
self.list_grid_tabs = []
#=======================================================================
#///////////////////////////////////////////////////////////////////////
#=======================================================================
#=======================================================================
# Scroll Area Section Parameters
#=======================================================================
# Scroll Area section parameters - Creation
self.scrollArea_sectionParams = QtWidgets.QScrollArea(self.groupBox_project)
# Customizing
self.scrollArea_sectionParams.setPalette(palette_parSection)
self.scrollArea_sectionParams.setWidgetResizable(True)
self.scrollArea_sectionParams.setObjectName("scrollArea_sectionParams")
self.scrollArea_sectionParams.setMaximumWidth(int(rect.width()*0.30))
# Widget Contents
self.scrollAreaWidgetContents_numPlanes = QtWidgets.QWidget()
self.scrollAreaWidgetContents_numPlanes.setGeometry(QtCore.QRect(0, 0, 445, 1780))
self.scrollAreaWidgetContents_numPlanes.setObjectName("scrollAreaWidgetContents_numPlanes")
# Grid Layout
self.gridLayout_7 = QtWidgets.QGridLayout(self.scrollAreaWidgetContents_numPlanes)
self.gridLayout_7.setObjectName("gridLayout_7")
#=======================================================================
#///////////////////////////////////////////////////////////////////////
#=======================================================================
#=======================================================================
# Scroll Area Text Box
#=======================================================================
self.scrollArea_textBox = QtWidgets.QScrollArea(self.scrollAreaWidgetContents_numPlanes)
self.scrollArea_textBox.setWidgetResizable(True)
self.scrollArea_textBox.setObjectName("ScrollArea_textBox")
self.scrollArea_textBox.setMinimumHeight(int(rect.height()/6.))
self.scrollAreaWidgetContents_textBox = QtWidgets.QWidget()
self.scrollAreaWidgetContents_textBox.setGeometry(QtCore.QRect(0, 0, 421, 85))
self.scrollAreaWidgetContents_textBox.setObjectName("scrollAreaWidgetContents_textBox")
self.gridLayout_textBox = QtWidgets.QGridLayout(self.scrollAreaWidgetContents_textBox)
self.gridLayout_textBox.setObjectName("gridLayout_geometry")
#=======================================================================
#///////////////////////////////////////////////////////////////////////
#=======================================================================
#=======================================================================
# Text Box to Write
#=======================================================================
# adding text box to write
self.plainTextEdit = QtWidgets.QPlainTextEdit(self.scrollAreaWidgetContents_textBox)
# palette color
self.plainTextEdit.setPalette(palette_textEdit)
# font
self.plainTextEdit.setFont(font_textBox)
self.plainTextEdit.setObjectName("plainTextEdit")
# grid
self.gridLayout_textBox.addWidget(self.plainTextEdit, 1, 0, 1, 3)
# adding space
spacerItem1 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
self.gridLayout_textBox.addItem(spacerItem1, 1, 0, 1, 1)
#=======================================================================
#///////////////////////////////////////////////////////////////////////
#=======================================================================
#=======================================================================
# Scroll Area FFT ZEROP PADDING
#=======================================================================
self.scrollArea_FFT = QtWidgets.QScrollArea(self.scrollAreaWidgetContents_numPlanes)
self.scrollArea_FFT.setWidgetResizable(True)
self.scrollArea_FFT.setObjectName("ScrollArea_FFT")
self.scrollArea_FFT.setMinimumHeight(int(rect.height()/6.))
self.scrollAreaWidgetContents_FFT = QtWidgets.QWidget()
self.scrollAreaWidgetContents_FFT.setGeometry(QtCore.QRect(0, 0, 421, 85))
self.scrollAreaWidgetContents_FFT.setObjectName("scrollAreaWidgetContents_FFT")
self.gridLayout_FFT = QtWidgets.QGridLayout(self.scrollAreaWidgetContents_FFT)
self.gridLayout_FFT.setObjectName("gridLayout_FFT")
#=======================================================================
#///////////////////////////////////////////////////////////////////////
#=======================================================================
#=======================================================================
# Scroll Area Save
#=======================================================================
self.scrollArea_save = QtWidgets.QScrollArea(self.scrollAreaWidgetContents_numPlanes)
self.scrollArea_save.setWidgetResizable(True)
self.scrollArea_save.setObjectName("ScrollArea_save")
self.scrollArea_save.setMinimumHeight(int(rect.height()/6.))
self.scrollAreaWidgetContents_save = QtWidgets.QWidget()
self.scrollAreaWidgetContents_save.setGeometry(QtCore.QRect(0, 0, 421, 85))
self.scrollAreaWidgetContents_save.setObjectName("scrollAreaWidgetContents_save")
self.gridLayout_save = QtWidgets.QGridLayout(self.scrollAreaWidgetContents_save)
self.gridLayout_save.setObjectName("gridLayout_save")
#=======================================================================
#///////////////////////////////////////////////////////////////////////
#=======================================================================
#=======================================================================
# Scroll Area Propagation Quantity
#=======================================================================
self.scrollArea_propQuantity = QtWidgets.QScrollArea(self.scrollAreaWidgetContents_numPlanes)
self.scrollArea_propQuantity.setWidgetResizable(True)
self.scrollArea_propQuantity.setObjectName("ScrollArea_cohModel")
self.scrollArea_propQuantity.setMinimumHeight(int(rect.height()/6.))
self.scrollAreaWidgetContents_propQuantity = QtWidgets.QWidget()
self.scrollAreaWidgetContents_propQuantity.setGeometry(QtCore.QRect(0, 0, 421, 85))
self.scrollAreaWidgetContents_propQuantity.setObjectName("scrollAreaWidgetContents_propQuantity")
self.gridLayout_propQuantity = QtWidgets.QGridLayout(self.scrollAreaWidgetContents_propQuantity)
self.gridLayout_propQuantity.setObjectName("gridLayout_propQuantity")
#=======================================================================
#///////////////////////////////////////////////////////////////////////
#=======================================================================
#=======================================================================
# Scroll Area Spectrum Model
#=======================================================================
self.scrollArea_spectrumModel = QtWidgets.QScrollArea(self.scrollAreaWidgetContents_numPlanes)
self.scrollArea_spectrumModel.setWidgetResizable(True)
self.scrollArea_spectrumModel.setObjectName("ScrollArea_spectrumModel")
self.scrollArea_spectrumModel.setMinimumHeight(int(rect.height()/6.))
self.scrollAreaWidgetContents_spectrumModel = QtWidgets.QWidget()
self.scrollAreaWidgetContents_spectrumModel.setGeometry(QtCore.QRect(0, 0, 421, 85))
self.scrollAreaWidgetContents_spectrumModel.setObjectName("scrollAreaWidgetContents_spectrumModel")
self.gridLayout_specModel = QtWidgets.QGridLayout(self.scrollAreaWidgetContents_spectrumModel)
self.gridLayout_specModel.setObjectName("gridLayout")
#=======================================================================
#///////////////////////////////////////////////////////////////////////
#=======================================================================
#=======================================================================
# Scroll Area CSDA from file
#=======================================================================
self.scrollArea_fromFile = QtWidgets.QScrollArea(self.scrollAreaWidgetContents_numPlanes)
self.scrollArea_fromFile.setWidgetResizable(True)
self.scrollArea_fromFile.setObjectName("ScrollArea_fromFile")
self.scrollArea_fromFile.setMinimumHeight(int(rect.height()/6.))
self.scrollAreaWidgetContents_fromFile = QtWidgets.QWidget()
self.scrollAreaWidgetContents_fromFile.setGeometry(QtCore.QRect(0, 0, 421, 85))
self.scrollAreaWidgetContents_fromFile.setObjectName("scrollAreaWidgetContents_fromFile")
self.gridLayout_fromFile = QtWidgets.QGridLayout(self.scrollAreaWidgetContents_fromFile)
self.gridLayout_fromFile.setObjectName("gridLayout_fromFile")
#=======================================================================
#///////////////////////////////////////////////////////////////////////
#=======================================================================
#=======================================================================
# Scroll Area Coherence Model
#=======================================================================
self.scrollArea_cohModel = QtWidgets.QScrollArea(self.scrollAreaWidgetContents_numPlanes)
self.scrollArea_cohModel.setWidgetResizable(True)
self.scrollArea_cohModel.setObjectName("ScrollArea_cohModel")
self.scrollArea_cohModel.setMinimumHeight(int(rect.height()/6.))
self.scrollAreaWidgetContents_cohModel = QtWidgets.QWidget()
self.scrollAreaWidgetContents_cohModel.setGeometry(QtCore.QRect(0, 0, 421, 85))
self.scrollAreaWidgetContents_cohModel.setObjectName("scrollAreaWidgetContents_cohModel")
self.gridLayout_cohModel = QtWidgets.QGridLayout(self.scrollAreaWidgetContents_cohModel)
self.gridLayout_cohModel.setObjectName("gridLayout_cohModel")
#=======================================================================
#///////////////////////////////////////////////////////////////////////
#=======================================================================
#=======================================================================
# Scroll Area Geometries
#=======================================================================
self.scrollArea_geometry = QtWidgets.QScrollArea(self.scrollAreaWidgetContents_numPlanes)
self.scrollArea_geometry.setWidgetResizable(True)
self.scrollArea_geometry.setObjectName("ScrollArea_geometry")
self.scrollArea_geometry.setMinimumHeight(int(rect.height()/6.))
self.scrollAreaWidgetContents_geometry = QtWidgets.QWidget()
self.scrollAreaWidgetContents_geometry.setGeometry(QtCore.QRect(0, 0, 421, 85))
self.scrollAreaWidgetContents_geometry.setObjectName("scrollAreaWidgetContents_geometry")
self.gridLayout_geometry = QtWidgets.QGridLayout(self.scrollAreaWidgetContents_geometry)
self.gridLayout_geometry.setObjectName("gridLayout_geometry")
#=======================================================================
#///////////////////////////////////////////////////////////////////////
#=======================================================================
#=======================================================================
# Scroll Spectral Density
#=======================================================================
self.scrollArea_SpecDensity = QtWidgets.QScrollArea(self.scrollAreaWidgetContents_numPlanes)
self.scrollArea_SpecDensity.setWidgetResizable(True)
self.scrollArea_SpecDensity.setObjectName("ScrollArea_geometry")
self.scrollArea_SpecDensity.setMinimumHeight(int(rect.height()/6.))
self.scrollAreaWidgetContents_SpecDensity = QtWidgets.QWidget()
self.scrollAreaWidgetContents_SpecDensity.setGeometry(QtCore.QRect(0, 0, 421, 85))
self.scrollAreaWidgetContents_SpecDensity.setObjectName("scrollAreaWidgetContents_SpecDensity")
self.gridLayout_SpecDensity = QtWidgets.QGridLayout(self.scrollAreaWidgetContents_SpecDensity)
self.gridLayout_SpecDensity.setObjectName("gridLayout_SpecDensity")
#=======================================================================
#///////////////////////////////////////////////////////////////////////
#=======================================================================
#=======================================================================
# Tab and Scroll Area Propagation System
#=======================================================================
# Tab Propagation System
self.tabWidget_propsystem = QtWidgets.QTabWidget(self.scrollAreaWidgetContents_numPlanes)
self.tabWidget_propsystem.setEnabled(True)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.tabWidget_propsystem.sizePolicy().hasHeightForWidth())
self.tabWidget_propsystem.setSizePolicy(sizePolicy)
self.tabWidget_propsystem.setPalette(palette_tabPropSys)
self.tabWidget_propsystem.setFont(font_normalLabel)
self.tabWidget_propsystem.setIconSize(QtCore.QSize(20, 20))
self.tabWidget_propsystem.setObjectName("tabWidget_propsystem")
# list of text browser for spatial resolutioon
self.textBrowser_spatialRes_list = []
# max number of propagation planes
self.max_numPlanes = 3
# List of Tab for propagation planes
self.tab_planes_list = []
# list of layouts for tabs of propagations planes
self.gridLayoutTab_list = []
#=======================================================================
#///////////////////////////////////////////////////////////////////////
#=======================================================================
#-----------------------------------------------------------------------
# Propagation Planes | area, widget contents and gridlayout
#-----------------------------------------------------------------------
# list of scroll Area of propagation planes
self.scrollArea_propPlanes_list = []
# list of scrollAreaWidgetContents of propagation planes
self.scrollAreaWidgetContents_propPlanes_list = []
# list of grid layouts for propagation planes
self.gridLayout_propPlanes_list = []
#_______________________________________________________________________
#-----------------------------------------------------------------------
# #|-% Propagation Model Function and Parameters | area, widget contents and gridlayout
#-----------------------------------------------------------------------
# list of scrollArea for Propagation functions and parameters
self.scrollArea_propModel_list = []
# list of scrollArea for Propagation functions and parameters
self.scrollAreaWidgetContents_propModel_list = []
# list of gridlayout for propagation functions and parameters
self.gridLayout_propModel_list=[]
#_______________________________________________________________________
#-----------------------------------------------------------------------
# Pupil Function and Parameters | area, widget contents and gridlayout
#-----------------------------------------------------------------------
# list of scrollArea for Pupil functions and parameters
self.scrollArea_pupil_list = []
# list of scrollArea for Pupil functions and parameters
self.scrollAreaWidgetContents_pupil_list = []
# list of gridlayout for pupil functions and parameters
self.gridLayout_pupil_list=[]
#_______________________________________________________________________
#-----------------------------------------------------------------------
# Optics Function and Parameters | area, widget contents and gridlayout
#-----------------------------------------------------------------------
# list of scrollArea for optical device functions and parameters
self.scrollArea_optics_list = []
# list of scroll area widgets contents for optics
self.scrollAreaWidgetContents_optics_list = []
# list of gridlayout for optics
self.gridLayout_optics_list=[]
#_______________________________________________________________________
#-----------------------------------------------------------------------
# Spin Box
#-----------------------------------------------------------------------
self.spinBox_numPlanes = QtWidgets.QSpinBox(self.scrollAreaWidgetContents_numPlanes)
self.spinBox_numPlanes.setObjectName("spinBox_numPlanes")
self.spinBox_numPlanes.setFont(font_normalLabel)
self.spinBox_numPlanes.setMinimum(1)
self.spinBox_numPlanes.setMaximum(3)
self.spinBox_numPlanes.setMaximumWidth(int(size_spinBox(self)))
self.gridLayout_7.addWidget(self.spinBox_numPlanes, 64, 1, 1, 1)
self.spinBox_numPlanes.valueChanged.connect(self.update_numPlanes)
#_______________________________________________________________________
#=======================================================================
# date time widget
#=======================================================================
"""
self.dateTimeEdit = QtWidgets.QDateTimeEdit(self.scrollAreaWidgetContents_numPlanes)
self.dateTimeEdit.setFont(font_normalLabel)
self.dateTimeEdit.setObjectName("dateTimeEdit")
self.gridLayout_7.addWidget(self.dateTimeEdit, 85, 0, 1, 2)
self.dateTimeEdit.setMaximumWidth(size_schedule(self))
self.dateTimeEdit.setDateTime(QtCore.QDateTime.currentDateTime())
"""
#=======================================================================
#///////////////////////////////////////////////////////////////////////
#=======================================================================
#=======================================================================
# Computational Variables
#=======================================================================
self.list_filesGeom = [] # list containing information on geometry functions [module name and dir]
self.list_filesCoh = [] # list containing information on coherence functions [module name and dir]
# directories
self.dirName = None # saved results directory
self.dirSourceGeo = None # directory with source image
self.dirSourceCSDA = None # directory with source CSDA
# present time
self.nowTime = datetime.now()
# directory name
self.saveDirName = None
# minimum size for combo boxes
self.minwidth_combo = rect.width()/7
# max width size for combo boxes when VIEWING
self.maxWidthView_combo = rect.width()/2
#=======================================================================
#///////////////////////////////////////////////////////////////////////
#=======================================================================
#-----------------------------------------------------------------------
# Spectrum Models and parameters | list, line Edit
#-----------------------------------------------------------------------
self.specModelsFunc = []
# Spectrum Models List ex: [ ["Gaussian", OBJECT] , ["Lorentzian, OBJECT] ]
self.specModel_list = []
# Spectrum Model Parameters ex: [ ["a"],["a","b"] ]
self.specModelPar_list = []
# Spectrum Model Line Edit Parameters
self.specModel_lineEditParameters = []
#_______________________________________________________________________
#-----------------------------------------------------------------------
# Geometry Models and parameters | list, line Edit
#-----------------------------------------------------------------------
self.geometryModelsFunc = []
# Geometry Models List ex: [ ["Circle", OBJECT] , ["Rectangle", OBJECT] ]
self.geometry_list = []
# Geometry Model Parameters ex: [ ["a"],["a","b"] ]
self.geometryPar_list = []
# Geometry Line Edit Parameters ex. [ OBJECT, OBJECT]
self.geometry_lineEditParameters = []
#_______________________________________________________________________
#-----------------------------------------------------------------------
# Coherence Models and parameters | list, line Edit
#-----------------------------------------------------------------------
# Coherence Models List ex: [ ["GSM", OBJECT] , ["GSM2", OBJECT] ]
self.cohModel_list = []
# Coherence Models Parameters ex: [ ["a"],["a","b"] ]
self.cohModelPar_list = []
# Coherence Models Line Edit Parameters ex. [ OBJECT, OBJECT]
self.cohModel_lineEditParameters = []
#_______________________________________________________________________
#-----------------------------------------------------------------------
# Spectral Density Models and parameters | list, line Edit
#-----------------------------------------------------------------------
# Spectral Density Models List ex: [ ["GSM", OBJECT] , ["GSM2", OBJECT] ]
self.specDenModel_list = []
# Spectral Density Models Parameters ex: [ ["a"],["a","b"] ]
self.specDenPar_list = []
# Spectral Density Models Line Edit Parameters ex. [ OBJECT, OBJECT]
self.specDen_lineEditParameters = []
#_______________________________________________________________________
#-----------------------------------------------------------------------
# Propagation models and Parameters | list, Line Edits #!-%
#-----------------------------------------------------------------------
# Propagation Model List
self.propModelFunc_list = []
for i in range(0,self.max_numPlanes):
self.propModelFunc_list.append([])
# Propagation Model's Parameters List
self.propModelPars_list = []
for i in range(0,self.max_numPlanes):
self.propModelPars_list.append([])
# Propagation Model's Line Edit Parameters ex. [ OBJECT, OBJECT]
self.propModel_lineEditParameters = []
for i in range(0,self.max_numPlanes):
self.propModel_lineEditParameters.append([])
#_______________________________________________________________________
#-----------------------------------------------------------------------
# Pupil Geometry Function and Parameters | list, Line Edits
#-----------------------------------------------------------------------
# Pupil Geometry Models List
self.pupilGeomFunc_list = []
for i in range(0,self.max_numPlanes):
self.pupilGeomFunc_list.append([])
# Pupil Geometry Parameters Models List
self.pupilGeomFuncPars_list = []
for i in range(0,self.max_numPlanes):
self.pupilGeomFuncPars_list.append([])
# Pupil Geometry Line Edit Parameters ex. [ OBJECT, OBJECT]
self.pupilGeom_lineEditParameters = []
for i in range(0,self.max_numPlanes):
self.pupilGeom_lineEditParameters.append([])
#_______________________________________________________________________
#-----------------------------------------------------------------------
# Optical Devices Function, Parameters and Line Edits
#-----------------------------------------------------------------------
# Optical Devices Models List
self.optDeviceFunc_list = []
for i in range(0,self.max_numPlanes):
self.optDeviceFunc_list.append([])
# Optical Device Parameters Models List
## self.optDevicePars_list
self.optDeviceFuncPars_list = []
for i in range(0,self.max_numPlanes):
self.optDeviceFuncPars_list.append([])
# Pupil Geometry Line Edit Parameters ex. [ OBJECT, OBJECT]
self.optDevicePars_lineEditParameters = []
for i in range(0,self.max_numPlanes):
self.optDevicePars_lineEditParameters.append([])
#_______________________________________________________________________
#=======================================================================
# Labels
#=======================================================================
# just a bar
self.bar = "------------------------------------------------"
# label simulation name
self.label_projName = QtWidgets.QLabel(self.scrollAreaWidgetContents_numPlanes)
self.label_projName.setFont(font_normalLabel)
self.label_projName.setObjectName("label")
self.gridLayout_7.addWidget(self.label_projName, 0, 0, 1, 1)
# label computational parameters (title)
self.label_comParams = QtWidgets.QLabel(self.scrollAreaWidgetContents_numPlanes)
self.label_comParams.setPalette(palette_titles)
self.label_comParams.setFont(font_title)
self.label_comParams.setAlignment(QtCore.Qt.AlignCenter)
self.label_comParams.setObjectName("label_comParams")
self.gridLayout_7.addWidget(self.label_comParams, 4, 0, 1, 2)
# label platform
self.label_platform = QtWidgets.QLabel(self.scrollAreaWidgetContents_numPlanes)
self.label_platform.setPalette(palette_parSection)
self.label_platform.setFont(font_normalLabel)
self.label_platform.setObjectName("label_platform")
self.gridLayout_7.addWidget(self.label_platform, 8, 0, 1, 1)
# label device
self.label_device = QtWidgets.QLabel(self.scrollAreaWidgetContents_numPlanes)
self.label_device.setPalette(palette_parSection)
self.label_device.setFont(font_normalLabel)
self.label_device.setObjectName("label_device")
self.gridLayout_7.addWidget(self.label_device, 9, 0, 1, 1)
# save file
self.label_saveFile = QtWidgets.QLabel(self.scrollAreaWidgetContents_save)
self.label_saveFile.setFont(font_normalLabel)
self.label_saveFile.setObjectName("label_saveFile")
self.gridLayout_save.addWidget(self.label_saveFile, 6, 0, 1, 1)
# Label N
self.label_N = QtWidgets.QLabel(self.scrollAreaWidgetContents_numPlanes)
self.label_N.setFont(font_normalLabel)
self.label_N.setObjectName("label_N")
self.gridLayout_7.addWidget(self.label_N, 15, 0, 1, 1)
# Label NZ
self.label_NZ = QtWidgets.QLabel(self.scrollAreaWidgetContents_numPlanes)
self.label_NZ.setFont(font_normalLabel)
self.label_NZ.setObjectName("label_NZ")
self.gridLayout_FFT.addWidget(self.label_NZ, 1, 0, 1, 1)
self.label_NZ.setText("Total matrix size (>N): ")
self.label_NZ.setVisible(False)
# label Propagation Quantities (title)
self.label_PropagationQuantities = QtWidgets.QLabel(self.scrollAreaWidgetContents_numPlanes)
self.label_PropagationQuantities.setPalette(palette_titles)
self.label_PropagationQuantities.setFont(font_title)
self.label_PropagationQuantities.setAlignment(QtCore.Qt.AlignCenter)
self.label_PropagationQuantities.setObjectName("label_PropagationQuantities")
self.gridLayout_7.addWidget(self.label_PropagationQuantities, 22, 0, 1, 2)
# label Propagation Quantity
self.label_propQuant = QtWidgets.QLabel(self.scrollAreaWidgetContents_propQuantity)
self.label_propQuant.setPalette(palette_parSection)
self.label_propQuant.setFont(font_normalLabel)
self.label_propQuant.setObjectName("label_propQuant")
self.gridLayout_propQuantity.addWidget(self.label_propQuant, 0, 0, 1, 1)
# label Prop Spec Model
self.label_propSpecModel = QtWidgets.QLabel(self.scrollAreaWidgetContents_propQuantity)
self.label_propSpecModel.setPalette(palette_parSection)
self.label_propSpecModel.setFont(font_normalLabel)
self.label_propSpecModel.setObjectName("label_propSpecModel")
self.gridLayout_propQuantity.addWidget(self.label_propSpecModel, 2, 0, 1, 3)
# label Theta
self.label_theta = QtWidgets.QLabel(self.scrollAreaWidgetContents_propQuantity)
self.label_theta.setPalette(palette_parSection)
self.label_theta.setFont(font_normalLabel)
self.label_theta.setObjectName("label_theta")
self.gridLayout_propQuantity.addWidget(self.label_theta, 3, 0, 1, 3)
# Label Spectrum Parameters (Title)
self.label_SpectrumParameters = QtWidgets.QLabel(self.scrollAreaWidgetContents_numPlanes)
self.label_SpectrumParameters.setPalette(palette_titles)
self.label_SpectrumParameters.setFont(font_title)
self.label_SpectrumParameters.setAlignment(QtCore.Qt.AlignCenter)
self.label_SpectrumParameters.setObjectName("label_SpectrumParameters")
self.gridLayout_7.addWidget(self.label_SpectrumParameters, 32, 0, 1, 2)
# label central frequency
self.label_centralFreq = QtWidgets.QLabel(self.scrollAreaWidgetContents_numPlanes)
self.label_centralFreq.setFont(font_normalLabel)
self.label_centralFreq.setObjectName("label_centralFreq")
self.gridLayout_7.addWidget(self.label_centralFreq, 38, 0, 1, 1)
# label_specType
self.label_specType = QtWidgets.QLabel(self.scrollAreaWidgetContents_spectrumModel)
self.label_specType.setPalette(palette_parSection)
self.label_specType.setFont(font_normalLabel)
self.label_specType.setObjectName("label_specType")
self.gridLayout_specModel.addWidget(self.label_specType, 0, 0, 1, 1)
# list of label parameters
self.specModel_labelParameters = []
# Label Source Parameters
self.label_SourceParameters = QtWidgets.QLabel(self.scrollAreaWidgetContents_numPlanes)
self.label_SourceParameters.setPalette(palette_titles)
self.label_SourceParameters.setFont(font_title)
self.label_SourceParameters.setAlignment(QtCore.Qt.AlignCenter)
self.label_SourceParameters.setObjectName("label_SourceParameters")
self.gridLayout_7.addWidget(self.label_SourceParameters, 44, 0, 1, 2)
# label source Resolution
self.label_sourceRes = QtWidgets.QLabel(self.scrollAreaWidgetContents_numPlanes)
self.label_sourceRes.setPalette(palette_parSection)
self.label_sourceRes.setFont(font_normalLabel)
self.label_sourceRes.setObjectName("label_sourceRes")
self.gridLayout_7.addWidget(self.label_sourceRes, 47, 0, 1, 1)
# Label Geometry
self.label_geometry = QtWidgets.QLabel(self.scrollAreaWidgetContents_geometry)
self.label_geometry.setFont(font_normalLabel)
self.label_geometry.setObjectName("label_geometry")
self.gridLayout_geometry.addWidget(self.label_geometry, 0, 0, 1, 1)
# list of label parameters
self.geometry_labelParameters = []
# label coherence model
self.label_cohModel = QtWidgets.QLabel(self.scrollAreaWidgetContents_cohModel)
self.label_cohModel.setPalette(palette_parSection)
self.label_cohModel.setFont(font_normalLabel)