Example #1
0
 def previewAll(self):
     if not np.shape(self.data.X):
         self.errorBox('There is no data', 'No data...')
         return
     self.subplot.clear()
     self.subplot.plot(self.data.X, self.data.current, label = 'Experimental data')
     cols = self.tableWidget.columnCount()
     rows = self.tableWidget.rowCount()
     cumulative = np.zeros(len(self.data.X))
     intensity = [float(self.tableWidget.item(row, 5).text()) for row in range(rows) if self.tableWidget.item(row, 0).checkState()&Qt.Checked]
     norm = max(self.data.current)/max(intensity)
     for row in range(rows):
         if self.tableWidget.item(row, 0).checkState() & Qt.Checked:
             error = [self.itemCheck(self.tableWidget.item(row, col), silent=True) for col in range(1, cols-1)]
             if True in error:
                 self.errorBox("Bad parameters", "Bad values")
                 return
             params =[float(self.tableWidget.item(row, col).text()) for col in [5, 6, 2]]
             params[0] *= norm
             label = self.tableWidget.item(row, 1).text()
             shape = self.tableWidget.cellWidget(row, 7).currentText().strip()[0]
             if shape == 'V':
                 params = np.append(params, 0.5)
             elif shape == 'B':
                 params = np.append(params, 0.02)
             p = FIT.Peak(FIT, self.data.X, *params, shape = shape)
             cumulative += p
             self.subplot.plot(self.data.X, p, label = label)
     self.subplot.plot(self.data.X, cumulative, 'r--', label = "Cumulative")
     self.plotAdjust()
Example #2
0
 def previewBand(self, row):
     if not np.shape(self.data.X):
         self.errorBox('There is no data', 'No data...')
         return
     cols = self.tableWidget.columnCount()
     params =[self.tableWidget.item(row, col).text() for col in range(1, cols-1)]
     shape = self.tableWidget.cellWidget(row, cols-1).currentText().strip()[0]
     label = params[0]
     params = np.asarray([params[4], params[5], params[1]]).astype(float)
     if shape == 'V':
         params = np.append(params, 0.5)
     elif shape == 'B':
         params = np.append(params, 0.02)
     self.Plot(self.data.X, self.data.current, "Experimental data")
     self.subplot.plot(self.data.X, FIT.Peak(FIT, self.data.X, *params, shape = shape), label = label)
     self.subplot.legend()
     self.canvas.draw()