text
stringlengths
0
828
Available options:
:param nfft: size of FFT window to use
:type nfft: int
:param overlap: percent overlap of window
:type overlap: number
:param window: Type of window to use, choices are hanning, hamming, blackman, bartlett or none (rectangular)
:type window: string
:param colormap: Gets set by colormap editor. Holds the information to generate the colormap. Items: :meth:`lut<pyqtgraph:pyqtgraph.ImageItem.setLookupTable>`, :meth:`levels<pyqtgraph:pyqtgraph.ImageItem.setLevels>`, state (info for editor)
:type colormap: dict
""""""
for key, value in kwargs.items():
if key == 'colormap':
SpecWidget.imgArgs['lut'] = value['lut']
SpecWidget.imgArgs['levels'] = value['levels']
SpecWidget.imgArgs['state'] = value['state']
for w in SpecWidget.instances:
w.updateColormap()
else:
SpecWidget.specgramArgs[key] = value"
35,"def clearImg(self):
""""""Clears the current image""""""
self.img.setImage(np.array([[0]]))
self.img.image = None"
36,"def editColormap(self):
""""""Prompts the user with a dialog to change colormap""""""
self.editor = pg.ImageView()
# remove the ROI and Norm buttons
self.editor.ui.roiBtn.setVisible(False)
self.editor.ui.menuBtn.setVisible(False)
self.editor.setImage(self.imageArray)
if self.imgArgs['state'] is not None:
self.editor.getHistogramWidget().item.gradient.restoreState(self.imgArgs['state'])
self.editor.getHistogramWidget().item.setLevels(*self.imgArgs['levels'])
self.editor.closeEvent = self._editor_close
self.editor.setWindowModality(QtCore.Qt.ApplicationModal)
self.editor.show()"
37,"def updateColormap(self):
""""""Updates the currently colormap accoring to stored settings""""""
if self.imgArgs['lut'] is not None:
self.img.setLookupTable(self.imgArgs['lut'])
self.img.setLevels(self.imgArgs['levels'])"
38,"def appendData(self, xdata, ydata, color='b', legendstr=None):
""""""Adds the data to the plot
:param xdata: index values for data, plotted on x-axis
:type xdata: numpy.ndarray
:param ydata: value data to plot, dimension must match xdata
:type ydata: numpy.ndarray
""""""
item = self.plot(xdata, ydata, pen=color)
if legendstr is not None:
self.legend.addItem(item, legendstr)
return item"
39,"def setLabels(self, xlabel=None, ylabel=None, title=None, xunits=None, yunits=None):
""""""Sets the plot labels
:param xlabel: X-axis label (do not include units)
:type xlabel: str
:param ylabel: Y-axis label (do not include units)
:type ylabel: str
:param title: Plot title
:type title: str
:param xunit: SI units for the x-axis. An appropriate label will be appended according to scale
:type xunit: str
:param yunit: SI units for the y-axis. An appropriate label will be appended according to scale
:type yunit: str
""""""
if xlabel is not None:
self.setLabel('bottom', xlabel, units=xunits)
if ylabel is not None:
self.setLabel('left', ylabel, units=yunits)
if title is not None:
self.setTitle(title)"
40,"def setPoint(self, x, group, y):
""""""Sets the given point, connects line to previous point in group
:param x: x value of point
:type x: float
:param group: group which plot point for
:type group: float
:param y: y value of point
:type y: float
""""""
if x == -1:
# silence window
self.plot([0],[y], symbol='o')
else:
yindex = self.groups.index(group)
xdata, ydata = self.lines[yindex].getData()
if ydata is None:
xdata = [x]
ydata = [y]
else:
xdata = np.append(xdata, x)
ydata = np.append(ydata, y)
self.lines[yindex].setData(xdata, ydata)"
41,"def setLabels(self, name):