Exemplo n.º 1
0
    def __init__(self, parent):
        self.parent = parent
        # dictionnary linking checkBox to measuring function
        self.dicNetAnalysis = {
            self.parent.gui.gbAssort.title(): get_assortativity,
            self.parent.gui.gbClustering.title(): get_clustering,
            self.parent.gui.gbReciprocity.title(): get_reciprocity,
            self.parent.gui.gbConnectComp.title(): get_num_scc,
            "Weak CC": get_num_wcc,
            self.parent.gui.gbDiameter.title(): get_diameter,
            self.parent.gui.gbSpectrum.title(): get_spectral_radius,
        }
        """# dic linking the weight generator
		self.dicWeightsType = {	"Gaussian": self.setGaussWeights,
								"Lognormal": self.setLogNormWeights}"""
        # la base (les attributs de l'instance)
        self.dicProperties = {}
        self.plottingWidget = PlotWidget()
Exemplo n.º 2
0
    def __init__(self, parent=None):
        super(Plotter_LC, self).__init__(parent) 
        
        self.tixi = Tixi()
        self.tixi.open(Config.path_cpacs_lc_ref)

        self.buttonBox = QtGui.QDialogButtonBox()
        self.buttonBox.addButton(QtGui.QDialogButtonBox.Ok)
        self.buttonBox.addButton(QtGui.QDialogButtonBox.Reset)
        self.buttonBox.addButton(QtGui.QDialogButtonBox.Cancel)

        self.plot_widget = PlotWidget("LC")

        self.comboBoxLoadCases = QtGui.QComboBox()
        self.fillComboBoxLoadCases()
        self.fire_LoadCaseChanged(0)

        self.grid = QtGui.QGridLayout()
        
        self.grid.addWidget(self.comboBoxLoadCases, 0,0)
        self.grid.addWidget(self.plot_widget, 1, 0)

        # set the layout
        layout = QtGui.QGridLayout()
        layout.addLayout(self.grid, 0,0,1,3)
        
        layout.addWidget(self.buttonBox, 5, 0, 1,3)
    
        widget = QtGui.QWidget()
        widget.setLayout(layout)
        
        self.setCentralWidget(widget)
    
        # ===============================================================================================
        # actions
        # ===============================================================================================
        self.comboBoxLoadCases.currentIndexChanged.connect(self.fire_LoadCaseChanged)
        self.buttonBox.button(QtGui.QDialogButtonBox.Ok).clicked.connect(self.close)
        self.buttonBox.button(QtGui.QDialogButtonBox.Reset).clicked.connect(self.close)
        self.buttonBox.button(QtGui.QDialogButtonBox.Cancel).clicked.connect(self.close)
