partition stringclasses 3
values | func_name stringlengths 1 134 | docstring stringlengths 1 46.9k | path stringlengths 4 223 | original_string stringlengths 75 104k | code stringlengths 75 104k | docstring_tokens listlengths 1 1.97k | repo stringlengths 7 55 | language stringclasses 1
value | url stringlengths 87 315 | code_tokens listlengths 19 28.4k | sha stringlengths 40 40 |
|---|---|---|---|---|---|---|---|---|---|---|---|
train | AggPathCollection.append | Append a new set of vertices to the collection.
For kwargs argument, n is the number of vertices (local) or the number
of item (shared)
Parameters
----------
P : np.array
Vertices positions of the path(s) to be added
closed: bool
Whether path(s... | glue_vispy_viewers/extern/vispy/visuals/collections/agg_path_collection.py | def append(self, P, closed=False, itemsize=None, **kwargs):
"""
Append a new set of vertices to the collection.
For kwargs argument, n is the number of vertices (local) or the number
of item (shared)
Parameters
----------
P : np.array
Vertices posit... | def append(self, P, closed=False, itemsize=None, **kwargs):
"""
Append a new set of vertices to the collection.
For kwargs argument, n is the number of vertices (local) or the number
of item (shared)
Parameters
----------
P : np.array
Vertices posit... | [
"Append",
"a",
"new",
"set",
"of",
"vertices",
"to",
"the",
"collection",
"."
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/collections/agg_path_collection.py#L101-L196 | [
"def",
"append",
"(",
"self",
",",
"P",
",",
"closed",
"=",
"False",
",",
"itemsize",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"itemsize",
"=",
"itemsize",
"or",
"len",
"(",
"P",
")",
"itemcount",
"=",
"len",
"(",
"P",
")",
"/",
"itemsize"... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | AggPathCollection.draw | Draw collection | glue_vispy_viewers/extern/vispy/visuals/collections/agg_path_collection.py | def draw(self, mode="triangles"):
""" Draw collection """
gl.glDepthMask(0)
Collection.draw(self, mode)
gl.glDepthMask(1) | def draw(self, mode="triangles"):
""" Draw collection """
gl.glDepthMask(0)
Collection.draw(self, mode)
gl.glDepthMask(1) | [
"Draw",
"collection"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/collections/agg_path_collection.py#L198-L203 | [
"def",
"draw",
"(",
"self",
",",
"mode",
"=",
"\"triangles\"",
")",
":",
"gl",
".",
"glDepthMask",
"(",
"0",
")",
"Collection",
".",
"draw",
"(",
"self",
",",
"mode",
")",
"gl",
".",
"glDepthMask",
"(",
"1",
")"
] | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | MarkersVisual.set_data | Set the data used to display this visual.
Parameters
----------
pos : array
The array of locations to display each symbol.
symbol : str
The style of symbol to draw (see Notes).
size : float or array
The symbol size in px.
edge_width : ... | glue_vispy_viewers/extern/vispy/visuals/markers.py | def set_data(self, pos=None, symbol='o', size=10., edge_width=1.,
edge_width_rel=None, edge_color='black', face_color='white',
scaling=False):
""" Set the data used to display this visual.
Parameters
----------
pos : array
The array of locat... | def set_data(self, pos=None, symbol='o', size=10., edge_width=1.,
edge_width_rel=None, edge_color='black', face_color='white',
scaling=False):
""" Set the data used to display this visual.
Parameters
----------
pos : array
The array of locat... | [
"Set",
"the",
"data",
"used",
"to",
"display",
"this",
"visual",
"."
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/markers.py#L502-L573 | [
"def",
"set_data",
"(",
"self",
",",
"pos",
"=",
"None",
",",
"symbol",
"=",
"'o'",
",",
"size",
"=",
"10.",
",",
"edge_width",
"=",
"1.",
",",
"edge_width_rel",
"=",
"None",
",",
"edge_color",
"=",
"'black'",
",",
"face_color",
"=",
"'white'",
",",
... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | Field.hook_changed | Handle a hook upate. | mpdlcd/display_fields.py | def hook_changed(self, hook_name, widget, new_data):
"""Handle a hook upate."""
if hook_name == 'song':
self.song_changed(widget, new_data)
elif hook_name == 'state':
self.state_changed(widget, new_data)
elif hook_name == 'elapsed_and_total':
elapsed, ... | def hook_changed(self, hook_name, widget, new_data):
"""Handle a hook upate."""
if hook_name == 'song':
self.song_changed(widget, new_data)
elif hook_name == 'state':
self.state_changed(widget, new_data)
elif hook_name == 'elapsed_and_total':
elapsed, ... | [
"Handle",
"a",
"hook",
"upate",
"."
] | rbarrois/mpdlcd | python | https://github.com/rbarrois/mpdlcd/blob/85f16c8cc0883f8abb4c2cc7f69729c3e2f857da/mpdlcd/display_fields.py#L104-L112 | [
"def",
"hook_changed",
"(",
"self",
",",
"hook_name",
",",
"widget",
",",
"new_data",
")",
":",
"if",
"hook_name",
"==",
"'song'",
":",
"self",
".",
"song_changed",
"(",
"widget",
",",
"new_data",
")",
"elif",
"hook_name",
"==",
"'state'",
":",
"self",
"... | 85f16c8cc0883f8abb4c2cc7f69729c3e2f857da |
train | FunctionMaker.update | Update the signature of func with the data in self | glue_vispy_viewers/extern/vispy/ext/_bundled/decorator.py | def update(self, func, **kw):
"Update the signature of func with the data in self"
func.__name__ = self.name
func.__doc__ = getattr(self, 'doc', None)
func.__dict__ = getattr(self, 'dict', {})
func.__defaults__ = getattr(self, 'defaults', ())
func.__kwdefaults__ = getattr... | def update(self, func, **kw):
"Update the signature of func with the data in self"
func.__name__ = self.name
func.__doc__ = getattr(self, 'doc', None)
func.__dict__ = getattr(self, 'dict', {})
func.__defaults__ = getattr(self, 'defaults', ())
func.__kwdefaults__ = getattr... | [
"Update",
"the",
"signature",
"of",
"func",
"with",
"the",
"data",
"in",
"self"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/ext/_bundled/decorator.py#L128-L138 | [
"def",
"update",
"(",
"self",
",",
"func",
",",
"*",
"*",
"kw",
")",
":",
"func",
".",
"__name__",
"=",
"self",
".",
"name",
"func",
".",
"__doc__",
"=",
"getattr",
"(",
"self",
",",
"'doc'",
",",
"None",
")",
"func",
".",
"__dict__",
"=",
"getat... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | FunctionMaker.make | Make a new function from a given template and update the signature | glue_vispy_viewers/extern/vispy/ext/_bundled/decorator.py | def make(self, src_templ, evaldict=None, addsource=False, **attrs):
"Make a new function from a given template and update the signature"
src = src_templ % vars(self) # expand name and signature
evaldict = evaldict or {}
mo = DEF.match(src)
if mo is None:
raise SyntaxE... | def make(self, src_templ, evaldict=None, addsource=False, **attrs):
"Make a new function from a given template and update the signature"
src = src_templ % vars(self) # expand name and signature
evaldict = evaldict or {}
mo = DEF.match(src)
if mo is None:
raise SyntaxE... | [
"Make",
"a",
"new",
"function",
"from",
"a",
"given",
"template",
"and",
"update",
"the",
"signature"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/ext/_bundled/decorator.py#L140-L167 | [
"def",
"make",
"(",
"self",
",",
"src_templ",
",",
"evaldict",
"=",
"None",
",",
"addsource",
"=",
"False",
",",
"*",
"*",
"attrs",
")",
":",
"src",
"=",
"src_templ",
"%",
"vars",
"(",
"self",
")",
"# expand name and signature",
"evaldict",
"=",
"evaldic... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | FunctionMaker.create | Create a function from the strings name, signature and body.
evaldict is the evaluation dictionary. If addsource is true an attribute
__source__ is added to the result. The attributes attrs are added,
if any. | glue_vispy_viewers/extern/vispy/ext/_bundled/decorator.py | def create(cls, obj, body, evaldict, defaults=None,
doc=None, module=None, addsource=True, **attrs):
"""
Create a function from the strings name, signature and body.
evaldict is the evaluation dictionary. If addsource is true an attribute
__source__ is added to the result.... | def create(cls, obj, body, evaldict, defaults=None,
doc=None, module=None, addsource=True, **attrs):
"""
Create a function from the strings name, signature and body.
evaldict is the evaluation dictionary. If addsource is true an attribute
__source__ is added to the result.... | [
"Create",
"a",
"function",
"from",
"the",
"strings",
"name",
"signature",
"and",
"body",
".",
"evaldict",
"is",
"the",
"evaluation",
"dictionary",
".",
"If",
"addsource",
"is",
"true",
"an",
"attribute",
"__source__",
"is",
"added",
"to",
"the",
"result",
".... | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/ext/_bundled/decorator.py#L170-L189 | [
"def",
"create",
"(",
"cls",
",",
"obj",
",",
"body",
",",
"evaldict",
",",
"defaults",
"=",
"None",
",",
"doc",
"=",
"None",
",",
"module",
"=",
"None",
",",
"addsource",
"=",
"True",
",",
"*",
"*",
"attrs",
")",
":",
"if",
"isinstance",
"(",
"o... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | IsosurfaceVisual.set_data | Set the scalar array data
Parameters
----------
data : ndarray
A 3D array of scalar values. The isosurface is constructed to show
all locations in the scalar field equal to ``self.level``.
vertex_colors : array-like | None
Colors to use for each verte... | glue_vispy_viewers/extern/vispy/visuals/isosurface.py | def set_data(self, data=None, vertex_colors=None, face_colors=None,
color=None):
""" Set the scalar array data
Parameters
----------
data : ndarray
A 3D array of scalar values. The isosurface is constructed to show
all locations in the scalar fie... | def set_data(self, data=None, vertex_colors=None, face_colors=None,
color=None):
""" Set the scalar array data
Parameters
----------
data : ndarray
A 3D array of scalar values. The isosurface is constructed to show
all locations in the scalar fie... | [
"Set",
"the",
"scalar",
"array",
"data"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/isosurface.py#L63-L92 | [
"def",
"set_data",
"(",
"self",
",",
"data",
"=",
"None",
",",
"vertex_colors",
"=",
"None",
",",
"face_colors",
"=",
"None",
",",
"color",
"=",
"None",
")",
":",
"# We only change the internal variables if they are provided",
"if",
"data",
"is",
"not",
"None",
... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | ViewBox.get_scene_bounds | Get the total bounds based on the visuals present in the scene
Parameters
----------
dim : int | None
Dimension to return.
Returns
-------
bounds : list | tuple
If ``dim is None``, Returns a list of 3 tuples, otherwise
the bounds for ... | glue_vispy_viewers/extern/vispy/scene/widgets/viewbox.py | def get_scene_bounds(self, dim=None):
"""Get the total bounds based on the visuals present in the scene
Parameters
----------
dim : int | None
Dimension to return.
Returns
-------
bounds : list | tuple
If ``dim is None``, Returns a list o... | def get_scene_bounds(self, dim=None):
"""Get the total bounds based on the visuals present in the scene
Parameters
----------
dim : int | None
Dimension to return.
Returns
-------
bounds : list | tuple
If ``dim is None``, Returns a list o... | [
"Get",
"the",
"total",
"bounds",
"based",
"on",
"the",
"visuals",
"present",
"in",
"the",
"scene"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/scene/widgets/viewbox.py#L126-L163 | [
"def",
"get_scene_bounds",
"(",
"self",
",",
"dim",
"=",
"None",
")",
":",
"# todo: handle sub-children",
"# todo: handle transformations",
"# Init",
"bounds",
"=",
"[",
"(",
"np",
".",
"inf",
",",
"-",
"np",
".",
"inf",
")",
",",
"(",
"np",
".",
"inf",
... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | _string_to_rgb | Convert user string or hex color to color array (length 3 or 4) | glue_vispy_viewers/extern/vispy/color/color_array.py | def _string_to_rgb(color):
"""Convert user string or hex color to color array (length 3 or 4)"""
if not color.startswith('#'):
if color.lower() not in _color_dict:
raise ValueError('Color "%s" unknown' % color)
color = _color_dict[color]
assert color[0] == '#'
# hex color... | def _string_to_rgb(color):
"""Convert user string or hex color to color array (length 3 or 4)"""
if not color.startswith('#'):
if color.lower() not in _color_dict:
raise ValueError('Color "%s" unknown' % color)
color = _color_dict[color]
assert color[0] == '#'
# hex color... | [
"Convert",
"user",
"string",
"or",
"hex",
"color",
"to",
"color",
"array",
"(",
"length",
"3",
"or",
"4",
")"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/color/color_array.py#L20-L37 | [
"def",
"_string_to_rgb",
"(",
"color",
")",
":",
"if",
"not",
"color",
".",
"startswith",
"(",
"'#'",
")",
":",
"if",
"color",
".",
"lower",
"(",
")",
"not",
"in",
"_color_dict",
":",
"raise",
"ValueError",
"(",
"'Color \"%s\" unknown'",
"%",
"color",
")... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | _user_to_rgba | Convert color(s) from any set of fmts (str/hex/arr) to RGB(A) array | glue_vispy_viewers/extern/vispy/color/color_array.py | def _user_to_rgba(color, expand=True, clip=False):
"""Convert color(s) from any set of fmts (str/hex/arr) to RGB(A) array"""
if color is None:
color = np.zeros(4, np.float32)
if isinstance(color, string_types):
color = _string_to_rgb(color)
elif isinstance(color, ColorArray):
col... | def _user_to_rgba(color, expand=True, clip=False):
"""Convert color(s) from any set of fmts (str/hex/arr) to RGB(A) array"""
if color is None:
color = np.zeros(4, np.float32)
if isinstance(color, string_types):
color = _string_to_rgb(color)
elif isinstance(color, ColorArray):
col... | [
"Convert",
"color",
"(",
"s",
")",
"from",
"any",
"set",
"of",
"fmts",
"(",
"str",
"/",
"hex",
"/",
"arr",
")",
"to",
"RGB",
"(",
"A",
")",
"array"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/color/color_array.py#L40-L67 | [
"def",
"_user_to_rgba",
"(",
"color",
",",
"expand",
"=",
"True",
",",
"clip",
"=",
"False",
")",
":",
"if",
"color",
"is",
"None",
":",
"color",
"=",
"np",
".",
"zeros",
"(",
"4",
",",
"np",
".",
"float32",
")",
"if",
"isinstance",
"(",
"color",
... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | _array_clip_val | Helper to turn val into array and clip between 0 and 1 | glue_vispy_viewers/extern/vispy/color/color_array.py | def _array_clip_val(val):
"""Helper to turn val into array and clip between 0 and 1"""
val = np.array(val)
if val.max() > 1 or val.min() < 0:
logger.warning('value will be clipped between 0 and 1')
val[...] = np.clip(val, 0, 1)
return val | def _array_clip_val(val):
"""Helper to turn val into array and clip between 0 and 1"""
val = np.array(val)
if val.max() > 1 or val.min() < 0:
logger.warning('value will be clipped between 0 and 1')
val[...] = np.clip(val, 0, 1)
return val | [
"Helper",
"to",
"turn",
"val",
"into",
"array",
"and",
"clip",
"between",
"0",
"and",
"1"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/color/color_array.py#L70-L76 | [
"def",
"_array_clip_val",
"(",
"val",
")",
":",
"val",
"=",
"np",
".",
"array",
"(",
"val",
")",
"if",
"val",
".",
"max",
"(",
")",
">",
"1",
"or",
"val",
".",
"min",
"(",
")",
"<",
"0",
":",
"logger",
".",
"warning",
"(",
"'value will be clipped... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | ColorArray.extend | Extend a ColorArray with new colors
Parameters
----------
colors : instance of ColorArray
The new colors. | glue_vispy_viewers/extern/vispy/color/color_array.py | def extend(self, colors):
"""Extend a ColorArray with new colors
Parameters
----------
colors : instance of ColorArray
The new colors.
"""
colors = ColorArray(colors)
self._rgba = np.vstack((self._rgba, colors._rgba))
return self | def extend(self, colors):
"""Extend a ColorArray with new colors
Parameters
----------
colors : instance of ColorArray
The new colors.
"""
colors = ColorArray(colors)
self._rgba = np.vstack((self._rgba, colors._rgba))
return self | [
"Extend",
"a",
"ColorArray",
"with",
"new",
"colors"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/color/color_array.py#L204-L214 | [
"def",
"extend",
"(",
"self",
",",
"colors",
")",
":",
"colors",
"=",
"ColorArray",
"(",
"colors",
")",
"self",
".",
"_rgba",
"=",
"np",
".",
"vstack",
"(",
"(",
"self",
".",
"_rgba",
",",
"colors",
".",
"_rgba",
")",
")",
"return",
"self"
] | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | ColorArray.rgba | Set the color using an Nx4 array of RGBA floats | glue_vispy_viewers/extern/vispy/color/color_array.py | def rgba(self, val):
"""Set the color using an Nx4 array of RGBA floats"""
# Note: all other attribute sets get routed here!
# This method is meant to do the heavy lifting of setting data
rgba = _user_to_rgba(val, expand=False)
if self._rgba is None:
self._rgba = rgba... | def rgba(self, val):
"""Set the color using an Nx4 array of RGBA floats"""
# Note: all other attribute sets get routed here!
# This method is meant to do the heavy lifting of setting data
rgba = _user_to_rgba(val, expand=False)
if self._rgba is None:
self._rgba = rgba... | [
"Set",
"the",
"color",
"using",
"an",
"Nx4",
"array",
"of",
"RGBA",
"floats"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/color/color_array.py#L223-L231 | [
"def",
"rgba",
"(",
"self",
",",
"val",
")",
":",
"# Note: all other attribute sets get routed here!",
"# This method is meant to do the heavy lifting of setting data",
"rgba",
"=",
"_user_to_rgba",
"(",
"val",
",",
"expand",
"=",
"False",
")",
"if",
"self",
".",
"_rgba... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | ColorArray.RGBA | Set the color using an Nx4 array of RGBA uint8 values | glue_vispy_viewers/extern/vispy/color/color_array.py | def RGBA(self, val):
"""Set the color using an Nx4 array of RGBA uint8 values"""
# need to convert to normalized float
val = np.atleast_1d(val).astype(np.float32) / 255
self.rgba = val | def RGBA(self, val):
"""Set the color using an Nx4 array of RGBA uint8 values"""
# need to convert to normalized float
val = np.atleast_1d(val).astype(np.float32) / 255
self.rgba = val | [
"Set",
"the",
"color",
"using",
"an",
"Nx4",
"array",
"of",
"RGBA",
"uint8",
"values"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/color/color_array.py#L249-L253 | [
"def",
"RGBA",
"(",
"self",
",",
"val",
")",
":",
"# need to convert to normalized float",
"val",
"=",
"np",
".",
"atleast_1d",
"(",
"val",
")",
".",
"astype",
"(",
"np",
".",
"float32",
")",
"/",
"255",
"self",
".",
"rgba",
"=",
"val"
] | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | ColorArray.RGB | Set the color using an Nx3 array of RGB uint8 values | glue_vispy_viewers/extern/vispy/color/color_array.py | def RGB(self, val):
"""Set the color using an Nx3 array of RGB uint8 values"""
# need to convert to normalized float
val = np.atleast_1d(val).astype(np.float32) / 255.
self.rgba = val | def RGB(self, val):
"""Set the color using an Nx3 array of RGB uint8 values"""
# need to convert to normalized float
val = np.atleast_1d(val).astype(np.float32) / 255.
self.rgba = val | [
"Set",
"the",
"color",
"using",
"an",
"Nx3",
"array",
"of",
"RGB",
"uint8",
"values"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/color/color_array.py#L261-L265 | [
"def",
"RGB",
"(",
"self",
",",
"val",
")",
":",
"# need to convert to normalized float",
"val",
"=",
"np",
".",
"atleast_1d",
"(",
"val",
")",
".",
"astype",
"(",
"np",
".",
"float32",
")",
"/",
"255.",
"self",
".",
"rgba",
"=",
"val"
] | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | ColorArray.value | Set the color using length-N array of (from HSV) | glue_vispy_viewers/extern/vispy/color/color_array.py | def value(self, val):
"""Set the color using length-N array of (from HSV)"""
hsv = self._hsv
hsv[:, 2] = _array_clip_val(val)
self.rgba = _hsv_to_rgb(hsv) | def value(self, val):
"""Set the color using length-N array of (from HSV)"""
hsv = self._hsv
hsv[:, 2] = _array_clip_val(val)
self.rgba = _hsv_to_rgb(hsv) | [
"Set",
"the",
"color",
"using",
"length",
"-",
"N",
"array",
"of",
"(",
"from",
"HSV",
")"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/color/color_array.py#L313-L317 | [
"def",
"value",
"(",
"self",
",",
"val",
")",
":",
"hsv",
"=",
"self",
".",
"_hsv",
"hsv",
"[",
":",
",",
"2",
"]",
"=",
"_array_clip_val",
"(",
"val",
")",
"self",
".",
"rgba",
"=",
"_hsv_to_rgb",
"(",
"hsv",
")"
] | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | ColorArray.lighter | Produce a lighter color (if possible)
Parameters
----------
dv : float
Amount to increase the color value by.
copy : bool
If False, operation will be carried out in-place.
Returns
-------
color : instance of ColorArray
The lig... | glue_vispy_viewers/extern/vispy/color/color_array.py | def lighter(self, dv=0.1, copy=True):
"""Produce a lighter color (if possible)
Parameters
----------
dv : float
Amount to increase the color value by.
copy : bool
If False, operation will be carried out in-place.
Returns
-------
c... | def lighter(self, dv=0.1, copy=True):
"""Produce a lighter color (if possible)
Parameters
----------
dv : float
Amount to increase the color value by.
copy : bool
If False, operation will be carried out in-place.
Returns
-------
c... | [
"Produce",
"a",
"lighter",
"color",
"(",
"if",
"possible",
")"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/color/color_array.py#L319-L336 | [
"def",
"lighter",
"(",
"self",
",",
"dv",
"=",
"0.1",
",",
"copy",
"=",
"True",
")",
":",
"color",
"=",
"self",
".",
"copy",
"(",
")",
"if",
"copy",
"else",
"self",
"color",
".",
"value",
"+=",
"dv",
"return",
"color"
] | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | ColorArray.darker | Produce a darker color (if possible)
Parameters
----------
dv : float
Amount to decrease the color value by.
copy : bool
If False, operation will be carried out in-place.
Returns
-------
color : instance of ColorArray
The dark... | glue_vispy_viewers/extern/vispy/color/color_array.py | def darker(self, dv=0.1, copy=True):
"""Produce a darker color (if possible)
Parameters
----------
dv : float
Amount to decrease the color value by.
copy : bool
If False, operation will be carried out in-place.
Returns
-------
col... | def darker(self, dv=0.1, copy=True):
"""Produce a darker color (if possible)
Parameters
----------
dv : float
Amount to decrease the color value by.
copy : bool
If False, operation will be carried out in-place.
Returns
-------
col... | [
"Produce",
"a",
"darker",
"color",
"(",
"if",
"possible",
")"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/color/color_array.py#L338-L355 | [
"def",
"darker",
"(",
"self",
",",
"dv",
"=",
"0.1",
",",
"copy",
"=",
"True",
")",
":",
"color",
"=",
"self",
".",
"copy",
"(",
")",
"if",
"copy",
"else",
"self",
"color",
".",
"value",
"-=",
"dv",
"return",
"color"
] | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | PerspectiveCamera.viewbox_mouse_event | The ViewBox received a mouse event; update transform
accordingly.
Default implementation adjusts scale factor when scolling.
Parameters
----------
event : instance of Event
The event. | glue_vispy_viewers/extern/vispy/scene/cameras/perspective.py | def viewbox_mouse_event(self, event):
""" The ViewBox received a mouse event; update transform
accordingly.
Default implementation adjusts scale factor when scolling.
Parameters
----------
event : instance of Event
The event.
"""
BaseCamera.vi... | def viewbox_mouse_event(self, event):
""" The ViewBox received a mouse event; update transform
accordingly.
Default implementation adjusts scale factor when scolling.
Parameters
----------
event : instance of Event
The event.
"""
BaseCamera.vi... | [
"The",
"ViewBox",
"received",
"a",
"mouse",
"event",
";",
"update",
"transform",
"accordingly",
".",
"Default",
"implementation",
"adjusts",
"scale",
"factor",
"when",
"scolling",
"."
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/scene/cameras/perspective.py#L48-L64 | [
"def",
"viewbox_mouse_event",
"(",
"self",
",",
"event",
")",
":",
"BaseCamera",
".",
"viewbox_mouse_event",
"(",
"self",
",",
"event",
")",
"if",
"event",
".",
"type",
"==",
"'mouse_wheel'",
":",
"s",
"=",
"1.1",
"**",
"-",
"event",
".",
"delta",
"[",
... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | PerspectiveCamera._set_range | Reset the camera view using the known limits. | glue_vispy_viewers/extern/vispy/scene/cameras/perspective.py | def _set_range(self, init):
""" Reset the camera view using the known limits.
"""
if init and (self._scale_factor is not None):
return # We don't have to set our scale factor
# Get window size (and store factor now to sync with resizing)
w, h = self._viewbox.size
... | def _set_range(self, init):
""" Reset the camera view using the known limits.
"""
if init and (self._scale_factor is not None):
return # We don't have to set our scale factor
# Get window size (and store factor now to sync with resizing)
w, h = self._viewbox.size
... | [
"Reset",
"the",
"camera",
"view",
"using",
"the",
"known",
"limits",
"."
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/scene/cameras/perspective.py#L86-L118 | [
"def",
"_set_range",
"(",
"self",
",",
"init",
")",
":",
"if",
"init",
"and",
"(",
"self",
".",
"_scale_factor",
"is",
"not",
"None",
")",
":",
"return",
"# We don't have to set our scale factor",
"# Get window size (and store factor now to sync with resizing)",
"w",
... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | Base3DRotationCamera.viewbox_mouse_event | The viewbox received a mouse event; update transform
accordingly.
Parameters
----------
event : instance of Event
The event. | glue_vispy_viewers/extern/vispy/scene/cameras/perspective.py | def viewbox_mouse_event(self, event):
"""
The viewbox received a mouse event; update transform
accordingly.
Parameters
----------
event : instance of Event
The event.
"""
if event.handled or not self.interactive:
return
Pe... | def viewbox_mouse_event(self, event):
"""
The viewbox received a mouse event; update transform
accordingly.
Parameters
----------
event : instance of Event
The event.
"""
if event.handled or not self.interactive:
return
Pe... | [
"The",
"viewbox",
"received",
"a",
"mouse",
"event",
";",
"update",
"transform",
"accordingly",
"."
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/scene/cameras/perspective.py#L194-L260 | [
"def",
"viewbox_mouse_event",
"(",
"self",
",",
"event",
")",
":",
"if",
"event",
".",
"handled",
"or",
"not",
"self",
".",
"interactive",
":",
"return",
"PerspectiveCamera",
".",
"viewbox_mouse_event",
"(",
"self",
",",
"event",
")",
"if",
"event",
".",
"... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | Base3DRotationCamera._update_camera_pos | Set the camera position and orientation | glue_vispy_viewers/extern/vispy/scene/cameras/perspective.py | def _update_camera_pos(self):
""" Set the camera position and orientation"""
# transform will be updated several times; do not update camera
# transform until we are done.
ch_em = self.events.transform_change
with ch_em.blocker(self._update_transform):
tr = self.tran... | def _update_camera_pos(self):
""" Set the camera position and orientation"""
# transform will be updated several times; do not update camera
# transform until we are done.
ch_em = self.events.transform_change
with ch_em.blocker(self._update_transform):
tr = self.tran... | [
"Set",
"the",
"camera",
"position",
"and",
"orientation"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/scene/cameras/perspective.py#L262-L282 | [
"def",
"_update_camera_pos",
"(",
"self",
")",
":",
"# transform will be updated several times; do not update camera",
"# transform until we are done.",
"ch_em",
"=",
"self",
".",
"events",
".",
"transform_change",
"with",
"ch_em",
".",
"blocker",
"(",
"self",
".",
"_upda... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | Application.is_interactive | Determine if the user requested interactive mode. | glue_vispy_viewers/extern/vispy/app/application.py | def is_interactive(self):
""" Determine if the user requested interactive mode.
"""
# The Python interpreter sets sys.flags correctly, so use them!
if sys.flags.interactive:
return True
# IPython does not set sys.flags when -i is specified, so first
# check i... | def is_interactive(self):
""" Determine if the user requested interactive mode.
"""
# The Python interpreter sets sys.flags correctly, so use them!
if sys.flags.interactive:
return True
# IPython does not set sys.flags when -i is specified, so first
# check i... | [
"Determine",
"if",
"the",
"user",
"requested",
"interactive",
"mode",
"."
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/app/application.py#L100-L118 | [
"def",
"is_interactive",
"(",
"self",
")",
":",
"# The Python interpreter sets sys.flags correctly, so use them!",
"if",
"sys",
".",
"flags",
".",
"interactive",
":",
"return",
"True",
"# IPython does not set sys.flags when -i is specified, so first",
"# check it if it is already i... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | Application.run | Enter the native GUI event loop.
Parameters
----------
allow_interactive : bool
Is the application allowed to handle interactive mode for console
terminals? By default, typing ``python -i main.py`` results in
an interactive shell that also regularly calls th... | glue_vispy_viewers/extern/vispy/app/application.py | def run(self, allow_interactive=True):
""" Enter the native GUI event loop.
Parameters
----------
allow_interactive : bool
Is the application allowed to handle interactive mode for console
terminals? By default, typing ``python -i main.py`` results in
... | def run(self, allow_interactive=True):
""" Enter the native GUI event loop.
Parameters
----------
allow_interactive : bool
Is the application allowed to handle interactive mode for console
terminals? By default, typing ``python -i main.py`` results in
... | [
"Enter",
"the",
"native",
"GUI",
"event",
"loop",
"."
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/app/application.py#L120-L137 | [
"def",
"run",
"(",
"self",
",",
"allow_interactive",
"=",
"True",
")",
":",
"if",
"allow_interactive",
"and",
"self",
".",
"is_interactive",
"(",
")",
":",
"inputhook",
".",
"set_interactive",
"(",
"enabled",
"=",
"True",
",",
"app",
"=",
"self",
")",
"e... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | Application._use | Select a backend by name. See class docstring for details. | glue_vispy_viewers/extern/vispy/app/application.py | def _use(self, backend_name=None):
"""Select a backend by name. See class docstring for details.
"""
# See if we're in a specific testing mode, if so DONT check to see
# if it's a valid backend. If it isn't, it's a good thing we
# get an error later because we should have decorat... | def _use(self, backend_name=None):
"""Select a backend by name. See class docstring for details.
"""
# See if we're in a specific testing mode, if so DONT check to see
# if it's a valid backend. If it isn't, it's a good thing we
# get an error later because we should have decorat... | [
"Select",
"a",
"backend",
"by",
"name",
".",
"See",
"class",
"docstring",
"for",
"details",
"."
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/app/application.py#L158-L241 | [
"def",
"_use",
"(",
"self",
",",
"backend_name",
"=",
"None",
")",
":",
"# See if we're in a specific testing mode, if so DONT check to see",
"# if it's a valid backend. If it isn't, it's a good thing we",
"# get an error later because we should have decorated our test",
"# with requires_a... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | _set_config | Set gl configuration | glue_vispy_viewers/extern/vispy/app/backends/_wx.py | def _set_config(c):
"""Set gl configuration"""
gl_attribs = [glcanvas.WX_GL_RGBA,
glcanvas.WX_GL_DEPTH_SIZE, c['depth_size'],
glcanvas.WX_GL_STENCIL_SIZE, c['stencil_size'],
glcanvas.WX_GL_MIN_RED, c['red_size'],
glcanvas.WX_GL_MIN_GREEN, c... | def _set_config(c):
"""Set gl configuration"""
gl_attribs = [glcanvas.WX_GL_RGBA,
glcanvas.WX_GL_DEPTH_SIZE, c['depth_size'],
glcanvas.WX_GL_STENCIL_SIZE, c['stencil_size'],
glcanvas.WX_GL_MIN_RED, c['red_size'],
glcanvas.WX_GL_MIN_GREEN, c... | [
"Set",
"gl",
"configuration"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/app/backends/_wx.py#L107-L118 | [
"def",
"_set_config",
"(",
"c",
")",
":",
"gl_attribs",
"=",
"[",
"glcanvas",
".",
"WX_GL_RGBA",
",",
"glcanvas",
".",
"WX_GL_DEPTH_SIZE",
",",
"c",
"[",
"'depth_size'",
"]",
",",
"glcanvas",
".",
"WX_GL_STENCIL_SIZE",
",",
"c",
"[",
"'stencil_size'",
"]",
... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | _get_mods | Helper to extract list of mods from event | glue_vispy_viewers/extern/vispy/app/backends/_wx.py | def _get_mods(evt):
"""Helper to extract list of mods from event"""
mods = []
mods += [keys.CONTROL] if evt.ControlDown() else []
mods += [keys.ALT] if evt.AltDown() else []
mods += [keys.SHIFT] if evt.ShiftDown() else []
mods += [keys.META] if evt.MetaDown() else []
return mods | def _get_mods(evt):
"""Helper to extract list of mods from event"""
mods = []
mods += [keys.CONTROL] if evt.ControlDown() else []
mods += [keys.ALT] if evt.AltDown() else []
mods += [keys.SHIFT] if evt.ShiftDown() else []
mods += [keys.META] if evt.MetaDown() else []
return mods | [
"Helper",
"to",
"extract",
"list",
"of",
"mods",
"from",
"event"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/app/backends/_wx.py#L165-L172 | [
"def",
"_get_mods",
"(",
"evt",
")",
":",
"mods",
"=",
"[",
"]",
"mods",
"+=",
"[",
"keys",
".",
"CONTROL",
"]",
"if",
"evt",
".",
"ControlDown",
"(",
")",
"else",
"[",
"]",
"mods",
"+=",
"[",
"keys",
".",
"ALT",
"]",
"if",
"evt",
".",
"AltDown... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | _process_key | Helper to convert from wx keycode to vispy keycode | glue_vispy_viewers/extern/vispy/app/backends/_wx.py | def _process_key(evt):
"""Helper to convert from wx keycode to vispy keycode"""
key = evt.GetKeyCode()
if key in KEYMAP:
return KEYMAP[key], ''
if 97 <= key <= 122:
key -= 32
if key >= 32 and key <= 127:
return keys.Key(chr(key)), chr(key)
else:
return None, None | def _process_key(evt):
"""Helper to convert from wx keycode to vispy keycode"""
key = evt.GetKeyCode()
if key in KEYMAP:
return KEYMAP[key], ''
if 97 <= key <= 122:
key -= 32
if key >= 32 and key <= 127:
return keys.Key(chr(key)), chr(key)
else:
return None, None | [
"Helper",
"to",
"convert",
"from",
"wx",
"keycode",
"to",
"vispy",
"keycode"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/app/backends/_wx.py#L175-L185 | [
"def",
"_process_key",
"(",
"evt",
")",
":",
"key",
"=",
"evt",
".",
"GetKeyCode",
"(",
")",
"if",
"key",
"in",
"KEYMAP",
":",
"return",
"KEYMAP",
"[",
"key",
"]",
",",
"''",
"if",
"97",
"<=",
"key",
"<=",
"122",
":",
"key",
"-=",
"32",
"if",
"... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | Node.is_child | Check if a node is a child of the current node
Parameters
----------
node : instance of Node
The potential child.
Returns
-------
child : bool
Whether or not the node is a child. | glue_vispy_viewers/extern/vispy/scene/node.py | def is_child(self, node):
"""Check if a node is a child of the current node
Parameters
----------
node : instance of Node
The potential child.
Returns
-------
child : bool
Whether or not the node is a child.
"""
if node in... | def is_child(self, node):
"""Check if a node is a child of the current node
Parameters
----------
node : instance of Node
The potential child.
Returns
-------
child : bool
Whether or not the node is a child.
"""
if node in... | [
"Check",
"if",
"a",
"node",
"is",
"a",
"child",
"of",
"the",
"current",
"node"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/scene/node.py#L234-L252 | [
"def",
"is_child",
"(",
"self",
",",
"node",
")",
":",
"if",
"node",
"in",
"self",
".",
"children",
":",
"return",
"True",
"for",
"c",
"in",
"self",
".",
"children",
":",
"if",
"c",
".",
"is_child",
"(",
"node",
")",
":",
"return",
"True",
"return"... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | Node.scene_node | The first ancestor of this node that is a SubScene instance, or self
if no such node exists. | glue_vispy_viewers/extern/vispy/scene/node.py | def scene_node(self):
"""The first ancestor of this node that is a SubScene instance, or self
if no such node exists.
"""
if self._scene_node is None:
from .subscene import SubScene
p = self.parent
while True:
if isinstance(p, SubScene)... | def scene_node(self):
"""The first ancestor of this node that is a SubScene instance, or self
if no such node exists.
"""
if self._scene_node is None:
from .subscene import SubScene
p = self.parent
while True:
if isinstance(p, SubScene)... | [
"The",
"first",
"ancestor",
"of",
"this",
"node",
"that",
"is",
"a",
"SubScene",
"instance",
"or",
"self",
"if",
"no",
"such",
"node",
"exists",
"."
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/scene/node.py#L279-L293 | [
"def",
"scene_node",
"(",
"self",
")",
":",
"if",
"self",
".",
"_scene_node",
"is",
"None",
":",
"from",
".",
"subscene",
"import",
"SubScene",
"p",
"=",
"self",
".",
"parent",
"while",
"True",
":",
"if",
"isinstance",
"(",
"p",
",",
"SubScene",
")",
... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | Node.update | Emit an event to inform listeners that properties of this Node have
changed. Also request a canvas update. | glue_vispy_viewers/extern/vispy/scene/node.py | def update(self):
"""
Emit an event to inform listeners that properties of this Node have
changed. Also request a canvas update.
"""
self.events.update()
c = getattr(self, 'canvas', None)
if c is not None:
c.update(node=self) | def update(self):
"""
Emit an event to inform listeners that properties of this Node have
changed. Also request a canvas update.
"""
self.events.update()
c = getattr(self, 'canvas', None)
if c is not None:
c.update(node=self) | [
"Emit",
"an",
"event",
"to",
"inform",
"listeners",
"that",
"properties",
"of",
"this",
"Node",
"have",
"changed",
".",
"Also",
"request",
"a",
"canvas",
"update",
"."
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/scene/node.py#L325-L333 | [
"def",
"update",
"(",
"self",
")",
":",
"self",
".",
"events",
".",
"update",
"(",
")",
"c",
"=",
"getattr",
"(",
"self",
",",
"'canvas'",
",",
"None",
")",
"if",
"c",
"is",
"not",
"None",
":",
"c",
".",
"update",
"(",
"node",
"=",
"self",
")"
... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | Node.set_transform | Create a new transform of *type* and assign it to this node.
All extra arguments are used in the construction of the transform.
Parameters
----------
type_ : str
The transform type.
*args : tuple
Arguments.
**kwargs : dict
Keywoard ar... | glue_vispy_viewers/extern/vispy/scene/node.py | def set_transform(self, type_, *args, **kwargs):
""" Create a new transform of *type* and assign it to this node.
All extra arguments are used in the construction of the transform.
Parameters
----------
type_ : str
The transform type.
*args : tuple
... | def set_transform(self, type_, *args, **kwargs):
""" Create a new transform of *type* and assign it to this node.
All extra arguments are used in the construction of the transform.
Parameters
----------
type_ : str
The transform type.
*args : tuple
... | [
"Create",
"a",
"new",
"transform",
"of",
"*",
"type",
"*",
"and",
"assign",
"it",
"to",
"this",
"node",
"."
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/scene/node.py#L371-L385 | [
"def",
"set_transform",
"(",
"self",
",",
"type_",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"transform",
"=",
"create_transform",
"(",
"type_",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | Node._update_trsys | Called when has changed.
This allows the node and its children to react (notably, VisualNode
uses this to update its TransformSystem).
Note that this method is only called when one transform is replaced by
another; it is not called if an existing transform internally c... | glue_vispy_viewers/extern/vispy/scene/node.py | def _update_trsys(self, event):
"""Called when has changed.
This allows the node and its children to react (notably, VisualNode
uses this to update its TransformSystem).
Note that this method is only called when one transform is replaced by
another; it is not c... | def _update_trsys(self, event):
"""Called when has changed.
This allows the node and its children to react (notably, VisualNode
uses this to update its TransformSystem).
Note that this method is only called when one transform is replaced by
another; it is not c... | [
"Called",
"when",
"has",
"changed",
".",
"This",
"allows",
"the",
"node",
"and",
"its",
"children",
"to",
"react",
"(",
"notably",
"VisualNode",
"uses",
"this",
"to",
"update",
"its",
"TransformSystem",
")",
".",
"Note",
"that",
"this",
"method",
"is",
"on... | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/scene/node.py#L387-L400 | [
"def",
"_update_trsys",
"(",
"self",
",",
"event",
")",
":",
"for",
"ch",
"in",
"self",
".",
"children",
":",
"ch",
".",
"_update_trsys",
"(",
"event",
")",
"self",
".",
"events",
".",
"transform_change",
"(",
")",
"self",
".",
"update",
"(",
")"
] | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | Node.parent_chain | Return the list of parents starting from this node. The chain ends
at the first node with no parents. | glue_vispy_viewers/extern/vispy/scene/node.py | def parent_chain(self):
"""
Return the list of parents starting from this node. The chain ends
at the first node with no parents.
"""
chain = [self]
while True:
try:
parent = chain[-1].parent
except Exception:
break
... | def parent_chain(self):
"""
Return the list of parents starting from this node. The chain ends
at the first node with no parents.
"""
chain = [self]
while True:
try:
parent = chain[-1].parent
except Exception:
break
... | [
"Return",
"the",
"list",
"of",
"parents",
"starting",
"from",
"this",
"node",
".",
"The",
"chain",
"ends",
"at",
"the",
"first",
"node",
"with",
"no",
"parents",
"."
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/scene/node.py#L402-L416 | [
"def",
"parent_chain",
"(",
"self",
")",
":",
"chain",
"=",
"[",
"self",
"]",
"while",
"True",
":",
"try",
":",
"parent",
"=",
"chain",
"[",
"-",
"1",
"]",
".",
"parent",
"except",
"Exception",
":",
"break",
"if",
"parent",
"is",
"None",
":",
"brea... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | Node._describe_tree | Helper function to actuall construct the tree | glue_vispy_viewers/extern/vispy/scene/node.py | def _describe_tree(self, prefix, with_transform):
"""Helper function to actuall construct the tree"""
extra = ': "%s"' % self.name if self.name is not None else ''
if with_transform:
extra += (' [%s]' % self.transform.__class__.__name__)
output = ''
if len(prefix) > 0... | def _describe_tree(self, prefix, with_transform):
"""Helper function to actuall construct the tree"""
extra = ': "%s"' % self.name if self.name is not None else ''
if with_transform:
extra += (' [%s]' % self.transform.__class__.__name__)
output = ''
if len(prefix) > 0... | [
"Helper",
"function",
"to",
"actuall",
"construct",
"the",
"tree"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/scene/node.py#L434-L449 | [
"def",
"_describe_tree",
"(",
"self",
",",
"prefix",
",",
"with_transform",
")",
":",
"extra",
"=",
"': \"%s\"'",
"%",
"self",
".",
"name",
"if",
"self",
".",
"name",
"is",
"not",
"None",
"else",
"''",
"if",
"with_transform",
":",
"extra",
"+=",
"(",
"... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | Node.common_parent | Return the common parent of two entities
If the entities have no common parent, return None.
Parameters
----------
node : instance of Node
The other node.
Returns
-------
parent : instance of Node | None
The parent. | glue_vispy_viewers/extern/vispy/scene/node.py | def common_parent(self, node):
"""
Return the common parent of two entities
If the entities have no common parent, return None.
Parameters
----------
node : instance of Node
The other node.
Returns
-------
parent : instance of Node |... | def common_parent(self, node):
"""
Return the common parent of two entities
If the entities have no common parent, return None.
Parameters
----------
node : instance of Node
The other node.
Returns
-------
parent : instance of Node |... | [
"Return",
"the",
"common",
"parent",
"of",
"two",
"entities"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/scene/node.py#L451-L472 | [
"def",
"common_parent",
"(",
"self",
",",
"node",
")",
":",
"p1",
"=",
"self",
".",
"parent_chain",
"(",
")",
"p2",
"=",
"node",
".",
"parent_chain",
"(",
")",
"for",
"p",
"in",
"p1",
":",
"if",
"p",
"in",
"p2",
":",
"return",
"p",
"return",
"Non... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | Node.node_path_to_child | Return a list describing the path from this node to a child node
If *node* is not a (grand)child of this node, then raise RuntimeError.
Parameters
----------
node : instance of Node
The child node.
Returns
-------
path : list | None
The ... | glue_vispy_viewers/extern/vispy/scene/node.py | def node_path_to_child(self, node):
"""Return a list describing the path from this node to a child node
If *node* is not a (grand)child of this node, then raise RuntimeError.
Parameters
----------
node : instance of Node
The child node.
Returns
----... | def node_path_to_child(self, node):
"""Return a list describing the path from this node to a child node
If *node* is not a (grand)child of this node, then raise RuntimeError.
Parameters
----------
node : instance of Node
The child node.
Returns
----... | [
"Return",
"a",
"list",
"describing",
"the",
"path",
"from",
"this",
"node",
"to",
"a",
"child",
"node"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/scene/node.py#L474-L523 | [
"def",
"node_path_to_child",
"(",
"self",
",",
"node",
")",
":",
"if",
"node",
"is",
"self",
":",
"return",
"[",
"]",
"# Go up from the child node as far as we can",
"path1",
"=",
"[",
"node",
"]",
"child",
"=",
"node",
"while",
"child",
".",
"parent",
"is",... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | Node.node_path | Return two lists describing the path from this node to another
Parameters
----------
node : instance of Node
The other node.
Returns
-------
p1 : list
First path (see below).
p2 : list
Second path (see below).
Notes
... | glue_vispy_viewers/extern/vispy/scene/node.py | def node_path(self, node):
"""Return two lists describing the path from this node to another
Parameters
----------
node : instance of Node
The other node.
Returns
-------
p1 : list
First path (see below).
p2 : list
Sec... | def node_path(self, node):
"""Return two lists describing the path from this node to another
Parameters
----------
node : instance of Node
The other node.
Returns
-------
p1 : list
First path (see below).
p2 : list
Sec... | [
"Return",
"two",
"lists",
"describing",
"the",
"path",
"from",
"this",
"node",
"to",
"another"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/scene/node.py#L525-L570 | [
"def",
"node_path",
"(",
"self",
",",
"node",
")",
":",
"p1",
"=",
"self",
".",
"parent_chain",
"(",
")",
"p2",
"=",
"node",
".",
"parent_chain",
"(",
")",
"cp",
"=",
"None",
"for",
"p",
"in",
"p1",
":",
"if",
"p",
"in",
"p2",
":",
"cp",
"=",
... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | Node.node_path_transforms | Return the list of transforms along the path to another node.
The transforms are listed in reverse order, such that the last
transform should be applied first when mapping from this node to
the other.
Parameters
----------
node : instance of Node
T... | glue_vispy_viewers/extern/vispy/scene/node.py | def node_path_transforms(self, node):
"""Return the list of transforms along the path to another node.
The transforms are listed in reverse order, such that the last
transform should be applied first when mapping from this node to
the other.
Parameters
-------... | def node_path_transforms(self, node):
"""Return the list of transforms along the path to another node.
The transforms are listed in reverse order, such that the last
transform should be applied first when mapping from this node to
the other.
Parameters
-------... | [
"Return",
"the",
"list",
"of",
"transforms",
"along",
"the",
"path",
"to",
"another",
"node",
".",
"The",
"transforms",
"are",
"listed",
"in",
"reverse",
"order",
"such",
"that",
"the",
"last",
"transform",
"should",
"be",
"applied",
"first",
"when",
"mappin... | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/scene/node.py#L572-L591 | [
"def",
"node_path_transforms",
"(",
"self",
",",
"node",
")",
":",
"a",
",",
"b",
"=",
"self",
".",
"node_path",
"(",
"node",
")",
"return",
"(",
"[",
"n",
".",
"transform",
"for",
"n",
"in",
"a",
"[",
":",
"-",
"1",
"]",
"]",
"+",
"[",
"n",
... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | WavefrontReader.read | read(fname, fmt)
This classmethod is the entry point for reading OBJ files.
Parameters
----------
fname : str
The name of the file to read.
fmt : str
Can be "obj" or "gz" to specify the file format. | glue_vispy_viewers/extern/vispy/io/wavefront.py | def read(cls, fname):
""" read(fname, fmt)
This classmethod is the entry point for reading OBJ files.
Parameters
----------
fname : str
The name of the file to read.
fmt : str
Can be "obj" or "gz" to specify the file format.
"""
#... | def read(cls, fname):
""" read(fname, fmt)
This classmethod is the entry point for reading OBJ files.
Parameters
----------
fname : str
The name of the file to read.
fmt : str
Can be "obj" or "gz" to specify the file format.
"""
#... | [
"read",
"(",
"fname",
"fmt",
")"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/io/wavefront.py#L55-L85 | [
"def",
"read",
"(",
"cls",
",",
"fname",
")",
":",
"# Open file",
"fmt",
"=",
"op",
".",
"splitext",
"(",
"fname",
")",
"[",
"1",
"]",
".",
"lower",
"(",
")",
"assert",
"fmt",
"in",
"(",
"'.obj'",
",",
"'.gz'",
")",
"opener",
"=",
"open",
"if",
... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | WavefrontReader.readLine | The method that reads a line and processes it. | glue_vispy_viewers/extern/vispy/io/wavefront.py | def readLine(self):
""" The method that reads a line and processes it.
"""
# Read line
line = self._f.readline().decode('ascii', 'ignore')
if not line:
raise EOFError()
line = line.strip()
if line.startswith('v '):
# self._vertices.append... | def readLine(self):
""" The method that reads a line and processes it.
"""
# Read line
line = self._f.readline().decode('ascii', 'ignore')
if not line:
raise EOFError()
line = line.strip()
if line.startswith('v '):
# self._vertices.append... | [
"The",
"method",
"that",
"reads",
"a",
"line",
"and",
"processes",
"it",
"."
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/io/wavefront.py#L87-L117 | [
"def",
"readLine",
"(",
"self",
")",
":",
"# Read line",
"line",
"=",
"self",
".",
"_f",
".",
"readline",
"(",
")",
".",
"decode",
"(",
"'ascii'",
",",
"'ignore'",
")",
"if",
"not",
"line",
":",
"raise",
"EOFError",
"(",
")",
"line",
"=",
"line",
"... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | WavefrontReader.readTuple | Reads a tuple of numbers. e.g. vertices, normals or teture coords. | glue_vispy_viewers/extern/vispy/io/wavefront.py | def readTuple(self, line, n=3):
""" Reads a tuple of numbers. e.g. vertices, normals or teture coords.
"""
numbers = [num for num in line.split(' ') if num]
return [float(num) for num in numbers[1:n + 1]] | def readTuple(self, line, n=3):
""" Reads a tuple of numbers. e.g. vertices, normals or teture coords.
"""
numbers = [num for num in line.split(' ') if num]
return [float(num) for num in numbers[1:n + 1]] | [
"Reads",
"a",
"tuple",
"of",
"numbers",
".",
"e",
".",
"g",
".",
"vertices",
"normals",
"or",
"teture",
"coords",
"."
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/io/wavefront.py#L119-L123 | [
"def",
"readTuple",
"(",
"self",
",",
"line",
",",
"n",
"=",
"3",
")",
":",
"numbers",
"=",
"[",
"num",
"for",
"num",
"in",
"line",
".",
"split",
"(",
"' '",
")",
"if",
"num",
"]",
"return",
"[",
"float",
"(",
"num",
")",
"for",
"num",
"in",
... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | WavefrontReader.readFace | Each face consists of three or more sets of indices. Each set
consists of 1, 2 or 3 indices to vertices/normals/texcords. | glue_vispy_viewers/extern/vispy/io/wavefront.py | def readFace(self, line):
""" Each face consists of three or more sets of indices. Each set
consists of 1, 2 or 3 indices to vertices/normals/texcords.
"""
# Get parts (skip first)
indexSets = [num for num in line.split(' ') if num][1:]
final_face = []
for index... | def readFace(self, line):
""" Each face consists of three or more sets of indices. Each set
consists of 1, 2 or 3 indices to vertices/normals/texcords.
"""
# Get parts (skip first)
indexSets = [num for num in line.split(' ') if num][1:]
final_face = []
for index... | [
"Each",
"face",
"consists",
"of",
"three",
"or",
"more",
"sets",
"of",
"indices",
".",
"Each",
"set",
"consists",
"of",
"1",
"2",
"or",
"3",
"indices",
"to",
"vertices",
"/",
"normals",
"/",
"texcords",
"."
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/io/wavefront.py#L125-L183 | [
"def",
"readFace",
"(",
"self",
",",
"line",
")",
":",
"# Get parts (skip first)",
"indexSets",
"=",
"[",
"num",
"for",
"num",
"in",
"line",
".",
"split",
"(",
"' '",
")",
"if",
"num",
"]",
"[",
"1",
":",
"]",
"final_face",
"=",
"[",
"]",
"for",
"i... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | WavefrontReader.finish | Converts gathere lists to numpy arrays and creates
BaseMesh instance. | glue_vispy_viewers/extern/vispy/io/wavefront.py | def finish(self):
""" Converts gathere lists to numpy arrays and creates
BaseMesh instance.
"""
self._vertices = np.array(self._vertices, 'float32')
if self._faces:
self._faces = np.array(self._faces, 'uint32')
else:
# Use vertices only
... | def finish(self):
""" Converts gathere lists to numpy arrays and creates
BaseMesh instance.
"""
self._vertices = np.array(self._vertices, 'float32')
if self._faces:
self._faces = np.array(self._faces, 'uint32')
else:
# Use vertices only
... | [
"Converts",
"gathere",
"lists",
"to",
"numpy",
"arrays",
"and",
"creates",
"BaseMesh",
"instance",
"."
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/io/wavefront.py#L200-L220 | [
"def",
"finish",
"(",
"self",
")",
":",
"self",
".",
"_vertices",
"=",
"np",
".",
"array",
"(",
"self",
".",
"_vertices",
",",
"'float32'",
")",
"if",
"self",
".",
"_faces",
":",
"self",
".",
"_faces",
"=",
"np",
".",
"array",
"(",
"self",
".",
"... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | WavefrontWriter.write | This classmethod is the entry point for writing mesh data to OBJ.
Parameters
----------
fname : string
The filename to write to. Must end with ".obj" or ".gz".
vertices : numpy array
The vertex data
faces : numpy array
The face data
te... | glue_vispy_viewers/extern/vispy/io/wavefront.py | def write(cls, fname, vertices, faces, normals,
texcoords, name='', reshape_faces=True):
""" This classmethod is the entry point for writing mesh data to OBJ.
Parameters
----------
fname : string
The filename to write to. Must end with ".obj" or ".gz".
... | def write(cls, fname, vertices, faces, normals,
texcoords, name='', reshape_faces=True):
""" This classmethod is the entry point for writing mesh data to OBJ.
Parameters
----------
fname : string
The filename to write to. Must end with ".obj" or ".gz".
... | [
"This",
"classmethod",
"is",
"the",
"entry",
"point",
"for",
"writing",
"mesh",
"data",
"to",
"OBJ",
"."
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/io/wavefront.py#L229-L263 | [
"def",
"write",
"(",
"cls",
",",
"fname",
",",
"vertices",
",",
"faces",
",",
"normals",
",",
"texcoords",
",",
"name",
"=",
"''",
",",
"reshape_faces",
"=",
"True",
")",
":",
"# Open file",
"fmt",
"=",
"op",
".",
"splitext",
"(",
"fname",
")",
"[",
... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | WavefrontWriter.writeTuple | Writes a tuple of numbers (on one line). | glue_vispy_viewers/extern/vispy/io/wavefront.py | def writeTuple(self, val, what):
""" Writes a tuple of numbers (on one line).
"""
# Limit to three values. so RGBA data drops the alpha channel
# Format can handle up to 3 texcords
val = val[:3]
# Make string
val = ' '.join([str(v) for v in val])
# Write l... | def writeTuple(self, val, what):
""" Writes a tuple of numbers (on one line).
"""
# Limit to three values. so RGBA data drops the alpha channel
# Format can handle up to 3 texcords
val = val[:3]
# Make string
val = ' '.join([str(v) for v in val])
# Write l... | [
"Writes",
"a",
"tuple",
"of",
"numbers",
"(",
"on",
"one",
"line",
")",
"."
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/io/wavefront.py#L272-L281 | [
"def",
"writeTuple",
"(",
"self",
",",
"val",
",",
"what",
")",
":",
"# Limit to three values. so RGBA data drops the alpha channel",
"# Format can handle up to 3 texcords",
"val",
"=",
"val",
"[",
":",
"3",
"]",
"# Make string",
"val",
"=",
"' '",
".",
"join",
"(",... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | WavefrontWriter.writeFace | Write the face info to the net line. | glue_vispy_viewers/extern/vispy/io/wavefront.py | def writeFace(self, val, what='f'):
""" Write the face info to the net line.
"""
# OBJ counts from 1
val = [v + 1 for v in val]
# Make string
if self._hasValues and self._hasNormals:
val = ' '.join(['%i/%i/%i' % (v, v, v) for v in val])
elif self._hasN... | def writeFace(self, val, what='f'):
""" Write the face info to the net line.
"""
# OBJ counts from 1
val = [v + 1 for v in val]
# Make string
if self._hasValues and self._hasNormals:
val = ' '.join(['%i/%i/%i' % (v, v, v) for v in val])
elif self._hasN... | [
"Write",
"the",
"face",
"info",
"to",
"the",
"net",
"line",
"."
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/io/wavefront.py#L283-L298 | [
"def",
"writeFace",
"(",
"self",
",",
"val",
",",
"what",
"=",
"'f'",
")",
":",
"# OBJ counts from 1",
"val",
"=",
"[",
"v",
"+",
"1",
"for",
"v",
"in",
"val",
"]",
"# Make string",
"if",
"self",
".",
"_hasValues",
"and",
"self",
".",
"_hasNormals",
... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | WavefrontWriter.writeMesh | Write the given mesh instance. | glue_vispy_viewers/extern/vispy/io/wavefront.py | def writeMesh(self, vertices, faces, normals, values,
name='', reshape_faces=True):
""" Write the given mesh instance.
"""
# Store properties
self._hasNormals = normals is not None
self._hasValues = values is not None
self._hasFaces = faces is not None
... | def writeMesh(self, vertices, faces, normals, values,
name='', reshape_faces=True):
""" Write the given mesh instance.
"""
# Store properties
self._hasNormals = normals is not None
self._hasValues = values is not None
self._hasFaces = faces is not None
... | [
"Write",
"the",
"given",
"mesh",
"instance",
"."
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/io/wavefront.py#L300-L363 | [
"def",
"writeMesh",
"(",
"self",
",",
"vertices",
",",
"faces",
",",
"normals",
",",
"values",
",",
"name",
"=",
"''",
",",
"reshape_faces",
"=",
"True",
")",
":",
"# Store properties",
"self",
".",
"_hasNormals",
"=",
"normals",
"is",
"not",
"None",
"se... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | _fast_cross_3d | Compute cross product between list of 3D vectors
Much faster than np.cross() when the number of cross products
becomes large (>500). This is because np.cross() methods become
less memory efficient at this stage.
Parameters
----------
x : array
Input array 1.
y : array
Input... | glue_vispy_viewers/extern/vispy/geometry/calculations.py | def _fast_cross_3d(x, y):
"""Compute cross product between list of 3D vectors
Much faster than np.cross() when the number of cross products
becomes large (>500). This is because np.cross() methods become
less memory efficient at this stage.
Parameters
----------
x : array
Input arr... | def _fast_cross_3d(x, y):
"""Compute cross product between list of 3D vectors
Much faster than np.cross() when the number of cross products
becomes large (>500). This is because np.cross() methods become
less memory efficient at this stage.
Parameters
----------
x : array
Input arr... | [
"Compute",
"cross",
"product",
"between",
"list",
"of",
"3D",
"vectors"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/geometry/calculations.py#L16-L50 | [
"def",
"_fast_cross_3d",
"(",
"x",
",",
"y",
")",
":",
"assert",
"x",
".",
"ndim",
"==",
"2",
"assert",
"y",
".",
"ndim",
"==",
"2",
"assert",
"x",
".",
"shape",
"[",
"1",
"]",
"==",
"3",
"assert",
"y",
".",
"shape",
"[",
"1",
"]",
"==",
"3",... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | _calculate_normals | Efficiently compute vertex normals for triangulated surface | glue_vispy_viewers/extern/vispy/geometry/calculations.py | def _calculate_normals(rr, tris):
"""Efficiently compute vertex normals for triangulated surface"""
# ensure highest precision for our summation/vectorization "trick"
rr = rr.astype(np.float64)
# first, compute triangle normals
r1 = rr[tris[:, 0], :]
r2 = rr[tris[:, 1], :]
r3 = rr[tris[:, 2]... | def _calculate_normals(rr, tris):
"""Efficiently compute vertex normals for triangulated surface"""
# ensure highest precision for our summation/vectorization "trick"
rr = rr.astype(np.float64)
# first, compute triangle normals
r1 = rr[tris[:, 0], :]
r2 = rr[tris[:, 1], :]
r3 = rr[tris[:, 2]... | [
"Efficiently",
"compute",
"vertex",
"normals",
"for",
"triangulated",
"surface"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/geometry/calculations.py#L53-L83 | [
"def",
"_calculate_normals",
"(",
"rr",
",",
"tris",
")",
":",
"# ensure highest precision for our summation/vectorization \"trick\"",
"rr",
"=",
"rr",
".",
"astype",
"(",
"np",
".",
"float64",
")",
"# first, compute triangle normals",
"r1",
"=",
"rr",
"[",
"tris",
... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | resize | Resize an image
Parameters
----------
image : ndarray
Array of shape (N, M, ...).
shape : tuple
2-element shape.
kind : str
Interpolation, either "linear" or "nearest".
Returns
-------
scaled_image : ndarray
New image, will have dtype np.float64. | glue_vispy_viewers/extern/vispy/geometry/calculations.py | def resize(image, shape, kind='linear'):
"""Resize an image
Parameters
----------
image : ndarray
Array of shape (N, M, ...).
shape : tuple
2-element shape.
kind : str
Interpolation, either "linear" or "nearest".
Returns
-------
scaled_image : ndarray
... | def resize(image, shape, kind='linear'):
"""Resize an image
Parameters
----------
image : ndarray
Array of shape (N, M, ...).
shape : tuple
2-element shape.
kind : str
Interpolation, either "linear" or "nearest".
Returns
-------
scaled_image : ndarray
... | [
"Resize",
"an",
"image"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/geometry/calculations.py#L86-L137 | [
"def",
"resize",
"(",
"image",
",",
"shape",
",",
"kind",
"=",
"'linear'",
")",
":",
"image",
"=",
"np",
".",
"array",
"(",
"image",
",",
"float",
")",
"shape",
"=",
"np",
".",
"array",
"(",
"shape",
",",
"int",
")",
"if",
"shape",
".",
"ndim",
... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | RawSegmentCollection.append | Append a new set of segments to the collection.
For kwargs argument, n is the number of vertices (local) or the number
of item (shared)
Parameters
----------
P : np.array
Vertices positions of the path(s) to be added
closed: bool
Whether path(s... | glue_vispy_viewers/extern/vispy/visuals/collections/raw_segment_collection.py | def append(self, P0, P1, itemsize=None, **kwargs):
"""
Append a new set of segments to the collection.
For kwargs argument, n is the number of vertices (local) or the number
of item (shared)
Parameters
----------
P : np.array
Vertices positions of t... | def append(self, P0, P1, itemsize=None, **kwargs):
"""
Append a new set of segments to the collection.
For kwargs argument, n is the number of vertices (local) or the number
of item (shared)
Parameters
----------
P : np.array
Vertices positions of t... | [
"Append",
"a",
"new",
"set",
"of",
"segments",
"to",
"the",
"collection",
"."
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/collections/raw_segment_collection.py#L71-L117 | [
"def",
"append",
"(",
"self",
",",
"P0",
",",
"P1",
",",
"itemsize",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"itemsize",
"=",
"itemsize",
"or",
"1",
"itemcount",
"=",
"len",
"(",
"P0",
")",
"/",
"itemsize",
"V",
"=",
"np",
".",
"empty",
... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | ScreenPattern.parse | Parse the lines, and fill self.line_fields accordingly. | mpdlcd/display_pattern.py | def parse(self):
"""Parse the lines, and fill self.line_fields accordingly."""
for line in self.lines:
# Parse the line
field_defs = self.parse_line(line)
fields = []
# Convert field parameters into Field objects
for (kind, options) in field_d... | def parse(self):
"""Parse the lines, and fill self.line_fields accordingly."""
for line in self.lines:
# Parse the line
field_defs = self.parse_line(line)
fields = []
# Convert field parameters into Field objects
for (kind, options) in field_d... | [
"Parse",
"the",
"lines",
"and",
"fill",
"self",
".",
"line_fields",
"accordingly",
"."
] | rbarrois/mpdlcd | python | https://github.com/rbarrois/mpdlcd/blob/85f16c8cc0883f8abb4c2cc7f69729c3e2f857da/mpdlcd/display_pattern.py#L42-L59 | [
"def",
"parse",
"(",
"self",
")",
":",
"for",
"line",
"in",
"self",
".",
"lines",
":",
"# Parse the line",
"field_defs",
"=",
"self",
".",
"parse_line",
"(",
"line",
")",
"fields",
"=",
"[",
"]",
"# Convert field parameters into Field objects",
"for",
"(",
"... | 85f16c8cc0883f8abb4c2cc7f69729c3e2f857da |
train | ScreenPattern.compute_positions | Compute the relative position of the fields on a given line.
Args:
screen_width (int): the width of the screen
line (mpdlcd.display_fields.Field list): the list of fields on the
line
Returns:
((int, mpdlcd.display_fields.Field) list): the positions o... | mpdlcd/display_pattern.py | def compute_positions(cls, screen_width, line):
"""Compute the relative position of the fields on a given line.
Args:
screen_width (int): the width of the screen
line (mpdlcd.display_fields.Field list): the list of fields on the
line
Returns:
... | def compute_positions(cls, screen_width, line):
"""Compute the relative position of the fields on a given line.
Args:
screen_width (int): the width of the screen
line (mpdlcd.display_fields.Field list): the list of fields on the
line
Returns:
... | [
"Compute",
"the",
"relative",
"position",
"of",
"the",
"fields",
"on",
"a",
"given",
"line",
"."
] | rbarrois/mpdlcd | python | https://github.com/rbarrois/mpdlcd/blob/85f16c8cc0883f8abb4c2cc7f69729c3e2f857da/mpdlcd/display_pattern.py#L67-L126 | [
"def",
"compute_positions",
"(",
"cls",
",",
"screen_width",
",",
"line",
")",
":",
"# First index",
"left",
"=",
"1",
"# Last index",
"right",
"=",
"screen_width",
"+",
"1",
"# Current 'flexible' field",
"flexible",
"=",
"None",
"# Compute the space to the left and t... | 85f16c8cc0883f8abb4c2cc7f69729c3e2f857da |
train | ScreenPattern.add_to_screen | Add the pattern to a screen.
Also fills self.widgets.
Args:
screen_width (int): the width of the screen
screen (lcdprod.Screen): the screen to fill. | mpdlcd/display_pattern.py | def add_to_screen(self, screen_width, screen):
"""Add the pattern to a screen.
Also fills self.widgets.
Args:
screen_width (int): the width of the screen
screen (lcdprod.Screen): the screen to fill.
"""
for lineno, fields in enumerate(self.line_fields):
... | def add_to_screen(self, screen_width, screen):
"""Add the pattern to a screen.
Also fills self.widgets.
Args:
screen_width (int): the width of the screen
screen (lcdprod.Screen): the screen to fill.
"""
for lineno, fields in enumerate(self.line_fields):
... | [
"Add",
"the",
"pattern",
"to",
"a",
"screen",
"."
] | rbarrois/mpdlcd | python | https://github.com/rbarrois/mpdlcd/blob/85f16c8cc0883f8abb4c2cc7f69729c3e2f857da/mpdlcd/display_pattern.py#L128-L145 | [
"def",
"add_to_screen",
"(",
"self",
",",
"screen_width",
",",
"screen",
")",
":",
"for",
"lineno",
",",
"fields",
"in",
"enumerate",
"(",
"self",
".",
"line_fields",
")",
":",
"for",
"left",
",",
"field",
"in",
"self",
".",
"compute_positions",
"(",
"sc... | 85f16c8cc0883f8abb4c2cc7f69729c3e2f857da |
train | ScreenPattern.register_hooks | Register a field on its target hooks. | mpdlcd/display_pattern.py | def register_hooks(self, field):
"""Register a field on its target hooks."""
for hook, subhooks in field.register_hooks():
self.hooks[hook].append(field)
self.subhooks[hook] |= set(subhooks) | def register_hooks(self, field):
"""Register a field on its target hooks."""
for hook, subhooks in field.register_hooks():
self.hooks[hook].append(field)
self.subhooks[hook] |= set(subhooks) | [
"Register",
"a",
"field",
"on",
"its",
"target",
"hooks",
"."
] | rbarrois/mpdlcd | python | https://github.com/rbarrois/mpdlcd/blob/85f16c8cc0883f8abb4c2cc7f69729c3e2f857da/mpdlcd/display_pattern.py#L147-L151 | [
"def",
"register_hooks",
"(",
"self",
",",
"field",
")",
":",
"for",
"hook",
",",
"subhooks",
"in",
"field",
".",
"register_hooks",
"(",
")",
":",
"self",
".",
"hooks",
"[",
"hook",
"]",
".",
"append",
"(",
"field",
")",
"self",
".",
"subhooks",
"[",... | 85f16c8cc0883f8abb4c2cc7f69729c3e2f857da |
train | ScreenPattern.hook_changed | Called whenever the data for a hook changed. | mpdlcd/display_pattern.py | def hook_changed(self, hook, new_data):
"""Called whenever the data for a hook changed."""
for field in self.hooks[hook]:
widget = self.widgets[field]
field.hook_changed(hook, widget, new_data) | def hook_changed(self, hook, new_data):
"""Called whenever the data for a hook changed."""
for field in self.hooks[hook]:
widget = self.widgets[field]
field.hook_changed(hook, widget, new_data) | [
"Called",
"whenever",
"the",
"data",
"for",
"a",
"hook",
"changed",
"."
] | rbarrois/mpdlcd | python | https://github.com/rbarrois/mpdlcd/blob/85f16c8cc0883f8abb4c2cc7f69729c3e2f857da/mpdlcd/display_pattern.py#L153-L157 | [
"def",
"hook_changed",
"(",
"self",
",",
"hook",
",",
"new_data",
")",
":",
"for",
"field",
"in",
"self",
".",
"hooks",
"[",
"hook",
"]",
":",
"widget",
"=",
"self",
".",
"widgets",
"[",
"field",
"]",
"field",
".",
"hook_changed",
"(",
"hook",
",",
... | 85f16c8cc0883f8abb4c2cc7f69729c3e2f857da |
train | ScreenPattern.parse_line | Parse a line of text.
A format contains fields, within curly brackets, and free text.
Maximum one 'variable width' field is allowed per line.
You cannot use the '{' or '}' characters in the various text/... fields.
Format:
'''{<field_kind>[ <field_option>,<field_option]} te... | mpdlcd/display_pattern.py | def parse_line(self, line):
"""Parse a line of text.
A format contains fields, within curly brackets, and free text.
Maximum one 'variable width' field is allowed per line.
You cannot use the '{' or '}' characters in the various text/... fields.
Format:
'''{<field_k... | def parse_line(self, line):
"""Parse a line of text.
A format contains fields, within curly brackets, and free text.
Maximum one 'variable width' field is allowed per line.
You cannot use the '{' or '}' characters in the various text/... fields.
Format:
'''{<field_k... | [
"Parse",
"a",
"line",
"of",
"text",
"."
] | rbarrois/mpdlcd | python | https://github.com/rbarrois/mpdlcd/blob/85f16c8cc0883f8abb4c2cc7f69729c3e2f857da/mpdlcd/display_pattern.py#L163-L424 | [
"def",
"parse_line",
"(",
"self",
",",
"line",
")",
":",
"logger",
".",
"debug",
"(",
"'Parsing line %s'",
",",
"line",
")",
"OUT_FIELD",
"=",
"0",
"IN_FIELD_KIND",
"=",
"1",
"IN_FIELD_OPTION_NAME",
"=",
"2",
"IN_FIELD_OPTION_VALUE",
"=",
"3",
"class",
"Pars... | 85f16c8cc0883f8abb4c2cc7f69729c3e2f857da |
train | ScreenPatternList.add | Add a pattern to the list.
Args:
pattern_txt (str list): the pattern, as a list of lines. | mpdlcd/display_pattern.py | def add(self, pattern_txt):
"""Add a pattern to the list.
Args:
pattern_txt (str list): the pattern, as a list of lines.
"""
self.patterns[len(pattern_txt)] = pattern_txt
low = 0
high = len(pattern_txt) - 1
while not pattern_txt[low]:
lo... | def add(self, pattern_txt):
"""Add a pattern to the list.
Args:
pattern_txt (str list): the pattern, as a list of lines.
"""
self.patterns[len(pattern_txt)] = pattern_txt
low = 0
high = len(pattern_txt) - 1
while not pattern_txt[low]:
lo... | [
"Add",
"a",
"pattern",
"to",
"the",
"list",
"."
] | rbarrois/mpdlcd | python | https://github.com/rbarrois/mpdlcd/blob/85f16c8cc0883f8abb4c2cc7f69729c3e2f857da/mpdlcd/display_pattern.py#L446-L464 | [
"def",
"add",
"(",
"self",
",",
"pattern_txt",
")",
":",
"self",
".",
"patterns",
"[",
"len",
"(",
"pattern_txt",
")",
"]",
"=",
"pattern_txt",
"low",
"=",
"0",
"high",
"=",
"len",
"(",
"pattern_txt",
")",
"-",
"1",
"while",
"not",
"pattern_txt",
"["... | 85f16c8cc0883f8abb4c2cc7f69729c3e2f857da |
train | _arcball | Convert x,y coordinates to w,x,y,z Quaternion parameters
Adapted from:
linalg library
Copyright (c) 2010-2015, Renaud Blanch <rndblnch at gmail dot com>
Licence at your convenience:
GPLv3 or higher <http://www.gnu.org/licenses/gpl.html>
BSD new <http://opensource.org/licenses/BSD-3-Clause> | glue_vispy_viewers/extern/vispy/scene/cameras/arcball.py | def _arcball(xy, wh):
"""Convert x,y coordinates to w,x,y,z Quaternion parameters
Adapted from:
linalg library
Copyright (c) 2010-2015, Renaud Blanch <rndblnch at gmail dot com>
Licence at your convenience:
GPLv3 or higher <http://www.gnu.org/licenses/gpl.html>
BSD new <http://opensource.... | def _arcball(xy, wh):
"""Convert x,y coordinates to w,x,y,z Quaternion parameters
Adapted from:
linalg library
Copyright (c) 2010-2015, Renaud Blanch <rndblnch at gmail dot com>
Licence at your convenience:
GPLv3 or higher <http://www.gnu.org/licenses/gpl.html>
BSD new <http://opensource.... | [
"Convert",
"x",
"y",
"coordinates",
"to",
"w",
"x",
"y",
"z",
"Quaternion",
"parameters"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/scene/cameras/arcball.py#L84-L101 | [
"def",
"_arcball",
"(",
"xy",
",",
"wh",
")",
":",
"x",
",",
"y",
"=",
"xy",
"w",
",",
"h",
"=",
"wh",
"r",
"=",
"(",
"w",
"+",
"h",
")",
"/",
"2.",
"x",
",",
"y",
"=",
"-",
"(",
"2.",
"*",
"x",
"-",
"w",
")",
"/",
"r",
",",
"(",
... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | ArcballCamera._update_rotation | Update rotation parmeters based on mouse movement | glue_vispy_viewers/extern/vispy/scene/cameras/arcball.py | def _update_rotation(self, event):
"""Update rotation parmeters based on mouse movement"""
p2 = event.mouse_event.pos
if self._event_value is None:
self._event_value = p2
wh = self._viewbox.size
self._quaternion = (Quaternion(*_arcball(p2, wh)) *
... | def _update_rotation(self, event):
"""Update rotation parmeters based on mouse movement"""
p2 = event.mouse_event.pos
if self._event_value is None:
self._event_value = p2
wh = self._viewbox.size
self._quaternion = (Quaternion(*_arcball(p2, wh)) *
... | [
"Update",
"rotation",
"parmeters",
"based",
"on",
"mouse",
"movement"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/scene/cameras/arcball.py#L53-L63 | [
"def",
"_update_rotation",
"(",
"self",
",",
"event",
")",
":",
"p2",
"=",
"event",
".",
"mouse_event",
".",
"pos",
"if",
"self",
".",
"_event_value",
"is",
"None",
":",
"self",
".",
"_event_value",
"=",
"p2",
"wh",
"=",
"self",
".",
"_viewbox",
".",
... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | ArcballCamera._rotate_tr | Rotate the transformation matrix based on camera parameters | glue_vispy_viewers/extern/vispy/scene/cameras/arcball.py | def _rotate_tr(self):
"""Rotate the transformation matrix based on camera parameters"""
rot, x, y, z = self._quaternion.get_axis_angle()
up, forward, right = self._get_dim_vectors()
self.transform.rotate(180 * rot / np.pi, (x, z, y)) | def _rotate_tr(self):
"""Rotate the transformation matrix based on camera parameters"""
rot, x, y, z = self._quaternion.get_axis_angle()
up, forward, right = self._get_dim_vectors()
self.transform.rotate(180 * rot / np.pi, (x, z, y)) | [
"Rotate",
"the",
"transformation",
"matrix",
"based",
"on",
"camera",
"parameters"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/scene/cameras/arcball.py#L65-L69 | [
"def",
"_rotate_tr",
"(",
"self",
")",
":",
"rot",
",",
"x",
",",
"y",
",",
"z",
"=",
"self",
".",
"_quaternion",
".",
"get_axis_angle",
"(",
")",
"up",
",",
"forward",
",",
"right",
"=",
"self",
".",
"_get_dim_vectors",
"(",
")",
"self",
".",
"tra... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | ArcballCamera._dist_to_trans | Convert mouse x, y movement into x, y, z translations | glue_vispy_viewers/extern/vispy/scene/cameras/arcball.py | def _dist_to_trans(self, dist):
"""Convert mouse x, y movement into x, y, z translations"""
rot, x, y, z = self._quaternion.get_axis_angle()
tr = MatrixTransform()
tr.rotate(180 * rot / np.pi, (x, y, z))
dx, dz, dy = np.dot(tr.matrix[:3, :3], (dist[0], dist[1], 0.))
retur... | def _dist_to_trans(self, dist):
"""Convert mouse x, y movement into x, y, z translations"""
rot, x, y, z = self._quaternion.get_axis_angle()
tr = MatrixTransform()
tr.rotate(180 * rot / np.pi, (x, y, z))
dx, dz, dy = np.dot(tr.matrix[:3, :3], (dist[0], dist[1], 0.))
retur... | [
"Convert",
"mouse",
"x",
"y",
"movement",
"into",
"x",
"y",
"z",
"translations"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/scene/cameras/arcball.py#L71-L77 | [
"def",
"_dist_to_trans",
"(",
"self",
",",
"dist",
")",
":",
"rot",
",",
"x",
",",
"y",
",",
"z",
"=",
"self",
".",
"_quaternion",
".",
"get_axis_angle",
"(",
")",
"tr",
"=",
"MatrixTransform",
"(",
")",
"tr",
".",
"rotate",
"(",
"180",
"*",
"rot",... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | arg_to_array | Decorator to convert argument to array.
Parameters
----------
func : function
The function to decorate.
Returns
-------
func : function
The decorated function. | glue_vispy_viewers/extern/vispy/visuals/transforms/_util.py | def arg_to_array(func):
"""
Decorator to convert argument to array.
Parameters
----------
func : function
The function to decorate.
Returns
-------
func : function
The decorated function.
"""
def fn(self, arg, *args, **kwargs):
"""Function
Param... | def arg_to_array(func):
"""
Decorator to convert argument to array.
Parameters
----------
func : function
The function to decorate.
Returns
-------
func : function
The decorated function.
"""
def fn(self, arg, *args, **kwargs):
"""Function
Param... | [
"Decorator",
"to",
"convert",
"argument",
"to",
"array",
"."
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/transforms/_util.py#L12-L44 | [
"def",
"arg_to_array",
"(",
"func",
")",
":",
"def",
"fn",
"(",
"self",
",",
"arg",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"\"\"\"Function\n\n Parameters\n ----------\n arg : array-like\n Argument to convert.\n *args : tu... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | as_vec4 | Convert `obj` to 4-element vector (numpy array with shape[-1] == 4)
Parameters
----------
obj : array-like
Original object.
default : array-like
The defaults to use if the object does not have 4 entries.
Returns
-------
obj : array-like
The object promoted to have 4... | glue_vispy_viewers/extern/vispy/visuals/transforms/_util.py | def as_vec4(obj, default=(0, 0, 0, 1)):
"""
Convert `obj` to 4-element vector (numpy array with shape[-1] == 4)
Parameters
----------
obj : array-like
Original object.
default : array-like
The defaults to use if the object does not have 4 entries.
Returns
-------
ob... | def as_vec4(obj, default=(0, 0, 0, 1)):
"""
Convert `obj` to 4-element vector (numpy array with shape[-1] == 4)
Parameters
----------
obj : array-like
Original object.
default : array-like
The defaults to use if the object does not have 4 entries.
Returns
-------
ob... | [
"Convert",
"obj",
"to",
"4",
"-",
"element",
"vector",
"(",
"numpy",
"array",
"with",
"shape",
"[",
"-",
"1",
"]",
"==",
"4",
")"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/transforms/_util.py#L47-L82 | [
"def",
"as_vec4",
"(",
"obj",
",",
"default",
"=",
"(",
"0",
",",
"0",
",",
"0",
",",
"1",
")",
")",
":",
"obj",
"=",
"np",
".",
"atleast_2d",
"(",
"obj",
")",
"# For multiple vectors, reshape to (..., 4)",
"if",
"obj",
".",
"shape",
"[",
"-",
"1",
... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | arg_to_vec4 | Decorator for converting argument to vec4 format suitable for 4x4 matrix
multiplication.
[x, y] => [[x, y, 0, 1]]
[x, y, z] => [[x, y, z, 1]]
[[x1, y1], [[x1, y1, 0, 1],
[x2, y2], => [x2, y2, 0, 1],
[x3, y3]] [x3, y3, 0, 1]]
If 1D input is provided, then the retu... | glue_vispy_viewers/extern/vispy/visuals/transforms/_util.py | def arg_to_vec4(func, self_, arg, *args, **kwargs):
"""
Decorator for converting argument to vec4 format suitable for 4x4 matrix
multiplication.
[x, y] => [[x, y, 0, 1]]
[x, y, z] => [[x, y, z, 1]]
[[x1, y1], [[x1, y1, 0, 1],
[x2, y2], => [x2, y2, 0, 1],
[x3, y3]] ... | def arg_to_vec4(func, self_, arg, *args, **kwargs):
"""
Decorator for converting argument to vec4 format suitable for 4x4 matrix
multiplication.
[x, y] => [[x, y, 0, 1]]
[x, y, z] => [[x, y, z, 1]]
[[x1, y1], [[x1, y1, 0, 1],
[x2, y2], => [x2, y2, 0, 1],
[x3, y3]] ... | [
"Decorator",
"for",
"converting",
"argument",
"to",
"vec4",
"format",
"suitable",
"for",
"4x4",
"matrix",
"multiplication",
"."
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/transforms/_util.py#L86-L122 | [
"def",
"arg_to_vec4",
"(",
"func",
",",
"self_",
",",
"arg",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"isinstance",
"(",
"arg",
",",
"(",
"tuple",
",",
"list",
",",
"np",
".",
"ndarray",
")",
")",
":",
"arg",
"=",
"np",
".",
... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | TransformCache.get | Get a transform from the cache that maps along *path*, which must
be a list of Transforms to apply in reverse order (last transform is
applied first).
Accessed items have their age reset to 0. | glue_vispy_viewers/extern/vispy/visuals/transforms/_util.py | def get(self, path):
""" Get a transform from the cache that maps along *path*, which must
be a list of Transforms to apply in reverse order (last transform is
applied first).
Accessed items have their age reset to 0.
"""
key = tuple(map(id, path))
item = self._c... | def get(self, path):
""" Get a transform from the cache that maps along *path*, which must
be a list of Transforms to apply in reverse order (last transform is
applied first).
Accessed items have their age reset to 0.
"""
key = tuple(map(id, path))
item = self._c... | [
"Get",
"a",
"transform",
"from",
"the",
"cache",
"that",
"maps",
"along",
"*",
"path",
"*",
"which",
"must",
"be",
"a",
"list",
"of",
"Transforms",
"to",
"apply",
"in",
"reverse",
"order",
"(",
"last",
"transform",
"is",
"applied",
"first",
")",
"."
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/transforms/_util.py#L143-L164 | [
"def",
"get",
"(",
"self",
",",
"path",
")",
":",
"key",
"=",
"tuple",
"(",
"map",
"(",
"id",
",",
"path",
")",
")",
"item",
"=",
"self",
".",
"_cache",
".",
"get",
"(",
"key",
",",
"None",
")",
"if",
"item",
"is",
"None",
":",
"logger",
".",... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | TransformCache.roll | Increase the age of all items in the cache by 1. Items whose age
is greater than self.max_age will be removed from the cache. | glue_vispy_viewers/extern/vispy/visuals/transforms/_util.py | def roll(self):
""" Increase the age of all items in the cache by 1. Items whose age
is greater than self.max_age will be removed from the cache.
"""
rem = []
for key, item in self._cache.items():
if item[0] > self.max_age:
rem.append(key)
... | def roll(self):
""" Increase the age of all items in the cache by 1. Items whose age
is greater than self.max_age will be removed from the cache.
"""
rem = []
for key, item in self._cache.items():
if item[0] > self.max_age:
rem.append(key)
... | [
"Increase",
"the",
"age",
"of",
"all",
"items",
"in",
"the",
"cache",
"by",
"1",
".",
"Items",
"whose",
"age",
"is",
"greater",
"than",
"self",
".",
"max_age",
"will",
"be",
"removed",
"from",
"the",
"cache",
"."
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/transforms/_util.py#L171-L183 | [
"def",
"roll",
"(",
"self",
")",
":",
"rem",
"=",
"[",
"]",
"for",
"key",
",",
"item",
"in",
"self",
".",
"_cache",
".",
"items",
"(",
")",
":",
"if",
"item",
"[",
"0",
"]",
">",
"self",
".",
"max_age",
":",
"rem",
".",
"append",
"(",
"key",
... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | PlotWidget.histogram | Calculate and show a histogram of data
Parameters
----------
data : array-like
Data to histogram. Currently only 1D data is supported.
bins : int | array-like
Number of bins, or bin edges.
color : instance of Color
Color of the histogram.
... | glue_vispy_viewers/extern/vispy/plot/plotwidget.py | def histogram(self, data, bins=10, color='w', orientation='h'):
"""Calculate and show a histogram of data
Parameters
----------
data : array-like
Data to histogram. Currently only 1D data is supported.
bins : int | array-like
Number of bins, or bin edges.... | def histogram(self, data, bins=10, color='w', orientation='h'):
"""Calculate and show a histogram of data
Parameters
----------
data : array-like
Data to histogram. Currently only 1D data is supported.
bins : int | array-like
Number of bins, or bin edges.... | [
"Calculate",
"and",
"show",
"a",
"histogram",
"of",
"data"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/plot/plotwidget.py#L159-L182 | [
"def",
"histogram",
"(",
"self",
",",
"data",
",",
"bins",
"=",
"10",
",",
"color",
"=",
"'w'",
",",
"orientation",
"=",
"'h'",
")",
":",
"self",
".",
"_configure_2d",
"(",
")",
"hist",
"=",
"scene",
".",
"Histogram",
"(",
"data",
",",
"bins",
",",... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | PlotWidget.image | Show an image
Parameters
----------
data : ndarray
Should have shape (N, M), (N, M, 3) or (N, M, 4).
cmap : str
Colormap name.
clim : str | tuple
Colormap limits. Should be ``'auto'`` or a two-element tuple of
min and max values.
... | glue_vispy_viewers/extern/vispy/plot/plotwidget.py | def image(self, data, cmap='cubehelix', clim='auto', fg_color=None):
"""Show an image
Parameters
----------
data : ndarray
Should have shape (N, M), (N, M, 3) or (N, M, 4).
cmap : str
Colormap name.
clim : str | tuple
Colormap limits. ... | def image(self, data, cmap='cubehelix', clim='auto', fg_color=None):
"""Show an image
Parameters
----------
data : ndarray
Should have shape (N, M), (N, M, 3) or (N, M, 4).
cmap : str
Colormap name.
clim : str | tuple
Colormap limits. ... | [
"Show",
"an",
"image"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/plot/plotwidget.py#L184-L214 | [
"def",
"image",
"(",
"self",
",",
"data",
",",
"cmap",
"=",
"'cubehelix'",
",",
"clim",
"=",
"'auto'",
",",
"fg_color",
"=",
"None",
")",
":",
"self",
".",
"_configure_2d",
"(",
"fg_color",
")",
"image",
"=",
"scene",
".",
"Image",
"(",
"data",
",",
... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | PlotWidget.mesh | Show a 3D mesh
Parameters
----------
vertices : array
Vertices.
faces : array | None
Face definitions.
vertex_colors : array | None
Vertex colors.
face_colors : array | None
Face colors.
color : instance of Color
... | glue_vispy_viewers/extern/vispy/plot/plotwidget.py | def mesh(self, vertices=None, faces=None, vertex_colors=None,
face_colors=None, color=(0.5, 0.5, 1.), fname=None,
meshdata=None):
"""Show a 3D mesh
Parameters
----------
vertices : array
Vertices.
faces : array | None
Face defini... | def mesh(self, vertices=None, faces=None, vertex_colors=None,
face_colors=None, color=(0.5, 0.5, 1.), fname=None,
meshdata=None):
"""Show a 3D mesh
Parameters
----------
vertices : array
Vertices.
faces : array | None
Face defini... | [
"Show",
"a",
"3D",
"mesh"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/plot/plotwidget.py#L216-L262 | [
"def",
"mesh",
"(",
"self",
",",
"vertices",
"=",
"None",
",",
"faces",
"=",
"None",
",",
"vertex_colors",
"=",
"None",
",",
"face_colors",
"=",
"None",
",",
"color",
"=",
"(",
"0.5",
",",
"0.5",
",",
"1.",
")",
",",
"fname",
"=",
"None",
",",
"m... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | PlotWidget.plot | Plot a series of data using lines and markers
Parameters
----------
data : array | two arrays
Arguments can be passed as ``(Y,)``, ``(X, Y)`` or
``np.array((X, Y))``.
color : instance of Color
Color of the line.
symbol : str
Marker... | glue_vispy_viewers/extern/vispy/plot/plotwidget.py | def plot(self, data, color='k', symbol=None, line_kind='-', width=1.,
marker_size=10., edge_color='k', face_color='b', edge_width=1.,
title=None, xlabel=None, ylabel=None):
"""Plot a series of data using lines and markers
Parameters
----------
data : array | tw... | def plot(self, data, color='k', symbol=None, line_kind='-', width=1.,
marker_size=10., edge_color='k', face_color='b', edge_width=1.,
title=None, xlabel=None, ylabel=None):
"""Plot a series of data using lines and markers
Parameters
----------
data : array | tw... | [
"Plot",
"a",
"series",
"of",
"data",
"using",
"lines",
"and",
"markers"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/plot/plotwidget.py#L264-L325 | [
"def",
"plot",
"(",
"self",
",",
"data",
",",
"color",
"=",
"'k'",
",",
"symbol",
"=",
"None",
",",
"line_kind",
"=",
"'-'",
",",
"width",
"=",
"1.",
",",
"marker_size",
"=",
"10.",
",",
"edge_color",
"=",
"'k'",
",",
"face_color",
"=",
"'b'",
",",... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | PlotWidget.spectrogram | Calculate and show a spectrogram
Parameters
----------
x : array-like
1D signal to operate on. ``If len(x) < n_fft``, x will be
zero-padded to length ``n_fft``.
n_fft : int
Number of FFT points. Much faster for powers of two.
step : int | None... | glue_vispy_viewers/extern/vispy/plot/plotwidget.py | def spectrogram(self, x, n_fft=256, step=None, fs=1., window='hann',
color_scale='log', cmap='cubehelix', clim='auto'):
"""Calculate and show a spectrogram
Parameters
----------
x : array-like
1D signal to operate on. ``If len(x) < n_fft``, x will be
... | def spectrogram(self, x, n_fft=256, step=None, fs=1., window='hann',
color_scale='log', cmap='cubehelix', clim='auto'):
"""Calculate and show a spectrogram
Parameters
----------
x : array-like
1D signal to operate on. ``If len(x) < n_fft``, x will be
... | [
"Calculate",
"and",
"show",
"a",
"spectrogram"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/plot/plotwidget.py#L327-L370 | [
"def",
"spectrogram",
"(",
"self",
",",
"x",
",",
"n_fft",
"=",
"256",
",",
"step",
"=",
"None",
",",
"fs",
"=",
"1.",
",",
"window",
"=",
"'hann'",
",",
"color_scale",
"=",
"'log'",
",",
"cmap",
"=",
"'cubehelix'",
",",
"clim",
"=",
"'auto'",
")",... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | PlotWidget.volume | Show a 3D volume
Parameters
----------
vol : ndarray
Volume to render.
clim : tuple of two floats | None
The contrast limits. The values in the volume are mapped to
black and white corresponding to these values. Default maps
between min an... | glue_vispy_viewers/extern/vispy/plot/plotwidget.py | def volume(self, vol, clim=None, method='mip', threshold=None,
cmap='grays'):
"""Show a 3D volume
Parameters
----------
vol : ndarray
Volume to render.
clim : tuple of two floats | None
The contrast limits. The values in the volume are mapp... | def volume(self, vol, clim=None, method='mip', threshold=None,
cmap='grays'):
"""Show a 3D volume
Parameters
----------
vol : ndarray
Volume to render.
clim : tuple of two floats | None
The contrast limits. The values in the volume are mapp... | [
"Show",
"a",
"3D",
"volume"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/plot/plotwidget.py#L372-L406 | [
"def",
"volume",
"(",
"self",
",",
"vol",
",",
"clim",
"=",
"None",
",",
"method",
"=",
"'mip'",
",",
"threshold",
"=",
"None",
",",
"cmap",
"=",
"'grays'",
")",
":",
"self",
".",
"_configure_3d",
"(",
")",
"volume",
"=",
"scene",
".",
"Volume",
"(... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | PlotWidget.surface | Show a 3D surface plot.
Extra keyword arguments are passed to `SurfacePlot()`.
Parameters
----------
zdata : array-like
A 2D array of the surface Z values. | glue_vispy_viewers/extern/vispy/plot/plotwidget.py | def surface(self, zdata, **kwargs):
"""Show a 3D surface plot.
Extra keyword arguments are passed to `SurfacePlot()`.
Parameters
----------
zdata : array-like
A 2D array of the surface Z values.
"""
self._configure_3d()
surf = scene.SurfaceP... | def surface(self, zdata, **kwargs):
"""Show a 3D surface plot.
Extra keyword arguments are passed to `SurfacePlot()`.
Parameters
----------
zdata : array-like
A 2D array of the surface Z values.
"""
self._configure_3d()
surf = scene.SurfaceP... | [
"Show",
"a",
"3D",
"surface",
"plot",
"."
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/plot/plotwidget.py#L408-L423 | [
"def",
"surface",
"(",
"self",
",",
"zdata",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"_configure_3d",
"(",
")",
"surf",
"=",
"scene",
".",
"SurfacePlot",
"(",
"z",
"=",
"zdata",
",",
"*",
"*",
"kwargs",
")",
"self",
".",
"view",
".",
"add... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | PlotWidget.colorbar | Show a ColorBar
Parameters
----------
cmap : str | vispy.color.ColorMap
Either the name of the ColorMap to be used from the standard
set of names (refer to `vispy.color.get_colormap`),
or a custom ColorMap object.
The ColorMap is used to apply a g... | glue_vispy_viewers/extern/vispy/plot/plotwidget.py | def colorbar(self, cmap, position="right",
label="", clim=("", ""),
border_width=0.0, border_color="black",
**kwargs):
"""Show a ColorBar
Parameters
----------
cmap : str | vispy.color.ColorMap
Either the name of the ColorMa... | def colorbar(self, cmap, position="right",
label="", clim=("", ""),
border_width=0.0, border_color="black",
**kwargs):
"""Show a ColorBar
Parameters
----------
cmap : str | vispy.color.ColorMap
Either the name of the ColorMa... | [
"Show",
"a",
"ColorBar"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/plot/plotwidget.py#L425-L499 | [
"def",
"colorbar",
"(",
"self",
",",
"cmap",
",",
"position",
"=",
"\"right\"",
",",
"label",
"=",
"\"\"",
",",
"clim",
"=",
"(",
"\"\"",
",",
"\"\"",
")",
",",
"border_width",
"=",
"0.0",
",",
"border_color",
"=",
"\"black\"",
",",
"*",
"*",
"kwargs... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | ScatterLayerArtist.redraw | Redraw the Vispy canvas | glue_vispy_viewers/scatter/layer_artist.py | def redraw(self):
"""
Redraw the Vispy canvas
"""
if self._multiscat is not None:
self._multiscat._update()
self.vispy_widget.canvas.update() | def redraw(self):
"""
Redraw the Vispy canvas
"""
if self._multiscat is not None:
self._multiscat._update()
self.vispy_widget.canvas.update() | [
"Redraw",
"the",
"Vispy",
"canvas"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/scatter/layer_artist.py#L96-L102 | [
"def",
"redraw",
"(",
"self",
")",
":",
"if",
"self",
".",
"_multiscat",
"is",
"not",
"None",
":",
"self",
".",
"_multiscat",
".",
"_update",
"(",
")",
"self",
".",
"vispy_widget",
".",
"canvas",
".",
"update",
"(",
")"
] | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | ScatterLayerArtist.remove | Remove the layer artist from the visualization | glue_vispy_viewers/scatter/layer_artist.py | def remove(self):
"""
Remove the layer artist from the visualization
"""
if self._multiscat is None:
return
self._multiscat.deallocate(self.id)
self._multiscat = None
self._viewer_state.remove_global_callback(self._update_scatter)
self.state... | def remove(self):
"""
Remove the layer artist from the visualization
"""
if self._multiscat is None:
return
self._multiscat.deallocate(self.id)
self._multiscat = None
self._viewer_state.remove_global_callback(self._update_scatter)
self.state... | [
"Remove",
"the",
"layer",
"artist",
"from",
"the",
"visualization"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/scatter/layer_artist.py#L110-L122 | [
"def",
"remove",
"(",
"self",
")",
":",
"if",
"self",
".",
"_multiscat",
"is",
"None",
":",
"return",
"self",
".",
"_multiscat",
".",
"deallocate",
"(",
"self",
".",
"id",
")",
"self",
".",
"_multiscat",
"=",
"None",
"self",
".",
"_viewer_state",
".",
... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | _check_valid | Helper to check valid options | glue_vispy_viewers/extern/vispy/gloo/wrappers.py | def _check_valid(key, val, valid):
"""Helper to check valid options"""
if val not in valid:
raise ValueError('%s must be one of %s, not "%s"'
% (key, valid, val)) | def _check_valid(key, val, valid):
"""Helper to check valid options"""
if val not in valid:
raise ValueError('%s must be one of %s, not "%s"'
% (key, valid, val)) | [
"Helper",
"to",
"check",
"valid",
"options"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/wrappers.py#L64-L68 | [
"def",
"_check_valid",
"(",
"key",
",",
"val",
",",
"valid",
")",
":",
"if",
"val",
"not",
"in",
"valid",
":",
"raise",
"ValueError",
"(",
"'%s must be one of %s, not \"%s\"'",
"%",
"(",
"key",
",",
"valid",
",",
"val",
")",
")"
] | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | _to_args | Convert to args representation | glue_vispy_viewers/extern/vispy/gloo/wrappers.py | def _to_args(x):
"""Convert to args representation"""
if not isinstance(x, (list, tuple, np.ndarray)):
x = [x]
return x | def _to_args(x):
"""Convert to args representation"""
if not isinstance(x, (list, tuple, np.ndarray)):
x = [x]
return x | [
"Convert",
"to",
"args",
"representation"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/wrappers.py#L71-L75 | [
"def",
"_to_args",
"(",
"x",
")",
":",
"if",
"not",
"isinstance",
"(",
"x",
",",
"(",
"list",
",",
"tuple",
",",
"np",
".",
"ndarray",
")",
")",
":",
"x",
"=",
"[",
"x",
"]",
"return",
"x"
] | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | _check_conversion | Check for existence of key in dict, return value or raise error | glue_vispy_viewers/extern/vispy/gloo/wrappers.py | def _check_conversion(key, valid_dict):
"""Check for existence of key in dict, return value or raise error"""
if key not in valid_dict and key not in valid_dict.values():
# Only show users the nice string values
keys = [v for v in valid_dict.keys() if isinstance(v, string_types)]
raise V... | def _check_conversion(key, valid_dict):
"""Check for existence of key in dict, return value or raise error"""
if key not in valid_dict and key not in valid_dict.values():
# Only show users the nice string values
keys = [v for v in valid_dict.keys() if isinstance(v, string_types)]
raise V... | [
"Check",
"for",
"existence",
"of",
"key",
"in",
"dict",
"return",
"value",
"or",
"raise",
"error"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/wrappers.py#L78-L84 | [
"def",
"_check_conversion",
"(",
"key",
",",
"valid_dict",
")",
":",
"if",
"key",
"not",
"in",
"valid_dict",
"and",
"key",
"not",
"in",
"valid_dict",
".",
"values",
"(",
")",
":",
"# Only show users the nice string values",
"keys",
"=",
"[",
"v",
"for",
"v",... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | read_pixels | Read pixels from the currently selected buffer.
Under most circumstances, this function reads from the front buffer.
Unlike all other functions in vispy.gloo, this function directly executes
an OpenGL command.
Parameters
----------
viewport : array-like | None
4-element list of x,... | glue_vispy_viewers/extern/vispy/gloo/wrappers.py | def read_pixels(viewport=None, alpha=True, out_type='unsigned_byte'):
"""Read pixels from the currently selected buffer.
Under most circumstances, this function reads from the front buffer.
Unlike all other functions in vispy.gloo, this function directly executes
an OpenGL command.
Parameters... | def read_pixels(viewport=None, alpha=True, out_type='unsigned_byte'):
"""Read pixels from the currently selected buffer.
Under most circumstances, this function reads from the front buffer.
Unlike all other functions in vispy.gloo, this function directly executes
an OpenGL command.
Parameters... | [
"Read",
"pixels",
"from",
"the",
"currently",
"selected",
"buffer",
".",
"Under",
"most",
"circumstances",
"this",
"function",
"reads",
"from",
"the",
"front",
"buffer",
".",
"Unlike",
"all",
"other",
"functions",
"in",
"vispy",
".",
"gloo",
"this",
"function"... | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/wrappers.py#L606-L663 | [
"def",
"read_pixels",
"(",
"viewport",
"=",
"None",
",",
"alpha",
"=",
"True",
",",
"out_type",
"=",
"'unsigned_byte'",
")",
":",
"# Check whether the GL context is direct or remote",
"context",
"=",
"get_current_canvas",
"(",
")",
".",
"context",
"if",
"context",
... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | get_gl_configuration | Read the current gl configuration
This function uses constants that are not in the OpenGL ES 2.1
namespace, so only use this on desktop systems.
Returns
-------
config : dict
The currently active OpenGL configuration. | glue_vispy_viewers/extern/vispy/gloo/wrappers.py | def get_gl_configuration():
"""Read the current gl configuration
This function uses constants that are not in the OpenGL ES 2.1
namespace, so only use this on desktop systems.
Returns
-------
config : dict
The currently active OpenGL configuration.
"""
# XXX eventually maybe we... | def get_gl_configuration():
"""Read the current gl configuration
This function uses constants that are not in the OpenGL ES 2.1
namespace, so only use this on desktop systems.
Returns
-------
config : dict
The currently active OpenGL configuration.
"""
# XXX eventually maybe we... | [
"Read",
"the",
"current",
"gl",
"configuration"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/wrappers.py#L666-L708 | [
"def",
"get_gl_configuration",
"(",
")",
":",
"# XXX eventually maybe we can ask `gl` whether or not we can access these",
"gl",
".",
"check_error",
"(",
"'pre-config check'",
")",
"config",
"=",
"dict",
"(",
")",
"gl",
".",
"glBindFramebuffer",
"(",
"gl",
".",
"GL_FRAM... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | BaseGlooFunctions.set_viewport | Set the OpenGL viewport
This is a wrapper for gl.glViewport.
Parameters
----------
*args : tuple
X and Y coordinates, plus width and height. Can be passed in as
individual components, or as a single tuple with four values. | glue_vispy_viewers/extern/vispy/gloo/wrappers.py | def set_viewport(self, *args):
"""Set the OpenGL viewport
This is a wrapper for gl.glViewport.
Parameters
----------
*args : tuple
X and Y coordinates, plus width and height. Can be passed in as
individual components, or as a single tuple with fo... | def set_viewport(self, *args):
"""Set the OpenGL viewport
This is a wrapper for gl.glViewport.
Parameters
----------
*args : tuple
X and Y coordinates, plus width and height. Can be passed in as
individual components, or as a single tuple with fo... | [
"Set",
"the",
"OpenGL",
"viewport",
"This",
"is",
"a",
"wrapper",
"for",
"gl",
".",
"glViewport",
".",
"Parameters",
"----------",
"*",
"args",
":",
"tuple",
"X",
"and",
"Y",
"coordinates",
"plus",
"width",
"and",
"height",
".",
"Can",
"be",
"passed",
"i... | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/wrappers.py#L100-L112 | [
"def",
"set_viewport",
"(",
"self",
",",
"*",
"args",
")",
":",
"x",
",",
"y",
",",
"w",
",",
"h",
"=",
"args",
"[",
"0",
"]",
"if",
"len",
"(",
"args",
")",
"==",
"1",
"else",
"args",
"self",
".",
"glir",
".",
"command",
"(",
"'FUNC'",
",",
... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | BaseGlooFunctions.set_depth_range | Set depth values
Parameters
----------
near : float
Near clipping plane.
far : float
Far clipping plane. | glue_vispy_viewers/extern/vispy/gloo/wrappers.py | def set_depth_range(self, near=0., far=1.):
"""Set depth values
Parameters
----------
near : float
Near clipping plane.
far : float
Far clipping plane.
"""
self.glir.command('FUNC', 'glDepthRange', float(near), float(far)) | def set_depth_range(self, near=0., far=1.):
"""Set depth values
Parameters
----------
near : float
Near clipping plane.
far : float
Far clipping plane.
"""
self.glir.command('FUNC', 'glDepthRange', float(near), float(far)) | [
"Set",
"depth",
"values",
"Parameters",
"----------",
"near",
":",
"float",
"Near",
"clipping",
"plane",
".",
"far",
":",
"float",
"Far",
"clipping",
"plane",
"."
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/wrappers.py#L114-L124 | [
"def",
"set_depth_range",
"(",
"self",
",",
"near",
"=",
"0.",
",",
"far",
"=",
"1.",
")",
":",
"self",
".",
"glir",
".",
"command",
"(",
"'FUNC'",
",",
"'glDepthRange'",
",",
"float",
"(",
"near",
")",
",",
"float",
"(",
"far",
")",
")"
] | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | BaseGlooFunctions.set_line_width | Set line width
Parameters
----------
width : float
The line width. | glue_vispy_viewers/extern/vispy/gloo/wrappers.py | def set_line_width(self, width=1.):
"""Set line width
Parameters
----------
width : float
The line width.
"""
width = float(width)
if width < 0:
raise RuntimeError('Cannot have width < 0')
self.glir.command('FUNC', 'glLineWidth... | def set_line_width(self, width=1.):
"""Set line width
Parameters
----------
width : float
The line width.
"""
width = float(width)
if width < 0:
raise RuntimeError('Cannot have width < 0')
self.glir.command('FUNC', 'glLineWidth... | [
"Set",
"line",
"width",
"Parameters",
"----------",
"width",
":",
"float",
"The",
"line",
"width",
"."
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/wrappers.py#L146-L157 | [
"def",
"set_line_width",
"(",
"self",
",",
"width",
"=",
"1.",
")",
":",
"width",
"=",
"float",
"(",
"width",
")",
"if",
"width",
"<",
"0",
":",
"raise",
"RuntimeError",
"(",
"'Cannot have width < 0'",
")",
"self",
".",
"glir",
".",
"command",
"(",
"'F... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | BaseGlooFunctions.set_polygon_offset | Set the scale and units used to calculate depth values
Parameters
----------
factor : float
Scale factor used to create a variable depth offset for
each polygon.
units : float
Multiplied by an implementation-specific value to create a
... | glue_vispy_viewers/extern/vispy/gloo/wrappers.py | def set_polygon_offset(self, factor=0., units=0.):
"""Set the scale and units used to calculate depth values
Parameters
----------
factor : float
Scale factor used to create a variable depth offset for
each polygon.
units : float
Multiplie... | def set_polygon_offset(self, factor=0., units=0.):
"""Set the scale and units used to calculate depth values
Parameters
----------
factor : float
Scale factor used to create a variable depth offset for
each polygon.
units : float
Multiplie... | [
"Set",
"the",
"scale",
"and",
"units",
"used",
"to",
"calculate",
"depth",
"values",
"Parameters",
"----------",
"factor",
":",
"float",
"Scale",
"factor",
"used",
"to",
"create",
"a",
"variable",
"depth",
"offset",
"for",
"each",
"polygon",
".",
"units",
":... | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/wrappers.py#L159-L172 | [
"def",
"set_polygon_offset",
"(",
"self",
",",
"factor",
"=",
"0.",
",",
"units",
"=",
"0.",
")",
":",
"self",
".",
"glir",
".",
"command",
"(",
"'FUNC'",
",",
"'glPolygonOffset'",
",",
"float",
"(",
"factor",
")",
",",
"float",
"(",
"units",
")",
")... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | BaseGlooFunctions.clear | Clear the screen buffers
This is a wrapper for gl.glClear.
Parameters
----------
color : bool | str | tuple | instance of Color
Clear the color buffer bit. If not bool, ``set_clear_color`` will
be used to set the color clear value.
depth : bool |... | glue_vispy_viewers/extern/vispy/gloo/wrappers.py | def clear(self, color=True, depth=True, stencil=True):
"""Clear the screen buffers
This is a wrapper for gl.glClear.
Parameters
----------
color : bool | str | tuple | instance of Color
Clear the color buffer bit. If not bool, ``set_clear_color`` will
... | def clear(self, color=True, depth=True, stencil=True):
"""Clear the screen buffers
This is a wrapper for gl.glClear.
Parameters
----------
color : bool | str | tuple | instance of Color
Clear the color buffer bit. If not bool, ``set_clear_color`` will
... | [
"Clear",
"the",
"screen",
"buffers",
"This",
"is",
"a",
"wrapper",
"for",
"gl",
".",
"glClear",
".",
"Parameters",
"----------",
"color",
":",
"bool",
"|",
"str",
"|",
"tuple",
"|",
"instance",
"of",
"Color",
"Clear",
"the",
"color",
"buffer",
"bit",
"."... | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/wrappers.py#L181-L211 | [
"def",
"clear",
"(",
"self",
",",
"color",
"=",
"True",
",",
"depth",
"=",
"True",
",",
"stencil",
"=",
"True",
")",
":",
"bits",
"=",
"0",
"if",
"isinstance",
"(",
"color",
",",
"np",
".",
"ndarray",
")",
"or",
"bool",
"(",
"color",
")",
":",
... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | BaseGlooFunctions.set_clear_color | Set the screen clear color
This is a wrapper for gl.glClearColor.
Parameters
----------
color : str | tuple | instance of Color
Color to use. See vispy.color.Color for options.
alpha : float | None
Alpha to use. | glue_vispy_viewers/extern/vispy/gloo/wrappers.py | def set_clear_color(self, color='black', alpha=None):
"""Set the screen clear color
This is a wrapper for gl.glClearColor.
Parameters
----------
color : str | tuple | instance of Color
Color to use. See vispy.color.Color for options.
alpha : float | None
... | def set_clear_color(self, color='black', alpha=None):
"""Set the screen clear color
This is a wrapper for gl.glClearColor.
Parameters
----------
color : str | tuple | instance of Color
Color to use. See vispy.color.Color for options.
alpha : float | None
... | [
"Set",
"the",
"screen",
"clear",
"color"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/wrappers.py#L213-L225 | [
"def",
"set_clear_color",
"(",
"self",
",",
"color",
"=",
"'black'",
",",
"alpha",
"=",
"None",
")",
":",
"self",
".",
"glir",
".",
"command",
"(",
"'FUNC'",
",",
"'glClearColor'",
",",
"*",
"Color",
"(",
"color",
",",
"alpha",
")",
".",
"rgba",
")"
... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | BaseGlooFunctions.set_blend_func | Specify pixel arithmetic for RGB and alpha
Parameters
----------
srgb : str
Source RGB factor.
drgb : str
Destination RGB factor.
salpha : str | None
Source alpha factor. If None, ``srgb`` is used.
dalpha : str
Destinat... | glue_vispy_viewers/extern/vispy/gloo/wrappers.py | def set_blend_func(self, srgb='one', drgb='zero',
salpha=None, dalpha=None):
"""Specify pixel arithmetic for RGB and alpha
Parameters
----------
srgb : str
Source RGB factor.
drgb : str
Destination RGB factor.
salpha : s... | def set_blend_func(self, srgb='one', drgb='zero',
salpha=None, dalpha=None):
"""Specify pixel arithmetic for RGB and alpha
Parameters
----------
srgb : str
Source RGB factor.
drgb : str
Destination RGB factor.
salpha : s... | [
"Specify",
"pixel",
"arithmetic",
"for",
"RGB",
"and",
"alpha",
"Parameters",
"----------",
"srgb",
":",
"str",
"Source",
"RGB",
"factor",
".",
"drgb",
":",
"str",
"Destination",
"RGB",
"factor",
".",
"salpha",
":",
"str",
"|",
"None",
"Source",
"alpha",
"... | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/wrappers.py#L253-L271 | [
"def",
"set_blend_func",
"(",
"self",
",",
"srgb",
"=",
"'one'",
",",
"drgb",
"=",
"'zero'",
",",
"salpha",
"=",
"None",
",",
"dalpha",
"=",
"None",
")",
":",
"salpha",
"=",
"srgb",
"if",
"salpha",
"is",
"None",
"else",
"salpha",
"dalpha",
"=",
"drgb... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | BaseGlooFunctions.set_blend_equation | Specify the equation for RGB and alpha blending
Parameters
----------
mode_rgb : str
Mode for RGB.
mode_alpha : str | None
Mode for Alpha. If None, ``mode_rgb`` is used.
Notes
-----
See ``set_blend_equation`` for valid modes. | glue_vispy_viewers/extern/vispy/gloo/wrappers.py | def set_blend_equation(self, mode_rgb, mode_alpha=None):
"""Specify the equation for RGB and alpha blending
Parameters
----------
mode_rgb : str
Mode for RGB.
mode_alpha : str | None
Mode for Alpha. If None, ``mode_rgb`` is used.
Notes
... | def set_blend_equation(self, mode_rgb, mode_alpha=None):
"""Specify the equation for RGB and alpha blending
Parameters
----------
mode_rgb : str
Mode for RGB.
mode_alpha : str | None
Mode for Alpha. If None, ``mode_rgb`` is used.
Notes
... | [
"Specify",
"the",
"equation",
"for",
"RGB",
"and",
"alpha",
"blending",
"Parameters",
"----------",
"mode_rgb",
":",
"str",
"Mode",
"for",
"RGB",
".",
"mode_alpha",
":",
"str",
"|",
"None",
"Mode",
"for",
"Alpha",
".",
"If",
"None",
"mode_rgb",
"is",
"used... | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/wrappers.py#L283-L299 | [
"def",
"set_blend_equation",
"(",
"self",
",",
"mode_rgb",
",",
"mode_alpha",
"=",
"None",
")",
":",
"mode_alpha",
"=",
"mode_rgb",
"if",
"mode_alpha",
"is",
"None",
"else",
"mode_alpha",
"self",
".",
"glir",
".",
"command",
"(",
"'FUNC'",
",",
"'glBlendEqua... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | BaseGlooFunctions.set_scissor | Define the scissor box
Parameters
----------
x : int
Left corner of the box.
y : int
Lower corner of the box.
w : int
The width of the box.
h : int
The height of the box. | glue_vispy_viewers/extern/vispy/gloo/wrappers.py | def set_scissor(self, x, y, w, h):
"""Define the scissor box
Parameters
----------
x : int
Left corner of the box.
y : int
Lower corner of the box.
w : int
The width of the box.
h : int
The height of the box.
... | def set_scissor(self, x, y, w, h):
"""Define the scissor box
Parameters
----------
x : int
Left corner of the box.
y : int
Lower corner of the box.
w : int
The width of the box.
h : int
The height of the box.
... | [
"Define",
"the",
"scissor",
"box",
"Parameters",
"----------",
"x",
":",
"int",
"Left",
"corner",
"of",
"the",
"box",
".",
"y",
":",
"int",
"Lower",
"corner",
"of",
"the",
"box",
".",
"w",
":",
"int",
"The",
"width",
"of",
"the",
"box",
".",
"h",
"... | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/wrappers.py#L304-L318 | [
"def",
"set_scissor",
"(",
"self",
",",
"x",
",",
"y",
",",
"w",
",",
"h",
")",
":",
"self",
".",
"glir",
".",
"command",
"(",
"'FUNC'",
",",
"'glScissor'",
",",
"int",
"(",
"x",
")",
",",
"int",
"(",
"y",
")",
",",
"int",
"(",
"w",
")",
",... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | BaseGlooFunctions.set_stencil_func | Set front or back function and reference value
Parameters
----------
func : str
See set_stencil_func.
ref : int
Reference value for the stencil test.
mask : int
Mask that is ANDed with ref and stored stencil value.
face : str
... | glue_vispy_viewers/extern/vispy/gloo/wrappers.py | def set_stencil_func(self, func='always', ref=0, mask=8,
face='front_and_back'):
"""Set front or back function and reference value
Parameters
----------
func : str
See set_stencil_func.
ref : int
Reference value for the stenc... | def set_stencil_func(self, func='always', ref=0, mask=8,
face='front_and_back'):
"""Set front or back function and reference value
Parameters
----------
func : str
See set_stencil_func.
ref : int
Reference value for the stenc... | [
"Set",
"front",
"or",
"back",
"function",
"and",
"reference",
"value",
"Parameters",
"----------",
"func",
":",
"str",
"See",
"set_stencil_func",
".",
"ref",
":",
"int",
"Reference",
"value",
"for",
"the",
"stencil",
"test",
".",
"mask",
":",
"int",
"Mask",
... | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/wrappers.py#L320-L336 | [
"def",
"set_stencil_func",
"(",
"self",
",",
"func",
"=",
"'always'",
",",
"ref",
"=",
"0",
",",
"mask",
"=",
"8",
",",
"face",
"=",
"'front_and_back'",
")",
":",
"self",
".",
"glir",
".",
"command",
"(",
"'FUNC'",
",",
"'glStencilFuncSeparate'",
",",
... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | BaseGlooFunctions.set_stencil_mask | Control the front or back writing of individual bits in the stencil
Parameters
----------
mask : int
Mask that is ANDed with ref and stored stencil value.
face : str
Can be 'front', 'back', or 'front_and_back'. | glue_vispy_viewers/extern/vispy/gloo/wrappers.py | def set_stencil_mask(self, mask=8, face='front_and_back'):
"""Control the front or back writing of individual bits in the stencil
Parameters
----------
mask : int
Mask that is ANDed with ref and stored stencil value.
face : str
Can be 'front', 'back',... | def set_stencil_mask(self, mask=8, face='front_and_back'):
"""Control the front or back writing of individual bits in the stencil
Parameters
----------
mask : int
Mask that is ANDed with ref and stored stencil value.
face : str
Can be 'front', 'back',... | [
"Control",
"the",
"front",
"or",
"back",
"writing",
"of",
"individual",
"bits",
"in",
"the",
"stencil",
"Parameters",
"----------",
"mask",
":",
"int",
"Mask",
"that",
"is",
"ANDed",
"with",
"ref",
"and",
"stored",
"stencil",
"value",
".",
"face",
":",
"st... | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/wrappers.py#L338-L348 | [
"def",
"set_stencil_mask",
"(",
"self",
",",
"mask",
"=",
"8",
",",
"face",
"=",
"'front_and_back'",
")",
":",
"self",
".",
"glir",
".",
"command",
"(",
"'FUNC'",
",",
"'glStencilMaskSeparate'",
",",
"face",
",",
"int",
"(",
"mask",
")",
")"
] | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | BaseGlooFunctions.set_stencil_op | Set front or back stencil test actions
Parameters
----------
sfail : str
Action to take when the stencil fails. Must be one of
'keep', 'zero', 'replace', 'incr', 'incr_wrap',
'decr', 'decr_wrap', or 'invert'.
dpfail : str
Action to tak... | glue_vispy_viewers/extern/vispy/gloo/wrappers.py | def set_stencil_op(self, sfail='keep', dpfail='keep', dppass='keep',
face='front_and_back'):
"""Set front or back stencil test actions
Parameters
----------
sfail : str
Action to take when the stencil fails. Must be one of
'keep', 'zero... | def set_stencil_op(self, sfail='keep', dpfail='keep', dppass='keep',
face='front_and_back'):
"""Set front or back stencil test actions
Parameters
----------
sfail : str
Action to take when the stencil fails. Must be one of
'keep', 'zero... | [
"Set",
"front",
"or",
"back",
"stencil",
"test",
"actions",
"Parameters",
"----------",
"sfail",
":",
"str",
"Action",
"to",
"take",
"when",
"the",
"stencil",
"fails",
".",
"Must",
"be",
"one",
"of",
"keep",
"zero",
"replace",
"incr",
"incr_wrap",
"decr",
... | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/wrappers.py#L350-L370 | [
"def",
"set_stencil_op",
"(",
"self",
",",
"sfail",
"=",
"'keep'",
",",
"dpfail",
"=",
"'keep'",
",",
"dppass",
"=",
"'keep'",
",",
"face",
"=",
"'front_and_back'",
")",
":",
"self",
".",
"glir",
".",
"command",
"(",
"'FUNC'",
",",
"'glStencilOpSeparate'",... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | BaseGlooFunctions.set_color_mask | Toggle writing of frame buffer color components
Parameters
----------
red : bool
Red toggle.
green : bool
Green toggle.
blue : bool
Blue toggle.
alpha : bool
Alpha toggle. | glue_vispy_viewers/extern/vispy/gloo/wrappers.py | def set_color_mask(self, red, green, blue, alpha):
"""Toggle writing of frame buffer color components
Parameters
----------
red : bool
Red toggle.
green : bool
Green toggle.
blue : bool
Blue toggle.
alpha : bool
... | def set_color_mask(self, red, green, blue, alpha):
"""Toggle writing of frame buffer color components
Parameters
----------
red : bool
Red toggle.
green : bool
Green toggle.
blue : bool
Blue toggle.
alpha : bool
... | [
"Toggle",
"writing",
"of",
"frame",
"buffer",
"color",
"components",
"Parameters",
"----------",
"red",
":",
"bool",
"Red",
"toggle",
".",
"green",
":",
"bool",
"Green",
"toggle",
".",
"blue",
":",
"bool",
"Blue",
"toggle",
".",
"alpha",
":",
"bool",
"Alph... | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/wrappers.py#L395-L410 | [
"def",
"set_color_mask",
"(",
"self",
",",
"red",
",",
"green",
",",
"blue",
",",
"alpha",
")",
":",
"self",
".",
"glir",
".",
"command",
"(",
"'FUNC'",
",",
"'glColorMask'",
",",
"bool",
"(",
"red",
")",
",",
"bool",
"(",
"green",
")",
",",
"bool"... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | BaseGlooFunctions.set_sample_coverage | Specify multisample coverage parameters
Parameters
----------
value : float
Sample coverage value (will be clamped between 0. and 1.).
invert : bool
Specify if the coverage masks should be inverted. | glue_vispy_viewers/extern/vispy/gloo/wrappers.py | def set_sample_coverage(self, value=1.0, invert=False):
"""Specify multisample coverage parameters
Parameters
----------
value : float
Sample coverage value (will be clamped between 0. and 1.).
invert : bool
Specify if the coverage masks should be inv... | def set_sample_coverage(self, value=1.0, invert=False):
"""Specify multisample coverage parameters
Parameters
----------
value : float
Sample coverage value (will be clamped between 0. and 1.).
invert : bool
Specify if the coverage masks should be inv... | [
"Specify",
"multisample",
"coverage",
"parameters",
"Parameters",
"----------",
"value",
":",
"float",
"Sample",
"coverage",
"value",
"(",
"will",
"be",
"clamped",
"between",
"0",
".",
"and",
"1",
".",
")",
".",
"invert",
":",
"bool",
"Specify",
"if",
"the",... | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/wrappers.py#L412-L423 | [
"def",
"set_sample_coverage",
"(",
"self",
",",
"value",
"=",
"1.0",
",",
"invert",
"=",
"False",
")",
":",
"self",
".",
"glir",
".",
"command",
"(",
"'FUNC'",
",",
"'glSampleCoverage'",
",",
"float",
"(",
"value",
")",
",",
"bool",
"(",
"invert",
")",... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | BaseGlooFunctions.set_state | Set OpenGL rendering state, optionally using a preset
Parameters
----------
preset : str | None
Can be one of ('opaque', 'translucent', 'additive') to use
use reasonable defaults for these typical use cases.
**kwargs : keyword arguments
Other supp... | glue_vispy_viewers/extern/vispy/gloo/wrappers.py | def set_state(self, preset=None, **kwargs):
"""Set OpenGL rendering state, optionally using a preset
Parameters
----------
preset : str | None
Can be one of ('opaque', 'translucent', 'additive') to use
use reasonable defaults for these typical use cases.
... | def set_state(self, preset=None, **kwargs):
"""Set OpenGL rendering state, optionally using a preset
Parameters
----------
preset : str | None
Can be one of ('opaque', 'translucent', 'additive') to use
use reasonable defaults for these typical use cases.
... | [
"Set",
"OpenGL",
"rendering",
"state",
"optionally",
"using",
"a",
"preset",
"Parameters",
"----------",
"preset",
":",
"str",
"|",
"None",
"Can",
"be",
"one",
"of",
"(",
"opaque",
"translucent",
"additive",
")",
"to",
"use",
"use",
"reasonable",
"defaults",
... | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/wrappers.py#L442-L527 | [
"def",
"set_state",
"(",
"self",
",",
"preset",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"kwargs",
"=",
"deepcopy",
"(",
"kwargs",
")",
"# Load preset, if supplied",
"if",
"preset",
"is",
"not",
"None",
":",
"_check_valid",
"(",
"'preset'",
",",
"... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | BaseGlooFunctions.finish | Wait for GL commands to to finish
This creates a GLIR command for glFinish and then processes the
GLIR commands. If the GLIR interpreter is remote (e.g. WebGL), this
function will return before GL has finished processing the commands. | glue_vispy_viewers/extern/vispy/gloo/wrappers.py | def finish(self):
"""Wait for GL commands to to finish
This creates a GLIR command for glFinish and then processes the
GLIR commands. If the GLIR interpreter is remote (e.g. WebGL), this
function will return before GL has finished processing the commands.
"""
if ... | def finish(self):
"""Wait for GL commands to to finish
This creates a GLIR command for glFinish and then processes the
GLIR commands. If the GLIR interpreter is remote (e.g. WebGL), this
function will return before GL has finished processing the commands.
"""
if ... | [
"Wait",
"for",
"GL",
"commands",
"to",
"to",
"finish",
"This",
"creates",
"a",
"GLIR",
"command",
"for",
"glFinish",
"and",
"then",
"processes",
"the",
"GLIR",
"commands",
".",
"If",
"the",
"GLIR",
"interpreter",
"is",
"remote",
"(",
"e",
".",
"g",
".",
... | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/wrappers.py#L533-L545 | [
"def",
"finish",
"(",
"self",
")",
":",
"if",
"hasattr",
"(",
"self",
",",
"'flush_commands'",
")",
":",
"context",
"=",
"self",
"else",
":",
"context",
"=",
"get_current_canvas",
"(",
")",
".",
"context",
"context",
".",
"glir",
".",
"command",
"(",
"... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.