예제 #1
0
 def refresh_page3(self):	    
     try:
         self.ni = self.sbni.value()
         self.elasticC = Analysis.elasticCalculation(self.files,self.ni,self.sbWD.value()-1).getElasticsConstants()
         for key in self.elasticC:
             globals()['b%s' % key].setText(str(round(self.elasticC[key],2)))	    	
     except:
         pass
예제 #2
0
    def createPage3(self):
        self.page2 = QtGui.QWidget()
        self.page2_layout = QtGui.QGridLayout()
        self.page2.setLayout(self.page2_layout)
        self.lblni = QtGui.QLabel('initial step : ')
        self.lblni.setFixedSize(70, 20)
        self.sbni = QtGui.QSpinBox()
        self.sbni.setMinimum(1)
        self.sbni.setMaximum(self.maxNi())
        self.sbni.setFixedSize(70, 20)
        self.sbni.setValue(self.ni)
        self.connect(self.sbni, QtCore.SIGNAL("valueChanged(int)"),
                     self.refresh_page3)
        self.preview2 = QtGui.QPushButton('&previous', self)
        self.preview2.setFixedSize(150, 20)
        self.connect(self.preview2, QtCore.SIGNAL("clicked()"),
                     self.showPage_1)

        self.elasticC = Analysis.elasticCalculation(self.files, self.ni,
                                                    self.sbWD.value() -
                                                    1).getElasticsConstants()

        if len(self.elasticC) == 0:
            self.showPage_1()
            return

        i = 1
        j = 0
        for key in self.elasticC:
            globals()['a%s' % key] = QtGui.QLabel(str(key) + "(GPa) : ")
            globals()['a%s' % key].setFixedSize(70, 20)
            globals()['b%s' % key] = QtGui.QTextEdit()
            globals()['b%s' % key].setFixedSize(100, 30)
            globals()['b%s' % key].setReadOnly(True)
            globals()['b%s' % key].setText(str(round(self.elasticC[key], 2)))

            self.page2_layout.addWidget(globals()['a%s' % key], i, j,
                                        QtCore.Qt.AlignRight)
            self.page2_layout.addWidget(globals()['b%s' % key], i, j + 1,
                                        QtCore.Qt.AlignLeft)

            if j == 4:
                j = 0
                i += 1
            else:
                j += 2

        if self.nbFiles > 1:
            self.page2_layout.addWidget(self.lblni, i + 1, 0, 1, 3,
                                        QtCore.Qt.AlignRight)
            self.page2_layout.addWidget(self.sbni, i + 1, 3, 1, 3,
                                        QtCore.Qt.AlignLeft)
            self.page2_layout.addWidget(self.preview2, i + 2, 0, 1, 6,
                                        QtCore.Qt.AlignCenter)

            self.addWidget(self.page2)
            self.setCurrentIndex(self.indexOf(self.page2))
예제 #3
0
            while True:
                try:
                    MD_file = openFile(choose = 'Choose the file with deformation (help):')
                    if MD_file.isGoodFile():
                        files[i]=MD_file
                        break
                except:
                    pass;
        while True:
            try:
                step = input("Choose initial step : ")
                if step >=1 and step < files['WD'].getNbTime() : 
                    break;
            except:
                pass;
        elasticC = Analysis.elasticCalculation(files,step,1).getElasticsConstants()
        print '\nThe elastic constants are:'        
        print elasticC
         
    elif choice == 6:
        clear()        
        
    elif choice == 7:
        clear();        
        
    elif choice == 8:
        break;

    if(input_file == True):
        i+=1