Exemplo n.º 3
0
    def setupUi(self, MainWindow):
        MainWindow.setObjectName("MainWindow")
        MainWindow.resize(1313, 875)
        icon = QtGui.QIcon()
        icon.addPixmap(QtGui.QPixmap(":/images/jderobot.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        MainWindow.setWindowIcon(icon)
        self.centralwidget = QtWidgets.QWidget(MainWindow)
        self.centralwidget.setObjectName("centralwidget")
        self.verticalLayoutWidget = QtWidgets.QWidget(self.centralwidget)
        self.verticalLayoutWidget.setGeometry(QtCore.QRect(30, 680, 161, 121))
        self.verticalLayoutWidget.setObjectName("verticalLayoutWidget")
        self.logoLayout = QtWidgets.QVBoxLayout(self.verticalLayoutWidget)
        self.logoLayout.setContentsMargins(0, 0, 0, 0)
        self.logoLayout.setObjectName("logoLayout")
        self.playpause = QtWidgets.QPushButton(self.centralwidget)
        self.playpause.setGeometry(QtCore.QRect(310, 300, 151, 51))
        font = QtGui.QFont()
        font.setPointSize(16)
        font.setBold(True)
        font.setWeight(75)
        self.playpause.setFont(font)
        self.playpause.setCheckable(True)
        self.playpause.setChecked(False)
        self.playpause.setObjectName("playpause")
        self.plot = PlotWidget(self.centralwidget)
        self.plot.setGeometry(QtCore.QRect(710, 30, 571, 571))
        self.plot.setObjectName("plot")
        self.progressBar = QtWidgets.QProgressBar(self.centralwidget)
        self.progressBar.setGeometry(QtCore.QRect(740, 680, 541, 23))
        self.progressBar.setProperty("value", 0)
        self.progressBar.setObjectName("progressBar")
        self.orig_img = QtWidgets.QLabel(self.centralwidget)
        self.orig_img.setGeometry(QtCore.QRect(40, 30, 320, 240))
        self.orig_img.setObjectName("orig_img")
        self.processed_img = QtWidgets.QLabel(self.centralwidget)
        self.processed_img.setGeometry(QtCore.QRect(380, 30, 320, 240))
        self.processed_img.setObjectName("processed_img")
        self.mean = QtWidgets.QLCDNumber(self.centralwidget)
        self.mean.setGeometry(QtCore.QRect(190, 430, 141, 51))
        self.mean.setObjectName("mean")
        self.median = QtWidgets.QLCDNumber(self.centralwidget)
        self.median.setGeometry(QtCore.QRect(190, 500, 141, 51))
        self.median.setObjectName("median")
        self.Std_dev = QtWidgets.QLCDNumber(self.centralwidget)
        self.Std_dev.setGeometry(QtCore.QRect(190, 580, 141, 51))
        self.Std_dev.setObjectName("Std_dev")
        self.rmse = QtWidgets.QLCDNumber(self.centralwidget)
        self.rmse.setGeometry(QtCore.QRect(530, 430, 141, 51))
        self.rmse.setObjectName("rmse")
        self.label = QtWidgets.QLabel(self.centralwidget)
        self.label.setGeometry(QtCore.QRect(240, 380, 311, 31))
        font = QtGui.QFont()
        font.setPointSize(16)
        font.setBold(False)
        font.setItalic(True)
        font.setUnderline(True)
        font.setWeight(50)
        self.label.setFont(font)
        self.label.setObjectName("label")
        self.label_3 = QtWidgets.QLabel(self.centralwidget)
        self.label_3.setGeometry(QtCore.QRect(10, 440, 141, 20))
        font = QtGui.QFont()
        font.setPointSize(14)
        font.setBold(True)
        font.setWeight(75)
        font.setKerning(True)
        self.label_3.setFont(font)
        self.label_3.setObjectName("label_3")
        self.label_4 = QtWidgets.QLabel(self.centralwidget)
        self.label_4.setGeometry(QtCore.QRect(10, 510, 141, 20))
        font = QtGui.QFont()
        font.setPointSize(14)
        font.setBold(True)
        font.setWeight(75)
        font.setKerning(True)
        self.label_4.setFont(font)
        self.label_4.setObjectName("label_4")
        self.label_5 = QtWidgets.QLabel(self.centralwidget)
        self.label_5.setGeometry(QtCore.QRect(10, 590, 171, 20))
        font = QtGui.QFont()
        font.setPointSize(14)
        font.setBold(True)
        font.setWeight(75)
        font.setKerning(True)
        self.label_5.setFont(font)
        self.label_5.setObjectName("label_5")
        self.label_6 = QtWidgets.QLabel(self.centralwidget)
        self.label_6.setGeometry(QtCore.QRect(400, 440, 101, 20))
        font = QtGui.QFont()
        font.setPointSize(14)
        font.setBold(True)
        font.setWeight(75)
        font.setKerning(True)
        self.label_6.setFont(font)
        self.label_6.setObjectName("label_6")
        self.label_7 = QtWidgets.QLabel(self.centralwidget)
        self.label_7.setGeometry(QtCore.QRect(570, 680, 161, 31))
        font = QtGui.QFont()
        font.setPointSize(18)
        self.label_7.setFont(font)
        self.label_7.setObjectName("label_7")
        self.realtime = QtWidgets.QLCDNumber(self.centralwidget)
        self.realtime.setGeometry(QtCore.QRect(530, 530, 141, 51))
        self.realtime.setObjectName("realtime")
        self.label_8 = QtWidgets.QLabel(self.centralwidget)
        self.label_8.setGeometry(QtCore.QRect(390, 540, 131, 31))
        font = QtGui.QFont()
        font.setPointSize(15)
        font.setBold(True)
        font.setWeight(75)
        self.label_8.setFont(font)
        self.label_8.setObjectName("label_8")
        self.line = QtWidgets.QFrame(self.centralwidget)
        self.line.setGeometry(QtCore.QRect(350, 500, 361, 20))
        self.line.setFrameShape(QtWidgets.QFrame.HLine)
        self.line.setFrameShadow(QtWidgets.QFrame.Sunken)
        self.line.setObjectName("line")
        self.line_2 = QtWidgets.QFrame(self.centralwidget)
        self.line_2.setGeometry(QtCore.QRect(-10, 360, 721, 20))
        self.line_2.setFrameShape(QtWidgets.QFrame.HLine)
        self.line_2.setFrameShadow(QtWidgets.QFrame.Sunken)
        self.line_2.setObjectName("line_2")
        self.line_3 = QtWidgets.QFrame(self.centralwidget)
        self.line_3.setGeometry(QtCore.QRect(342, 510, 21, 161))
        self.line_3.setFrameShape(QtWidgets.QFrame.VLine)
        self.line_3.setFrameShadow(QtWidgets.QFrame.Sunken)
        self.line_3.setObjectName("line_3")
        self.line_4 = QtWidgets.QFrame(self.centralwidget)
        self.line_4.setGeometry(QtCore.QRect(-3, 660, 361, 20))
        self.line_4.setFrameShape(QtWidgets.QFrame.HLine)
        self.line_4.setFrameShadow(QtWidgets.QFrame.Sunken)
        self.line_4.setObjectName("line_4")
        self.line_5 = QtWidgets.QFrame(self.centralwidget)
        self.line_5.setGeometry(QtCore.QRect(350, 590, 361, 20))
        self.line_5.setFrameShape(QtWidgets.QFrame.HLine)
        self.line_5.setFrameShadow(QtWidgets.QFrame.Sunken)
        self.line_5.setObjectName("line_5")
        self.label_9 = QtWidgets.QLabel(self.centralwidget)
        self.label_9.setGeometry(QtCore.QRect(120, 0, 131, 21))
        font = QtGui.QFont()
        font.setBold(True)
        font.setWeight(75)
        self.label_9.setFont(font)
        self.label_9.setObjectName("label_9")
        self.label_10 = QtWidgets.QLabel(self.centralwidget)
        self.label_10.setGeometry(QtCore.QRect(440, 0, 151, 21))
        font = QtGui.QFont()
        font.setBold(True)
        font.setWeight(75)
        self.label_10.setFont(font)
        self.label_10.setObjectName("label_10")
        MainWindow.setCentralWidget(self.centralwidget)
        self.menubar = QtWidgets.QMenuBar(MainWindow)
        self.menubar.setGeometry(QtCore.QRect(0, 0, 1313, 27))
        self.menubar.setObjectName("menubar")
        MainWindow.setMenuBar(self.menubar)
        self.statusbar = QtWidgets.QStatusBar(MainWindow)
        self.statusbar.setObjectName("statusbar")
        MainWindow.setStatusBar(self.statusbar)
        self.toolBar = QtWidgets.QToolBar(MainWindow)
        self.toolBar.setObjectName("toolBar")
        MainWindow.addToolBar(QtCore.Qt.TopToolBarArea, self.toolBar)

        self.retranslateUi(MainWindow)
        QtCore.QMetaObject.connectSlotsByName(MainWindow)
Exemplo n.º 4
0
class Plotter_LC(QtGui.QMainWindow):
    def __init__(self, parent=None):
        super(Plotter_LC, self).__init__(parent) 
        
        self.tixi = Tixi()
        self.tixi.open(Config.path_cpacs_lc_ref)

        self.buttonBox = QtGui.QDialogButtonBox()
        self.buttonBox.addButton(QtGui.QDialogButtonBox.Ok)
        self.buttonBox.addButton(QtGui.QDialogButtonBox.Reset)
        self.buttonBox.addButton(QtGui.QDialogButtonBox.Cancel)

        self.plot_widget = PlotWidget("LC")

        self.comboBoxLoadCases = QtGui.QComboBox()
        self.fillComboBoxLoadCases()
        self.fire_LoadCaseChanged(0)

        self.grid = QtGui.QGridLayout()
        
        self.grid.addWidget(self.comboBoxLoadCases, 0,0)
        self.grid.addWidget(self.plot_widget, 1, 0)

        # set the layout
        layout = QtGui.QGridLayout()
        layout.addLayout(self.grid, 0,0,1,3)
        
        layout.addWidget(self.buttonBox, 5, 0, 1,3)
    
        widget = QtGui.QWidget()
        widget.setLayout(layout)
        
        self.setCentralWidget(widget)
    
        # ===============================================================================================
        # actions
        # ===============================================================================================
        self.comboBoxLoadCases.currentIndexChanged.connect(self.fire_LoadCaseChanged)
        self.buttonBox.button(QtGui.QDialogButtonBox.Ok).clicked.connect(self.close)
        self.buttonBox.button(QtGui.QDialogButtonBox.Reset).clicked.connect(self.close)
        self.buttonBox.button(QtGui.QDialogButtonBox.Cancel).clicked.connect(self.close)

    def fire_LoadCaseChanged(self, idx):
        uid = self.comboBoxLoadCases.currentText()
        path = '/cpacs/vehicles/aircraft/model[1]/analyses/loadAnalysis/loadCases/flightLoadCase[@uID="' + uid + '"]'        
        x_axis, y_axis = self.getPlotPointValues(path)
        self.plot_widget.plot.clear()
        self.plot_widget.plot.grid(True)
        self.plot_widget.simplePlot(x_axis, y_axis)

    def fillComboBoxLoadCases(self):
        path_lc = "/cpacs/vehicles/aircraft/model[1]/analyses/loadAnalysis/loadCases"
        
        for idx_lc in range(1, self.tixi.getNumberOfChilds(path_lc) + 1) :
            tmp_path = path_lc + "/flightLoadCase[" + str(idx_lc) + "]"
            self.comboBoxLoadCases.addItem( self.tixi.getTextAttribute(tmp_path,"uID") )
            
    def getPlotPointValues(self, path):
        """... 
        
        Args:
            path  (String): path to specific flightLoadCase
        
        Returns:
            ...
        """ 
        xaxis = []
        yaxis = []
        path_wings = path + "/aeroLoads/wings"
        for idx_wing in range(1, self.tixi.getNumberOfChilds(path_wings) + 1) :
            path_segs = path_wings + "/wing[" + str(idx_wing) + "]/segments"
            for idx_seg in range(1, self.tixi.getNumberOfChilds(path_segs) + 1) :
                for idx_strip in range(1, self.tixi.getNamedChildrenCount(path_segs + "/segment[" + str(idx_seg) + "]", "strip") + 1) :
                    x =  self.tixi.getDoubleElement(path_segs + "/segment[" + str(idx_seg) + "]/strip[" + str(idx_strip) + "]/reference/point/x")
                    y = self.tixi.getDoubleElement(path_segs + "/segment[" + str(idx_seg) + "]/strip[" + str(idx_strip) + "]/reference/point/y")
                    xaxis.append(x)
                    yaxis.append(y)
        return xaxis, yaxis
Exemplo n.º 5
0
    def setupUi(self, MainWindow):
        MainWindow.setObjectName("MainWindow")
        MainWindow.resize(1347, 904)
        icon = QtGui.QIcon()
        icon.addPixmap(QtGui.QPixmap(":/images/jderobot.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        MainWindow.setWindowIcon(icon)
        self.centralwidget = QtWidgets.QWidget(MainWindow)
        self.centralwidget.setObjectName("centralwidget")
        self.verticalLayoutWidget = QtWidgets.QWidget(self.centralwidget)
        self.verticalLayoutWidget.setGeometry(QtCore.QRect(30, 680, 171, 141))
        self.verticalLayoutWidget.setObjectName("verticalLayoutWidget")
        self.logoLayout = QtWidgets.QVBoxLayout(self.verticalLayoutWidget)
        self.logoLayout.setContentsMargins(0, 0, 0, 0)
        self.logoLayout.setObjectName("logoLayout")
        self.playpause = QtWidgets.QPushButton(self.centralwidget)
        self.playpause.setGeometry(QtCore.QRect(260, 300, 201, 51))
        font = QtGui.QFont()
        font.setPointSize(16)
        font.setBold(True)
        font.setWeight(75)
        self.playpause.setFont(font)
        self.playpause.setCheckable(True)
        self.playpause.setChecked(False)
        self.playpause.setObjectName("playpause")
        self.plot = PlotWidget(self.centralwidget)
        self.plot.setGeometry(QtCore.QRect(710, 30, 621, 571))
        self.plot.setObjectName("plot")
        self.progressBar = QtWidgets.QProgressBar(self.centralwidget)
        self.progressBar.setGeometry(QtCore.QRect(740, 680, 541, 23))
        self.progressBar.setProperty("value", 0)
        self.progressBar.setObjectName("progressBar")
        self.orig_img = QtWidgets.QLabel(self.centralwidget)
        self.orig_img.setGeometry(QtCore.QRect(40, 30, 320, 240))
        self.orig_img.setObjectName("orig_img")
        self.processed_img = QtWidgets.QLabel(self.centralwidget)
        self.processed_img.setGeometry(QtCore.QRect(380, 30, 320, 240))
        self.processed_img.setObjectName("processed_img")
        self.mean = QtWidgets.QLCDNumber(self.centralwidget)
        self.mean.setGeometry(QtCore.QRect(190, 430, 141, 51))
        self.mean.setObjectName("mean")
        self.median = QtWidgets.QLCDNumber(self.centralwidget)
        self.median.setGeometry(QtCore.QRect(190, 500, 141, 51))
        self.median.setObjectName("median")
        self.Std_dev = QtWidgets.QLCDNumber(self.centralwidget)
        self.Std_dev.setGeometry(QtCore.QRect(190, 580, 141, 51))
        self.Std_dev.setObjectName("Std_dev")
        self.rmse = QtWidgets.QLCDNumber(self.centralwidget)
        self.rmse.setGeometry(QtCore.QRect(530, 430, 141, 51))
        self.rmse.setObjectName("rmse")
        self.label = QtWidgets.QLabel(self.centralwidget)
        self.label.setGeometry(QtCore.QRect(160, 380, 421, 31))
        font = QtGui.QFont()
        font.setPointSize(16)
        font.setBold(False)
        font.setItalic(True)
        font.setUnderline(True)
        font.setWeight(50)
        self.label.setFont(font)
        self.label.setObjectName("label")
        self.label_3 = QtWidgets.QLabel(self.centralwidget)
        self.label_3.setGeometry(QtCore.QRect(10, 440, 141, 20))
        font = QtGui.QFont()
        font.setPointSize(14)
        font.setBold(True)
        font.setWeight(75)
        font.setKerning(True)
        self.label_3.setFont(font)
        self.label_3.setObjectName("label_3")
        self.label_4 = QtWidgets.QLabel(self.centralwidget)
        self.label_4.setGeometry(QtCore.QRect(10, 510, 141, 20))
        font = QtGui.QFont()
        font.setPointSize(14)
        font.setBold(True)
        font.setWeight(75)
        font.setKerning(True)
        self.label_4.setFont(font)
        self.label_4.setObjectName("label_4")
        self.label_5 = QtWidgets.QLabel(self.centralwidget)
        self.label_5.setGeometry(QtCore.QRect(0, 590, 191, 20))
        font = QtGui.QFont()
        font.setPointSize(14)
        font.setBold(True)
        font.setWeight(75)
        font.setKerning(True)
        self.label_5.setFont(font)
        self.label_5.setObjectName("label_5")
        self.label_6 = QtWidgets.QLabel(self.centralwidget)
        self.label_6.setGeometry(QtCore.QRect(400, 440, 101, 20))
        font = QtGui.QFont()
        font.setPointSize(14)
        font.setBold(True)
        font.setWeight(75)
        font.setKerning(True)
        self.label_6.setFont(font)
        self.label_6.setObjectName("label_6")
        self.label_7 = QtWidgets.QLabel(self.centralwidget)
        self.label_7.setGeometry(QtCore.QRect(570, 680, 161, 31))
        font = QtGui.QFont()
        font.setPointSize(18)
        self.label_7.setFont(font)
        self.label_7.setObjectName("label_7")
        self.realtime = QtWidgets.QLCDNumber(self.centralwidget)
        self.realtime.setGeometry(QtCore.QRect(530, 530, 141, 51))
        self.realtime.setObjectName("realtime")
        self.label_8 = QtWidgets.QLabel(self.centralwidget)
        self.label_8.setGeometry(QtCore.QRect(370, 540, 141, 31))
        font = QtGui.QFont()
        font.setPointSize(15)
        font.setBold(True)
        font.setWeight(75)
        self.label_8.setFont(font)
        self.label_8.setObjectName("label_8")
        self.line = QtWidgets.QFrame(self.centralwidget)
        self.line.setGeometry(QtCore.QRect(350, 500, 361, 20))
        self.line.setFrameShape(QtWidgets.QFrame.HLine)
        self.line.setFrameShadow(QtWidgets.QFrame.Sunken)
        self.line.setObjectName("line")
        self.line_2 = QtWidgets.QFrame(self.centralwidget)
        self.line_2.setGeometry(QtCore.QRect(-10, 360, 721, 20))
        self.line_2.setFrameShape(QtWidgets.QFrame.HLine)
        self.line_2.setFrameShadow(QtWidgets.QFrame.Sunken)
        self.line_2.setObjectName("line_2")
        self.line_3 = QtWidgets.QFrame(self.centralwidget)
        self.line_3.setGeometry(QtCore.QRect(342, 510, 21, 161))
        self.line_3.setFrameShape(QtWidgets.QFrame.VLine)
        self.line_3.setFrameShadow(QtWidgets.QFrame.Sunken)
        self.line_3.setObjectName("line_3")
        self.line_4 = QtWidgets.QFrame(self.centralwidget)
        self.line_4.setGeometry(QtCore.QRect(-3, 660, 361, 20))
        self.line_4.setFrameShape(QtWidgets.QFrame.HLine)
        self.line_4.setFrameShadow(QtWidgets.QFrame.Sunken)
        self.line_4.setObjectName("line_4")
        self.line_5 = QtWidgets.QFrame(self.centralwidget)
        self.line_5.setGeometry(QtCore.QRect(350, 590, 361, 20))
        self.line_5.setFrameShape(QtWidgets.QFrame.HLine)
        self.line_5.setFrameShadow(QtWidgets.QFrame.Sunken)
        self.line_5.setObjectName("line_5")
        self.label_9 = QtWidgets.QLabel(self.centralwidget)
        self.label_9.setGeometry(QtCore.QRect(120, 0, 131, 31))
        font = QtGui.QFont()
        font.setBold(True)
        font.setWeight(75)
        self.label_9.setFont(font)
        self.label_9.setObjectName("label_9")
        self.label_10 = QtWidgets.QLabel(self.centralwidget)
        self.label_10.setGeometry(QtCore.QRect(440, 0, 181, 31))
        font = QtGui.QFont()
        font.setBold(True)
        font.setWeight(75)
        self.label_10.setFont(font)
        self.label_10.setObjectName("label_10")
        MainWindow.setCentralWidget(self.centralwidget)
        self.menubar = QtWidgets.QMenuBar(MainWindow)
        self.menubar.setGeometry(QtCore.QRect(0, 0, 1347, 32))
        self.menubar.setObjectName("menubar")
        MainWindow.setMenuBar(self.menubar)
        self.statusbar = QtWidgets.QStatusBar(MainWindow)
        self.statusbar.setObjectName("statusbar")
        MainWindow.setStatusBar(self.statusbar)
        self.toolBar = QtWidgets.QToolBar(MainWindow)
        self.toolBar.setObjectName("toolBar")
        MainWindow.addToolBar(QtCore.Qt.TopToolBarArea, self.toolBar)

        self.retranslateUi(MainWindow)
        QtCore.QMetaObject.connectSlotsByName(MainWindow)
Exemplo n.º 6
0
class GraphAnalyzer:
    def __init__(self, parent):
        self.parent = parent
        # dictionnary linking checkBox to measuring function
        self.dicNetAnalysis = {
            self.parent.gui.gbAssort.title(): get_assortativity,
            self.parent.gui.gbClustering.title(): get_clustering,
            self.parent.gui.gbReciprocity.title(): get_reciprocity,
            self.parent.gui.gbConnectComp.title(): get_num_scc,
            "Weak CC": get_num_wcc,
            self.parent.gui.gbDiameter.title(): get_diameter,
            self.parent.gui.gbSpectrum.title(): get_spectral_radius,
        }
        """# dic linking the weight generator
		self.dicWeightsType = {	"Gaussian": self.setGaussWeights,
								"Lognormal": self.setLogNormWeights}"""
        # la base (les attributs de l'instance)
        self.dicProperties = {}
        self.plottingWidget = PlotWidget()
        # ~ self.updateProgress = QtCore.Signal(int)

        # ---------------#
        # set functions #
        # ---------------#

    def setDicPropGraphEvol(self, strEvolProp, currentValProp):
        self.reset_dic_properties()
        self.dicProperties["Type"] = self.parent.gui.cbNetTypeEvol.currentText()
        self.dicProperties["InhibFrac"] = self.parent.gui.dsbInhibFracEvol.value()
        if self.parent.gui.checkBoxNodesEvol.isChecked():
            self.dicProperties["Nodes"] = self.parent.gui.sbNodesEvol.value()
        if self.parent.gui.checkBoxEdgesEvol.isChecked():
            self.dicProperties["Edges"] = self.parent.gui.sbEdgesEvol.value()
        if self.parent.gui.checkBoxDensityEvol.isChecked():
            self.dicProperties["Density"] = self.parent.gui.dsbDensityEvol.value()
        if self.parent.gui.cbNetTypeEvol.currentText() == "Free-scale":
            self.dicProperties["InDeg"] = self.parent.gui.dsbInDegExpEvol.value()
            self.dicProperties["OutDeg"] = self.parent.gui.dsbOutDegExpEvol.value()
            self.dicProperties["Reciprocity"] = self.parent.gui.dsbRecipEvol.value()
        if self.parent.gui.cbNetTypeEvol.currentText() == "EDR":
            self.dicProperties["Lambda"] = self.parent.gui.dsbLambdaEvol.value()
            self.dicProperties["Rho"] = self.parent.gui.sbNeuronDensEvol.value()
        strName = ""
        # pour le moment on s'occupe pas des poids
        self.dicProperties["Weighted"] = False
        if self.parent.gui.gbGraphName.isChecked():
            strName = self.dicProperties["Type"] + "_"
        for string in self.dicProperties.keys():
            if string != "Type":
                strName += string[0] + str(self.dicProperties[string])
        self.dicProperties["Name"] = strName
        self.dicProperties[strEvolProp] = currentValProp

    def reset_dic_properties(self):
        self.dicProperties = {}

        ##################
        # get functions

    def get_measurements(self):
        lstMeas = []
        if self.parent.gui.gbAssort.isEnabled():
            lstMeas.append(self.parent.gui.gbAssort.title())
        if self.parent.gui.gbClustering.isEnabled():
            lstMeas.append(self.parent.gui.gbClustering.title())
        if self.parent.gui.gbReciprocity.isEnabled():
            lstMeas.append(self.parent.gui.gbReciprocity.title())
        if self.parent.gui.gbConnectComp.isEnabled():
            lstMeas.append(self.parent.gui.gbConnectComp.title())
            if self.parent.gui.tabWAnalysis.currentIndex() == 0:
                lstMeas.append("Weak CC")
        if self.parent.gui.gbDiameter.isEnabled():
            lstMeas.append(self.parent.gui.gbDiameter.title())
        if self.parent.gui.gbSpectrum.isEnabled():
            lstMeas.append(self.parent.gui.gbSpectrum.title())
        return lstMeas

        ##################
        # Graph analysis

    def plotDistrib(self):
        # get selected graph
        idxCurrent = self.parent.gui.comboBoxSelectGraph.currentIndex()
        graph = self.parent.gui.comboBoxSelectGraph.itemData(idxCurrent)
        strGraphName = graph.get_name().replace(".", "p")
        # do we care about weights?
        bWeights = False
        if self.parent.gui.checkBoxConsiderWeights.isChecked():
            bWeights = True
            # look at which subgraph(s) we want to study
        dicGraphType = {}
        dicGraphStorage = {}
        if self.parent.gui.checkBoxAnalyzeExc.isChecked():
            dicGraphType["Exc"] = graph.genExcSubgraph
        if self.parent.gui.checkBoxAnalyzeInhib.isChecked():
            dicGraphType["Inhib"] = graph.genInhibSubgraph
        if self.parent.gui.checkBoxAnalyzeAll.isChecked():
            dicGraphType["Total"] = graph.copy
        dicBetwNodes = {}
        dicBetwEdges = {}
        # plot properties
        if self.parent.gui.gbBetweenness.isChecked():
            lstArgsBetw = []
            if self.parent.gui.checkBoxBetwEdges.isChecked():
                lstArgsBetw.append("Edges")
            if self.parent.gui.checkBoxBetwNodes.isChecked():
                lstArgsBetw.append("Nodes")
            for strType in dicGraphType.keys():
                dicGraphStorage[strType] = dicGraphType[strType]()
                strFileName = "betw_{}_{}".format(strGraphName, strType)
                strGP = self.parent.gnuPlotter.genGpStrBetw(strFileName, lstArgsBetw)
                strGPTMP, dicBetwNodes[strType], dicBetwEdges[strType] = plotBetwDistrib(
                    self.parent, dicGraphStorage[strType], lstArgsBetw, False, bWeights
                )
                strGP += strGPTMP
                strSubprocess = "data/histoBetweenness.gp"
                with open(strSubprocess, "w") as fileGP:
                    fileGP.write(strGP)
                subprocess.call(["gnuplot", strSubprocess])
        if self.parent.gui.gbDegDistrib.isChecked():
            lstArgsDeg = []
            if self.parent.gui.checkBoxDegIn.isChecked():
                lstArgsDeg.append("in")
            if self.parent.gui.checkBoxDegOut.isChecked():
                lstArgsDeg.append("out")
            if self.parent.gui.checkBoxDegTot.isChecked():
                lstArgsDeg.append("total")
            for strType in dicGraphType.keys():
                if strType not in dicGraphStorage.keys():
                    dicGraphStorage[strType] = dicGraphType[strType]()
                strFileName = "deg_{}_{}".format(strGraphName, strType)
                strGP, bLogDeg = self.parent.gnuPlotter.genGpStrDeg(strFileName, lstArgsDeg)
                strGP += plotDegDistrib(self.parent, dicGraphStorage[strType], lstArgsDeg, bLogDeg, bWeights)
                strSubprocess = "data/histoDegree.gp"
                with open(strSubprocess, "w") as fileGP:
                    fileGP.write(strGP)
                subprocess.call(["gnuplot", strSubprocess])
        if bWeights:
            dicPlots = {}
            for strType in dicGraphType.keys():
                if strType not in dicGraphStorage.keys():
                    dicGraphStorage[strType] = dicGraphType[strType]()
                arrWeightCount, arrWeight = weight_distribution(dicGraphStorage[strType], False)
                dicPlots["Weight distrib. ({})".format(strType)] = [
                    np.array([arrWeight, arrWeightCount]),
                    "Count",
                    "Weight",
                ]
            plotView = self.plottingWidget.createPlotView(dicPlots)
            self.plottingWidget.addPlotView(graph.get_name(), plotView)
            self.plottingWidget.show()
            # nodes' properties
        bNodeProp = False
        strHeader = "Node"
        lstStrVal = np.arange(graph.num_vertices()).astype(str)
        lstTab = np.repeat("\t", graph.num_vertices())
        if self.parent.gui.checkBoxBetwVal.isChecked():
            bNodeProp = True
            for strType in dicGraphType.keys():
                if strType not in dicGraphStorage.keys():
                    dicGraphStorage[strType] = dicGraphType[strType]()
                    dicBetwNodes[strType] = betwCentrality(dicGraphStorage[strType], bWeights)[0]
                elif strType not in dicBetwNodes.keys():
                    dicBetwNodes[strType] = betwCentrality(dicGraphStorage[strType], bWeights)[0]
                strHeader += "\tBetw.-" + strType
                lstStrVal = np.core.defchararray.add(lstStrVal, lstTab)
                lstStrVal = np.core.defchararray.add(lstStrVal, dicBetwNodes[strType].a.astype(str))
        if self.parent.gui.gbDegreeVal.isChecked():
            bNodeProp = True
            for strType in dicGraphType.keys():
                if strType not in dicGraphStorage.keys():
                    dicGraphStorage[strType] = dicGraphType[strType]()
                if self.parent.gui.checkBoxInDegVal.isChecked():
                    strHeader += "\tIn-deg.-" + strType
                    lstStrVal = np.core.defchararray.add(lstStrVal, lstTab)
                    lstDeg = dicGraphStorage[strType].get_graph().degree_property_map("in").a
                    lstStrVal = np.core.defchararray.add(lstStrVal, lstDeg.astype(str))
                if self.parent.gui.checkBoxOutDegVal.isChecked():
                    strHeader += "\tOut-deg.-" + strType
                    lstStrVal = np.core.defchararray.add(lstStrVal, lstTab)
                    lstDeg = dicGraphStorage[strType].get_graph().degree_property_map("out").a
                    lstStrVal = np.core.defchararray.add(lstStrVal, lstDeg.astype(str))
                if self.parent.gui.checkBoxTotDegVal.isChecked():
                    strHeader += "\tTot.-deg.-" + strType
                    lstStrVal = np.core.defchararray.add(lstStrVal, lstTab)
                    lstDeg = dicGraphStorage[strType].get_graph().degree_property_map("total").a
                    lstStrVal = np.core.defchararray.add(lstStrVal, lstDeg.astype(str))
        strHeader += "\n"
        if bNodeProp:
            with open("data/nodeVal" + strGraphName, "w") as fileNodeVal:
                fileNodeVal.write(strHeader)
                idxLast = len(lstStrVal) - 1
                for i in range(idxLast + 1):
                    fileNodeVal.write(lstStrVal[i])
                    if i != idxLast:
                        fileNodeVal.write("\n")
                        # nodes' sorting
        bNodeSort = False
        nNodesToKeep = self.parent.gui.sbNodesToKeep.value()
        strSort = ""
        if self.parent.gui.checkBoxBetwSort.isChecked():
            bNodeSort = True
            for strType in dicGraphType.keys():
                if strType not in dicGraphStorage.keys():
                    dicGraphStorage[strType] = dicGraphType[strType]()
                    dicBetwNodes[strType] = betwCentrality(dicGraphStorage[strType], bWeights)[0]
                elif strType not in dicBetwNodes.keys():
                    dicBetwNodes[strType] = betwCentrality(dicGraphStorage[strType], bWeights)[0]
                strSort += "Node betweenness sorting - " + strType + "\n"
                lstBetwSort = np.argsort(dicBetwNodes[strType].a)
                for i in range(nNodesToKeep):
                    strSort += " {}".format(lstBetwSort[i])
                strSort += "\n"
        if self.parent.gui.gbDegSort.isChecked():
            bNodeSort = True
            for strType in dicGraphType.keys():
                if strType not in dicGraphStorage.keys():
                    dicGraphStorage[strType] = dicGraphType[strType]()
                if self.parent.gui.checkBoxInDegSort.isChecked():
                    lstDeg = dicGraphStorage[strType].get_graph().degree_property_map("in").a
                    strSort += "Node in-degree sorting - " + strType + "\n"
                    for i in range(nNodesToKeep):
                        strSort += " {}".format(lstDeg[i])
                    strSort += "\n"
                if self.parent.gui.checkBoxOutDegSort.isChecked():
                    lstDeg = dicGraphStorage[strType].get_graph().degree_property_map("out").a
                    strSort += "Node out-degree sorting - " + strType + "\n"
                    for i in range(nNodesToKeep):
                        strSort += " {}".format(lstDeg[i])
                    strSort += "\n"
                if self.parent.gui.checkBoxTotDegSort.isChecked():
                    lstDeg = dicGraphStorage[strType].get_graph().degree_property_map("total").a
                    strSort += "Node total-degree sorting - " + strType + "\n"
                    for i in range(nNodesToKeep):
                        strSort += " {}".format(lstDeg[i])
                    strSort += "\n"
        if bNodeSort:
            with open("data/sort_" + strGraphName, "w") as fileSort:
                fileSort.write(strSort)
                # betweenness Vs weight
        if self.parent.gui.checkBoxBetwVsWeight.isChecked():
            for strType in dicGraphType.keys():
                if strType not in dicGraphStorage.keys():
                    dicGraphStorage[strType] = dicGraphType[strType]()
                    dicBetwEdges[strType] = betwCentrality(dicGraphStorage[strType])[1]
                elif strType not in dicBetwEdges.keys():
                    dicBetwEdges[strType] = betwCentrality(dicGraphStorage[strType])[1]
                plotBetwVsWeight(self.parent, dicGraphStorage[strType], dicBetwEdges[strType])

    def plotEvolProp(self):
        # get requested averaging number
        numAvg = 1
        if self.parent.gui.sbAverage.isEnabled():
            numAvg = self.parent.gui.sbAverage.value()
        print("--- Averaging over {} samples ---".format(numAvg))
        dicVaryingQuantities = {}
        lstStrMeasurements = self.get_measurements()
        dicVaryingQuantities = self.get_varying_quantities()
        # check log and weights
        bWeights = False
        dicLog = {"Degree": False, "Betweenness": False}
        if self.parent.gui.checkBoxConsiderWeights.isChecked():
            bWeights = True
        if self.parent.gui.checkBoxLogDegX.isChecked():
            dicLog["Degree"] = True
        if self.parent.gui.checkBoxLogBetwX.isChecked():
            dicLog["Betweenness"] = True
            # check subgraph types to be studied:
        lstSubgraphTypes = []
        if self.parent.gui.checkBoxAnalyzeExc.isChecked():
            lstSubgraphTypes.append("Exc")
        if self.parent.gui.checkBoxAnalyzeInhib.isChecked():
            lstSubgraphTypes.append("Inhib")
        if self.parent.gui.checkBoxAnalyzeAll.isChecked():
            lstSubgraphTypes.append("All")
            # for each varying quantity
        for strVarQuantity, lstVarValues in dicVaryingQuantities.items():
            # initialize progressbar and plots informations
            self.parent.gui.init_progressbar()
            dicPlotFunc, dicArgs, dicStrGp = checkPlots(self.parent, lstSubgraphTypes, strVarQuantity)
            nNecessarySteps = len(lstVarValues)
            # file names
            strFile = "evol_{}_var{}_".format(self.parent.gui.cbNetTypeEvol.currentText(), strVarQuantity)
            for strMeas in lstStrMeasurements:
                strFile += strMeas[:1]
            dicFileNames = {subgraphType: strFile + "_{}".format(subgraphType) for subgraphType in lstSubgraphTypes}
            # initialize files
            initFiles(self.parent, lstSubgraphTypes, dicFileNames, strVarQuantity, lstStrMeasurements)
            # iterations and averaging
            rStepToPercent = 100.0 / (nNecessarySteps * numAvg)
            for i in range(nNecessarySteps):
                self.setDicPropGraphEvol(strVarQuantity, lstVarValues[i])
                # dictionnary containing the average values for each graph subtypes
                dicAvgValues, dicAvgDistrib = initDicAvg(dicPlotFunc, dicArgs, lstStrMeasurements)
                dicGraphAvgValues = {subgraphType: deepcopy(dicAvgValues) for subgraphType in lstSubgraphTypes}
                dicGraphAvgDistrib = {subgraphType: deepcopy(dicAvgDistrib) for subgraphType in lstSubgraphTypes}
                # ~ dicGraphAvgValues = { subgraphType: multiprocessing.Manager().dict(dicAvgValues) for subgraphType in lstSubgraphTypes }
                # ~ dicGraphAvgDistrib = { subgraphType: multiprocessing.Manager().dict(dicAvgDistrib) for subgraphType in lstSubgraphTypes }
                strAddInfo = "{}{}".format(strVarQuantity[0:4], lstVarValues[i])
                strGraphName = ""
                numNodes = 0
                for j in range(numAvg):
                    graph = GraphClass(self.dicProperties)
                    QtGui.qApp.processEvents()
                    strGraphName = graph.get_name().replace(".", "p")
                    numNodes = graph.num_vertices()
                    # for each subgraph (exc, inhib, all/complete)
                    for subgraphType, dicAvg in dicGraphAvgValues.items():
                        # ~ dicGraphDistribs = dicGraphAvgDistrib[subgraphType]
                        # ~ procScalar = multiprocessing.Process(target=getNetworkProperties, args=(graph, subgraphType, self.dicNetAnalysis, dicPlotFunc, lstStrMeasurements, dicAvg, numAvg))
                        # ~ self.parent.gui.lstProcessesEvolProp[-1].append(procScalar)
                        # ~ procScalar.start()
                        # ~ # distributions
                        # ~ procDistrib = multiprocessing.Process(target=getNetworkDistrib, args=(graph, subgraphType, dicGraphDistribs,dicLog,bWeights,i,strAddInfo))
                        # ~ self.parent.gui.lstProcessesEvolProp[-1].append(procDistrib)
                        # ~ procDistrib.start()
                        dicGraphDistribs = dicGraphAvgDistrib[subgraphType]
                        QtGui.qApp.processEvents()
                        # scalar properties
                        getNetworkProperties(
                            graph, subgraphType, self.dicNetAnalysis, dicPlotFunc, lstStrMeasurements, dicAvg, numAvg
                        )
                        QtGui.qApp.processEvents()
                        # distributions
                        getNetworkDistrib(graph, subgraphType, dicGraphDistribs, dicLog, bWeights, i, strAddInfo)
                        # update progressBar
                    self.parent.gui.progBarEvolProp.setValue(float(numAvg * i + j + 1) * rStepToPercent)
                    QtGui.qApp.processEvents()
                    # ~ for proc in self.parent.gui.lstProcessesEvolProp[-1]:
                    # ~ proc.join()
                    # ~ if self.parent.gui.lstProcessesEvolProp:
                    # ~ self.parent.gui.lstProcessesEvolProp.pop()
                    # ~ self.parent.gui.progBarEvolProp.setValue(float(numAvg*(i+1))*rStepToPercent)
                    # ~ QtGui.qApp.processEvents()
                    # compute distrib and write averaged properties
                computeDistributions(numNodes, dicLog, dicGraphAvgDistrib, numAvg)
                writeAveragedMeasurements(
                    self.parent,
                    strGraphName,
                    lstVarValues[i],
                    dicStrGp,
                    dicFileNames,
                    dicGraphAvgValues,
                    lstStrMeasurements,
                    nNecessarySteps,
                    i,
                    strAddInfo,
                )
                writeAveragedDistributions(
                    self.parent,
                    strGraphName,
                    lstVarValues[i],
                    dicStrGp,
                    dicFileNames,
                    dicGraphAvgDistrib,
                    nNecessarySteps,
                    i,
                    strAddInfo,
                )
            self.parent.gui.progBarEvolProp.setVisible(False)
            # plot the measurements
            if self.parent.gui.gbGraphMeas.isChecked():
                for subgraphType in lstSubgraphTypes:
                    with open("data/" + dicFileNames[subgraphType] + ".gp", "w") as fileGP:
                        strGP, lstLabelsY2 = self.parent.gnuPlotter.genGpStrEvolMeas(
                            dicFileNames[subgraphType], strVarQuantity, lstStrMeasurements
                        )
                        for col, strMeas in enumerate(lstStrMeasurements):
                            strGP += self.parent.gnuPlotter.completeGpStrEvol(
                                dicFileNames[subgraphType], lstLabelsY2, col, strMeas
                            )
                            if strMeas != lstStrMeasurements[-1]:
                                strGP += ",\\\n"
                        fileGP.write(strGP)
                    strSubprocess = "data/" + dicFileNames[subgraphType] + ".gp"
                    subprocess.call(["gnuplot", strSubprocess])  # careful to call it OUT of 'with open(...) as ...'
                    # plot the distributions if necessary
            for subgraphType in lstSubgraphTypes:
                for strPlot in dicPlotFunc.keys():
                    strSubprocess = "data/histo" + strPlot + "Exc.gp"
                    with open(strSubprocess, "w") as fileGP:
                        fileGP.write(dicStrGp[subgraphType][strPlot])
                    subprocess.call(["gnuplot", strSubprocess])  # careful to call it OUT of 'with open(...) as ...'

    def get_varying_quantities(self):
        dicVaryingQuantities = {}
        dicSSS = {"Start": 0, "Stop": 0, "Step": 0}
        for child in self.parent.gui.gbEvolX.children():
            if child != self.parent.gui.gbEvolX.layout():
                # on parcours toutes les groupBox des quantités pouvant varier
                if child.isChecked():
                    strQuantity = child.title()
                    for subChild in child.children():
                        # on cherche les dsb et sb des Start, Stop, Step
                        nLen = len(subChild.objectName())
                        if subChild.objectName()[nLen - 5 :] == "Start":
                            dicSSS["Start"] = subChild.value()
                        if subChild.objectName()[nLen - 4 :] == "Stop":
                            dicSSS["Stop"] = subChild.value()
                        if subChild.objectName()[nLen - 4 :] == "Step":
                            dicSSS["Step"] = subChild.value()
                    dicVaryingQuantities[strQuantity] = np.arange(dicSSS["Start"], dicSSS["Stop"], dicSSS["Step"])
        return dicVaryingQuantities

    def show_measurements(self):
        lstStrMeasurements = self.get_measurements()
        dicData = {}
        idxCurrent = self.parent.gui.comboBoxSelectGraph.currentIndex()
        graph = self.parent.gui.comboBoxSelectGraph.itemData(idxCurrent)
        print(graph.get_density())
        if self.parent.gui.gbGraphMeas.isChecked():
            if self.parent.gui.checkBoxAnalyzeExc.isChecked():
                subGraph = graph.genExcSubgraph()
                for strMeas in lstStrMeasurements:
                    rMeas = self.dicNetAnalysis[strMeas](subGraph.get_graph())
                    dicData[strMeas] = rMeas
                strTitle = graph.get_name() + "Exc"
                self.plottingWidget.addData(strTitle, dicData)
                dicData = {}
            if self.parent.gui.checkBoxAnalyzeInhib.isChecked():
                subGraph = graph.genInhibSubgraph()
                for strMeas in lstStrMeasurements:
                    rMeas = self.dicNetAnalysis[strMeas](subGraph.get_graph())
                    dicData[strMeas] = rMeas
                strTitle = graph.get_name() + "Inhib"
                self.plottingWidget.addData(strTitle, dicData)
                dicData = {}
            if self.parent.gui.checkBoxAnalyzeAll.isChecked():
                for strMeas in lstStrMeasurements:
                    rMeas = self.dicNetAnalysis[strMeas](graph.get_graph())
                    dicData[strMeas] = rMeas
                strTitle = graph.get_name()
                self.plottingWidget.addData(strTitle, dicData)
        self.plottingWidget.show()

    def __del__(self):
        self.dicNetAnalysis = None
        print("GraphAnalysis died")