Example #1
0
    def __init__(self, parent=None):
        QtGui.QMainWindow.__init__(self, parent)
        self.ui = Ui_MainWindow()
        self.ui.setupUi(self)

        self.time = []
        self.strain = []
        self.stress = []

        self.stressEvaluated = []

        self.popt = 0.0
        self.pcoc = 0.0

        self.dataPath = ''
        self.statusString = ''
        self.materialModel = ''

        ####Assignment of buttons:###

        # self.ui.mplwidget.plotDataPoints(x,y)
        self.ui.button_plot.clicked.connect(self.PLOT)
        self.ui.button_import.clicked.connect(self.importFile)
        self.ui.button_solve.clicked.connect(self.CALIBRATE)
        self.ui.button_export.clicked.connect(self.OPENGUI)
        self.ui.button_pause.clicked.connect(self.UpdateStatus)
Example #2
0
class MyDialog2(QtGui.QMainWindow, Ui_MainWindow2):
    def __init__(self, parent=None):
        QtGui.QMainWindow.__init__(self, parent)
        self.ui = Ui_MainWindow()
        self.ui.setupUi(self)
Example #3
0
 def __init__(self, parent=None):
     QtGui.QMainWindow.__init__(self, parent)
     self.ui = Ui_MainWindow()
     self.ui.setupUi(self)
Example #4
0
class MyDialog(QtGui.QMainWindow, Ui_MainWindow):  # ,MatplotlibWidget):
    def __init__(self, parent=None):
        QtGui.QMainWindow.__init__(self, parent)
        self.ui = Ui_MainWindow()
        self.ui.setupUi(self)

        self.time = []
        self.strain = []
        self.stress = []

        self.stressEvaluated = []

        self.popt = 0.0
        self.pcoc = 0.0

        self.dataPath = ''
        self.statusString = ''
        self.materialModel = ''

        ####Assignment of buttons:###

        # self.ui.mplwidget.plotDataPoints(x,y)
        self.ui.button_plot.clicked.connect(self.PLOT)
        self.ui.button_import.clicked.connect(self.importFile)
        self.ui.button_solve.clicked.connect(self.CALIBRATE)
        self.ui.button_export.clicked.connect(self.OPENGUI)
        self.ui.button_pause.clicked.connect(self.UpdateStatus)

    ###Functions for button actions###

    def PLOT(self, strain, stress):
        self.ui.mplwidget.plotDataPoints(strain, stress)

    def UpdateStatus(self):
        self.ui.plainTextEdit.setPlainText(str(self.statusString))

    def OK(self):
        print 'OK pressed.'

    def READ(self):
        print(self.ui.lineEdit_2.text())

    def OPENGUI(self):
        self.newdialog = MyDialog2(self)
        self.newdialog.show()
        print

    def importFile(self):
        self.fileDialog = QtGui.QFileDialog(self)
        self.dataPath = unicode(self.fileDialog.getOpenFileName())

        try:
            self.time, self.strain, self.stress = DataUtilities.readData(self.dataPath)
            self.statusString += 'Read data routine completed \n'
        except:
            self.statusString += 'Read data routine failed \n'

        finally:
            self.PLOT(self.strain,self.stress)
            #print (self.dataPath)
            self.UpdateStatus()



        # self.fileDialog.show()

    def CALIBRATE(self):


        try:
            self.materialModel=DataUtilities.materialModels[str(self.ui.comboBox_4.currentText())]
            self.popt, self.pcov = DataUtilities.fitData(self.time, self.strain, self.stress, self.materialModel)

            self.statusString += 'Optimizer routine completed \n'
            #self.statusString += str(popt, pcov)
        except:
            self.statusString += 'Optimizer routine failed \n'


        try:
            self.stressEvaluated = DataUtilities.evaluateMaterialModel(self.strain,self.popt,self.materialModel)
        finally:
            self.UpdateStatus()
            self.PLOT(self.strain,self.stressEvaluated)


            # DataUtilities.stuff()

    def store(self):
        # self.ui.button_solve.clicked.connect(self.selectFile)

        #       self.ui.tableWidget.setItem(1,0,self.ui.tableWidget.item(1,1))
        print(self.ui.comboBox.currentText())
        print(self.ui.checkBox.isChecked())