signature stringlengths 8 3.44k | body stringlengths 0 1.41M | docstring stringlengths 1 122k | id stringlengths 5 17 |
|---|---|---|---|
def updateRasterBounds(self): | yrange = self.viewRange()[<NUM_LIT:1>]<EOL>yrange_size = yrange[<NUM_LIT:1>] - yrange[<NUM_LIT:0>]<EOL>rmax = self.rasterTop*yrange_size + yrange[<NUM_LIT:0>]<EOL>rmin = self.rasterBottom*yrange_size + yrange[<NUM_LIT:0>]<EOL>self.rasterYslots = np.linspace(rmin, rmax, self.nreps)<EOL>self.rasterBoundsUpdated.emit((sel... | Updates the y-coordinate slots where the raster points
are plotted, according to the current limits of the y-axis | f10614:c1:m10 |
def askRasterBounds(self): | dlg = RasterBoundsDialog(bounds= (self.rasterBottom, self.rasterTop))<EOL>if dlg.exec_():<EOL><INDENT>bounds = dlg.values()<EOL>self.setRasterBounds(bounds)<EOL><DEDENT> | Prompts the user to provide the raster bounds with a dialog.
Saves the bounds to be applied to the plot | f10614:c1:m11 |
def getRasterBounds(self): | return (self.rasterBottom, self.rasterTop)<EOL> | Current raster y-axis plot limits
:returns: (float, float) -- (min, max) of raster plot bounds | f10614:c1:m12 |
def rangeChange(self, pw, ranges): | if hasattr(ranges, '<STR_LIT>'):<EOL><INDENT>yrange_size = ranges[<NUM_LIT:1>][<NUM_LIT:1>] - ranges[<NUM_LIT:1>][<NUM_LIT:0>]<EOL>stim_x, stim_y = self.stimPlot.getData()<EOL>if stim_y is not None:<EOL><INDENT>stim_height = yrange_size*STIM_HEIGHT<EOL>stim_y = stim_y - np.amin(stim_y)<EOL>if np.amax(stim_y) != <NUM_LI... | Adjusts the stimulus signal to keep it at the top of a plot,
after any ajustment to the axes ranges takes place.
This is a slot for the undocumented pyqtgraph signal sigRangeChanged.
From what I can tell the arguments are:
:param pw: reference to the emitting object (plot widget in my ... | f10614:c1:m14 |
def update_thresh(self): | thresh_val = self.threshLine.value()<EOL>self.threshold_field.setValue(thresh_val)<EOL>self.thresholdUpdated.emit(thresh_val, self.getTitle())<EOL> | Emits a Qt signal thresholdUpdated with the current threshold value | f10614:c1:m15 |
def setAmpConversionFactor(self, scalar): | self._ampScalar = scalar<EOL> | Set the scalar for converting volts to amps when the trace
plot is set to plot Amps | f10614:c1:m20 |
def fromFile(self, fname): | spec, f, bins, dur = audiotools.spectrogram(fname, **self.specgramArgs)<EOL>self.updateImage(spec, bins, f)<EOL>return dur<EOL> | Displays a spectrogram of an audio file. Supported formats see :func:`sparkle.tools.audiotools.audioread`
:param fname: file path of the audiofile to display
:type fname: str
:returns: float -- duration of audio recording (seconds) | f10614:c2:m1 |
def updateImage(self, imgdata, xaxis=None, yaxis=None): | imgdata = imgdata.T<EOL>self.img.setImage(imgdata)<EOL>if xaxis is not None and yaxis is not None:<EOL><INDENT>xscale = <NUM_LIT:1.0>/(imgdata.shape[<NUM_LIT:0>]/xaxis[-<NUM_LIT:1>])<EOL>yscale = <NUM_LIT:1.0>/(imgdata.shape[<NUM_LIT:1>]/yaxis[-<NUM_LIT:1>])<EOL>self.resetScale() <EOL>self.img.scale(xscale, ysca... | Updates the Widget image directly.
:type imgdata: numpy.ndarray, see :meth:`pyqtgraph:pyqtgraph.ImageItem.setImage`
:param xaxis: x-axis values, length should match dimension 1 of imgdata
:param yaxis: y-axis values, length should match dimension 0 of imgdata | f10614:c2:m2 |
def resetScale(self): | self.img.scale(<NUM_LIT:1.>/self.imgScale[<NUM_LIT:0>], <NUM_LIT:1.>/self.imgScale[<NUM_LIT:1>])<EOL>self.imgScale = (<NUM_LIT:1.>,<NUM_LIT:1.>)<EOL> | Resets the scale on this image. Correctly aligns time scale, undoes manual scaling | f10614:c2:m3 |
def updateData(self, signal, fs): | <EOL>t = threading.Thread(target=_doSpectrogram, args=(self.spec_done, (fs, signal),), kwargs=self.specgramArgs)<EOL>t.start()<EOL> | Displays a spectrogram of the provided signal
:param signal: 1-D signal of audio
:type signal: numpy.ndarray
:param fs: samplerate of signal
:type fs: int | f10614:c2:m4 |
@staticmethod<EOL><INDENT>def setSpecArgs(**kwargs):<DEDENT> | for key, value in kwargs.items():<EOL><INDENT>if key == '<STR_LIT>':<EOL><INDENT>SpecWidget.imgArgs['<STR_LIT>'] = value['<STR_LIT>']<EOL>SpecWidget.imgArgs['<STR_LIT>'] = value['<STR_LIT>']<EOL>SpecWidget.imgArgs['<STR_LIT:state>'] = value['<STR_LIT:state>']<EOL>for w in SpecWidget.instances:<EOL><INDENT>w.updateColor... | Sets optional arguments for the spectrogram appearance.
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... | f10614:c2:m5 |
def clearImg(self): | self.img.setImage(np.array([[<NUM_LIT:0>]]))<EOL>self.img.image = None<EOL> | Clears the current image | f10614:c2:m6 |
def hasImg(self): | return self.img.image is not None<EOL> | Whether an image is currently displayed | f10614:c2:m7 |
def editColormap(self): | self.editor = pg.ImageView()<EOL>self.editor.ui.roiBtn.setVisible(False)<EOL>self.editor.ui.menuBtn.setVisible(False)<EOL>self.editor.setImage(self.imageArray)<EOL>if self.imgArgs['<STR_LIT:state>'] is not None:<EOL><INDENT>self.editor.getHistogramWidget().item.gradient.restoreState(self.imgArgs['<STR_LIT:state>'])<EOL... | Prompts the user with a dialog to change colormap | f10614:c2:m8 |
def updateColormap(self): | if self.imgArgs['<STR_LIT>'] is not None:<EOL><INDENT>self.img.setLookupTable(self.imgArgs['<STR_LIT>'])<EOL>self.img.setLevels(self.imgArgs['<STR_LIT>'])<EOL><DEDENT> | Updates the currently colormap accoring to stored settings | f10614:c2:m10 |
def getColormap(self): | return self.imgArgs<EOL> | Returns the currently stored colormap settings | f10614:c2:m11 |
def updateData(self, indexData, valueData): | self.fftPlot.setData(indexData, valueData)<EOL> | Plot the given data
:param indexData: index point values to match valueData array, may be plotted on x or y axis, depending on plot orientation.
:type indexData: numpy.ndarray
:param valueData: values to plot at indexData points, may be plotted on x or y axis, depending on plot orientation.
... | f10614:c3:m1 |
def appendData(self, xdata, ydata, color='<STR_LIT:b>', legendstr=None): | item = self.plot(xdata, ydata, pen=color)<EOL>if legendstr is not None:<EOL><INDENT>self.legend.addItem(item, legendstr)<EOL><DEDENT>return item<EOL> | 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 | f10614:c4:m2 |
def setLabels(self, xlabel=None, ylabel=None, title=None, xunits=None, yunits=None): | if xlabel is not None:<EOL><INDENT>self.setLabel('<STR_LIT>', xlabel, units=xunits)<EOL><DEDENT>if ylabel is not None:<EOL><INDENT>self.setLabel('<STR_LIT:left>', ylabel, units=yunits)<EOL><DEDENT>if title is not None:<EOL><INDENT>self.setTitle(title)<EOL><DEDENT> | 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 wi... | f10614:c4:m3 |
def setPoint(self, x, group, y): | if x == -<NUM_LIT:1>:<EOL><INDENT>self.plot([<NUM_LIT:0>],[y], symbol='<STR_LIT:o>')<EOL><DEDENT>else:<EOL><INDENT>yindex = self.groups.index(group)<EOL>xdata, ydata = self.lines[yindex].getData()<EOL>if ydata is None:<EOL><INDENT>xdata = [x]<EOL>ydata = [y]<EOL><DEDENT>else:<EOL><INDENT>xdata = np.append(xdata, x)<EOL... | 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 | f10614:c5:m1 |
def setLabels(self, name): | if name == "<STR_LIT>":<EOL><INDENT>self.setWindowTitle("<STR_LIT>")<EOL>self.setTitle("<STR_LIT>")<EOL>self.setLabel('<STR_LIT>', "<STR_LIT>", units='<STR_LIT>')<EOL>self.setLabel('<STR_LIT:left>', '<STR_LIT>')<EOL><DEDENT>elif name == "<STR_LIT>":<EOL><INDENT>self.setWindowTitle("<STR_LIT>")<EOL>self.setTitle("<STR_L... | Sets plot labels, according to predefined options
:param name: The type of plot to create labels for. Options: calibration, tuning, anything else labels for spike counts
:type name: str | f10614:c5:m2 |
@staticmethod<EOL><INDENT>def loadCurve(data, groups, thresholds, absvals, fs, xlabels):<DEDENT> | xlims = (xlabels[<NUM_LIT:0>], xlabels[-<NUM_LIT:1>])<EOL>pw = ProgressWidget(groups, xlims)<EOL>spike_counts = []<EOL>for itrace in range(data.shape[<NUM_LIT:0>]):<EOL><INDENT>count = <NUM_LIT:0><EOL>for ichan in range(data.shape[<NUM_LIT:2>]):<EOL><INDENT>flat_reps = data[itrace,:,ichan,:].flatten()<EOL>count += len(... | Accepts a data set from a whole test, averages reps and re-creates the
progress plot as the same as it was during live plotting. Number of thresholds
must match the size of the channel dimension | f10614:c5:m3 |
def setBins(self, bins): | self._bins = bins<EOL>self._counts = np.zeros_like(self._bins)<EOL>bar_width = bins[<NUM_LIT:0>]*<NUM_LIT><EOL>self.histo.setOpts(x=bins, height=self._counts, width=bar_width)<EOL>self.setXlim((<NUM_LIT:0>, bins[-<NUM_LIT:1>]))<EOL> | Sets the bin centers (x values)
:param bins: time bin centers
:type bins: numpy.ndarray | f10614:c6:m1 |
def clearData(self): | self._counts = np.zeros_like(self._bins)<EOL>self.histo.setOpts(height=self._counts)<EOL> | Clears all histograms (keeps bins) | f10614:c6:m2 |
def appendData(self, bins, repnum=None): | <EOL>bins[bins >= len(self._counts)] = len(self._counts) -<NUM_LIT:1><EOL>bin_totals = np.bincount(bins)<EOL>self._counts[:len(bin_totals)] += bin_totals<EOL>self.histo.setOpts(height=np.array(self._counts))<EOL> | Increases the values at bins (indexes)
:param bins: bin center values to increment counts for, to increment a time bin more than once include multiple items in list with that bin center value
:type bins: numpy.ndarray | f10614:c6:m3 |
def getData(self): | return self.histo.opts['<STR_LIT>']<EOL> | Gets the heights of the histogram bars
:returns: list<int> -- the count values for each bin | f10614:c6:m4 |
def setSr(self, fs): | self.tracePlot.setSr(fs)<EOL>self.stimPlot.setSr(fs)<EOL> | Sets the samplerate of the input operation being plotted | f10614:c7:m1 |
def setWindowSize(self, winsz): | self.tracePlot.setWindowSize(winsz)<EOL>self.stimPlot.setWindowSize(winsz)<EOL> | Sets the size of scroll window | f10614:c7:m2 |
def clearData(self): | self.tracePlot.clearData()<EOL>self.stimPlot.clearData()<EOL> | Clears all data from plot | f10614:c7:m3 |
def addPlot(self, xdata, ydata, xlabel=None, ylabel=None, title=None, xunits=None, yunits=None): | p = SimplePlotWidget(xdata, ydata)<EOL>p.setLabels(xlabel, ylabel, title, xunits, yunits)<EOL>self.stacker.addWidget(p)<EOL> | Adds a new plot for the given set of data and/or labels, Generates a SimplePlotWidget
: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 | f10614:c9:m1 |
def addSpectrogram(self, ydata, fs, title=None): | p = SpecWidget()<EOL>p.updateData(ydata, fs)<EOL>if title is not None:<EOL><INDENT>p.setTitle(title)<EOL><DEDENT>self.stacker.addWidget(p)<EOL> | Adds a new spectorgram plot for the given image. Generates a SpecWidget
:param ydata: 2-D array of the image to display
:type ydata: numpy.ndarray
:param fs: the samplerate of the signal in the image, used to set time/ frequency scale
:type fs: int
:param title: Plot title
... | f10614:c9:m2 |
def nextPlot(self): | if self.stacker.currentIndex() < self.stacker.count():<EOL><INDENT>self.stacker.setCurrentIndex(self.stacker.currentIndex()+<NUM_LIT:1>)<EOL><DEDENT> | Moves the displayed plot to the next one | f10614:c9:m3 |
def prevPlot(self): | if self.stacker.currentIndex() > <NUM_LIT:0>:<EOL><INDENT>self.stacker.setCurrentIndex(self.stacker.currentIndex()-<NUM_LIT:1>)<EOL><DEDENT> | Moves the displayed plot to the previous one | f10614:c9:m4 |
def firstPlot(self): | self.stacker.setCurrentIndex(<NUM_LIT:0>)<EOL> | Jumps display plot to the first one | f10614:c9:m5 |
def lastPlot(self): | self.stacker.setCurrentIndex(self.stacker.count()-<NUM_LIT:1>)<EOL> | Jumps display plot to the last one | f10614:c9:m6 |
def updateSpec(self, *args, **kwargs): | if args[<NUM_LIT:0>] is None:<EOL><INDENT>self.stimSpecPlot.clearImg()<EOL>self.responseSpecPlot.clearImg()<EOL><DEDENT>else:<EOL><INDENT>p = kwargs.pop('<STR_LIT>')<EOL>if p == '<STR_LIT>':<EOL><INDENT>self.responseSpecPlot.updateData(*args, **kwargs)<EOL><DEDENT>else:<EOL><INDENT>self.stimSpecPlot.updateData(*args, *... | Updates the spectrogram given by kwarg *'plot'*, which is
either 'response' or (well actually anything). If no arguments
are given, clears both spectrograms.
For other arguments, see: :meth:`SpecWidget.updateData<sparkle.gui.plotting.pyqtgraph_widgets.SpecWidget.updateData>` | f10615:c0:m1 |
def updateSignal(self, *args, **kwargs): | p = kwargs.pop('<STR_LIT>')<EOL>if p == '<STR_LIT>':<EOL><INDENT>self.responseSignalPlot.updateData(*args, **kwargs)<EOL><DEDENT>else:<EOL><INDENT>self.stimSignalPlot.updateData(*args, **kwargs)<EOL><DEDENT> | Updates the signal plots kwarg *'plot'*, which is
either 'response' or (well actually anything).
For other arguments, see: :meth:`FFTWidget.updateData<sparkle.gui.plotting.pyqtgraph_widgets.FFTWidget.updateData>` | f10615:c0:m2 |
def updateFft(self, *args, **kwargs): | p = kwargs.pop('<STR_LIT>')<EOL>if p == '<STR_LIT>': <EOL><INDENT>self.responseFftPlot.updateData(*args, **kwargs)<EOL><DEDENT>else:<EOL><INDENT>self.stimFftPlot.updateData(*args, **kwargs)<EOL><DEDENT> | Updates the FFT plots kwarg *'plot'*, which is
either 'response' or (well actually anything).
For other arguments, see: :meth:`FFTWidget.updateData<sparkle.gui.plotting.pyqtgraph_widgets.FFTWidget.updateData>` | f10615:c0:m3 |
def setXlimits(self, lims): | self.responseSignalPlot.setXlim(lims)<EOL>self.stimSignalPlot.setXlim(lims)<EOL> | Sets the X axis limits of the signal plots
:param lims: (min, max) of x axis, in same units as data
:type lims: (float, float) | f10615:c0:m4 |
def autoRange(self): | self.responseSignalPlot.autoRange()<EOL>self.responseFftPlot.autoRange()<EOL> | Automatically adjust the visiable region of the response
signal and FFT plots | f10615:c0:m5 |
def setCustomMouse(self, usecustom=True): | self._customMouse = usecustom<EOL> | Whether to use our custom defined mouse behaviour
:param usecustom: whether to use the custom behaviour
:type usecustom: bool | f10617:c0:m1 |
def setZeroWheel(self): | self._zeroWheel = True<EOL>self.menu.viewAll.triggered.disconnect()<EOL>self.menu.viewAll.triggered.connect(self.autoRange)<EOL> | Sets the zoom locus of the mouse wheel to the point 0,0
(instead of the coordinates under the cursor) | f10617:c0:m2 |
def mouseDragEvent(self, ev, axis=None): | if self._customMouse and ev.button() == QtCore.Qt.RightButton:<EOL><INDENT>ev.accept() <EOL>if ev.isFinish(): <EOL><INDENT>pos = ev.pos()<EOL>self.rbScaleBox.hide()<EOL>ax = QtCore.QRectF(Point(ev.buttonDownPos(ev.button())), Point(pos))<EOL>ax = self.childGroup.mapRectFromParent(ax)<EOL>self.showAxRect(ax)<EOL>self.... | Customized mouse dragging, where the right drag is bounding box zoom
:param ev: event object containing drag state info
:type ev: :py:class:`MouseDragEvent<pyqtgraph:pyqtgraph.GraphicsScene.mouseEvents.MouseDragEvent>` | f10617:c0:m3 |
def autoRange0(self): | return self.autoRange(padding=<NUM_LIT:0>)<EOL> | autoRange with 0 padding | f10617:c0:m4 |
def wheelEvent(self, ev, axis=None): | state = None<EOL>if ev.modifiers() == QtCore.Qt.ControlModifier:<EOL><INDENT>state = self.mouseEnabled()<EOL>self.setMouseEnabled(not state[<NUM_LIT:0>], not state[<NUM_LIT:1>])<EOL><DEDENT>if self._zeroWheel:<EOL><INDENT>ev.pos = lambda : self.mapViewToScene(QtCore.QPoint(<NUM_LIT:0>,<NUM_LIT:0>))<EOL><DEDENT>super(Sp... | Reacts to mouse wheel movement, custom behaviour switches zoom
axis when ctrl is pressed, and sets the locus of zoom, if zeroWheel
is set. | f10617:c0:m5 |
def autoRange(self): | self.view.autoRange(padding=<NUM_LIT:0>)<EOL> | autoRange with zero padding | f10617:c1:m1 |
def copy(self): | <EOL>m = QtGui.QMenu()<EOL>for sm in self.subMenus():<EOL><INDENT>if isinstance(sm, QtGui.QMenu):<EOL><INDENT>m.addMenu(sm)<EOL><DEDENT>else:<EOL><INDENT>m.addAction(sm)<EOL><DEDENT><DEDENT>m.setTitle(self.title())<EOL>return m<EOL> | Adds menus to itself, required by ViewBox | f10617:c1:m2 |
def subMenus(self): | return [self.viewAll]<EOL> | Returns a List of all submenus | f10617:c1:m3 |
def setViewList(self, views): | pass<EOL> | This will do nothing, required by ViewBox | f10617:c1:m4 |
def updateOutFft(self, *args, **kwargs): | self.outFft.updateData(*args, **kwargs)<EOL> | Sets new data for outgoing FFT
for arguments, see :meth:`FFTWidget.updateData<sparkle.gui.plotting.pyqtgraph_widgets.FFTWidget.updateData>` | f10618:c0:m1 |
def updateInFft(self, *args, **kwargs): | self.inFft.updateData(*args, **kwargs)<EOL> | Sets new data for recorded FFT
for arguments, see :meth:`FFTWidget.updateData<sparkle.gui.plotting.pyqtgraph_widgets.FFTWidget.updateData>` | f10618:c0:m2 |
def values(self): | lower = float(self.lowerSpnbx.value())<EOL>upper = float(self.upperSpnbx.value())<EOL>return (lower, upper)<EOL> | Gets the user enter max and min values of where the
raster points should appear on the y-axis
:returns: (float, float) -- (min, max) y-values to bound the raster plot by | f10619:c0:m1 |
def updateSpec(self, *args, **kwargs): | if args[<NUM_LIT:0>] is None:<EOL><INDENT>self.specPlot.clearImg()<EOL><DEDENT>elif isinstance(args[<NUM_LIT:0>], basestring):<EOL><INDENT>self.specPlot.fromFile(*args, **kwargs)<EOL><DEDENT>else:<EOL><INDENT>self.specPlot.updateData(*args,**kwargs)<EOL><DEDENT> | Updates the spectrogram. First argument can be a filename,
or a data array. If no arguments are given, clears the spectrograms.
For other arguments, see: :meth:`SpecWidget.updateData<sparkle.gui.plotting.pyqtgraph_widgets.SpecWidget.updateData>` | f10620:c0:m1 |
def showSpec(self, fname): | if not self.specPlot.hasImg() and fname is not None:<EOL><INDENT>self.specPlot.fromFile(fname)<EOL><DEDENT> | Draws the spectrogram if it is currently None | f10620:c0:m2 |
def updateFft(self, *args, **kwargs): | self.fftPlot.updateData(*args, **kwargs)<EOL> | Updates the FFT plot with new data
For arguments, see: :meth:`FFTWidget.updateData<sparkle.gui.plotting.pyqtgraph_widgets.FFTWidget.updateData>` | f10620:c0:m3 |
def updateSpiketrace(self, xdata, ydata, plotname=None): | if plotname is None:<EOL><INDENT>plotname = self.responsePlots.keys()[<NUM_LIT:0>]<EOL><DEDENT>if len(ydata.shape) == <NUM_LIT:1>:<EOL><INDENT>self.responsePlots[plotname].updateData(axeskey='<STR_LIT>', x=xdata, y=ydata)<EOL><DEDENT>else:<EOL><INDENT>self.responsePlots[plotname].addTraces(xdata, ydata)<EOL><DEDENT> | Updates the spike trace
:param xdata: index values
:type xdata: numpy.ndarray
:param ydata: values to plot
:type ydata: numpy.ndarray | f10620:c0:m8 |
def clearRaster(self): | for plot in self.responsePlots.values():<EOL><INDENT>plot.clearData('<STR_LIT>')<EOL><DEDENT> | Clears data from the raster plots | f10620:c0:m9 |
def addRasterPoints(self, xdata, repnum, plotname=None): | if plotname is None:<EOL><INDENT>plotname = self.responsePlots.keys()[<NUM_LIT:0>]<EOL><DEDENT>ydata = np.ones_like(xdata)*repnum<EOL>self.responsePlots[plotname].appendData('<STR_LIT>', xdata, ydata)<EOL> | Add a list (or numpy array) of points to raster plot,
in any order.
:param xdata: bin centers
:param ydata: rep number | f10620:c0:m10 |
def updateSignal(self, xdata, ydata, plotname=None): | if plotname is None:<EOL><INDENT>plotname = self.responsePlots.keys()[<NUM_LIT:0>]<EOL><DEDENT>self.responsePlots[plotname].updateData(axeskey='<STR_LIT>', x=xdata, y=ydata)<EOL> | Updates the trace of the outgoing signal
:param xdata: time points of recording
:param ydata: brain potential at time points | f10620:c0:m11 |
def setXlimits(self, lims): | <EOL>self.specPlot.setXlim(lims)<EOL>for plot in self.responsePlots.values():<EOL><INDENT>plot.setXlim(lims)<EOL><DEDENT>sizes = self.splittersw.sizes()<EOL>if len(sizes) > <NUM_LIT:1>:<EOL><INDENT>if self.badbadbad:<EOL><INDENT>sizes[<NUM_LIT:0>] +=<NUM_LIT:1><EOL>sizes[<NUM_LIT:1>] -=<NUM_LIT:1><EOL><DEDENT>else:<EOL... | Sets the X axis limits of the trace plot
:param lims: (min, max) of x axis, in same units as data
:type lims: (float, float) | f10620:c0:m12 |
def setNreps(self, nreps): | for plot in self.responsePlots.values():<EOL><INDENT>plot.setNreps(nreps)<EOL><DEDENT> | Sets the number of reps before the raster plot resets | f10620:c0:m14 |
def sizeHint(self): | return QtCore.QSize(<NUM_LIT>,<NUM_LIT>)<EOL> | default size? | f10620:c0:m15 |
def specAutoRange(self): | trace_range = self.responsePlots.values()[<NUM_LIT:0>].viewRange()[<NUM_LIT:0>]<EOL>vb = self.specPlot.getViewBox()<EOL>vb.autoRange(padding=<NUM_LIT:0>)<EOL>self.specPlot.setXlim(trace_range)<EOL> | Auto adjusts the visible range of the spectrogram | f10620:c0:m16 |
def dragEnterEvent(self, event): | self.setFlat(False)<EOL>event.accept()<EOL> | Changes apperance of button when a dragged mouse cursor is over it | f10622:c0:m1 |
def dragLeaveEvent(self, event): | self.setFlat(True)<EOL>event.accept()<EOL> | Changes apperance of button when a dragged mouse cursor leaves it | f10622:c0:m2 |
def dragMoveEvent(self, event): | event.accept()<EOL> | This needs to be allowed | f10622:c0:m3 |
def leaveEvent(self, event): | self.setFlat(True)<EOL>event.accept()<EOL> | Sets button image back to normal after a drop | f10622:c0:m4 |
def dropEvent(self, event): | super(TrashWidget, self).dropEvent(event)<EOL>self.itemTrashed.emit()<EOL> | Emits the itemTrashed signal, data contained in drag
operation left to be garbage collected | f10622:c0:m5 |
def setCurveModel(self, model): | self.stimModel = model<EOL>self.ui.curveWidget.setModel(model)<EOL> | Sets the stimulus model for the calibration curve test
:param model: Stimulus model that has a tone curve configured
:type model: :class:`StimulusModel <sparkle.stim.stimulus_model.StimulusModel>` | f10623:c0:m1 |
def setDuration(self, dur): | for w in self.durationWidgets:<EOL><INDENT>w.setValue(dur)<EOL><DEDENT> | Sets the duration for the all of the calibration stimuli
:param dur: duration of output, in current units for UI
:type dur: float | f10623:c0:m2 |
def addOption(self, stim): | <EOL>self.ui.calTypeCmbbx.insertItem(<NUM_LIT:0>,stim.name)<EOL>editor = stim.showEditor()<EOL>durInput = editor.durationInputWidget()<EOL>self.durationWidgets.append(durInput)<EOL>durInput.setEnabled(False)<EOL>self.ui.caleditorStack.insertWidget(<NUM_LIT:0>, editor)<EOL>self.ui.calTypeCmbbx.setCurrentIndex(<NUM_LIT:0... | Adds a stimulus to the list of stims to use for testing calibration
:param stim: stimulus to add to drop-down list
:type stim: :class:`AbstractStimulusComponent<sparkle.stim.abstract_component.AbstractStimulusComponent>` | f10623:c0:m3 |
def saveToObject(self): | for i in range(self.ui.caleditorStack.count()):<EOL><INDENT>try:<EOL><INDENT>self.ui.caleditorStack.widget(i).saveToObject()<EOL><DEDENT>except AttributeError:<EOL><INDENT>logger = logging.getLogger('<STR_LIT>')<EOL>logger.debug('<STR_LIT>'.format(i))<EOL><DEDENT><DEDENT> | Saves the current UI setting to the model | f10623:c0:m4 |
def currentIndex(self): | return self.ui.calTypeCmbbx.currentIndex()<EOL> | Current index of the calibration stim type list
:returns: int -- index of the combo box | f10623:c0:m5 |
def currentSelection(self): | return self.ui.calTypeCmbbx.currentText()<EOL> | Name of the current calibration stim type
:returns: str -- the text of the current item in the combo box | f10623:c0:m6 |
def isToneCal(self): | return self.ui.calTypeCmbbx.currentIndex() == self.ui.calTypeCmbbx.count() -<NUM_LIT:1><EOL> | Whether the currently selected calibration stimulus type is the calibration curve
:returns: boolean -- if the current combo box selection is calibration curve | f10623:c0:m7 |
def saveChecked(self): | return self.ui.savecalCkbx.isChecked()<EOL> | Whether the UI is set to save the current calibration run
:returns: boolean -- if the save calibration box is checked | f10623:c0:m8 |
def setClass(self, factoryclass): | self.factoryclass = factoryclass<EOL>self.setText(str(factoryclass.name))<EOL> | Sets the constructor for the component type this label is to
represent
:param factoryclass: a class that, when called, results in an instance of the desired class
:type factoryclass: callable | f10628:c0:m1 |
def mousePressEvent(self, event): | self.dragStartPosition = event.pos()<EOL> | saves the drag position, so we know when a drag should be initiated | f10628:c0:m2 |
def mouseMoveEvent(self, event): | if (event.pos() - self.dragStartPosition).manhattanLength() < <NUM_LIT:10>:<EOL><INDENT>return<EOL><DEDENT>QtGui.QApplication.setOverrideCursor(QtGui.QCursor(QtCore.Qt.ClosedHandCursor))<EOL>factory = self.factoryclass()<EOL>mimeData = QtCore.QMimeData()<EOL>try:<EOL><INDENT>mimeData.setData("<STR_LIT>", factory.serial... | Determines if a drag is taking place, and initiates it | f10628:c0:m3 |
def model(self): | raise NotImplementedError<EOL> | Returns the model for which this editor is acting on
Must be implemented by subclass
:returns: :class:`QStimulusModel<sparkle.gui.stim.qstimulus.QStimulusModel>` | f10633:c0:m1 |
def setModel(self, model): | raise NotImplementedError<EOL> | Sets the model for this editor
Must be implemented by subclass
:param model: Stimulus to edit
:type model: :class:`QStimulusModel<sparkle.gui.stim.qstimulus.QStimulusModel>` | f10633:c0:m2 |
def closeEvent(self, event): | self.ok.setText("<STR_LIT>")<EOL>QtGui.QApplication.processEvents()<EOL>self.model().cleanComponents()<EOL>self.model().purgeAutoSelected()<EOL>msg = self.model().verify()<EOL>if not msg:<EOL><INDENT>msg = self.model().warning()<EOL><DEDENT>if msg:<EOL><INDENT>warnBox = QtGui.QMessageBox( QtGui.QMessageBox.Warning, '<S... | Verifies the stimulus before closing, warns user with a
dialog if there are any problems | f10633:c0:m3 |
def headerData(self, section, orientation, role): | if role == QtCore.Qt.DisplayRole:<EOL><INDENT>if orientation == QtCore.Qt.Horizontal:<EOL><INDENT>return self._headers[section]<EOL><DEDENT><DEDENT> | Gets the Header for the columns in the table
Required by view, see :qtdoc:`subclassing<qabstractitemmodel.subclassing>`
:param section: column of header to return
:type section: int | f10634:c0:m1 |
def rowCount(self, parent=QtCore.QModelIndex()): | return self.model.nrows()<EOL> | Determines the numbers of rows the view will draw
Required by view, see :qtdoc:`subclassing<qabstractitemmodel.subclassing>` | f10634:c0:m2 |
def columnCount(self, parent=QtCore.QModelIndex()): | return len(self._headers)<EOL> | Determines the numbers of columns the view will draw
Required by view, see :qtdoc:`subclassing<qabstractitemmodel.subclassing>` | f10634:c0:m3 |
def clearParameters(self): | self.beginRemoveRows(QtCore.QModelIndex(), <NUM_LIT:0>, self.rowCount())<EOL>self.model.clear_parameters()<EOL>self.endRemoveRows()<EOL> | Removes all parameters from model | f10634:c0:m4 |
def data(self, index, role=QtCore.Qt.UserRole): | if role == QtCore.Qt.DisplayRole:<EOL><INDENT>row = index.row()<EOL>field = self._headers[index.column()]<EOL>val = self.model.paramValue(row, field)<EOL>if <NUM_LIT:1> <= index.column() <= <NUM_LIT:3>:<EOL><INDENT>unit = self.model.getDetail(index.row(), '<STR_LIT>')<EOL>if val is not None and unit is not None:<EOL><I... | Used by the view to determine data to present
See :qtdoc:`QAbstractItemModel<QAbstractItemModel.data>`,
and :qtdoc:`subclassing<qabstractitemmodel.subclassing>` | f10634:c0:m5 |
def setData(self, index, value, role=QtCore.Qt.UserRole): | if role == QtCore.Qt.EditRole:<EOL><INDENT>if isinstance(value, QtCore.QVariant):<EOL><INDENT>value = value.toPyObject()<EOL><DEDENT>elif isinstance(value, QtCore.QString):<EOL><INDENT>value = str(value)<EOL><DEDENT>self.model.setVerifiedValue(index.row(), self._headers[index.column()], value)<EOL>self.countChanged.emi... | Sets data at *index* to *value* in underlying data structure
See :qtdoc:`QAbstractItemModel<QAbstractItemModel.setData>`,
and :qtdoc:`subclassing<qabstractitemmodel.subclassing>` | f10634:c0:m6 |
def checkValidCell(self, index): | col = index.column()<EOL>row = index.row()<EOL>return self.model.isFieldValid(row, self._headers[index.column()])<EOL> | Asks the model if the value at *index* is valid
See :meth:`isFieldValid<sparkle.stim.auto_parameter_model.AutoParameterModel.isFieldValid>` | f10634:c0:m7 |
def findFileParam(self, comp): | return self.model.findFileParam(comp)<EOL> | wrapper for :meth:`findFileParam<sparkle.stim.auto_parameter_model.AutoParameterModel.findFileParam>` | f10634:c0:m8 |
def setParameterList(self, paramlist): | self._parameters = paramlist<EOL> | clears parameter list and assigns *paramlist* | f10634:c0:m9 |
def insertRows(self, position, rows, parent = QtCore.QModelIndex()): | self.beginInsertRows(parent, position, position + rows - <NUM_LIT:1>)<EOL>for i in range(rows):<EOL><INDENT>self.model.insertRow(position)<EOL><DEDENT>self.endInsertRows()<EOL>if self.rowCount() == <NUM_LIT:1>:<EOL><INDENT>self.emptied.emit(False)<EOL><DEDENT>return True<EOL> | Inserts new parameters and emits an emptied False signal
:param position: row location to insert new parameter
:type position: int
:param rows: number of new parameters to insert
:type rows: int
:param parent: Required by QAbstractItemModel, can be safely ignored | f10634:c0:m10 |
def removeRows(self, position, rows, parent = QtCore.QModelIndex()): | self.beginRemoveRows(parent, position, position + rows - <NUM_LIT:1>)<EOL>for i in range(rows):<EOL><INDENT>self.model.removeRow(position)<EOL><DEDENT>self.endRemoveRows()<EOL>if self.rowCount() == <NUM_LIT:0>:<EOL><INDENT>self.emptied.emit(True)<EOL><DEDENT>return True<EOL> | Removes parameters from the model. Emits and emptied True signal, if there are no parameters left.
:param position: row location of parameters to remove
:type position: int
:param rows: number of parameters to remove
:type rows: int
:param parent: Required by QAbstractItemModel,... | f10634:c0:m11 |
def removeItem(self, index): | self.removeRows(index.row(), <NUM_LIT:1>)<EOL> | Removes the parameters at *index* | f10634:c0:m12 |
def insertItem(self, index, item): | row = index.row()<EOL>self.beginInsertRows(QtCore.QModelIndex(), row, row)<EOL>self.model.insertRow(row)<EOL>self.endInsertRows()<EOL>self.model.overwriteParam(index.row(), item)<EOL> | Inserts parameter *item* at index | f10634:c0:m13 |
def flags(self, index): | if index.isValid():<EOL><INDENT>if self.model.editableRow(index.row()) and index.column() < <NUM_LIT:4>:<EOL><INDENT>return QtCore.Qt.ItemIsDragEnabled |QtCore.Qt.ItemIsEnabled | QtCore.Qt.ItemIsSelectable |QtCore.Qt.ItemIsEditable<EOL><DEDENT>else:<EOL><INDENT>return QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnable... | Determines interaction allowed with table cells.
See :qtdoc:`QAbstractItemModel<QAbstractItemModel.flags>`,
and :qtdoc:`subclassing<qabstractitemmodel.subclassing>` | f10634:c0:m14 |
def toggleSelection(self, index, comp): | self.model.toggleSelection(index.row(), comp)<EOL> | Toggles a component in or out of the currently
selected parameter's compnents list | f10634:c0:m16 |
def selection(self, index): | return self.model.selection(index.row())<EOL> | Returns the selected Indexes of components for
the given parameter | f10634:c0:m17 |
def selectedParameterTypes(self, index): | return self.model.selectedParameterTypes(index.row())<EOL> | Returns a list of the parameter types valid as
options for the parameter field for parameter at *index* | f10634:c0:m18 |
def fileParameter(self, comp): | return self.model.fileParameter(comp)<EOL> | Returns the row which comp is found in
wrapper for :meth:`findFileParam<sparkle.stim.auto_parameter_model.AutoParameterModel.findFileParam>` | f10634:c0:m19 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.