repo
stringlengths
7
55
path
stringlengths
4
223
func_name
stringlengths
1
134
original_string
stringlengths
75
104k
language
stringclasses
1 value
code
stringlengths
75
104k
code_tokens
listlengths
19
28.4k
docstring
stringlengths
1
46.9k
docstring_tokens
listlengths
1
1.97k
sha
stringlengths
40
40
url
stringlengths
87
315
partition
stringclasses
3 values
summary
stringlengths
4
350
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/scene/node.py
Node.common_parent
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 |...
python
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", ")", ":", "p1", "=", "self", ".", "parent_chain", "(", ")", "p2", "=", "node", ".", "parent_chain", "(", ")", "for", "p", "in", "p1", ":", "if", "p", "in", "p2", ":", "return", "p", "return", "Non...
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.
[ "Return", "the", "common", "parent", "of", "two", "entities" ]
54a4351d98c1f90dfb1a557d1b447c1f57470eea
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/scene/node.py#L451-L472
train
Return the common parent of two entities.
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/scene/node.py
Node.node_path_to_child
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 ----...
python
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", ")", ":", "if", "node", "is", "self", ":", "return", "[", "]", "# Go up from the child node as far as we can", "path1", "=", "[", "node", "]", "child", "=", "node", "while", "child", ".", "parent", "is",...
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 ...
[ "Return", "a", "list", "describing", "the", "path", "from", "this", "node", "to", "a", "child", "node" ]
54a4351d98c1f90dfb1a557d1b447c1f57470eea
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/scene/node.py#L474-L523
train
Return a list describing the path from this node to a child node.
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/scene/node.py
Node.node_path
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...
python
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", ")", ":", "p1", "=", "self", ".", "parent_chain", "(", ")", "p2", "=", "node", ".", "parent_chain", "(", ")", "cp", "=", "None", "for", "p", "in", "p1", ":", "if", "p", "in", "p2", ":", "cp", "=", ...
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 ...
[ "Return", "two", "lists", "describing", "the", "path", "from", "this", "node", "to", "another" ]
54a4351d98c1f90dfb1a557d1b447c1f57470eea
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/scene/node.py#L525-L570
train
Return two lists describing the path from this node to another node.
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/scene/node.py
Node.node_path_transforms
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 -------...
python
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", ")", ":", "a", ",", "b", "=", "self", ".", "node_path", "(", "node", ")", "return", "(", "[", "n", ".", "transform", "for", "n", "in", "a", "[", ":", "-", "1", "]", "]", "+", "[", "n", ...
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...
[ "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...
54a4351d98c1f90dfb1a557d1b447c1f57470eea
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/scene/node.py#L572-L591
train
Returns the list of transforms along the path to another node.
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/io/wavefront.py
WavefrontReader.read
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. """ #...
python
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", ")", ":", "# Open file", "fmt", "=", "op", ".", "splitext", "(", "fname", ")", "[", "1", "]", ".", "lower", "(", ")", "assert", "fmt", "in", "(", "'.obj'", ",", "'.gz'", ")", "opener", "=", "open", "if", ...
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", ")" ]
54a4351d98c1f90dfb1a557d1b447c1f57470eea
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/io/wavefront.py#L55-L85
train
This classmethod is used to read the OBJ file. It is the entry point for reading the OBJ files.
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/io/wavefront.py
WavefrontReader.readLine
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...
python
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", ")", ":", "# Read line", "line", "=", "self", ".", "_f", ".", "readline", "(", ")", ".", "decode", "(", "'ascii'", ",", "'ignore'", ")", "if", "not", "line", ":", "raise", "EOFError", "(", ")", "line", "=", "line", "...
The method that reads a line and processes it.
[ "The", "method", "that", "reads", "a", "line", "and", "processes", "it", "." ]
54a4351d98c1f90dfb1a557d1b447c1f57470eea
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/io/wavefront.py#L87-L117
train
Reads a single line and processes it.
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/io/wavefront.py
WavefrontReader.readTuple
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]]
python
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", ")", ":", "numbers", "=", "[", "num", "for", "num", "in", "line", ".", "split", "(", "' '", ")", "if", "num", "]", "return", "[", "float", "(", "num", ")", "for", "num", "in", ...
Reads a tuple of numbers. e.g. vertices, normals or teture coords.
[ "Reads", "a", "tuple", "of", "numbers", ".", "e", ".", "g", ".", "vertices", "normals", "or", "teture", "coords", "." ]
54a4351d98c1f90dfb1a557d1b447c1f57470eea
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/io/wavefront.py#L119-L123
train
Reads a tuple of numbers. e. g. vertices normals or teture coords.
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/io/wavefront.py
WavefrontReader.readFace
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...
python
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", ")", ":", "# Get parts (skip first)", "indexSets", "=", "[", "num", "for", "num", "in", "line", ".", "split", "(", "' '", ")", "if", "num", "]", "[", "1", ":", "]", "final_face", "=", "[", "]", "for", "i...
Each face consists of three or more sets of indices. Each set consists of 1, 2 or 3 indices to vertices/normals/texcords.
[ "Each", "face", "consists", "of", "three", "or", "more", "sets", "of", "indices", ".", "Each", "set", "consists", "of", "1", "2", "or", "3", "indices", "to", "vertices", "/", "normals", "/", "texcords", "." ]
54a4351d98c1f90dfb1a557d1b447c1f57470eea
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/io/wavefront.py#L125-L183
train
Reads a single face from a string.
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/io/wavefront.py
WavefrontReader.finish
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 ...
python
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", ")", ":", "self", ".", "_vertices", "=", "np", ".", "array", "(", "self", ".", "_vertices", ",", "'float32'", ")", "if", "self", ".", "_faces", ":", "self", ".", "_faces", "=", "np", ".", "array", "(", "self", ".", "...
Converts gathere lists to numpy arrays and creates BaseMesh instance.
[ "Converts", "gathere", "lists", "to", "numpy", "arrays", "and", "creates", "BaseMesh", "instance", "." ]
54a4351d98c1f90dfb1a557d1b447c1f57470eea
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/io/wavefront.py#L200-L220
train
Converts gathere lists to numpy arrays and creates BaseMesh instance.
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/io/wavefront.py
WavefrontWriter.write
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". ...
python
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", ")", ":", "# Open file", "fmt", "=", "op", ".", "splitext", "(", "fname", ")", "[", ...
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...
[ "This", "classmethod", "is", "the", "entry", "point", "for", "writing", "mesh", "data", "to", "OBJ", "." ]
54a4351d98c1f90dfb1a557d1b447c1f57470eea
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/io/wavefront.py#L229-L263
train
This classmethod writes a mesh to an object file.
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/io/wavefront.py
WavefrontWriter.writeTuple
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...
python
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", ")", ":", "# 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", "(",...
Writes a tuple of numbers (on one line).
[ "Writes", "a", "tuple", "of", "numbers", "(", "on", "one", "line", ")", "." ]
54a4351d98c1f90dfb1a557d1b447c1f57470eea
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/io/wavefront.py#L272-L281
train
Writes a tuple of numbers on one line.
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/io/wavefront.py
WavefrontWriter.writeFace
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...
python
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'", ")", ":", "# OBJ counts from 1", "val", "=", "[", "v", "+", "1", "for", "v", "in", "val", "]", "# Make string", "if", "self", ".", "_hasValues", "and", "self", ".", "_hasNormals", ...
Write the face info to the net line.
[ "Write", "the", "face", "info", "to", "the", "net", "line", "." ]
54a4351d98c1f90dfb1a557d1b447c1f57470eea
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/io/wavefront.py#L283-L298
train
Write the face info to the net line.
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/io/wavefront.py
WavefrontWriter.writeMesh
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 ...
python
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", ")", ":", "# Store properties", "self", ".", "_hasNormals", "=", "normals", "is", "not", "None", "se...
Write the given mesh instance.
[ "Write", "the", "given", "mesh", "instance", "." ]
54a4351d98c1f90dfb1a557d1b447c1f57470eea
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/io/wavefront.py#L300-L363
train
Writes a mesh to the file.
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/geometry/calculations.py
_fast_cross_3d
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...
python
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", ")", ":", "assert", "x", ".", "ndim", "==", "2", "assert", "y", ".", "ndim", "==", "2", "assert", "x", ".", "shape", "[", "1", "]", "==", "3", "assert", "y", ".", "shape", "[", "1", "]", "==", "3",...
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...
[ "Compute", "cross", "product", "between", "list", "of", "3D", "vectors" ]
54a4351d98c1f90dfb1a557d1b447c1f57470eea
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/geometry/calculations.py#L16-L50
train
Compute cross product between 2D arrays x and y.
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/geometry/calculations.py
_calculate_normals
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]...
python
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", ")", ":", "# ensure highest precision for our summation/vectorization \"trick\"", "rr", "=", "rr", ".", "astype", "(", "np", ".", "float64", ")", "# first, compute triangle normals", "r1", "=", "rr", "[", "tris", ...
Efficiently compute vertex normals for triangulated surface
[ "Efficiently", "compute", "vertex", "normals", "for", "triangulated", "surface" ]
54a4351d98c1f90dfb1a557d1b447c1f57470eea
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/geometry/calculations.py#L53-L83
train
Efficiently compute vertex normals for triangulated surface.
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/geometry/calculations.py
resize
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 ...
python
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'", ")", ":", "image", "=", "np", ".", "array", "(", "image", ",", "float", ")", "shape", "=", "np", ".", "array", "(", "shape", ",", "int", ")", "if", "shape", ".", "ndim", ...
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.
[ "Resize", "an", "image" ]
54a4351d98c1f90dfb1a557d1b447c1f57470eea
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/geometry/calculations.py#L86-L137
train
Resizes an image into a new image with the specified shape.
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/visuals/collections/raw_segment_collection.py
RawSegmentCollection.append
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...
python
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", ")", ":", "itemsize", "=", "itemsize", "or", "1", "itemcount", "=", "len", "(", "P0", ")", "/", "itemsize", "V", "=", "np", ".", "empty", ...
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...
[ "Append", "a", "new", "set", "of", "segments", "to", "the", "collection", "." ]
54a4351d98c1f90dfb1a557d1b447c1f57470eea
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/collections/raw_segment_collection.py#L71-L117
train
Append a new set of segments to the collection.
rbarrois/mpdlcd
mpdlcd/display_pattern.py
ScreenPattern.parse
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...
python
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", ")", ":", "for", "line", "in", "self", ".", "lines", ":", "# Parse the line", "field_defs", "=", "self", ".", "parse_line", "(", "line", ")", "fields", "=", "[", "]", "# Convert field parameters into Field objects", "for", "(", "...
Parse the lines, and fill self.line_fields accordingly.
[ "Parse", "the", "lines", "and", "fill", "self", ".", "line_fields", "accordingly", "." ]
85f16c8cc0883f8abb4c2cc7f69729c3e2f857da
https://github.com/rbarrois/mpdlcd/blob/85f16c8cc0883f8abb4c2cc7f69729c3e2f857da/mpdlcd/display_pattern.py#L42-L59
train
Parse the lines and fill self. line_fields accordingly.
rbarrois/mpdlcd
mpdlcd/display_pattern.py
ScreenPattern.compute_positions
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: ...
python
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", ")", ":", "# First index", "left", "=", "1", "# Last index", "right", "=", "screen_width", "+", "1", "# Current 'flexible' field", "flexible", "=", "None", "# Compute the space to the left and t...
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...
[ "Compute", "the", "relative", "position", "of", "the", "fields", "on", "a", "given", "line", "." ]
85f16c8cc0883f8abb4c2cc7f69729c3e2f857da
https://github.com/rbarrois/mpdlcd/blob/85f16c8cc0883f8abb4c2cc7f69729c3e2f857da/mpdlcd/display_pattern.py#L67-L126
train
Compute the relative position of the fields on a given line.
rbarrois/mpdlcd
mpdlcd/display_pattern.py
ScreenPattern.add_to_screen
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): ...
python
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", ")", ":", "for", "lineno", ",", "fields", "in", "enumerate", "(", "self", ".", "line_fields", ")", ":", "for", "left", ",", "field", "in", "self", ".", "compute_positions", "(", "sc...
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.
[ "Add", "the", "pattern", "to", "a", "screen", "." ]
85f16c8cc0883f8abb4c2cc7f69729c3e2f857da
https://github.com/rbarrois/mpdlcd/blob/85f16c8cc0883f8abb4c2cc7f69729c3e2f857da/mpdlcd/display_pattern.py#L128-L145
train
Add the pattern to a screen.
rbarrois/mpdlcd
mpdlcd/display_pattern.py
ScreenPattern.register_hooks
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)
python
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", ")", ":", "for", "hook", ",", "subhooks", "in", "field", ".", "register_hooks", "(", ")", ":", "self", ".", "hooks", "[", "hook", "]", ".", "append", "(", "field", ")", "self", ".", "subhooks", "[",...
Register a field on its target hooks.
[ "Register", "a", "field", "on", "its", "target", "hooks", "." ]
85f16c8cc0883f8abb4c2cc7f69729c3e2f857da
https://github.com/rbarrois/mpdlcd/blob/85f16c8cc0883f8abb4c2cc7f69729c3e2f857da/mpdlcd/display_pattern.py#L147-L151
train
Register a field on its target hooks.
rbarrois/mpdlcd
mpdlcd/display_pattern.py
ScreenPattern.hook_changed
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)
python
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", ")", ":", "for", "field", "in", "self", ".", "hooks", "[", "hook", "]", ":", "widget", "=", "self", ".", "widgets", "[", "field", "]", "field", ".", "hook_changed", "(", "hook", ",", ...
Called whenever the data for a hook changed.
[ "Called", "whenever", "the", "data", "for", "a", "hook", "changed", "." ]
85f16c8cc0883f8abb4c2cc7f69729c3e2f857da
https://github.com/rbarrois/mpdlcd/blob/85f16c8cc0883f8abb4c2cc7f69729c3e2f857da/mpdlcd/display_pattern.py#L153-L157
train
Called whenever the data for a specific hook has changed.
rbarrois/mpdlcd
mpdlcd/display_pattern.py
ScreenPattern.parse_line
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...
python
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", ")", ":", "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...
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...
[ "Parse", "a", "line", "of", "text", "." ]
85f16c8cc0883f8abb4c2cc7f69729c3e2f857da
https://github.com/rbarrois/mpdlcd/blob/85f16c8cc0883f8abb4c2cc7f69729c3e2f857da/mpdlcd/display_pattern.py#L163-L424
train
Parse a line of text into a patternLine object.
rbarrois/mpdlcd
mpdlcd/display_pattern.py
ScreenPatternList.add
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...
python
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", ")", ":", "self", ".", "patterns", "[", "len", "(", "pattern_txt", ")", "]", "=", "pattern_txt", "low", "=", "0", "high", "=", "len", "(", "pattern_txt", ")", "-", "1", "while", "not", "pattern_txt", "["...
Add a pattern to the list. Args: pattern_txt (str list): the pattern, as a list of lines.
[ "Add", "a", "pattern", "to", "the", "list", "." ]
85f16c8cc0883f8abb4c2cc7f69729c3e2f857da
https://github.com/rbarrois/mpdlcd/blob/85f16c8cc0883f8abb4c2cc7f69729c3e2f857da/mpdlcd/display_pattern.py#L446-L464
train
Adds a pattern to the list.
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/scene/cameras/arcball.py
_arcball
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....
python
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", ")", ":", "x", ",", "y", "=", "xy", "w", ",", "h", "=", "wh", "r", "=", "(", "w", "+", "h", ")", "/", "2.", "x", ",", "y", "=", "-", "(", "2.", "*", "x", "-", "w", ")", "/", "r", ",", "(", ...
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>
[ "Convert", "x", "y", "coordinates", "to", "w", "x", "y", "z", "Quaternion", "parameters" ]
54a4351d98c1f90dfb1a557d1b447c1f57470eea
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/scene/cameras/arcball.py#L84-L101
train
Convert x y coordinates to w x y z Quaternion parameters
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/scene/cameras/arcball.py
ArcballCamera._update_rotation
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)) * ...
python
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", ")", ":", "p2", "=", "event", ".", "mouse_event", ".", "pos", "if", "self", ".", "_event_value", "is", "None", ":", "self", ".", "_event_value", "=", "p2", "wh", "=", "self", ".", "_viewbox", ".", ...
Update rotation parmeters based on mouse movement
[ "Update", "rotation", "parmeters", "based", "on", "mouse", "movement" ]
54a4351d98c1f90dfb1a557d1b447c1f57470eea
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/scene/cameras/arcball.py#L53-L63
train
Update rotation parmeters based on mouse movement
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/scene/cameras/arcball.py
ArcballCamera._rotate_tr
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))
python
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", ")", ":", "rot", ",", "x", ",", "y", ",", "z", "=", "self", ".", "_quaternion", ".", "get_axis_angle", "(", ")", "up", ",", "forward", ",", "right", "=", "self", ".", "_get_dim_vectors", "(", ")", "self", ".", "tra...
Rotate the transformation matrix based on camera parameters
[ "Rotate", "the", "transformation", "matrix", "based", "on", "camera", "parameters" ]
54a4351d98c1f90dfb1a557d1b447c1f57470eea
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/scene/cameras/arcball.py#L65-L69
train
Rotate the transformation matrix based on camera parameters
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/scene/cameras/arcball.py
ArcballCamera._dist_to_trans
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...
python
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", ")", ":", "rot", ",", "x", ",", "y", ",", "z", "=", "self", ".", "_quaternion", ".", "get_axis_angle", "(", ")", "tr", "=", "MatrixTransform", "(", ")", "tr", ".", "rotate", "(", "180", "*", "rot",...
Convert mouse x, y movement into x, y, z translations
[ "Convert", "mouse", "x", "y", "movement", "into", "x", "y", "z", "translations" ]
54a4351d98c1f90dfb1a557d1b447c1f57470eea
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/scene/cameras/arcball.py#L71-L77
train
Convert mouse x y movement into x y z translations
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/visuals/transforms/_util.py
arg_to_array
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...
python
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", ")", ":", "def", "fn", "(", "self", ",", "arg", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "\"\"\"Function\n\n Parameters\n ----------\n arg : array-like\n Argument to convert.\n *args : tu...
Decorator to convert argument to array. Parameters ---------- func : function The function to decorate. Returns ------- func : function The decorated function.
[ "Decorator", "to", "convert", "argument", "to", "array", "." ]
54a4351d98c1f90dfb1a557d1b447c1f57470eea
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/transforms/_util.py#L12-L44
train
Decorator to convert argument to array.
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/visuals/transforms/_util.py
as_vec4
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...
python
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", ")", ")", ":", "obj", "=", "np", ".", "atleast_2d", "(", "obj", ")", "# For multiple vectors, reshape to (..., 4)", "if", "obj", ".", "shape", "[", "-", "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 ------- obj : array-like The object promoted to have 4...
[ "Convert", "obj", "to", "4", "-", "element", "vector", "(", "numpy", "array", "with", "shape", "[", "-", "1", "]", "==", "4", ")" ]
54a4351d98c1f90dfb1a557d1b447c1f57470eea
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/transforms/_util.py#L47-L82
train
Convert obj to 4 - element vector.
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/visuals/transforms/_util.py
arg_to_vec4
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]] ...
python
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", ")", ":", "if", "isinstance", "(", "arg", ",", "(", "tuple", ",", "list", ",", "np", ".", "ndarray", ")", ")", ":", "arg", "=", "np", ".", ...
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...
[ "Decorator", "for", "converting", "argument", "to", "vec4", "format", "suitable", "for", "4x4", "matrix", "multiplication", "." ]
54a4351d98c1f90dfb1a557d1b447c1f57470eea
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/transforms/_util.py#L86-L122
train
Decorator for converting an argument to vec4 format suitable for 4x4 matrix multiplication.
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/visuals/transforms/_util.py
TransformCache.get
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...
python
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", ")", ":", "key", "=", "tuple", "(", "map", "(", "id", ",", "path", ")", ")", "item", "=", "self", ".", "_cache", ".", "get", "(", "key", ",", "None", ")", "if", "item", "is", "None", ":", "logger", ".",...
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.
[ "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", ")", "." ]
54a4351d98c1f90dfb1a557d1b447c1f57470eea
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/transforms/_util.py#L143-L164
train
Get a transform from the cache that maps along path which must be a list of Transforms to apply in reverse order.
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/visuals/transforms/_util.py
TransformCache.roll
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) ...
python
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", ")", ":", "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.
[ "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", "." ]
54a4351d98c1f90dfb1a557d1b447c1f57470eea
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/transforms/_util.py#L171-L183
train
Roll the cache by 1. Items whose age is greater than self. max_age will be removed from the cache.
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/plot/plotwidget.py
PlotWidget.histogram
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....
python
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'", ")", ":", "self", ".", "_configure_2d", "(", ")", "hist", "=", "scene", ".", "Histogram", "(", "data", ",", "bins", ",",...
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. ...
[ "Calculate", "and", "show", "a", "histogram", "of", "data" ]
54a4351d98c1f90dfb1a557d1b447c1f57470eea
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/plot/plotwidget.py#L159-L182
train
Calculate and show a histogram of data.
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/plot/plotwidget.py
PlotWidget.image
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. ...
python
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", ")", ":", "self", ".", "_configure_2d", "(", "fg_color", ")", "image", "=", "scene", ".", "Image", "(", "data", ",", ...
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. ...
[ "Show", "an", "image" ]
54a4351d98c1f90dfb1a557d1b447c1f57470eea
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/plot/plotwidget.py#L184-L214
train
Show an image in the view.
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/plot/plotwidget.py
PlotWidget.mesh
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...
python
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", ",", "m...
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 ...
[ "Show", "a", "3D", "mesh" ]
54a4351d98c1f90dfb1a557d1b447c1f57470eea
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/plot/plotwidget.py#L216-L262
train
Show a 3D mesh.
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/plot/plotwidget.py
PlotWidget.plot
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...
python
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'", ",",...
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...
[ "Plot", "a", "series", "of", "data", "using", "lines", "and", "markers" ]
54a4351d98c1f90dfb1a557d1b447c1f57470eea
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/plot/plotwidget.py#L264-L325
train
Plot a series of data using lines and markers.
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/plot/plotwidget.py
PlotWidget.spectrogram
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 ...
python
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 zero-padded to length ``n_fft``. n_fft : int Number of FFT points. Much faster for powers of two. step : int | None...
[ "Calculate", "and", "show", "a", "spectrogram" ]
54a4351d98c1f90dfb1a557d1b447c1f57470eea
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/plot/plotwidget.py#L327-L370
train
Calculate and show a spectrogram of the specified data.
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/plot/plotwidget.py
PlotWidget.volume
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...
python
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'", ")", ":", "self", ".", "_configure_3d", "(", ")", "volume", "=", "scene", ".", "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...
[ "Show", "a", "3D", "volume" ]
54a4351d98c1f90dfb1a557d1b447c1f57470eea
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/plot/plotwidget.py#L372-L406
train
Show a 3D volume
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/plot/plotwidget.py
PlotWidget.surface
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...
python
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", ")", ":", "self", ".", "_configure_3d", "(", ")", "surf", "=", "scene", ".", "SurfacePlot", "(", "z", "=", "zdata", ",", "*", "*", "kwargs", ")", "self", ".", "view", ".", "add...
Show a 3D surface plot. Extra keyword arguments are passed to `SurfacePlot()`. Parameters ---------- zdata : array-like A 2D array of the surface Z values.
[ "Show", "a", "3D", "surface", "plot", "." ]
54a4351d98c1f90dfb1a557d1b447c1f57470eea
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/plot/plotwidget.py#L408-L423
train
Show a 3D surface plot.
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/plot/plotwidget.py
PlotWidget.colorbar
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...
python
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 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...
[ "Show", "a", "ColorBar" ]
54a4351d98c1f90dfb1a557d1b447c1f57470eea
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/plot/plotwidget.py#L425-L499
train
Show a ColorBarWidget for the specified ColorMap and position.
glue-viz/glue-vispy-viewers
glue_vispy_viewers/scatter/layer_artist.py
ScatterLayerArtist.redraw
def redraw(self): """ Redraw the Vispy canvas """ if self._multiscat is not None: self._multiscat._update() self.vispy_widget.canvas.update()
python
def redraw(self): """ Redraw the Vispy canvas """ if self._multiscat is not None: self._multiscat._update() self.vispy_widget.canvas.update()
[ "def", "redraw", "(", "self", ")", ":", "if", "self", ".", "_multiscat", "is", "not", "None", ":", "self", ".", "_multiscat", ".", "_update", "(", ")", "self", ".", "vispy_widget", ".", "canvas", ".", "update", "(", ")" ]
Redraw the Vispy canvas
[ "Redraw", "the", "Vispy", "canvas" ]
54a4351d98c1f90dfb1a557d1b447c1f57470eea
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/scatter/layer_artist.py#L96-L102
train
Redraw the Vispy canvas
glue-viz/glue-vispy-viewers
glue_vispy_viewers/scatter/layer_artist.py
ScatterLayerArtist.remove
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...
python
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", ")", ":", "if", "self", ".", "_multiscat", "is", "None", ":", "return", "self", ".", "_multiscat", ".", "deallocate", "(", "self", ".", "id", ")", "self", ".", "_multiscat", "=", "None", "self", ".", "_viewer_state", ".", ...
Remove the layer artist from the visualization
[ "Remove", "the", "layer", "artist", "from", "the", "visualization" ]
54a4351d98c1f90dfb1a557d1b447c1f57470eea
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/scatter/layer_artist.py#L110-L122
train
Remove the layer artist from the visualization
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/gloo/wrappers.py
_check_valid
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))
python
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", ")", ":", "if", "val", "not", "in", "valid", ":", "raise", "ValueError", "(", "'%s must be one of %s, not \"%s\"'", "%", "(", "key", ",", "valid", ",", "val", ")", ")" ]
Helper to check valid options
[ "Helper", "to", "check", "valid", "options" ]
54a4351d98c1f90dfb1a557d1b447c1f57470eea
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/wrappers.py#L64-L68
train
Helper to check if a key value is in the valid options
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/gloo/wrappers.py
_to_args
def _to_args(x): """Convert to args representation""" if not isinstance(x, (list, tuple, np.ndarray)): x = [x] return x
python
def _to_args(x): """Convert to args representation""" if not isinstance(x, (list, tuple, np.ndarray)): x = [x] return x
[ "def", "_to_args", "(", "x", ")", ":", "if", "not", "isinstance", "(", "x", ",", "(", "list", ",", "tuple", ",", "np", ".", "ndarray", ")", ")", ":", "x", "=", "[", "x", "]", "return", "x" ]
Convert to args representation
[ "Convert", "to", "args", "representation" ]
54a4351d98c1f90dfb1a557d1b447c1f57470eea
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/wrappers.py#L71-L75
train
Convert to args representation
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/gloo/wrappers.py
_check_conversion
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...
python
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", ")", ":", "if", "key", "not", "in", "valid_dict", "and", "key", "not", "in", "valid_dict", ".", "values", "(", ")", ":", "# Only show users the nice string values", "keys", "=", "[", "v", "for", "v",...
Check for existence of key in dict, return value or raise error
[ "Check", "for", "existence", "of", "key", "in", "dict", "return", "value", "or", "raise", "error" ]
54a4351d98c1f90dfb1a557d1b447c1f57470eea
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/wrappers.py#L78-L84
train
Check for existence of key in dict return value or raise error
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/gloo/wrappers.py
read_pixels
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...
python
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'", ")", ":", "# Check whether the GL context is direct or remote", "context", "=", "get_current_canvas", "(", ")", ".", "context", "if", "context", ...
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,...
[ "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"...
54a4351d98c1f90dfb1a557d1b447c1f57470eea
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/wrappers.py#L606-L663
train
Read pixels from the currently selected buffer.
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/gloo/wrappers.py
get_gl_configuration
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...
python
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", "(", ")", ":", "# 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...
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.
[ "Read", "the", "current", "gl", "configuration" ]
54a4351d98c1f90dfb1a557d1b447c1f57470eea
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/wrappers.py#L666-L708
train
Read the current GL configuration.
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/gloo/wrappers.py
BaseGlooFunctions.set_viewport
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...
python
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", ")", ":", "x", ",", "y", ",", "w", ",", "h", "=", "args", "[", "0", "]", "if", "len", "(", "args", ")", "==", "1", "else", "args", "self", ".", "glir", ".", "command", "(", "'FUNC'", ",", ...
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.
[ "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...
54a4351d98c1f90dfb1a557d1b447c1f57470eea
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/wrappers.py#L100-L112
train
Set the OpenGL viewport of the specified category.
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/gloo/wrappers.py
BaseGlooFunctions.set_depth_range
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))
python
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.", ")", ":", "self", ".", "glir", ".", "command", "(", "'FUNC'", ",", "'glDepthRange'", ",", "float", "(", "near", ")", ",", "float", "(", "far", ")", ")" ]
Set depth values Parameters ---------- near : float Near clipping plane. far : float Far clipping plane.
[ "Set", "depth", "values", "Parameters", "----------", "near", ":", "float", "Near", "clipping", "plane", ".", "far", ":", "float", "Far", "clipping", "plane", "." ]
54a4351d98c1f90dfb1a557d1b447c1f57470eea
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/wrappers.py#L114-L124
train
Set the depth range of the current object.
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/gloo/wrappers.py
BaseGlooFunctions.set_line_width
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...
python
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.", ")", ":", "width", "=", "float", "(", "width", ")", "if", "width", "<", "0", ":", "raise", "RuntimeError", "(", "'Cannot have width < 0'", ")", "self", ".", "glir", ".", "command", "(", "'F...
Set line width Parameters ---------- width : float The line width.
[ "Set", "line", "width", "Parameters", "----------", "width", ":", "float", "The", "line", "width", "." ]
54a4351d98c1f90dfb1a557d1b447c1f57470eea
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/wrappers.py#L146-L157
train
Set the line width of the current locale.
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/gloo/wrappers.py
BaseGlooFunctions.set_polygon_offset
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...
python
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.", ")", ":", "self", ".", "glir", ".", "command", "(", "'FUNC'", ",", "'glPolygonOffset'", ",", "float", "(", "factor", ")", ",", "float", "(", "units", ")", ")...
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 ...
[ "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", ":...
54a4351d98c1f90dfb1a557d1b447c1f57470eea
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/wrappers.py#L159-L172
train
Sets the scale and units used to calculate the depth values for the polygon.
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/gloo/wrappers.py
BaseGlooFunctions.clear
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 ...
python
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", ")", ":", "bits", "=", "0", "if", "isinstance", "(", "color", ",", "np", ".", "ndarray", ")", "or", "bool", "(", "color", ")", ":", ...
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 |...
[ "Clear", "the", "screen", "buffers", "This", "is", "a", "wrapper", "for", "gl", ".", "glClear", ".", "Parameters", "----------", "color", ":", "bool", "|", "str", "|", "tuple", "|", "instance", "of", "Color", "Clear", "the", "color", "buffer", "bit", "."...
54a4351d98c1f90dfb1a557d1b447c1f57470eea
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/wrappers.py#L181-L211
train
Clear the color and depth buffers of the current object.
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/gloo/wrappers.py
BaseGlooFunctions.set_clear_color
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 ...
python
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", ")", ":", "self", ".", "glir", ".", "command", "(", "'FUNC'", ",", "'glClearColor'", ",", "*", "Color", "(", "color", ",", "alpha", ")", ".", "rgba", ")" ...
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.
[ "Set", "the", "screen", "clear", "color" ]
54a4351d98c1f90dfb1a557d1b447c1f57470eea
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/wrappers.py#L213-L225
train
Set the screen clear color
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/gloo/wrappers.py
BaseGlooFunctions.set_blend_func
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...
python
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", ")", ":", "salpha", "=", "srgb", "if", "salpha", "is", "None", "else", "salpha", "dalpha", "=", "drgb...
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...
[ "Specify", "pixel", "arithmetic", "for", "RGB", "and", "alpha", "Parameters", "----------", "srgb", ":", "str", "Source", "RGB", "factor", ".", "drgb", ":", "str", "Destination", "RGB", "factor", ".", "salpha", ":", "str", "|", "None", "Source", "alpha", "...
54a4351d98c1f90dfb1a557d1b447c1f57470eea
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/wrappers.py#L253-L271
train
Specify pixel arithmetic for RGB and alpha
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/gloo/wrappers.py
BaseGlooFunctions.set_blend_equation
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 ...
python
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", ")", ":", "mode_alpha", "=", "mode_rgb", "if", "mode_alpha", "is", "None", "else", "mode_alpha", "self", ".", "glir", ".", "command", "(", "'FUNC'", ",", "'glBlendEqua...
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.
[ "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...
54a4351d98c1f90dfb1a557d1b447c1f57470eea
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/wrappers.py#L283-L299
train
Specify the equation for RGB and Alpha blending .
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/gloo/wrappers.py
BaseGlooFunctions.set_scissor
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. ...
python
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", ")", ":", "self", ".", "glir", ".", "command", "(", "'FUNC'", ",", "'glScissor'", ",", "int", "(", "x", ")", ",", "int", "(", "y", ")", ",", "int", "(", "w", ")", ",...
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", "...
54a4351d98c1f90dfb1a557d1b447c1f57470eea
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/wrappers.py#L304-L318
train
Define the scissor box.
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/gloo/wrappers.py
BaseGlooFunctions.set_stencil_func
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...
python
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'", ")", ":", "self", ".", "glir", ".", "command", "(", "'FUNC'", ",", "'glStencilFuncSeparate'", ",", ...
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 ...
[ "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", ...
54a4351d98c1f90dfb1a557d1b447c1f57470eea
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/wrappers.py#L320-L336
train
Set the stencil test function and reference value for the current stencil test.
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/gloo/wrappers.py
BaseGlooFunctions.set_stencil_mask
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',...
python
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'", ")", ":", "self", ".", "glir", ".", "command", "(", "'FUNC'", ",", "'glStencilMaskSeparate'", ",", "face", ",", "int", "(", "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'.
[ "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...
54a4351d98c1f90dfb1a557d1b447c1f57470eea
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/wrappers.py#L338-L348
train
Control the front or back writing of individual bits in the stencil.
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/gloo/wrappers.py
BaseGlooFunctions.set_stencil_op
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...
python
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'", ")", ":", "self", ".", "glir", ".", "command", "(", "'FUNC'", ",", "'glStencilOpSeparate'",...
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...
[ "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", ...
54a4351d98c1f90dfb1a557d1b447c1f57470eea
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/wrappers.py#L350-L370
train
Set the stencil test actions for a specific buffer.
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/gloo/wrappers.py
BaseGlooFunctions.set_color_mask
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 ...
python
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", ")", ":", "self", ".", "glir", ".", "command", "(", "'FUNC'", ",", "'glColorMask'", ",", "bool", "(", "red", ")", ",", "bool", "(", "green", ")", ",", "bool"...
Toggle writing of frame buffer color components Parameters ---------- red : bool Red toggle. green : bool Green toggle. blue : bool Blue toggle. alpha : bool Alpha toggle.
[ "Toggle", "writing", "of", "frame", "buffer", "color", "components", "Parameters", "----------", "red", ":", "bool", "Red", "toggle", ".", "green", ":", "bool", "Green", "toggle", ".", "blue", ":", "bool", "Blue", "toggle", ".", "alpha", ":", "bool", "Alph...
54a4351d98c1f90dfb1a557d1b447c1f57470eea
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/wrappers.py#L395-L410
train
Toggle writing of frame buffer color components
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/gloo/wrappers.py
BaseGlooFunctions.set_sample_coverage
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...
python
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", ")", ":", "self", ".", "glir", ".", "command", "(", "'FUNC'", ",", "'glSampleCoverage'", ",", "float", "(", "value", ")", ",", "bool", "(", "invert", ")",...
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.
[ "Specify", "multisample", "coverage", "parameters", "Parameters", "----------", "value", ":", "float", "Sample", "coverage", "value", "(", "will", "be", "clamped", "between", "0", ".", "and", "1", ".", ")", ".", "invert", ":", "bool", "Specify", "if", "the",...
54a4351d98c1f90dfb1a557d1b447c1f57470eea
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/wrappers.py#L412-L423
train
Set the coverage of the sample in the current context.
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/gloo/wrappers.py
BaseGlooFunctions.set_state
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. ...
python
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", ")", ":", "kwargs", "=", "deepcopy", "(", "kwargs", ")", "# Load preset, if supplied", "if", "preset", "is", "not", "None", ":", "_check_valid", "(", "'preset'", ",", "...
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...
[ "Set", "OpenGL", "rendering", "state", "optionally", "using", "a", "preset", "Parameters", "----------", "preset", ":", "str", "|", "None", "Can", "be", "one", "of", "(", "opaque", "translucent", "additive", ")", "to", "use", "use", "reasonable", "defaults", ...
54a4351d98c1f90dfb1a557d1b447c1f57470eea
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/wrappers.py#L442-L527
train
Sets the state of the OpenGL rendering system for the specified object.
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/gloo/wrappers.py
BaseGlooFunctions.finish
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 ...
python
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", ")", ":", "if", "hasattr", "(", "self", ",", "'flush_commands'", ")", ":", "context", "=", "self", "else", ":", "context", "=", "get_current_canvas", "(", ")", ".", "context", "context", ".", "glir", ".", "command", "(", "...
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.
[ "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", ".", ...
54a4351d98c1f90dfb1a557d1b447c1f57470eea
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/wrappers.py#L533-L545
train
Wait for GL commands to finish processing the
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/gloo/wrappers.py
BaseGlooFunctions.flush
def flush(self): """Flush GL commands This is a wrapper for glFlush(). This also flushes the GLIR command queue. """ if hasattr(self, 'flush_commands'): context = self else: context = get_current_canvas().context context.glir.command('...
python
def flush(self): """Flush GL commands This is a wrapper for glFlush(). This also flushes the GLIR command queue. """ if hasattr(self, 'flush_commands'): context = self else: context = get_current_canvas().context context.glir.command('...
[ "def", "flush", "(", "self", ")", ":", "if", "hasattr", "(", "self", ",", "'flush_commands'", ")", ":", "context", "=", "self", "else", ":", "context", "=", "get_current_canvas", "(", ")", ".", "context", "context", ".", "glir", ".", "command", "(", "'...
Flush GL commands This is a wrapper for glFlush(). This also flushes the GLIR command queue.
[ "Flush", "GL", "commands", "This", "is", "a", "wrapper", "for", "glFlush", "()", ".", "This", "also", "flushes", "the", "GLIR", "command", "queue", "." ]
54a4351d98c1f90dfb1a557d1b447c1f57470eea
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/wrappers.py#L547-L558
train
Flush GL commands that are currently in use.
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/gloo/wrappers.py
BaseGlooFunctions.set_hint
def set_hint(self, target, mode): """Set OpenGL drawing hint Parameters ---------- target : str The target, e.g. 'fog_hint', 'line_smooth_hint', 'point_smooth_hint'. mode : str The mode to set (e.g., 'fastest', 'nicest', 'dont_care'). ...
python
def set_hint(self, target, mode): """Set OpenGL drawing hint Parameters ---------- target : str The target, e.g. 'fog_hint', 'line_smooth_hint', 'point_smooth_hint'. mode : str The mode to set (e.g., 'fastest', 'nicest', 'dont_care'). ...
[ "def", "set_hint", "(", "self", ",", "target", ",", "mode", ")", ":", "if", "not", "all", "(", "isinstance", "(", "tm", ",", "string_types", ")", "for", "tm", "in", "(", "target", ",", "mode", ")", ")", ":", "raise", "TypeError", "(", "'target and mo...
Set OpenGL drawing hint Parameters ---------- target : str The target, e.g. 'fog_hint', 'line_smooth_hint', 'point_smooth_hint'. mode : str The mode to set (e.g., 'fastest', 'nicest', 'dont_care').
[ "Set", "OpenGL", "drawing", "hint", "Parameters", "----------", "target", ":", "str", "The", "target", "e", ".", "g", ".", "fog_hint", "line_smooth_hint", "point_smooth_hint", ".", "mode", ":", "str", "The", "mode", "to", "set", "(", "e", ".", "g", ".", ...
54a4351d98c1f90dfb1a557d1b447c1f57470eea
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/wrappers.py#L560-L573
train
Set OpenGL drawing hint for the specified target and mode.
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/gloo/wrappers.py
GlooFunctions.glir
def glir(self): """ The GLIR queue corresponding to the current canvas """ canvas = get_current_canvas() if canvas is None: msg = ("If you want to use gloo without vispy.app, " + "use a gloo.context.FakeCanvas.") raise RuntimeError('Gloo requir...
python
def glir(self): """ The GLIR queue corresponding to the current canvas """ canvas = get_current_canvas() if canvas is None: msg = ("If you want to use gloo without vispy.app, " + "use a gloo.context.FakeCanvas.") raise RuntimeError('Gloo requir...
[ "def", "glir", "(", "self", ")", ":", "canvas", "=", "get_current_canvas", "(", ")", "if", "canvas", "is", "None", ":", "msg", "=", "(", "\"If you want to use gloo without vispy.app, \"", "+", "\"use a gloo.context.FakeCanvas.\"", ")", "raise", "RuntimeError", "(", ...
The GLIR queue corresponding to the current canvas
[ "The", "GLIR", "queue", "corresponding", "to", "the", "current", "canvas" ]
54a4351d98c1f90dfb1a557d1b447c1f57470eea
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/wrappers.py#L579-L587
train
Returns the GLIR queue corresponding to the current canvas s GLIR queue.
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/gloo/gl/__init__.py
use_gl
def use_gl(target='gl2'): """ Let Vispy use the target OpenGL ES 2.0 implementation Also see ``vispy.use()``. Parameters ---------- target : str The target GL backend to use. Available backends: * gl2 - Use ES 2.0 subset of desktop (i.e. normal) OpenGL * gl+ - Use the ...
python
def use_gl(target='gl2'): """ Let Vispy use the target OpenGL ES 2.0 implementation Also see ``vispy.use()``. Parameters ---------- target : str The target GL backend to use. Available backends: * gl2 - Use ES 2.0 subset of desktop (i.e. normal) OpenGL * gl+ - Use the ...
[ "def", "use_gl", "(", "target", "=", "'gl2'", ")", ":", "target", "=", "target", "or", "'gl2'", "target", "=", "target", ".", "replace", "(", "'+'", ",", "'plus'", ")", "# Get options", "target", ",", "_", ",", "options", "=", "target", ".", "partition...
Let Vispy use the target OpenGL ES 2.0 implementation Also see ``vispy.use()``. Parameters ---------- target : str The target GL backend to use. Available backends: * gl2 - Use ES 2.0 subset of desktop (i.e. normal) OpenGL * gl+ - Use the desktop ES 2.0 subset plus all non...
[ "Let", "Vispy", "use", "the", "target", "OpenGL", "ES", "2", ".", "0", "implementation", "Also", "see", "vispy", ".", "use", "()", ".", "Parameters", "----------", "target", ":", "str", "The", "target", "GL", "backend", "to", "use", "." ]
54a4351d98c1f90dfb1a557d1b447c1f57470eea
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/gl/__init__.py#L102-L150
train
Let Vispy use the target OpenGL GL backend.
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/gloo/gl/__init__.py
_clear_namespace
def _clear_namespace(): """ Clear names that are not part of the strict ES API """ ok_names = set(default_backend.__dict__) ok_names.update(['gl2', 'glplus']) # don't remove the module NS = globals() for name in list(NS.keys()): if name.lower().startswith('gl'): if name not ...
python
def _clear_namespace(): """ Clear names that are not part of the strict ES API """ ok_names = set(default_backend.__dict__) ok_names.update(['gl2', 'glplus']) # don't remove the module NS = globals() for name in list(NS.keys()): if name.lower().startswith('gl'): if name not ...
[ "def", "_clear_namespace", "(", ")", ":", "ok_names", "=", "set", "(", "default_backend", ".", "__dict__", ")", "ok_names", ".", "update", "(", "[", "'gl2'", ",", "'glplus'", "]", ")", "# don't remove the module", "NS", "=", "globals", "(", ")", "for", "na...
Clear names that are not part of the strict ES API
[ "Clear", "names", "that", "are", "not", "part", "of", "the", "strict", "ES", "API" ]
54a4351d98c1f90dfb1a557d1b447c1f57470eea
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/gl/__init__.py#L153-L162
train
Clear the names that are not part of the strict ES API
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/gloo/gl/__init__.py
check_error
def check_error(when='periodic check'): """ Check this from time to time to detect GL errors. Parameters ---------- when : str Shown in the exception to help the developer determine when this check was done. """ errors = [] while True: err = glGetError() if ...
python
def check_error(when='periodic check'): """ Check this from time to time to detect GL errors. Parameters ---------- when : str Shown in the exception to help the developer determine when this check was done. """ errors = [] while True: err = glGetError() if ...
[ "def", "check_error", "(", "when", "=", "'periodic check'", ")", ":", "errors", "=", "[", "]", "while", "True", ":", "err", "=", "glGetError", "(", ")", "if", "err", "==", "GL_NO_ERROR", "or", "(", "errors", "and", "err", "==", "errors", "[", "-", "1...
Check this from time to time to detect GL errors. Parameters ---------- when : str Shown in the exception to help the developer determine when this check was done.
[ "Check", "this", "from", "time", "to", "time", "to", "detect", "GL", "errors", "." ]
54a4351d98c1f90dfb1a557d1b447c1f57470eea
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/gl/__init__.py#L190-L211
train
Check this from time to time to detect GL errors.
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/gloo/gl/__init__.py
DebugProxy._arg_repr
def _arg_repr(self, arg): """ Get a useful (and not too large) represetation of an argument. """ r = repr(arg) max = 40 if len(r) > max: if hasattr(arg, 'shape'): r = 'array:' + 'x'.join([repr(s) for s in arg.shape]) else: r...
python
def _arg_repr(self, arg): """ Get a useful (and not too large) represetation of an argument. """ r = repr(arg) max = 40 if len(r) > max: if hasattr(arg, 'shape'): r = 'array:' + 'x'.join([repr(s) for s in arg.shape]) else: r...
[ "def", "_arg_repr", "(", "self", ",", "arg", ")", ":", "r", "=", "repr", "(", "arg", ")", "max", "=", "40", "if", "len", "(", "r", ")", ">", "max", ":", "if", "hasattr", "(", "arg", ",", "'shape'", ")", ":", "r", "=", "'array:'", "+", "'x'", ...
Get a useful (and not too large) represetation of an argument.
[ "Get", "a", "useful", "(", "and", "not", "too", "large", ")", "represetation", "of", "an", "argument", "." ]
54a4351d98c1f90dfb1a557d1b447c1f57470eea
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/gl/__init__.py#L65-L75
train
Get a useful represetation of an argument.
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/visuals/isocurve.py
IsocurveVisual.set_data
def set_data(self, data): """ Set the scalar array data Parameters ---------- data : ndarray A 2D array of scalar values. The isocurve is constructed to show all locations in the scalar field equal to ``self.levels``. """ self._data = data ...
python
def set_data(self, data): """ Set the scalar array data Parameters ---------- data : ndarray A 2D array of scalar values. The isocurve is constructed to show all locations in the scalar field equal to ``self.levels``. """ self._data = data ...
[ "def", "set_data", "(", "self", ",", "data", ")", ":", "self", ".", "_data", "=", "data", "# if using matplotlib isoline algorithm we have to check for meshgrid", "# and we can setup the tracer object here", "if", "_HAS_MPL", ":", "if", "self", ".", "_X", "is", "None", ...
Set the scalar array data Parameters ---------- data : ndarray A 2D array of scalar values. The isocurve is constructed to show all locations in the scalar field equal to ``self.levels``.
[ "Set", "the", "scalar", "array", "data" ]
54a4351d98c1f90dfb1a557d1b447c1f57470eea
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/isocurve.py#L96-L127
train
Set the scalar array data.
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/visuals/isocurve.py
IsocurveVisual._get_verts_and_connect
def _get_verts_and_connect(self, paths): """ retrieve vertices and connects from given paths-list """ verts = np.vstack(paths) gaps = np.add.accumulate(np.array([len(x) for x in paths])) - 1 connect = np.ones(gaps[-1], dtype=bool) connect[gaps[:-1]] = False return...
python
def _get_verts_and_connect(self, paths): """ retrieve vertices and connects from given paths-list """ verts = np.vstack(paths) gaps = np.add.accumulate(np.array([len(x) for x in paths])) - 1 connect = np.ones(gaps[-1], dtype=bool) connect[gaps[:-1]] = False return...
[ "def", "_get_verts_and_connect", "(", "self", ",", "paths", ")", ":", "verts", "=", "np", ".", "vstack", "(", "paths", ")", "gaps", "=", "np", ".", "add", ".", "accumulate", "(", "np", ".", "array", "(", "[", "len", "(", "x", ")", "for", "x", "in...
retrieve vertices and connects from given paths-list
[ "retrieve", "vertices", "and", "connects", "from", "given", "paths", "-", "list" ]
54a4351d98c1f90dfb1a557d1b447c1f57470eea
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/isocurve.py#L129-L136
train
retrieve vertices and connects from given paths - list
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/visuals/isocurve.py
IsocurveVisual._compute_iso_line
def _compute_iso_line(self): """ compute LineVisual vertices, connects and color-index """ level_index = [] connects = [] verts = [] # calculate which level are within data range # this works for now and the existing examples, but should be tested # thoro...
python
def _compute_iso_line(self): """ compute LineVisual vertices, connects and color-index """ level_index = [] connects = [] verts = [] # calculate which level are within data range # this works for now and the existing examples, but should be tested # thoro...
[ "def", "_compute_iso_line", "(", "self", ")", ":", "level_index", "=", "[", "]", "connects", "=", "[", "]", "verts", "=", "[", "]", "# calculate which level are within data range", "# this works for now and the existing examples, but should be tested", "# thoroughly also with...
compute LineVisual vertices, connects and color-index
[ "compute", "LineVisual", "vertices", "connects", "and", "color", "-", "index" ]
54a4351d98c1f90dfb1a557d1b447c1f57470eea
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/isocurve.py#L138-L175
train
compute LineVisual vertices connects and color - index
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/util/event.py
EventEmitter.connect
def connect(self, callback, ref=False, position='first', before=None, after=None): """Connect this emitter to a new callback. Parameters ---------- callback : function | tuple *callback* may be either a callable object or a tuple (object, attr_nam...
python
def connect(self, callback, ref=False, position='first', before=None, after=None): """Connect this emitter to a new callback. Parameters ---------- callback : function | tuple *callback* may be either a callable object or a tuple (object, attr_nam...
[ "def", "connect", "(", "self", ",", "callback", ",", "ref", "=", "False", ",", "position", "=", "'first'", ",", "before", "=", "None", ",", "after", "=", "None", ")", ":", "callbacks", "=", "self", ".", "callbacks", "callback_refs", "=", "self", ".", ...
Connect this emitter to a new callback. Parameters ---------- callback : function | tuple *callback* may be either a callable object or a tuple (object, attr_name) where object.attr_name will point to a callable object. Note that only a weak reference to ``ob...
[ "Connect", "this", "emitter", "to", "a", "new", "callback", "." ]
54a4351d98c1f90dfb1a557d1b447c1f57470eea
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/util/event.py#L266-L373
train
Connect this emitter to a new callback.
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/util/event.py
EventEmitter.disconnect
def disconnect(self, callback=None): """Disconnect a callback from this emitter. If no callback is specified, then *all* callbacks are removed. If the callback was not already connected, then the call does nothing. """ if callback is None: self._callbacks = [] ...
python
def disconnect(self, callback=None): """Disconnect a callback from this emitter. If no callback is specified, then *all* callbacks are removed. If the callback was not already connected, then the call does nothing. """ if callback is None: self._callbacks = [] ...
[ "def", "disconnect", "(", "self", ",", "callback", "=", "None", ")", ":", "if", "callback", "is", "None", ":", "self", ".", "_callbacks", "=", "[", "]", "self", ".", "_callback_refs", "=", "[", "]", "else", ":", "callback", "=", "self", ".", "_normal...
Disconnect a callback from this emitter. If no callback is specified, then *all* callbacks are removed. If the callback was not already connected, then the call does nothing.
[ "Disconnect", "a", "callback", "from", "this", "emitter", "." ]
54a4351d98c1f90dfb1a557d1b447c1f57470eea
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/util/event.py#L375-L389
train
Disconnect a callback from this emitter.
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/util/event.py
EventEmitter.block
def block(self, callback=None): """Block this emitter. Any attempts to emit an event while blocked will be silently ignored. If *callback* is given, then the emitter is only blocked for that specific callback. Calls to block are cumulative; the emitter must be unblocked the same ...
python
def block(self, callback=None): """Block this emitter. Any attempts to emit an event while blocked will be silently ignored. If *callback* is given, then the emitter is only blocked for that specific callback. Calls to block are cumulative; the emitter must be unblocked the same ...
[ "def", "block", "(", "self", ",", "callback", "=", "None", ")", ":", "self", ".", "_blocked", "[", "callback", "]", "=", "self", ".", "_blocked", ".", "get", "(", "callback", ",", "0", ")", "+", "1" ]
Block this emitter. Any attempts to emit an event while blocked will be silently ignored. If *callback* is given, then the emitter is only blocked for that specific callback. Calls to block are cumulative; the emitter must be unblocked the same number of times as it is blocked.
[ "Block", "this", "emitter", ".", "Any", "attempts", "to", "emit", "an", "event", "while", "blocked", "will", "be", "silently", "ignored", ".", "If", "*", "callback", "*", "is", "given", "then", "the", "emitter", "is", "only", "blocked", "for", "that", "s...
54a4351d98c1f90dfb1a557d1b447c1f57470eea
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/util/event.py#L500-L508
train
Block this emitter.
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/util/event.py
EventEmitter.unblock
def unblock(self, callback=None): """ Unblock this emitter. See :func:`event.EventEmitter.block`. Note: Use of ``unblock(None)`` only reverses the effect of ``block(None)``; it does not unblock callbacks that were explicitly blocked using ``block(callback)``. """ ...
python
def unblock(self, callback=None): """ Unblock this emitter. See :func:`event.EventEmitter.block`. Note: Use of ``unblock(None)`` only reverses the effect of ``block(None)``; it does not unblock callbacks that were explicitly blocked using ``block(callback)``. """ ...
[ "def", "unblock", "(", "self", ",", "callback", "=", "None", ")", ":", "if", "callback", "not", "in", "self", ".", "_blocked", "or", "self", ".", "_blocked", "[", "callback", "]", "==", "0", ":", "raise", "RuntimeError", "(", "\"Cannot unblock %s for callb...
Unblock this emitter. See :func:`event.EventEmitter.block`. Note: Use of ``unblock(None)`` only reverses the effect of ``block(None)``; it does not unblock callbacks that were explicitly blocked using ``block(callback)``.
[ "Unblock", "this", "emitter", ".", "See", ":", "func", ":", "event", ".", "EventEmitter", ".", "block", ".", "Note", ":", "Use", "of", "unblock", "(", "None", ")", "only", "reverses", "the", "effect", "of", "block", "(", "None", ")", ";", "it", "does...
54a4351d98c1f90dfb1a557d1b447c1f57470eea
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/util/event.py#L510-L525
train
Unblock this emitter.
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/util/event.py
EmitterGroup.add
def add(self, auto_connect=None, **kwargs): """ Add one or more EventEmitter instances to this emitter group. Each keyword argument may be specified as either an EventEmitter instance or an Event subclass, in which case an EventEmitter will be generated automatically:: # Thi...
python
def add(self, auto_connect=None, **kwargs): """ Add one or more EventEmitter instances to this emitter group. Each keyword argument may be specified as either an EventEmitter instance or an Event subclass, in which case an EventEmitter will be generated automatically:: # Thi...
[ "def", "add", "(", "self", ",", "auto_connect", "=", "None", ",", "*", "*", "kwargs", ")", ":", "if", "auto_connect", "is", "None", ":", "auto_connect", "=", "self", ".", "auto_connect", "# check all names before adding anything", "for", "name", "in", "kwargs"...
Add one or more EventEmitter instances to this emitter group. Each keyword argument may be specified as either an EventEmitter instance or an Event subclass, in which case an EventEmitter will be generated automatically:: # This statement: group.add(mouse_press=MouseEven...
[ "Add", "one", "or", "more", "EventEmitter", "instances", "to", "this", "emitter", "group", ".", "Each", "keyword", "argument", "may", "be", "specified", "as", "either", "an", "EventEmitter", "instance", "or", "an", "Event", "subclass", "in", "which", "case", ...
54a4351d98c1f90dfb1a557d1b447c1f57470eea
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/util/event.py#L633-L690
train
Adds one or more Emitters to this emitter group.
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/util/event.py
EmitterGroup.block_all
def block_all(self): """ Block all emitters in this group. """ self.block() for em in self._emitters.values(): em.block()
python
def block_all(self): """ Block all emitters in this group. """ self.block() for em in self._emitters.values(): em.block()
[ "def", "block_all", "(", "self", ")", ":", "self", ".", "block", "(", ")", "for", "em", "in", "self", ".", "_emitters", ".", "values", "(", ")", ":", "em", ".", "block", "(", ")" ]
Block all emitters in this group.
[ "Block", "all", "emitters", "in", "this", "group", "." ]
54a4351d98c1f90dfb1a557d1b447c1f57470eea
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/util/event.py#L705-L710
train
Block all emitters in this group.
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/util/event.py
EmitterGroup.unblock_all
def unblock_all(self): """ Unblock all emitters in this group. """ self.unblock() for em in self._emitters.values(): em.unblock()
python
def unblock_all(self): """ Unblock all emitters in this group. """ self.unblock() for em in self._emitters.values(): em.unblock()
[ "def", "unblock_all", "(", "self", ")", ":", "self", ".", "unblock", "(", ")", "for", "em", "in", "self", ".", "_emitters", ".", "values", "(", ")", ":", "em", ".", "unblock", "(", ")" ]
Unblock all emitters in this group.
[ "Unblock", "all", "emitters", "in", "this", "group", "." ]
54a4351d98c1f90dfb1a557d1b447c1f57470eea
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/util/event.py#L712-L717
train
Unblock all emitters in this group.
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/util/event.py
EmitterGroup.connect
def connect(self, callback, ref=False, position='first', before=None, after=None): """ Connect the callback to the event group. The callback will receive events from *all* of the emitters in the group. See :func:`EventEmitter.connect() <vispy.event.EventEmitter.connect>` ...
python
def connect(self, callback, ref=False, position='first', before=None, after=None): """ Connect the callback to the event group. The callback will receive events from *all* of the emitters in the group. See :func:`EventEmitter.connect() <vispy.event.EventEmitter.connect>` ...
[ "def", "connect", "(", "self", ",", "callback", ",", "ref", "=", "False", ",", "position", "=", "'first'", ",", "before", "=", "None", ",", "after", "=", "None", ")", ":", "self", ".", "_connect_emitters", "(", "True", ")", "return", "EventEmitter", "....
Connect the callback to the event group. The callback will receive events from *all* of the emitters in the group. See :func:`EventEmitter.connect() <vispy.event.EventEmitter.connect>` for arguments.
[ "Connect", "the", "callback", "to", "the", "event", "group", ".", "The", "callback", "will", "receive", "events", "from", "*", "all", "*", "of", "the", "emitters", "in", "the", "group", "." ]
54a4351d98c1f90dfb1a557d1b447c1f57470eea
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/util/event.py#L719-L729
train
Connect the callback to the event group.
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/util/event.py
EmitterGroup.disconnect
def disconnect(self, callback=None): """ Disconnect the callback from this group. See :func:`connect() <vispy.event.EmitterGroup.connect>` and :func:`EventEmitter.connect() <vispy.event.EventEmitter.connect>` for more information. """ ret = EventEmitter.disconnect(self, c...
python
def disconnect(self, callback=None): """ Disconnect the callback from this group. See :func:`connect() <vispy.event.EmitterGroup.connect>` and :func:`EventEmitter.connect() <vispy.event.EventEmitter.connect>` for more information. """ ret = EventEmitter.disconnect(self, c...
[ "def", "disconnect", "(", "self", ",", "callback", "=", "None", ")", ":", "ret", "=", "EventEmitter", ".", "disconnect", "(", "self", ",", "callback", ")", "if", "len", "(", "self", ".", "_callbacks", ")", "==", "0", ":", "self", ".", "_connect_emitter...
Disconnect the callback from this group. See :func:`connect() <vispy.event.EmitterGroup.connect>` and :func:`EventEmitter.connect() <vispy.event.EventEmitter.connect>` for more information.
[ "Disconnect", "the", "callback", "from", "this", "group", ".", "See", ":", "func", ":", "connect", "()", "<vispy", ".", "event", ".", "EmitterGroup", ".", "connect", ">", "and", ":", "func", ":", "EventEmitter", ".", "connect", "()", "<vispy", ".", "even...
54a4351d98c1f90dfb1a557d1b447c1f57470eea
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/util/event.py#L731-L740
train
Disconnect the callback from this group.
anjishnu/ask-alexa-pykit
ask/write_sample.py
validate_input_format
def validate_input_format(utterance, intent): """ TODO add handling for bad input""" slots = {slot["name"] for slot in intent["slots"]} split_utt = re.split("{(.*)}", utterance) banned = set("-/\\()^%$#@~`-_=+><;:") # Banned characters for token in split_utt: if (banned & set(token)): ...
python
def validate_input_format(utterance, intent): """ TODO add handling for bad input""" slots = {slot["name"] for slot in intent["slots"]} split_utt = re.split("{(.*)}", utterance) banned = set("-/\\()^%$#@~`-_=+><;:") # Banned characters for token in split_utt: if (banned & set(token)): ...
[ "def", "validate_input_format", "(", "utterance", ",", "intent", ")", ":", "slots", "=", "{", "slot", "[", "\"name\"", "]", "for", "slot", "in", "intent", "[", "\"slots\"", "]", "}", "split_utt", "=", "re", ".", "split", "(", "\"{(.*)}\"", ",", "utteranc...
TODO add handling for bad input
[ "TODO", "add", "handling", "for", "bad", "input" ]
a47c278ca7a60532bbe1a9b789f6c37e609fea8b
https://github.com/anjishnu/ask-alexa-pykit/blob/a47c278ca7a60532bbe1a9b789f6c37e609fea8b/ask/write_sample.py#L25-L47
train
Validate input format for the Alerting App.
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/geometry/isosurface.py
isosurface
def isosurface(data, level): """ Generate isosurface from volumetric data using marching cubes algorithm. See Paul Bourke, "Polygonising a Scalar Field" (http://paulbourke.net/geometry/polygonise/) *data* 3D numpy array of scalar values *level* The level at which to generate an isosurf...
python
def isosurface(data, level): """ Generate isosurface from volumetric data using marching cubes algorithm. See Paul Bourke, "Polygonising a Scalar Field" (http://paulbourke.net/geometry/polygonise/) *data* 3D numpy array of scalar values *level* The level at which to generate an isosurf...
[ "def", "isosurface", "(", "data", ",", "level", ")", ":", "# For improvement, see:", "# ", "# Efficient implementation of Marching Cubes' cases with topological ", "# guarantees.", "# Thomas Lewiner, Helio Lopes, Antonio Wilson Vieira and Geovan Tavares.", "# Journal of Graphics Tools 8(2)...
Generate isosurface from volumetric data using marching cubes algorithm. See Paul Bourke, "Polygonising a Scalar Field" (http://paulbourke.net/geometry/polygonise/) *data* 3D numpy array of scalar values *level* The level at which to generate an isosurface Returns an array of vertex c...
[ "Generate", "isosurface", "from", "volumetric", "data", "using", "marching", "cubes", "algorithm", ".", "See", "Paul", "Bourke", "Polygonising", "a", "Scalar", "Field", "(", "http", ":", "//", "paulbourke", ".", "net", "/", "geometry", "/", "polygonise", "/", ...
54a4351d98c1f90dfb1a557d1b447c1f57470eea
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/geometry/isosurface.py#L6-L135
train
Generate an isosurface from volumetric data using marching cubes algorithm.
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/app/backends/_ipynb_util.py
_extract_buffers
def _extract_buffers(commands): """Extract all data buffers from the list of GLIR commands, and replace them by buffer pointers {buffer: <buffer_index>}. Return the modified list # of GILR commands and the list of buffers as well.""" # First, filter all DATA commands. data_commands = [command for co...
python
def _extract_buffers(commands): """Extract all data buffers from the list of GLIR commands, and replace them by buffer pointers {buffer: <buffer_index>}. Return the modified list # of GILR commands and the list of buffers as well.""" # First, filter all DATA commands. data_commands = [command for co...
[ "def", "_extract_buffers", "(", "commands", ")", ":", "# First, filter all DATA commands.", "data_commands", "=", "[", "command", "for", "command", "in", "commands", "if", "command", "[", "0", "]", "==", "'DATA'", "]", "# Extract the arrays.", "buffers", "=", "[",...
Extract all data buffers from the list of GLIR commands, and replace them by buffer pointers {buffer: <buffer_index>}. Return the modified list # of GILR commands and the list of buffers as well.
[ "Extract", "all", "data", "buffers", "from", "the", "list", "of", "GLIR", "commands", "and", "replace", "them", "by", "buffer", "pointers", "{", "buffer", ":", "<buffer_index", ">", "}", ".", "Return", "the", "modified", "list", "#", "of", "GILR", "command...
54a4351d98c1f90dfb1a557d1b447c1f57470eea
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/app/backends/_ipynb_util.py#L19-L35
train
Extract all data buffers from the list of GLIR commands and replace them by buffer pointers. Return the modified list and the list of buffers as well.
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/app/backends/_ipynb_util.py
_serialize_item
def _serialize_item(item): """Internal function: serialize native types.""" # Recursively serialize lists, tuples, and dicts. if isinstance(item, (list, tuple)): return [_serialize_item(subitem) for subitem in item] elif isinstance(item, dict): return dict([(key, _serialize_item(value)) ...
python
def _serialize_item(item): """Internal function: serialize native types.""" # Recursively serialize lists, tuples, and dicts. if isinstance(item, (list, tuple)): return [_serialize_item(subitem) for subitem in item] elif isinstance(item, dict): return dict([(key, _serialize_item(value)) ...
[ "def", "_serialize_item", "(", "item", ")", ":", "# Recursively serialize lists, tuples, and dicts.", "if", "isinstance", "(", "item", ",", "(", "list", ",", "tuple", ")", ")", ":", "return", "[", "_serialize_item", "(", "subitem", ")", "for", "subitem", "in", ...
Internal function: serialize native types.
[ "Internal", "function", ":", "serialize", "native", "types", "." ]
54a4351d98c1f90dfb1a557d1b447c1f57470eea
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/app/backends/_ipynb_util.py#L38-L64
train
Internal function to serialize native types.
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/app/backends/_ipynb_util.py
create_glir_message
def create_glir_message(commands, array_serialization=None): """Create a JSON-serializable message of GLIR commands. NumPy arrays are serialized according to the specified method. Arguments --------- commands : list List of GLIR commands. array_serialization : string or None Se...
python
def create_glir_message(commands, array_serialization=None): """Create a JSON-serializable message of GLIR commands. NumPy arrays are serialized according to the specified method. Arguments --------- commands : list List of GLIR commands. array_serialization : string or None Se...
[ "def", "create_glir_message", "(", "commands", ",", "array_serialization", "=", "None", ")", ":", "# Default serialization method for NumPy arrays.", "if", "array_serialization", "is", "None", ":", "array_serialization", "=", "'binary'", "# Extract the buffers.", "commands_mo...
Create a JSON-serializable message of GLIR commands. NumPy arrays are serialized according to the specified method. Arguments --------- commands : list List of GLIR commands. array_serialization : string or None Serialization method for NumPy arrays. Possible values are: ...
[ "Create", "a", "JSON", "-", "serializable", "message", "of", "GLIR", "commands", ".", "NumPy", "arrays", "are", "serialized", "according", "to", "the", "specified", "method", "." ]
54a4351d98c1f90dfb1a557d1b447c1f57470eea
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/app/backends/_ipynb_util.py#L73-L104
train
Create a JSON - serializable message of GLIR commands.
rbarrois/mpdlcd
mpdlcd/vendor/lcdproc/server.py
Server.start_session
def start_session(self): """ Start Session """ response = self.request("hello") bits = response.split(" ") self.server_info.update({ "server_version": bits[2], "protocol_version": bits[4], "screen_width": int(bits[7]), "screen_height": int...
python
def start_session(self): """ Start Session """ response = self.request("hello") bits = response.split(" ") self.server_info.update({ "server_version": bits[2], "protocol_version": bits[4], "screen_width": int(bits[7]), "screen_height": int...
[ "def", "start_session", "(", "self", ")", ":", "response", "=", "self", ".", "request", "(", "\"hello\"", ")", "bits", "=", "response", ".", "split", "(", "\" \"", ")", "self", ".", "server_info", ".", "update", "(", "{", "\"server_version\"", ":", "bits...
Start Session
[ "Start", "Session" ]
85f16c8cc0883f8abb4c2cc7f69729c3e2f857da
https://github.com/rbarrois/mpdlcd/blob/85f16c8cc0883f8abb4c2cc7f69729c3e2f857da/mpdlcd/vendor/lcdproc/server.py#L53-L66
train
Start Session
rbarrois/mpdlcd
mpdlcd/vendor/lcdproc/server.py
Server.request
def request(self, command_string): """ Request """ self.send(command_string) if self.debug: print("Telnet Request: %s" % (command_string)) while True: response = urllib.parse.unquote(self.tn.read_until(b"\n").decode()) if "success" in response: # N...
python
def request(self, command_string): """ Request """ self.send(command_string) if self.debug: print("Telnet Request: %s" % (command_string)) while True: response = urllib.parse.unquote(self.tn.read_until(b"\n").decode()) if "success" in response: # N...
[ "def", "request", "(", "self", ",", "command_string", ")", ":", "self", ".", "send", "(", "command_string", ")", "if", "self", ".", "debug", ":", "print", "(", "\"Telnet Request: %s\"", "%", "(", "command_string", ")", ")", "while", "True", ":", "response...
Request
[ "Request" ]
85f16c8cc0883f8abb4c2cc7f69729c3e2f857da
https://github.com/rbarrois/mpdlcd/blob/85f16c8cc0883f8abb4c2cc7f69729c3e2f857da/mpdlcd/vendor/lcdproc/server.py#L90-L108
train
Send a command to the Telnet server and return the response.
rbarrois/mpdlcd
mpdlcd/vendor/lcdproc/server.py
Server.add_screen
def add_screen(self, ref): """ Add Screen """ if ref not in self.screens: screen = Screen(self, ref) screen.clear() # TODO Check this is needed, new screens should be clear. self.screens[ref] = screen return self.screens[ref]
python
def add_screen(self, ref): """ Add Screen """ if ref not in self.screens: screen = Screen(self, ref) screen.clear() # TODO Check this is needed, new screens should be clear. self.screens[ref] = screen return self.screens[ref]
[ "def", "add_screen", "(", "self", ",", "ref", ")", ":", "if", "ref", "not", "in", "self", ".", "screens", ":", "screen", "=", "Screen", "(", "self", ",", "ref", ")", "screen", ".", "clear", "(", ")", "# TODO Check this is needed, new screens should be clear....
Add Screen
[ "Add", "Screen" ]
85f16c8cc0883f8abb4c2cc7f69729c3e2f857da
https://github.com/rbarrois/mpdlcd/blob/85f16c8cc0883f8abb4c2cc7f69729c3e2f857da/mpdlcd/vendor/lcdproc/server.py#L126-L134
train
Add a screen to the list of screens.
rbarrois/mpdlcd
mpdlcd/vendor/lcdproc/server.py
Server.add_key
def add_key(self, ref, mode="shared"): """ Add a key. (ref) Return key name or None on error """ if ref not in self.keys: response = self.request("client_add_key %s -%s" % (ref, mode)) if "success" not in response: return None ...
python
def add_key(self, ref, mode="shared"): """ Add a key. (ref) Return key name or None on error """ if ref not in self.keys: response = self.request("client_add_key %s -%s" % (ref, mode)) if "success" not in response: return None ...
[ "def", "add_key", "(", "self", ",", "ref", ",", "mode", "=", "\"shared\"", ")", ":", "if", "ref", "not", "in", "self", ".", "keys", ":", "response", "=", "self", ".", "request", "(", "\"client_add_key %s -%s\"", "%", "(", "ref", ",", "mode", ")", ")"...
Add a key. (ref) Return key name or None on error
[ "Add", "a", "key", "." ]
85f16c8cc0883f8abb4c2cc7f69729c3e2f857da
https://github.com/rbarrois/mpdlcd/blob/85f16c8cc0883f8abb4c2cc7f69729c3e2f857da/mpdlcd/vendor/lcdproc/server.py#L141-L153
train
Add a key to the cache.
rbarrois/mpdlcd
mpdlcd/vendor/lcdproc/server.py
Server.del_key
def del_key(self, ref): """ Delete a key. (ref) Return None or LCDd response on error """ if ref not in self.keys: response = self.request("client_del_key %s" % (ref)) self.keys.remove(ref) if "success" in response: ret...
python
def del_key(self, ref): """ Delete a key. (ref) Return None or LCDd response on error """ if ref not in self.keys: response = self.request("client_del_key %s" % (ref)) self.keys.remove(ref) if "success" in response: ret...
[ "def", "del_key", "(", "self", ",", "ref", ")", ":", "if", "ref", "not", "in", "self", ".", "keys", ":", "response", "=", "self", ".", "request", "(", "\"client_del_key %s\"", "%", "(", "ref", ")", ")", "self", ".", "keys", ".", "remove", "(", "ref...
Delete a key. (ref) Return None or LCDd response on error
[ "Delete", "a", "key", "." ]
85f16c8cc0883f8abb4c2cc7f69729c3e2f857da
https://github.com/rbarrois/mpdlcd/blob/85f16c8cc0883f8abb4c2cc7f69729c3e2f857da/mpdlcd/vendor/lcdproc/server.py#L155-L168
train
Delete a key.
federico123579/Trading212-API
tradingAPI/low_level.py
LowLevelAPI.launch
def launch(self): """launch browser and virtual display, first of all to be launched""" try: # init virtual Display self.vbro = Display() self.vbro.start() logger.debug("virtual display launched") except Exception: raise exceptions.VBro...
python
def launch(self): """launch browser and virtual display, first of all to be launched""" try: # init virtual Display self.vbro = Display() self.vbro.start() logger.debug("virtual display launched") except Exception: raise exceptions.VBro...
[ "def", "launch", "(", "self", ")", ":", "try", ":", "# init virtual Display", "self", ".", "vbro", "=", "Display", "(", ")", "self", ".", "vbro", ".", "start", "(", ")", "logger", ".", "debug", "(", "\"virtual display launched\"", ")", "except", "Exception...
launch browser and virtual display, first of all to be launched
[ "launch", "browser", "and", "virtual", "display", "first", "of", "all", "to", "be", "launched" ]
0fab20b71a2348e72bbe76071b81f3692128851f
https://github.com/federico123579/Trading212-API/blob/0fab20b71a2348e72bbe76071b81f3692128851f/tradingAPI/low_level.py#L73-L88
train
launch browser and virtual display first of all to be launched
federico123579/Trading212-API
tradingAPI/low_level.py
LowLevelAPI.css
def css(self, css_path, dom=None): """css find function abbreviation""" if dom is None: dom = self.browser return expect(dom.find_by_css, args=[css_path])
python
def css(self, css_path, dom=None): """css find function abbreviation""" if dom is None: dom = self.browser return expect(dom.find_by_css, args=[css_path])
[ "def", "css", "(", "self", ",", "css_path", ",", "dom", "=", "None", ")", ":", "if", "dom", "is", "None", ":", "dom", "=", "self", ".", "browser", "return", "expect", "(", "dom", ".", "find_by_css", ",", "args", "=", "[", "css_path", "]", ")" ]
css find function abbreviation
[ "css", "find", "function", "abbreviation" ]
0fab20b71a2348e72bbe76071b81f3692128851f
https://github.com/federico123579/Trading212-API/blob/0fab20b71a2348e72bbe76071b81f3692128851f/tradingAPI/low_level.py#L90-L94
train
css find function abbreviation
federico123579/Trading212-API
tradingAPI/low_level.py
LowLevelAPI.css1
def css1(self, css_path, dom=None): """return the first value of self.css""" if dom is None: dom = self.browser def _css1(path, domm): """virtual local func""" return self.css(path, domm)[0] return expect(_css1, args=[css_path, dom])
python
def css1(self, css_path, dom=None): """return the first value of self.css""" if dom is None: dom = self.browser def _css1(path, domm): """virtual local func""" return self.css(path, domm)[0] return expect(_css1, args=[css_path, dom])
[ "def", "css1", "(", "self", ",", "css_path", ",", "dom", "=", "None", ")", ":", "if", "dom", "is", "None", ":", "dom", "=", "self", ".", "browser", "def", "_css1", "(", "path", ",", "domm", ")", ":", "\"\"\"virtual local func\"\"\"", "return", "self", ...
return the first value of self.css
[ "return", "the", "first", "value", "of", "self", ".", "css" ]
0fab20b71a2348e72bbe76071b81f3692128851f
https://github.com/federico123579/Trading212-API/blob/0fab20b71a2348e72bbe76071b81f3692128851f/tradingAPI/low_level.py#L96-L105
train
return the first value of self. css
federico123579/Trading212-API
tradingAPI/low_level.py
LowLevelAPI.search_name
def search_name(self, name, dom=None): """name find function abbreviation""" if dom is None: dom = self.browser return expect(dom.find_by_name, args=[name])
python
def search_name(self, name, dom=None): """name find function abbreviation""" if dom is None: dom = self.browser return expect(dom.find_by_name, args=[name])
[ "def", "search_name", "(", "self", ",", "name", ",", "dom", "=", "None", ")", ":", "if", "dom", "is", "None", ":", "dom", "=", "self", ".", "browser", "return", "expect", "(", "dom", ".", "find_by_name", ",", "args", "=", "[", "name", "]", ")" ]
name find function abbreviation
[ "name", "find", "function", "abbreviation" ]
0fab20b71a2348e72bbe76071b81f3692128851f
https://github.com/federico123579/Trading212-API/blob/0fab20b71a2348e72bbe76071b81f3692128851f/tradingAPI/low_level.py#L107-L111
train
name find function abbreviation
federico123579/Trading212-API
tradingAPI/low_level.py
LowLevelAPI.xpath
def xpath(self, xpath, dom=None): """xpath find function abbreviation""" if dom is None: dom = self.browser return expect(dom.find_by_xpath, args=[xpath])
python
def xpath(self, xpath, dom=None): """xpath find function abbreviation""" if dom is None: dom = self.browser return expect(dom.find_by_xpath, args=[xpath])
[ "def", "xpath", "(", "self", ",", "xpath", ",", "dom", "=", "None", ")", ":", "if", "dom", "is", "None", ":", "dom", "=", "self", ".", "browser", "return", "expect", "(", "dom", ".", "find_by_xpath", ",", "args", "=", "[", "xpath", "]", ")" ]
xpath find function abbreviation
[ "xpath", "find", "function", "abbreviation" ]
0fab20b71a2348e72bbe76071b81f3692128851f
https://github.com/federico123579/Trading212-API/blob/0fab20b71a2348e72bbe76071b81f3692128851f/tradingAPI/low_level.py#L113-L117
train
xpath find function abbreviation
federico123579/Trading212-API
tradingAPI/low_level.py
LowLevelAPI.elCss
def elCss(self, css_path, dom=None): """check if element is present by css""" if dom is None: dom = self.browser return expect(dom.is_element_present_by_css, args=[css_path])
python
def elCss(self, css_path, dom=None): """check if element is present by css""" if dom is None: dom = self.browser return expect(dom.is_element_present_by_css, args=[css_path])
[ "def", "elCss", "(", "self", ",", "css_path", ",", "dom", "=", "None", ")", ":", "if", "dom", "is", "None", ":", "dom", "=", "self", ".", "browser", "return", "expect", "(", "dom", ".", "is_element_present_by_css", ",", "args", "=", "[", "css_path", ...
check if element is present by css
[ "check", "if", "element", "is", "present", "by", "css" ]
0fab20b71a2348e72bbe76071b81f3692128851f
https://github.com/federico123579/Trading212-API/blob/0fab20b71a2348e72bbe76071b81f3692128851f/tradingAPI/low_level.py#L119-L123
train
check if element is present by css
federico123579/Trading212-API
tradingAPI/low_level.py
LowLevelAPI.elXpath
def elXpath(self, xpath, dom=None): """check if element is present by css""" if dom is None: dom = self.browser return expect(dom.is_element_present_by_xpath, args=[xpath])
python
def elXpath(self, xpath, dom=None): """check if element is present by css""" if dom is None: dom = self.browser return expect(dom.is_element_present_by_xpath, args=[xpath])
[ "def", "elXpath", "(", "self", ",", "xpath", ",", "dom", "=", "None", ")", ":", "if", "dom", "is", "None", ":", "dom", "=", "self", ".", "browser", "return", "expect", "(", "dom", ".", "is_element_present_by_xpath", ",", "args", "=", "[", "xpath", "]...
check if element is present by css
[ "check", "if", "element", "is", "present", "by", "css" ]
0fab20b71a2348e72bbe76071b81f3692128851f
https://github.com/federico123579/Trading212-API/blob/0fab20b71a2348e72bbe76071b81f3692128851f/tradingAPI/low_level.py#L125-L129
train
check if element is present by xpath