Ejemplo n.º 1
0
 def report_fit(self):
     message_box = QtGui.QMessageBox()
     message_box.setText("Fit Results")
     if self.fit.result.success:
         summary = 'Fit Successful'
     else:
         summary = 'Fit Failed'
     if self.fit.result.errorbars:
         errors = 'Uncertainties estimated'
     else:
         errors = 'Uncertainties not estimated'
     text = '%s\n' % summary +\
            '%s\n' % self.fit.result.message +\
            '%s\n' % self.fit.result.lmdif_message +\
            'scipy.optimize.leastsq error value = %s\n' % self.fit.result.ier +\
            'Chi^2 = %s\n' % self.fit.result.chisqr +\
            'Reduced Chi^2 = %s\n' % self.fit.result.redchi +\
            '%s\n' % errors +\
            'No. of Function Evaluations = %s\n' % self.fit.result.nfev +\
            'No. of Variables = %s\n' % self.fit.result.nvarys +\
            'No. of Data Points = %s\n' % self.fit.result.ndata +\
            'No. of Degrees of Freedom = %s\n' % self.fit.result.nfree +\
            '%s' % self.fit.fit_report()
     message_box.setInformativeText(text)
     message_box.setStandardButtons(QtGui.QMessageBox.Ok)
     spacer = QtGui.QSpacerItem(500, 0, QtGui.QSizePolicy.Minimum,
                                QtGui.QSizePolicy.Expanding)
     layout = message_box.layout()
     layout.addItem(spacer, layout.rowCount(), 0, 1, layout.columnCount())
     message_box.exec_()
Ejemplo n.º 2
0
 def confirm_action(self, query, information=None):
     message_box = QtGui.QMessageBox()
     message_box.setText(query)
     if information:
         message_box.setInformativeText(information)
     message_box.setStandardButtons(QtGui.QMessageBox.Ok | 
                                    QtGui.QMessageBox.Cancel)
     message_box.setDefaultButton(QtGui.QMessageBox.Ok)
     return message_box.exec_()
Ejemplo n.º 3
0
 def accept(self):
     try:
         root = self.globus.load(self.user, self.port)
         from nexpy.gui.consoleapp import _mainwindow, _shell
         name = _mainwindow.treeview.tree.get_name(root.nxfilename)
         _mainwindow.treeview.tree[name] = _shell[name] = root
         _mainwindow.remote_defaults = (self.catalog, self.dataset)
         logging.info(
             "Opening remote NeXus file '%s' on '%s' as workspace '%s'" %
             (root.nxfilename, root._file, name))
         super(RemoteDialog, self).accept()
     except CommunicationError as e:
         msgBox = QtGui.QMessageBox()
         msgBox.setText("Could not connect to: " + uri)
         msgBox.setIcon(QtGui.QMessageBox.Critical)
         logging.debug("Connection failed to: " + uri + "\n\n" + str(e))
         msgBox.exec_()
     except NeXusError:
         super(RemoteDialog, self).reject()