repository_name
stringlengths
7
55
func_path_in_repository
stringlengths
4
223
func_name
stringlengths
1
134
whole_func_string
stringlengths
75
104k
language
stringclasses
1 value
func_code_string
stringlengths
75
104k
func_code_tokens
listlengths
19
28.4k
func_documentation_string
stringlengths
1
46.9k
func_documentation_tokens
listlengths
1
1.97k
split_name
stringclasses
1 value
func_code_url
stringlengths
87
315
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/util/fonts/_quartz.py
_get_k_p_a
def _get_k_p_a(font, left, right): """This actually calculates the kerning + advance""" # http://lists.apple.com/archives/coretext-dev/2010/Dec/msg00020.html # 1) set up a CTTypesetter chars = left + right args = [None, 1, cf.kCFTypeDictionaryKeyCallBacks, cf.kCFTypeDictionaryValueCallBa...
python
def _get_k_p_a(font, left, right): """This actually calculates the kerning + advance""" # http://lists.apple.com/archives/coretext-dev/2010/Dec/msg00020.html # 1) set up a CTTypesetter chars = left + right args = [None, 1, cf.kCFTypeDictionaryKeyCallBacks, cf.kCFTypeDictionaryValueCallBa...
[ "def", "_get_k_p_a", "(", "font", ",", "left", ",", "right", ")", ":", "# http://lists.apple.com/archives/coretext-dev/2010/Dec/msg00020.html", "# 1) set up a CTTypesetter", "chars", "=", "left", "+", "right", "args", "=", "[", "None", ",", "1", ",", "cf", ".", "k...
This actually calculates the kerning + advance
[ "This", "actually", "calculates", "the", "kerning", "+", "advance" ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/util/fonts/_quartz.py#L164-L184
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/visuals/gridmesh.py
GridMeshVisual.set_data
def set_data(self, xs=None, ys=None, zs=None, colors=None): '''Update the mesh data. Parameters ---------- xs : ndarray | None A 2d array of x coordinates for the vertices of the mesh. ys : ndarray | None A 2d array of y coordinates for the vertices of th...
python
def set_data(self, xs=None, ys=None, zs=None, colors=None): '''Update the mesh data. Parameters ---------- xs : ndarray | None A 2d array of x coordinates for the vertices of the mesh. ys : ndarray | None A 2d array of y coordinates for the vertices of th...
[ "def", "set_data", "(", "self", ",", "xs", "=", "None", ",", "ys", "=", "None", ",", "zs", "=", "None", ",", "colors", "=", "None", ")", ":", "if", "xs", "is", "None", ":", "xs", "=", "self", ".", "_xs", "self", ".", "__vertices", "=", "None", ...
Update the mesh data. Parameters ---------- xs : ndarray | None A 2d array of x coordinates for the vertices of the mesh. ys : ndarray | None A 2d array of y coordinates for the vertices of the mesh. zs : ndarray | None A 2d array of z coordin...
[ "Update", "the", "mesh", "data", "." ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/gridmesh.py#L55-L99
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/io/image.py
_make_png
def _make_png(data, level=6): """Convert numpy array to PNG byte array. Parameters ---------- data : numpy.ndarray Data must be (H, W, 3 | 4) with dtype = np.ubyte (np.uint8) level : int https://docs.python.org/2/library/zlib.html#zlib.compress An integer from 0 to 9 control...
python
def _make_png(data, level=6): """Convert numpy array to PNG byte array. Parameters ---------- data : numpy.ndarray Data must be (H, W, 3 | 4) with dtype = np.ubyte (np.uint8) level : int https://docs.python.org/2/library/zlib.html#zlib.compress An integer from 0 to 9 control...
[ "def", "_make_png", "(", "data", ",", "level", "=", "6", ")", ":", "# Eventually we might want to use ext/png.py for this, but this", "# routine *should* be faster b/c it's speacialized for our use case", "def", "mkchunk", "(", "data", ",", "name", ")", ":", "if", "isinstan...
Convert numpy array to PNG byte array. Parameters ---------- data : numpy.ndarray Data must be (H, W, 3 | 4) with dtype = np.ubyte (np.uint8) level : int https://docs.python.org/2/library/zlib.html#zlib.compress An integer from 0 to 9 controlling the level of compression: ...
[ "Convert", "numpy", "array", "to", "PNG", "byte", "array", "." ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/io/image.py#L17-L98
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/io/image.py
read_png
def read_png(filename): """Read a PNG file to RGB8 or RGBA8 Unlike imread, this requires no external dependencies. Parameters ---------- filename : str File to read. Returns ------- data : array Image data. See also -------- write_png, imread, imsave "...
python
def read_png(filename): """Read a PNG file to RGB8 or RGBA8 Unlike imread, this requires no external dependencies. Parameters ---------- filename : str File to read. Returns ------- data : array Image data. See also -------- write_png, imread, imsave "...
[ "def", "read_png", "(", "filename", ")", ":", "x", "=", "Reader", "(", "filename", ")", "try", ":", "alpha", "=", "x", ".", "asDirect", "(", ")", "[", "3", "]", "[", "'alpha'", "]", "if", "alpha", ":", "y", "=", "x", ".", "asRGBA8", "(", ")", ...
Read a PNG file to RGB8 or RGBA8 Unlike imread, this requires no external dependencies. Parameters ---------- filename : str File to read. Returns ------- data : array Image data. See also -------- write_png, imread, imsave
[ "Read", "a", "PNG", "file", "to", "RGB8", "or", "RGBA8" ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/io/image.py#L101-L133
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/io/image.py
write_png
def write_png(filename, data): """Write a PNG file Unlike imsave, this requires no external dependencies. Parameters ---------- filename : str File to save to. data : array Image data. See also -------- read_png, imread, imsave """ data = np.asarray(data) ...
python
def write_png(filename, data): """Write a PNG file Unlike imsave, this requires no external dependencies. Parameters ---------- filename : str File to save to. data : array Image data. See also -------- read_png, imread, imsave """ data = np.asarray(data) ...
[ "def", "write_png", "(", "filename", ",", "data", ")", ":", "data", "=", "np", ".", "asarray", "(", "data", ")", "if", "not", "data", ".", "ndim", "==", "3", "and", "data", ".", "shape", "[", "-", "1", "]", "in", "(", "3", ",", "4", ")", ":",...
Write a PNG file Unlike imsave, this requires no external dependencies. Parameters ---------- filename : str File to save to. data : array Image data. See also -------- read_png, imread, imsave
[ "Write", "a", "PNG", "file" ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/io/image.py#L136-L156
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/io/image.py
imread
def imread(filename, format=None): """Read image data from disk Requires imageio or PIL. Parameters ---------- filename : str Filename to read. format : str | None Format of the file. If None, it will be inferred from the filename. Returns ------- data : array ...
python
def imread(filename, format=None): """Read image data from disk Requires imageio or PIL. Parameters ---------- filename : str Filename to read. format : str | None Format of the file. If None, it will be inferred from the filename. Returns ------- data : array ...
[ "def", "imread", "(", "filename", ",", "format", "=", "None", ")", ":", "imageio", ",", "PIL", "=", "_check_img_lib", "(", ")", "if", "imageio", "is", "not", "None", ":", "return", "imageio", ".", "imread", "(", "filename", ",", "format", ")", "elif", ...
Read image data from disk Requires imageio or PIL. Parameters ---------- filename : str Filename to read. format : str | None Format of the file. If None, it will be inferred from the filename. Returns ------- data : array Image data. See also --------...
[ "Read", "image", "data", "from", "disk" ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/io/image.py#L159-L194
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/io/image.py
imsave
def imsave(filename, im, format=None): """Save image data to disk Requires imageio or PIL. Parameters ---------- filename : str Filename to write. im : array Image data. format : str | None Format of the file. If None, it will be inferred from the filename. See...
python
def imsave(filename, im, format=None): """Save image data to disk Requires imageio or PIL. Parameters ---------- filename : str Filename to write. im : array Image data. format : str | None Format of the file. If None, it will be inferred from the filename. See...
[ "def", "imsave", "(", "filename", ",", "im", ",", "format", "=", "None", ")", ":", "# Import imageio or PIL", "imageio", ",", "PIL", "=", "_check_img_lib", "(", ")", "if", "imageio", "is", "not", "None", ":", "return", "imageio", ".", "imsave", "(", "fil...
Save image data to disk Requires imageio or PIL. Parameters ---------- filename : str Filename to write. im : array Image data. format : str | None Format of the file. If None, it will be inferred from the filename. See also -------- imread, read_png, write...
[ "Save", "image", "data", "to", "disk" ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/io/image.py#L197-L223
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/io/image.py
_check_img_lib
def _check_img_lib(): """Utility to search for imageio or PIL""" # Import imageio or PIL imageio = PIL = None try: import imageio except ImportError: try: import PIL.Image except ImportError: pass return imageio, PIL
python
def _check_img_lib(): """Utility to search for imageio or PIL""" # Import imageio or PIL imageio = PIL = None try: import imageio except ImportError: try: import PIL.Image except ImportError: pass return imageio, PIL
[ "def", "_check_img_lib", "(", ")", ":", "# Import imageio or PIL", "imageio", "=", "PIL", "=", "None", "try", ":", "import", "imageio", "except", "ImportError", ":", "try", ":", "import", "PIL", ".", "Image", "except", "ImportError", ":", "pass", "return", "...
Utility to search for imageio or PIL
[ "Utility", "to", "search", "for", "imageio", "or", "PIL" ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/io/image.py#L226-L237
anjishnu/ask-alexa-pykit
ask/config/config.py
read_from_user
def read_from_user(input_type, *args, **kwargs): ''' Helper function to prompt user for input of a specific type e.g. float, str, int Designed to work with both python 2 and 3 Yes I know this is ugly. ''' def _read_in(*args, **kwargs): while True: try: tmp = raw_inpu...
python
def read_from_user(input_type, *args, **kwargs): ''' Helper function to prompt user for input of a specific type e.g. float, str, int Designed to work with both python 2 and 3 Yes I know this is ugly. ''' def _read_in(*args, **kwargs): while True: try: tmp = raw_inpu...
[ "def", "read_from_user", "(", "input_type", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "def", "_read_in", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "while", "True", ":", "try", ":", "tmp", "=", "raw_input", "(", "*", "args", ...
Helper function to prompt user for input of a specific type e.g. float, str, int Designed to work with both python 2 and 3 Yes I know this is ugly.
[ "Helper", "function", "to", "prompt", "user", "for", "input", "of", "a", "specific", "type", "e", ".", "g", ".", "float", "str", "int", "Designed", "to", "work", "with", "both", "python", "2", "and", "3", "Yes", "I", "know", "this", "is", "ugly", "."...
train
https://github.com/anjishnu/ask-alexa-pykit/blob/a47c278ca7a60532bbe1a9b789f6c37e609fea8b/ask/config/config.py#L18-L33
anjishnu/ask-alexa-pykit
ask/config/config.py
load_builtin_slots
def load_builtin_slots(): ''' Helper function to load builtin slots from the data location ''' builtin_slots = {} for index, line in enumerate(open(BUILTIN_SLOTS_LOCATION)): o = line.strip().split('\t') builtin_slots[index] = {'name' : o[0], 'descript...
python
def load_builtin_slots(): ''' Helper function to load builtin slots from the data location ''' builtin_slots = {} for index, line in enumerate(open(BUILTIN_SLOTS_LOCATION)): o = line.strip().split('\t') builtin_slots[index] = {'name' : o[0], 'descript...
[ "def", "load_builtin_slots", "(", ")", ":", "builtin_slots", "=", "{", "}", "for", "index", ",", "line", "in", "enumerate", "(", "open", "(", "BUILTIN_SLOTS_LOCATION", ")", ")", ":", "o", "=", "line", ".", "strip", "(", ")", ".", "split", "(", "'\\t'",...
Helper function to load builtin slots from the data location
[ "Helper", "function", "to", "load", "builtin", "slots", "from", "the", "data", "location" ]
train
https://github.com/anjishnu/ask-alexa-pykit/blob/a47c278ca7a60532bbe1a9b789f6c37e609fea8b/ask/config/config.py#L38-L47
brouberol/contexttimer
contexttimer/__init__.py
timer
def timer(logger=None, level=logging.INFO, fmt="function %(function_name)s execution time: %(execution_time).3f", *func_or_func_args, **timer_kwargs): """ Function decorator displaying the function execution time All kwargs are the arguments taken by the Timer class constructor. """ ...
python
def timer(logger=None, level=logging.INFO, fmt="function %(function_name)s execution time: %(execution_time).3f", *func_or_func_args, **timer_kwargs): """ Function decorator displaying the function execution time All kwargs are the arguments taken by the Timer class constructor. """ ...
[ "def", "timer", "(", "logger", "=", "None", ",", "level", "=", "logging", ".", "INFO", ",", "fmt", "=", "\"function %(function_name)s execution time: %(execution_time).3f\"", ",", "*", "func_or_func_args", ",", "*", "*", "timer_kwargs", ")", ":", "# store Timer kwar...
Function decorator displaying the function execution time All kwargs are the arguments taken by the Timer class constructor.
[ "Function", "decorator", "displaying", "the", "function", "execution", "time" ]
train
https://github.com/brouberol/contexttimer/blob/a866f420ed4c10f29abf252c58b11f9db6706100/contexttimer/__init__.py#L108-L141
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/visuals/collections/raw_triangle_collection.py
RawTriangleCollection.append
def append(self, points, indices, **kwargs): """ Append a new set of vertices to the collection. For kwargs argument, n is the number of vertices (local) or the number of item (shared) Parameters ---------- points : np.array Vertices composing the t...
python
def append(self, points, indices, **kwargs): """ Append a new set of vertices to the collection. For kwargs argument, n is the number of vertices (local) or the number of item (shared) Parameters ---------- points : np.array Vertices composing the t...
[ "def", "append", "(", "self", ",", "points", ",", "indices", ",", "*", "*", "kwargs", ")", ":", "itemsize", "=", "len", "(", "points", ")", "itemcount", "=", "1", "V", "=", "np", ".", "empty", "(", "itemcount", "*", "itemsize", ",", "dtype", "=", ...
Append a new set of vertices to the collection. For kwargs argument, n is the number of vertices (local) or the number of item (shared) Parameters ---------- points : np.array Vertices composing the triangles indices : np.array Indices describi...
[ "Append", "a", "new", "set", "of", "vertices", "to", "the", "collection", "." ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/collections/raw_triangle_collection.py#L40-L81
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/mpl_plot/_mpl_to_vispy.py
_mpl_to_vispy
def _mpl_to_vispy(fig): """Convert a given matplotlib figure to vispy This function is experimental and subject to change! Requires matplotlib and mplexporter. Parameters ---------- fig : instance of matplotlib Figure The populated figure to display. Returns ------- canvas...
python
def _mpl_to_vispy(fig): """Convert a given matplotlib figure to vispy This function is experimental and subject to change! Requires matplotlib and mplexporter. Parameters ---------- fig : instance of matplotlib Figure The populated figure to display. Returns ------- canvas...
[ "def", "_mpl_to_vispy", "(", "fig", ")", ":", "renderer", "=", "VispyRenderer", "(", ")", "exporter", "=", "Exporter", "(", "renderer", ")", "with", "warnings", ".", "catch_warnings", "(", "record", "=", "True", ")", ":", "# py3k mpl warning", "exporter", "....
Convert a given matplotlib figure to vispy This function is experimental and subject to change! Requires matplotlib and mplexporter. Parameters ---------- fig : instance of matplotlib Figure The populated figure to display. Returns ------- canvas : instance of Canvas T...
[ "Convert", "a", "given", "matplotlib", "figure", "to", "vispy" ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/mpl_plot/_mpl_to_vispy.py#L155-L176
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/mpl_plot/_mpl_to_vispy.py
show
def show(block=False): """Show current figures using vispy Parameters ---------- block : bool If True, blocking mode will be used. If False, then non-blocking / interactive mode will be used. Returns ------- canvases : list List of the vispy canvases that were creat...
python
def show(block=False): """Show current figures using vispy Parameters ---------- block : bool If True, blocking mode will be used. If False, then non-blocking / interactive mode will be used. Returns ------- canvases : list List of the vispy canvases that were creat...
[ "def", "show", "(", "block", "=", "False", ")", ":", "if", "not", "has_matplotlib", "(", ")", ":", "raise", "ImportError", "(", "'Requires matplotlib version >= 1.2'", ")", "cs", "=", "[", "_mpl_to_vispy", "(", "plt", ".", "figure", "(", "ii", ")", ")", ...
Show current figures using vispy Parameters ---------- block : bool If True, blocking mode will be used. If False, then non-blocking / interactive mode will be used. Returns ------- canvases : list List of the vispy canvases that were created.
[ "Show", "current", "figures", "using", "vispy" ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/mpl_plot/_mpl_to_vispy.py#L179-L198
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/mpl_plot/_mpl_to_vispy.py
VispyRenderer._mpl_ax_to
def _mpl_ax_to(self, mplobj, output='vb'): """Helper to get the parent axes of a given mplobj""" for ax in self._axs.values(): if ax['ax'] is mplobj.axes: return ax[output] raise RuntimeError('Parent axes could not be found!')
python
def _mpl_ax_to(self, mplobj, output='vb'): """Helper to get the parent axes of a given mplobj""" for ax in self._axs.values(): if ax['ax'] is mplobj.axes: return ax[output] raise RuntimeError('Parent axes could not be found!')
[ "def", "_mpl_ax_to", "(", "self", ",", "mplobj", ",", "output", "=", "'vb'", ")", ":", "for", "ax", "in", "self", ".", "_axs", ".", "values", "(", ")", ":", "if", "ax", "[", "'ax'", "]", "is", "mplobj", ".", "axes", ":", "return", "ax", "[", "o...
Helper to get the parent axes of a given mplobj
[ "Helper", "to", "get", "the", "parent", "axes", "of", "a", "given", "mplobj" ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/mpl_plot/_mpl_to_vispy.py#L138-L143
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/visuals/graphs/layouts/random.py
random
def random(adjacency_mat, directed=False, random_state=None): """ Place the graph nodes at random places. Parameters ---------- adjacency_mat : matrix or sparse The graph adjacency matrix directed : bool Whether the graph is directed. If this is True, is will also genera...
python
def random(adjacency_mat, directed=False, random_state=None): """ Place the graph nodes at random places. Parameters ---------- adjacency_mat : matrix or sparse The graph adjacency matrix directed : bool Whether the graph is directed. If this is True, is will also genera...
[ "def", "random", "(", "adjacency_mat", ",", "directed", "=", "False", ",", "random_state", "=", "None", ")", ":", "if", "random_state", "is", "None", ":", "random_state", "=", "np", ".", "random", "elif", "not", "isinstance", "(", "random_state", ",", "np"...
Place the graph nodes at random places. Parameters ---------- adjacency_mat : matrix or sparse The graph adjacency matrix directed : bool Whether the graph is directed. If this is True, is will also generate the vertices for arrows, which can be passed to an ArrowVisual....
[ "Place", "the", "graph", "nodes", "at", "random", "places", "." ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/graphs/layouts/random.py#L16-L52
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/geometry/isocurve.py
isocurve
def isocurve(data, level, connected=False, extend_to_edge=False): """ Generate isocurve from 2D data using marching squares algorithm. Parameters ---------- data : ndarray 2D numpy array of scalar values level : float The level at which to generate an isosurface connected : ...
python
def isocurve(data, level, connected=False, extend_to_edge=False): """ Generate isocurve from 2D data using marching squares algorithm. Parameters ---------- data : ndarray 2D numpy array of scalar values level : float The level at which to generate an isosurface connected : ...
[ "def", "isocurve", "(", "data", ",", "level", ",", "connected", "=", "False", ",", "extend_to_edge", "=", "False", ")", ":", "# This function is SLOW; plenty of room for optimization here.", "if", "extend_to_edge", ":", "d2", "=", "np", ".", "empty", "(", "(", "...
Generate isocurve from 2D data using marching squares algorithm. Parameters ---------- data : ndarray 2D numpy array of scalar values level : float The level at which to generate an isosurface connected : bool If False, return a single long list of point pairs If Tru...
[ "Generate", "isocurve", "from", "2D", "data", "using", "marching", "squares", "algorithm", "." ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/geometry/isocurve.py#L12-L175
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/scene/events.py
SceneMouseEvent.pos
def pos(self): """ The position of this event in the local coordinate system of the visual. """ if self._pos is None: tr = self.visual.get_transform('canvas', 'visual') self._pos = tr.map(self.mouse_event.pos) return self._pos
python
def pos(self): """ The position of this event in the local coordinate system of the visual. """ if self._pos is None: tr = self.visual.get_transform('canvas', 'visual') self._pos = tr.map(self.mouse_event.pos) return self._pos
[ "def", "pos", "(", "self", ")", ":", "if", "self", ".", "_pos", "is", "None", ":", "tr", "=", "self", ".", "visual", ".", "get_transform", "(", "'canvas'", ",", "'visual'", ")", "self", ".", "_pos", "=", "tr", ".", "map", "(", "self", ".", "mouse...
The position of this event in the local coordinate system of the visual.
[ "The", "position", "of", "this", "event", "in", "the", "local", "coordinate", "system", "of", "the", "visual", "." ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/scene/events.py#L29-L36
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/scene/events.py
SceneMouseEvent.last_event
def last_event(self): """ The mouse event immediately prior to this one. This property is None when no mouse buttons are pressed. """ if self.mouse_event.last_event is None: return None ev = self.copy() ev.mouse_event = self.mouse_event.last_event retu...
python
def last_event(self): """ The mouse event immediately prior to this one. This property is None when no mouse buttons are pressed. """ if self.mouse_event.last_event is None: return None ev = self.copy() ev.mouse_event = self.mouse_event.last_event retu...
[ "def", "last_event", "(", "self", ")", ":", "if", "self", ".", "mouse_event", ".", "last_event", "is", "None", ":", "return", "None", "ev", "=", "self", ".", "copy", "(", ")", "ev", ".", "mouse_event", "=", "self", ".", "mouse_event", ".", "last_event"...
The mouse event immediately prior to this one. This property is None when no mouse buttons are pressed.
[ "The", "mouse", "event", "immediately", "prior", "to", "this", "one", ".", "This", "property", "is", "None", "when", "no", "mouse", "buttons", "are", "pressed", "." ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/scene/events.py#L39-L47
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/scene/events.py
SceneMouseEvent.press_event
def press_event(self): """ The mouse press event that initiated a mouse drag, if any. """ if self.mouse_event.press_event is None: return None ev = self.copy() ev.mouse_event = self.mouse_event.press_event return ev
python
def press_event(self): """ The mouse press event that initiated a mouse drag, if any. """ if self.mouse_event.press_event is None: return None ev = self.copy() ev.mouse_event = self.mouse_event.press_event return ev
[ "def", "press_event", "(", "self", ")", ":", "if", "self", ".", "mouse_event", ".", "press_event", "is", "None", ":", "return", "None", "ev", "=", "self", ".", "copy", "(", ")", "ev", ".", "mouse_event", "=", "self", ".", "mouse_event", ".", "press_eve...
The mouse press event that initiated a mouse drag, if any.
[ "The", "mouse", "press", "event", "that", "initiated", "a", "mouse", "drag", "if", "any", "." ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/scene/events.py#L50-L57
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/gloo/util.py
check_enum
def check_enum(enum, name=None, valid=None): """ Get lowercase string representation of enum. """ name = name or 'enum' # Try to convert res = None if isinstance(enum, int): if hasattr(enum, 'name') and enum.name.startswith('GL_'): res = enum.name[3:].lower() elif isinsta...
python
def check_enum(enum, name=None, valid=None): """ Get lowercase string representation of enum. """ name = name or 'enum' # Try to convert res = None if isinstance(enum, int): if hasattr(enum, 'name') and enum.name.startswith('GL_'): res = enum.name[3:].lower() elif isinsta...
[ "def", "check_enum", "(", "enum", ",", "name", "=", "None", ",", "valid", "=", "None", ")", ":", "name", "=", "name", "or", "'enum'", "# Try to convert", "res", "=", "None", "if", "isinstance", "(", "enum", ",", "int", ")", ":", "if", "hasattr", "(",...
Get lowercase string representation of enum.
[ "Get", "lowercase", "string", "representation", "of", "enum", "." ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/util.py#L76-L94
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/gloo/util.py
draw_texture
def draw_texture(tex): """Draw a 2D texture to the current viewport Parameters ---------- tex : instance of Texture2D The texture to draw. """ from .program import Program program = Program(vert_draw, frag_draw) program['u_texture'] = tex program['a_position'] = [[-1., -1.],...
python
def draw_texture(tex): """Draw a 2D texture to the current viewport Parameters ---------- tex : instance of Texture2D The texture to draw. """ from .program import Program program = Program(vert_draw, frag_draw) program['u_texture'] = tex program['a_position'] = [[-1., -1.],...
[ "def", "draw_texture", "(", "tex", ")", ":", "from", ".", "program", "import", "Program", "program", "=", "Program", "(", "vert_draw", ",", "frag_draw", ")", "program", "[", "'u_texture'", "]", "=", "tex", "program", "[", "'a_position'", "]", "=", "[", "...
Draw a 2D texture to the current viewport Parameters ---------- tex : instance of Texture2D The texture to draw.
[ "Draw", "a", "2D", "texture", "to", "the", "current", "viewport" ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/util.py#L118-L131
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/util/dpi/_linux.py
_get_dpi_from
def _get_dpi_from(cmd, pattern, func): """Match pattern against the output of func, passing the results as floats to func. If anything fails, return None. """ try: out, _ = run_subprocess([cmd]) except (OSError, CalledProcessError): pass else: match = re.search(pattern, ...
python
def _get_dpi_from(cmd, pattern, func): """Match pattern against the output of func, passing the results as floats to func. If anything fails, return None. """ try: out, _ = run_subprocess([cmd]) except (OSError, CalledProcessError): pass else: match = re.search(pattern, ...
[ "def", "_get_dpi_from", "(", "cmd", ",", "pattern", ",", "func", ")", ":", "try", ":", "out", ",", "_", "=", "run_subprocess", "(", "[", "cmd", "]", ")", "except", "(", "OSError", ",", "CalledProcessError", ")", ":", "pass", "else", ":", "match", "="...
Match pattern against the output of func, passing the results as floats to func. If anything fails, return None.
[ "Match", "pattern", "against", "the", "output", "of", "func", "passing", "the", "results", "as", "floats", "to", "func", ".", "If", "anything", "fails", "return", "None", "." ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/util/dpi/_linux.py#L15-L26
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/util/dpi/_linux.py
get_dpi
def get_dpi(raise_error=True): """Get screen DPI from the OS Parameters ---------- raise_error : bool If True, raise an error if DPI could not be determined. Returns ------- dpi : float Dots per inch of the primary screen. """ # If we are running without an X server...
python
def get_dpi(raise_error=True): """Get screen DPI from the OS Parameters ---------- raise_error : bool If True, raise an error if DPI could not be determined. Returns ------- dpi : float Dots per inch of the primary screen. """ # If we are running without an X server...
[ "def", "get_dpi", "(", "raise_error", "=", "True", ")", ":", "# If we are running without an X server (e.g. OSMesa), use a fixed DPI", "if", "'DISPLAY'", "not", "in", "os", ".", "environ", ":", "return", "96.", "from_xdpyinfo", "=", "_get_dpi_from", "(", "'xdpyinfo'", ...
Get screen DPI from the OS Parameters ---------- raise_error : bool If True, raise an error if DPI could not be determined. Returns ------- dpi : float Dots per inch of the primary screen.
[ "Get", "screen", "DPI", "from", "the", "OS" ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/util/dpi/_linux.py#L29-L61
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/visuals/graphs/graph.py
GraphVisual.set_data
def set_data(self, adjacency_mat=None, **kwargs): """Set the data Parameters ---------- adjacency_mat : ndarray | None The adjacency matrix. **kwargs : dict Keyword arguments to pass to the arrows. """ if adjacency_mat is not None: ...
python
def set_data(self, adjacency_mat=None, **kwargs): """Set the data Parameters ---------- adjacency_mat : ndarray | None The adjacency matrix. **kwargs : dict Keyword arguments to pass to the arrows. """ if adjacency_mat is not None: ...
[ "def", "set_data", "(", "self", ",", "adjacency_mat", "=", "None", ",", "*", "*", "kwargs", ")", ":", "if", "adjacency_mat", "is", "not", "None", ":", "if", "adjacency_mat", ".", "shape", "[", "0", "]", "!=", "adjacency_mat", ".", "shape", "[", "1", ...
Set the data Parameters ---------- adjacency_mat : ndarray | None The adjacency matrix. **kwargs : dict Keyword arguments to pass to the arrows.
[ "Set", "the", "data" ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/graphs/graph.py#L177-L226
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/scene/widgets/colorbar.py
ColorBarWidget.calc_size
def calc_size(rect, orientation): """Calculate a size Parameters ---------- rect : rectangle The rectangle. orientation : str Either "bottom" or "top". """ (total_halfx, total_halfy) = rect.center if orientation in ["bottom", "top"...
python
def calc_size(rect, orientation): """Calculate a size Parameters ---------- rect : rectangle The rectangle. orientation : str Either "bottom" or "top". """ (total_halfx, total_halfy) = rect.center if orientation in ["bottom", "top"...
[ "def", "calc_size", "(", "rect", ",", "orientation", ")", ":", "(", "total_halfx", ",", "total_halfy", ")", "=", "rect", ".", "center", "if", "orientation", "in", "[", "\"bottom\"", ",", "\"top\"", "]", ":", "(", "total_major_axis", ",", "total_minor_axis", ...
Calculate a size Parameters ---------- rect : rectangle The rectangle. orientation : str Either "bottom" or "top".
[ "Calculate", "a", "size" ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/scene/widgets/colorbar.py#L101-L126
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/visuals/collections/util.py
dtype_reduce
def dtype_reduce(dtype, level=0, depth=0): """ Try to reduce dtype up to a given level when it is possible dtype = [ ('vertex', [('x', 'f4'), ('y', 'f4'), ('z', 'f4')]), ('normal', [('x', 'f4'), ('y', 'f4'), ('z', 'f4')]), ('color', [('r', 'f4'), ('g', 'f4'), ('b', 'f4'),...
python
def dtype_reduce(dtype, level=0, depth=0): """ Try to reduce dtype up to a given level when it is possible dtype = [ ('vertex', [('x', 'f4'), ('y', 'f4'), ('z', 'f4')]), ('normal', [('x', 'f4'), ('y', 'f4'), ('z', 'f4')]), ('color', [('r', 'f4'), ('g', 'f4'), ('b', 'f4'),...
[ "def", "dtype_reduce", "(", "dtype", ",", "level", "=", "0", ",", "depth", "=", "0", ")", ":", "dtype", "=", "np", ".", "dtype", "(", "dtype", ")", "fields", "=", "dtype", ".", "fields", "# No fields", "if", "fields", "is", "None", ":", "if", "len"...
Try to reduce dtype up to a given level when it is possible dtype = [ ('vertex', [('x', 'f4'), ('y', 'f4'), ('z', 'f4')]), ('normal', [('x', 'f4'), ('y', 'f4'), ('z', 'f4')]), ('color', [('r', 'f4'), ('g', 'f4'), ('b', 'f4'), ('a', 'f4')])] level ...
[ "Try", "to", "reduce", "dtype", "up", "to", "a", "given", "level", "when", "it", "is", "possible" ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/collections/util.py#L13-L72
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/visuals/collections/util.py
fetchcode
def fetchcode(utype, prefix=""): """ Generate the GLSL code needed to retrieve fake uniform values from a texture. uniforms : sampler2D Texture to fetch uniforms from uniforms_shape: vec3 Size of texture (width,height,count) where count is the number of float to be fetched....
python
def fetchcode(utype, prefix=""): """ Generate the GLSL code needed to retrieve fake uniform values from a texture. uniforms : sampler2D Texture to fetch uniforms from uniforms_shape: vec3 Size of texture (width,height,count) where count is the number of float to be fetched....
[ "def", "fetchcode", "(", "utype", ",", "prefix", "=", "\"\"", ")", ":", "utype", "=", "np", ".", "dtype", "(", "utype", ")", "_utype", "=", "dtype_reduce", "(", "utype", ",", "level", "=", "1", ")", "header", "=", "\"\"\"\nuniform sampler2D uniforms;\nun...
Generate the GLSL code needed to retrieve fake uniform values from a texture. uniforms : sampler2D Texture to fetch uniforms from uniforms_shape: vec3 Size of texture (width,height,count) where count is the number of float to be fetched. collection_index: float Attribu...
[ "Generate", "the", "GLSL", "code", "needed", "to", "retrieve", "fake", "uniform", "values", "from", "a", "texture", "." ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/collections/util.py#L75-L163
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/geometry/generation.py
create_cube
def create_cube(): """ Generate vertices & indices for a filled and outlined cube Returns ------- vertices : array Array of vertices suitable for use as a VertexBuffer. filled : array Indices to use to produce a filled cube. outline : array Indices to use to produce an o...
python
def create_cube(): """ Generate vertices & indices for a filled and outlined cube Returns ------- vertices : array Array of vertices suitable for use as a VertexBuffer. filled : array Indices to use to produce a filled cube. outline : array Indices to use to produce an o...
[ "def", "create_cube", "(", ")", ":", "vtype", "=", "[", "(", "'position'", ",", "np", ".", "float32", ",", "3", ")", ",", "(", "'texcoord'", ",", "np", ".", "float32", ",", "2", ")", ",", "(", "'normal'", ",", "np", ".", "float32", ",", "3", ")...
Generate vertices & indices for a filled and outlined cube Returns ------- vertices : array Array of vertices suitable for use as a VertexBuffer. filled : array Indices to use to produce a filled cube. outline : array Indices to use to produce an outline of the cube.
[ "Generate", "vertices", "&", "indices", "for", "a", "filled", "and", "outlined", "cube" ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/geometry/generation.py#L16-L89
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/geometry/generation.py
create_plane
def create_plane(width=1, height=1, width_segments=1, height_segments=1, direction='+z'): """ Generate vertices & indices for a filled and outlined plane. Parameters ---------- width : float Plane width. height : float Plane height. width_segments : int ...
python
def create_plane(width=1, height=1, width_segments=1, height_segments=1, direction='+z'): """ Generate vertices & indices for a filled and outlined plane. Parameters ---------- width : float Plane width. height : float Plane height. width_segments : int ...
[ "def", "create_plane", "(", "width", "=", "1", ",", "height", "=", "1", ",", "width_segments", "=", "1", ",", "height_segments", "=", "1", ",", "direction", "=", "'+z'", ")", ":", "x_grid", "=", "width_segments", "y_grid", "=", "height_segments", "x_grid1"...
Generate vertices & indices for a filled and outlined plane. Parameters ---------- width : float Plane width. height : float Plane height. width_segments : int Plane segments count along the width. height_segments : float Plane segments count along the height. ...
[ "Generate", "vertices", "&", "indices", "for", "a", "filled", "and", "outlined", "plane", "." ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/geometry/generation.py#L92-L198
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/geometry/generation.py
create_box
def create_box(width=1, height=1, depth=1, width_segments=1, height_segments=1, depth_segments=1, planes=None): """ Generate vertices & indices for a filled and outlined box. Parameters ---------- width : float Box width. height : float Box height. depth : float ...
python
def create_box(width=1, height=1, depth=1, width_segments=1, height_segments=1, depth_segments=1, planes=None): """ Generate vertices & indices for a filled and outlined box. Parameters ---------- width : float Box width. height : float Box height. depth : float ...
[ "def", "create_box", "(", "width", "=", "1", ",", "height", "=", "1", ",", "depth", "=", "1", ",", "width_segments", "=", "1", ",", "height_segments", "=", "1", ",", "depth_segments", "=", "1", ",", "planes", "=", "None", ")", ":", "planes", "=", "...
Generate vertices & indices for a filled and outlined box. Parameters ---------- width : float Box width. height : float Box height. depth : float Box depth. width_segments : int Box segments count along the width. height_segments : float Box segments...
[ "Generate", "vertices", "&", "indices", "for", "a", "filled", "and", "outlined", "box", "." ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/geometry/generation.py#L201-L297
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/geometry/generation.py
create_sphere
def create_sphere(rows=10, cols=10, depth=10, radius=1.0, offset=True, subdivisions=3, method='latitude'): """Create a sphere Parameters ---------- rows : int Number of rows (for method='latitude' and 'cube'). cols : int Number of columns (for method='latitude' and...
python
def create_sphere(rows=10, cols=10, depth=10, radius=1.0, offset=True, subdivisions=3, method='latitude'): """Create a sphere Parameters ---------- rows : int Number of rows (for method='latitude' and 'cube'). cols : int Number of columns (for method='latitude' and...
[ "def", "create_sphere", "(", "rows", "=", "10", ",", "cols", "=", "10", ",", "depth", "=", "10", ",", "radius", "=", "1.0", ",", "offset", "=", "True", ",", "subdivisions", "=", "3", ",", "method", "=", "'latitude'", ")", ":", "if", "method", "==",...
Create a sphere Parameters ---------- rows : int Number of rows (for method='latitude' and 'cube'). cols : int Number of columns (for method='latitude' and 'cube'). depth : int Number of depth segments (for method='cube'). radius : float Sphere radius. offset...
[ "Create", "a", "sphere" ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/geometry/generation.py#L415-L450
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/geometry/generation.py
create_cylinder
def create_cylinder(rows, cols, radius=[1.0, 1.0], length=1.0, offset=False): """Create a cylinder Parameters ---------- rows : int Number of rows. cols : int Number of columns. radius : tuple of float Cylinder radii. length : float Length of the cylinder. ...
python
def create_cylinder(rows, cols, radius=[1.0, 1.0], length=1.0, offset=False): """Create a cylinder Parameters ---------- rows : int Number of rows. cols : int Number of columns. radius : tuple of float Cylinder radii. length : float Length of the cylinder. ...
[ "def", "create_cylinder", "(", "rows", ",", "cols", ",", "radius", "=", "[", "1.0", ",", "1.0", "]", ",", "length", "=", "1.0", ",", "offset", "=", "False", ")", ":", "verts", "=", "np", ".", "empty", "(", "(", "rows", "+", "1", ",", "cols", ",...
Create a cylinder Parameters ---------- rows : int Number of rows. cols : int Number of columns. radius : tuple of float Cylinder radii. length : float Length of the cylinder. offset : bool Rotate each row by half a column. Returns ------- ...
[ "Create", "a", "cylinder" ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/geometry/generation.py#L453-L504
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/geometry/generation.py
create_cone
def create_cone(cols, radius=1.0, length=1.0): """Create a cone Parameters ---------- cols : int Number of faces. radius : float Base cone radius. length : float Length of the cone. Returns ------- cone : MeshData Vertices and faces computed for a co...
python
def create_cone(cols, radius=1.0, length=1.0): """Create a cone Parameters ---------- cols : int Number of faces. radius : float Base cone radius. length : float Length of the cone. Returns ------- cone : MeshData Vertices and faces computed for a co...
[ "def", "create_cone", "(", "cols", ",", "radius", "=", "1.0", ",", "length", "=", "1.0", ")", ":", "verts", "=", "np", ".", "empty", "(", "(", "cols", "+", "1", ",", "3", ")", ",", "dtype", "=", "np", ".", "float32", ")", "# compute vertexes", "t...
Create a cone Parameters ---------- cols : int Number of faces. radius : float Base cone radius. length : float Length of the cone. Returns ------- cone : MeshData Vertices and faces computed for a cone surface.
[ "Create", "a", "cone" ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/geometry/generation.py#L507-L543
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/geometry/generation.py
create_arrow
def create_arrow(rows, cols, radius=0.1, length=1.0, cone_radius=None, cone_length=None): """Create a 3D arrow using a cylinder plus cone Parameters ---------- rows : int Number of rows. cols : int Number of columns. radius : float Base cylinder radius. ...
python
def create_arrow(rows, cols, radius=0.1, length=1.0, cone_radius=None, cone_length=None): """Create a 3D arrow using a cylinder plus cone Parameters ---------- rows : int Number of rows. cols : int Number of columns. radius : float Base cylinder radius. ...
[ "def", "create_arrow", "(", "rows", ",", "cols", ",", "radius", "=", "0.1", ",", "length", "=", "1.0", ",", "cone_radius", "=", "None", ",", "cone_length", "=", "None", ")", ":", "# create the cylinder", "md_cyl", "=", "None", "if", "cone_radius", "is", ...
Create a 3D arrow using a cylinder plus cone Parameters ---------- rows : int Number of rows. cols : int Number of columns. radius : float Base cylinder radius. length : float Length of the arrow. cone_radius : float Radius of the cone base. ...
[ "Create", "a", "3D", "arrow", "using", "a", "cylinder", "plus", "cone" ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/geometry/generation.py#L546-L595
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/geometry/generation.py
create_grid_mesh
def create_grid_mesh(xs, ys, zs): '''Generate vertices and indices for an implicitly connected mesh. The intention is that this makes it simple to generate a mesh from meshgrid data. Parameters ---------- xs : ndarray A 2d array of x coordinates for the vertices of the mesh. Must ...
python
def create_grid_mesh(xs, ys, zs): '''Generate vertices and indices for an implicitly connected mesh. The intention is that this makes it simple to generate a mesh from meshgrid data. Parameters ---------- xs : ndarray A 2d array of x coordinates for the vertices of the mesh. Must ...
[ "def", "create_grid_mesh", "(", "xs", ",", "ys", ",", "zs", ")", ":", "shape", "=", "xs", ".", "shape", "length", "=", "shape", "[", "0", "]", "*", "shape", "[", "1", "]", "vertices", "=", "np", ".", "zeros", "(", "(", "length", ",", "3", ")", ...
Generate vertices and indices for an implicitly connected mesh. The intention is that this makes it simple to generate a mesh from meshgrid data. Parameters ---------- xs : ndarray A 2d array of x coordinates for the vertices of the mesh. Must have the same dimensions as ys and zs....
[ "Generate", "vertices", "and", "indices", "for", "an", "implicitly", "connected", "mesh", "." ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/geometry/generation.py#L598-L646
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/visuals/graphs/util.py
_straight_line_vertices
def _straight_line_vertices(adjacency_mat, node_coords, directed=False): """ Generate the vertices for straight lines between nodes. If it is a directed graph, it also generates the vertices which can be passed to an :class:`ArrowVisual`. Parameters ---------- adjacency_mat : array ...
python
def _straight_line_vertices(adjacency_mat, node_coords, directed=False): """ Generate the vertices for straight lines between nodes. If it is a directed graph, it also generates the vertices which can be passed to an :class:`ArrowVisual`. Parameters ---------- adjacency_mat : array ...
[ "def", "_straight_line_vertices", "(", "adjacency_mat", ",", "node_coords", ",", "directed", "=", "False", ")", ":", "if", "not", "issparse", "(", "adjacency_mat", ")", ":", "adjacency_mat", "=", "np", ".", "asarray", "(", "adjacency_mat", ",", "float", ")", ...
Generate the vertices for straight lines between nodes. If it is a directed graph, it also generates the vertices which can be passed to an :class:`ArrowVisual`. Parameters ---------- adjacency_mat : array The adjacency matrix of the graph node_coords : array The current coordi...
[ "Generate", "the", "vertices", "for", "straight", "lines", "between", "nodes", "." ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/graphs/util.py#L54-L95
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/visuals/graphs/util.py
_rescale_layout
def _rescale_layout(pos, scale=1): """ Normalize the given coordinate list to the range [0, `scale`]. Parameters ---------- pos : array Coordinate list scale : number The upperbound value for the coordinates range Returns ------- pos : array The rescaled (no...
python
def _rescale_layout(pos, scale=1): """ Normalize the given coordinate list to the range [0, `scale`]. Parameters ---------- pos : array Coordinate list scale : number The upperbound value for the coordinates range Returns ------- pos : array The rescaled (no...
[ "def", "_rescale_layout", "(", "pos", ",", "scale", "=", "1", ")", ":", "pos", "-=", "pos", ".", "min", "(", "axis", "=", "0", ")", "pos", "*=", "scale", "/", "pos", ".", "max", "(", ")", "return", "pos" ]
Normalize the given coordinate list to the range [0, `scale`]. Parameters ---------- pos : array Coordinate list scale : number The upperbound value for the coordinates range Returns ------- pos : array The rescaled (normalized) coordinates in the range [0, `scale`]...
[ "Normalize", "the", "given", "coordinate", "list", "to", "the", "range", "[", "0", "scale", "]", "." ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/graphs/util.py#L98-L122
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/ext/_bundled/freetype.py
get_handle
def get_handle(): ''' Get unique FT_Library handle ''' global __handle__ if not __handle__: __handle__ = FT_Library() error = FT_Init_FreeType(byref(__handle__)) if error: raise RuntimeError(hex(error)) return __handle__
python
def get_handle(): ''' Get unique FT_Library handle ''' global __handle__ if not __handle__: __handle__ = FT_Library() error = FT_Init_FreeType(byref(__handle__)) if error: raise RuntimeError(hex(error)) return __handle__
[ "def", "get_handle", "(", ")", ":", "global", "__handle__", "if", "not", "__handle__", ":", "__handle__", "=", "FT_Library", "(", ")", "error", "=", "FT_Init_FreeType", "(", "byref", "(", "__handle__", ")", ")", "if", "error", ":", "raise", "RuntimeError", ...
Get unique FT_Library handle
[ "Get", "unique", "FT_Library", "handle" ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/ext/_bundled/freetype.py#L205-L215
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/ext/_bundled/freetype.py
version
def version(): ''' Return the version of the FreeType library being used as a tuple of ( major version number, minor version number, patch version number ) ''' amajor = FT_Int() aminor = FT_Int() apatch = FT_Int() library = get_handle() FT_Library_Version(library, byref(amajor), byre...
python
def version(): ''' Return the version of the FreeType library being used as a tuple of ( major version number, minor version number, patch version number ) ''' amajor = FT_Int() aminor = FT_Int() apatch = FT_Int() library = get_handle() FT_Library_Version(library, byref(amajor), byre...
[ "def", "version", "(", ")", ":", "amajor", "=", "FT_Int", "(", ")", "aminor", "=", "FT_Int", "(", ")", "apatch", "=", "FT_Int", "(", ")", "library", "=", "get_handle", "(", ")", "FT_Library_Version", "(", "library", ",", "byref", "(", "amajor", ")", ...
Return the version of the FreeType library being used as a tuple of ( major version number, minor version number, patch version number )
[ "Return", "the", "version", "of", "the", "FreeType", "library", "being", "used", "as", "a", "tuple", "of", "(", "major", "version", "number", "minor", "version", "number", "patch", "version", "number", ")" ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/ext/_bundled/freetype.py#L218-L228
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/scene/cameras/_base.py
make_camera
def make_camera(cam_type, *args, **kwargs): """ Factory function for creating new cameras using a string name. Parameters ---------- cam_type : str May be one of: * 'panzoom' : Creates :class:`PanZoomCamera` * 'turntable' : Creates :class:`TurntableCamera` *...
python
def make_camera(cam_type, *args, **kwargs): """ Factory function for creating new cameras using a string name. Parameters ---------- cam_type : str May be one of: * 'panzoom' : Creates :class:`PanZoomCamera` * 'turntable' : Creates :class:`TurntableCamera` *...
[ "def", "make_camera", "(", "cam_type", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "cam_types", "=", "{", "None", ":", "BaseCamera", "}", "for", "camType", "in", "(", "BaseCamera", ",", "PanZoomCamera", ",", "PerspectiveCamera", ",", "TurntableCam...
Factory function for creating new cameras using a string name. Parameters ---------- cam_type : str May be one of: * 'panzoom' : Creates :class:`PanZoomCamera` * 'turntable' : Creates :class:`TurntableCamera` * None : Creates :class:`Camera` Notes -----...
[ "Factory", "function", "for", "creating", "new", "cameras", "using", "a", "string", "name", "." ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/scene/cameras/_base.py#L12-L38
glue-viz/glue-vispy-viewers
glue_vispy_viewers/scatter/multi_scatter.py
MultiColorScatter.set_data_values
def set_data_values(self, label, x, y, z): """ Set the position of the datapoints """ # TODO: avoid re-allocating an array every time self.layers[label]['data'] = np.array([x, y, z]).transpose() self._update()
python
def set_data_values(self, label, x, y, z): """ Set the position of the datapoints """ # TODO: avoid re-allocating an array every time self.layers[label]['data'] = np.array([x, y, z]).transpose() self._update()
[ "def", "set_data_values", "(", "self", ",", "label", ",", "x", ",", "y", ",", "z", ")", ":", "# TODO: avoid re-allocating an array every time", "self", ".", "layers", "[", "label", "]", "[", "'data'", "]", "=", "np", ".", "array", "(", "[", "x", ",", "...
Set the position of the datapoints
[ "Set", "the", "position", "of", "the", "datapoints" ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/scatter/multi_scatter.py#L49-L55
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/visuals/collections/segment_collection.py
SegmentCollection
def SegmentCollection(mode="agg-fast", *args, **kwargs): """ mode: string - "raw" (speed: fastest, size: small, output: ugly, no dash, no thickness) - "agg" (speed: slower, size: medium, output: perfect, no dash) """ if mode == "raw": return RawSegmentCollection(*args...
python
def SegmentCollection(mode="agg-fast", *args, **kwargs): """ mode: string - "raw" (speed: fastest, size: small, output: ugly, no dash, no thickness) - "agg" (speed: slower, size: medium, output: perfect, no dash) """ if mode == "raw": return RawSegmentCollection(*args...
[ "def", "SegmentCollection", "(", "mode", "=", "\"agg-fast\"", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "mode", "==", "\"raw\"", ":", "return", "RawSegmentCollection", "(", "*", "args", ",", "*", "*", "kwargs", ")", "return", "AggSegment...
mode: string - "raw" (speed: fastest, size: small, output: ugly, no dash, no thickness) - "agg" (speed: slower, size: medium, output: perfect, no dash)
[ "mode", ":", "string", "-", "raw", "(", "speed", ":", "fastest", "size", ":", "small", "output", ":", "ugly", "no", "dash", "no", "thickness", ")", "-", "agg", "(", "speed", ":", "slower", "size", ":", "medium", "output", ":", "perfect", "no", "dash"...
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/collections/segment_collection.py#L10-L20
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/geometry/parametric.py
surface
def surface(func, umin=0, umax=2 * np.pi, ucount=64, urepeat=1.0, vmin=0, vmax=2 * np.pi, vcount=64, vrepeat=1.0): """ Computes the parameterization of a parametric surface func: function(u,v) Parametric function used to build the surface """ vtype = [('position', np.float32, 3...
python
def surface(func, umin=0, umax=2 * np.pi, ucount=64, urepeat=1.0, vmin=0, vmax=2 * np.pi, vcount=64, vrepeat=1.0): """ Computes the parameterization of a parametric surface func: function(u,v) Parametric function used to build the surface """ vtype = [('position', np.float32, 3...
[ "def", "surface", "(", "func", ",", "umin", "=", "0", ",", "umax", "=", "2", "*", "np", ".", "pi", ",", "ucount", "=", "64", ",", "urepeat", "=", "1.0", ",", "vmin", "=", "0", ",", "vmax", "=", "2", "*", "np", ".", "pi", ",", "vcount", "=",...
Computes the parameterization of a parametric surface func: function(u,v) Parametric function used to build the surface
[ "Computes", "the", "parameterization", "of", "a", "parametric", "surface" ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/geometry/parametric.py#L11-L57
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/visuals/collections/point_collection.py
PointCollection
def PointCollection(mode="raw", *args, **kwargs): """ mode: string - "raw" (speed: fastest, size: small, output: ugly) - "agg" (speed: fast, size: small, output: beautiful) """ if mode == "raw": return RawPointCollection(*args, **kwargs) return AggPointCollection(*args,...
python
def PointCollection(mode="raw", *args, **kwargs): """ mode: string - "raw" (speed: fastest, size: small, output: ugly) - "agg" (speed: fast, size: small, output: beautiful) """ if mode == "raw": return RawPointCollection(*args, **kwargs) return AggPointCollection(*args,...
[ "def", "PointCollection", "(", "mode", "=", "\"raw\"", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "mode", "==", "\"raw\"", ":", "return", "RawPointCollection", "(", "*", "args", ",", "*", "*", "kwargs", ")", "return", "AggPointCollection"...
mode: string - "raw" (speed: fastest, size: small, output: ugly) - "agg" (speed: fast, size: small, output: beautiful)
[ "mode", ":", "string", "-", "raw", "(", "speed", ":", "fastest", "size", ":", "small", "output", ":", "ugly", ")", "-", "agg", "(", "speed", ":", "fast", "size", ":", "small", "output", ":", "beautiful", ")" ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/collections/point_collection.py#L11-L20
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/visuals/scrolling_lines.py
ScrollingLinesVisual.roll_data
def roll_data(self, data): """Append new data to the right side of every line strip and remove as much data from the left. Parameters ---------- data : array-like A data array to append. """ data = data.astype('float32')[..., np.newaxis] ...
python
def roll_data(self, data): """Append new data to the right side of every line strip and remove as much data from the left. Parameters ---------- data : array-like A data array to append. """ data = data.astype('float32')[..., np.newaxis] ...
[ "def", "roll_data", "(", "self", ",", "data", ")", ":", "data", "=", "data", ".", "astype", "(", "'float32'", ")", "[", "...", ",", "np", ".", "newaxis", "]", "s1", "=", "self", ".", "_data_shape", "[", "1", "]", "-", "self", ".", "_offset", "if"...
Append new data to the right side of every line strip and remove as much data from the left. Parameters ---------- data : array-like A data array to append.
[ "Append", "new", "data", "to", "the", "right", "side", "of", "every", "line", "strip", "and", "remove", "as", "much", "data", "from", "the", "left", ".", "Parameters", "----------", "data", ":", "array", "-", "like", "A", "data", "array", "to", "append",...
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/scrolling_lines.py#L160-L179
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/visuals/scrolling_lines.py
ScrollingLinesVisual.set_data
def set_data(self, index, data): """Set the complete data for a single line strip. Parameters ---------- index : int The index of the line strip to be replaced. data : array-like The data to assign to the selected line strip. """ s...
python
def set_data(self, index, data): """Set the complete data for a single line strip. Parameters ---------- index : int The index of the line strip to be replaced. data : array-like The data to assign to the selected line strip. """ s...
[ "def", "set_data", "(", "self", ",", "index", ",", "data", ")", ":", "self", ".", "_pos_tex", "[", "index", ",", ":", "]", "=", "data", "self", ".", "update", "(", ")" ]
Set the complete data for a single line strip. Parameters ---------- index : int The index of the line strip to be replaced. data : array-like The data to assign to the selected line strip.
[ "Set", "the", "complete", "data", "for", "a", "single", "line", "strip", ".", "Parameters", "----------", "index", ":", "int", "The", "index", "of", "the", "line", "strip", "to", "be", "replaced", ".", "data", ":", "array", "-", "like", "The", "data", ...
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/scrolling_lines.py#L181-L192
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/visuals/shaders/multiprogram.py
MultiProgram.add_program
def add_program(self, name=None): """Create a program and add it to this MultiProgram. It is the caller's responsibility to keep a reference to the returned program. The *name* must be unique, but is otherwise arbitrary and used for debugging purposes. ...
python
def add_program(self, name=None): """Create a program and add it to this MultiProgram. It is the caller's responsibility to keep a reference to the returned program. The *name* must be unique, but is otherwise arbitrary and used for debugging purposes. ...
[ "def", "add_program", "(", "self", ",", "name", "=", "None", ")", ":", "if", "name", "is", "None", ":", "name", "=", "'program'", "+", "str", "(", "self", ".", "_next_prog_id", ")", "self", ".", "_next_prog_id", "+=", "1", "if", "name", "in", "self",...
Create a program and add it to this MultiProgram. It is the caller's responsibility to keep a reference to the returned program. The *name* must be unique, but is otherwise arbitrary and used for debugging purposes.
[ "Create", "a", "program", "and", "add", "it", "to", "this", "MultiProgram", ".", "It", "is", "the", "caller", "s", "responsibility", "to", "keep", "a", "reference", "to", "the", "returned", "program", ".", "The", "*", "name", "*", "must", "be", "unique",...
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/shaders/multiprogram.py#L26-L50
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/visuals/shaders/multiprogram.py
MultiShader._new_program
def _new_program(self, p): """New program was added to the multiprogram; update items in the shader. """ for k, v in self._set_items.items(): getattr(p, self._shader)[k] = v
python
def _new_program(self, p): """New program was added to the multiprogram; update items in the shader. """ for k, v in self._set_items.items(): getattr(p, self._shader)[k] = v
[ "def", "_new_program", "(", "self", ",", "p", ")", ":", "for", "k", ",", "v", "in", "self", ".", "_set_items", ".", "items", "(", ")", ":", "getattr", "(", "p", ",", "self", ".", "_shader", ")", "[", "k", "]", "=", "v" ]
New program was added to the multiprogram; update items in the shader.
[ "New", "program", "was", "added", "to", "the", "multiprogram", ";", "update", "items", "in", "the", "shader", "." ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/shaders/multiprogram.py#L125-L130
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/visuals/transforms/interactive.py
PanZoomTransform.attach
def attach(self, canvas): """Attach this tranform to a canvas Parameters ---------- canvas : instance of Canvas The canvas. """ self._canvas = canvas canvas.events.resize.connect(self.on_resize) canvas.events.mouse_wheel.connect(self.on_mouse_...
python
def attach(self, canvas): """Attach this tranform to a canvas Parameters ---------- canvas : instance of Canvas The canvas. """ self._canvas = canvas canvas.events.resize.connect(self.on_resize) canvas.events.mouse_wheel.connect(self.on_mouse_...
[ "def", "attach", "(", "self", ",", "canvas", ")", ":", "self", ".", "_canvas", "=", "canvas", "canvas", ".", "events", ".", "resize", ".", "connect", "(", "self", ".", "on_resize", ")", "canvas", ".", "events", ".", "mouse_wheel", ".", "connect", "(", ...
Attach this tranform to a canvas Parameters ---------- canvas : instance of Canvas The canvas.
[ "Attach", "this", "tranform", "to", "a", "canvas" ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/transforms/interactive.py#L28-L39
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/visuals/transforms/interactive.py
PanZoomTransform.on_resize
def on_resize(self, event): """Resize handler Parameters ---------- event : instance of Event The event. """ if self._aspect is None: return w, h = self._canvas.size aspect = self._aspect / (w / h) self.scale = (self.scale[...
python
def on_resize(self, event): """Resize handler Parameters ---------- event : instance of Event The event. """ if self._aspect is None: return w, h = self._canvas.size aspect = self._aspect / (w / h) self.scale = (self.scale[...
[ "def", "on_resize", "(", "self", ",", "event", ")", ":", "if", "self", ".", "_aspect", "is", "None", ":", "return", "w", ",", "h", "=", "self", ".", "_canvas", ".", "size", "aspect", "=", "self", ".", "_aspect", "/", "(", "w", "/", "h", ")", "s...
Resize handler Parameters ---------- event : instance of Event The event.
[ "Resize", "handler" ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/transforms/interactive.py#L47-L60
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/visuals/transforms/interactive.py
PanZoomTransform.on_mouse_move
def on_mouse_move(self, event): """Mouse move handler Parameters ---------- event : instance of Event The event. """ if event.is_dragging: dxy = event.pos - event.last_event.pos button = event.press_event.button if button ...
python
def on_mouse_move(self, event): """Mouse move handler Parameters ---------- event : instance of Event The event. """ if event.is_dragging: dxy = event.pos - event.last_event.pos button = event.press_event.button if button ...
[ "def", "on_mouse_move", "(", "self", ",", "event", ")", ":", "if", "event", ".", "is_dragging", ":", "dxy", "=", "event", ".", "pos", "-", "event", ".", "last_event", ".", "pos", "button", "=", "event", ".", "press_event", ".", "button", "if", "button"...
Mouse move handler Parameters ---------- event : instance of Event The event.
[ "Mouse", "move", "handler" ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/transforms/interactive.py#L62-L87
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/visuals/transforms/interactive.py
PanZoomTransform.on_mouse_wheel
def on_mouse_wheel(self, event): """Mouse wheel handler Parameters ---------- event : instance of Event The event. """ self.zoom(np.exp(event.delta * (0.01, -0.01)), event.pos)
python
def on_mouse_wheel(self, event): """Mouse wheel handler Parameters ---------- event : instance of Event The event. """ self.zoom(np.exp(event.delta * (0.01, -0.01)), event.pos)
[ "def", "on_mouse_wheel", "(", "self", ",", "event", ")", ":", "self", ".", "zoom", "(", "np", ".", "exp", "(", "event", ".", "delta", "*", "(", "0.01", ",", "-", "0.01", ")", ")", ",", "event", ".", "pos", ")" ]
Mouse wheel handler Parameters ---------- event : instance of Event The event.
[ "Mouse", "wheel", "handler" ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/transforms/interactive.py#L89-L97
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/visuals/tube.py
_frenet_frames
def _frenet_frames(points, closed): '''Calculates and returns the tangents, normals and binormals for the tube.''' tangents = np.zeros((len(points), 3)) normals = np.zeros((len(points), 3)) epsilon = 0.0001 # Compute tangent vectors for each segment tangents = np.roll(points, -1, axis=0) -...
python
def _frenet_frames(points, closed): '''Calculates and returns the tangents, normals and binormals for the tube.''' tangents = np.zeros((len(points), 3)) normals = np.zeros((len(points), 3)) epsilon = 0.0001 # Compute tangent vectors for each segment tangents = np.roll(points, -1, axis=0) -...
[ "def", "_frenet_frames", "(", "points", ",", "closed", ")", ":", "tangents", "=", "np", ".", "zeros", "(", "(", "len", "(", "points", ")", ",", "3", ")", ")", "normals", "=", "np", ".", "zeros", "(", "(", "len", "(", "points", ")", ",", "3", ")...
Calculates and returns the tangents, normals and binormals for the tube.
[ "Calculates", "and", "returns", "the", "tangents", "normals", "and", "binormals", "for", "the", "tube", "." ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/tube.py#L109-L160
cds-astro/mocpy
mocpy/abstract_moc.py
AbstractMOC.max_order
def max_order(self): """ Depth of the smallest HEALPix cells found in the MOC instance. """ # TODO: cache value combo = int(0) for iv in self._interval_set._intervals: combo |= iv[0] | iv[1] ret = AbstractMOC.HPY_MAX_NORDER - (utils.number_trailing_ze...
python
def max_order(self): """ Depth of the smallest HEALPix cells found in the MOC instance. """ # TODO: cache value combo = int(0) for iv in self._interval_set._intervals: combo |= iv[0] | iv[1] ret = AbstractMOC.HPY_MAX_NORDER - (utils.number_trailing_ze...
[ "def", "max_order", "(", "self", ")", ":", "# TODO: cache value", "combo", "=", "int", "(", "0", ")", "for", "iv", "in", "self", ".", "_interval_set", ".", "_intervals", ":", "combo", "|=", "iv", "[", "0", "]", "|", "iv", "[", "1", "]", "ret", "=",...
Depth of the smallest HEALPix cells found in the MOC instance.
[ "Depth", "of", "the", "smallest", "HEALPix", "cells", "found", "in", "the", "MOC", "instance", "." ]
train
https://github.com/cds-astro/mocpy/blob/09472cabe537f6bfdb049eeea64d3ea57b391c21/mocpy/abstract_moc.py#L70-L83
cds-astro/mocpy
mocpy/abstract_moc.py
AbstractMOC.intersection
def intersection(self, another_moc, *args): """ Intersection between the MOC instance and other MOCs. Parameters ---------- another_moc : `~mocpy.moc.MOC` The MOC used for performing the intersection with self. args : `~mocpy.moc.MOC` Other additi...
python
def intersection(self, another_moc, *args): """ Intersection between the MOC instance and other MOCs. Parameters ---------- another_moc : `~mocpy.moc.MOC` The MOC used for performing the intersection with self. args : `~mocpy.moc.MOC` Other additi...
[ "def", "intersection", "(", "self", ",", "another_moc", ",", "*", "args", ")", ":", "interval_set", "=", "self", ".", "_interval_set", ".", "intersection", "(", "another_moc", ".", "_interval_set", ")", "for", "moc", "in", "args", ":", "interval_set", "=", ...
Intersection between the MOC instance and other MOCs. Parameters ---------- another_moc : `~mocpy.moc.MOC` The MOC used for performing the intersection with self. args : `~mocpy.moc.MOC` Other additional MOCs to perform the intersection with. Returns ...
[ "Intersection", "between", "the", "MOC", "instance", "and", "other", "MOCs", "." ]
train
https://github.com/cds-astro/mocpy/blob/09472cabe537f6bfdb049eeea64d3ea57b391c21/mocpy/abstract_moc.py#L85-L105
cds-astro/mocpy
mocpy/abstract_moc.py
AbstractMOC.union
def union(self, another_moc, *args): """ Union between the MOC instance and other MOCs. Parameters ---------- another_moc : `~mocpy.moc.MOC` The MOC used for performing the union with self. args : `~mocpy.moc.MOC` Other additional MOCs to perform ...
python
def union(self, another_moc, *args): """ Union between the MOC instance and other MOCs. Parameters ---------- another_moc : `~mocpy.moc.MOC` The MOC used for performing the union with self. args : `~mocpy.moc.MOC` Other additional MOCs to perform ...
[ "def", "union", "(", "self", ",", "another_moc", ",", "*", "args", ")", ":", "interval_set", "=", "self", ".", "_interval_set", ".", "union", "(", "another_moc", ".", "_interval_set", ")", "for", "moc", "in", "args", ":", "interval_set", "=", "interval_set...
Union between the MOC instance and other MOCs. Parameters ---------- another_moc : `~mocpy.moc.MOC` The MOC used for performing the union with self. args : `~mocpy.moc.MOC` Other additional MOCs to perform the union with. Returns ------- ...
[ "Union", "between", "the", "MOC", "instance", "and", "other", "MOCs", "." ]
train
https://github.com/cds-astro/mocpy/blob/09472cabe537f6bfdb049eeea64d3ea57b391c21/mocpy/abstract_moc.py#L107-L127
cds-astro/mocpy
mocpy/abstract_moc.py
AbstractMOC.difference
def difference(self, another_moc, *args): """ Difference between the MOC instance and other MOCs. Parameters ---------- another_moc : `~mocpy.moc.MOC` The MOC used that will be substracted to self. args : `~mocpy.moc.MOC` Other additional MOCs to ...
python
def difference(self, another_moc, *args): """ Difference between the MOC instance and other MOCs. Parameters ---------- another_moc : `~mocpy.moc.MOC` The MOC used that will be substracted to self. args : `~mocpy.moc.MOC` Other additional MOCs to ...
[ "def", "difference", "(", "self", ",", "another_moc", ",", "*", "args", ")", ":", "interval_set", "=", "self", ".", "_interval_set", ".", "difference", "(", "another_moc", ".", "_interval_set", ")", "for", "moc", "in", "args", ":", "interval_set", "=", "in...
Difference between the MOC instance and other MOCs. Parameters ---------- another_moc : `~mocpy.moc.MOC` The MOC used that will be substracted to self. args : `~mocpy.moc.MOC` Other additional MOCs to perform the difference with. Returns ------- ...
[ "Difference", "between", "the", "MOC", "instance", "and", "other", "MOCs", "." ]
train
https://github.com/cds-astro/mocpy/blob/09472cabe537f6bfdb049eeea64d3ea57b391c21/mocpy/abstract_moc.py#L129-L149
cds-astro/mocpy
mocpy/abstract_moc.py
AbstractMOC._neighbour_pixels
def _neighbour_pixels(hp, ipix): """ Returns all the pixels neighbours of ``ipix`` """ neigh_ipix = np.unique(hp.neighbours(ipix).ravel()) # Remove negative pixel values returned by `~astropy_healpix.HEALPix.neighbours` return neigh_ipix[np.where(neigh_ipix >= 0)]
python
def _neighbour_pixels(hp, ipix): """ Returns all the pixels neighbours of ``ipix`` """ neigh_ipix = np.unique(hp.neighbours(ipix).ravel()) # Remove negative pixel values returned by `~astropy_healpix.HEALPix.neighbours` return neigh_ipix[np.where(neigh_ipix >= 0)]
[ "def", "_neighbour_pixels", "(", "hp", ",", "ipix", ")", ":", "neigh_ipix", "=", "np", ".", "unique", "(", "hp", ".", "neighbours", "(", "ipix", ")", ".", "ravel", "(", ")", ")", "# Remove negative pixel values returned by `~astropy_healpix.HEALPix.neighbours`", "...
Returns all the pixels neighbours of ``ipix``
[ "Returns", "all", "the", "pixels", "neighbours", "of", "ipix" ]
train
https://github.com/cds-astro/mocpy/blob/09472cabe537f6bfdb049eeea64d3ea57b391c21/mocpy/abstract_moc.py#L187-L193
cds-astro/mocpy
mocpy/abstract_moc.py
AbstractMOC.from_cells
def from_cells(cls, cells): """ Creates a MOC from a numpy array representing the HEALPix cells. Parameters ---------- cells : `numpy.ndarray` Must be a numpy structured array (See https://docs.scipy.org/doc/numpy-1.15.0/user/basics.rec.html). The structu...
python
def from_cells(cls, cells): """ Creates a MOC from a numpy array representing the HEALPix cells. Parameters ---------- cells : `numpy.ndarray` Must be a numpy structured array (See https://docs.scipy.org/doc/numpy-1.15.0/user/basics.rec.html). The structu...
[ "def", "from_cells", "(", "cls", ",", "cells", ")", ":", "shift", "=", "(", "AbstractMOC", ".", "HPY_MAX_NORDER", "-", "cells", "[", "\"depth\"", "]", ")", "<<", "1", "p1", "=", "cells", "[", "\"ipix\"", "]", "p2", "=", "cells", "[", "\"ipix\"", "]",...
Creates a MOC from a numpy array representing the HEALPix cells. Parameters ---------- cells : `numpy.ndarray` Must be a numpy structured array (See https://docs.scipy.org/doc/numpy-1.15.0/user/basics.rec.html). The structure of a cell contains 3 attributes: ...
[ "Creates", "a", "MOC", "from", "a", "numpy", "array", "representing", "the", "HEALPix", "cells", "." ]
train
https://github.com/cds-astro/mocpy/blob/09472cabe537f6bfdb049eeea64d3ea57b391c21/mocpy/abstract_moc.py#L196-L222
cds-astro/mocpy
mocpy/abstract_moc.py
AbstractMOC.from_json
def from_json(cls, json_moc): """ Creates a MOC from a dictionary of HEALPix cell arrays indexed by their depth. Parameters ---------- json_moc : dict(str : [int] A dictionary of HEALPix cell arrays indexed by their depth. Returns ------- moc...
python
def from_json(cls, json_moc): """ Creates a MOC from a dictionary of HEALPix cell arrays indexed by their depth. Parameters ---------- json_moc : dict(str : [int] A dictionary of HEALPix cell arrays indexed by their depth. Returns ------- moc...
[ "def", "from_json", "(", "cls", ",", "json_moc", ")", ":", "intervals", "=", "np", ".", "array", "(", "[", "]", ")", "for", "order", ",", "pix_l", "in", "json_moc", ".", "items", "(", ")", ":", "if", "len", "(", "pix_l", ")", "==", "0", ":", "c...
Creates a MOC from a dictionary of HEALPix cell arrays indexed by their depth. Parameters ---------- json_moc : dict(str : [int] A dictionary of HEALPix cell arrays indexed by their depth. Returns ------- moc : `~mocpy.moc.MOC` or `~mocpy.tmoc.TimeMOC` ...
[ "Creates", "a", "MOC", "from", "a", "dictionary", "of", "HEALPix", "cell", "arrays", "indexed", "by", "their", "depth", "." ]
train
https://github.com/cds-astro/mocpy/blob/09472cabe537f6bfdb049eeea64d3ea57b391c21/mocpy/abstract_moc.py#L225-L254
cds-astro/mocpy
mocpy/abstract_moc.py
AbstractMOC._uniq_pixels_iterator
def _uniq_pixels_iterator(self): """ Generator giving the NUNIQ HEALPix pixels of the MOC. Returns ------- uniq : the NUNIQ HEALPix pixels iterator """ intervals_uniq_l = IntervalSet.to_nuniq_interval_set(self._interval_set)._intervals for uni...
python
def _uniq_pixels_iterator(self): """ Generator giving the NUNIQ HEALPix pixels of the MOC. Returns ------- uniq : the NUNIQ HEALPix pixels iterator """ intervals_uniq_l = IntervalSet.to_nuniq_interval_set(self._interval_set)._intervals for uni...
[ "def", "_uniq_pixels_iterator", "(", "self", ")", ":", "intervals_uniq_l", "=", "IntervalSet", ".", "to_nuniq_interval_set", "(", "self", ".", "_interval_set", ")", ".", "_intervals", "for", "uniq_iv", "in", "intervals_uniq_l", ":", "for", "uniq", "in", "range", ...
Generator giving the NUNIQ HEALPix pixels of the MOC. Returns ------- uniq : the NUNIQ HEALPix pixels iterator
[ "Generator", "giving", "the", "NUNIQ", "HEALPix", "pixels", "of", "the", "MOC", "." ]
train
https://github.com/cds-astro/mocpy/blob/09472cabe537f6bfdb049eeea64d3ea57b391c21/mocpy/abstract_moc.py#L256-L268
cds-astro/mocpy
mocpy/abstract_moc.py
AbstractMOC.from_fits
def from_fits(cls, filename): """ Loads a MOC from a FITS file. The specified FITS file must store the MOC (i.e. the list of HEALPix cells it contains) in a binary HDU table. Parameters ---------- filename : str The path to the FITS file. Returns ...
python
def from_fits(cls, filename): """ Loads a MOC from a FITS file. The specified FITS file must store the MOC (i.e. the list of HEALPix cells it contains) in a binary HDU table. Parameters ---------- filename : str The path to the FITS file. Returns ...
[ "def", "from_fits", "(", "cls", ",", "filename", ")", ":", "table", "=", "Table", ".", "read", "(", "filename", ")", "intervals", "=", "np", ".", "vstack", "(", "(", "table", "[", "'UNIQ'", "]", ",", "table", "[", "'UNIQ'", "]", "+", "1", ")", ")...
Loads a MOC from a FITS file. The specified FITS file must store the MOC (i.e. the list of HEALPix cells it contains) in a binary HDU table. Parameters ---------- filename : str The path to the FITS file. Returns ------- result : `~mocpy.moc.MOC` or...
[ "Loads", "a", "MOC", "from", "a", "FITS", "file", "." ]
train
https://github.com/cds-astro/mocpy/blob/09472cabe537f6bfdb049eeea64d3ea57b391c21/mocpy/abstract_moc.py#L271-L293
cds-astro/mocpy
mocpy/abstract_moc.py
AbstractMOC.from_str
def from_str(cls, value): """ Create a MOC from a str. This grammar is expressed is the `MOC IVOA <http://ivoa.net/documents/MOC/20190215/WD-MOC-1.1-20190215.pdf>`__ specification at section 2.3.2. Parameters ---------- value : str The MOC as...
python
def from_str(cls, value): """ Create a MOC from a str. This grammar is expressed is the `MOC IVOA <http://ivoa.net/documents/MOC/20190215/WD-MOC-1.1-20190215.pdf>`__ specification at section 2.3.2. Parameters ---------- value : str The MOC as...
[ "def", "from_str", "(", "cls", ",", "value", ")", ":", "# Import lark parser when from_str is called", "# at least one time", "from", "lark", "import", "Lark", ",", "Transformer", "class", "ParsingException", "(", "Exception", ")", ":", "pass", "class", "TreeToJson", ...
Create a MOC from a str. This grammar is expressed is the `MOC IVOA <http://ivoa.net/documents/MOC/20190215/WD-MOC-1.1-20190215.pdf>`__ specification at section 2.3.2. Parameters ---------- value : str The MOC as a string following the grammar rules. ...
[ "Create", "a", "MOC", "from", "a", "str", ".", "This", "grammar", "is", "expressed", "is", "the", "MOC", "IVOA", "<http", ":", "//", "ivoa", ".", "net", "/", "documents", "/", "MOC", "/", "20190215", "/", "WD", "-", "MOC", "-", "1", ".", "1", "-"...
train
https://github.com/cds-astro/mocpy/blob/09472cabe537f6bfdb049eeea64d3ea57b391c21/mocpy/abstract_moc.py#L296-L377
cds-astro/mocpy
mocpy/abstract_moc.py
AbstractMOC._to_json
def _to_json(uniq): """ Serializes a MOC to the JSON format. Parameters ---------- uniq : `~numpy.ndarray` The array of HEALPix cells representing the MOC to serialize. Returns ------- result_json : {str : [int]} A dictionary of H...
python
def _to_json(uniq): """ Serializes a MOC to the JSON format. Parameters ---------- uniq : `~numpy.ndarray` The array of HEALPix cells representing the MOC to serialize. Returns ------- result_json : {str : [int]} A dictionary of H...
[ "def", "_to_json", "(", "uniq", ")", ":", "result_json", "=", "{", "}", "depth", ",", "ipix", "=", "utils", ".", "uniq2orderipix", "(", "uniq", ")", "min_depth", "=", "np", ".", "min", "(", "depth", "[", "0", "]", ")", "max_depth", "=", "np", ".", ...
Serializes a MOC to the JSON format. Parameters ---------- uniq : `~numpy.ndarray` The array of HEALPix cells representing the MOC to serialize. Returns ------- result_json : {str : [int]} A dictionary of HEALPix cell lists indexed by their depth...
[ "Serializes", "a", "MOC", "to", "the", "JSON", "format", "." ]
train
https://github.com/cds-astro/mocpy/blob/09472cabe537f6bfdb049eeea64d3ea57b391c21/mocpy/abstract_moc.py#L380-L407
cds-astro/mocpy
mocpy/abstract_moc.py
AbstractMOC._to_str
def _to_str(uniq): """ Serializes a MOC to the STRING format. HEALPix cells are separated by a comma. The HEALPix cell at order 0 and number 10 is encoded by the string: "0/10", the first digit representing the depth and the second the HEALPix cell number for this depth. HEALPix...
python
def _to_str(uniq): """ Serializes a MOC to the STRING format. HEALPix cells are separated by a comma. The HEALPix cell at order 0 and number 10 is encoded by the string: "0/10", the first digit representing the depth and the second the HEALPix cell number for this depth. HEALPix...
[ "def", "_to_str", "(", "uniq", ")", ":", "def", "write_cells", "(", "serial", ",", "a", ",", "b", ",", "sep", "=", "''", ")", ":", "if", "a", "==", "b", ":", "serial", "+=", "'{0}{1}'", ".", "format", "(", "a", ",", "sep", ")", "else", ":", "...
Serializes a MOC to the STRING format. HEALPix cells are separated by a comma. The HEALPix cell at order 0 and number 10 is encoded by the string: "0/10", the first digit representing the depth and the second the HEALPix cell number for this depth. HEALPix cells next to each other within a spec...
[ "Serializes", "a", "MOC", "to", "the", "STRING", "format", "." ]
train
https://github.com/cds-astro/mocpy/blob/09472cabe537f6bfdb049eeea64d3ea57b391c21/mocpy/abstract_moc.py#L410-L487
cds-astro/mocpy
mocpy/abstract_moc.py
AbstractMOC._to_fits
def _to_fits(self, uniq, optional_kw_dict=None): """ Serializes a MOC to the FITS format. Parameters ---------- uniq : `numpy.ndarray` The array of HEALPix cells representing the MOC to serialize. optional_kw_dict : dict Optional keywords argument...
python
def _to_fits(self, uniq, optional_kw_dict=None): """ Serializes a MOC to the FITS format. Parameters ---------- uniq : `numpy.ndarray` The array of HEALPix cells representing the MOC to serialize. optional_kw_dict : dict Optional keywords argument...
[ "def", "_to_fits", "(", "self", ",", "uniq", ",", "optional_kw_dict", "=", "None", ")", ":", "depth", "=", "self", ".", "max_order", "if", "depth", "<=", "13", ":", "fits_format", "=", "'1J'", "else", ":", "fits_format", "=", "'1K'", "tbhdu", "=", "fit...
Serializes a MOC to the FITS format. Parameters ---------- uniq : `numpy.ndarray` The array of HEALPix cells representing the MOC to serialize. optional_kw_dict : dict Optional keywords arguments added to the FITS header. Returns ------- ...
[ "Serializes", "a", "MOC", "to", "the", "FITS", "format", "." ]
train
https://github.com/cds-astro/mocpy/blob/09472cabe537f6bfdb049eeea64d3ea57b391c21/mocpy/abstract_moc.py#L489-L525
cds-astro/mocpy
mocpy/abstract_moc.py
AbstractMOC.serialize
def serialize(self, format='fits', optional_kw_dict=None): """ Serializes the MOC into a specific format. Possible formats are FITS, JSON and STRING Parameters ---------- format : str 'fits' by default. The other possible choice is 'json' or 'str'. o...
python
def serialize(self, format='fits', optional_kw_dict=None): """ Serializes the MOC into a specific format. Possible formats are FITS, JSON and STRING Parameters ---------- format : str 'fits' by default. The other possible choice is 'json' or 'str'. o...
[ "def", "serialize", "(", "self", ",", "format", "=", "'fits'", ",", "optional_kw_dict", "=", "None", ")", ":", "formats", "=", "(", "'fits'", ",", "'json'", ",", "'str'", ")", "if", "format", "not", "in", "formats", ":", "raise", "ValueError", "(", "'f...
Serializes the MOC into a specific format. Possible formats are FITS, JSON and STRING Parameters ---------- format : str 'fits' by default. The other possible choice is 'json' or 'str'. optional_kw_dict : dict Optional keywords arguments added to the FIT...
[ "Serializes", "the", "MOC", "into", "a", "specific", "format", "." ]
train
https://github.com/cds-astro/mocpy/blob/09472cabe537f6bfdb049eeea64d3ea57b391c21/mocpy/abstract_moc.py#L527-L564
cds-astro/mocpy
mocpy/abstract_moc.py
AbstractMOC.write
def write(self, path, format='fits', overwrite=False, optional_kw_dict=None): """ Writes the MOC to a file. Format can be 'fits' or 'json', though only the fits format is officially supported by the IVOA. Parameters ---------- path : str, optional The path t...
python
def write(self, path, format='fits', overwrite=False, optional_kw_dict=None): """ Writes the MOC to a file. Format can be 'fits' or 'json', though only the fits format is officially supported by the IVOA. Parameters ---------- path : str, optional The path t...
[ "def", "write", "(", "self", ",", "path", ",", "format", "=", "'fits'", ",", "overwrite", "=", "False", ",", "optional_kw_dict", "=", "None", ")", ":", "serialization", "=", "self", ".", "serialize", "(", "format", "=", "format", ",", "optional_kw_dict", ...
Writes the MOC to a file. Format can be 'fits' or 'json', though only the fits format is officially supported by the IVOA. Parameters ---------- path : str, optional The path to the file to save the MOC in. format : str, optional The format in which the ...
[ "Writes", "the", "MOC", "to", "a", "file", "." ]
train
https://github.com/cds-astro/mocpy/blob/09472cabe537f6bfdb049eeea64d3ea57b391c21/mocpy/abstract_moc.py#L566-L590
cds-astro/mocpy
mocpy/abstract_moc.py
AbstractMOC.degrade_to_order
def degrade_to_order(self, new_order): """ Degrades the MOC instance to a new, less precise, MOC. The maximum depth (i.e. the depth of the smallest HEALPix cells that can be found in the MOC) of the degraded MOC is set to ``new_order``. Parameters ---------- ne...
python
def degrade_to_order(self, new_order): """ Degrades the MOC instance to a new, less precise, MOC. The maximum depth (i.e. the depth of the smallest HEALPix cells that can be found in the MOC) of the degraded MOC is set to ``new_order``. Parameters ---------- ne...
[ "def", "degrade_to_order", "(", "self", ",", "new_order", ")", ":", "shift", "=", "2", "*", "(", "AbstractMOC", ".", "HPY_MAX_NORDER", "-", "new_order", ")", "ofs", "=", "(", "int", "(", "1", ")", "<<", "shift", ")", "-", "1", "mask", "=", "~", "of...
Degrades the MOC instance to a new, less precise, MOC. The maximum depth (i.e. the depth of the smallest HEALPix cells that can be found in the MOC) of the degraded MOC is set to ``new_order``. Parameters ---------- new_order : int Maximum depth of the output degra...
[ "Degrades", "the", "MOC", "instance", "to", "a", "new", "less", "precise", "MOC", "." ]
train
https://github.com/cds-astro/mocpy/blob/09472cabe537f6bfdb049eeea64d3ea57b391c21/mocpy/abstract_moc.py#L592-L623
rbarrois/mpdlcd
mpdlcd/vendor/lcdproc/screen.py
Screen.set_name
def set_name(self, name): """ Set Screen Name """ self.name = name self.server.request("screen_set %s name %s" % (self.ref, self.name))
python
def set_name(self, name): """ Set Screen Name """ self.name = name self.server.request("screen_set %s name %s" % (self.ref, self.name))
[ "def", "set_name", "(", "self", ",", "name", ")", ":", "self", ".", "name", "=", "name", "self", ".", "server", ".", "request", "(", "\"screen_set %s name %s\"", "%", "(", "self", ".", "ref", ",", "self", ".", "name", ")", ")" ]
Set Screen Name
[ "Set", "Screen", "Name" ]
train
https://github.com/rbarrois/mpdlcd/blob/85f16c8cc0883f8abb4c2cc7f69729c3e2f857da/mpdlcd/vendor/lcdproc/screen.py#L53-L57
rbarrois/mpdlcd
mpdlcd/vendor/lcdproc/screen.py
Screen.set_width
def set_width(self, width): """ Set Screen Width """ if width > 0 and width <= self.server.server_info.get("screen_width"): self.width = width self.server.request("screen_set %s wid %i" % (self.ref, self.width))
python
def set_width(self, width): """ Set Screen Width """ if width > 0 and width <= self.server.server_info.get("screen_width"): self.width = width self.server.request("screen_set %s wid %i" % (self.ref, self.width))
[ "def", "set_width", "(", "self", ",", "width", ")", ":", "if", "width", ">", "0", "and", "width", "<=", "self", ".", "server", ".", "server_info", ".", "get", "(", "\"screen_width\"", ")", ":", "self", ".", "width", "=", "width", "self", ".", "server...
Set Screen Width
[ "Set", "Screen", "Width" ]
train
https://github.com/rbarrois/mpdlcd/blob/85f16c8cc0883f8abb4c2cc7f69729c3e2f857da/mpdlcd/vendor/lcdproc/screen.py#L59-L64
rbarrois/mpdlcd
mpdlcd/vendor/lcdproc/screen.py
Screen.set_height
def set_height(self, height): """ Set Screen Height """ if height > 0 and height <= self.server.server_info.get("screen_height"): self.height = height self.server.request("screen_set %s hgt %i" % (self.ref, self.height))
python
def set_height(self, height): """ Set Screen Height """ if height > 0 and height <= self.server.server_info.get("screen_height"): self.height = height self.server.request("screen_set %s hgt %i" % (self.ref, self.height))
[ "def", "set_height", "(", "self", ",", "height", ")", ":", "if", "height", ">", "0", "and", "height", "<=", "self", ".", "server", ".", "server_info", ".", "get", "(", "\"screen_height\"", ")", ":", "self", ".", "height", "=", "height", "self", ".", ...
Set Screen Height
[ "Set", "Screen", "Height" ]
train
https://github.com/rbarrois/mpdlcd/blob/85f16c8cc0883f8abb4c2cc7f69729c3e2f857da/mpdlcd/vendor/lcdproc/screen.py#L66-L71
rbarrois/mpdlcd
mpdlcd/vendor/lcdproc/screen.py
Screen.set_cursor_x
def set_cursor_x(self, x): """ Set Screen Cursor X Position """ if x >= 0 and x <= self.server.server_info.get("screen_width"): self.cursor_x = x self.server.request("screen_set %s cursor_x %i" % (self.ref, self.cursor_x))
python
def set_cursor_x(self, x): """ Set Screen Cursor X Position """ if x >= 0 and x <= self.server.server_info.get("screen_width"): self.cursor_x = x self.server.request("screen_set %s cursor_x %i" % (self.ref, self.cursor_x))
[ "def", "set_cursor_x", "(", "self", ",", "x", ")", ":", "if", "x", ">=", "0", "and", "x", "<=", "self", ".", "server", ".", "server_info", ".", "get", "(", "\"screen_width\"", ")", ":", "self", ".", "cursor_x", "=", "x", "self", ".", "server", ".",...
Set Screen Cursor X Position
[ "Set", "Screen", "Cursor", "X", "Position" ]
train
https://github.com/rbarrois/mpdlcd/blob/85f16c8cc0883f8abb4c2cc7f69729c3e2f857da/mpdlcd/vendor/lcdproc/screen.py#L73-L78
rbarrois/mpdlcd
mpdlcd/vendor/lcdproc/screen.py
Screen.set_cursor_y
def set_cursor_y(self, y): """ Set Screen Cursor Y Position """ if y >= 0 and y <= self.server.server_info.get("screen_height"): self.cursor_y = y self.server.request("screen_set %s cursor_y %i" % (self.ref, self.cursor_y))
python
def set_cursor_y(self, y): """ Set Screen Cursor Y Position """ if y >= 0 and y <= self.server.server_info.get("screen_height"): self.cursor_y = y self.server.request("screen_set %s cursor_y %i" % (self.ref, self.cursor_y))
[ "def", "set_cursor_y", "(", "self", ",", "y", ")", ":", "if", "y", ">=", "0", "and", "y", "<=", "self", ".", "server", ".", "server_info", ".", "get", "(", "\"screen_height\"", ")", ":", "self", ".", "cursor_y", "=", "y", "self", ".", "server", "."...
Set Screen Cursor Y Position
[ "Set", "Screen", "Cursor", "Y", "Position" ]
train
https://github.com/rbarrois/mpdlcd/blob/85f16c8cc0883f8abb4c2cc7f69729c3e2f857da/mpdlcd/vendor/lcdproc/screen.py#L80-L85
rbarrois/mpdlcd
mpdlcd/vendor/lcdproc/screen.py
Screen.set_duration
def set_duration(self, duration): """ Set Screen Change Interval Duration """ if duration > 0: self.duration = duration self.server.request("screen_set %s duration %i" % (self.ref, (self.duration * 8)))
python
def set_duration(self, duration): """ Set Screen Change Interval Duration """ if duration > 0: self.duration = duration self.server.request("screen_set %s duration %i" % (self.ref, (self.duration * 8)))
[ "def", "set_duration", "(", "self", ",", "duration", ")", ":", "if", "duration", ">", "0", ":", "self", ".", "duration", "=", "duration", "self", ".", "server", ".", "request", "(", "\"screen_set %s duration %i\"", "%", "(", "self", ".", "ref", ",", "(",...
Set Screen Change Interval Duration
[ "Set", "Screen", "Change", "Interval", "Duration" ]
train
https://github.com/rbarrois/mpdlcd/blob/85f16c8cc0883f8abb4c2cc7f69729c3e2f857da/mpdlcd/vendor/lcdproc/screen.py#L87-L92
rbarrois/mpdlcd
mpdlcd/vendor/lcdproc/screen.py
Screen.set_timeout
def set_timeout(self, timeout): """ Set Screen Timeout Duration """ if timeout > 0: self.timeout = timeout self.server.request("screen_set %s timeout %i" % (self.ref, (self.timeout * 8)))
python
def set_timeout(self, timeout): """ Set Screen Timeout Duration """ if timeout > 0: self.timeout = timeout self.server.request("screen_set %s timeout %i" % (self.ref, (self.timeout * 8)))
[ "def", "set_timeout", "(", "self", ",", "timeout", ")", ":", "if", "timeout", ">", "0", ":", "self", ".", "timeout", "=", "timeout", "self", ".", "server", ".", "request", "(", "\"screen_set %s timeout %i\"", "%", "(", "self", ".", "ref", ",", "(", "se...
Set Screen Timeout Duration
[ "Set", "Screen", "Timeout", "Duration" ]
train
https://github.com/rbarrois/mpdlcd/blob/85f16c8cc0883f8abb4c2cc7f69729c3e2f857da/mpdlcd/vendor/lcdproc/screen.py#L94-L99
rbarrois/mpdlcd
mpdlcd/vendor/lcdproc/screen.py
Screen.set_priority
def set_priority(self, priority): """ Set Screen Priority Class """ if priority in ["hidden", "background", "info", "foreground", "alert", "input"]: self.priority = priority self.server.request("screen_set %s priority %s" % (self.ref, self.priority))
python
def set_priority(self, priority): """ Set Screen Priority Class """ if priority in ["hidden", "background", "info", "foreground", "alert", "input"]: self.priority = priority self.server.request("screen_set %s priority %s" % (self.ref, self.priority))
[ "def", "set_priority", "(", "self", ",", "priority", ")", ":", "if", "priority", "in", "[", "\"hidden\"", ",", "\"background\"", ",", "\"info\"", ",", "\"foreground\"", ",", "\"alert\"", ",", "\"input\"", "]", ":", "self", ".", "priority", "=", "priority", ...
Set Screen Priority Class
[ "Set", "Screen", "Priority", "Class" ]
train
https://github.com/rbarrois/mpdlcd/blob/85f16c8cc0883f8abb4c2cc7f69729c3e2f857da/mpdlcd/vendor/lcdproc/screen.py#L101-L106
rbarrois/mpdlcd
mpdlcd/vendor/lcdproc/screen.py
Screen.set_backlight
def set_backlight(self, state): """ Set Screen Backlight Mode """ if state in ["on", "off", "toggle", "open", "blink", "flash"]: self.backlight = state self.server.request("screen_set %s backlight %s" % (self.ref, self.backlight))
python
def set_backlight(self, state): """ Set Screen Backlight Mode """ if state in ["on", "off", "toggle", "open", "blink", "flash"]: self.backlight = state self.server.request("screen_set %s backlight %s" % (self.ref, self.backlight))
[ "def", "set_backlight", "(", "self", ",", "state", ")", ":", "if", "state", "in", "[", "\"on\"", ",", "\"off\"", ",", "\"toggle\"", ",", "\"open\"", ",", "\"blink\"", ",", "\"flash\"", "]", ":", "self", ".", "backlight", "=", "state", "self", ".", "ser...
Set Screen Backlight Mode
[ "Set", "Screen", "Backlight", "Mode" ]
train
https://github.com/rbarrois/mpdlcd/blob/85f16c8cc0883f8abb4c2cc7f69729c3e2f857da/mpdlcd/vendor/lcdproc/screen.py#L108-L113
rbarrois/mpdlcd
mpdlcd/vendor/lcdproc/screen.py
Screen.set_heartbeat
def set_heartbeat(self, state): """ Set Screen Heartbeat Display Mode """ if state in ["on", "off", "open"]: self.heartbeat = state self.server.request("screen_set %s heartbeat %s" % (self.ref, self.heartbeat))
python
def set_heartbeat(self, state): """ Set Screen Heartbeat Display Mode """ if state in ["on", "off", "open"]: self.heartbeat = state self.server.request("screen_set %s heartbeat %s" % (self.ref, self.heartbeat))
[ "def", "set_heartbeat", "(", "self", ",", "state", ")", ":", "if", "state", "in", "[", "\"on\"", ",", "\"off\"", ",", "\"open\"", "]", ":", "self", ".", "heartbeat", "=", "state", "self", ".", "server", ".", "request", "(", "\"screen_set %s heartbeat %s\""...
Set Screen Heartbeat Display Mode
[ "Set", "Screen", "Heartbeat", "Display", "Mode" ]
train
https://github.com/rbarrois/mpdlcd/blob/85f16c8cc0883f8abb4c2cc7f69729c3e2f857da/mpdlcd/vendor/lcdproc/screen.py#L115-L120
rbarrois/mpdlcd
mpdlcd/vendor/lcdproc/screen.py
Screen.set_cursor
def set_cursor(self, cursor): """ Set Screen Cursor Mode """ if cursor in ["on", "off", "under", "block"]: self.cursor = cursor self.server.request("screen_set %s cursor %s" % (self.ref, self.cursor))
python
def set_cursor(self, cursor): """ Set Screen Cursor Mode """ if cursor in ["on", "off", "under", "block"]: self.cursor = cursor self.server.request("screen_set %s cursor %s" % (self.ref, self.cursor))
[ "def", "set_cursor", "(", "self", ",", "cursor", ")", ":", "if", "cursor", "in", "[", "\"on\"", ",", "\"off\"", ",", "\"under\"", ",", "\"block\"", "]", ":", "self", ".", "cursor", "=", "cursor", "self", ".", "server", ".", "request", "(", "\"screen_se...
Set Screen Cursor Mode
[ "Set", "Screen", "Cursor", "Mode" ]
train
https://github.com/rbarrois/mpdlcd/blob/85f16c8cc0883f8abb4c2cc7f69729c3e2f857da/mpdlcd/vendor/lcdproc/screen.py#L122-L127
rbarrois/mpdlcd
mpdlcd/vendor/lcdproc/screen.py
Screen.clear
def clear(self): """ Clear Screen """ widgets.StringWidget(self, ref="_w1_", text=" " * 20, x=1, y=1) widgets.StringWidget(self, ref="_w2_", text=" " * 20, x=1, y=2) widgets.StringWidget(self, ref="_w3_", text=" " * 20, x=1, y=3) widgets.StringWidget(self, ref="_w4_", text=" " * ...
python
def clear(self): """ Clear Screen """ widgets.StringWidget(self, ref="_w1_", text=" " * 20, x=1, y=1) widgets.StringWidget(self, ref="_w2_", text=" " * 20, x=1, y=2) widgets.StringWidget(self, ref="_w3_", text=" " * 20, x=1, y=3) widgets.StringWidget(self, ref="_w4_", text=" " * ...
[ "def", "clear", "(", "self", ")", ":", "widgets", ".", "StringWidget", "(", "self", ",", "ref", "=", "\"_w1_\"", ",", "text", "=", "\" \"", "*", "20", ",", "x", "=", "1", ",", "y", "=", "1", ")", "widgets", ".", "StringWidget", "(", "self", ",", ...
Clear Screen
[ "Clear", "Screen" ]
train
https://github.com/rbarrois/mpdlcd/blob/85f16c8cc0883f8abb4c2cc7f69729c3e2f857da/mpdlcd/vendor/lcdproc/screen.py#L129-L134
rbarrois/mpdlcd
mpdlcd/vendor/lcdproc/screen.py
Screen.add_string_widget
def add_string_widget(self, ref, text="Text", x=1, y=1): """ Add String Widget """ if ref not in self.widgets: widget = widgets.StringWidget(screen=self, ref=ref, text=text, x=x, y=y) self.widgets[ref] = widget return self.widgets[ref]
python
def add_string_widget(self, ref, text="Text", x=1, y=1): """ Add String Widget """ if ref not in self.widgets: widget = widgets.StringWidget(screen=self, ref=ref, text=text, x=x, y=y) self.widgets[ref] = widget return self.widgets[ref]
[ "def", "add_string_widget", "(", "self", ",", "ref", ",", "text", "=", "\"Text\"", ",", "x", "=", "1", ",", "y", "=", "1", ")", ":", "if", "ref", "not", "in", "self", ".", "widgets", ":", "widget", "=", "widgets", ".", "StringWidget", "(", "screen"...
Add String Widget
[ "Add", "String", "Widget" ]
train
https://github.com/rbarrois/mpdlcd/blob/85f16c8cc0883f8abb4c2cc7f69729c3e2f857da/mpdlcd/vendor/lcdproc/screen.py#L136-L142
rbarrois/mpdlcd
mpdlcd/vendor/lcdproc/screen.py
Screen.add_title_widget
def add_title_widget(self, ref, text="Title"): """ Add Title Widget """ if ref not in self.widgets: widget = widgets.TitleWidget(screen=self, ref=ref, text=text) self.widgets[ref] = widget return self.widgets[ref]
python
def add_title_widget(self, ref, text="Title"): """ Add Title Widget """ if ref not in self.widgets: widget = widgets.TitleWidget(screen=self, ref=ref, text=text) self.widgets[ref] = widget return self.widgets[ref]
[ "def", "add_title_widget", "(", "self", ",", "ref", ",", "text", "=", "\"Title\"", ")", ":", "if", "ref", "not", "in", "self", ".", "widgets", ":", "widget", "=", "widgets", ".", "TitleWidget", "(", "screen", "=", "self", ",", "ref", "=", "ref", ",",...
Add Title Widget
[ "Add", "Title", "Widget" ]
train
https://github.com/rbarrois/mpdlcd/blob/85f16c8cc0883f8abb4c2cc7f69729c3e2f857da/mpdlcd/vendor/lcdproc/screen.py#L144-L150
rbarrois/mpdlcd
mpdlcd/vendor/lcdproc/screen.py
Screen.add_hbar_widget
def add_hbar_widget(self, ref, x=1, y=1, length=10): """ Add Horizontal Bar Widget """ if ref not in self.widgets: widget = widgets.HBarWidget(screen=self, ref=ref, x=x, y=y, length=length) self.widgets[ref] = widget return self.widgets[ref]
python
def add_hbar_widget(self, ref, x=1, y=1, length=10): """ Add Horizontal Bar Widget """ if ref not in self.widgets: widget = widgets.HBarWidget(screen=self, ref=ref, x=x, y=y, length=length) self.widgets[ref] = widget return self.widgets[ref]
[ "def", "add_hbar_widget", "(", "self", ",", "ref", ",", "x", "=", "1", ",", "y", "=", "1", ",", "length", "=", "10", ")", ":", "if", "ref", "not", "in", "self", ".", "widgets", ":", "widget", "=", "widgets", ".", "HBarWidget", "(", "screen", "=",...
Add Horizontal Bar Widget
[ "Add", "Horizontal", "Bar", "Widget" ]
train
https://github.com/rbarrois/mpdlcd/blob/85f16c8cc0883f8abb4c2cc7f69729c3e2f857da/mpdlcd/vendor/lcdproc/screen.py#L152-L158
rbarrois/mpdlcd
mpdlcd/vendor/lcdproc/screen.py
Screen.add_vbar_widget
def add_vbar_widget(self, ref, x=1, y=1, length=10): """ Add Vertical Bar Widget """ if ref not in self.widgets: widget = widgets.VBarWidget(screen=self, ref=ref, x=x, y=y, length=length) self.widgets[ref] = widget return self.widgets[ref]
python
def add_vbar_widget(self, ref, x=1, y=1, length=10): """ Add Vertical Bar Widget """ if ref not in self.widgets: widget = widgets.VBarWidget(screen=self, ref=ref, x=x, y=y, length=length) self.widgets[ref] = widget return self.widgets[ref]
[ "def", "add_vbar_widget", "(", "self", ",", "ref", ",", "x", "=", "1", ",", "y", "=", "1", ",", "length", "=", "10", ")", ":", "if", "ref", "not", "in", "self", ".", "widgets", ":", "widget", "=", "widgets", ".", "VBarWidget", "(", "screen", "=",...
Add Vertical Bar Widget
[ "Add", "Vertical", "Bar", "Widget" ]
train
https://github.com/rbarrois/mpdlcd/blob/85f16c8cc0883f8abb4c2cc7f69729c3e2f857da/mpdlcd/vendor/lcdproc/screen.py#L160-L166
rbarrois/mpdlcd
mpdlcd/vendor/lcdproc/screen.py
Screen.add_frame_widget
def add_frame_widget(self, ref, left=1, top=1, right=20, bottom=1, width=20, height=4, direction="h", speed=1): """ Add Frame Widget """ if ref not in self.widgets: widget = widgets.FrameWidget( screen=self, ref=ref, left=left, top=top, right=right, bottom=bottom, width=widt...
python
def add_frame_widget(self, ref, left=1, top=1, right=20, bottom=1, width=20, height=4, direction="h", speed=1): """ Add Frame Widget """ if ref not in self.widgets: widget = widgets.FrameWidget( screen=self, ref=ref, left=left, top=top, right=right, bottom=bottom, width=widt...
[ "def", "add_frame_widget", "(", "self", ",", "ref", ",", "left", "=", "1", ",", "top", "=", "1", ",", "right", "=", "20", ",", "bottom", "=", "1", ",", "width", "=", "20", ",", "height", "=", "4", ",", "direction", "=", "\"h\"", ",", "speed", "...
Add Frame Widget
[ "Add", "Frame", "Widget" ]
train
https://github.com/rbarrois/mpdlcd/blob/85f16c8cc0883f8abb4c2cc7f69729c3e2f857da/mpdlcd/vendor/lcdproc/screen.py#L187-L196
rbarrois/mpdlcd
mpdlcd/vendor/lcdproc/screen.py
Screen.add_number_widget
def add_number_widget(self, ref, x=1, value=1): """ Add Number Widget """ if ref not in self.widgets: widget = widgets.NumberWidget(screen=self, ref=ref, x=x, value=value) self.widgets[ref] = widget return self.widgets[ref]
python
def add_number_widget(self, ref, x=1, value=1): """ Add Number Widget """ if ref not in self.widgets: widget = widgets.NumberWidget(screen=self, ref=ref, x=x, value=value) self.widgets[ref] = widget return self.widgets[ref]
[ "def", "add_number_widget", "(", "self", ",", "ref", ",", "x", "=", "1", ",", "value", "=", "1", ")", ":", "if", "ref", "not", "in", "self", ".", "widgets", ":", "widget", "=", "widgets", ".", "NumberWidget", "(", "screen", "=", "self", ",", "ref",...
Add Number Widget
[ "Add", "Number", "Widget" ]
train
https://github.com/rbarrois/mpdlcd/blob/85f16c8cc0883f8abb4c2cc7f69729c3e2f857da/mpdlcd/vendor/lcdproc/screen.py#L198-L204
rbarrois/mpdlcd
mpdlcd/vendor/lcdproc/screen.py
Screen.del_widget
def del_widget(self, ref): """ Delete/Remove A Widget """ self.server.request("widget_del %s %s" % (self.name, ref)) del(self.widgets[ref])
python
def del_widget(self, ref): """ Delete/Remove A Widget """ self.server.request("widget_del %s %s" % (self.name, ref)) del(self.widgets[ref])
[ "def", "del_widget", "(", "self", ",", "ref", ")", ":", "self", ".", "server", ".", "request", "(", "\"widget_del %s %s\"", "%", "(", "self", ".", "name", ",", "ref", ")", ")", "del", "(", "self", ".", "widgets", "[", "ref", "]", ")" ]
Delete/Remove A Widget
[ "Delete", "/", "Remove", "A", "Widget" ]
train
https://github.com/rbarrois/mpdlcd/blob/85f16c8cc0883f8abb4c2cc7f69729c3e2f857da/mpdlcd/vendor/lcdproc/screen.py#L206-L209
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/scene/cameras/turntable.py
TurntableCamera.orbit
def orbit(self, azim, elev): """ Orbits the camera around the center position. Parameters ---------- azim : float Angle in degrees to rotate horizontally around the center point. elev : float Angle in degrees to rotate vertically around the center point. ...
python
def orbit(self, azim, elev): """ Orbits the camera around the center position. Parameters ---------- azim : float Angle in degrees to rotate horizontally around the center point. elev : float Angle in degrees to rotate vertically around the center point. ...
[ "def", "orbit", "(", "self", ",", "azim", ",", "elev", ")", ":", "self", ".", "azimuth", "+=", "azim", "self", ".", "elevation", "=", "np", ".", "clip", "(", "self", ".", "elevation", "+", "elev", ",", "-", "90", ",", "90", ")", "self", ".", "v...
Orbits the camera around the center position. Parameters ---------- azim : float Angle in degrees to rotate horizontally around the center point. elev : float Angle in degrees to rotate vertically around the center point.
[ "Orbits", "the", "camera", "around", "the", "center", "position", "." ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/scene/cameras/turntable.py#L111-L123
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/scene/cameras/turntable.py
TurntableCamera._update_rotation
def _update_rotation(self, event): """Update rotation parmeters based on mouse movement""" p1 = event.mouse_event.press_event.pos p2 = event.mouse_event.pos if self._event_value is None: self._event_value = self.azimuth, self.elevation self.azimuth = self._event_value...
python
def _update_rotation(self, event): """Update rotation parmeters based on mouse movement""" p1 = event.mouse_event.press_event.pos p2 = event.mouse_event.pos if self._event_value is None: self._event_value = self.azimuth, self.elevation self.azimuth = self._event_value...
[ "def", "_update_rotation", "(", "self", ",", "event", ")", ":", "p1", "=", "event", ".", "mouse_event", ".", "press_event", ".", "pos", "p2", "=", "event", ".", "mouse_event", ".", "pos", "if", "self", ".", "_event_value", "is", "None", ":", "self", "....
Update rotation parmeters based on mouse movement
[ "Update", "rotation", "parmeters", "based", "on", "mouse", "movement" ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/scene/cameras/turntable.py#L125-L132
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/scene/cameras/turntable.py
TurntableCamera._rotate_tr
def _rotate_tr(self): """Rotate the transformation matrix based on camera parameters""" up, forward, right = self._get_dim_vectors() self.transform.rotate(self.elevation, -right) self.transform.rotate(self.azimuth, up)
python
def _rotate_tr(self): """Rotate the transformation matrix based on camera parameters""" up, forward, right = self._get_dim_vectors() self.transform.rotate(self.elevation, -right) self.transform.rotate(self.azimuth, up)
[ "def", "_rotate_tr", "(", "self", ")", ":", "up", ",", "forward", ",", "right", "=", "self", ".", "_get_dim_vectors", "(", ")", "self", ".", "transform", ".", "rotate", "(", "self", ".", "elevation", ",", "-", "right", ")", "self", ".", "transform", ...
Rotate the transformation matrix based on camera parameters
[ "Rotate", "the", "transformation", "matrix", "based", "on", "camera", "parameters" ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/scene/cameras/turntable.py#L134-L138
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/scene/cameras/turntable.py
TurntableCamera._dist_to_trans
def _dist_to_trans(self, dist): """Convert mouse x, y movement into x, y, z translations""" rae = np.array([self.roll, self.azimuth, self.elevation]) * np.pi / 180 sro, saz, sel = np.sin(rae) cro, caz, cel = np.cos(rae) dx = (+ dist[0] * (cro * caz + sro * sel * saz) ...
python
def _dist_to_trans(self, dist): """Convert mouse x, y movement into x, y, z translations""" rae = np.array([self.roll, self.azimuth, self.elevation]) * np.pi / 180 sro, saz, sel = np.sin(rae) cro, caz, cel = np.cos(rae) dx = (+ dist[0] * (cro * caz + sro * sel * saz) ...
[ "def", "_dist_to_trans", "(", "self", ",", "dist", ")", ":", "rae", "=", "np", ".", "array", "(", "[", "self", ".", "roll", ",", "self", ".", "azimuth", ",", "self", ".", "elevation", "]", ")", "*", "np", ".", "pi", "/", "180", "sro", ",", "saz...
Convert mouse x, y movement into x, y, z translations
[ "Convert", "mouse", "x", "y", "movement", "into", "x", "y", "z", "translations" ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/scene/cameras/turntable.py#L140-L150
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/app/backends/_glfw.py
_set_config
def _set_config(c): """Set gl configuration for GLFW """ glfw.glfwWindowHint(glfw.GLFW_RED_BITS, c['red_size']) glfw.glfwWindowHint(glfw.GLFW_GREEN_BITS, c['green_size']) glfw.glfwWindowHint(glfw.GLFW_BLUE_BITS, c['blue_size']) glfw.glfwWindowHint(glfw.GLFW_ALPHA_BITS, c['alpha_size']) glfw.glf...
python
def _set_config(c): """Set gl configuration for GLFW """ glfw.glfwWindowHint(glfw.GLFW_RED_BITS, c['red_size']) glfw.glfwWindowHint(glfw.GLFW_GREEN_BITS, c['green_size']) glfw.glfwWindowHint(glfw.GLFW_BLUE_BITS, c['blue_size']) glfw.glfwWindowHint(glfw.GLFW_ALPHA_BITS, c['alpha_size']) glfw.glf...
[ "def", "_set_config", "(", "c", ")", ":", "glfw", ".", "glfwWindowHint", "(", "glfw", ".", "GLFW_RED_BITS", ",", "c", "[", "'red_size'", "]", ")", "glfw", ".", "glfwWindowHint", "(", "glfw", ".", "GLFW_GREEN_BITS", ",", "c", "[", "'green_size'", "]", ")"...
Set gl configuration for GLFW
[ "Set", "gl", "configuration", "for", "GLFW" ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/app/backends/_glfw.py#L133-L154
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/app/backends/_glfw.py
CanvasBackend._process_mod
def _process_mod(self, key, down): """Process (possible) keyboard modifiers GLFW provides "mod" with many callbacks, but not (critically) the scroll callback, so we keep track on our own here. """ if key in MOD_KEYS: if down: if key not in self._mod: ...
python
def _process_mod(self, key, down): """Process (possible) keyboard modifiers GLFW provides "mod" with many callbacks, but not (critically) the scroll callback, so we keep track on our own here. """ if key in MOD_KEYS: if down: if key not in self._mod: ...
[ "def", "_process_mod", "(", "self", ",", "key", ",", "down", ")", ":", "if", "key", "in", "MOD_KEYS", ":", "if", "down", ":", "if", "key", "not", "in", "self", ".", "_mod", ":", "self", ".", "_mod", ".", "append", "(", "key", ")", "elif", "key", ...
Process (possible) keyboard modifiers GLFW provides "mod" with many callbacks, but not (critically) the scroll callback, so we keep track on our own here.
[ "Process", "(", "possible", ")", "keyboard", "modifiers" ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/app/backends/_glfw.py#L483-L495
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/gloo/gl/pyopengl2.py
_patch
def _patch(): """ Monkey-patch pyopengl to fix a bug in glBufferSubData. """ import sys from OpenGL import GL if sys.version_info > (3,): buffersubdatafunc = GL.glBufferSubData if hasattr(buffersubdatafunc, 'wrapperFunction'): buffersubdatafunc = buffersubdatafunc.wrapperFunc...
python
def _patch(): """ Monkey-patch pyopengl to fix a bug in glBufferSubData. """ import sys from OpenGL import GL if sys.version_info > (3,): buffersubdatafunc = GL.glBufferSubData if hasattr(buffersubdatafunc, 'wrapperFunction'): buffersubdatafunc = buffersubdatafunc.wrapperFunc...
[ "def", "_patch", "(", ")", ":", "import", "sys", "from", "OpenGL", "import", "GL", "if", "sys", ".", "version_info", ">", "(", "3", ",", ")", ":", "buffersubdatafunc", "=", "GL", ".", "glBufferSubData", "if", "hasattr", "(", "buffersubdatafunc", ",", "'w...
Monkey-patch pyopengl to fix a bug in glBufferSubData.
[ "Monkey", "-", "patch", "pyopengl", "to", "fix", "a", "bug", "in", "glBufferSubData", "." ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/gl/pyopengl2.py#L18-L34
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/gloo/gl/pyopengl2.py
_get_function_from_pyopengl
def _get_function_from_pyopengl(funcname): """ Try getting the given function from PyOpenGL, return a dummy function (that shows a warning when called) if it could not be found. """ func = None # Get function from GL try: func = getattr(_GL, funcname) except AttributeError: ...
python
def _get_function_from_pyopengl(funcname): """ Try getting the given function from PyOpenGL, return a dummy function (that shows a warning when called) if it could not be found. """ func = None # Get function from GL try: func = getattr(_GL, funcname) except AttributeError: ...
[ "def", "_get_function_from_pyopengl", "(", "funcname", ")", ":", "func", "=", "None", "# Get function from GL", "try", ":", "func", "=", "getattr", "(", "_GL", ",", "funcname", ")", "except", "AttributeError", ":", "# Get function from FBO", "try", ":", "func", ...
Try getting the given function from PyOpenGL, return a dummy function (that shows a warning when called) if it could not be found.
[ "Try", "getting", "the", "given", "function", "from", "PyOpenGL", "return", "a", "dummy", "function", "(", "that", "shows", "a", "warning", "when", "called", ")", "if", "it", "could", "not", "be", "found", "." ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/gl/pyopengl2.py#L48-L79
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/gloo/gl/pyopengl2.py
_inject
def _inject(): """ Copy functions from OpenGL.GL into _pyopengl namespace. """ NS = _pyopengl2.__dict__ for glname, ourname in _pyopengl2._functions_to_import: func = _get_function_from_pyopengl(glname) NS[ourname] = func
python
def _inject(): """ Copy functions from OpenGL.GL into _pyopengl namespace. """ NS = _pyopengl2.__dict__ for glname, ourname in _pyopengl2._functions_to_import: func = _get_function_from_pyopengl(glname) NS[ourname] = func
[ "def", "_inject", "(", ")", ":", "NS", "=", "_pyopengl2", ".", "__dict__", "for", "glname", ",", "ourname", "in", "_pyopengl2", ".", "_functions_to_import", ":", "func", "=", "_get_function_from_pyopengl", "(", "glname", ")", "NS", "[", "ourname", "]", "=", ...
Copy functions from OpenGL.GL into _pyopengl namespace.
[ "Copy", "functions", "from", "OpenGL", ".", "GL", "into", "_pyopengl", "namespace", "." ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/gl/pyopengl2.py#L82-L88
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/util/fonts/_vispy_fonts.py
_get_vispy_font_filename
def _get_vispy_font_filename(face, bold, italic): """Fetch a remote vispy font""" name = face + '-' name += 'Regular' if not bold and not italic else '' name += 'Bold' if bold else '' name += 'Italic' if italic else '' name += '.ttf' return load_data_file('fonts/%s' % name)
python
def _get_vispy_font_filename(face, bold, italic): """Fetch a remote vispy font""" name = face + '-' name += 'Regular' if not bold and not italic else '' name += 'Bold' if bold else '' name += 'Italic' if italic else '' name += '.ttf' return load_data_file('fonts/%s' % name)
[ "def", "_get_vispy_font_filename", "(", "face", ",", "bold", ",", "italic", ")", ":", "name", "=", "face", "+", "'-'", "name", "+=", "'Regular'", "if", "not", "bold", "and", "not", "italic", "else", "''", "name", "+=", "'Bold'", "if", "bold", "else", "...
Fetch a remote vispy font
[ "Fetch", "a", "remote", "vispy", "font" ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/util/fonts/_vispy_fonts.py#L13-L20
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/color/color_space.py
_check_color_dim
def _check_color_dim(val): """Ensure val is Nx(n_col), usually Nx3""" val = np.atleast_2d(val) if val.shape[1] not in (3, 4): raise RuntimeError('Value must have second dimension of size 3 or 4') return val, val.shape[1]
python
def _check_color_dim(val): """Ensure val is Nx(n_col), usually Nx3""" val = np.atleast_2d(val) if val.shape[1] not in (3, 4): raise RuntimeError('Value must have second dimension of size 3 or 4') return val, val.shape[1]
[ "def", "_check_color_dim", "(", "val", ")", ":", "val", "=", "np", ".", "atleast_2d", "(", "val", ")", "if", "val", ".", "shape", "[", "1", "]", "not", "in", "(", "3", ",", "4", ")", ":", "raise", "RuntimeError", "(", "'Value must have second dimension...
Ensure val is Nx(n_col), usually Nx3
[ "Ensure", "val", "is", "Nx", "(", "n_col", ")", "usually", "Nx3" ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/color/color_space.py#L14-L19