id int32 0 252k | repo stringlengths 7 55 | path stringlengths 4 127 | func_name stringlengths 1 88 | original_string stringlengths 75 19.8k | language stringclasses 1
value | code stringlengths 75 19.8k | code_tokens list | docstring stringlengths 3 17.3k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 87 242 |
|---|---|---|---|---|---|---|---|---|---|---|---|
37,400 | portfors-lab/sparkle | sparkle/gui/plotting/pyqtgraph_widgets.py | TraceWidget.appendData | def appendData(self, axeskey, bins, ypoints):
"""Appends data to existing plotted data
:param axeskey: name of data plot to update. Valid options are 'stim' or 'response'
:type axeskey: str
:param bins: bins to plot a point for
:type bin: numpy.ndarray
:param ypoints: it... | python | def appendData(self, axeskey, bins, ypoints):
"""Appends data to existing plotted data
:param axeskey: name of data plot to update. Valid options are 'stim' or 'response'
:type axeskey: str
:param bins: bins to plot a point for
:type bin: numpy.ndarray
:param ypoints: it... | [
"def",
"appendData",
"(",
"self",
",",
"axeskey",
",",
"bins",
",",
"ypoints",
")",
":",
"if",
"axeskey",
"==",
"'raster'",
"and",
"len",
"(",
"bins",
")",
">",
"0",
":",
"x",
",",
"y",
"=",
"self",
".",
"rasterPlot",
".",
"getData",
"(",
")",
"#... | Appends data to existing plotted data
:param axeskey: name of data plot to update. Valid options are 'stim' or 'response'
:type axeskey: str
:param bins: bins to plot a point for
:type bin: numpy.ndarray
:param ypoints: iteration number of raster, *should* match bins dimension, ... | [
"Appends",
"data",
"to",
"existing",
"plotted",
"data"
] | 5fad1cf2bec58ec6b15d91da20f6236a74826110 | https://github.com/portfors-lab/sparkle/blob/5fad1cf2bec58ec6b15d91da20f6236a74826110/sparkle/gui/plotting/pyqtgraph_widgets.py#L211-L229 |
37,401 | portfors-lab/sparkle | sparkle/gui/plotting/pyqtgraph_widgets.py | TraceWidget.setThreshold | def setThreshold(self, threshold):
"""Sets the current threshold
:param threshold: the y value to set the threshold line at
:type threshold: float
"""
self.threshLine.setValue(threshold)
self.threshold_field.setValue(threshold) | python | def setThreshold(self, threshold):
"""Sets the current threshold
:param threshold: the y value to set the threshold line at
:type threshold: float
"""
self.threshLine.setValue(threshold)
self.threshold_field.setValue(threshold) | [
"def",
"setThreshold",
"(",
"self",
",",
"threshold",
")",
":",
"self",
".",
"threshLine",
".",
"setValue",
"(",
"threshold",
")",
"self",
".",
"threshold_field",
".",
"setValue",
"(",
"threshold",
")"
] | Sets the current threshold
:param threshold: the y value to set the threshold line at
:type threshold: float | [
"Sets",
"the",
"current",
"threshold"
] | 5fad1cf2bec58ec6b15d91da20f6236a74826110 | https://github.com/portfors-lab/sparkle/blob/5fad1cf2bec58ec6b15d91da20f6236a74826110/sparkle/gui/plotting/pyqtgraph_widgets.py#L243-L250 |
37,402 | portfors-lab/sparkle | sparkle/gui/plotting/pyqtgraph_widgets.py | TraceWidget.setRasterBounds | def setRasterBounds(self, lims):
"""Sets the raster plot y-axis bounds, where in the plot the raster will appear between
:param lims: the (min, max) y-values for the raster plot to be placed between
:type lims: (float, float)
"""
self.rasterBottom = lims[0]
self.rasterTo... | python | def setRasterBounds(self, lims):
"""Sets the raster plot y-axis bounds, where in the plot the raster will appear between
:param lims: the (min, max) y-values for the raster plot to be placed between
:type lims: (float, float)
"""
self.rasterBottom = lims[0]
self.rasterTo... | [
"def",
"setRasterBounds",
"(",
"self",
",",
"lims",
")",
":",
"self",
".",
"rasterBottom",
"=",
"lims",
"[",
"0",
"]",
"self",
".",
"rasterTop",
"=",
"lims",
"[",
"1",
"]",
"self",
".",
"updateRasterBounds",
"(",
")"
] | Sets the raster plot y-axis bounds, where in the plot the raster will appear between
:param lims: the (min, max) y-values for the raster plot to be placed between
:type lims: (float, float) | [
"Sets",
"the",
"raster",
"plot",
"y",
"-",
"axis",
"bounds",
"where",
"in",
"the",
"plot",
"the",
"raster",
"will",
"appear",
"between"
] | 5fad1cf2bec58ec6b15d91da20f6236a74826110 | https://github.com/portfors-lab/sparkle/blob/5fad1cf2bec58ec6b15d91da20f6236a74826110/sparkle/gui/plotting/pyqtgraph_widgets.py#L262-L270 |
37,403 | portfors-lab/sparkle | sparkle/gui/plotting/pyqtgraph_widgets.py | TraceWidget.updateRasterBounds | def updateRasterBounds(self):
"""Updates the y-coordinate slots where the raster points
are plotted, according to the current limits of the y-axis"""
yrange = self.viewRange()[1]
yrange_size = yrange[1] - yrange[0]
rmax = self.rasterTop*yrange_size + yrange[0]
rmin = sel... | python | def updateRasterBounds(self):
"""Updates the y-coordinate slots where the raster points
are plotted, according to the current limits of the y-axis"""
yrange = self.viewRange()[1]
yrange_size = yrange[1] - yrange[0]
rmax = self.rasterTop*yrange_size + yrange[0]
rmin = sel... | [
"def",
"updateRasterBounds",
"(",
"self",
")",
":",
"yrange",
"=",
"self",
".",
"viewRange",
"(",
")",
"[",
"1",
"]",
"yrange_size",
"=",
"yrange",
"[",
"1",
"]",
"-",
"yrange",
"[",
"0",
"]",
"rmax",
"=",
"self",
".",
"rasterTop",
"*",
"yrange_size"... | Updates the y-coordinate slots where the raster points
are plotted, according to the current limits of the y-axis | [
"Updates",
"the",
"y",
"-",
"coordinate",
"slots",
"where",
"the",
"raster",
"points",
"are",
"plotted",
"according",
"to",
"the",
"current",
"limits",
"of",
"the",
"y",
"-",
"axis"
] | 5fad1cf2bec58ec6b15d91da20f6236a74826110 | https://github.com/portfors-lab/sparkle/blob/5fad1cf2bec58ec6b15d91da20f6236a74826110/sparkle/gui/plotting/pyqtgraph_widgets.py#L272-L280 |
37,404 | portfors-lab/sparkle | sparkle/gui/plotting/pyqtgraph_widgets.py | TraceWidget.askRasterBounds | def askRasterBounds(self):
"""Prompts the user to provide the raster bounds with a dialog.
Saves the bounds to be applied to the plot"""
dlg = RasterBoundsDialog(bounds= (self.rasterBottom, self.rasterTop))
if dlg.exec_():
bounds = dlg.values()
self.setRasterBoun... | python | def askRasterBounds(self):
"""Prompts the user to provide the raster bounds with a dialog.
Saves the bounds to be applied to the plot"""
dlg = RasterBoundsDialog(bounds= (self.rasterBottom, self.rasterTop))
if dlg.exec_():
bounds = dlg.values()
self.setRasterBoun... | [
"def",
"askRasterBounds",
"(",
"self",
")",
":",
"dlg",
"=",
"RasterBoundsDialog",
"(",
"bounds",
"=",
"(",
"self",
".",
"rasterBottom",
",",
"self",
".",
"rasterTop",
")",
")",
"if",
"dlg",
".",
"exec_",
"(",
")",
":",
"bounds",
"=",
"dlg",
".",
"va... | Prompts the user to provide the raster bounds with a dialog.
Saves the bounds to be applied to the plot | [
"Prompts",
"the",
"user",
"to",
"provide",
"the",
"raster",
"bounds",
"with",
"a",
"dialog",
".",
"Saves",
"the",
"bounds",
"to",
"be",
"applied",
"to",
"the",
"plot"
] | 5fad1cf2bec58ec6b15d91da20f6236a74826110 | https://github.com/portfors-lab/sparkle/blob/5fad1cf2bec58ec6b15d91da20f6236a74826110/sparkle/gui/plotting/pyqtgraph_widgets.py#L282-L288 |
37,405 | portfors-lab/sparkle | sparkle/gui/plotting/pyqtgraph_widgets.py | TraceWidget.rangeChange | def rangeChange(self, pw, ranges):
"""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: refere... | python | def rangeChange(self, pw, ranges):
"""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: refere... | [
"def",
"rangeChange",
"(",
"self",
",",
"pw",
",",
"ranges",
")",
":",
"if",
"hasattr",
"(",
"ranges",
",",
"'__iter__'",
")",
":",
"# adjust the stim signal so that it falls in the correct range",
"yrange_size",
"=",
"ranges",
"[",
"1",
"]",
"[",
"1",
"]",
"-... | 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 ... | [
"Adjusts",
"the",
"stimulus",
"signal",
"to",
"keep",
"it",
"at",
"the",
"top",
"of",
"a",
"plot",
"after",
"any",
"ajustment",
"to",
"the",
"axes",
"ranges",
"takes",
"place",
"."
] | 5fad1cf2bec58ec6b15d91da20f6236a74826110 | https://github.com/portfors-lab/sparkle/blob/5fad1cf2bec58ec6b15d91da20f6236a74826110/sparkle/gui/plotting/pyqtgraph_widgets.py#L307-L337 |
37,406 | portfors-lab/sparkle | sparkle/gui/plotting/pyqtgraph_widgets.py | TraceWidget.update_thresh | def update_thresh(self):
"""Emits a Qt signal thresholdUpdated with the current threshold value"""
thresh_val = self.threshLine.value()
self.threshold_field.setValue(thresh_val)
self.thresholdUpdated.emit(thresh_val, self.getTitle()) | python | def update_thresh(self):
"""Emits a Qt signal thresholdUpdated with the current threshold value"""
thresh_val = self.threshLine.value()
self.threshold_field.setValue(thresh_val)
self.thresholdUpdated.emit(thresh_val, self.getTitle()) | [
"def",
"update_thresh",
"(",
"self",
")",
":",
"thresh_val",
"=",
"self",
".",
"threshLine",
".",
"value",
"(",
")",
"self",
".",
"threshold_field",
".",
"setValue",
"(",
"thresh_val",
")",
"self",
".",
"thresholdUpdated",
".",
"emit",
"(",
"thresh_val",
"... | Emits a Qt signal thresholdUpdated with the current threshold value | [
"Emits",
"a",
"Qt",
"signal",
"thresholdUpdated",
"with",
"the",
"current",
"threshold",
"value"
] | 5fad1cf2bec58ec6b15d91da20f6236a74826110 | https://github.com/portfors-lab/sparkle/blob/5fad1cf2bec58ec6b15d91da20f6236a74826110/sparkle/gui/plotting/pyqtgraph_widgets.py#L339-L343 |
37,407 | portfors-lab/sparkle | sparkle/gui/plotting/pyqtgraph_widgets.py | SpecWidget.updateImage | def updateImage(self, imgdata, xaxis=None, yaxis=None):
"""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 shou... | python | def updateImage(self, imgdata, xaxis=None, yaxis=None):
"""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 shou... | [
"def",
"updateImage",
"(",
"self",
",",
"imgdata",
",",
"xaxis",
"=",
"None",
",",
"yaxis",
"=",
"None",
")",
":",
"imgdata",
"=",
"imgdata",
".",
"T",
"self",
".",
"img",
".",
"setImage",
"(",
"imgdata",
")",
"if",
"xaxis",
"is",
"not",
"None",
"a... | 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 | [
"Updates",
"the",
"Widget",
"image",
"directly",
"."
] | 5fad1cf2bec58ec6b15d91da20f6236a74826110 | https://github.com/portfors-lab/sparkle/blob/5fad1cf2bec58ec6b15d91da20f6236a74826110/sparkle/gui/plotting/pyqtgraph_widgets.py#L414-L430 |
37,408 | portfors-lab/sparkle | sparkle/gui/plotting/pyqtgraph_widgets.py | SpecWidget.resetScale | def resetScale(self):
"""Resets the scale on this image. Correctly aligns time scale, undoes manual scaling"""
self.img.scale(1./self.imgScale[0], 1./self.imgScale[1])
self.imgScale = (1.,1.) | python | def resetScale(self):
"""Resets the scale on this image. Correctly aligns time scale, undoes manual scaling"""
self.img.scale(1./self.imgScale[0], 1./self.imgScale[1])
self.imgScale = (1.,1.) | [
"def",
"resetScale",
"(",
"self",
")",
":",
"self",
".",
"img",
".",
"scale",
"(",
"1.",
"/",
"self",
".",
"imgScale",
"[",
"0",
"]",
",",
"1.",
"/",
"self",
".",
"imgScale",
"[",
"1",
"]",
")",
"self",
".",
"imgScale",
"=",
"(",
"1.",
",",
"... | Resets the scale on this image. Correctly aligns time scale, undoes manual scaling | [
"Resets",
"the",
"scale",
"on",
"this",
"image",
".",
"Correctly",
"aligns",
"time",
"scale",
"undoes",
"manual",
"scaling"
] | 5fad1cf2bec58ec6b15d91da20f6236a74826110 | https://github.com/portfors-lab/sparkle/blob/5fad1cf2bec58ec6b15d91da20f6236a74826110/sparkle/gui/plotting/pyqtgraph_widgets.py#L432-L435 |
37,409 | portfors-lab/sparkle | sparkle/gui/plotting/pyqtgraph_widgets.py | SpecWidget.updateData | def updateData(self, signal, fs):
"""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
"""
# use a separate thread to calculate spectrogram so UI doesn't lag
... | python | def updateData(self, signal, fs):
"""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
"""
# use a separate thread to calculate spectrogram so UI doesn't lag
... | [
"def",
"updateData",
"(",
"self",
",",
"signal",
",",
"fs",
")",
":",
"# use a separate thread to calculate spectrogram so UI doesn't lag",
"t",
"=",
"threading",
".",
"Thread",
"(",
"target",
"=",
"_doSpectrogram",
",",
"args",
"=",
"(",
"self",
".",
"spec_done",... | 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 | [
"Displays",
"a",
"spectrogram",
"of",
"the",
"provided",
"signal"
] | 5fad1cf2bec58ec6b15d91da20f6236a74826110 | https://github.com/portfors-lab/sparkle/blob/5fad1cf2bec58ec6b15d91da20f6236a74826110/sparkle/gui/plotting/pyqtgraph_widgets.py#L437-L447 |
37,410 | portfors-lab/sparkle | sparkle/gui/plotting/pyqtgraph_widgets.py | SpecWidget.setSpecArgs | def setSpecArgs(**kwargs):
"""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, ... | python | def setSpecArgs(**kwargs):
"""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, ... | [
"def",
"setSpecArgs",
"(",
"*",
"*",
"kwargs",
")",
":",
"for",
"key",
",",
"value",
"in",
"kwargs",
".",
"items",
"(",
")",
":",
"if",
"key",
"==",
"'colormap'",
":",
"SpecWidget",
".",
"imgArgs",
"[",
"'lut'",
"]",
"=",
"value",
"[",
"'lut'",
"]"... | 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... | [
"Sets",
"optional",
"arguments",
"for",
"the",
"spectrogram",
"appearance",
"."
] | 5fad1cf2bec58ec6b15d91da20f6236a74826110 | https://github.com/portfors-lab/sparkle/blob/5fad1cf2bec58ec6b15d91da20f6236a74826110/sparkle/gui/plotting/pyqtgraph_widgets.py#L450-L472 |
37,411 | portfors-lab/sparkle | sparkle/gui/plotting/pyqtgraph_widgets.py | SpecWidget.clearImg | def clearImg(self):
"""Clears the current image"""
self.img.setImage(np.array([[0]]))
self.img.image = None | python | def clearImg(self):
"""Clears the current image"""
self.img.setImage(np.array([[0]]))
self.img.image = None | [
"def",
"clearImg",
"(",
"self",
")",
":",
"self",
".",
"img",
".",
"setImage",
"(",
"np",
".",
"array",
"(",
"[",
"[",
"0",
"]",
"]",
")",
")",
"self",
".",
"img",
".",
"image",
"=",
"None"
] | Clears the current image | [
"Clears",
"the",
"current",
"image"
] | 5fad1cf2bec58ec6b15d91da20f6236a74826110 | https://github.com/portfors-lab/sparkle/blob/5fad1cf2bec58ec6b15d91da20f6236a74826110/sparkle/gui/plotting/pyqtgraph_widgets.py#L474-L477 |
37,412 | portfors-lab/sparkle | sparkle/gui/plotting/pyqtgraph_widgets.py | SpecWidget.editColormap | 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... | python | 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... | [
"def",
"editColormap",
"(",
"self",
")",
":",
"self",
".",
"editor",
"=",
"pg",
".",
"ImageView",
"(",
")",
"# remove the ROI and Norm buttons",
"self",
".",
"editor",
".",
"ui",
".",
"roiBtn",
".",
"setVisible",
"(",
"False",
")",
"self",
".",
"editor",
... | Prompts the user with a dialog to change colormap | [
"Prompts",
"the",
"user",
"with",
"a",
"dialog",
"to",
"change",
"colormap"
] | 5fad1cf2bec58ec6b15d91da20f6236a74826110 | https://github.com/portfors-lab/sparkle/blob/5fad1cf2bec58ec6b15d91da20f6236a74826110/sparkle/gui/plotting/pyqtgraph_widgets.py#L483-L496 |
37,413 | portfors-lab/sparkle | sparkle/gui/plotting/pyqtgraph_widgets.py | SpecWidget.updateColormap | 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']) | python | 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']) | [
"def",
"updateColormap",
"(",
"self",
")",
":",
"if",
"self",
".",
"imgArgs",
"[",
"'lut'",
"]",
"is",
"not",
"None",
":",
"self",
".",
"img",
".",
"setLookupTable",
"(",
"self",
".",
"imgArgs",
"[",
"'lut'",
"]",
")",
"self",
".",
"img",
".",
"set... | Updates the currently colormap accoring to stored settings | [
"Updates",
"the",
"currently",
"colormap",
"accoring",
"to",
"stored",
"settings"
] | 5fad1cf2bec58ec6b15d91da20f6236a74826110 | https://github.com/portfors-lab/sparkle/blob/5fad1cf2bec58ec6b15d91da20f6236a74826110/sparkle/gui/plotting/pyqtgraph_widgets.py#L510-L514 |
37,414 | portfors-lab/sparkle | sparkle/gui/plotting/pyqtgraph_widgets.py | SimplePlotWidget.appendData | 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
"""
... | python | 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
"""
... | [
"def",
"appendData",
"(",
"self",
",",
"xdata",
",",
"ydata",
",",
"color",
"=",
"'b'",
",",
"legendstr",
"=",
"None",
")",
":",
"item",
"=",
"self",
".",
"plot",
"(",
"xdata",
",",
"ydata",
",",
"pen",
"=",
"color",
")",
"if",
"legendstr",
"is",
... | 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 | [
"Adds",
"the",
"data",
"to",
"the",
"plot"
] | 5fad1cf2bec58ec6b15d91da20f6236a74826110 | https://github.com/portfors-lab/sparkle/blob/5fad1cf2bec58ec6b15d91da20f6236a74826110/sparkle/gui/plotting/pyqtgraph_widgets.py#L568-L579 |
37,415 | portfors-lab/sparkle | sparkle/gui/plotting/pyqtgraph_widgets.py | SimplePlotWidget.setLabels | 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... | python | 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... | [
"def",
"setLabels",
"(",
"self",
",",
"xlabel",
"=",
"None",
",",
"ylabel",
"=",
"None",
",",
"title",
"=",
"None",
",",
"xunits",
"=",
"None",
",",
"yunits",
"=",
"None",
")",
":",
"if",
"xlabel",
"is",
"not",
"None",
":",
"self",
".",
"setLabel",... | 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... | [
"Sets",
"the",
"plot",
"labels"
] | 5fad1cf2bec58ec6b15d91da20f6236a74826110 | https://github.com/portfors-lab/sparkle/blob/5fad1cf2bec58ec6b15d91da20f6236a74826110/sparkle/gui/plotting/pyqtgraph_widgets.py#L581-L600 |
37,416 | portfors-lab/sparkle | sparkle/gui/plotting/pyqtgraph_widgets.py | ProgressWidget.setPoint | 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
"""
... | python | 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
"""
... | [
"def",
"setPoint",
"(",
"self",
",",
"x",
",",
"group",
",",
"y",
")",
":",
"if",
"x",
"==",
"-",
"1",
":",
"# silence window",
"self",
".",
"plot",
"(",
"[",
"0",
"]",
",",
"[",
"y",
"]",
",",
"symbol",
"=",
"'o'",
")",
"else",
":",
"yindex"... | 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 | [
"Sets",
"the",
"given",
"point",
"connects",
"line",
"to",
"previous",
"point",
"in",
"group"
] | 5fad1cf2bec58ec6b15d91da20f6236a74826110 | https://github.com/portfors-lab/sparkle/blob/5fad1cf2bec58ec6b15d91da20f6236a74826110/sparkle/gui/plotting/pyqtgraph_widgets.py#L626-L648 |
37,417 | portfors-lab/sparkle | sparkle/gui/plotting/pyqtgraph_widgets.py | ProgressWidget.setLabels | def setLabels(self, name):
"""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
"""
if name == "calibration":
self.setWindowTitle("... | python | def setLabels(self, name):
"""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
"""
if name == "calibration":
self.setWindowTitle("... | [
"def",
"setLabels",
"(",
"self",
",",
"name",
")",
":",
"if",
"name",
"==",
"\"calibration\"",
":",
"self",
".",
"setWindowTitle",
"(",
"\"Calibration Curve\"",
")",
"self",
".",
"setTitle",
"(",
"\"Calibration Curve\"",
")",
"self",
".",
"setLabel",
"(",
"'... | 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 | [
"Sets",
"plot",
"labels",
"according",
"to",
"predefined",
"options"
] | 5fad1cf2bec58ec6b15d91da20f6236a74826110 | https://github.com/portfors-lab/sparkle/blob/5fad1cf2bec58ec6b15d91da20f6236a74826110/sparkle/gui/plotting/pyqtgraph_widgets.py#L650-L670 |
37,418 | portfors-lab/sparkle | sparkle/gui/plotting/pyqtgraph_widgets.py | ProgressWidget.loadCurve | def loadCurve(data, groups, thresholds, absvals, fs, xlabels):
"""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"""
xlims = (xlabels[0], xl... | python | def loadCurve(data, groups, thresholds, absvals, fs, xlabels):
"""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"""
xlims = (xlabels[0], xl... | [
"def",
"loadCurve",
"(",
"data",
",",
"groups",
",",
"thresholds",
",",
"absvals",
",",
"fs",
",",
"xlabels",
")",
":",
"xlims",
"=",
"(",
"xlabels",
"[",
"0",
"]",
",",
"xlabels",
"[",
"-",
"1",
"]",
")",
"pw",
"=",
"ProgressWidget",
"(",
"groups"... | 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 | [
"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",
"mat... | 5fad1cf2bec58ec6b15d91da20f6236a74826110 | https://github.com/portfors-lab/sparkle/blob/5fad1cf2bec58ec6b15d91da20f6236a74826110/sparkle/gui/plotting/pyqtgraph_widgets.py#L673-L694 |
37,419 | portfors-lab/sparkle | sparkle/gui/plotting/pyqtgraph_widgets.py | PSTHWidget.processData | def processData(self, times, response, test_num, trace_num, rep_num):
"""Calulate spike times from raw response data"""
# invert polarity affects spike counting
response = response * self._polarity
if rep_num == 0:
# reset
self.spike_counts = []
self.... | python | def processData(self, times, response, test_num, trace_num, rep_num):
"""Calulate spike times from raw response data"""
# invert polarity affects spike counting
response = response * self._polarity
if rep_num == 0:
# reset
self.spike_counts = []
self.... | [
"def",
"processData",
"(",
"self",
",",
"times",
",",
"response",
",",
"test_num",
",",
"trace_num",
",",
"rep_num",
")",
":",
"# invert polarity affects spike counting",
"response",
"=",
"response",
"*",
"self",
".",
"_polarity",
"if",
"rep_num",
"==",
"0",
"... | Calulate spike times from raw response data | [
"Calulate",
"spike",
"times",
"from",
"raw",
"response",
"data"
] | 5fad1cf2bec58ec6b15d91da20f6236a74826110 | https://github.com/portfors-lab/sparkle/blob/5fad1cf2bec58ec6b15d91da20f6236a74826110/sparkle/gui/plotting/pyqtgraph_widgets.py#L749-L774 |
37,420 | portfors-lab/sparkle | sparkle/gui/plotting/pyqtgraph_widgets.py | ChartWidget.setSr | def setSr(self, fs):
"""Sets the samplerate of the input operation being plotted"""
self.tracePlot.setSr(fs)
self.stimPlot.setSr(fs) | python | def setSr(self, fs):
"""Sets the samplerate of the input operation being plotted"""
self.tracePlot.setSr(fs)
self.stimPlot.setSr(fs) | [
"def",
"setSr",
"(",
"self",
",",
"fs",
")",
":",
"self",
".",
"tracePlot",
".",
"setSr",
"(",
"fs",
")",
"self",
".",
"stimPlot",
".",
"setSr",
"(",
"fs",
")"
] | Sets the samplerate of the input operation being plotted | [
"Sets",
"the",
"samplerate",
"of",
"the",
"input",
"operation",
"being",
"plotted"
] | 5fad1cf2bec58ec6b15d91da20f6236a74826110 | https://github.com/portfors-lab/sparkle/blob/5fad1cf2bec58ec6b15d91da20f6236a74826110/sparkle/gui/plotting/pyqtgraph_widgets.py#L806-L809 |
37,421 | portfors-lab/sparkle | sparkle/gui/plotting/pyqtgraph_widgets.py | ChartWidget.setWindowSize | def setWindowSize(self, winsz):
"""Sets the size of scroll window"""
self.tracePlot.setWindowSize(winsz)
self.stimPlot.setWindowSize(winsz) | python | def setWindowSize(self, winsz):
"""Sets the size of scroll window"""
self.tracePlot.setWindowSize(winsz)
self.stimPlot.setWindowSize(winsz) | [
"def",
"setWindowSize",
"(",
"self",
",",
"winsz",
")",
":",
"self",
".",
"tracePlot",
".",
"setWindowSize",
"(",
"winsz",
")",
"self",
".",
"stimPlot",
".",
"setWindowSize",
"(",
"winsz",
")"
] | Sets the size of scroll window | [
"Sets",
"the",
"size",
"of",
"scroll",
"window"
] | 5fad1cf2bec58ec6b15d91da20f6236a74826110 | https://github.com/portfors-lab/sparkle/blob/5fad1cf2bec58ec6b15d91da20f6236a74826110/sparkle/gui/plotting/pyqtgraph_widgets.py#L811-L814 |
37,422 | portfors-lab/sparkle | sparkle/gui/plotting/pyqtgraph_widgets.py | StackedPlot.addSpectrogram | def addSpectrogram(self, ydata, fs, title=None):
"""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
... | python | def addSpectrogram(self, ydata, fs, title=None):
"""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
... | [
"def",
"addSpectrogram",
"(",
"self",
",",
"ydata",
",",
"fs",
",",
"title",
"=",
"None",
")",
":",
"p",
"=",
"SpecWidget",
"(",
")",
"p",
".",
"updateData",
"(",
"ydata",
",",
"fs",
")",
"if",
"title",
"is",
"not",
"None",
":",
"p",
".",
"setTit... | 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
... | [
"Adds",
"a",
"new",
"spectorgram",
"plot",
"for",
"the",
"given",
"image",
".",
"Generates",
"a",
"SpecWidget"
] | 5fad1cf2bec58ec6b15d91da20f6236a74826110 | https://github.com/portfors-lab/sparkle/blob/5fad1cf2bec58ec6b15d91da20f6236a74826110/sparkle/gui/plotting/pyqtgraph_widgets.py#L927-L941 |
37,423 | portfors-lab/sparkle | sparkle/gui/plotting/pyqtgraph_widgets.py | StackedPlot.nextPlot | def nextPlot(self):
"""Moves the displayed plot to the next one"""
if self.stacker.currentIndex() < self.stacker.count():
self.stacker.setCurrentIndex(self.stacker.currentIndex()+1) | python | def nextPlot(self):
"""Moves the displayed plot to the next one"""
if self.stacker.currentIndex() < self.stacker.count():
self.stacker.setCurrentIndex(self.stacker.currentIndex()+1) | [
"def",
"nextPlot",
"(",
"self",
")",
":",
"if",
"self",
".",
"stacker",
".",
"currentIndex",
"(",
")",
"<",
"self",
".",
"stacker",
".",
"count",
"(",
")",
":",
"self",
".",
"stacker",
".",
"setCurrentIndex",
"(",
"self",
".",
"stacker",
".",
"curren... | Moves the displayed plot to the next one | [
"Moves",
"the",
"displayed",
"plot",
"to",
"the",
"next",
"one"
] | 5fad1cf2bec58ec6b15d91da20f6236a74826110 | https://github.com/portfors-lab/sparkle/blob/5fad1cf2bec58ec6b15d91da20f6236a74826110/sparkle/gui/plotting/pyqtgraph_widgets.py#L943-L946 |
37,424 | portfors-lab/sparkle | sparkle/gui/plotting/pyqtgraph_widgets.py | StackedPlot.prevPlot | def prevPlot(self):
"""Moves the displayed plot to the previous one"""
if self.stacker.currentIndex() > 0:
self.stacker.setCurrentIndex(self.stacker.currentIndex()-1) | python | def prevPlot(self):
"""Moves the displayed plot to the previous one"""
if self.stacker.currentIndex() > 0:
self.stacker.setCurrentIndex(self.stacker.currentIndex()-1) | [
"def",
"prevPlot",
"(",
"self",
")",
":",
"if",
"self",
".",
"stacker",
".",
"currentIndex",
"(",
")",
">",
"0",
":",
"self",
".",
"stacker",
".",
"setCurrentIndex",
"(",
"self",
".",
"stacker",
".",
"currentIndex",
"(",
")",
"-",
"1",
")"
] | Moves the displayed plot to the previous one | [
"Moves",
"the",
"displayed",
"plot",
"to",
"the",
"previous",
"one"
] | 5fad1cf2bec58ec6b15d91da20f6236a74826110 | https://github.com/portfors-lab/sparkle/blob/5fad1cf2bec58ec6b15d91da20f6236a74826110/sparkle/gui/plotting/pyqtgraph_widgets.py#L948-L951 |
37,425 | NoviceLive/pat | pat/utils.py | most_even_chunk | def most_even_chunk(string, group):
"""Divide a string into a list of strings as even as possible."""
counts = [0] + most_even(len(string), group)
indices = accumulate(counts)
slices = window(indices, 2)
return [string[slice(*one)] for one in slices] | python | def most_even_chunk(string, group):
"""Divide a string into a list of strings as even as possible."""
counts = [0] + most_even(len(string), group)
indices = accumulate(counts)
slices = window(indices, 2)
return [string[slice(*one)] for one in slices] | [
"def",
"most_even_chunk",
"(",
"string",
",",
"group",
")",
":",
"counts",
"=",
"[",
"0",
"]",
"+",
"most_even",
"(",
"len",
"(",
"string",
")",
",",
"group",
")",
"indices",
"=",
"accumulate",
"(",
"counts",
")",
"slices",
"=",
"window",
"(",
"indic... | Divide a string into a list of strings as even as possible. | [
"Divide",
"a",
"string",
"into",
"a",
"list",
"of",
"strings",
"as",
"even",
"as",
"possible",
"."
] | bd223fc5e758213662befbebdf9538f3fbf58ad6 | https://github.com/NoviceLive/pat/blob/bd223fc5e758213662befbebdf9538f3fbf58ad6/pat/utils.py#L32-L37 |
37,426 | NoviceLive/pat | pat/utils.py | most_even | def most_even(number, group):
"""Divide a number into a list of numbers as even as possible."""
count, rest = divmod(number, group)
counts = zip_longest([count] * group, [1] * rest, fillvalue=0)
chunks = [sum(one) for one in counts]
logging.debug('chunks: %s', chunks)
return chunks | python | def most_even(number, group):
"""Divide a number into a list of numbers as even as possible."""
count, rest = divmod(number, group)
counts = zip_longest([count] * group, [1] * rest, fillvalue=0)
chunks = [sum(one) for one in counts]
logging.debug('chunks: %s', chunks)
return chunks | [
"def",
"most_even",
"(",
"number",
",",
"group",
")",
":",
"count",
",",
"rest",
"=",
"divmod",
"(",
"number",
",",
"group",
")",
"counts",
"=",
"zip_longest",
"(",
"[",
"count",
"]",
"*",
"group",
",",
"[",
"1",
"]",
"*",
"rest",
",",
"fillvalue",... | Divide a number into a list of numbers as even as possible. | [
"Divide",
"a",
"number",
"into",
"a",
"list",
"of",
"numbers",
"as",
"even",
"as",
"possible",
"."
] | bd223fc5e758213662befbebdf9538f3fbf58ad6 | https://github.com/NoviceLive/pat/blob/bd223fc5e758213662befbebdf9538f3fbf58ad6/pat/utils.py#L40-L46 |
37,427 | NoviceLive/pat | pat/utils.py | window | def window(seq, count=2):
"""Slide window."""
iseq = iter(seq)
result = tuple(islice(iseq, count))
if len(result) == count:
yield result
for elem in iseq:
result = result[1:] + (elem,)
yield result | python | def window(seq, count=2):
"""Slide window."""
iseq = iter(seq)
result = tuple(islice(iseq, count))
if len(result) == count:
yield result
for elem in iseq:
result = result[1:] + (elem,)
yield result | [
"def",
"window",
"(",
"seq",
",",
"count",
"=",
"2",
")",
":",
"iseq",
"=",
"iter",
"(",
"seq",
")",
"result",
"=",
"tuple",
"(",
"islice",
"(",
"iseq",
",",
"count",
")",
")",
"if",
"len",
"(",
"result",
")",
"==",
"count",
":",
"yield",
"resu... | Slide window. | [
"Slide",
"window",
"."
] | bd223fc5e758213662befbebdf9538f3fbf58ad6 | https://github.com/NoviceLive/pat/blob/bd223fc5e758213662befbebdf9538f3fbf58ad6/pat/utils.py#L49-L57 |
37,428 | sirfoga/pyhal | hal/meta/attributes.py | _get_modules | def _get_modules(path):
"""Finds modules in folder recursively
:param path: directory
:return: list of modules
"""
lst = []
folder_contents = os.listdir(path)
is_python_module = "__init__.py" in folder_contents
if is_python_module:
for file in folder_contents:
full_... | python | def _get_modules(path):
"""Finds modules in folder recursively
:param path: directory
:return: list of modules
"""
lst = []
folder_contents = os.listdir(path)
is_python_module = "__init__.py" in folder_contents
if is_python_module:
for file in folder_contents:
full_... | [
"def",
"_get_modules",
"(",
"path",
")",
":",
"lst",
"=",
"[",
"]",
"folder_contents",
"=",
"os",
".",
"listdir",
"(",
"path",
")",
"is_python_module",
"=",
"\"__init__.py\"",
"in",
"folder_contents",
"if",
"is_python_module",
":",
"for",
"file",
"in",
"fold... | Finds modules in folder recursively
:param path: directory
:return: list of modules | [
"Finds",
"modules",
"in",
"folder",
"recursively"
] | 4394d8a1f7e45bea28a255ec390f4962ee64d33a | https://github.com/sirfoga/pyhal/blob/4394d8a1f7e45bea28a255ec390f4962ee64d33a/hal/meta/attributes.py#L152-L172 |
37,429 | sirfoga/pyhal | hal/meta/attributes.py | ModuleFile._parse | def _parse(self):
"""Parses file contents
:return: Tree hierarchy of file
"""
with open(self.path, "rt") as reader:
return ast.parse(reader.read(), filename=self.path) | python | def _parse(self):
"""Parses file contents
:return: Tree hierarchy of file
"""
with open(self.path, "rt") as reader:
return ast.parse(reader.read(), filename=self.path) | [
"def",
"_parse",
"(",
"self",
")",
":",
"with",
"open",
"(",
"self",
".",
"path",
",",
"\"rt\"",
")",
"as",
"reader",
":",
"return",
"ast",
".",
"parse",
"(",
"reader",
".",
"read",
"(",
")",
",",
"filename",
"=",
"self",
".",
"path",
")"
] | Parses file contents
:return: Tree hierarchy of file | [
"Parses",
"file",
"contents"
] | 4394d8a1f7e45bea28a255ec390f4962ee64d33a | https://github.com/sirfoga/pyhal/blob/4394d8a1f7e45bea28a255ec390f4962ee64d33a/hal/meta/attributes.py#L26-L32 |
37,430 | sirfoga/pyhal | hal/meta/attributes.py | ModuleFile._find_package | def _find_package(self, root_package):
"""Finds package name of file
:param root_package: root package
:return: package name
"""
package = self.path.replace(root_package, "")
if package.endswith(".py"):
package = package[:-3]
package = package.repla... | python | def _find_package(self, root_package):
"""Finds package name of file
:param root_package: root package
:return: package name
"""
package = self.path.replace(root_package, "")
if package.endswith(".py"):
package = package[:-3]
package = package.repla... | [
"def",
"_find_package",
"(",
"self",
",",
"root_package",
")",
":",
"package",
"=",
"self",
".",
"path",
".",
"replace",
"(",
"root_package",
",",
"\"\"",
")",
"if",
"package",
".",
"endswith",
"(",
"\".py\"",
")",
":",
"package",
"=",
"package",
"[",
... | Finds package name of file
:param root_package: root package
:return: package name | [
"Finds",
"package",
"name",
"of",
"file"
] | 4394d8a1f7e45bea28a255ec390f4962ee64d33a | https://github.com/sirfoga/pyhal/blob/4394d8a1f7e45bea28a255ec390f4962ee64d33a/hal/meta/attributes.py#L34-L49 |
37,431 | sirfoga/pyhal | hal/meta/attributes.py | ModuleTree._get_instances | def _get_instances(self, instance):
"""Finds all instances of instance in tree
:param instance: type of object
:return: list of objects in tree of same instance
"""
return [
x
for x in self.tree.body
if isinstance(x, instance)
] | python | def _get_instances(self, instance):
"""Finds all instances of instance in tree
:param instance: type of object
:return: list of objects in tree of same instance
"""
return [
x
for x in self.tree.body
if isinstance(x, instance)
] | [
"def",
"_get_instances",
"(",
"self",
",",
"instance",
")",
":",
"return",
"[",
"x",
"for",
"x",
"in",
"self",
".",
"tree",
".",
"body",
"if",
"isinstance",
"(",
"x",
",",
"instance",
")",
"]"
] | Finds all instances of instance in tree
:param instance: type of object
:return: list of objects in tree of same instance | [
"Finds",
"all",
"instances",
"of",
"instance",
"in",
"tree"
] | 4394d8a1f7e45bea28a255ec390f4962ee64d33a | https://github.com/sirfoga/pyhal/blob/4394d8a1f7e45bea28a255ec390f4962ee64d33a/hal/meta/attributes.py#L70-L81 |
37,432 | sirfoga/pyhal | hal/meta/attributes.py | ModuleTree.get_classes | def get_classes(self):
"""Finds classes in file
:return: list of top-level classes
"""
instances = self._get_instances(ast.ClassDef)
instances = [
PyClass(instance, self.package)
for instance in instances
]
return instances | python | def get_classes(self):
"""Finds classes in file
:return: list of top-level classes
"""
instances = self._get_instances(ast.ClassDef)
instances = [
PyClass(instance, self.package)
for instance in instances
]
return instances | [
"def",
"get_classes",
"(",
"self",
")",
":",
"instances",
"=",
"self",
".",
"_get_instances",
"(",
"ast",
".",
"ClassDef",
")",
"instances",
"=",
"[",
"PyClass",
"(",
"instance",
",",
"self",
".",
"package",
")",
"for",
"instance",
"in",
"instances",
"]"... | Finds classes in file
:return: list of top-level classes | [
"Finds",
"classes",
"in",
"file"
] | 4394d8a1f7e45bea28a255ec390f4962ee64d33a | https://github.com/sirfoga/pyhal/blob/4394d8a1f7e45bea28a255ec390f4962ee64d33a/hal/meta/attributes.py#L83-L93 |
37,433 | lowandrew/OLCTools | spadespipeline/skesa.py | Skesa.best_assemblyfile | def best_assemblyfile(self):
"""
Determine whether the contigs.fasta output file from the assembler is present. If not, set the .bestassembly
attribute to 'NA'
"""
for sample in self.metadata:
try:
# Set the name of the filtered assembly file
... | python | def best_assemblyfile(self):
"""
Determine whether the contigs.fasta output file from the assembler is present. If not, set the .bestassembly
attribute to 'NA'
"""
for sample in self.metadata:
try:
# Set the name of the filtered assembly file
... | [
"def",
"best_assemblyfile",
"(",
"self",
")",
":",
"for",
"sample",
"in",
"self",
".",
"metadata",
":",
"try",
":",
"# Set the name of the filtered assembly file",
"filtered_outputfile",
"=",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"path",
",",
"'raw... | Determine whether the contigs.fasta output file from the assembler is present. If not, set the .bestassembly
attribute to 'NA' | [
"Determine",
"whether",
"the",
"contigs",
".",
"fasta",
"output",
"file",
"from",
"the",
"assembler",
"is",
"present",
".",
"If",
"not",
"set",
"the",
".",
"bestassembly",
"attribute",
"to",
"NA"
] | 88aa90ac85f84d0bbeb03e43c29b0a9d36e4ce2a | https://github.com/lowandrew/OLCTools/blob/88aa90ac85f84d0bbeb03e43c29b0a9d36e4ce2a/spadespipeline/skesa.py#L179-L203 |
37,434 | outini/python-pylls | pylls/cachet.py | ComponentGroups.get | def get(self, group_id=None, **kwargs):
"""Get component groups
:param group_id: Component group ID (optional)
:return: Component groups data (:class:`dict`)
Additional named arguments may be passed and are directly transmitted
to API. It is useful to use the API search feature... | python | def get(self, group_id=None, **kwargs):
"""Get component groups
:param group_id: Component group ID (optional)
:return: Component groups data (:class:`dict`)
Additional named arguments may be passed and are directly transmitted
to API. It is useful to use the API search feature... | [
"def",
"get",
"(",
"self",
",",
"group_id",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"path",
"=",
"'components/groups'",
"if",
"group_id",
"is",
"not",
"None",
":",
"path",
"+=",
"'/%s'",
"%",
"group_id",
"return",
"self",
".",
"paginate_get",
"... | Get component groups
:param group_id: Component group ID (optional)
:return: Component groups data (:class:`dict`)
Additional named arguments may be passed and are directly transmitted
to API. It is useful to use the API search features.
.. seealso:: https://docs.cachethq.io/r... | [
"Get",
"component",
"groups"
] | f9fa220594bc1974469097d9bad690a42d0d0f0f | https://github.com/outini/python-pylls/blob/f9fa220594bc1974469097d9bad690a42d0d0f0f/pylls/cachet.py#L185-L200 |
37,435 | outini/python-pylls | pylls/cachet.py | ComponentGroups.create | def create(self, name, order=None, collapsed=None):
"""Create a new Component Group
:param str name: Name of the component group
:param int order: Order of the component group
:param int collapsed: Collapse the group? 0-2
:return: Created component group data (:class:`dict`)
... | python | def create(self, name, order=None, collapsed=None):
"""Create a new Component Group
:param str name: Name of the component group
:param int order: Order of the component group
:param int collapsed: Collapse the group? 0-2
:return: Created component group data (:class:`dict`)
... | [
"def",
"create",
"(",
"self",
",",
"name",
",",
"order",
"=",
"None",
",",
"collapsed",
"=",
"None",
")",
":",
"data",
"=",
"ApiParams",
"(",
")",
"data",
"[",
"'name'",
"]",
"=",
"name",
"data",
"[",
"'order'",
"]",
"=",
"order",
"data",
"[",
"'... | Create a new Component Group
:param str name: Name of the component group
:param int order: Order of the component group
:param int collapsed: Collapse the group? 0-2
:return: Created component group data (:class:`dict`)
.. seealso:: https://docs.cachethq.io/reference#post-comp... | [
"Create",
"a",
"new",
"Component",
"Group"
] | f9fa220594bc1974469097d9bad690a42d0d0f0f | https://github.com/outini/python-pylls/blob/f9fa220594bc1974469097d9bad690a42d0d0f0f/pylls/cachet.py#L202-L216 |
37,436 | outini/python-pylls | pylls/cachet.py | ComponentGroups.update | def update(self, group_id, name=None, order=None, collapsed=None):
"""Update a Component Group
:param int group_id: Component Group ID
:param str name: Name of the component group
:param int order: Order of the group
:param int collapsed: Collapse the group?
:return: Upd... | python | def update(self, group_id, name=None, order=None, collapsed=None):
"""Update a Component Group
:param int group_id: Component Group ID
:param str name: Name of the component group
:param int order: Order of the group
:param int collapsed: Collapse the group?
:return: Upd... | [
"def",
"update",
"(",
"self",
",",
"group_id",
",",
"name",
"=",
"None",
",",
"order",
"=",
"None",
",",
"collapsed",
"=",
"None",
")",
":",
"data",
"=",
"ApiParams",
"(",
")",
"data",
"[",
"'group'",
"]",
"=",
"group_id",
"data",
"[",
"'name'",
"]... | Update a Component Group
:param int group_id: Component Group ID
:param str name: Name of the component group
:param int order: Order of the group
:param int collapsed: Collapse the group?
:return: Updated component group data (:class:`dict`)
.. seealso:: https://docs.c... | [
"Update",
"a",
"Component",
"Group"
] | f9fa220594bc1974469097d9bad690a42d0d0f0f | https://github.com/outini/python-pylls/blob/f9fa220594bc1974469097d9bad690a42d0d0f0f/pylls/cachet.py#L218-L234 |
37,437 | outini/python-pylls | pylls/cachet.py | Incidents.create | def create(self, name, message, status, visible, component_id=None,
component_status=None, notify=None, created_at=None,
template=None, tplvars=None):
"""Create a new Incident
:param str name: Name of the incident
:param str message: Incident explanation message
... | python | def create(self, name, message, status, visible, component_id=None,
component_status=None, notify=None, created_at=None,
template=None, tplvars=None):
"""Create a new Incident
:param str name: Name of the incident
:param str message: Incident explanation message
... | [
"def",
"create",
"(",
"self",
",",
"name",
",",
"message",
",",
"status",
",",
"visible",
",",
"component_id",
"=",
"None",
",",
"component_status",
"=",
"None",
",",
"notify",
"=",
"None",
",",
"created_at",
"=",
"None",
",",
"template",
"=",
"None",
... | Create a new Incident
:param str name: Name of the incident
:param str message: Incident explanation message
:param int status: Status of the incident
:param int visible: Whether the incident is publicly visible
:param int component_id: Component to update
:param int com... | [
"Create",
"a",
"new",
"Incident"
] | f9fa220594bc1974469097d9bad690a42d0d0f0f | https://github.com/outini/python-pylls/blob/f9fa220594bc1974469097d9bad690a42d0d0f0f/pylls/cachet.py#L271-L301 |
37,438 | outini/python-pylls | pylls/cachet.py | Incidents.update | def update(self, incident_id, name=None, message=None, status=None,
visible=None, component_id=None, component_status=None,
notify=None, created_at=None, template=None, tpl_vars=None):
"""Update an Incident
:param int incident_id: Incident ID
:param str name: Name ... | python | def update(self, incident_id, name=None, message=None, status=None,
visible=None, component_id=None, component_status=None,
notify=None, created_at=None, template=None, tpl_vars=None):
"""Update an Incident
:param int incident_id: Incident ID
:param str name: Name ... | [
"def",
"update",
"(",
"self",
",",
"incident_id",
",",
"name",
"=",
"None",
",",
"message",
"=",
"None",
",",
"status",
"=",
"None",
",",
"visible",
"=",
"None",
",",
"component_id",
"=",
"None",
",",
"component_status",
"=",
"None",
",",
"notify",
"="... | Update an Incident
:param int incident_id: Incident ID
:param str name: Name of the incident
:param str message: Incident explanation message
:param int status: Status of the incident
:param int visible: Whether the incident is publicly visible
:param int component_id: C... | [
"Update",
"an",
"Incident"
] | f9fa220594bc1974469097d9bad690a42d0d0f0f | https://github.com/outini/python-pylls/blob/f9fa220594bc1974469097d9bad690a42d0d0f0f/pylls/cachet.py#L303-L334 |
37,439 | outini/python-pylls | pylls/cachet.py | Metrics.create | def create(self, name, suffix, description, default_value, display=None):
"""Create a new Metric
:param str name: Name of metric
:param str suffix: Metric unit
:param str description: Description of what the metric is measuring
:param int default_value: Default value to use when... | python | def create(self, name, suffix, description, default_value, display=None):
"""Create a new Metric
:param str name: Name of metric
:param str suffix: Metric unit
:param str description: Description of what the metric is measuring
:param int default_value: Default value to use when... | [
"def",
"create",
"(",
"self",
",",
"name",
",",
"suffix",
",",
"description",
",",
"default_value",
",",
"display",
"=",
"None",
")",
":",
"data",
"=",
"ApiParams",
"(",
")",
"data",
"[",
"'name'",
"]",
"=",
"name",
"data",
"[",
"'suffix'",
"]",
"=",... | Create a new Metric
:param str name: Name of metric
:param str suffix: Metric unit
:param str description: Description of what the metric is measuring
:param int default_value: Default value to use when a point is added
:param int display: Display the chart on the status page
... | [
"Create",
"a",
"new",
"Metric"
] | f9fa220594bc1974469097d9bad690a42d0d0f0f | https://github.com/outini/python-pylls/blob/f9fa220594bc1974469097d9bad690a42d0d0f0f/pylls/cachet.py#L383-L401 |
37,440 | outini/python-pylls | pylls/cachet.py | MetricPoints.create | def create(self, metric_id, value, timestamp=None):
"""Add a Metric Point to a Metric
:param int metric_id: Metric ID
:param int value: Value to plot on the metric graph
:param str timestamp: Unix timestamp of the point was measured
:return: Created metric point data (:class:`di... | python | def create(self, metric_id, value, timestamp=None):
"""Add a Metric Point to a Metric
:param int metric_id: Metric ID
:param int value: Value to plot on the metric graph
:param str timestamp: Unix timestamp of the point was measured
:return: Created metric point data (:class:`di... | [
"def",
"create",
"(",
"self",
",",
"metric_id",
",",
"value",
",",
"timestamp",
"=",
"None",
")",
":",
"data",
"=",
"ApiParams",
"(",
")",
"data",
"[",
"'value'",
"]",
"=",
"value",
"data",
"[",
"'timestamp'",
"]",
"=",
"timestamp",
"return",
"self",
... | Add a Metric Point to a Metric
:param int metric_id: Metric ID
:param int value: Value to plot on the metric graph
:param str timestamp: Unix timestamp of the point was measured
:return: Created metric point data (:class:`dict`)
.. seealso:: https://docs.cachethq.io/reference#p... | [
"Add",
"a",
"Metric",
"Point",
"to",
"a",
"Metric"
] | f9fa220594bc1974469097d9bad690a42d0d0f0f | https://github.com/outini/python-pylls/blob/f9fa220594bc1974469097d9bad690a42d0d0f0f/pylls/cachet.py#L431-L444 |
37,441 | outini/python-pylls | pylls/cachet.py | Subscribers.create | def create(self, email, verify=None, components=None):
"""Create a new subscriber
:param str email: Email address to subscribe
:param bool verify: Whether to send verification email
:param list components: Components ID list, defaults to all
:return: Created subscriber data (:cl... | python | def create(self, email, verify=None, components=None):
"""Create a new subscriber
:param str email: Email address to subscribe
:param bool verify: Whether to send verification email
:param list components: Components ID list, defaults to all
:return: Created subscriber data (:cl... | [
"def",
"create",
"(",
"self",
",",
"email",
",",
"verify",
"=",
"None",
",",
"components",
"=",
"None",
")",
":",
"data",
"=",
"ApiParams",
"(",
")",
"data",
"[",
"'email'",
"]",
"=",
"email",
"data",
"[",
"'verify'",
"]",
"=",
"verify",
"data",
"[... | Create a new subscriber
:param str email: Email address to subscribe
:param bool verify: Whether to send verification email
:param list components: Components ID list, defaults to all
:return: Created subscriber data (:class:`dict`)
.. seealso:: https://docs.cachethq.io/referen... | [
"Create",
"a",
"new",
"subscriber"
] | f9fa220594bc1974469097d9bad690a42d0d0f0f | https://github.com/outini/python-pylls/blob/f9fa220594bc1974469097d9bad690a42d0d0f0f/pylls/cachet.py#L479-L493 |
37,442 | lowandrew/OLCTools | coreGenome/core.py | AnnotatedCore.annotatedcore | def annotatedcore(self):
"""
Calculates the core genome of organisms using custom databases
"""
logging.info('Calculating annotated core')
# Determine the total number of core genes
self.total_core()
# Iterate through all the samples, and process all Escherichia
... | python | def annotatedcore(self):
"""
Calculates the core genome of organisms using custom databases
"""
logging.info('Calculating annotated core')
# Determine the total number of core genes
self.total_core()
# Iterate through all the samples, and process all Escherichia
... | [
"def",
"annotatedcore",
"(",
"self",
")",
":",
"logging",
".",
"info",
"(",
"'Calculating annotated core'",
")",
"# Determine the total number of core genes",
"self",
".",
"total_core",
"(",
")",
"# Iterate through all the samples, and process all Escherichia",
"for",
"sample... | Calculates the core genome of organisms using custom databases | [
"Calculates",
"the",
"core",
"genome",
"of",
"organisms",
"using",
"custom",
"databases"
] | 88aa90ac85f84d0bbeb03e43c29b0a9d36e4ce2a | https://github.com/lowandrew/OLCTools/blob/88aa90ac85f84d0bbeb03e43c29b0a9d36e4ce2a/coreGenome/core.py#L169-L193 |
37,443 | lowandrew/OLCTools | coreGenome/core.py | AnnotatedCore.total_core | def total_core(self):
"""
Determine the total number of core genes present
"""
corefile = os.path.join(self.reffilepath, self.analysistype, 'Escherichia', 'core_combined.fasta')
for record in SeqIO.parse(corefile, 'fasta'):
gene_name = record.id.split('-')[0]
... | python | def total_core(self):
"""
Determine the total number of core genes present
"""
corefile = os.path.join(self.reffilepath, self.analysistype, 'Escherichia', 'core_combined.fasta')
for record in SeqIO.parse(corefile, 'fasta'):
gene_name = record.id.split('-')[0]
... | [
"def",
"total_core",
"(",
"self",
")",
":",
"corefile",
"=",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"reffilepath",
",",
"self",
".",
"analysistype",
",",
"'Escherichia'",
",",
"'core_combined.fasta'",
")",
"for",
"record",
"in",
"SeqIO",
".",
... | Determine the total number of core genes present | [
"Determine",
"the",
"total",
"number",
"of",
"core",
"genes",
"present"
] | 88aa90ac85f84d0bbeb03e43c29b0a9d36e4ce2a | https://github.com/lowandrew/OLCTools/blob/88aa90ac85f84d0bbeb03e43c29b0a9d36e4ce2a/coreGenome/core.py#L195-L203 |
37,444 | sirfoga/pyhal | hal/system/process.py | Process.get_simple_output | def get_simple_output(self, stderr=STDOUT):
"""Executes a simple external command and get its output
The command contains no pipes. Error messages are
redirected to the standard output by default
:param stderr: where to put stderr
:return: output of command
"""
a... | python | def get_simple_output(self, stderr=STDOUT):
"""Executes a simple external command and get its output
The command contains no pipes. Error messages are
redirected to the standard output by default
:param stderr: where to put stderr
:return: output of command
"""
a... | [
"def",
"get_simple_output",
"(",
"self",
",",
"stderr",
"=",
"STDOUT",
")",
":",
"args",
"=",
"shlex",
".",
"split",
"(",
"self",
".",
"cmd",
")",
"proc",
"=",
"Popen",
"(",
"args",
",",
"stdout",
"=",
"PIPE",
",",
"stderr",
"=",
"stderr",
")",
"re... | Executes a simple external command and get its output
The command contains no pipes. Error messages are
redirected to the standard output by default
:param stderr: where to put stderr
:return: output of command | [
"Executes",
"a",
"simple",
"external",
"command",
"and",
"get",
"its",
"output",
"The",
"command",
"contains",
"no",
"pipes",
".",
"Error",
"messages",
"are",
"redirected",
"to",
"the",
"standard",
"output",
"by",
"default"
] | 4394d8a1f7e45bea28a255ec390f4962ee64d33a | https://github.com/sirfoga/pyhal/blob/4394d8a1f7e45bea28a255ec390f4962ee64d33a/hal/system/process.py#L21-L31 |
37,445 | sirfoga/pyhal | hal/system/process.py | Process.get_complex_output | def get_complex_output(self, stderr=STDOUT):
"""Executes a piped command and get the lines of the output in a list
:param stderr: where to put stderr
:return: output of command
"""
proc = Popen(self.cmd, shell=True, stdout=PIPE, stderr=stderr)
return proc.stdout.readline... | python | def get_complex_output(self, stderr=STDOUT):
"""Executes a piped command and get the lines of the output in a list
:param stderr: where to put stderr
:return: output of command
"""
proc = Popen(self.cmd, shell=True, stdout=PIPE, stderr=stderr)
return proc.stdout.readline... | [
"def",
"get_complex_output",
"(",
"self",
",",
"stderr",
"=",
"STDOUT",
")",
":",
"proc",
"=",
"Popen",
"(",
"self",
".",
"cmd",
",",
"shell",
"=",
"True",
",",
"stdout",
"=",
"PIPE",
",",
"stderr",
"=",
"stderr",
")",
"return",
"proc",
".",
"stdout"... | Executes a piped command and get the lines of the output in a list
:param stderr: where to put stderr
:return: output of command | [
"Executes",
"a",
"piped",
"command",
"and",
"get",
"the",
"lines",
"of",
"the",
"output",
"in",
"a",
"list"
] | 4394d8a1f7e45bea28a255ec390f4962ee64d33a | https://github.com/sirfoga/pyhal/blob/4394d8a1f7e45bea28a255ec390f4962ee64d33a/hal/system/process.py#L33-L40 |
37,446 | sirfoga/pyhal | hal/system/process.py | Process.keep_alive | def keep_alive(self):
"""Keeps a process alive. If the process terminates, it will restart it
The terminated processes become zombies. They die when their parent
terminates
"""
while True:
pid = self.execute_in_background()
p = psutil.Process(pid)
... | python | def keep_alive(self):
"""Keeps a process alive. If the process terminates, it will restart it
The terminated processes become zombies. They die when their parent
terminates
"""
while True:
pid = self.execute_in_background()
p = psutil.Process(pid)
... | [
"def",
"keep_alive",
"(",
"self",
")",
":",
"while",
"True",
":",
"pid",
"=",
"self",
".",
"execute_in_background",
"(",
")",
"p",
"=",
"psutil",
".",
"Process",
"(",
"pid",
")",
"while",
"p",
".",
"is_running",
"(",
")",
"and",
"str",
"(",
"p",
".... | Keeps a process alive. If the process terminates, it will restart it
The terminated processes become zombies. They die when their parent
terminates | [
"Keeps",
"a",
"process",
"alive",
".",
"If",
"the",
"process",
"terminates",
"it",
"will",
"restart",
"it",
"The",
"terminated",
"processes",
"become",
"zombies",
".",
"They",
"die",
"when",
"their",
"parent",
"terminates"
] | 4394d8a1f7e45bea28a255ec390f4962ee64d33a | https://github.com/sirfoga/pyhal/blob/4394d8a1f7e45bea28a255ec390f4962ee64d33a/hal/system/process.py#L92-L101 |
37,447 | portfors-lab/sparkle | sparkle/tools/util.py | increment_title | def increment_title(title):
"""
Increments a string that ends in a number
"""
count = re.search('\d+$', title).group(0)
new_title = title[:-(len(count))] + str(int(count)+1)
return new_title | python | def increment_title(title):
"""
Increments a string that ends in a number
"""
count = re.search('\d+$', title).group(0)
new_title = title[:-(len(count))] + str(int(count)+1)
return new_title | [
"def",
"increment_title",
"(",
"title",
")",
":",
"count",
"=",
"re",
".",
"search",
"(",
"'\\d+$'",
",",
"title",
")",
".",
"group",
"(",
"0",
")",
"new_title",
"=",
"title",
"[",
":",
"-",
"(",
"len",
"(",
"count",
")",
")",
"]",
"+",
"str",
... | Increments a string that ends in a number | [
"Increments",
"a",
"string",
"that",
"ends",
"in",
"a",
"number"
] | 5fad1cf2bec58ec6b15d91da20f6236a74826110 | https://github.com/portfors-lab/sparkle/blob/5fad1cf2bec58ec6b15d91da20f6236a74826110/sparkle/tools/util.py#L9-L15 |
37,448 | Frzk/Ellis | ellis/rule.py | Rule.check_limit | def check_limit(self, limit):
"""
Checks if the given limit is valid.
A limit must be > 0 to be considered valid.
Raises ValueError when the *limit* is not > 0.
"""
if limit > 0:
self.limit = limit
else:
raise ValueError("Rule limit must ... | python | def check_limit(self, limit):
"""
Checks if the given limit is valid.
A limit must be > 0 to be considered valid.
Raises ValueError when the *limit* is not > 0.
"""
if limit > 0:
self.limit = limit
else:
raise ValueError("Rule limit must ... | [
"def",
"check_limit",
"(",
"self",
",",
"limit",
")",
":",
"if",
"limit",
">",
"0",
":",
"self",
".",
"limit",
"=",
"limit",
"else",
":",
"raise",
"ValueError",
"(",
"\"Rule limit must be strictly > 0 ({0} given)\"",
".",
"format",
"(",
"limit",
")",
")",
... | Checks if the given limit is valid.
A limit must be > 0 to be considered valid.
Raises ValueError when the *limit* is not > 0. | [
"Checks",
"if",
"the",
"given",
"limit",
"is",
"valid",
"."
] | 39ce8987cbc503354cf1f45927344186a8b18363 | https://github.com/Frzk/Ellis/blob/39ce8987cbc503354cf1f45927344186a8b18363/ellis/rule.py#L59-L73 |
37,449 | jmbhughes/suvi-trainer | scripts/make_movie_frames.py | get_args | def get_args():
"""
request the arguments for running
"""
ap = argparse.ArgumentParser(description="Create frames for a movie that can be compiled using ffmpeg")
ap.add_argument("start", help="date string as start time")
ap.add_argument("end", help="date string as end time")
ap.add_argument(... | python | def get_args():
"""
request the arguments for running
"""
ap = argparse.ArgumentParser(description="Create frames for a movie that can be compiled using ffmpeg")
ap.add_argument("start", help="date string as start time")
ap.add_argument("end", help="date string as end time")
ap.add_argument(... | [
"def",
"get_args",
"(",
")",
":",
"ap",
"=",
"argparse",
".",
"ArgumentParser",
"(",
"description",
"=",
"\"Create frames for a movie that can be compiled using ffmpeg\"",
")",
"ap",
".",
"add_argument",
"(",
"\"start\"",
",",
"help",
"=",
"\"date string as start time\"... | request the arguments for running | [
"request",
"the",
"arguments",
"for",
"running"
] | 3d89894a4a037286221974c7eb5634d229b4f5d4 | https://github.com/jmbhughes/suvi-trainer/blob/3d89894a4a037286221974c7eb5634d229b4f5d4/scripts/make_movie_frames.py#L11-L20 |
37,450 | jmbhughes/suvi-trainer | scripts/make_movie_frames.py | main | def main():
"""
process the main task
"""
args = get_args()
args.start = date_parser.parse(args.start)
args.end = date_parser.parse(args.end)
args.step = timedelta(args.step)
config = Config(args.config)
times = [args.start + i * args.step for i in range(int((args.end - args.start) ... | python | def main():
"""
process the main task
"""
args = get_args()
args.start = date_parser.parse(args.start)
args.end = date_parser.parse(args.end)
args.step = timedelta(args.step)
config = Config(args.config)
times = [args.start + i * args.step for i in range(int((args.end - args.start) ... | [
"def",
"main",
"(",
")",
":",
"args",
"=",
"get_args",
"(",
")",
"args",
".",
"start",
"=",
"date_parser",
".",
"parse",
"(",
"args",
".",
"start",
")",
"args",
".",
"end",
"=",
"date_parser",
".",
"parse",
"(",
"args",
".",
"end",
")",
"args",
"... | process the main task | [
"process",
"the",
"main",
"task"
] | 3d89894a4a037286221974c7eb5634d229b4f5d4 | https://github.com/jmbhughes/suvi-trainer/blob/3d89894a4a037286221974c7eb5634d229b4f5d4/scripts/make_movie_frames.py#L61-L74 |
37,451 | TorkamaniLab/metapipe | metapipe/models/grammar.py | Grammar.overall | def overall():
""" The overall grammer for pulling apart the main input files. """
return ZeroOrMore(Grammar.comment) + Dict(ZeroOrMore(Group(
Grammar._section + ZeroOrMore(Group(Grammar.line)))
)) | python | def overall():
""" The overall grammer for pulling apart the main input files. """
return ZeroOrMore(Grammar.comment) + Dict(ZeroOrMore(Group(
Grammar._section + ZeroOrMore(Group(Grammar.line)))
)) | [
"def",
"overall",
"(",
")",
":",
"return",
"ZeroOrMore",
"(",
"Grammar",
".",
"comment",
")",
"+",
"Dict",
"(",
"ZeroOrMore",
"(",
"Group",
"(",
"Grammar",
".",
"_section",
"+",
"ZeroOrMore",
"(",
"Group",
"(",
"Grammar",
".",
"line",
")",
")",
")",
... | The overall grammer for pulling apart the main input files. | [
"The",
"overall",
"grammer",
"for",
"pulling",
"apart",
"the",
"main",
"input",
"files",
"."
] | 15592e5b0c217afb00ac03503f8d0d7453d4baf4 | https://github.com/TorkamaniLab/metapipe/blob/15592e5b0c217afb00ac03503f8d0d7453d4baf4/metapipe/models/grammar.py#L51-L55 |
37,452 | TorkamaniLab/metapipe | metapipe/models/grammar.py | Grammar.file | def file():
""" Grammar for files found in the overall input files. """
return (
Optional(Word(alphanums).setResultsName('alias') +
Suppress(Literal('.'))) + Suppress(White()) +
Word(approved_printables).setResultsName('filename')
) | python | def file():
""" Grammar for files found in the overall input files. """
return (
Optional(Word(alphanums).setResultsName('alias') +
Suppress(Literal('.'))) + Suppress(White()) +
Word(approved_printables).setResultsName('filename')
) | [
"def",
"file",
"(",
")",
":",
"return",
"(",
"Optional",
"(",
"Word",
"(",
"alphanums",
")",
".",
"setResultsName",
"(",
"'alias'",
")",
"+",
"Suppress",
"(",
"Literal",
"(",
"'.'",
")",
")",
")",
"+",
"Suppress",
"(",
"White",
"(",
")",
")",
"+",
... | Grammar for files found in the overall input files. | [
"Grammar",
"for",
"files",
"found",
"in",
"the",
"overall",
"input",
"files",
"."
] | 15592e5b0c217afb00ac03503f8d0d7453d4baf4 | https://github.com/TorkamaniLab/metapipe/blob/15592e5b0c217afb00ac03503f8d0d7453d4baf4/metapipe/models/grammar.py#L64-L70 |
37,453 | yamcs/yamcs-python | yamcs-client/examples/events.py | listen_to_event_updates | def listen_to_event_updates():
"""Subscribe to events."""
def callback(event):
print('Event:', event)
client.create_event_subscription(instance='simulator', on_data=callback)
sleep(5) | python | def listen_to_event_updates():
"""Subscribe to events."""
def callback(event):
print('Event:', event)
client.create_event_subscription(instance='simulator', on_data=callback)
sleep(5) | [
"def",
"listen_to_event_updates",
"(",
")",
":",
"def",
"callback",
"(",
"event",
")",
":",
"print",
"(",
"'Event:'",
",",
"event",
")",
"client",
".",
"create_event_subscription",
"(",
"instance",
"=",
"'simulator'",
",",
"on_data",
"=",
"callback",
")",
"s... | Subscribe to events. | [
"Subscribe",
"to",
"events",
"."
] | 1082fee8a299010cc44416bbb7518fac0ef08b48 | https://github.com/yamcs/yamcs-python/blob/1082fee8a299010cc44416bbb7518fac0ef08b48/yamcs-client/examples/events.py#L8-L15 |
37,454 | JukeboxPipeline/jukeboxmaya | src/jukeboxmaya/mayaplugins/jbscene.py | get_current_scene_node | def get_current_scene_node():
"""Return the name of the jb_sceneNode, that describes the current scene or None if there is no scene node.
:returns: the full name of the node or none, if there is no scene node
:rtype: str | None
:raises: None
"""
c = cmds.namespaceInfo(':', listOnlyDependencyNod... | python | def get_current_scene_node():
"""Return the name of the jb_sceneNode, that describes the current scene or None if there is no scene node.
:returns: the full name of the node or none, if there is no scene node
:rtype: str | None
:raises: None
"""
c = cmds.namespaceInfo(':', listOnlyDependencyNod... | [
"def",
"get_current_scene_node",
"(",
")",
":",
"c",
"=",
"cmds",
".",
"namespaceInfo",
"(",
"':'",
",",
"listOnlyDependencyNodes",
"=",
"True",
",",
"absoluteName",
"=",
"True",
",",
"dagPath",
"=",
"True",
")",
"l",
"=",
"cmds",
".",
"ls",
"(",
"c",
... | Return the name of the jb_sceneNode, that describes the current scene or None if there is no scene node.
:returns: the full name of the node or none, if there is no scene node
:rtype: str | None
:raises: None | [
"Return",
"the",
"name",
"of",
"the",
"jb_sceneNode",
"that",
"describes",
"the",
"current",
"scene",
"or",
"None",
"if",
"there",
"is",
"no",
"scene",
"node",
"."
] | c8d6318d53cdb5493453c4a6b65ef75bdb2d5f2c | https://github.com/JukeboxPipeline/jukeboxmaya/blob/c8d6318d53cdb5493453c4a6b65ef75bdb2d5f2c/src/jukeboxmaya/mayaplugins/jbscene.py#L53-L67 |
37,455 | portfors-lab/sparkle | sparkle/gui/plotting/protocoldisplay.py | ProtocolDisplay.updateSpec | def updateSpec(self, *args, **kwargs):
"""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>`
... | python | def updateSpec(self, *args, **kwargs):
"""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>`
... | [
"def",
"updateSpec",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"args",
"[",
"0",
"]",
"is",
"None",
":",
"self",
".",
"specPlot",
".",
"clearImg",
"(",
")",
"elif",
"isinstance",
"(",
"args",
"[",
"0",
"]",
",",
"b... | 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>` | [
"Updates",
"the",
"spectrogram",
".",
"First",
"argument",
"can",
"be",
"a",
"filename",
"or",
"a",
"data",
"array",
".",
"If",
"no",
"arguments",
"are",
"given",
"clears",
"the",
"spectrograms",
"."
] | 5fad1cf2bec58ec6b15d91da20f6236a74826110 | https://github.com/portfors-lab/sparkle/blob/5fad1cf2bec58ec6b15d91da20f6236a74826110/sparkle/gui/plotting/protocoldisplay.py#L72-L83 |
37,456 | portfors-lab/sparkle | sparkle/gui/plotting/protocoldisplay.py | ProtocolDisplay.showSpec | def showSpec(self, fname):
"""Draws the spectrogram if it is currently None"""
if not self.specPlot.hasImg() and fname is not None:
self.specPlot.fromFile(fname) | python | def showSpec(self, fname):
"""Draws the spectrogram if it is currently None"""
if not self.specPlot.hasImg() and fname is not None:
self.specPlot.fromFile(fname) | [
"def",
"showSpec",
"(",
"self",
",",
"fname",
")",
":",
"if",
"not",
"self",
".",
"specPlot",
".",
"hasImg",
"(",
")",
"and",
"fname",
"is",
"not",
"None",
":",
"self",
".",
"specPlot",
".",
"fromFile",
"(",
"fname",
")"
] | Draws the spectrogram if it is currently None | [
"Draws",
"the",
"spectrogram",
"if",
"it",
"is",
"currently",
"None"
] | 5fad1cf2bec58ec6b15d91da20f6236a74826110 | https://github.com/portfors-lab/sparkle/blob/5fad1cf2bec58ec6b15d91da20f6236a74826110/sparkle/gui/plotting/protocoldisplay.py#L85-L88 |
37,457 | portfors-lab/sparkle | sparkle/gui/plotting/protocoldisplay.py | ProtocolDisplay.updateSpiketrace | def updateSpiketrace(self, xdata, ydata, plotname=None):
"""Updates the spike trace
:param xdata: index values
:type xdata: numpy.ndarray
:param ydata: values to plot
:type ydata: numpy.ndarray
"""
if plotname is None:
plotname = self.responsePlots.ke... | python | def updateSpiketrace(self, xdata, ydata, plotname=None):
"""Updates the spike trace
:param xdata: index values
:type xdata: numpy.ndarray
:param ydata: values to plot
:type ydata: numpy.ndarray
"""
if plotname is None:
plotname = self.responsePlots.ke... | [
"def",
"updateSpiketrace",
"(",
"self",
",",
"xdata",
",",
"ydata",
",",
"plotname",
"=",
"None",
")",
":",
"if",
"plotname",
"is",
"None",
":",
"plotname",
"=",
"self",
".",
"responsePlots",
".",
"keys",
"(",
")",
"[",
"0",
"]",
"if",
"len",
"(",
... | Updates the spike trace
:param xdata: index values
:type xdata: numpy.ndarray
:param ydata: values to plot
:type ydata: numpy.ndarray | [
"Updates",
"the",
"spike",
"trace"
] | 5fad1cf2bec58ec6b15d91da20f6236a74826110 | https://github.com/portfors-lab/sparkle/blob/5fad1cf2bec58ec6b15d91da20f6236a74826110/sparkle/gui/plotting/protocoldisplay.py#L127-L141 |
37,458 | portfors-lab/sparkle | sparkle/gui/plotting/protocoldisplay.py | ProtocolDisplay.updateSignal | def updateSignal(self, xdata, ydata, plotname=None):
"""Updates the trace of the outgoing signal
:param xdata: time points of recording
:param ydata: brain potential at time points
"""
if plotname is None:
plotname = self.responsePlots.keys()[0]
self.response... | python | def updateSignal(self, xdata, ydata, plotname=None):
"""Updates the trace of the outgoing signal
:param xdata: time points of recording
:param ydata: brain potential at time points
"""
if plotname is None:
plotname = self.responsePlots.keys()[0]
self.response... | [
"def",
"updateSignal",
"(",
"self",
",",
"xdata",
",",
"ydata",
",",
"plotname",
"=",
"None",
")",
":",
"if",
"plotname",
"is",
"None",
":",
"plotname",
"=",
"self",
".",
"responsePlots",
".",
"keys",
"(",
")",
"[",
"0",
"]",
"self",
".",
"responsePl... | Updates the trace of the outgoing signal
:param xdata: time points of recording
:param ydata: brain potential at time points | [
"Updates",
"the",
"trace",
"of",
"the",
"outgoing",
"signal"
] | 5fad1cf2bec58ec6b15d91da20f6236a74826110 | https://github.com/portfors-lab/sparkle/blob/5fad1cf2bec58ec6b15d91da20f6236a74826110/sparkle/gui/plotting/protocoldisplay.py#L160-L168 |
37,459 | portfors-lab/sparkle | sparkle/gui/plotting/protocoldisplay.py | ProtocolDisplay.setXlimits | def setXlimits(self, lims):
"""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)
"""
# update all "linked", plots
self.specPlot.setXlim(lims)
for plot in self.responsePlots.values():
... | python | def setXlimits(self, lims):
"""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)
"""
# update all "linked", plots
self.specPlot.setXlim(lims)
for plot in self.responsePlots.values():
... | [
"def",
"setXlimits",
"(",
"self",
",",
"lims",
")",
":",
"# update all \"linked\", plots",
"self",
".",
"specPlot",
".",
"setXlim",
"(",
"lims",
")",
"for",
"plot",
"in",
"self",
".",
"responsePlots",
".",
"values",
"(",
")",
":",
"plot",
".",
"setXlim",
... | 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) | [
"Sets",
"the",
"X",
"axis",
"limits",
"of",
"the",
"trace",
"plot"
] | 5fad1cf2bec58ec6b15d91da20f6236a74826110 | https://github.com/portfors-lab/sparkle/blob/5fad1cf2bec58ec6b15d91da20f6236a74826110/sparkle/gui/plotting/protocoldisplay.py#L170-L192 |
37,460 | portfors-lab/sparkle | sparkle/gui/plotting/protocoldisplay.py | ProtocolDisplay.setNreps | def setNreps(self, nreps):
"""Sets the number of reps before the raster plot resets"""
for plot in self.responsePlots.values():
plot.setNreps(nreps) | python | def setNreps(self, nreps):
"""Sets the number of reps before the raster plot resets"""
for plot in self.responsePlots.values():
plot.setNreps(nreps) | [
"def",
"setNreps",
"(",
"self",
",",
"nreps",
")",
":",
"for",
"plot",
"in",
"self",
".",
"responsePlots",
".",
"values",
"(",
")",
":",
"plot",
".",
"setNreps",
"(",
"nreps",
")"
] | Sets the number of reps before the raster plot resets | [
"Sets",
"the",
"number",
"of",
"reps",
"before",
"the",
"raster",
"plot",
"resets"
] | 5fad1cf2bec58ec6b15d91da20f6236a74826110 | https://github.com/portfors-lab/sparkle/blob/5fad1cf2bec58ec6b15d91da20f6236a74826110/sparkle/gui/plotting/protocoldisplay.py#L200-L203 |
37,461 | portfors-lab/sparkle | sparkle/gui/plotting/protocoldisplay.py | ProtocolDisplay.specAutoRange | def specAutoRange(self):
"""Auto adjusts the visible range of the spectrogram"""
trace_range = self.responsePlots.values()[0].viewRange()[0]
vb = self.specPlot.getViewBox()
vb.autoRange(padding=0)
self.specPlot.setXlim(trace_range) | python | def specAutoRange(self):
"""Auto adjusts the visible range of the spectrogram"""
trace_range = self.responsePlots.values()[0].viewRange()[0]
vb = self.specPlot.getViewBox()
vb.autoRange(padding=0)
self.specPlot.setXlim(trace_range) | [
"def",
"specAutoRange",
"(",
"self",
")",
":",
"trace_range",
"=",
"self",
".",
"responsePlots",
".",
"values",
"(",
")",
"[",
"0",
"]",
".",
"viewRange",
"(",
")",
"[",
"0",
"]",
"vb",
"=",
"self",
".",
"specPlot",
".",
"getViewBox",
"(",
")",
"vb... | Auto adjusts the visible range of the spectrogram | [
"Auto",
"adjusts",
"the",
"visible",
"range",
"of",
"the",
"spectrogram"
] | 5fad1cf2bec58ec6b15d91da20f6236a74826110 | https://github.com/portfors-lab/sparkle/blob/5fad1cf2bec58ec6b15d91da20f6236a74826110/sparkle/gui/plotting/protocoldisplay.py#L209-L214 |
37,462 | jmbhughes/suvi-trainer | suvitrainer/gui.py | App.save | def save(self):
""" Save as a FITS file and attempt an upload if designated in the configuration file """
out = Outgest(self.output, self.selection_array.astype('uint8'), self.headers, self.config_path)
out.save()
out.upload() | python | def save(self):
""" Save as a FITS file and attempt an upload if designated in the configuration file """
out = Outgest(self.output, self.selection_array.astype('uint8'), self.headers, self.config_path)
out.save()
out.upload() | [
"def",
"save",
"(",
"self",
")",
":",
"out",
"=",
"Outgest",
"(",
"self",
".",
"output",
",",
"self",
".",
"selection_array",
".",
"astype",
"(",
"'uint8'",
")",
",",
"self",
".",
"headers",
",",
"self",
".",
"config_path",
")",
"out",
".",
"save",
... | Save as a FITS file and attempt an upload if designated in the configuration file | [
"Save",
"as",
"a",
"FITS",
"file",
"and",
"attempt",
"an",
"upload",
"if",
"designated",
"in",
"the",
"configuration",
"file"
] | 3d89894a4a037286221974c7eb5634d229b4f5d4 | https://github.com/jmbhughes/suvi-trainer/blob/3d89894a4a037286221974c7eb5634d229b4f5d4/suvitrainer/gui.py#L198-L202 |
37,463 | jmbhughes/suvi-trainer | suvitrainer/gui.py | App.on_exit | def on_exit(self):
""" When you click to exit, this function is called, prompts whether to save"""
answer = messagebox.askyesnocancel("Exit", "Do you want to save as you quit the application?")
if answer:
self.save()
self.quit()
self.destroy()
elif ans... | python | def on_exit(self):
""" When you click to exit, this function is called, prompts whether to save"""
answer = messagebox.askyesnocancel("Exit", "Do you want to save as you quit the application?")
if answer:
self.save()
self.quit()
self.destroy()
elif ans... | [
"def",
"on_exit",
"(",
"self",
")",
":",
"answer",
"=",
"messagebox",
".",
"askyesnocancel",
"(",
"\"Exit\"",
",",
"\"Do you want to save as you quit the application?\"",
")",
"if",
"answer",
":",
"self",
".",
"save",
"(",
")",
"self",
".",
"quit",
"(",
")",
... | When you click to exit, this function is called, prompts whether to save | [
"When",
"you",
"click",
"to",
"exit",
"this",
"function",
"is",
"called",
"prompts",
"whether",
"to",
"save"
] | 3d89894a4a037286221974c7eb5634d229b4f5d4 | https://github.com/jmbhughes/suvi-trainer/blob/3d89894a4a037286221974c7eb5634d229b4f5d4/suvitrainer/gui.py#L204-L215 |
37,464 | jmbhughes/suvi-trainer | suvitrainer/gui.py | App.make_gui | def make_gui(self):
""" Setups the general structure of the gui, the first function called """
self.option_window = Toplevel()
self.option_window.protocol("WM_DELETE_WINDOW", self.on_exit)
self.canvas_frame = tk.Frame(self, height=500)
self.option_frame = tk.Frame(self.option_win... | python | def make_gui(self):
""" Setups the general structure of the gui, the first function called """
self.option_window = Toplevel()
self.option_window.protocol("WM_DELETE_WINDOW", self.on_exit)
self.canvas_frame = tk.Frame(self, height=500)
self.option_frame = tk.Frame(self.option_win... | [
"def",
"make_gui",
"(",
"self",
")",
":",
"self",
".",
"option_window",
"=",
"Toplevel",
"(",
")",
"self",
".",
"option_window",
".",
"protocol",
"(",
"\"WM_DELETE_WINDOW\"",
",",
"self",
".",
"on_exit",
")",
"self",
".",
"canvas_frame",
"=",
"tk",
".",
... | Setups the general structure of the gui, the first function called | [
"Setups",
"the",
"general",
"structure",
"of",
"the",
"gui",
"the",
"first",
"function",
"called"
] | 3d89894a4a037286221974c7eb5634d229b4f5d4 | https://github.com/jmbhughes/suvi-trainer/blob/3d89894a4a037286221974c7eb5634d229b4f5d4/suvitrainer/gui.py#L222-L232 |
37,465 | jmbhughes/suvi-trainer | suvitrainer/gui.py | App.make_options_frame | def make_options_frame(self):
""" make the frame that allows for configuration and classification"""
self.tab_frame = ttk.Notebook(self.option_frame, width=800)
self.tab_configure = tk.Frame(self.tab_frame)
self.tab_classify = tk.Frame(self.tab_frame)
self.make_configure_tab()
... | python | def make_options_frame(self):
""" make the frame that allows for configuration and classification"""
self.tab_frame = ttk.Notebook(self.option_frame, width=800)
self.tab_configure = tk.Frame(self.tab_frame)
self.tab_classify = tk.Frame(self.tab_frame)
self.make_configure_tab()
... | [
"def",
"make_options_frame",
"(",
"self",
")",
":",
"self",
".",
"tab_frame",
"=",
"ttk",
".",
"Notebook",
"(",
"self",
".",
"option_frame",
",",
"width",
"=",
"800",
")",
"self",
".",
"tab_configure",
"=",
"tk",
".",
"Frame",
"(",
"self",
".",
"tab_fr... | make the frame that allows for configuration and classification | [
"make",
"the",
"frame",
"that",
"allows",
"for",
"configuration",
"and",
"classification"
] | 3d89894a4a037286221974c7eb5634d229b4f5d4 | https://github.com/jmbhughes/suvi-trainer/blob/3d89894a4a037286221974c7eb5634d229b4f5d4/suvitrainer/gui.py#L447-L457 |
37,466 | jmbhughes/suvi-trainer | suvitrainer/gui.py | App.disable_multicolor | def disable_multicolor(self):
""" swap from the multicolor image to the single color image """
# disable the multicolor image
for color in ['red', 'green', 'blue']:
self.multicolorscales[color].config(state=tk.DISABLED, bg='grey')
self.multicolorframes[color].config(bg='g... | python | def disable_multicolor(self):
""" swap from the multicolor image to the single color image """
# disable the multicolor image
for color in ['red', 'green', 'blue']:
self.multicolorscales[color].config(state=tk.DISABLED, bg='grey')
self.multicolorframes[color].config(bg='g... | [
"def",
"disable_multicolor",
"(",
"self",
")",
":",
"# disable the multicolor image",
"for",
"color",
"in",
"[",
"'red'",
",",
"'green'",
",",
"'blue'",
"]",
":",
"self",
".",
"multicolorscales",
"[",
"color",
"]",
".",
"config",
"(",
"state",
"=",
"tk",
"... | swap from the multicolor image to the single color image | [
"swap",
"from",
"the",
"multicolor",
"image",
"to",
"the",
"single",
"color",
"image"
] | 3d89894a4a037286221974c7eb5634d229b4f5d4 | https://github.com/jmbhughes/suvi-trainer/blob/3d89894a4a037286221974c7eb5634d229b4f5d4/suvitrainer/gui.py#L459-L476 |
37,467 | jmbhughes/suvi-trainer | suvitrainer/gui.py | App.update_button_action | def update_button_action(self):
""" when update button is clicked, refresh the data preview"""
if self.mode.get() == 3: # threecolor
self.configure_threecolor_image()
elif self.mode.get() == 1: # singlecolor
self.configure_singlecolor_image()
else:
r... | python | def update_button_action(self):
""" when update button is clicked, refresh the data preview"""
if self.mode.get() == 3: # threecolor
self.configure_threecolor_image()
elif self.mode.get() == 1: # singlecolor
self.configure_singlecolor_image()
else:
r... | [
"def",
"update_button_action",
"(",
"self",
")",
":",
"if",
"self",
".",
"mode",
".",
"get",
"(",
")",
"==",
"3",
":",
"# threecolor",
"self",
".",
"configure_threecolor_image",
"(",
")",
"elif",
"self",
".",
"mode",
".",
"get",
"(",
")",
"==",
"1",
... | when update button is clicked, refresh the data preview | [
"when",
"update",
"button",
"is",
"clicked",
"refresh",
"the",
"data",
"preview"
] | 3d89894a4a037286221974c7eb5634d229b4f5d4 | https://github.com/jmbhughes/suvi-trainer/blob/3d89894a4a037286221974c7eb5634d229b4f5d4/suvitrainer/gui.py#L497-L509 |
37,468 | jmbhughes/suvi-trainer | suvitrainer/gui.py | App.make_configure_tab | def make_configure_tab(self):
""" initial set up of configure tab"""
# Setup the choice between single and multicolor
modeframe = tk.Frame(self.tab_configure)
self.mode = tk.IntVar()
singlecolor = tk.Radiobutton(modeframe, text="Single color", variable=self.mode,
... | python | def make_configure_tab(self):
""" initial set up of configure tab"""
# Setup the choice between single and multicolor
modeframe = tk.Frame(self.tab_configure)
self.mode = tk.IntVar()
singlecolor = tk.Radiobutton(modeframe, text="Single color", variable=self.mode,
... | [
"def",
"make_configure_tab",
"(",
"self",
")",
":",
"# Setup the choice between single and multicolor",
"modeframe",
"=",
"tk",
".",
"Frame",
"(",
"self",
".",
"tab_configure",
")",
"self",
".",
"mode",
"=",
"tk",
".",
"IntVar",
"(",
")",
"singlecolor",
"=",
"... | initial set up of configure tab | [
"initial",
"set",
"up",
"of",
"configure",
"tab"
] | 3d89894a4a037286221974c7eb5634d229b4f5d4 | https://github.com/jmbhughes/suvi-trainer/blob/3d89894a4a037286221974c7eb5634d229b4f5d4/suvitrainer/gui.py#L511-L529 |
37,469 | jmbhughes/suvi-trainer | suvitrainer/gui.py | App.make_classify_tab | def make_classify_tab(self):
""" initial set up of classification tab"""
self.pick_frame = tk.Frame(self.tab_classify)
self.pick_frame2 = tk.Frame(self.tab_classify)
self.solar_class_var = tk.IntVar()
self.solar_class_var.set(0) # initialize to unlabeled
buttonnum = 0
... | python | def make_classify_tab(self):
""" initial set up of classification tab"""
self.pick_frame = tk.Frame(self.tab_classify)
self.pick_frame2 = tk.Frame(self.tab_classify)
self.solar_class_var = tk.IntVar()
self.solar_class_var.set(0) # initialize to unlabeled
buttonnum = 0
... | [
"def",
"make_classify_tab",
"(",
"self",
")",
":",
"self",
".",
"pick_frame",
"=",
"tk",
".",
"Frame",
"(",
"self",
".",
"tab_classify",
")",
"self",
".",
"pick_frame2",
"=",
"tk",
".",
"Frame",
"(",
"self",
".",
"tab_classify",
")",
"self",
".",
"sola... | initial set up of classification tab | [
"initial",
"set",
"up",
"of",
"classification",
"tab"
] | 3d89894a4a037286221974c7eb5634d229b4f5d4 | https://github.com/jmbhughes/suvi-trainer/blob/3d89894a4a037286221974c7eb5634d229b4f5d4/suvitrainer/gui.py#L531-L554 |
37,470 | jmbhughes/suvi-trainer | suvitrainer/gui.py | App.setup_singlecolor | def setup_singlecolor(self):
""" initial setup of single color options and variables"""
self.singlecolorframe = tk.Frame(self.tab_configure, bg=self.single_color_theme)
channel_choices = sorted(list(self.data.keys()))
self.singlecolorlabel = tk.Label(self.singlecolorframe, text="single",... | python | def setup_singlecolor(self):
""" initial setup of single color options and variables"""
self.singlecolorframe = tk.Frame(self.tab_configure, bg=self.single_color_theme)
channel_choices = sorted(list(self.data.keys()))
self.singlecolorlabel = tk.Label(self.singlecolorframe, text="single",... | [
"def",
"setup_singlecolor",
"(",
"self",
")",
":",
"self",
".",
"singlecolorframe",
"=",
"tk",
".",
"Frame",
"(",
"self",
".",
"tab_configure",
",",
"bg",
"=",
"self",
".",
"single_color_theme",
")",
"channel_choices",
"=",
"sorted",
"(",
"list",
"(",
"sel... | initial setup of single color options and variables | [
"initial",
"setup",
"of",
"single",
"color",
"options",
"and",
"variables"
] | 3d89894a4a037286221974c7eb5634d229b4f5d4 | https://github.com/jmbhughes/suvi-trainer/blob/3d89894a4a037286221974c7eb5634d229b4f5d4/suvitrainer/gui.py#L556-L594 |
37,471 | jmbhughes/suvi-trainer | suvitrainer/gui.py | App.undobutton_action | def undobutton_action(self):
""" when undo is clicked, revert the thematic map to the previous state"""
if len(self.history) > 1:
old = self.history.pop(-1)
self.selection_array = old
self.mask.set_data(old)
self.fig.canvas.draw_idle() | python | def undobutton_action(self):
""" when undo is clicked, revert the thematic map to the previous state"""
if len(self.history) > 1:
old = self.history.pop(-1)
self.selection_array = old
self.mask.set_data(old)
self.fig.canvas.draw_idle() | [
"def",
"undobutton_action",
"(",
"self",
")",
":",
"if",
"len",
"(",
"self",
".",
"history",
")",
">",
"1",
":",
"old",
"=",
"self",
".",
"history",
".",
"pop",
"(",
"-",
"1",
")",
"self",
".",
"selection_array",
"=",
"old",
"self",
".",
"mask",
... | when undo is clicked, revert the thematic map to the previous state | [
"when",
"undo",
"is",
"clicked",
"revert",
"the",
"thematic",
"map",
"to",
"the",
"previous",
"state"
] | 3d89894a4a037286221974c7eb5634d229b4f5d4 | https://github.com/jmbhughes/suvi-trainer/blob/3d89894a4a037286221974c7eb5634d229b4f5d4/suvitrainer/gui.py#L650-L656 |
37,472 | jmbhughes/suvi-trainer | suvitrainer/gui.py | App.change_class | def change_class(self):
""" "on changing the classification label, update the "draw" text """
self.toolbarcenterframe.config(text="Draw: {}".format(self.config.solar_class_name[self.solar_class_var.get()])) | python | def change_class(self):
""" "on changing the classification label, update the "draw" text """
self.toolbarcenterframe.config(text="Draw: {}".format(self.config.solar_class_name[self.solar_class_var.get()])) | [
"def",
"change_class",
"(",
"self",
")",
":",
"self",
".",
"toolbarcenterframe",
".",
"config",
"(",
"text",
"=",
"\"Draw: {}\"",
".",
"format",
"(",
"self",
".",
"config",
".",
"solar_class_name",
"[",
"self",
".",
"solar_class_var",
".",
"get",
"(",
")",... | "on changing the classification label, update the "draw" text | [
"on",
"changing",
"the",
"classification",
"label",
"update",
"the",
"draw",
"text"
] | 3d89894a4a037286221974c7eb5634d229b4f5d4 | https://github.com/jmbhughes/suvi-trainer/blob/3d89894a4a037286221974c7eb5634d229b4f5d4/suvitrainer/gui.py#L658-L660 |
37,473 | portfors-lab/sparkle | sparkle/gui/dialogs/specgram_dlg.py | SpecDialog.values | def values(self):
"""Gets the parameter values
:returns: dict of inputs:
| *'nfft'*: int -- length, in samples, of FFT chunks
| *'window'*: str -- name of window to apply to FFT chunks
| *'overlap'*: float -- percent overlap of windows
"""
s... | python | def values(self):
"""Gets the parameter values
:returns: dict of inputs:
| *'nfft'*: int -- length, in samples, of FFT chunks
| *'window'*: str -- name of window to apply to FFT chunks
| *'overlap'*: float -- percent overlap of windows
"""
s... | [
"def",
"values",
"(",
"self",
")",
":",
"self",
".",
"vals",
"[",
"'nfft'",
"]",
"=",
"self",
".",
"ui",
".",
"nfftSpnbx",
".",
"value",
"(",
")",
"self",
".",
"vals",
"[",
"'window'",
"]",
"=",
"str",
"(",
"self",
".",
"ui",
".",
"windowCmbx",
... | Gets the parameter values
:returns: dict of inputs:
| *'nfft'*: int -- length, in samples, of FFT chunks
| *'window'*: str -- name of window to apply to FFT chunks
| *'overlap'*: float -- percent overlap of windows | [
"Gets",
"the",
"parameter",
"values"
] | 5fad1cf2bec58ec6b15d91da20f6236a74826110 | https://github.com/portfors-lab/sparkle/blob/5fad1cf2bec58ec6b15d91da20f6236a74826110/sparkle/gui/dialogs/specgram_dlg.py#L23-L34 |
37,474 | TorkamaniLab/metapipe | metapipe/app.py | main | def main():
""" Parses the command-line args, and calls run. """
parser = argparse.ArgumentParser(
description='A pipeline that generates analysis pipelines.')
parser.add_argument('input', nargs='?',
help='A valid metapipe configuration file.')
parser.add_argument('-o', '--out... | python | def main():
""" Parses the command-line args, and calls run. """
parser = argparse.ArgumentParser(
description='A pipeline that generates analysis pipelines.')
parser.add_argument('input', nargs='?',
help='A valid metapipe configuration file.')
parser.add_argument('-o', '--out... | [
"def",
"main",
"(",
")",
":",
"parser",
"=",
"argparse",
".",
"ArgumentParser",
"(",
"description",
"=",
"'A pipeline that generates analysis pipelines.'",
")",
"parser",
".",
"add_argument",
"(",
"'input'",
",",
"nargs",
"=",
"'?'",
",",
"help",
"=",
"'A valid ... | Parses the command-line args, and calls run. | [
"Parses",
"the",
"command",
"-",
"line",
"args",
"and",
"calls",
"run",
"."
] | 15592e5b0c217afb00ac03503f8d0d7453d4baf4 | https://github.com/TorkamaniLab/metapipe/blob/15592e5b0c217afb00ac03503f8d0d7453d4baf4/metapipe/app.py#L39-L94 |
37,475 | TorkamaniLab/metapipe | metapipe/app.py | run | def run(config, max_jobs, output=sys.stdout, job_type='local',
report_type='text', shell='/bin/bash', temp='.metapipe', run_now=False):
""" Create the metapipe based on the provided input. """
if max_jobs == None:
max_jobs = cpu_count()
parser = Parser(config)
try:
command_templ... | python | def run(config, max_jobs, output=sys.stdout, job_type='local',
report_type='text', shell='/bin/bash', temp='.metapipe', run_now=False):
""" Create the metapipe based on the provided input. """
if max_jobs == None:
max_jobs = cpu_count()
parser = Parser(config)
try:
command_templ... | [
"def",
"run",
"(",
"config",
",",
"max_jobs",
",",
"output",
"=",
"sys",
".",
"stdout",
",",
"job_type",
"=",
"'local'",
",",
"report_type",
"=",
"'text'",
",",
"shell",
"=",
"'/bin/bash'",
",",
"temp",
"=",
"'.metapipe'",
",",
"run_now",
"=",
"False",
... | Create the metapipe based on the provided input. | [
"Create",
"the",
"metapipe",
"based",
"on",
"the",
"provided",
"input",
"."
] | 15592e5b0c217afb00ac03503f8d0d7453d4baf4 | https://github.com/TorkamaniLab/metapipe/blob/15592e5b0c217afb00ac03503f8d0d7453d4baf4/metapipe/app.py#L97-L131 |
37,476 | TorkamaniLab/metapipe | metapipe/app.py | make_submit_job | def make_submit_job(shell, output, job_type):
""" Preps the metapipe main job to be submitted. """
run_cmd = [shell, output]
submit_command = Command(alias=PIPELINE_ALIAS, cmds=run_cmd)
submit_job = get_job(submit_command, job_type)
submit_job.make()
return submit_job | python | def make_submit_job(shell, output, job_type):
""" Preps the metapipe main job to be submitted. """
run_cmd = [shell, output]
submit_command = Command(alias=PIPELINE_ALIAS, cmds=run_cmd)
submit_job = get_job(submit_command, job_type)
submit_job.make()
return submit_job | [
"def",
"make_submit_job",
"(",
"shell",
",",
"output",
",",
"job_type",
")",
":",
"run_cmd",
"=",
"[",
"shell",
",",
"output",
"]",
"submit_command",
"=",
"Command",
"(",
"alias",
"=",
"PIPELINE_ALIAS",
",",
"cmds",
"=",
"run_cmd",
")",
"submit_job",
"=",
... | Preps the metapipe main job to be submitted. | [
"Preps",
"the",
"metapipe",
"main",
"job",
"to",
"be",
"submitted",
"."
] | 15592e5b0c217afb00ac03503f8d0d7453d4baf4 | https://github.com/TorkamaniLab/metapipe/blob/15592e5b0c217afb00ac03503f8d0d7453d4baf4/metapipe/app.py#L134-L140 |
37,477 | raymondEhlers/pachyderm | pachyderm/yaml.py | yaml | def yaml(modules_to_register: Iterable[Any] = None, classes_to_register: Iterable[Any] = None) -> ruamel.yaml.YAML:
""" Create a YAML object for loading a YAML configuration.
Args:
modules_to_register: Modules containing classes to be registered with the YAML object. Default: None.
classes_to_r... | python | def yaml(modules_to_register: Iterable[Any] = None, classes_to_register: Iterable[Any] = None) -> ruamel.yaml.YAML:
""" Create a YAML object for loading a YAML configuration.
Args:
modules_to_register: Modules containing classes to be registered with the YAML object. Default: None.
classes_to_r... | [
"def",
"yaml",
"(",
"modules_to_register",
":",
"Iterable",
"[",
"Any",
"]",
"=",
"None",
",",
"classes_to_register",
":",
"Iterable",
"[",
"Any",
"]",
"=",
"None",
")",
"->",
"ruamel",
".",
"yaml",
".",
"YAML",
":",
"# Defein a round-trip yaml object for us t... | Create a YAML object for loading a YAML configuration.
Args:
modules_to_register: Modules containing classes to be registered with the YAML object. Default: None.
classes_to_register: Classes to be registered with the YAML object. Default: None.
Returns:
A newly creating YAML object, co... | [
"Create",
"a",
"YAML",
"object",
"for",
"loading",
"a",
"YAML",
"configuration",
"."
] | aaa1d8374fd871246290ce76f1796f2f7582b01d | https://github.com/raymondEhlers/pachyderm/blob/aaa1d8374fd871246290ce76f1796f2f7582b01d/pachyderm/yaml.py#L53-L74 |
37,478 | raymondEhlers/pachyderm | pachyderm/yaml.py | register_classes | def register_classes(yaml: ruamel.yaml.YAML, classes: Optional[Iterable[Any]] = None) -> ruamel.yaml.YAML:
""" Register externally defined classes. """
# Validation
if classes is None:
classes = []
# Register the classes
for cls in classes:
logger.debug(f"Registering class {cls} wit... | python | def register_classes(yaml: ruamel.yaml.YAML, classes: Optional[Iterable[Any]] = None) -> ruamel.yaml.YAML:
""" Register externally defined classes. """
# Validation
if classes is None:
classes = []
# Register the classes
for cls in classes:
logger.debug(f"Registering class {cls} wit... | [
"def",
"register_classes",
"(",
"yaml",
":",
"ruamel",
".",
"yaml",
".",
"YAML",
",",
"classes",
":",
"Optional",
"[",
"Iterable",
"[",
"Any",
"]",
"]",
"=",
"None",
")",
"->",
"ruamel",
".",
"yaml",
".",
"YAML",
":",
"# Validation",
"if",
"classes",
... | Register externally defined classes. | [
"Register",
"externally",
"defined",
"classes",
"."
] | aaa1d8374fd871246290ce76f1796f2f7582b01d | https://github.com/raymondEhlers/pachyderm/blob/aaa1d8374fd871246290ce76f1796f2f7582b01d/pachyderm/yaml.py#L76-L87 |
37,479 | raymondEhlers/pachyderm | pachyderm/yaml.py | register_module_classes | def register_module_classes(yaml: ruamel.yaml.YAML, modules: Optional[Iterable[Any]] = None) -> ruamel.yaml.YAML:
""" Register all classes in the given modules with the YAML object.
This is a simple helper function.
"""
# Validation
if modules is None:
modules = []
# Extract the classe... | python | def register_module_classes(yaml: ruamel.yaml.YAML, modules: Optional[Iterable[Any]] = None) -> ruamel.yaml.YAML:
""" Register all classes in the given modules with the YAML object.
This is a simple helper function.
"""
# Validation
if modules is None:
modules = []
# Extract the classe... | [
"def",
"register_module_classes",
"(",
"yaml",
":",
"ruamel",
".",
"yaml",
".",
"YAML",
",",
"modules",
":",
"Optional",
"[",
"Iterable",
"[",
"Any",
"]",
"]",
"=",
"None",
")",
"->",
"ruamel",
".",
"yaml",
".",
"YAML",
":",
"# Validation",
"if",
"modu... | Register all classes in the given modules with the YAML object.
This is a simple helper function. | [
"Register",
"all",
"classes",
"in",
"the",
"given",
"modules",
"with",
"the",
"YAML",
"object",
"."
] | aaa1d8374fd871246290ce76f1796f2f7582b01d | https://github.com/raymondEhlers/pachyderm/blob/aaa1d8374fd871246290ce76f1796f2f7582b01d/pachyderm/yaml.py#L89-L105 |
37,480 | raymondEhlers/pachyderm | pachyderm/yaml.py | numpy_to_yaml | def numpy_to_yaml(representer: Representer, data: np.ndarray) -> Sequence[Any]:
""" Write a numpy array to YAML.
It registers the array under the tag ``!numpy_array``.
Use with:
.. code-block:: python
>>> yaml = ruamel.yaml.YAML()
>>> yaml.representer.add_representer(np.ndarray, yaml... | python | def numpy_to_yaml(representer: Representer, data: np.ndarray) -> Sequence[Any]:
""" Write a numpy array to YAML.
It registers the array under the tag ``!numpy_array``.
Use with:
.. code-block:: python
>>> yaml = ruamel.yaml.YAML()
>>> yaml.representer.add_representer(np.ndarray, yaml... | [
"def",
"numpy_to_yaml",
"(",
"representer",
":",
"Representer",
",",
"data",
":",
"np",
".",
"ndarray",
")",
"->",
"Sequence",
"[",
"Any",
"]",
":",
"return",
"representer",
".",
"represent_sequence",
"(",
"\"!numpy_array\"",
",",
"data",
".",
"tolist",
"(",... | Write a numpy array to YAML.
It registers the array under the tag ``!numpy_array``.
Use with:
.. code-block:: python
>>> yaml = ruamel.yaml.YAML()
>>> yaml.representer.add_representer(np.ndarray, yaml.numpy_to_yaml)
Note:
We cannot use ``yaml.register_class`` because it won'... | [
"Write",
"a",
"numpy",
"array",
"to",
"YAML",
"."
] | aaa1d8374fd871246290ce76f1796f2f7582b01d | https://github.com/raymondEhlers/pachyderm/blob/aaa1d8374fd871246290ce76f1796f2f7582b01d/pachyderm/yaml.py#L111-L131 |
37,481 | raymondEhlers/pachyderm | pachyderm/yaml.py | numpy_from_yaml | def numpy_from_yaml(constructor: Constructor, data: ruamel.yaml.nodes.SequenceNode) -> np.ndarray:
""" Read an array from YAML to numpy.
It reads arrays registered under the tag ``!numpy_array``.
Use with:
.. code-block:: python
>>> yaml = ruamel.yaml.YAML()
>>> yaml.constructor.add_... | python | def numpy_from_yaml(constructor: Constructor, data: ruamel.yaml.nodes.SequenceNode) -> np.ndarray:
""" Read an array from YAML to numpy.
It reads arrays registered under the tag ``!numpy_array``.
Use with:
.. code-block:: python
>>> yaml = ruamel.yaml.YAML()
>>> yaml.constructor.add_... | [
"def",
"numpy_from_yaml",
"(",
"constructor",
":",
"Constructor",
",",
"data",
":",
"ruamel",
".",
"yaml",
".",
"nodes",
".",
"SequenceNode",
")",
"->",
"np",
".",
"ndarray",
":",
"# Construct the contained values so that we properly construct int, float, etc.",
"# We j... | Read an array from YAML to numpy.
It reads arrays registered under the tag ``!numpy_array``.
Use with:
.. code-block:: python
>>> yaml = ruamel.yaml.YAML()
>>> yaml.constructor.add_constructor("!numpy_array", yaml.numpy_from_yaml)
Note:
We cannot use ``yaml.register_class`` ... | [
"Read",
"an",
"array",
"from",
"YAML",
"to",
"numpy",
"."
] | aaa1d8374fd871246290ce76f1796f2f7582b01d | https://github.com/raymondEhlers/pachyderm/blob/aaa1d8374fd871246290ce76f1796f2f7582b01d/pachyderm/yaml.py#L133-L154 |
37,482 | raymondEhlers/pachyderm | pachyderm/yaml.py | enum_to_yaml | def enum_to_yaml(cls: Type[T_EnumToYAML], representer: Representer, data: T_EnumToYAML) -> ruamel.yaml.nodes.ScalarNode:
""" Encodes YAML representation.
This is a mixin method for writing enum values to YAML. It needs to be added to the enum
as a classmethod. See the module docstring for further informati... | python | def enum_to_yaml(cls: Type[T_EnumToYAML], representer: Representer, data: T_EnumToYAML) -> ruamel.yaml.nodes.ScalarNode:
""" Encodes YAML representation.
This is a mixin method for writing enum values to YAML. It needs to be added to the enum
as a classmethod. See the module docstring for further informati... | [
"def",
"enum_to_yaml",
"(",
"cls",
":",
"Type",
"[",
"T_EnumToYAML",
"]",
",",
"representer",
":",
"Representer",
",",
"data",
":",
"T_EnumToYAML",
")",
"->",
"ruamel",
".",
"yaml",
".",
"nodes",
".",
"ScalarNode",
":",
"return",
"representer",
".",
"repre... | Encodes YAML representation.
This is a mixin method for writing enum values to YAML. It needs to be added to the enum
as a classmethod. See the module docstring for further information on this approach and how
to implement it.
This method writes whatever is used in the string representation of the YAM... | [
"Encodes",
"YAML",
"representation",
"."
] | aaa1d8374fd871246290ce76f1796f2f7582b01d | https://github.com/raymondEhlers/pachyderm/blob/aaa1d8374fd871246290ce76f1796f2f7582b01d/pachyderm/yaml.py#L156-L181 |
37,483 | raymondEhlers/pachyderm | pachyderm/yaml.py | enum_from_yaml | def enum_from_yaml(cls: Type[T_EnumFromYAML], constructor: Constructor, node: ruamel.yaml.nodes.ScalarNode) -> T_EnumFromYAML:
""" Decode YAML representation.
This is a mixin method for reading enum values from YAML. It needs to be added to the enum
as a classmethod. See the module docstring for further in... | python | def enum_from_yaml(cls: Type[T_EnumFromYAML], constructor: Constructor, node: ruamel.yaml.nodes.ScalarNode) -> T_EnumFromYAML:
""" Decode YAML representation.
This is a mixin method for reading enum values from YAML. It needs to be added to the enum
as a classmethod. See the module docstring for further in... | [
"def",
"enum_from_yaml",
"(",
"cls",
":",
"Type",
"[",
"T_EnumFromYAML",
"]",
",",
"constructor",
":",
"Constructor",
",",
"node",
":",
"ruamel",
".",
"yaml",
".",
"nodes",
".",
"ScalarNode",
")",
"->",
"T_EnumFromYAML",
":",
"# mypy doesn't like indexing to con... | Decode YAML representation.
This is a mixin method for reading enum values from YAML. It needs to be added to the enum
as a classmethod. See the module docstring for further information on this approach and how
to implement it.
Note:
This method assumes that the name of the enumeration value w... | [
"Decode",
"YAML",
"representation",
"."
] | aaa1d8374fd871246290ce76f1796f2f7582b01d | https://github.com/raymondEhlers/pachyderm/blob/aaa1d8374fd871246290ce76f1796f2f7582b01d/pachyderm/yaml.py#L183-L200 |
37,484 | computational-metabolomics/msp2db | msp2db/parse.py | LibraryData._get_current_ids | def _get_current_ids(self, source=True, meta=True, spectra=True, spectra_annotation=True):
"""Get the current id for each table in the database
Args:
source (boolean): get the id for the table "library_spectra_source" will update self.current_id_origin
meta (boolean): get the id... | python | def _get_current_ids(self, source=True, meta=True, spectra=True, spectra_annotation=True):
"""Get the current id for each table in the database
Args:
source (boolean): get the id for the table "library_spectra_source" will update self.current_id_origin
meta (boolean): get the id... | [
"def",
"_get_current_ids",
"(",
"self",
",",
"source",
"=",
"True",
",",
"meta",
"=",
"True",
",",
"spectra",
"=",
"True",
",",
"spectra_annotation",
"=",
"True",
")",
":",
"# get the cursor for the database connection",
"c",
"=",
"self",
".",
"c",
"# Get the ... | Get the current id for each table in the database
Args:
source (boolean): get the id for the table "library_spectra_source" will update self.current_id_origin
meta (boolean): get the id for the table "library_spectra_meta" will update self.current_id_meta
spectra (boolean): ... | [
"Get",
"the",
"current",
"id",
"for",
"each",
"table",
"in",
"the",
"database"
] | f86f01efca26fd2745547c9993f97337c6bef123 | https://github.com/computational-metabolomics/msp2db/blob/f86f01efca26fd2745547c9993f97337c6bef123/msp2db/parse.py#L116-L163 |
37,485 | computational-metabolomics/msp2db | msp2db/parse.py | LibraryData._update_libdata | def _update_libdata(self, line):
"""Update the library meta data from the current line being parsed
Args:
line (str): The current line of the of the file being parsed
"""
####################################################
# parse MONA Comments line
########... | python | def _update_libdata(self, line):
"""Update the library meta data from the current line being parsed
Args:
line (str): The current line of the of the file being parsed
"""
####################################################
# parse MONA Comments line
########... | [
"def",
"_update_libdata",
"(",
"self",
",",
"line",
")",
":",
"####################################################",
"# parse MONA Comments line",
"####################################################",
"# The mona msp files contain a \"comments\" line that contains lots of other information ... | Update the library meta data from the current line being parsed
Args:
line (str): The current line of the of the file being parsed | [
"Update",
"the",
"library",
"meta",
"data",
"from",
"the",
"current",
"line",
"being",
"parsed"
] | f86f01efca26fd2745547c9993f97337c6bef123 | https://github.com/computational-metabolomics/msp2db/blob/f86f01efca26fd2745547c9993f97337c6bef123/msp2db/parse.py#L236-L309 |
37,486 | computational-metabolomics/msp2db | msp2db/parse.py | LibraryData._store_compound_info | def _store_compound_info(self):
"""Update the compound_info dictionary with the current chunk of compound details
Note that we use the inchikey as unique identifier. If we can't find an appropiate inchikey we just use
a random string (uuid4) suffixed with UNKNOWN
"""
other_name_... | python | def _store_compound_info(self):
"""Update the compound_info dictionary with the current chunk of compound details
Note that we use the inchikey as unique identifier. If we can't find an appropiate inchikey we just use
a random string (uuid4) suffixed with UNKNOWN
"""
other_name_... | [
"def",
"_store_compound_info",
"(",
"self",
")",
":",
"other_name_l",
"=",
"[",
"name",
"for",
"name",
"in",
"self",
".",
"other_names",
"if",
"name",
"!=",
"self",
".",
"compound_info",
"[",
"'name'",
"]",
"]",
"self",
".",
"compound_info",
"[",
"'other_n... | Update the compound_info dictionary with the current chunk of compound details
Note that we use the inchikey as unique identifier. If we can't find an appropiate inchikey we just use
a random string (uuid4) suffixed with UNKNOWN | [
"Update",
"the",
"compound_info",
"dictionary",
"with",
"the",
"current",
"chunk",
"of",
"compound",
"details"
] | f86f01efca26fd2745547c9993f97337c6bef123 | https://github.com/computational-metabolomics/msp2db/blob/f86f01efca26fd2745547c9993f97337c6bef123/msp2db/parse.py#L321-L356 |
37,487 | computational-metabolomics/msp2db | msp2db/parse.py | LibraryData._store_meta_info | def _store_meta_info(self):
"""Update the meta dictionary with the current chunk of meta data details
"""
# In the mass bank msp files, sometimes the precursor_mz is missing but we have the neutral mass and
# the precursor_type (e.g. adduct) so we can calculate the precursor_mz
i... | python | def _store_meta_info(self):
"""Update the meta dictionary with the current chunk of meta data details
"""
# In the mass bank msp files, sometimes the precursor_mz is missing but we have the neutral mass and
# the precursor_type (e.g. adduct) so we can calculate the precursor_mz
i... | [
"def",
"_store_meta_info",
"(",
"self",
")",
":",
"# In the mass bank msp files, sometimes the precursor_mz is missing but we have the neutral mass and",
"# the precursor_type (e.g. adduct) so we can calculate the precursor_mz",
"if",
"not",
"self",
".",
"meta_info",
"[",
"'precursor_mz'... | Update the meta dictionary with the current chunk of meta data details | [
"Update",
"the",
"meta",
"dictionary",
"with",
"the",
"current",
"chunk",
"of",
"meta",
"data",
"details"
] | f86f01efca26fd2745547c9993f97337c6bef123 | https://github.com/computational-metabolomics/msp2db/blob/f86f01efca26fd2745547c9993f97337c6bef123/msp2db/parse.py#L358-L385 |
37,488 | computational-metabolomics/msp2db | msp2db/parse.py | LibraryData._parse_spectra_annotation | def _parse_spectra_annotation(self, line):
"""Parse and store the spectral annotation details
"""
if re.match('^PK\$NUM_PEAK(.*)', line, re.IGNORECASE):
self.start_spectra_annotation = False
return
saplist = line.split()
sarow = (
self.curren... | python | def _parse_spectra_annotation(self, line):
"""Parse and store the spectral annotation details
"""
if re.match('^PK\$NUM_PEAK(.*)', line, re.IGNORECASE):
self.start_spectra_annotation = False
return
saplist = line.split()
sarow = (
self.curren... | [
"def",
"_parse_spectra_annotation",
"(",
"self",
",",
"line",
")",
":",
"if",
"re",
".",
"match",
"(",
"'^PK\\$NUM_PEAK(.*)'",
",",
"line",
",",
"re",
".",
"IGNORECASE",
")",
":",
"self",
".",
"start_spectra_annotation",
"=",
"False",
"return",
"saplist",
"=... | Parse and store the spectral annotation details | [
"Parse",
"and",
"store",
"the",
"spectral",
"annotation",
"details"
] | f86f01efca26fd2745547c9993f97337c6bef123 | https://github.com/computational-metabolomics/msp2db/blob/f86f01efca26fd2745547c9993f97337c6bef123/msp2db/parse.py#L387-L407 |
37,489 | computational-metabolomics/msp2db | msp2db/parse.py | LibraryData._parse_spectra | def _parse_spectra(self, line):
"""Parse and store the spectral details
"""
if line in ['\n', '\r\n', '//\n', '//\r\n', '', '//']:
self.start_spectra = False
self.current_id_meta += 1
self.collect_meta = True
return
splist = line.split()
... | python | def _parse_spectra(self, line):
"""Parse and store the spectral details
"""
if line in ['\n', '\r\n', '//\n', '//\r\n', '', '//']:
self.start_spectra = False
self.current_id_meta += 1
self.collect_meta = True
return
splist = line.split()
... | [
"def",
"_parse_spectra",
"(",
"self",
",",
"line",
")",
":",
"if",
"line",
"in",
"[",
"'\\n'",
",",
"'\\r\\n'",
",",
"'//\\n'",
",",
"'//\\r\\n'",
",",
"''",
",",
"'//'",
"]",
":",
"self",
".",
"start_spectra",
"=",
"False",
"self",
".",
"current_id_me... | Parse and store the spectral details | [
"Parse",
"and",
"store",
"the",
"spectral",
"details"
] | f86f01efca26fd2745547c9993f97337c6bef123 | https://github.com/computational-metabolomics/msp2db/blob/f86f01efca26fd2745547c9993f97337c6bef123/msp2db/parse.py#L409-L431 |
37,490 | computational-metabolomics/msp2db | msp2db/parse.py | LibraryData._set_inchi_pcc | def _set_inchi_pcc(self, in_str, pcp_type, elem):
"""Check pubchem compounds via API for both an inchikey and any available compound details
"""
if not in_str:
return 0
try:
pccs = pcp.get_compounds(in_str, pcp_type)
except pcp.BadRequestError as e:
... | python | def _set_inchi_pcc(self, in_str, pcp_type, elem):
"""Check pubchem compounds via API for both an inchikey and any available compound details
"""
if not in_str:
return 0
try:
pccs = pcp.get_compounds(in_str, pcp_type)
except pcp.BadRequestError as e:
... | [
"def",
"_set_inchi_pcc",
"(",
"self",
",",
"in_str",
",",
"pcp_type",
",",
"elem",
")",
":",
"if",
"not",
"in_str",
":",
"return",
"0",
"try",
":",
"pccs",
"=",
"pcp",
".",
"get_compounds",
"(",
"in_str",
",",
"pcp_type",
")",
"except",
"pcp",
".",
"... | Check pubchem compounds via API for both an inchikey and any available compound details | [
"Check",
"pubchem",
"compounds",
"via",
"API",
"for",
"both",
"an",
"inchikey",
"and",
"any",
"available",
"compound",
"details"
] | f86f01efca26fd2745547c9993f97337c6bef123 | https://github.com/computational-metabolomics/msp2db/blob/f86f01efca26fd2745547c9993f97337c6bef123/msp2db/parse.py#L433-L467 |
37,491 | computational-metabolomics/msp2db | msp2db/parse.py | LibraryData._get_other_names | def _get_other_names(self, line):
"""Parse and extract any other names that might be recorded for the compound
Args:
line (str): line of the msp file
"""
m = re.search(self.compound_regex['other_names'][0], line, re.IGNORECASE)
if m:
self.other_names.app... | python | def _get_other_names(self, line):
"""Parse and extract any other names that might be recorded for the compound
Args:
line (str): line of the msp file
"""
m = re.search(self.compound_regex['other_names'][0], line, re.IGNORECASE)
if m:
self.other_names.app... | [
"def",
"_get_other_names",
"(",
"self",
",",
"line",
")",
":",
"m",
"=",
"re",
".",
"search",
"(",
"self",
".",
"compound_regex",
"[",
"'other_names'",
"]",
"[",
"0",
"]",
",",
"line",
",",
"re",
".",
"IGNORECASE",
")",
"if",
"m",
":",
"self",
".",... | Parse and extract any other names that might be recorded for the compound
Args:
line (str): line of the msp file | [
"Parse",
"and",
"extract",
"any",
"other",
"names",
"that",
"might",
"be",
"recorded",
"for",
"the",
"compound"
] | f86f01efca26fd2745547c9993f97337c6bef123 | https://github.com/computational-metabolomics/msp2db/blob/f86f01efca26fd2745547c9993f97337c6bef123/msp2db/parse.py#L469-L477 |
37,492 | computational-metabolomics/msp2db | msp2db/parse.py | LibraryData._parse_meta_info | def _parse_meta_info(self, line):
"""Parse and extract all meta data by looping through the dictionary of meta_info regexs
updates self.meta_info
Args:
line (str): line of the msp file
"""
if self.mslevel:
self.meta_info['ms_level'] = self.mslevel
... | python | def _parse_meta_info(self, line):
"""Parse and extract all meta data by looping through the dictionary of meta_info regexs
updates self.meta_info
Args:
line (str): line of the msp file
"""
if self.mslevel:
self.meta_info['ms_level'] = self.mslevel
... | [
"def",
"_parse_meta_info",
"(",
"self",
",",
"line",
")",
":",
"if",
"self",
".",
"mslevel",
":",
"self",
".",
"meta_info",
"[",
"'ms_level'",
"]",
"=",
"self",
".",
"mslevel",
"if",
"self",
".",
"polarity",
":",
"self",
".",
"meta_info",
"[",
"'polari... | Parse and extract all meta data by looping through the dictionary of meta_info regexs
updates self.meta_info
Args:
line (str): line of the msp file | [
"Parse",
"and",
"extract",
"all",
"meta",
"data",
"by",
"looping",
"through",
"the",
"dictionary",
"of",
"meta_info",
"regexs"
] | f86f01efca26fd2745547c9993f97337c6bef123 | https://github.com/computational-metabolomics/msp2db/blob/f86f01efca26fd2745547c9993f97337c6bef123/msp2db/parse.py#L479-L499 |
37,493 | computational-metabolomics/msp2db | msp2db/parse.py | LibraryData._parse_compound_info | def _parse_compound_info(self, line):
"""Parse and extract all compound data by looping through the dictionary of compound_info regexs
updates self.compound_info
Args:
line (str): line of the msp file
"""
for k, regexes in six.iteritems(self.compound_regex):
... | python | def _parse_compound_info(self, line):
"""Parse and extract all compound data by looping through the dictionary of compound_info regexs
updates self.compound_info
Args:
line (str): line of the msp file
"""
for k, regexes in six.iteritems(self.compound_regex):
... | [
"def",
"_parse_compound_info",
"(",
"self",
",",
"line",
")",
":",
"for",
"k",
",",
"regexes",
"in",
"six",
".",
"iteritems",
"(",
"self",
".",
"compound_regex",
")",
":",
"for",
"reg",
"in",
"regexes",
":",
"if",
"self",
".",
"compound_info",
"[",
"k"... | Parse and extract all compound data by looping through the dictionary of compound_info regexs
updates self.compound_info
Args:
line (str): line of the msp file | [
"Parse",
"and",
"extract",
"all",
"compound",
"data",
"by",
"looping",
"through",
"the",
"dictionary",
"of",
"compound_info",
"regexs"
] | f86f01efca26fd2745547c9993f97337c6bef123 | https://github.com/computational-metabolomics/msp2db/blob/f86f01efca26fd2745547c9993f97337c6bef123/msp2db/parse.py#L501-L518 |
37,494 | computational-metabolomics/msp2db | msp2db/parse.py | LibraryData.insert_data | def insert_data(self, remove_data=False, db_type='sqlite'):
"""Insert data stored in the current chunk of parsing into the selected database
Args:
remove_data (boolean): Remove the data stored within the LibraryData object for the current chunk of
proce... | python | def insert_data(self, remove_data=False, db_type='sqlite'):
"""Insert data stored in the current chunk of parsing into the selected database
Args:
remove_data (boolean): Remove the data stored within the LibraryData object for the current chunk of
proce... | [
"def",
"insert_data",
"(",
"self",
",",
"remove_data",
"=",
"False",
",",
"db_type",
"=",
"'sqlite'",
")",
":",
"if",
"self",
".",
"update_source",
":",
"# print \"insert ref id\"",
"import",
"msp2db",
"self",
".",
"c",
".",
"execute",
"(",
"\"INSERT INTO libr... | Insert data stored in the current chunk of parsing into the selected database
Args:
remove_data (boolean): Remove the data stored within the LibraryData object for the current chunk of
processing
db_type (str): The type of database to submit to
... | [
"Insert",
"data",
"stored",
"in",
"the",
"current",
"chunk",
"of",
"parsing",
"into",
"the",
"selected",
"database"
] | f86f01efca26fd2745547c9993f97337c6bef123 | https://github.com/computational-metabolomics/msp2db/blob/f86f01efca26fd2745547c9993f97337c6bef123/msp2db/parse.py#L520-L568 |
37,495 | 0k/kids.cmd | src/kids/cmd/menu.py | line | def line(line_def, **kwargs):
"""Highlights a character in the line"""
def replace(s):
return "(%s)" % ansi.aformat(s.group()[1:], attrs=["bold", ])
return ansi.aformat(
re.sub('@.?', replace, line_def),
**kwargs) | python | def line(line_def, **kwargs):
"""Highlights a character in the line"""
def replace(s):
return "(%s)" % ansi.aformat(s.group()[1:], attrs=["bold", ])
return ansi.aformat(
re.sub('@.?', replace, line_def),
**kwargs) | [
"def",
"line",
"(",
"line_def",
",",
"*",
"*",
"kwargs",
")",
":",
"def",
"replace",
"(",
"s",
")",
":",
"return",
"\"(%s)\"",
"%",
"ansi",
".",
"aformat",
"(",
"s",
".",
"group",
"(",
")",
"[",
"1",
":",
"]",
",",
"attrs",
"=",
"[",
"\"bold\""... | Highlights a character in the line | [
"Highlights",
"a",
"character",
"in",
"the",
"line"
] | bbe958556bc72e6579d4007a28064e2f62109bcf | https://github.com/0k/kids.cmd/blob/bbe958556bc72e6579d4007a28064e2f62109bcf/src/kids/cmd/menu.py#L8-L14 |
37,496 | Chilipp/psy-simple | psy_simple/plugin.py | try_and_error | def try_and_error(*funcs):
"""Apply multiple validation functions
Parameters
----------
``*funcs``
Validation functions to test
Returns
-------
function"""
def validate(value):
exc = None
for func in funcs:
try:
return func(value)
... | python | def try_and_error(*funcs):
"""Apply multiple validation functions
Parameters
----------
``*funcs``
Validation functions to test
Returns
-------
function"""
def validate(value):
exc = None
for func in funcs:
try:
return func(value)
... | [
"def",
"try_and_error",
"(",
"*",
"funcs",
")",
":",
"def",
"validate",
"(",
"value",
")",
":",
"exc",
"=",
"None",
"for",
"func",
"in",
"funcs",
":",
"try",
":",
"return",
"func",
"(",
"value",
")",
"except",
"(",
"ValueError",
",",
"TypeError",
")"... | Apply multiple validation functions
Parameters
----------
``*funcs``
Validation functions to test
Returns
-------
function | [
"Apply",
"multiple",
"validation",
"functions"
] | 7d916406a6d3c3c27c0b7102f98fef07a4da0a61 | https://github.com/Chilipp/psy-simple/blob/7d916406a6d3c3c27c0b7102f98fef07a4da0a61/psy_simple/plugin.py#L55-L74 |
37,497 | Chilipp/psy-simple | psy_simple/plugin.py | validate_text | def validate_text(value):
"""Validate a text formatoption
Parameters
----------
value: see :attr:`psyplot.plotter.labelplotter.text`
Raises
------
ValueError"""
possible_transform = ['axes', 'fig', 'data']
validate_transform = ValidateInStrings('transform', possible_transform,
... | python | def validate_text(value):
"""Validate a text formatoption
Parameters
----------
value: see :attr:`psyplot.plotter.labelplotter.text`
Raises
------
ValueError"""
possible_transform = ['axes', 'fig', 'data']
validate_transform = ValidateInStrings('transform', possible_transform,
... | [
"def",
"validate_text",
"(",
"value",
")",
":",
"possible_transform",
"=",
"[",
"'axes'",
",",
"'fig'",
",",
"'data'",
"]",
"validate_transform",
"=",
"ValidateInStrings",
"(",
"'transform'",
",",
"possible_transform",
",",
"True",
")",
"tests",
"=",
"[",
"val... | Validate a text formatoption
Parameters
----------
value: see :attr:`psyplot.plotter.labelplotter.text`
Raises
------
ValueError | [
"Validate",
"a",
"text",
"formatoption"
] | 7d916406a6d3c3c27c0b7102f98fef07a4da0a61 | https://github.com/Chilipp/psy-simple/blob/7d916406a6d3c3c27c0b7102f98fef07a4da0a61/psy_simple/plugin.py#L117-L163 |
37,498 | Chilipp/psy-simple | psy_simple/plugin.py | validate_none | def validate_none(b):
"""Validate that None is given
Parameters
----------
b: {None, 'none'}
None or string (the case is ignored)
Returns
-------
None
Raises
------
ValueError"""
if isinstance(b, six.string_types):
b = b.lower()
if b is None or b == 'no... | python | def validate_none(b):
"""Validate that None is given
Parameters
----------
b: {None, 'none'}
None or string (the case is ignored)
Returns
-------
None
Raises
------
ValueError"""
if isinstance(b, six.string_types):
b = b.lower()
if b is None or b == 'no... | [
"def",
"validate_none",
"(",
"b",
")",
":",
"if",
"isinstance",
"(",
"b",
",",
"six",
".",
"string_types",
")",
":",
"b",
"=",
"b",
".",
"lower",
"(",
")",
"if",
"b",
"is",
"None",
"or",
"b",
"==",
"'none'",
":",
"return",
"None",
"else",
":",
... | Validate that None is given
Parameters
----------
b: {None, 'none'}
None or string (the case is ignored)
Returns
-------
None
Raises
------
ValueError | [
"Validate",
"that",
"None",
"is",
"given"
] | 7d916406a6d3c3c27c0b7102f98fef07a4da0a61 | https://github.com/Chilipp/psy-simple/blob/7d916406a6d3c3c27c0b7102f98fef07a4da0a61/psy_simple/plugin.py#L184-L204 |
37,499 | Chilipp/psy-simple | psy_simple/plugin.py | validate_axiscolor | def validate_axiscolor(value):
"""Validate a dictionary containing axiscolor definitions
Parameters
----------
value: dict
see :attr:`psyplot.plotter.baseplotter.axiscolor`
Returns
-------
dict
Raises
------
ValueError"""
validate = try_and_error(validate_none, val... | python | def validate_axiscolor(value):
"""Validate a dictionary containing axiscolor definitions
Parameters
----------
value: dict
see :attr:`psyplot.plotter.baseplotter.axiscolor`
Returns
-------
dict
Raises
------
ValueError"""
validate = try_and_error(validate_none, val... | [
"def",
"validate_axiscolor",
"(",
"value",
")",
":",
"validate",
"=",
"try_and_error",
"(",
"validate_none",
",",
"validate_color",
")",
"possible_keys",
"=",
"{",
"'right'",
",",
"'left'",
",",
"'top'",
",",
"'bottom'",
"}",
"try",
":",
"value",
"=",
"dict"... | Validate a dictionary containing axiscolor definitions
Parameters
----------
value: dict
see :attr:`psyplot.plotter.baseplotter.axiscolor`
Returns
-------
dict
Raises
------
ValueError | [
"Validate",
"a",
"dictionary",
"containing",
"axiscolor",
"definitions"
] | 7d916406a6d3c3c27c0b7102f98fef07a4da0a61 | https://github.com/Chilipp/psy-simple/blob/7d916406a6d3c3c27c0b7102f98fef07a4da0a61/psy_simple/plugin.py#L207-L233 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.