示例#1
0
 def showTextLabel(self, x, y, secure=25):
     """
     add labels of principle peaks of spectrum or chroma
     on the plot, return the labels, that we can show hide
     
     """
     maxis = []  #will contain tuple(rt, intens)
     indexes = []
     #from core.MetObjects import MSAbstractTypes
     from scipy.ndimage import gaussian_filter1d as gauss
     z = gauss(y, 1)
     #z = MSAbstractTypes.computeBaseLine(z, 92., 0.8)
     i = 0
     while i < len(z) - 1:
         while z[i + 1] >= z[i] and i < len(y) - 2:
             i += 1
         maxis.append((x[i], y[i]))
         indexes.append(i)
         while z[i + 1] <= z[i] and i < len(z) - 2:
             i += 1
         i += 1
     labels = []
     for t in sorted(maxis, key=lambda x: x[1])[-5:]:
         g = QGraphicsTextItem(str(t[0]))
         g.setFlag(QGraphicsItem.ItemIgnoresTransformations)
         font = QApplication.font()
         font.setPointSizeF(6.5)
         g.setFont(font)
         g.setDefaultTextColor(Qt.black)
         g.setPos(t[0], t[1])
         labels.append(g)
         self.pw.addItem(g)
     return labels
示例#2
0
 def showTextLabel(self, x, y, secure=25):
     """
     add labels of principle peaks of spectrum or chroma
     on the plot, return the labels, that we can show hide
     
     """
     maxis=[]#will contain tuple(rt, intens)
     indexes=[]
     #from core.MetObjects import MSAbstractTypes
     from scipy.ndimage import gaussian_filter1d as gauss        
     z=gauss(y, 1)
     #z = MSAbstractTypes.computeBaseLine(z, 92., 0.8)
     i=0
     while i <len(z)-1:
         while z[i+1] >= z[i] and i < len(y)-2:
             i+=1
         maxis.append((x[i], y[i])) 
         indexes.append(i)
         while z[i+1] <= z[i] and i<len(z)-2:
             i+=1
         i+=1
     labels=[]    
     for t in sorted(maxis, key=lambda x:x[1])[-5:]:
         g=QGraphicsTextItem(str(t[0]))
         g.setFlag(QGraphicsItem.ItemIgnoresTransformations)
         font=QApplication.font()
         font.setPointSizeF(6.5)
         g.setFont(font)
         g.setDefaultTextColor(Qt.black)
         g.setPos(t[0], t[1])
         labels.append(g)
         self.pw.addItem(g)
     return labels
示例#3
0
 def annotate(self):
     text, bool_ = QInputDialog.getText(self.view, "Annotation dialog", "Annotation:")
     g=QGraphicsTextItem(str(text))
     g.setFlag(QGraphicsItem.ItemIgnoresTransformations)
     g.setFlag(QGraphicsItem.ItemIsMovable)
     g.setTextInteractionFlags(Qt.TextEditorInteraction)
     font=qApp.instance().font()
     font.setPointSizeF(10.)
     g.setFont(font)
     g.setDefaultTextColor(Qt.blue)
     g.setPos(500,1e4)
     self.trashItems.append(g)
     self.pw.addItem(g)
示例#4
0
 def annotate(self):
     text, bool_ = QInputDialog.getText(self.view, "Annotation dialog",
                                        "Annotation:")
     g = QGraphicsTextItem(str(text))
     g.setFlag(QGraphicsItem.ItemIgnoresTransformations)
     g.setFlag(QGraphicsItem.ItemIsMovable)
     g.setTextInteractionFlags(Qt.TextEditorInteraction)
     font = qApp.instance().font()
     font.setPointSizeF(10.)
     g.setFont(font)
     g.setDefaultTextColor(Qt.blue)
     g.setPos(500, 1e4)
     self.trashItems.append(g)
     self.pw.addItem(g)