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
cds-astro/mocpy
mocpy/interval_set.py
IntervalSet.to_nuniq_interval_set
def to_nuniq_interval_set(cls, nested_is): """ Convert an IntervalSet using the NESTED numbering scheme to an IntervalSet containing UNIQ numbers for HEALPix cells. Parameters ---------- nested_is : `IntervalSet` IntervalSet object storing HEALPix cells as [i...
python
def to_nuniq_interval_set(cls, nested_is): """ Convert an IntervalSet using the NESTED numbering scheme to an IntervalSet containing UNIQ numbers for HEALPix cells. Parameters ---------- nested_is : `IntervalSet` IntervalSet object storing HEALPix cells as [i...
[ "def", "to_nuniq_interval_set", "(", "cls", ",", "nested_is", ")", ":", "r2", "=", "nested_is", ".", "copy", "(", ")", "res", "=", "[", "]", "if", "r2", ".", "empty", "(", ")", ":", "return", "IntervalSet", "(", ")", "order", "=", "0", "while", "no...
Convert an IntervalSet using the NESTED numbering scheme to an IntervalSet containing UNIQ numbers for HEALPix cells. Parameters ---------- nested_is : `IntervalSet` IntervalSet object storing HEALPix cells as [ipix*4^(29-order), (ipix+1)*4^(29-order)[ intervals. Re...
[ "Convert", "an", "IntervalSet", "using", "the", "NESTED", "numbering", "scheme", "to", "an", "IntervalSet", "containing", "UNIQ", "numbers", "for", "HEALPix", "cells", "." ]
train
https://github.com/cds-astro/mocpy/blob/09472cabe537f6bfdb049eeea64d3ea57b391c21/mocpy/interval_set.py#L217-L261
cds-astro/mocpy
mocpy/interval_set.py
IntervalSet.from_nuniq_interval_set
def from_nuniq_interval_set(cls, nuniq_is): """ Convert an IntervalSet containing NUNIQ intervals to an IntervalSet representing HEALPix cells following the NESTED numbering scheme. Parameters ---------- nuniq_is : `IntervalSet` IntervalSet object storing HEA...
python
def from_nuniq_interval_set(cls, nuniq_is): """ Convert an IntervalSet containing NUNIQ intervals to an IntervalSet representing HEALPix cells following the NESTED numbering scheme. Parameters ---------- nuniq_is : `IntervalSet` IntervalSet object storing HEA...
[ "def", "from_nuniq_interval_set", "(", "cls", ",", "nuniq_is", ")", ":", "nested_is", "=", "IntervalSet", "(", ")", "# Appending a list is faster than appending a numpy array", "# For these algorithms we append a list and create the interval set from the finished list", "rtmp", "=", ...
Convert an IntervalSet containing NUNIQ intervals to an IntervalSet representing HEALPix cells following the NESTED numbering scheme. Parameters ---------- nuniq_is : `IntervalSet` IntervalSet object storing HEALPix cells as [ipix + 4*4^(order), ipix+1 + 4*4^(order)[ interva...
[ "Convert", "an", "IntervalSet", "containing", "NUNIQ", "intervals", "to", "an", "IntervalSet", "representing", "HEALPix", "cells", "following", "the", "NESTED", "numbering", "scheme", "." ]
train
https://github.com/cds-astro/mocpy/blob/09472cabe537f6bfdb049eeea64d3ea57b391c21/mocpy/interval_set.py#L264-L301
cds-astro/mocpy
mocpy/interval_set.py
IntervalSet.merge
def merge(a_intervals, b_intervals, op): """ Merge two lists of intervals according to the boolean function op ``a_intervals`` and ``b_intervals`` need to be sorted and consistent (no overlapping intervals). This operation keeps the resulting interval set consistent. Parameters...
python
def merge(a_intervals, b_intervals, op): """ Merge two lists of intervals according to the boolean function op ``a_intervals`` and ``b_intervals`` need to be sorted and consistent (no overlapping intervals). This operation keeps the resulting interval set consistent. Parameters...
[ "def", "merge", "(", "a_intervals", ",", "b_intervals", ",", "op", ")", ":", "a_endpoints", "=", "a_intervals", ".", "flatten", "(", ")", ".", "tolist", "(", ")", "b_endpoints", "=", "b_intervals", ".", "flatten", "(", ")", ".", "tolist", "(", ")", "se...
Merge two lists of intervals according to the boolean function op ``a_intervals`` and ``b_intervals`` need to be sorted and consistent (no overlapping intervals). This operation keeps the resulting interval set consistent. Parameters ---------- a_intervals : `~numpy.ndarray` ...
[ "Merge", "two", "lists", "of", "intervals", "according", "to", "the", "boolean", "function", "op" ]
train
https://github.com/cds-astro/mocpy/blob/09472cabe537f6bfdb049eeea64d3ea57b391c21/mocpy/interval_set.py#L304-L357
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/gloo/globject.py
GLObject.delete
def delete(self): """ Delete the object from GPU memory. Note that the GPU object will also be deleted when this gloo object is about to be deleted. However, sometimes you want to explicitly delete the GPU object explicitly. """ # We only allow the object from being del...
python
def delete(self): """ Delete the object from GPU memory. Note that the GPU object will also be deleted when this gloo object is about to be deleted. However, sometimes you want to explicitly delete the GPU object explicitly. """ # We only allow the object from being del...
[ "def", "delete", "(", "self", ")", ":", "# We only allow the object from being deleted once, otherwise", "# we might be deleting another GPU object that got our gl-id", "# after our GPU object was deleted. Also note that e.g.", "# DataBufferView does not have the _glir attribute.", "if", "hasa...
Delete the object from GPU memory. Note that the GPU object will also be deleted when this gloo object is about to be deleted. However, sometimes you want to explicitly delete the GPU object explicitly.
[ "Delete", "the", "object", "from", "GPU", "memory", "." ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/globject.py#L80-L97
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/visuals/image.py
ImageVisual.set_data
def set_data(self, image): """Set the data Parameters ---------- image : array-like The image data. """ data = np.asarray(image) if self._data is None or self._data.shape != data.shape: self._need_vertex_update = True self._data = ...
python
def set_data(self, image): """Set the data Parameters ---------- image : array-like The image data. """ data = np.asarray(image) if self._data is None or self._data.shape != data.shape: self._need_vertex_update = True self._data = ...
[ "def", "set_data", "(", "self", ",", "image", ")", ":", "data", "=", "np", ".", "asarray", "(", "image", ")", "if", "self", ".", "_data", "is", "None", "or", "self", ".", "_data", ".", "shape", "!=", "data", ".", "shape", ":", "self", ".", "_need...
Set the data Parameters ---------- image : array-like The image data.
[ "Set", "the", "data" ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/image.py#L219-L231
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/visuals/image.py
ImageVisual._build_interpolation
def _build_interpolation(self): """Rebuild the _data_lookup_fn using different interpolations within the shader """ interpolation = self._interpolation self._data_lookup_fn = self._interpolation_fun[interpolation] self.shared_program.frag['get_data'] = self._data_lookup_f...
python
def _build_interpolation(self): """Rebuild the _data_lookup_fn using different interpolations within the shader """ interpolation = self._interpolation self._data_lookup_fn = self._interpolation_fun[interpolation] self.shared_program.frag['get_data'] = self._data_lookup_f...
[ "def", "_build_interpolation", "(", "self", ")", ":", "interpolation", "=", "self", ".", "_interpolation", "self", ".", "_data_lookup_fn", "=", "self", ".", "_interpolation_fun", "[", "interpolation", "]", "self", ".", "shared_program", ".", "frag", "[", "'get_d...
Rebuild the _data_lookup_fn using different interpolations within the shader
[ "Rebuild", "the", "_data_lookup_fn", "using", "different", "interpolations", "within", "the", "shader" ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/image.py#L306-L330
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/visuals/image.py
ImageVisual._build_vertex_data
def _build_vertex_data(self): """Rebuild the vertex buffers used for rendering the image when using the subdivide method. """ grid = self._grid w = 1.0 / grid[1] h = 1.0 / grid[0] quad = np.array([[0, 0, 0], [w, 0, 0], [w, h, 0], [0, 0, 0...
python
def _build_vertex_data(self): """Rebuild the vertex buffers used for rendering the image when using the subdivide method. """ grid = self._grid w = 1.0 / grid[1] h = 1.0 / grid[0] quad = np.array([[0, 0, 0], [w, 0, 0], [w, h, 0], [0, 0, 0...
[ "def", "_build_vertex_data", "(", "self", ")", ":", "grid", "=", "self", ".", "_grid", "w", "=", "1.0", "/", "grid", "[", "1", "]", "h", "=", "1.0", "/", "grid", "[", "0", "]", "quad", "=", "np", ".", "array", "(", "[", "[", "0", ",", "0", ...
Rebuild the vertex buffers used for rendering the image when using the subdivide method.
[ "Rebuild", "the", "vertex", "buffers", "used", "for", "rendering", "the", "image", "when", "using", "the", "subdivide", "method", "." ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/image.py#L332-L357
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/visuals/image.py
ImageVisual._update_method
def _update_method(self, view): """Decide which method to use for *view* and configure it accordingly. """ method = self._method if method == 'auto': if view.transforms.get_transform().Linear: method = 'subdivide' else: method = 'im...
python
def _update_method(self, view): """Decide which method to use for *view* and configure it accordingly. """ method = self._method if method == 'auto': if view.transforms.get_transform().Linear: method = 'subdivide' else: method = 'im...
[ "def", "_update_method", "(", "self", ",", "view", ")", ":", "method", "=", "self", ".", "_method", "if", "method", "==", "'auto'", ":", "if", "view", ".", "transforms", ".", "get_transform", "(", ")", ".", "Linear", ":", "method", "=", "'subdivide'", ...
Decide which method to use for *view* and configure it accordingly.
[ "Decide", "which", "method", "to", "use", "for", "*", "view", "*", "and", "configure", "it", "accordingly", "." ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/image.py#L359-L383
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/visuals/collections/agg_fast_path_collection.py
AggFastPathCollection.append
def append(self, P, closed=False, itemsize=None, **kwargs): """ Append a new set of vertices to the collection. For kwargs argument, n is the number of vertices (local) or the number of item (shared) Parameters ---------- P : np.array Vertices posit...
python
def append(self, P, closed=False, itemsize=None, **kwargs): """ Append a new set of vertices to the collection. For kwargs argument, n is the number of vertices (local) or the number of item (shared) Parameters ---------- P : np.array Vertices posit...
[ "def", "append", "(", "self", ",", "P", ",", "closed", "=", "False", ",", "itemsize", "=", "None", ",", "*", "*", "kwargs", ")", ":", "itemsize", "=", "itemsize", "or", "len", "(", "P", ")", "itemcount", "=", "len", "(", "P", ")", "/", "itemsize"...
Append a new set of vertices to the collection. For kwargs argument, n is the number of vertices (local) or the number of item (shared) Parameters ---------- P : np.array Vertices positions of the path(s) to be added closed: bool Whether path(s...
[ "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/agg_fast_path_collection.py#L93-L177
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/visuals/collections/agg_fast_path_collection.py
AggFastPathCollection.bake
def bake(self, P, key='curr', closed=False, itemsize=None): """ Given a path P, return the baked vertices as they should be copied in the collection if the path has already been appended. Example: -------- paths.append(P) P *= 2 paths['prev'][0] = bake(P...
python
def bake(self, P, key='curr', closed=False, itemsize=None): """ Given a path P, return the baked vertices as they should be copied in the collection if the path has already been appended. Example: -------- paths.append(P) P *= 2 paths['prev'][0] = bake(P...
[ "def", "bake", "(", "self", ",", "P", ",", "key", "=", "'curr'", ",", "closed", "=", "False", ",", "itemsize", "=", "None", ")", ":", "itemsize", "=", "itemsize", "or", "len", "(", "P", ")", "itemcount", "=", "len", "(", "P", ")", "/", "itemsize"...
Given a path P, return the baked vertices as they should be copied in the collection if the path has already been appended. Example: -------- paths.append(P) P *= 2 paths['prev'][0] = bake(P,'prev') paths['curr'][0] = bake(P,'curr') paths['next'][0] = ba...
[ "Given", "a", "path", "P", "return", "the", "baked", "vertices", "as", "they", "should", "be", "copied", "in", "the", "collection", "if", "the", "path", "has", "already", "been", "appended", "." ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/collections/agg_fast_path_collection.py#L179-L219
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/visuals/collections/agg_fast_path_collection.py
AggFastPathCollection.draw
def draw(self, mode="triangle_strip"): """ Draw collection """ gl.glDepthMask(gl.GL_FALSE) Collection.draw(self, mode) gl.glDepthMask(gl.GL_TRUE)
python
def draw(self, mode="triangle_strip"): """ Draw collection """ gl.glDepthMask(gl.GL_FALSE) Collection.draw(self, mode) gl.glDepthMask(gl.GL_TRUE)
[ "def", "draw", "(", "self", ",", "mode", "=", "\"triangle_strip\"", ")", ":", "gl", ".", "glDepthMask", "(", "gl", ".", "GL_FALSE", ")", "Collection", ".", "draw", "(", "self", ",", "mode", ")", "gl", ".", "glDepthMask", "(", "gl", ".", "GL_TRUE", ")...
Draw collection
[ "Draw", "collection" ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/collections/agg_fast_path_collection.py#L221-L226
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/app/backends/ipython/_widget.py
_stop_timers
def _stop_timers(canvas): """Stop all timers in a canvas.""" for attr in dir(canvas): try: attr_obj = getattr(canvas, attr) except NotImplementedError: # This try/except is needed because canvas.position raises # an error (it is not implemented in this backend...
python
def _stop_timers(canvas): """Stop all timers in a canvas.""" for attr in dir(canvas): try: attr_obj = getattr(canvas, attr) except NotImplementedError: # This try/except is needed because canvas.position raises # an error (it is not implemented in this backend...
[ "def", "_stop_timers", "(", "canvas", ")", ":", "for", "attr", "in", "dir", "(", "canvas", ")", ":", "try", ":", "attr_obj", "=", "getattr", "(", "canvas", ",", "attr", ")", "except", "NotImplementedError", ":", "# This try/except is needed because canvas.positi...
Stop all timers in a canvas.
[ "Stop", "all", "timers", "in", "a", "canvas", "." ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/app/backends/ipython/_widget.py#L21-L31
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/gloo/buffer.py
_last_stack_str
def _last_stack_str(): """Print stack trace from call that didn't originate from here""" stack = extract_stack() for s in stack[::-1]: if op.join('vispy', 'gloo', 'buffer.py') not in __file__: break return format_list([s])[0]
python
def _last_stack_str(): """Print stack trace from call that didn't originate from here""" stack = extract_stack() for s in stack[::-1]: if op.join('vispy', 'gloo', 'buffer.py') not in __file__: break return format_list([s])[0]
[ "def", "_last_stack_str", "(", ")", ":", "stack", "=", "extract_stack", "(", ")", "for", "s", "in", "stack", "[", ":", ":", "-", "1", "]", ":", "if", "op", ".", "join", "(", "'vispy'", ",", "'gloo'", ",", "'buffer.py'", ")", "not", "in", "__file__"...
Print stack trace from call that didn't originate from here
[ "Print", "stack", "trace", "from", "call", "that", "didn", "t", "originate", "from", "here" ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/buffer.py#L457-L463
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/gloo/buffer.py
Buffer.set_subdata
def set_subdata(self, data, offset=0, copy=False): """ Set a sub-region of the buffer (deferred operation). Parameters ---------- data : ndarray Data to be uploaded offset: int Offset in buffer where to start copying data (in bytes) copy: bool ...
python
def set_subdata(self, data, offset=0, copy=False): """ Set a sub-region of the buffer (deferred operation). Parameters ---------- data : ndarray Data to be uploaded offset: int Offset in buffer where to start copying data (in bytes) copy: bool ...
[ "def", "set_subdata", "(", "self", ",", "data", ",", "offset", "=", "0", ",", "copy", "=", "False", ")", ":", "data", "=", "np", ".", "array", "(", "data", ",", "copy", "=", "copy", ")", "nbytes", "=", "data", ".", "nbytes", "if", "offset", "<", ...
Set a sub-region of the buffer (deferred operation). Parameters ---------- data : ndarray Data to be uploaded offset: int Offset in buffer where to start copying data (in bytes) copy: bool Since the operation is deferred, data may change befo...
[ "Set", "a", "sub", "-", "region", "of", "the", "buffer", "(", "deferred", "operation", ")", "." ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/buffer.py#L61-L88
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/gloo/buffer.py
Buffer.set_data
def set_data(self, data, copy=False): """ Set data in the buffer (deferred operation). This completely resets the size and contents of the buffer. Parameters ---------- data : ndarray Data to be uploaded copy: bool Since the operation is deferred...
python
def set_data(self, data, copy=False): """ Set data in the buffer (deferred operation). This completely resets the size and contents of the buffer. Parameters ---------- data : ndarray Data to be uploaded copy: bool Since the operation is deferred...
[ "def", "set_data", "(", "self", ",", "data", ",", "copy", "=", "False", ")", ":", "data", "=", "np", ".", "array", "(", "data", ",", "copy", "=", "copy", ")", "nbytes", "=", "data", ".", "nbytes", "if", "nbytes", "!=", "self", ".", "_nbytes", ":"...
Set data in the buffer (deferred operation). This completely resets the size and contents of the buffer. Parameters ---------- data : ndarray Data to be uploaded copy: bool Since the operation is deferred, data may change before data is actua...
[ "Set", "data", "in", "the", "buffer", "(", "deferred", "operation", ")", "." ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/buffer.py#L90-L114
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/gloo/buffer.py
Buffer.resize_bytes
def resize_bytes(self, size): """ Resize this buffer (deferred operation). Parameters ---------- size : int New buffer size in bytes. """ self._nbytes = size self._glir.command('SIZE', self._id, size) # Invalidate any view on this buf...
python
def resize_bytes(self, size): """ Resize this buffer (deferred operation). Parameters ---------- size : int New buffer size in bytes. """ self._nbytes = size self._glir.command('SIZE', self._id, size) # Invalidate any view on this buf...
[ "def", "resize_bytes", "(", "self", ",", "size", ")", ":", "self", ".", "_nbytes", "=", "size", "self", ".", "_glir", ".", "command", "(", "'SIZE'", ",", "self", ".", "_id", ",", "size", ")", "# Invalidate any view on this buffer", "for", "view", "in", "...
Resize this buffer (deferred operation). Parameters ---------- size : int New buffer size in bytes.
[ "Resize", "this", "buffer", "(", "deferred", "operation", ")", ".", "Parameters", "----------", "size", ":", "int", "New", "buffer", "size", "in", "bytes", "." ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/buffer.py#L116-L130
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/gloo/buffer.py
DataBuffer.set_subdata
def set_subdata(self, data, offset=0, copy=False, **kwargs): """ Set a sub-region of the buffer (deferred operation). Parameters ---------- data : ndarray Data to be uploaded offset: int Offset in buffer where to start copying data (in bytes) cop...
python
def set_subdata(self, data, offset=0, copy=False, **kwargs): """ Set a sub-region of the buffer (deferred operation). Parameters ---------- data : ndarray Data to be uploaded offset: int Offset in buffer where to start copying data (in bytes) cop...
[ "def", "set_subdata", "(", "self", ",", "data", ",", "offset", "=", "0", ",", "copy", "=", "False", ",", "*", "*", "kwargs", ")", ":", "data", "=", "self", ".", "_prepare_data", "(", "data", ",", "*", "*", "kwargs", ")", "offset", "=", "offset", ...
Set a sub-region of the buffer (deferred operation). Parameters ---------- data : ndarray Data to be uploaded offset: int Offset in buffer where to start copying data (in bytes) copy: bool Since the operation is deferred, data may change befo...
[ "Set", "a", "sub", "-", "region", "of", "the", "buffer", "(", "deferred", "operation", ")", "." ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/buffer.py#L157-L176
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/gloo/buffer.py
DataBuffer.set_data
def set_data(self, data, copy=False, **kwargs): """ Set data (deferred operation) Parameters ---------- data : ndarray Data to be uploaded copy: bool Since the operation is deferred, data may change before data is actually uploaded to GPU memo...
python
def set_data(self, data, copy=False, **kwargs): """ Set data (deferred operation) Parameters ---------- data : ndarray Data to be uploaded copy: bool Since the operation is deferred, data may change before data is actually uploaded to GPU memo...
[ "def", "set_data", "(", "self", ",", "data", ",", "copy", "=", "False", ",", "*", "*", "kwargs", ")", ":", "data", "=", "self", ".", "_prepare_data", "(", "data", ",", "*", "*", "kwargs", ")", "self", ".", "_dtype", "=", "data", ".", "dtype", "se...
Set data (deferred operation) Parameters ---------- data : ndarray Data to be uploaded copy: bool Since the operation is deferred, data may change before data is actually uploaded to GPU memory. Asking explicitly for a copy will prevent th...
[ "Set", "data", "(", "deferred", "operation", ")" ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/buffer.py#L178-L196
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/gloo/buffer.py
DataBuffer.glsl_type
def glsl_type(self): """ GLSL declaration strings required for a variable to hold this data. """ if self.dtype is None: return None dtshape = self.dtype[0].shape n = dtshape[0] if dtshape else 1 if n > 1: dtype = 'vec%d' % n else: ...
python
def glsl_type(self): """ GLSL declaration strings required for a variable to hold this data. """ if self.dtype is None: return None dtshape = self.dtype[0].shape n = dtshape[0] if dtshape else 1 if n > 1: dtype = 'vec%d' % n else: ...
[ "def", "glsl_type", "(", "self", ")", ":", "if", "self", ".", "dtype", "is", "None", ":", "return", "None", "dtshape", "=", "self", ".", "dtype", "[", "0", "]", ".", "shape", "n", "=", "dtshape", "[", "0", "]", "if", "dtshape", "else", "1", "if",...
GLSL declaration strings required for a variable to hold this data.
[ "GLSL", "declaration", "strings", "required", "for", "a", "variable", "to", "hold", "this", "data", "." ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/buffer.py#L228-L239
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/gloo/buffer.py
DataBuffer.resize_bytes
def resize_bytes(self, size): """ Resize the buffer (in-place, deferred operation) Parameters ---------- size : integer New buffer size in bytes Notes ----- This clears any pending operations. """ Buffer.resize_bytes(self, size) ...
python
def resize_bytes(self, size): """ Resize the buffer (in-place, deferred operation) Parameters ---------- size : integer New buffer size in bytes Notes ----- This clears any pending operations. """ Buffer.resize_bytes(self, size) ...
[ "def", "resize_bytes", "(", "self", ",", "size", ")", ":", "Buffer", ".", "resize_bytes", "(", "self", ",", "size", ")", "self", ".", "_size", "=", "size", "//", "self", ".", "itemsize" ]
Resize the buffer (in-place, deferred operation) Parameters ---------- size : integer New buffer size in bytes Notes ----- This clears any pending operations.
[ "Resize", "the", "buffer", "(", "in", "-", "place", "deferred", "operation", ")" ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/buffer.py#L241-L254
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/visuals/shaders/compiler.py
Compiler.compile
def compile(self, pretty=True): """ Compile all code and return a dict {name: code} where the keys are determined by the keyword arguments passed to __init__(). Parameters ---------- pretty : bool If True, use a slower method to mangle object names. This produces ...
python
def compile(self, pretty=True): """ Compile all code and return a dict {name: code} where the keys are determined by the keyword arguments passed to __init__(). Parameters ---------- pretty : bool If True, use a slower method to mangle object names. This produces ...
[ "def", "compile", "(", "self", ",", "pretty", "=", "True", ")", ":", "# Authoritative mapping of {obj: name}", "self", ".", "_object_names", "=", "{", "}", "#", "# 1. collect list of dependencies for each shader", "#", "# maps {shader_name: [deps]}", "self", ".", "_shad...
Compile all code and return a dict {name: code} where the keys are determined by the keyword arguments passed to __init__(). Parameters ---------- pretty : bool If True, use a slower method to mangle object names. This produces GLSL that is more readable. ...
[ "Compile", "all", "code", "and", "return", "a", "dict", "{", "name", ":", "code", "}", "where", "the", "keys", "are", "determined", "by", "the", "keyword", "arguments", "passed", "to", "__init__", "()", "." ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/shaders/compiler.py#L49-L118
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/visuals/shaders/compiler.py
Compiler._rename_objects_fast
def _rename_objects_fast(self): """ Rename all objects quickly to guaranteed-unique names using the id() of each object. This produces mostly unreadable GLSL, but is about 10x faster to compile. """ for shader_name, deps in self._shader_deps.items(): for dep ...
python
def _rename_objects_fast(self): """ Rename all objects quickly to guaranteed-unique names using the id() of each object. This produces mostly unreadable GLSL, but is about 10x faster to compile. """ for shader_name, deps in self._shader_deps.items(): for dep ...
[ "def", "_rename_objects_fast", "(", "self", ")", ":", "for", "shader_name", ",", "deps", "in", "self", ".", "_shader_deps", ".", "items", "(", ")", ":", "for", "dep", "in", "deps", ":", "name", "=", "dep", ".", "name", "if", "name", "!=", "'main'", "...
Rename all objects quickly to guaranteed-unique names using the id() of each object. This produces mostly unreadable GLSL, but is about 10x faster to compile.
[ "Rename", "all", "objects", "quickly", "to", "guaranteed", "-", "unique", "names", "using", "the", "id", "()", "of", "each", "object", "." ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/shaders/compiler.py#L120-L133
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/visuals/shaders/compiler.py
Compiler._rename_objects_pretty
def _rename_objects_pretty(self): """ Rename all objects like "name_1" to avoid conflicts. Objects are only renamed if necessary. This method produces more readable GLSL, but is rather slow. """ # # 1. For each object, add its static names to the global namespace ...
python
def _rename_objects_pretty(self): """ Rename all objects like "name_1" to avoid conflicts. Objects are only renamed if necessary. This method produces more readable GLSL, but is rather slow. """ # # 1. For each object, add its static names to the global namespace ...
[ "def", "_rename_objects_pretty", "(", "self", ")", ":", "#", "# 1. For each object, add its static names to the global namespace", "# and make a list of the shaders used by the object.", "#", "# {name: obj} mapping for finding unique names", "# initialize with reserved keywords.", "self",...
Rename all objects like "name_1" to avoid conflicts. Objects are only renamed if necessary. This method produces more readable GLSL, but is rather slow.
[ "Rename", "all", "objects", "like", "name_1", "to", "avoid", "conflicts", ".", "Objects", "are", "only", "renamed", "if", "necessary", "." ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/shaders/compiler.py#L135-L181
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/visuals/shaders/compiler.py
Compiler._name_available
def _name_available(self, obj, name, shaders): """ Return True if *name* is available for *obj* in *shaders*. """ if name in self._global_ns: return False shaders = self.shaders if self._is_global(obj) else shaders for shader in shaders: if name in self._s...
python
def _name_available(self, obj, name, shaders): """ Return True if *name* is available for *obj* in *shaders*. """ if name in self._global_ns: return False shaders = self.shaders if self._is_global(obj) else shaders for shader in shaders: if name in self._s...
[ "def", "_name_available", "(", "self", ",", "obj", ",", "name", ",", "shaders", ")", ":", "if", "name", "in", "self", ".", "_global_ns", ":", "return", "False", "shaders", "=", "self", ".", "shaders", "if", "self", ".", "_is_global", "(", "obj", ")", ...
Return True if *name* is available for *obj* in *shaders*.
[ "Return", "True", "if", "*", "name", "*", "is", "available", "for", "*", "obj", "*", "in", "*", "shaders", "*", "." ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/shaders/compiler.py#L196-L205
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/visuals/shaders/compiler.py
Compiler._assign_name
def _assign_name(self, obj, name, shaders): """ Assign *name* to *obj* in *shaders*. """ if self._is_global(obj): assert name not in self._global_ns self._global_ns[name] = obj else: for shader in shaders: ns = self._shader_ns[shader] ...
python
def _assign_name(self, obj, name, shaders): """ Assign *name* to *obj* in *shaders*. """ if self._is_global(obj): assert name not in self._global_ns self._global_ns[name] = obj else: for shader in shaders: ns = self._shader_ns[shader] ...
[ "def", "_assign_name", "(", "self", ",", "obj", ",", "name", ",", "shaders", ")", ":", "if", "self", ".", "_is_global", "(", "obj", ")", ":", "assert", "name", "not", "in", "self", ".", "_global_ns", "self", ".", "_global_ns", "[", "name", "]", "=", ...
Assign *name* to *obj* in *shaders*.
[ "Assign", "*", "name", "*", "to", "*", "obj", "*", "in", "*", "shaders", "*", "." ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/shaders/compiler.py#L207-L218
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/visuals/colorbar.py
_CoreColorBarVisual._update
def _update(self): """Rebuilds the shaders, and repositions the objects that are used internally by the ColorBarVisual """ x, y = self._pos halfw, halfh = self._halfdim # test that width and height are non-zero if halfw <= 0: raise ValueError("hal...
python
def _update(self): """Rebuilds the shaders, and repositions the objects that are used internally by the ColorBarVisual """ x, y = self._pos halfw, halfh = self._halfdim # test that width and height are non-zero if halfw <= 0: raise ValueError("hal...
[ "def", "_update", "(", "self", ")", ":", "x", ",", "y", "=", "self", ".", "_pos", "halfw", ",", "halfh", "=", "self", ".", "_halfdim", "# test that width and height are non-zero", "if", "halfw", "<=", "0", ":", "raise", "ValueError", "(", "\"half-width must ...
Rebuilds the shaders, and repositions the objects that are used internally by the ColorBarVisual
[ "Rebuilds", "the", "shaders", "and", "repositions", "the", "objects", "that", "are", "used", "internally", "by", "the", "ColorBarVisual" ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/colorbar.py#L117-L158
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/visuals/colorbar.py
ColorBarVisual._update
def _update(self): """Rebuilds the shaders, and repositions the objects that are used internally by the ColorBarVisual """ self._colorbar.halfdim = self._halfdim self._border.halfdim = self._halfdim self._label.text = self._label_str self._ticks[0].text = str(...
python
def _update(self): """Rebuilds the shaders, and repositions the objects that are used internally by the ColorBarVisual """ self._colorbar.halfdim = self._halfdim self._border.halfdim = self._halfdim self._label.text = self._label_str self._ticks[0].text = str(...
[ "def", "_update", "(", "self", ")", ":", "self", ".", "_colorbar", ".", "halfdim", "=", "self", ".", "_halfdim", "self", ".", "_border", ".", "halfdim", "=", "self", ".", "_halfdim", "self", ".", "_label", ".", "text", "=", "self", ".", "_label_str", ...
Rebuilds the shaders, and repositions the objects that are used internally by the ColorBarVisual
[ "Rebuilds", "the", "shaders", "and", "repositions", "the", "objects", "that", "are", "used", "internally", "by", "the", "ColorBarVisual" ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/colorbar.py#L319-L333
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/visuals/colorbar.py
ColorBarVisual._update_positions
def _update_positions(self): """ updates the positions of the colorbars and labels """ self._colorbar.pos = self._pos self._border.pos = self._pos if self._orientation == "right" or self._orientation == "left": self._label.rotation = -90 x, y = self...
python
def _update_positions(self): """ updates the positions of the colorbars and labels """ self._colorbar.pos = self._pos self._border.pos = self._pos if self._orientation == "right" or self._orientation == "left": self._label.rotation = -90 x, y = self...
[ "def", "_update_positions", "(", "self", ")", ":", "self", ".", "_colorbar", ".", "pos", "=", "self", ".", "_pos", "self", ".", "_border", ".", "pos", "=", "self", ".", "_pos", "if", "self", ".", "_orientation", "==", "\"right\"", "or", "self", ".", ...
updates the positions of the colorbars and labels
[ "updates", "the", "positions", "of", "the", "colorbars", "and", "labels" ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/colorbar.py#L335-L374
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/visuals/colorbar.py
ColorBarVisual._calc_positions
def _calc_positions(center, halfdim, border_width, orientation, transforms): """ Calculate the text centeritions given the ColorBar parameters. Note ---- This is static because in principle, this function does not need access to the state ...
python
def _calc_positions(center, halfdim, border_width, orientation, transforms): """ Calculate the text centeritions given the ColorBar parameters. Note ---- This is static because in principle, this function does not need access to the state ...
[ "def", "_calc_positions", "(", "center", ",", "halfdim", ",", "border_width", ",", "orientation", ",", "transforms", ")", ":", "(", "x", ",", "y", ")", "=", "center", "(", "halfw", ",", "halfh", ")", "=", "halfdim", "visual_to_doc", "=", "transforms", "....
Calculate the text centeritions given the ColorBar parameters. Note ---- This is static because in principle, this function does not need access to the state of the ColorBar at all. It's a computation function that computes coordinate transforms Paramete...
[ "Calculate", "the", "text", "centeritions", "given", "the", "ColorBar", "parameters", "." ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/colorbar.py#L471-L551
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/visuals/colorbar.py
ColorBarVisual.size
def size(self): """ The size of the ColorBar Returns ------- size: (major_axis_length, minor_axis_length) major and minor axis are defined by the orientation of the ColorBar """ (halfw, halfh) = self._halfdim if self.orientation in ["top",...
python
def size(self): """ The size of the ColorBar Returns ------- size: (major_axis_length, minor_axis_length) major and minor axis are defined by the orientation of the ColorBar """ (halfw, halfh) = self._halfdim if self.orientation in ["top",...
[ "def", "size", "(", "self", ")", ":", "(", "halfw", ",", "halfh", ")", "=", "self", ".", "_halfdim", "if", "self", ".", "orientation", "in", "[", "\"top\"", ",", "\"bottom\"", "]", ":", "return", "(", "halfw", "*", "2.", ",", "halfh", "*", "2.", ...
The size of the ColorBar Returns ------- size: (major_axis_length, minor_axis_length) major and minor axis are defined by the orientation of the ColorBar
[ "The", "size", "of", "the", "ColorBar" ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/colorbar.py#L645-L658
rbarrois/mpdlcd
mpdlcd/lcdrunner.py
MpdRunner.add_pseudo_fields
def add_pseudo_fields(self): """Add 'pseudo' fields (e.g non-displayed fields) to the display.""" fields = [] if self.backlight_on != enums.BACKLIGHT_ON_NEVER: fields.append( display_fields.BacklightPseudoField(ref='0', backlight_rule=self.backlight_on) ) ...
python
def add_pseudo_fields(self): """Add 'pseudo' fields (e.g non-displayed fields) to the display.""" fields = [] if self.backlight_on != enums.BACKLIGHT_ON_NEVER: fields.append( display_fields.BacklightPseudoField(ref='0', backlight_rule=self.backlight_on) ) ...
[ "def", "add_pseudo_fields", "(", "self", ")", ":", "fields", "=", "[", "]", "if", "self", ".", "backlight_on", "!=", "enums", ".", "BACKLIGHT_ON_NEVER", ":", "fields", ".", "append", "(", "display_fields", ".", "BacklightPseudoField", "(", "ref", "=", "'0'",...
Add 'pseudo' fields (e.g non-displayed fields) to the display.
[ "Add", "pseudo", "fields", "(", "e", ".", "g", "non", "-", "displayed", "fields", ")", "to", "the", "display", "." ]
train
https://github.com/rbarrois/mpdlcd/blob/85f16c8cc0883f8abb4c2cc7f69729c3e2f857da/mpdlcd/lcdrunner.py#L63-L79
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/geometry/rect.py
Rect.padded
def padded(self, padding): """Return a new Rect padded (smaller) by padding on all sides Parameters ---------- padding : float The padding. Returns ------- rect : instance of Rect The padded rectangle. """ return Rect(pos=...
python
def padded(self, padding): """Return a new Rect padded (smaller) by padding on all sides Parameters ---------- padding : float The padding. Returns ------- rect : instance of Rect The padded rectangle. """ return Rect(pos=...
[ "def", "padded", "(", "self", ",", "padding", ")", ":", "return", "Rect", "(", "pos", "=", "(", "self", ".", "pos", "[", "0", "]", "+", "padding", ",", "self", ".", "pos", "[", "1", "]", "+", "padding", ")", ",", "size", "=", "(", "self", "."...
Return a new Rect padded (smaller) by padding on all sides Parameters ---------- padding : float The padding. Returns ------- rect : instance of Rect The padded rectangle.
[ "Return", "a", "new", "Rect", "padded", "(", "smaller", ")", "by", "padding", "on", "all", "sides" ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/geometry/rect.py#L115-L129
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/geometry/rect.py
Rect.normalized
def normalized(self): """Return a Rect covering the same area, but with height and width guaranteed to be positive.""" return Rect(pos=(min(self.left, self.right), min(self.top, self.bottom)), size=(abs(self.width), abs(self.height)))
python
def normalized(self): """Return a Rect covering the same area, but with height and width guaranteed to be positive.""" return Rect(pos=(min(self.left, self.right), min(self.top, self.bottom)), size=(abs(self.width), abs(self.height)))
[ "def", "normalized", "(", "self", ")", ":", "return", "Rect", "(", "pos", "=", "(", "min", "(", "self", ".", "left", ",", "self", ".", "right", ")", ",", "min", "(", "self", ".", "top", ",", "self", ".", "bottom", ")", ")", ",", "size", "=", ...
Return a Rect covering the same area, but with height and width guaranteed to be positive.
[ "Return", "a", "Rect", "covering", "the", "same", "area", "but", "with", "height", "and", "width", "guaranteed", "to", "be", "positive", "." ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/geometry/rect.py#L131-L136
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/geometry/rect.py
Rect.flipped
def flipped(self, x=False, y=True): """Return a Rect with the same bounds but with axes inverted Parameters ---------- x : bool Flip the X axis. y : bool Flip the Y axis. Returns ------- rect : instance of Rect The fli...
python
def flipped(self, x=False, y=True): """Return a Rect with the same bounds but with axes inverted Parameters ---------- x : bool Flip the X axis. y : bool Flip the Y axis. Returns ------- rect : instance of Rect The fli...
[ "def", "flipped", "(", "self", ",", "x", "=", "False", ",", "y", "=", "True", ")", ":", "pos", "=", "list", "(", "self", ".", "pos", ")", "size", "=", "list", "(", "self", ".", "size", ")", "for", "i", ",", "flip", "in", "enumerate", "(", "("...
Return a Rect with the same bounds but with axes inverted Parameters ---------- x : bool Flip the X axis. y : bool Flip the Y axis. Returns ------- rect : instance of Rect The flipped rectangle.
[ "Return", "a", "Rect", "with", "the", "same", "bounds", "but", "with", "axes", "inverted" ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/geometry/rect.py#L138-L159
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/geometry/rect.py
Rect._transform_in
def _transform_in(self): """Return array of coordinates that can be mapped by Transform classes.""" return np.array([ [self.left, self.bottom, 0, 1], [self.right, self.top, 0, 1]])
python
def _transform_in(self): """Return array of coordinates that can be mapped by Transform classes.""" return np.array([ [self.left, self.bottom, 0, 1], [self.right, self.top, 0, 1]])
[ "def", "_transform_in", "(", "self", ")", ":", "return", "np", ".", "array", "(", "[", "[", "self", ".", "left", ",", "self", ".", "bottom", ",", "0", ",", "1", "]", ",", "[", "self", ".", "right", ",", "self", ".", "top", ",", "0", ",", "1",...
Return array of coordinates that can be mapped by Transform classes.
[ "Return", "array", "of", "coordinates", "that", "can", "be", "mapped", "by", "Transform", "classes", "." ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/geometry/rect.py#L193-L198
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/visuals/transforms/transform_system.py
TransformSystem.configure
def configure(self, viewport=None, fbo_size=None, fbo_rect=None, canvas=None): """Automatically configure the TransformSystem: * canvas_transform maps from the Canvas logical pixel coordinate system to the framebuffer coordinate system, taking into account the log...
python
def configure(self, viewport=None, fbo_size=None, fbo_rect=None, canvas=None): """Automatically configure the TransformSystem: * canvas_transform maps from the Canvas logical pixel coordinate system to the framebuffer coordinate system, taking into account the log...
[ "def", "configure", "(", "self", ",", "viewport", "=", "None", ",", "fbo_size", "=", "None", ",", "fbo_rect", "=", "None", ",", "canvas", "=", "None", ")", ":", "# TODO: check that d2f and f2r transforms still contain a single", "# STTransform (if the user has modified ...
Automatically configure the TransformSystem: * canvas_transform maps from the Canvas logical pixel coordinate system to the framebuffer coordinate system, taking into account the logical/physical pixel scale factor, current FBO position, and y-axis inversion. * framebuff...
[ "Automatically", "configure", "the", "TransformSystem", ":" ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/transforms/transform_system.py#L164-L228
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/visuals/transforms/transform_system.py
TransformSystem.dpi
def dpi(self): """ Physical resolution of the document coordinate system (dots per inch). """ if self._dpi is None: if self._canvas is None: return None else: return self.canvas.dpi else: return self._dpi
python
def dpi(self): """ Physical resolution of the document coordinate system (dots per inch). """ if self._dpi is None: if self._canvas is None: return None else: return self.canvas.dpi else: return self._dpi
[ "def", "dpi", "(", "self", ")", ":", "if", "self", ".", "_dpi", "is", "None", ":", "if", "self", ".", "_canvas", "is", "None", ":", "return", "None", "else", ":", "return", "self", ".", "canvas", ".", "dpi", "else", ":", "return", "self", ".", "_...
Physical resolution of the document coordinate system (dots per inch).
[ "Physical", "resolution", "of", "the", "document", "coordinate", "system", "(", "dots", "per", "inch", ")", "." ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/transforms/transform_system.py#L241-L251
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/visuals/transforms/transform_system.py
TransformSystem.get_transform
def get_transform(self, map_from='visual', map_to='render'): """Return a transform mapping between any two coordinate systems. Parameters ---------- map_from : str The starting coordinate system to map from. Must be one of: visual, scene, document, canvas...
python
def get_transform(self, map_from='visual', map_to='render'): """Return a transform mapping between any two coordinate systems. Parameters ---------- map_from : str The starting coordinate system to map from. Must be one of: visual, scene, document, canvas...
[ "def", "get_transform", "(", "self", ",", "map_from", "=", "'visual'", ",", "map_to", "=", "'render'", ")", ":", "tr", "=", "[", "'visual'", ",", "'scene'", ",", "'document'", ",", "'canvas'", ",", "'framebuffer'", ",", "'render'", "]", "ifrom", "=", "tr...
Return a transform mapping between any two coordinate systems. Parameters ---------- map_from : str The starting coordinate system to map from. Must be one of: visual, scene, document, canvas, framebuffer, or render. map_to : str The ending co...
[ "Return", "a", "transform", "mapping", "between", "any", "two", "coordinate", "systems", ".", "Parameters", "----------", "map_from", ":", "str", "The", "starting", "coordinate", "system", "to", "map", "from", ".", "Must", "be", "one", "of", ":", "visual", "...
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/transforms/transform_system.py#L313-L335
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/visuals/graphs/layouts/force_directed.py
_calculate_delta_pos
def _calculate_delta_pos(adjacency_arr, pos, t, optimal): """Helper to calculate the delta position""" # XXX eventually this should be refactored for the sparse case to only # do the necessary pairwise distances delta = pos[:, np.newaxis, :] - pos # Distance between points distance2 = (delta*de...
python
def _calculate_delta_pos(adjacency_arr, pos, t, optimal): """Helper to calculate the delta position""" # XXX eventually this should be refactored for the sparse case to only # do the necessary pairwise distances delta = pos[:, np.newaxis, :] - pos # Distance between points distance2 = (delta*de...
[ "def", "_calculate_delta_pos", "(", "adjacency_arr", ",", "pos", ",", "t", ",", "optimal", ")", ":", "# XXX eventually this should be refactored for the sparse case to only", "# do the necessary pairwise distances", "delta", "=", "pos", "[", ":", ",", "np", ".", "newaxis"...
Helper to calculate the delta position
[ "Helper", "to", "calculate", "the", "delta", "position" ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/graphs/layouts/force_directed.py#L190-L212
anjishnu/ask-alexa-pykit
lambda_function.py
get_recipe_intent_handler
def get_recipe_intent_handler(request): """ You can insert arbitrary business logic code here """ # Get variables like userId, slots, intent name etc from the 'Request' object ingredient = request.slots["Ingredient"] # Gets an Ingredient Slot from the Request object. if ingredient == ...
python
def get_recipe_intent_handler(request): """ You can insert arbitrary business logic code here """ # Get variables like userId, slots, intent name etc from the 'Request' object ingredient = request.slots["Ingredient"] # Gets an Ingredient Slot from the Request object. if ingredient == ...
[ "def", "get_recipe_intent_handler", "(", "request", ")", ":", "# Get variables like userId, slots, intent name etc from the 'Request' object", "ingredient", "=", "request", ".", "slots", "[", "\"Ingredient\"", "]", "# Gets an Ingredient Slot from the Request object.", "if", "ingred...
You can insert arbitrary business logic code here
[ "You", "can", "insert", "arbitrary", "business", "logic", "code", "here" ]
train
https://github.com/anjishnu/ask-alexa-pykit/blob/a47c278ca7a60532bbe1a9b789f6c37e609fea8b/lambda_function.py#L47-L71
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/util/wrappers.py
use
def use(app=None, gl=None): """ Set the usage options for vispy Specify what app backend and GL backend to use. Parameters ---------- app : str The app backend to use (case insensitive). Standard backends: * 'PyQt4': use Qt widget toolkit via PyQt4. * 'PyQt5': use Q...
python
def use(app=None, gl=None): """ Set the usage options for vispy Specify what app backend and GL backend to use. Parameters ---------- app : str The app backend to use (case insensitive). Standard backends: * 'PyQt4': use Qt widget toolkit via PyQt4. * 'PyQt5': use Q...
[ "def", "use", "(", "app", "=", "None", ",", "gl", "=", "None", ")", ":", "if", "app", "is", "None", "and", "gl", "is", "None", ":", "raise", "TypeError", "(", "'Must specify at least one of \"app\" or \"gl\".'", ")", "# Example for future. This wont work (yet).", ...
Set the usage options for vispy Specify what app backend and GL backend to use. Parameters ---------- app : str The app backend to use (case insensitive). Standard backends: * 'PyQt4': use Qt widget toolkit via PyQt4. * 'PyQt5': use Qt widget toolkit via PyQt5. ...
[ "Set", "the", "usage", "options", "for", "vispy" ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/util/wrappers.py#L23-L94
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/util/wrappers.py
run_subprocess
def run_subprocess(command, return_code=False, **kwargs): """Run command using subprocess.Popen Run command and wait for command to complete. If the return code was zero then return, otherwise raise CalledProcessError. By default, this will also add stdout= and stderr=subproces.PIPE to the call to ...
python
def run_subprocess(command, return_code=False, **kwargs): """Run command using subprocess.Popen Run command and wait for command to complete. If the return code was zero then return, otherwise raise CalledProcessError. By default, this will also add stdout= and stderr=subproces.PIPE to the call to ...
[ "def", "run_subprocess", "(", "command", ",", "return_code", "=", "False", ",", "*", "*", "kwargs", ")", ":", "# code adapted with permission from mne-python", "use_kwargs", "=", "dict", "(", "stderr", "=", "subprocess", ".", "PIPE", ",", "stdout", "=", "subproc...
Run command using subprocess.Popen Run command and wait for command to complete. If the return code was zero then return, otherwise raise CalledProcessError. By default, this will also add stdout= and stderr=subproces.PIPE to the call to Popen to suppress printing to the terminal. Parameters -...
[ "Run", "command", "using", "subprocess", ".", "Popen" ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/util/wrappers.py#L97-L148
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/app/timer.py
Timer.start
def start(self, interval=None, iterations=None): """Start the timer. A timeout event will be generated every *interval* seconds. If *interval* is None, then self.interval will be used. If *iterations* is specified, the timer will stop after emitting that number of events. If un...
python
def start(self, interval=None, iterations=None): """Start the timer. A timeout event will be generated every *interval* seconds. If *interval* is None, then self.interval will be used. If *iterations* is specified, the timer will stop after emitting that number of events. If un...
[ "def", "start", "(", "self", ",", "interval", "=", "None", ",", "iterations", "=", "None", ")", ":", "if", "self", ".", "running", ":", "return", "# don't do anything if already running", "self", ".", "iter_count", "=", "0", "if", "interval", "is", "not", ...
Start the timer. A timeout event will be generated every *interval* seconds. If *interval* is None, then self.interval will be used. If *iterations* is specified, the timer will stop after emitting that number of events. If unspecified, then the previous value of self.iteration...
[ "Start", "the", "timer", "." ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/app/timer.py#L97-L124
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/app/timer.py
Timer.stop
def stop(self): """Stop the timer.""" self._backend._vispy_stop() self._running = False self.events.stop(type='timer_stop')
python
def stop(self): """Stop the timer.""" self._backend._vispy_stop() self._running = False self.events.stop(type='timer_stop')
[ "def", "stop", "(", "self", ")", ":", "self", ".", "_backend", ".", "_vispy_stop", "(", ")", "self", ".", "_running", "=", "False", "self", ".", "events", ".", "stop", "(", "type", "=", "'timer_stop'", ")" ]
Stop the timer.
[ "Stop", "the", "timer", "." ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/app/timer.py#L126-L130
cds-astro/mocpy
mocpy/moc/moc.py
MOC._best_res_pixels
def _best_res_pixels(self): """ Returns a numpy array of all the HEALPix indexes contained in the MOC at its max order. Returns ------- result : `~numpy.ndarray` The array of HEALPix at ``max_order`` """ factor = 2 * (AbstractMOC.HPY_MAX_NORDER - self...
python
def _best_res_pixels(self): """ Returns a numpy array of all the HEALPix indexes contained in the MOC at its max order. Returns ------- result : `~numpy.ndarray` The array of HEALPix at ``max_order`` """ factor = 2 * (AbstractMOC.HPY_MAX_NORDER - self...
[ "def", "_best_res_pixels", "(", "self", ")", ":", "factor", "=", "2", "*", "(", "AbstractMOC", ".", "HPY_MAX_NORDER", "-", "self", ".", "max_order", ")", "pix_l", "=", "[", "]", "for", "iv", "in", "self", ".", "_interval_set", ".", "_intervals", ":", "...
Returns a numpy array of all the HEALPix indexes contained in the MOC at its max order. Returns ------- result : `~numpy.ndarray` The array of HEALPix at ``max_order``
[ "Returns", "a", "numpy", "array", "of", "all", "the", "HEALPix", "indexes", "contained", "in", "the", "MOC", "at", "its", "max", "order", "." ]
train
https://github.com/cds-astro/mocpy/blob/09472cabe537f6bfdb049eeea64d3ea57b391c21/mocpy/moc/moc.py#L71-L86
cds-astro/mocpy
mocpy/moc/moc.py
MOC.contains
def contains(self, ra, dec, keep_inside=True): """ Returns a boolean mask array of the positions lying inside (or outside) the MOC instance. Parameters ---------- ra : `astropy.units.Quantity` Right ascension array dec : `astropy.units.Quantity` D...
python
def contains(self, ra, dec, keep_inside=True): """ Returns a boolean mask array of the positions lying inside (or outside) the MOC instance. Parameters ---------- ra : `astropy.units.Quantity` Right ascension array dec : `astropy.units.Quantity` D...
[ "def", "contains", "(", "self", ",", "ra", ",", "dec", ",", "keep_inside", "=", "True", ")", ":", "depth", "=", "self", ".", "max_order", "m", "=", "np", ".", "zeros", "(", "nside2npix", "(", "1", "<<", "depth", ")", ",", "dtype", "=", "bool", ")...
Returns a boolean mask array of the positions lying inside (or outside) the MOC instance. Parameters ---------- ra : `astropy.units.Quantity` Right ascension array dec : `astropy.units.Quantity` Declination array keep_inside : bool, optional T...
[ "Returns", "a", "boolean", "mask", "array", "of", "the", "positions", "lying", "inside", "(", "or", "outside", ")", "the", "MOC", "instance", "." ]
train
https://github.com/cds-astro/mocpy/blob/09472cabe537f6bfdb049eeea64d3ea57b391c21/mocpy/moc/moc.py#L88-L119
cds-astro/mocpy
mocpy/moc/moc.py
MOC.add_neighbours
def add_neighbours(self): """ Extends the MOC instance so that it includes the HEALPix cells touching its border. The depth of the HEALPix cells added at the border is equal to the maximum depth of the MOC instance. Returns ------- moc : `~mocpy.moc.MOC` sel...
python
def add_neighbours(self): """ Extends the MOC instance so that it includes the HEALPix cells touching its border. The depth of the HEALPix cells added at the border is equal to the maximum depth of the MOC instance. Returns ------- moc : `~mocpy.moc.MOC` sel...
[ "def", "add_neighbours", "(", "self", ")", ":", "# Get the pixels array of the MOC at the its max order.", "ipix", "=", "self", ".", "_best_res_pixels", "(", ")", "hp", "=", "HEALPix", "(", "nside", "=", "(", "1", "<<", "self", ".", "max_order", ")", ",", "ord...
Extends the MOC instance so that it includes the HEALPix cells touching its border. The depth of the HEALPix cells added at the border is equal to the maximum depth of the MOC instance. Returns ------- moc : `~mocpy.moc.MOC` self extended by one degree of neighbours.
[ "Extends", "the", "MOC", "instance", "so", "that", "it", "includes", "the", "HEALPix", "cells", "touching", "its", "border", "." ]
train
https://github.com/cds-astro/mocpy/blob/09472cabe537f6bfdb049eeea64d3ea57b391c21/mocpy/moc/moc.py#L124-L151
cds-astro/mocpy
mocpy/moc/moc.py
MOC.remove_neighbours
def remove_neighbours(self): """ Removes from the MOC instance the HEALPix cells located at its border. The depth of the HEALPix cells removed is equal to the maximum depth of the MOC instance. Returns ------- moc : `~mocpy.moc.MOC` self minus its HEALPix ce...
python
def remove_neighbours(self): """ Removes from the MOC instance the HEALPix cells located at its border. The depth of the HEALPix cells removed is equal to the maximum depth of the MOC instance. Returns ------- moc : `~mocpy.moc.MOC` self minus its HEALPix ce...
[ "def", "remove_neighbours", "(", "self", ")", ":", "# Get the HEALPix cells of the MOC at its max depth", "ipix", "=", "self", ".", "_best_res_pixels", "(", ")", "hp", "=", "HEALPix", "(", "nside", "=", "(", "1", "<<", "self", ".", "max_order", ")", ",", "orde...
Removes from the MOC instance the HEALPix cells located at its border. The depth of the HEALPix cells removed is equal to the maximum depth of the MOC instance. Returns ------- moc : `~mocpy.moc.MOC` self minus its HEALPix cells located at its border.
[ "Removes", "from", "the", "MOC", "instance", "the", "HEALPix", "cells", "located", "at", "its", "border", "." ]
train
https://github.com/cds-astro/mocpy/blob/09472cabe537f6bfdb049eeea64d3ea57b391c21/mocpy/moc/moc.py#L153-L182
cds-astro/mocpy
mocpy/moc/moc.py
MOC.fill
def fill(self, ax, wcs, **kw_mpl_pathpatch): """ Draws the MOC on a matplotlib axis. This performs the projection of the cells from the world coordinate system to the pixel image coordinate system. You are able to specify various styling kwargs for `matplotlib.patches.PathPatch` ...
python
def fill(self, ax, wcs, **kw_mpl_pathpatch): """ Draws the MOC on a matplotlib axis. This performs the projection of the cells from the world coordinate system to the pixel image coordinate system. You are able to specify various styling kwargs for `matplotlib.patches.PathPatch` ...
[ "def", "fill", "(", "self", ",", "ax", ",", "wcs", ",", "*", "*", "kw_mpl_pathpatch", ")", ":", "fill", ".", "fill", "(", "self", ",", "ax", ",", "wcs", ",", "*", "*", "kw_mpl_pathpatch", ")" ]
Draws the MOC on a matplotlib axis. This performs the projection of the cells from the world coordinate system to the pixel image coordinate system. You are able to specify various styling kwargs for `matplotlib.patches.PathPatch` (see the `list of valid keywords <https://matplotlib.org/api/_as...
[ "Draws", "the", "MOC", "on", "a", "matplotlib", "axis", "." ]
train
https://github.com/cds-astro/mocpy/blob/09472cabe537f6bfdb049eeea64d3ea57b391c21/mocpy/moc/moc.py#L184-L229
cds-astro/mocpy
mocpy/moc/moc.py
MOC.border
def border(self, ax, wcs, **kw_mpl_pathpatch): """ Draws the MOC border(s) on a matplotlib axis. This performs the projection of the sky coordinates defining the perimeter of the MOC to the pixel image coordinate system. You are able to specify various styling kwargs for `matplotlib.pat...
python
def border(self, ax, wcs, **kw_mpl_pathpatch): """ Draws the MOC border(s) on a matplotlib axis. This performs the projection of the sky coordinates defining the perimeter of the MOC to the pixel image coordinate system. You are able to specify various styling kwargs for `matplotlib.pat...
[ "def", "border", "(", "self", ",", "ax", ",", "wcs", ",", "*", "*", "kw_mpl_pathpatch", ")", ":", "border", ".", "border", "(", "self", ",", "ax", ",", "wcs", ",", "*", "*", "kw_mpl_pathpatch", ")" ]
Draws the MOC border(s) on a matplotlib axis. This performs the projection of the sky coordinates defining the perimeter of the MOC to the pixel image coordinate system. You are able to specify various styling kwargs for `matplotlib.patches.PathPatch` (see the `list of valid keywords <https://...
[ "Draws", "the", "MOC", "border", "(", "s", ")", "on", "a", "matplotlib", "axis", "." ]
train
https://github.com/cds-astro/mocpy/blob/09472cabe537f6bfdb049eeea64d3ea57b391c21/mocpy/moc/moc.py#L231-L273
cds-astro/mocpy
mocpy/moc/moc.py
MOC.from_image
def from_image(cls, header, max_norder, mask=None): """ Creates a `~mocpy.moc.MOC` from an image stored as a FITS file. Parameters ---------- header : `astropy.io.fits.Header` FITS header containing all the info of where the image is located (position, size, etc...) ...
python
def from_image(cls, header, max_norder, mask=None): """ Creates a `~mocpy.moc.MOC` from an image stored as a FITS file. Parameters ---------- header : `astropy.io.fits.Header` FITS header containing all the info of where the image is located (position, size, etc...) ...
[ "def", "from_image", "(", "cls", ",", "header", ",", "max_norder", ",", "mask", "=", "None", ")", ":", "# load the image data", "height", "=", "header", "[", "'NAXIS2'", "]", "width", "=", "header", "[", "'NAXIS1'", "]", "# use wcs from astropy to locate the ima...
Creates a `~mocpy.moc.MOC` from an image stored as a FITS file. Parameters ---------- header : `astropy.io.fits.Header` FITS header containing all the info of where the image is located (position, size, etc...) max_norder : int The moc resolution. mask : ...
[ "Creates", "a", "~mocpy", ".", "moc", ".", "MOC", "from", "an", "image", "stored", "as", "a", "FITS", "file", "." ]
train
https://github.com/cds-astro/mocpy/blob/09472cabe537f6bfdb049eeea64d3ea57b391c21/mocpy/moc/moc.py#L299-L359
cds-astro/mocpy
mocpy/moc/moc.py
MOC.from_fits_images
def from_fits_images(cls, path_l, max_norder): """ Loads a MOC from a set of FITS file images. Parameters ---------- path_l : [str] A list of path where the fits image are located. max_norder : int The MOC resolution. Returns ----...
python
def from_fits_images(cls, path_l, max_norder): """ Loads a MOC from a set of FITS file images. Parameters ---------- path_l : [str] A list of path where the fits image are located. max_norder : int The MOC resolution. Returns ----...
[ "def", "from_fits_images", "(", "cls", ",", "path_l", ",", "max_norder", ")", ":", "moc", "=", "MOC", "(", ")", "for", "path", "in", "path_l", ":", "header", "=", "fits", ".", "getheader", "(", "path", ")", "current_moc", "=", "MOC", ".", "from_image",...
Loads a MOC from a set of FITS file images. Parameters ---------- path_l : [str] A list of path where the fits image are located. max_norder : int The MOC resolution. Returns ------- moc : `~mocpy.moc.MOC` The union of all the...
[ "Loads", "a", "MOC", "from", "a", "set", "of", "FITS", "file", "images", "." ]
train
https://github.com/cds-astro/mocpy/blob/09472cabe537f6bfdb049eeea64d3ea57b391c21/mocpy/moc/moc.py#L362-L384
cds-astro/mocpy
mocpy/moc/moc.py
MOC.from_vizier_table
def from_vizier_table(cls, table_id, nside=256): """ Creates a `~mocpy.moc.MOC` object from a VizieR table. **Info**: This method is already implemented in `astroquery.cds <https://astroquery.readthedocs.io/en/latest/cds/cds.html>`__. You can ask to get a `mocpy.moc.MOC` object from a v...
python
def from_vizier_table(cls, table_id, nside=256): """ Creates a `~mocpy.moc.MOC` object from a VizieR table. **Info**: This method is already implemented in `astroquery.cds <https://astroquery.readthedocs.io/en/latest/cds/cds.html>`__. You can ask to get a `mocpy.moc.MOC` object from a v...
[ "def", "from_vizier_table", "(", "cls", ",", "table_id", ",", "nside", "=", "256", ")", ":", "nside_possible_values", "=", "(", "8", ",", "16", ",", "32", ",", "64", ",", "128", ",", "256", ",", "512", ")", "if", "nside", "not", "in", "nside_possible...
Creates a `~mocpy.moc.MOC` object from a VizieR table. **Info**: This method is already implemented in `astroquery.cds <https://astroquery.readthedocs.io/en/latest/cds/cds.html>`__. You can ask to get a `mocpy.moc.MOC` object from a vizier catalog ID. Parameters ---------- tabl...
[ "Creates", "a", "~mocpy", ".", "moc", ".", "MOC", "object", "from", "a", "VizieR", "table", "." ]
train
https://github.com/cds-astro/mocpy/blob/09472cabe537f6bfdb049eeea64d3ea57b391c21/mocpy/moc/moc.py#L387-L411
cds-astro/mocpy
mocpy/moc/moc.py
MOC.from_ivorn
def from_ivorn(cls, ivorn, nside=256): """ Creates a `~mocpy.moc.MOC` object from a given ivorn. Parameters ---------- ivorn : str nside : int, optional 256 by default Returns ------- result : `~mocpy.moc.MOC` The resultin...
python
def from_ivorn(cls, ivorn, nside=256): """ Creates a `~mocpy.moc.MOC` object from a given ivorn. Parameters ---------- ivorn : str nside : int, optional 256 by default Returns ------- result : `~mocpy.moc.MOC` The resultin...
[ "def", "from_ivorn", "(", "cls", ",", "ivorn", ",", "nside", "=", "256", ")", ":", "return", "cls", ".", "from_url", "(", "'%s?%s'", "%", "(", "MOC", ".", "MOC_SERVER_ROOT_URL", ",", "urlencode", "(", "{", "'ivorn'", ":", "ivorn", ",", "'get'", ":", ...
Creates a `~mocpy.moc.MOC` object from a given ivorn. Parameters ---------- ivorn : str nside : int, optional 256 by default Returns ------- result : `~mocpy.moc.MOC` The resulting MOC.
[ "Creates", "a", "~mocpy", ".", "moc", ".", "MOC", "object", "from", "a", "given", "ivorn", "." ]
train
https://github.com/cds-astro/mocpy/blob/09472cabe537f6bfdb049eeea64d3ea57b391c21/mocpy/moc/moc.py#L416-L436
cds-astro/mocpy
mocpy/moc/moc.py
MOC.from_url
def from_url(cls, url): """ Creates a `~mocpy.moc.MOC` object from a given url. Parameters ---------- url : str The url of a FITS file storing a MOC. Returns ------- result : `~mocpy.moc.MOC` The resulting MOC. """ ...
python
def from_url(cls, url): """ Creates a `~mocpy.moc.MOC` object from a given url. Parameters ---------- url : str The url of a FITS file storing a MOC. Returns ------- result : `~mocpy.moc.MOC` The resulting MOC. """ ...
[ "def", "from_url", "(", "cls", ",", "url", ")", ":", "path", "=", "download_file", "(", "url", ",", "show_progress", "=", "False", ",", "timeout", "=", "60", ")", "return", "cls", ".", "from_fits", "(", "path", ")" ]
Creates a `~mocpy.moc.MOC` object from a given url. Parameters ---------- url : str The url of a FITS file storing a MOC. Returns ------- result : `~mocpy.moc.MOC` The resulting MOC.
[ "Creates", "a", "~mocpy", ".", "moc", ".", "MOC", "object", "from", "a", "given", "url", "." ]
train
https://github.com/cds-astro/mocpy/blob/09472cabe537f6bfdb049eeea64d3ea57b391c21/mocpy/moc/moc.py#L439-L454
cds-astro/mocpy
mocpy/moc/moc.py
MOC.from_skycoords
def from_skycoords(cls, skycoords, max_norder): """ Creates a MOC from an `astropy.coordinates.SkyCoord`. Parameters ---------- skycoords : `astropy.coordinates.SkyCoord` The sky coordinates that will belong to the MOC. max_norder : int The depth ...
python
def from_skycoords(cls, skycoords, max_norder): """ Creates a MOC from an `astropy.coordinates.SkyCoord`. Parameters ---------- skycoords : `astropy.coordinates.SkyCoord` The sky coordinates that will belong to the MOC. max_norder : int The depth ...
[ "def", "from_skycoords", "(", "cls", ",", "skycoords", ",", "max_norder", ")", ":", "hp", "=", "HEALPix", "(", "nside", "=", "(", "1", "<<", "max_norder", ")", ",", "order", "=", "'nested'", ")", "ipix", "=", "hp", ".", "lonlat_to_healpix", "(", "skyco...
Creates a MOC from an `astropy.coordinates.SkyCoord`. Parameters ---------- skycoords : `astropy.coordinates.SkyCoord` The sky coordinates that will belong to the MOC. max_norder : int The depth of the smallest HEALPix cells contained in the MOC. ...
[ "Creates", "a", "MOC", "from", "an", "astropy", ".", "coordinates", ".", "SkyCoord", "." ]
train
https://github.com/cds-astro/mocpy/blob/09472cabe537f6bfdb049eeea64d3ea57b391c21/mocpy/moc/moc.py#L457-L480
cds-astro/mocpy
mocpy/moc/moc.py
MOC.from_lonlat
def from_lonlat(cls, lon, lat, max_norder): """ Creates a MOC from astropy lon, lat `astropy.units.Quantity`. Parameters ---------- lon : `astropy.units.Quantity` The longitudes of the sky coordinates belonging to the MOC. lat : `astropy.units.Quantit...
python
def from_lonlat(cls, lon, lat, max_norder): """ Creates a MOC from astropy lon, lat `astropy.units.Quantity`. Parameters ---------- lon : `astropy.units.Quantity` The longitudes of the sky coordinates belonging to the MOC. lat : `astropy.units.Quantit...
[ "def", "from_lonlat", "(", "cls", ",", "lon", ",", "lat", ",", "max_norder", ")", ":", "hp", "=", "HEALPix", "(", "nside", "=", "(", "1", "<<", "max_norder", ")", ",", "order", "=", "'nested'", ")", "ipix", "=", "hp", ".", "lonlat_to_healpix", "(", ...
Creates a MOC from astropy lon, lat `astropy.units.Quantity`. Parameters ---------- lon : `astropy.units.Quantity` The longitudes of the sky coordinates belonging to the MOC. lat : `astropy.units.Quantity` The latitudes of the sky coordinates belonging to...
[ "Creates", "a", "MOC", "from", "astropy", "lon", "lat", "astropy", ".", "units", ".", "Quantity", ".", "Parameters", "----------", "lon", ":", "astropy", ".", "units", ".", "Quantity", "The", "longitudes", "of", "the", "sky", "coordinates", "belonging", "to"...
train
https://github.com/cds-astro/mocpy/blob/09472cabe537f6bfdb049eeea64d3ea57b391c21/mocpy/moc/moc.py#L483-L508
cds-astro/mocpy
mocpy/moc/moc.py
MOC.from_polygon_skycoord
def from_polygon_skycoord(cls, skycoord, inside=None, max_depth=10): """ Creates a MOC from a polygon. The polygon is given as an `astropy.coordinates.SkyCoord` that contains the vertices of the polygon. Concave and convex polygons are accepted but self-intersecting ones are cu...
python
def from_polygon_skycoord(cls, skycoord, inside=None, max_depth=10): """ Creates a MOC from a polygon. The polygon is given as an `astropy.coordinates.SkyCoord` that contains the vertices of the polygon. Concave and convex polygons are accepted but self-intersecting ones are cu...
[ "def", "from_polygon_skycoord", "(", "cls", ",", "skycoord", ",", "inside", "=", "None", ",", "max_depth", "=", "10", ")", ":", "return", "MOC", ".", "from_polygon", "(", "lon", "=", "skycoord", ".", "icrs", ".", "ra", ",", "lat", "=", "skycoord", ".",...
Creates a MOC from a polygon. The polygon is given as an `astropy.coordinates.SkyCoord` that contains the vertices of the polygon. Concave and convex polygons are accepted but self-intersecting ones are currently not properly handled. Parameters ---------- skycoord : `...
[ "Creates", "a", "MOC", "from", "a", "polygon", "." ]
train
https://github.com/cds-astro/mocpy/blob/09472cabe537f6bfdb049eeea64d3ea57b391c21/mocpy/moc/moc.py#L511-L541
cds-astro/mocpy
mocpy/moc/moc.py
MOC.from_polygon
def from_polygon(cls, lon, lat, inside=None, max_depth=10): """ Creates a MOC from a polygon The polygon is given as lon and lat `astropy.units.Quantity` that define the vertices of the polygon. Concave and convex polygons are accepted but self-intersecting ones are currently n...
python
def from_polygon(cls, lon, lat, inside=None, max_depth=10): """ Creates a MOC from a polygon The polygon is given as lon and lat `astropy.units.Quantity` that define the vertices of the polygon. Concave and convex polygons are accepted but self-intersecting ones are currently n...
[ "def", "from_polygon", "(", "cls", ",", "lon", ",", "lat", ",", "inside", "=", "None", ",", "max_depth", "=", "10", ")", ":", "from", ".", "polygon", "import", "PolygonComputer", "polygon_computer", "=", "PolygonComputer", "(", "lon", ",", "lat", ",", "i...
Creates a MOC from a polygon The polygon is given as lon and lat `astropy.units.Quantity` that define the vertices of the polygon. Concave and convex polygons are accepted but self-intersecting ones are currently not properly handled. Parameters ---------- lon : `astro...
[ "Creates", "a", "MOC", "from", "a", "polygon" ]
train
https://github.com/cds-astro/mocpy/blob/09472cabe537f6bfdb049eeea64d3ea57b391c21/mocpy/moc/moc.py#L544-L586
cds-astro/mocpy
mocpy/moc/moc.py
MOC.sky_fraction
def sky_fraction(self): """ Sky fraction covered by the MOC """ pix_id = self._best_res_pixels() nb_pix_filled = pix_id.size return nb_pix_filled / float(3 << (2*(self.max_order + 1)))
python
def sky_fraction(self): """ Sky fraction covered by the MOC """ pix_id = self._best_res_pixels() nb_pix_filled = pix_id.size return nb_pix_filled / float(3 << (2*(self.max_order + 1)))
[ "def", "sky_fraction", "(", "self", ")", ":", "pix_id", "=", "self", ".", "_best_res_pixels", "(", ")", "nb_pix_filled", "=", "pix_id", ".", "size", "return", "nb_pix_filled", "/", "float", "(", "3", "<<", "(", "2", "*", "(", "self", ".", "max_order", ...
Sky fraction covered by the MOC
[ "Sky", "fraction", "covered", "by", "the", "MOC" ]
train
https://github.com/cds-astro/mocpy/blob/09472cabe537f6bfdb049eeea64d3ea57b391c21/mocpy/moc/moc.py#L589-L595
cds-astro/mocpy
mocpy/moc/moc.py
MOC._query
def _query(self, resource_id, max_rows): """ Internal method to query Simbad or a VizieR table for sources in the coverage of the MOC instance """ from astropy.io.votable import parse_single_table if max_rows is not None and max_rows >= 0: max_rows_str = str(...
python
def _query(self, resource_id, max_rows): """ Internal method to query Simbad or a VizieR table for sources in the coverage of the MOC instance """ from astropy.io.votable import parse_single_table if max_rows is not None and max_rows >= 0: max_rows_str = str(...
[ "def", "_query", "(", "self", ",", "resource_id", ",", "max_rows", ")", ":", "from", "astropy", ".", "io", ".", "votable", "import", "parse_single_table", "if", "max_rows", "is", "not", "None", "and", "max_rows", ">=", "0", ":", "max_rows_str", "=", "str",...
Internal method to query Simbad or a VizieR table for sources in the coverage of the MOC instance
[ "Internal", "method", "to", "query", "Simbad", "or", "a", "VizieR", "table", "for", "sources", "in", "the", "coverage", "of", "the", "MOC", "instance" ]
train
https://github.com/cds-astro/mocpy/blob/09472cabe537f6bfdb049eeea64d3ea57b391c21/mocpy/moc/moc.py#L612-L644
cds-astro/mocpy
mocpy/moc/moc.py
MOC.plot
def plot(self, title='MOC', frame=None): """ Plot the MOC object using a mollweide projection. **Deprecated**: New `fill` and `border` methods produce more reliable results and allow you to specify additional matplotlib style parameters. Parameters ---------- t...
python
def plot(self, title='MOC', frame=None): """ Plot the MOC object using a mollweide projection. **Deprecated**: New `fill` and `border` methods produce more reliable results and allow you to specify additional matplotlib style parameters. Parameters ---------- t...
[ "def", "plot", "(", "self", ",", "title", "=", "'MOC'", ",", "frame", "=", "None", ")", ":", "frame", "=", "ICRS", "(", ")", "if", "frame", "is", "None", "else", "frame", "from", "matplotlib", ".", "colors", "import", "LinearSegmentedColormap", "import",...
Plot the MOC object using a mollweide projection. **Deprecated**: New `fill` and `border` methods produce more reliable results and allow you to specify additional matplotlib style parameters. Parameters ---------- title : str The title of the plot frame : ...
[ "Plot", "the", "MOC", "object", "using", "a", "mollweide", "projection", "." ]
train
https://github.com/cds-astro/mocpy/blob/09472cabe537f6bfdb049eeea64d3ea57b391c21/mocpy/moc/moc.py#L646-L712
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/visuals/transforms/base_transform.py
BaseTransform.inverse
def inverse(self): """ The inverse of this transform. """ if self._inverse is None: self._inverse = InverseTransform(self) return self._inverse
python
def inverse(self): """ The inverse of this transform. """ if self._inverse is None: self._inverse = InverseTransform(self) return self._inverse
[ "def", "inverse", "(", "self", ")", ":", "if", "self", ".", "_inverse", "is", "None", ":", "self", ".", "_inverse", "=", "InverseTransform", "(", "self", ")", "return", "self", ".", "_inverse" ]
The inverse of this transform.
[ "The", "inverse", "of", "this", "transform", "." ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/transforms/base_transform.py#L99-L104
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/visuals/axis.py
Ticker._tile_ticks
def _tile_ticks(self, frac, tickvec): """Tiles tick marks along the axis.""" origins = np.tile(self.axis._vec, (len(frac), 1)) origins = self.axis.pos[0].T + (origins.T*frac).T endpoints = tickvec + origins return origins, endpoints
python
def _tile_ticks(self, frac, tickvec): """Tiles tick marks along the axis.""" origins = np.tile(self.axis._vec, (len(frac), 1)) origins = self.axis.pos[0].T + (origins.T*frac).T endpoints = tickvec + origins return origins, endpoints
[ "def", "_tile_ticks", "(", "self", ",", "frac", ",", "tickvec", ")", ":", "origins", "=", "np", ".", "tile", "(", "self", ".", "axis", ".", "_vec", ",", "(", "len", "(", "frac", ")", ",", "1", ")", ")", "origins", "=", "self", ".", "axis", ".",...
Tiles tick marks along the axis.
[ "Tiles", "tick", "marks", "along", "the", "axis", "." ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/axis.py#L345-L350
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/visuals/axis.py
Ticker._get_tick_frac_labels
def _get_tick_frac_labels(self): """Get the major ticks, minor ticks, and major labels""" minor_num = 4 # number of minor ticks per major division if (self.axis.scale_type == 'linear'): domain = self.axis.domain if domain[1] < domain[0]: flip = True ...
python
def _get_tick_frac_labels(self): """Get the major ticks, minor ticks, and major labels""" minor_num = 4 # number of minor ticks per major division if (self.axis.scale_type == 'linear'): domain = self.axis.domain if domain[1] < domain[0]: flip = True ...
[ "def", "_get_tick_frac_labels", "(", "self", ")", ":", "minor_num", "=", "4", "# number of minor ticks per major division", "if", "(", "self", ".", "axis", ".", "scale_type", "==", "'linear'", ")", ":", "domain", "=", "self", ".", "axis", ".", "domain", "if", ...
Get the major ticks, minor ticks, and major labels
[ "Get", "the", "major", "ticks", "minor", "ticks", "and", "major", "labels" ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/axis.py#L352-L396
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/ext/_bundled/png.py
interleave_planes
def interleave_planes(ipixels, apixels, ipsize, apsize): """ Interleave (colour) planes, e.g. RGB + A = RGBA. Return an array of pixels consisting of the `ipsize` elements of data from each pixel in `ipixels` followed by the `apsize` elements of data from each pixel in `apixels`. Conventionally `i...
python
def interleave_planes(ipixels, apixels, ipsize, apsize): """ Interleave (colour) planes, e.g. RGB + A = RGBA. Return an array of pixels consisting of the `ipsize` elements of data from each pixel in `ipixels` followed by the `apsize` elements of data from each pixel in `apixels`. Conventionally `i...
[ "def", "interleave_planes", "(", "ipixels", ",", "apixels", ",", "ipsize", ",", "apsize", ")", ":", "itotal", "=", "len", "(", "ipixels", ")", "atotal", "=", "len", "(", "apixels", ")", "newtotal", "=", "itotal", "+", "atotal", "newpsize", "=", "ipsize",...
Interleave (colour) planes, e.g. RGB + A = RGBA. Return an array of pixels consisting of the `ipsize` elements of data from each pixel in `ipixels` followed by the `apsize` elements of data from each pixel in `apixels`. Conventionally `ipixels` and `apixels` are byte arrays so the sizes are bytes, but...
[ "Interleave", "(", "colour", ")", "planes", "e", ".", "g", ".", "RGB", "+", "A", "=", "RGBA", "." ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/ext/_bundled/png.py#L101-L129
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/ext/_bundled/png.py
write_chunks
def write_chunks(out, chunks): """Create a PNG file by writing out the chunks.""" out.write(_signature) for chunk in chunks: write_chunk(out, *chunk)
python
def write_chunks(out, chunks): """Create a PNG file by writing out the chunks.""" out.write(_signature) for chunk in chunks: write_chunk(out, *chunk)
[ "def", "write_chunks", "(", "out", ",", "chunks", ")", ":", "out", ".", "write", "(", "_signature", ")", "for", "chunk", "in", "chunks", ":", "write_chunk", "(", "out", ",", "*", "chunk", ")" ]
Create a PNG file by writing out the chunks.
[ "Create", "a", "PNG", "file", "by", "writing", "out", "the", "chunks", "." ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/ext/_bundled/png.py#L838-L843
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/ext/_bundled/png.py
filter_scanline
def filter_scanline(type, line, fo, prev=None): """Apply a scanline filter to a scanline. `type` specifies the filter type (0 to 4); `line` specifies the current (unfiltered) scanline as a sequence of bytes; `prev` specifies the previous (unfiltered) scanline as a sequence of bytes. `fo` specifies the ...
python
def filter_scanline(type, line, fo, prev=None): """Apply a scanline filter to a scanline. `type` specifies the filter type (0 to 4); `line` specifies the current (unfiltered) scanline as a sequence of bytes; `prev` specifies the previous (unfiltered) scanline as a sequence of bytes. `fo` specifies the ...
[ "def", "filter_scanline", "(", "type", ",", "line", ",", "fo", ",", "prev", "=", "None", ")", ":", "assert", "0", "<=", "type", "<", "5", "# The output array. Which, pathetically, we extend one-byte at a", "# time (fortunately this is linear).", "out", "=", "array", ...
Apply a scanline filter to a scanline. `type` specifies the filter type (0 to 4); `line` specifies the current (unfiltered) scanline as a sequence of bytes; `prev` specifies the previous (unfiltered) scanline as a sequence of bytes. `fo` specifies the filter offset; normally this is size of a pixel in ...
[ "Apply", "a", "scanline", "filter", "to", "a", "scanline", ".", "type", "specifies", "the", "filter", "type", "(", "0", "to", "4", ")", ";", "line", "specifies", "the", "current", "(", "unfiltered", ")", "scanline", "as", "a", "sequence", "of", "bytes", ...
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/ext/_bundled/png.py#L845-L929
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/ext/_bundled/png.py
from_array
def from_array(a, mode=None, info={}): """Create a PNG :class:`Image` object from a 2- or 3-dimensional array. One application of this function is easy PIL-style saving: ``png.from_array(pixels, 'L').save('foo.png')``. .. note : The use of the term *3-dimensional* is for marketing purposes ...
python
def from_array(a, mode=None, info={}): """Create a PNG :class:`Image` object from a 2- or 3-dimensional array. One application of this function is easy PIL-style saving: ``png.from_array(pixels, 'L').save('foo.png')``. .. note : The use of the term *3-dimensional* is for marketing purposes ...
[ "def", "from_array", "(", "a", ",", "mode", "=", "None", ",", "info", "=", "{", "}", ")", ":", "# We abuse the *info* parameter by modifying it. Take a copy here.", "# (Also typechecks *info* to some extent).", "info", "=", "dict", "(", "info", ")", "# Syntax check mod...
Create a PNG :class:`Image` object from a 2- or 3-dimensional array. One application of this function is easy PIL-style saving: ``png.from_array(pixels, 'L').save('foo.png')``. .. note : The use of the term *3-dimensional* is for marketing purposes only. It doesn't actually work. Please bea...
[ "Create", "a", "PNG", ":", "class", ":", "Image", "object", "from", "a", "2", "-", "or", "3", "-", "dimensional", "array", ".", "One", "application", "of", "this", "function", "is", "easy", "PIL", "-", "style", "saving", ":", "png", ".", "from_array", ...
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/ext/_bundled/png.py#L932-L1136
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/ext/_bundled/png.py
Writer.make_palette
def make_palette(self): """Create the byte sequences for a ``PLTE`` and if necessary a ``tRNS`` chunk. Returned as a pair (*p*, *t*). *t* will be ``None`` if no ``tRNS`` chunk is necessary. """ p = array('B') t = array('B') for x in self.palette: p...
python
def make_palette(self): """Create the byte sequences for a ``PLTE`` and if necessary a ``tRNS`` chunk. Returned as a pair (*p*, *t*). *t* will be ``None`` if no ``tRNS`` chunk is necessary. """ p = array('B') t = array('B') for x in self.palette: p...
[ "def", "make_palette", "(", "self", ")", ":", "p", "=", "array", "(", "'B'", ")", "t", "=", "array", "(", "'B'", ")", "for", "x", "in", "self", ".", "palette", ":", "p", ".", "extend", "(", "x", "[", "0", ":", "3", "]", ")", "if", "len", "(...
Create the byte sequences for a ``PLTE`` and if necessary a ``tRNS`` chunk. Returned as a pair (*p*, *t*). *t* will be ``None`` if no ``tRNS`` chunk is necessary.
[ "Create", "the", "byte", "sequences", "for", "a", "PLTE", "and", "if", "necessary", "a", "tRNS", "chunk", ".", "Returned", "as", "a", "pair", "(", "*", "p", "*", "*", "t", "*", ")", ".", "*", "t", "*", "will", "be", "None", "if", "no", "tRNS", ...
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/ext/_bundled/png.py#L464-L481
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/ext/_bundled/png.py
Writer.write
def write(self, outfile, rows): """Write a PNG image to the output file. `rows` should be an iterable that yields each row in boxed row flat pixel format. The rows should be the rows of the original image, so there should be ``self.height`` rows of ``self.width * self.planes`` ...
python
def write(self, outfile, rows): """Write a PNG image to the output file. `rows` should be an iterable that yields each row in boxed row flat pixel format. The rows should be the rows of the original image, so there should be ``self.height`` rows of ``self.width * self.planes`` ...
[ "def", "write", "(", "self", ",", "outfile", ",", "rows", ")", ":", "if", "self", ".", "interlace", ":", "fmt", "=", "'BH'", "[", "self", ".", "bitdepth", ">", "8", "]", "a", "=", "array", "(", "fmt", ",", "itertools", ".", "chain", "(", "*", "...
Write a PNG image to the output file. `rows` should be an iterable that yields each row in boxed row flat pixel format. The rows should be the rows of the original image, so there should be ``self.height`` rows of ``self.width * self.planes`` values. If `interlace` is specified (when ...
[ "Write", "a", "PNG", "image", "to", "the", "output", "file", ".", "rows", "should", "be", "an", "iterable", "that", "yields", "each", "row", "in", "boxed", "row", "flat", "pixel", "format", ".", "The", "rows", "should", "be", "the", "rows", "of", "the"...
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/ext/_bundled/png.py#L483-L508
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/ext/_bundled/png.py
Writer.write_passes
def write_passes(self, outfile, rows, packed=False): """ Write a PNG image to the output file. Most users are expected to find the :meth:`write` or :meth:`write_array` method more convenient. The rows should be given to this method in the order that they appear ...
python
def write_passes(self, outfile, rows, packed=False): """ Write a PNG image to the output file. Most users are expected to find the :meth:`write` or :meth:`write_array` method more convenient. The rows should be given to this method in the order that they appear ...
[ "def", "write_passes", "(", "self", ",", "outfile", ",", "rows", ",", "packed", "=", "False", ")", ":", "# http://www.w3.org/TR/PNG/#5PNG-file-signature", "outfile", ".", "write", "(", "_signature", ")", "# http://www.w3.org/TR/PNG/#11IHDR", "write_chunk", "(", "outfi...
Write a PNG image to the output file. Most users are expected to find the :meth:`write` or :meth:`write_array` method more convenient. The rows should be given to this method in the order that they appear in the output file. For straightlaced images, this is the usual ...
[ "Write", "a", "PNG", "image", "to", "the", "output", "file", "." ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/ext/_bundled/png.py#L510-L676
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/ext/_bundled/png.py
Writer.write_packed
def write_packed(self, outfile, rows): """ Write PNG file to `outfile`. The pixel data comes from `rows` which should be in boxed row packed format. Each row should be a sequence of packed bytes. Technically, this method does work for interlaced images but it is best a...
python
def write_packed(self, outfile, rows): """ Write PNG file to `outfile`. The pixel data comes from `rows` which should be in boxed row packed format. Each row should be a sequence of packed bytes. Technically, this method does work for interlaced images but it is best a...
[ "def", "write_packed", "(", "self", ",", "outfile", ",", "rows", ")", ":", "if", "self", ".", "rescale", ":", "raise", "Error", "(", "\"write_packed method not suitable for bit depth %d\"", "%", "self", ".", "rescale", "[", "0", "]", ")", "return", "self", "...
Write PNG file to `outfile`. The pixel data comes from `rows` which should be in boxed row packed format. Each row should be a sequence of packed bytes. Technically, this method does work for interlaced images but it is best avoided. For interlaced images, the rows should be ...
[ "Write", "PNG", "file", "to", "outfile", ".", "The", "pixel", "data", "comes", "from", "rows", "which", "should", "be", "in", "boxed", "row", "packed", "format", ".", "Each", "row", "should", "be", "a", "sequence", "of", "packed", "bytes", "." ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/ext/_bundled/png.py#L689-L707
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/ext/_bundled/png.py
Writer.convert_pnm
def convert_pnm(self, infile, outfile): """ Convert a PNM file containing raw pixel data into a PNG file with the parameters set in the writer object. Works for (binary) PGM, PPM, and PAM formats. """ if self.interlace: pixels = array('B') pixels...
python
def convert_pnm(self, infile, outfile): """ Convert a PNM file containing raw pixel data into a PNG file with the parameters set in the writer object. Works for (binary) PGM, PPM, and PAM formats. """ if self.interlace: pixels = array('B') pixels...
[ "def", "convert_pnm", "(", "self", ",", "infile", ",", "outfile", ")", ":", "if", "self", ".", "interlace", ":", "pixels", "=", "array", "(", "'B'", ")", "pixels", ".", "fromfile", "(", "infile", ",", "(", "self", ".", "bitdepth", "/", "8", ")", "*...
Convert a PNM file containing raw pixel data into a PNG file with the parameters set in the writer object. Works for (binary) PGM, PPM, and PAM formats.
[ "Convert", "a", "PNM", "file", "containing", "raw", "pixel", "data", "into", "a", "PNG", "file", "with", "the", "parameters", "set", "in", "the", "writer", "object", ".", "Works", "for", "(", "binary", ")", "PGM", "PPM", "and", "PAM", "formats", "." ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/ext/_bundled/png.py#L709-L723
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/ext/_bundled/png.py
Writer.convert_ppm_and_pgm
def convert_ppm_and_pgm(self, ppmfile, pgmfile, outfile): """ Convert a PPM and PGM file containing raw pixel data into a PNG outfile with the parameters set in the writer object. """ pixels = array('B') pixels.fromfile(ppmfile, (self.bitdepth/8) *...
python
def convert_ppm_and_pgm(self, ppmfile, pgmfile, outfile): """ Convert a PPM and PGM file containing raw pixel data into a PNG outfile with the parameters set in the writer object. """ pixels = array('B') pixels.fromfile(ppmfile, (self.bitdepth/8) *...
[ "def", "convert_ppm_and_pgm", "(", "self", ",", "ppmfile", ",", "pgmfile", ",", "outfile", ")", ":", "pixels", "=", "array", "(", "'B'", ")", "pixels", ".", "fromfile", "(", "ppmfile", ",", "(", "self", ".", "bitdepth", "/", "8", ")", "*", "self", "....
Convert a PPM and PGM file containing raw pixel data into a PNG outfile with the parameters set in the writer object.
[ "Convert", "a", "PPM", "and", "PGM", "file", "containing", "raw", "pixel", "data", "into", "a", "PNG", "outfile", "with", "the", "parameters", "set", "in", "the", "writer", "object", "." ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/ext/_bundled/png.py#L725-L744
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/ext/_bundled/png.py
Writer.file_scanlines
def file_scanlines(self, infile): """ Generates boxed rows in flat pixel format, from the input file `infile`. It assumes that the input file is in a "Netpbm-like" binary format, and is positioned at the beginning of the first pixel. The number of pixels to read is taken from t...
python
def file_scanlines(self, infile): """ Generates boxed rows in flat pixel format, from the input file `infile`. It assumes that the input file is in a "Netpbm-like" binary format, and is positioned at the beginning of the first pixel. The number of pixels to read is taken from t...
[ "def", "file_scanlines", "(", "self", ",", "infile", ")", ":", "# Values per row", "vpr", "=", "self", ".", "width", "*", "self", ".", "planes", "row_bytes", "=", "vpr", "if", "self", ".", "bitdepth", ">", "8", ":", "assert", "self", ".", "bitdepth", "...
Generates boxed rows in flat pixel format, from the input file `infile`. It assumes that the input file is in a "Netpbm-like" binary format, and is positioned at the beginning of the first pixel. The number of pixels to read is taken from the image dimensions (`width`, `height`, `plane...
[ "Generates", "boxed", "rows", "in", "flat", "pixel", "format", "from", "the", "input", "file", "infile", ".", "It", "assumes", "that", "the", "input", "file", "is", "in", "a", "Netpbm", "-", "like", "binary", "format", "and", "is", "positioned", "at", "t...
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/ext/_bundled/png.py#L746-L770
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/ext/_bundled/png.py
Writer.array_scanlines_interlace
def array_scanlines_interlace(self, pixels): """ Generator for interlaced scanlines from an array. `pixels` is the full source image in flat row flat pixel format. The generator yields each scanline of the reduced passes in turn, in boxed row flat pixel format. """ ...
python
def array_scanlines_interlace(self, pixels): """ Generator for interlaced scanlines from an array. `pixels` is the full source image in flat row flat pixel format. The generator yields each scanline of the reduced passes in turn, in boxed row flat pixel format. """ ...
[ "def", "array_scanlines_interlace", "(", "self", ",", "pixels", ")", ":", "# http://www.w3.org/TR/PNG/#8InterlaceMethods", "# Array type.", "fmt", "=", "'BH'", "[", "self", ".", "bitdepth", ">", "8", "]", "# Value per row", "vpr", "=", "self", ".", "width", "*", ...
Generator for interlaced scanlines from an array. `pixels` is the full source image in flat row flat pixel format. The generator yields each scanline of the reduced passes in turn, in boxed row flat pixel format.
[ "Generator", "for", "interlaced", "scanlines", "from", "an", "array", ".", "pixels", "is", "the", "full", "source", "image", "in", "flat", "row", "flat", "pixel", "format", ".", "The", "generator", "yields", "each", "scanline", "of", "the", "reduced", "passe...
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/ext/_bundled/png.py#L786-L820
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/ext/_bundled/png.py
Reader.undo_filter
def undo_filter(self, filter_type, scanline, previous): """Undo the filter for a scanline. `scanline` is a sequence of bytes that does not include the initial filter type byte. `previous` is decoded previous scanline (for straightlaced images this is the previous pixel row, but for inte...
python
def undo_filter(self, filter_type, scanline, previous): """Undo the filter for a scanline. `scanline` is a sequence of bytes that does not include the initial filter type byte. `previous` is decoded previous scanline (for straightlaced images this is the previous pixel row, but for inte...
[ "def", "undo_filter", "(", "self", ",", "filter_type", ",", "scanline", ",", "previous", ")", ":", "# :todo: Would it be better to update scanline in place?", "# Yes, with the Cython extension making the undo_filter fast,", "# updating scanline inplace makes the code 3 times faster", "...
Undo the filter for a scanline. `scanline` is a sequence of bytes that does not include the initial filter type byte. `previous` is decoded previous scanline (for straightlaced images this is the previous pixel row, but for interlaced images, it is the previous scanline in the reduced i...
[ "Undo", "the", "filter", "for", "a", "scanline", ".", "scanline", "is", "a", "sequence", "of", "bytes", "that", "does", "not", "include", "the", "initial", "filter", "type", "byte", ".", "previous", "is", "decoded", "previous", "scanline", "(", "for", "str...
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/ext/_bundled/png.py#L1315-L1424
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/ext/_bundled/png.py
Reader.deinterlace
def deinterlace(self, raw): """ Read raw pixel data, undo filters, deinterlace, and flatten. Return in flat row flat pixel format. """ # Values per row (of the target image) vpr = self.width * self.planes # Make a result array, and make it big enough. Interleav...
python
def deinterlace(self, raw): """ Read raw pixel data, undo filters, deinterlace, and flatten. Return in flat row flat pixel format. """ # Values per row (of the target image) vpr = self.width * self.planes # Make a result array, and make it big enough. Interleav...
[ "def", "deinterlace", "(", "self", ",", "raw", ")", ":", "# Values per row (of the target image)", "vpr", "=", "self", ".", "width", "*", "self", ".", "planes", "# Make a result array, and make it big enough. Interleaving", "# writes to the output array randomly (well, not qui...
Read raw pixel data, undo filters, deinterlace, and flatten. Return in flat row flat pixel format.
[ "Read", "raw", "pixel", "data", "undo", "filters", "deinterlace", "and", "flatten", ".", "Return", "in", "flat", "row", "flat", "pixel", "format", "." ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/ext/_bundled/png.py#L1426-L1472
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/ext/_bundled/png.py
Reader.iterboxed
def iterboxed(self, rows): """Iterator that yields each scanline in boxed row flat pixel format. `rows` should be an iterator that yields the bytes of each row in turn. """ def asvalues(raw): """Convert a row of raw bytes into a flat row. Result will be...
python
def iterboxed(self, rows): """Iterator that yields each scanline in boxed row flat pixel format. `rows` should be an iterator that yields the bytes of each row in turn. """ def asvalues(raw): """Convert a row of raw bytes into a flat row. Result will be...
[ "def", "iterboxed", "(", "self", ",", "rows", ")", ":", "def", "asvalues", "(", "raw", ")", ":", "\"\"\"Convert a row of raw bytes into a flat row. Result will\n be a freshly allocated object, not shared with\n argument.\n \"\"\"", "if", "self", "....
Iterator that yields each scanline in boxed row flat pixel format. `rows` should be an iterator that yields the bytes of each row in turn.
[ "Iterator", "that", "yields", "each", "scanline", "in", "boxed", "row", "flat", "pixel", "format", ".", "rows", "should", "be", "an", "iterator", "that", "yields", "the", "bytes", "of", "each", "row", "in", "turn", "." ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/ext/_bundled/png.py#L1474-L1502
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/ext/_bundled/png.py
Reader.serialtoflat
def serialtoflat(self, bytes, width=None): """Convert serial format (byte stream) pixel data to flat row flat pixel. """ if self.bitdepth == 8: return bytes if self.bitdepth == 16: bytes = tostring(bytes) return array('H', struct...
python
def serialtoflat(self, bytes, width=None): """Convert serial format (byte stream) pixel data to flat row flat pixel. """ if self.bitdepth == 8: return bytes if self.bitdepth == 16: bytes = tostring(bytes) return array('H', struct...
[ "def", "serialtoflat", "(", "self", ",", "bytes", ",", "width", "=", "None", ")", ":", "if", "self", ".", "bitdepth", "==", "8", ":", "return", "bytes", "if", "self", ".", "bitdepth", "==", "16", ":", "bytes", "=", "tostring", "(", "bytes", ")", "r...
Convert serial format (byte stream) pixel data to flat row flat pixel.
[ "Convert", "serial", "format", "(", "byte", "stream", ")", "pixel", "data", "to", "flat", "row", "flat", "pixel", "." ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/ext/_bundled/png.py#L1504-L1529
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/ext/_bundled/png.py
Reader.iterstraight
def iterstraight(self, raw): """Iterator that undoes the effect of filtering, and yields each row in serialised format (as a sequence of bytes). Assumes input is straightlaced. `raw` should be an iterable that yields the raw bytes in chunks of arbitrary size. """ # leng...
python
def iterstraight(self, raw): """Iterator that undoes the effect of filtering, and yields each row in serialised format (as a sequence of bytes). Assumes input is straightlaced. `raw` should be an iterable that yields the raw bytes in chunks of arbitrary size. """ # leng...
[ "def", "iterstraight", "(", "self", ",", "raw", ")", ":", "# length of row, in bytes", "rb", "=", "self", ".", "row_bytes", "a", "=", "array", "(", "'B'", ")", "# The previous (reconstructed) scanline. None indicates first", "# line of image.", "recon", "=", "None", ...
Iterator that undoes the effect of filtering, and yields each row in serialised format (as a sequence of bytes). Assumes input is straightlaced. `raw` should be an iterable that yields the raw bytes in chunks of arbitrary size.
[ "Iterator", "that", "undoes", "the", "effect", "of", "filtering", "and", "yields", "each", "row", "in", "serialised", "format", "(", "as", "a", "sequence", "of", "bytes", ")", ".", "Assumes", "input", "is", "straightlaced", ".", "raw", "should", "be", "an"...
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/ext/_bundled/png.py#L1531-L1558
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/ext/_bundled/png.py
Reader.chunklentype
def chunklentype(self): """Reads just enough of the input to determine the next chunk's length and type, returned as a (*length*, *type*) pair where *type* is a string. If there are no more chunks, ``None`` is returned. """ x = self.file.read(8) if not x: ...
python
def chunklentype(self): """Reads just enough of the input to determine the next chunk's length and type, returned as a (*length*, *type*) pair where *type* is a string. If there are no more chunks, ``None`` is returned. """ x = self.file.read(8) if not x: ...
[ "def", "chunklentype", "(", "self", ")", ":", "x", "=", "self", ".", "file", ".", "read", "(", "8", ")", "if", "not", "x", ":", "return", "None", "if", "len", "(", "x", ")", "!=", "8", ":", "raise", "FormatError", "(", "'End of file whilst reading ch...
Reads just enough of the input to determine the next chunk's length and type, returned as a (*length*, *type*) pair where *type* is a string. If there are no more chunks, ``None`` is returned.
[ "Reads", "just", "enough", "of", "the", "input", "to", "determine", "the", "next", "chunk", "s", "length", "and", "type", "returned", "as", "a", "(", "*", "length", "*", "*", "type", "*", ")", "pair", "where", "*", "type", "*", "is", "a", "string", ...
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/ext/_bundled/png.py#L1594-L1611
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/ext/_bundled/png.py
Reader.read
def read(self, lenient=False): """ Read the PNG file and decode it. Returns (`width`, `height`, `pixels`, `metadata`). May use excessive memory. `pixels` are returned in boxed row flat pixel format. If the optional `lenient` argument evaluates to True, checksu...
python
def read(self, lenient=False): """ Read the PNG file and decode it. Returns (`width`, `height`, `pixels`, `metadata`). May use excessive memory. `pixels` are returned in boxed row flat pixel format. If the optional `lenient` argument evaluates to True, checksu...
[ "def", "read", "(", "self", ",", "lenient", "=", "False", ")", ":", "def", "iteridat", "(", ")", ":", "\"\"\"Iterator that yields all the ``IDAT`` chunks as strings.\"\"\"", "while", "True", ":", "try", ":", "type", ",", "data", "=", "self", ".", "chunk", "(",...
Read the PNG file and decode it. Returns (`width`, `height`, `pixels`, `metadata`). May use excessive memory. `pixels` are returned in boxed row flat pixel format. If the optional `lenient` argument evaluates to True, checksum failures will raise warnings rather than exceptio...
[ "Read", "the", "PNG", "file", "and", "decode", "it", ".", "Returns", "(", "width", "height", "pixels", "metadata", ")", "." ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/ext/_bundled/png.py#L1735-L1805
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/ext/_bundled/png.py
Reader.palette
def palette(self, alpha='natural'): """Returns a palette that is a sequence of 3-tuples or 4-tuples, synthesizing it from the ``PLTE`` and ``tRNS`` chunks. These chunks should have already been processed (for example, by calling the :meth:`preamble` method). All the tuples are the ...
python
def palette(self, alpha='natural'): """Returns a palette that is a sequence of 3-tuples or 4-tuples, synthesizing it from the ``PLTE`` and ``tRNS`` chunks. These chunks should have already been processed (for example, by calling the :meth:`preamble` method). All the tuples are the ...
[ "def", "palette", "(", "self", ",", "alpha", "=", "'natural'", ")", ":", "if", "not", "self", ".", "plte", ":", "raise", "FormatError", "(", "\"Required PLTE chunk is missing in colour type 3 image.\"", ")", "plte", "=", "group", "(", "array", "(", "'B'", ",",...
Returns a palette that is a sequence of 3-tuples or 4-tuples, synthesizing it from the ``PLTE`` and ``tRNS`` chunks. These chunks should have already been processed (for example, by calling the :meth:`preamble` method). All the tuples are the same size: 3-tuples if there is no ``tRNS``...
[ "Returns", "a", "palette", "that", "is", "a", "sequence", "of", "3", "-", "tuples", "or", "4", "-", "tuples", "synthesizing", "it", "from", "the", "PLTE", "and", "tRNS", "chunks", ".", "These", "chunks", "should", "have", "already", "been", "processed", ...
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/ext/_bundled/png.py#L1826-L1847
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/ext/_bundled/png.py
Reader.asDirect
def asDirect(self): """Returns the image data as a direct representation of an ``x * y * planes`` array. This method is intended to remove the need for callers to deal with palettes and transparency themselves. Images with a palette (colour type 3) are converted to RGB or RGBA;...
python
def asDirect(self): """Returns the image data as a direct representation of an ``x * y * planes`` array. This method is intended to remove the need for callers to deal with palettes and transparency themselves. Images with a palette (colour type 3) are converted to RGB or RGBA;...
[ "def", "asDirect", "(", "self", ")", ":", "self", ".", "preamble", "(", ")", "# Simple case, no conversion necessary.", "if", "not", "self", ".", "colormap", "and", "not", "self", ".", "trns", "and", "not", "self", ".", "sbit", ":", "return", "self", ".", ...
Returns the image data as a direct representation of an ``x * y * planes`` array. This method is intended to remove the need for callers to deal with palettes and transparency themselves. Images with a palette (colour type 3) are converted to RGB or RGBA; images with transparency (a ...
[ "Returns", "the", "image", "data", "as", "a", "direct", "representation", "of", "an", "x", "*", "y", "*", "planes", "array", ".", "This", "method", "is", "intended", "to", "remove", "the", "need", "for", "callers", "to", "deal", "with", "palettes", "and"...
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/ext/_bundled/png.py#L1849-L1952
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/ext/_bundled/png.py
Reader.asFloat
def asFloat(self, maxval=1.0): """Return image pixels as per :meth:`asDirect` method, but scale all pixel values to be floating point values between 0.0 and *maxval*. """ x,y,pixels,info = self.asDirect() sourcemaxval = 2**info['bitdepth']-1 del info['bitdepth'] ...
python
def asFloat(self, maxval=1.0): """Return image pixels as per :meth:`asDirect` method, but scale all pixel values to be floating point values between 0.0 and *maxval*. """ x,y,pixels,info = self.asDirect() sourcemaxval = 2**info['bitdepth']-1 del info['bitdepth'] ...
[ "def", "asFloat", "(", "self", ",", "maxval", "=", "1.0", ")", ":", "x", ",", "y", ",", "pixels", ",", "info", "=", "self", ".", "asDirect", "(", ")", "sourcemaxval", "=", "2", "**", "info", "[", "'bitdepth'", "]", "-", "1", "del", "info", "[", ...
Return image pixels as per :meth:`asDirect` method, but scale all pixel values to be floating point values between 0.0 and *maxval*.
[ "Return", "image", "pixels", "as", "per", ":", "meth", ":", "asDirect", "method", "but", "scale", "all", "pixel", "values", "to", "be", "floating", "point", "values", "between", "0", ".", "0", "and", "*", "maxval", "*", "." ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/ext/_bundled/png.py#L1954-L1968
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/ext/_bundled/png.py
Reader._as_rescale
def _as_rescale(self, get, targetbitdepth): """Helper used by :meth:`asRGB8` and :meth:`asRGBA8`.""" width,height,pixels,meta = get() maxval = 2**meta['bitdepth'] - 1 targetmaxval = 2**targetbitdepth - 1 factor = float(targetmaxval) / float(maxval) meta['bitdepth'] = tar...
python
def _as_rescale(self, get, targetbitdepth): """Helper used by :meth:`asRGB8` and :meth:`asRGBA8`.""" width,height,pixels,meta = get() maxval = 2**meta['bitdepth'] - 1 targetmaxval = 2**targetbitdepth - 1 factor = float(targetmaxval) / float(maxval) meta['bitdepth'] = tar...
[ "def", "_as_rescale", "(", "self", ",", "get", ",", "targetbitdepth", ")", ":", "width", ",", "height", ",", "pixels", ",", "meta", "=", "get", "(", ")", "maxval", "=", "2", "**", "meta", "[", "'bitdepth'", "]", "-", "1", "targetmaxval", "=", "2", ...
Helper used by :meth:`asRGB8` and :meth:`asRGBA8`.
[ "Helper", "used", "by", ":", "meth", ":", "asRGB8", "and", ":", "meth", ":", "asRGBA8", "." ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/ext/_bundled/png.py#L1970-L1984
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/ext/_bundled/png.py
Reader.asRGB
def asRGB(self): """Return image as RGB pixels. RGB colour images are passed through unchanged; greyscales are expanded into RGB triplets (there is a small speed overhead for doing this). An alpha channel in the source image will raise an exception. The return values a...
python
def asRGB(self): """Return image as RGB pixels. RGB colour images are passed through unchanged; greyscales are expanded into RGB triplets (there is a small speed overhead for doing this). An alpha channel in the source image will raise an exception. The return values a...
[ "def", "asRGB", "(", "self", ")", ":", "width", ",", "height", ",", "pixels", ",", "meta", "=", "self", ".", "asDirect", "(", ")", "if", "meta", "[", "'alpha'", "]", ":", "raise", "Error", "(", "\"will not convert image with alpha channel to RGB\"", ")", "...
Return image as RGB pixels. RGB colour images are passed through unchanged; greyscales are expanded into RGB triplets (there is a small speed overhead for doing this). An alpha channel in the source image will raise an exception. The return values are as for the :meth:`read` m...
[ "Return", "image", "as", "RGB", "pixels", ".", "RGB", "colour", "images", "are", "passed", "through", "unchanged", ";", "greyscales", "are", "expanded", "into", "RGB", "triplets", "(", "there", "is", "a", "small", "speed", "overhead", "for", "doing", "this",...
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/ext/_bundled/png.py#L2017-L2044
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/ext/_bundled/png.py
Reader.asRGBA
def asRGBA(self): """Return image as RGBA pixels. Greyscales are expanded into RGB triplets; an alpha channel is synthesized if necessary. The return values are as for the :meth:`read` method except that the *metadata* reflect the returned pixels, not the source image. In parti...
python
def asRGBA(self): """Return image as RGBA pixels. Greyscales are expanded into RGB triplets; an alpha channel is synthesized if necessary. The return values are as for the :meth:`read` method except that the *metadata* reflect the returned pixels, not the source image. In parti...
[ "def", "asRGBA", "(", "self", ")", ":", "width", ",", "height", ",", "pixels", ",", "meta", "=", "self", ".", "asDirect", "(", ")", "if", "meta", "[", "'alpha'", "]", "and", "not", "meta", "[", "'greyscale'", "]", ":", "return", "width", ",", "heig...
Return image as RGBA pixels. Greyscales are expanded into RGB triplets; an alpha channel is synthesized if necessary. The return values are as for the :meth:`read` method except that the *metadata* reflect the returned pixels, not the source image. In particular, for this method ...
[ "Return", "image", "as", "RGBA", "pixels", ".", "Greyscales", "are", "expanded", "into", "RGB", "triplets", ";", "an", "alpha", "channel", "is", "synthesized", "if", "necessary", ".", "The", "return", "values", "are", "as", "for", "the", ":", "meth", ":", ...
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/ext/_bundled/png.py#L2046-L2092
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/util/fetching.py
load_data_file
def load_data_file(fname, directory=None, force_download=False): """Get a standard vispy demo data file Parameters ---------- fname : str The filename on the remote ``demo-data`` repository to download, e.g. ``'molecular_viewer/micelle.npy'``. These correspond to paths on ``http...
python
def load_data_file(fname, directory=None, force_download=False): """Get a standard vispy demo data file Parameters ---------- fname : str The filename on the remote ``demo-data`` repository to download, e.g. ``'molecular_viewer/micelle.npy'``. These correspond to paths on ``http...
[ "def", "load_data_file", "(", "fname", ",", "directory", "=", "None", ",", "force_download", "=", "False", ")", ":", "_url_root", "=", "'http://github.com/vispy/demo-data/raw/master/'", "url", "=", "_url_root", "+", "fname", "if", "directory", "is", "None", ":", ...
Get a standard vispy demo data file Parameters ---------- fname : str The filename on the remote ``demo-data`` repository to download, e.g. ``'molecular_viewer/micelle.npy'``. These correspond to paths on ``https://github.com/vispy/demo-data/``. directory : str | None Di...
[ "Get", "a", "standard", "vispy", "demo", "data", "file" ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/util/fetching.py#L23-L69
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/util/fetching.py
_chunk_read
def _chunk_read(response, local_file, chunk_size=65536, initial_size=0): """Download a file chunk by chunk and show advancement Can also be used when resuming downloads over http. Parameters ---------- response: urllib.response.addinfourl Response to the download request in order to get fi...
python
def _chunk_read(response, local_file, chunk_size=65536, initial_size=0): """Download a file chunk by chunk and show advancement Can also be used when resuming downloads over http. Parameters ---------- response: urllib.response.addinfourl Response to the download request in order to get fi...
[ "def", "_chunk_read", "(", "response", ",", "local_file", ",", "chunk_size", "=", "65536", ",", "initial_size", "=", "0", ")", ":", "# Adapted from NISL:", "# https://github.com/nisl/tutorial/blob/master/nisl/datasets.py", "bytes_so_far", "=", "initial_size", "# Returns onl...
Download a file chunk by chunk and show advancement Can also be used when resuming downloads over http. Parameters ---------- response: urllib.response.addinfourl Response to the download request in order to get file size. local_file: file Hard disk file where data should be writte...
[ "Download", "a", "file", "chunk", "by", "chunk", "and", "show", "advancement" ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/util/fetching.py#L174-L207
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/util/fetching.py
_chunk_write
def _chunk_write(chunk, local_file, progress): """Write a chunk to file and update the progress bar""" local_file.write(chunk) progress.update_with_increment_value(len(chunk))
python
def _chunk_write(chunk, local_file, progress): """Write a chunk to file and update the progress bar""" local_file.write(chunk) progress.update_with_increment_value(len(chunk))
[ "def", "_chunk_write", "(", "chunk", ",", "local_file", ",", "progress", ")", ":", "local_file", ".", "write", "(", "chunk", ")", "progress", ".", "update_with_increment_value", "(", "len", "(", "chunk", ")", ")" ]
Write a chunk to file and update the progress bar
[ "Write", "a", "chunk", "to", "file", "and", "update", "the", "progress", "bar" ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/util/fetching.py#L210-L213
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/util/fetching.py
_fetch_file
def _fetch_file(url, file_name, print_destination=True): """Load requested file, downloading it if needed or requested Parameters ---------- url: string The url of file to be downloaded. file_name: string Name, along with the path, of where downloaded file will be saved. print_d...
python
def _fetch_file(url, file_name, print_destination=True): """Load requested file, downloading it if needed or requested Parameters ---------- url: string The url of file to be downloaded. file_name: string Name, along with the path, of where downloaded file will be saved. print_d...
[ "def", "_fetch_file", "(", "url", ",", "file_name", ",", "print_destination", "=", "True", ")", ":", "# Adapted from NISL:", "# https://github.com/nisl/tutorial/blob/master/nisl/datasets.py", "temp_file_name", "=", "file_name", "+", "\".part\"", "local_file", "=", "None", ...
Load requested file, downloading it if needed or requested Parameters ---------- url: string The url of file to be downloaded. file_name: string Name, along with the path, of where downloaded file will be saved. print_destination: bool, optional If true, destination of where...
[ "Load", "requested", "file", "downloading", "it", "if", "needed", "or", "requested" ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/util/fetching.py#L216-L261
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/util/fetching.py
ProgressBar.update
def update(self, cur_value, mesg=None): """Update progressbar with current value of process Parameters ---------- cur_value : number Current value of process. Should be <= max_value (but this is not enforced). The percent of the progressbar will be computed as ...
python
def update(self, cur_value, mesg=None): """Update progressbar with current value of process Parameters ---------- cur_value : number Current value of process. Should be <= max_value (but this is not enforced). The percent of the progressbar will be computed as ...
[ "def", "update", "(", "self", ",", "cur_value", ",", "mesg", "=", "None", ")", ":", "# Ensure floating-point division so we can get fractions of a percent", "# for the progressbar.", "self", ".", "cur_value", "=", "cur_value", "progress", "=", "float", "(", "self", "....
Update progressbar with current value of process Parameters ---------- cur_value : number Current value of process. Should be <= max_value (but this is not enforced). The percent of the progressbar will be computed as (cur_value / max_value) * 100 m...
[ "Update", "progressbar", "with", "current", "value", "of", "process" ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/util/fetching.py#L113-L153
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/util/fetching.py
ProgressBar.update_with_increment_value
def update_with_increment_value(self, increment_value, mesg=None): """Update progressbar with the value of the increment instead of the current value of process as in update() Parameters ---------- increment_value : int Value of the increment of process. The percent...
python
def update_with_increment_value(self, increment_value, mesg=None): """Update progressbar with the value of the increment instead of the current value of process as in update() Parameters ---------- increment_value : int Value of the increment of process. The percent...
[ "def", "update_with_increment_value", "(", "self", ",", "increment_value", ",", "mesg", "=", "None", ")", ":", "self", ".", "cur_value", "+=", "increment_value", "self", ".", "update", "(", "self", ".", "cur_value", ",", "mesg", ")" ]
Update progressbar with the value of the increment instead of the current value of process as in update() Parameters ---------- increment_value : int Value of the increment of process. The percent of the progressbar will be computed as (self.cur_valu...
[ "Update", "progressbar", "with", "the", "value", "of", "the", "increment", "instead", "of", "the", "current", "value", "of", "process", "as", "in", "update", "()" ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/util/fetching.py#L155-L171
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/scene/canvas.py
SceneCanvas.central_widget
def central_widget(self): """ Returns the default widget that occupies the entire area of the canvas. """ if self._central_widget is None: self._central_widget = Widget(size=self.size, parent=self.scene) return self._central_widget
python
def central_widget(self): """ Returns the default widget that occupies the entire area of the canvas. """ if self._central_widget is None: self._central_widget = Widget(size=self.size, parent=self.scene) return self._central_widget
[ "def", "central_widget", "(", "self", ")", ":", "if", "self", ".", "_central_widget", "is", "None", ":", "self", ".", "_central_widget", "=", "Widget", "(", "size", "=", "self", ".", "size", ",", "parent", "=", "self", ".", "scene", ")", "return", "sel...
Returns the default widget that occupies the entire area of the canvas.
[ "Returns", "the", "default", "widget", "that", "occupies", "the", "entire", "area", "of", "the", "canvas", "." ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/scene/canvas.py#L164-L170
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/scene/canvas.py
SceneCanvas.render
def render(self, region=None, size=None, bgcolor=None): """Render the scene to an offscreen buffer and return the image array. Parameters ---------- region : tuple | None Specifies the region of the canvas to render. Format is (x, y, w, h). By default, t...
python
def render(self, region=None, size=None, bgcolor=None): """Render the scene to an offscreen buffer and return the image array. Parameters ---------- region : tuple | None Specifies the region of the canvas to render. Format is (x, y, w, h). By default, t...
[ "def", "render", "(", "self", ",", "region", "=", "None", ",", "size", "=", "None", ",", "bgcolor", "=", "None", ")", ":", "self", ".", "set_current", "(", ")", "# Set up a framebuffer to render to", "offset", "=", "(", "0", ",", "0", ")", "if", "regio...
Render the scene to an offscreen buffer and return the image array. Parameters ---------- region : tuple | None Specifies the region of the canvas to render. Format is (x, y, w, h). By default, the entire canvas is rendered. size : tuple | None ...
[ "Render", "the", "scene", "to", "an", "offscreen", "buffer", "and", "return", "the", "image", "array", ".", "Parameters", "----------", "region", ":", "tuple", "|", "None", "Specifies", "the", "region", "of", "the", "canvas", "to", "render", ".", "Format", ...
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/scene/canvas.py#L209-L247
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/scene/canvas.py
SceneCanvas.draw_visual
def draw_visual(self, visual, event=None): """ Draw a visual and its children to the canvas or currently active framebuffer. Parameters ---------- visual : Visual The visual to draw event : None or DrawEvent Optionally specifies the origin...
python
def draw_visual(self, visual, event=None): """ Draw a visual and its children to the canvas or currently active framebuffer. Parameters ---------- visual : Visual The visual to draw event : None or DrawEvent Optionally specifies the origin...
[ "def", "draw_visual", "(", "self", ",", "visual", ",", "event", "=", "None", ")", ":", "prof", "=", "Profiler", "(", ")", "# make sure this canvas's context is active", "self", ".", "set_current", "(", ")", "try", ":", "self", ".", "_drawing", "=", "True", ...
Draw a visual and its children to the canvas or currently active framebuffer. Parameters ---------- visual : Visual The visual to draw event : None or DrawEvent Optionally specifies the original canvas draw event that initiated this dr...
[ "Draw", "a", "visual", "and", "its", "children", "to", "the", "canvas", "or", "currently", "active", "framebuffer", ".", "Parameters", "----------", "visual", ":", "Visual", "The", "visual", "to", "draw", "event", ":", "None", "or", "DrawEvent", "Optionally", ...
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/scene/canvas.py#L255-L298
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/scene/canvas.py
SceneCanvas._generate_draw_order
def _generate_draw_order(self, node=None): """Return a list giving the order to draw visuals. Each node appears twice in the list--(node, True) appears before the node's children are drawn, and (node, False) appears after. """ if node is None: node = self._sc...
python
def _generate_draw_order(self, node=None): """Return a list giving the order to draw visuals. Each node appears twice in the list--(node, True) appears before the node's children are drawn, and (node, False) appears after. """ if node is None: node = self._sc...
[ "def", "_generate_draw_order", "(", "self", ",", "node", "=", "None", ")", ":", "if", "node", "is", "None", ":", "node", "=", "self", ".", "_scene", "order", "=", "[", "(", "node", ",", "True", ")", "]", "children", "=", "node", ".", "children", "c...
Return a list giving the order to draw visuals. Each node appears twice in the list--(node, True) appears before the node's children are drawn, and (node, False) appears after.
[ "Return", "a", "list", "giving", "the", "order", "to", "draw", "visuals", ".", "Each", "node", "appears", "twice", "in", "the", "list", "--", "(", "node", "True", ")", "appears", "before", "the", "node", "s", "children", "are", "drawn", "and", "(", "no...
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/scene/canvas.py#L300-L314