partition stringclasses 3
values | func_name stringlengths 1 134 | docstring stringlengths 1 46.9k | path stringlengths 4 223 | original_string stringlengths 75 104k | code stringlengths 75 104k | docstring_tokens listlengths 1 1.97k | repo stringlengths 7 55 | language stringclasses 1
value | url stringlengths 87 315 | code_tokens listlengths 19 28.4k | sha stringlengths 40 40 |
|---|---|---|---|---|---|---|---|---|---|---|---|
train | ScrollingLinesVisual.set_data | Set the complete data for a single line strip.
Parameters
----------
index : int
The index of the line strip to be replaced.
data : array-like
The data to assign to the selected line strip. | glue_vispy_viewers/extern/vispy/visuals/scrolling_lines.py | def set_data(self, index, data):
"""Set the complete data for a single line strip.
Parameters
----------
index : int
The index of the line strip to be replaced.
data : array-like
The data to assign to the selected line strip.
"""
s... | def set_data(self, index, data):
"""Set the complete data for a single line strip.
Parameters
----------
index : int
The index of the line strip to be replaced.
data : array-like
The data to assign to the selected line strip.
"""
s... | [
"Set",
"the",
"complete",
"data",
"for",
"a",
"single",
"line",
"strip",
".",
"Parameters",
"----------",
"index",
":",
"int",
"The",
"index",
"of",
"the",
"line",
"strip",
"to",
"be",
"replaced",
".",
"data",
":",
"array",
"-",
"like",
"The",
"data",
... | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/scrolling_lines.py#L181-L192 | [
"def",
"set_data",
"(",
"self",
",",
"index",
",",
"data",
")",
":",
"self",
".",
"_pos_tex",
"[",
"index",
",",
":",
"]",
"=",
"data",
"self",
".",
"update",
"(",
")"
] | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | MultiProgram.add_program | Create a program and add it to this MultiProgram.
It is the caller's responsibility to keep a reference to the returned
program.
The *name* must be unique, but is otherwise arbitrary and used for
debugging purposes. | glue_vispy_viewers/extern/vispy/visuals/shaders/multiprogram.py | def add_program(self, name=None):
"""Create a program and add it to this MultiProgram.
It is the caller's responsibility to keep a reference to the returned
program.
The *name* must be unique, but is otherwise arbitrary and used for
debugging purposes.
... | def add_program(self, name=None):
"""Create a program and add it to this MultiProgram.
It is the caller's responsibility to keep a reference to the returned
program.
The *name* must be unique, but is otherwise arbitrary and used for
debugging purposes.
... | [
"Create",
"a",
"program",
"and",
"add",
"it",
"to",
"this",
"MultiProgram",
".",
"It",
"is",
"the",
"caller",
"s",
"responsibility",
"to",
"keep",
"a",
"reference",
"to",
"the",
"returned",
"program",
".",
"The",
"*",
"name",
"*",
"must",
"be",
"unique",... | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/shaders/multiprogram.py#L26-L50 | [
"def",
"add_program",
"(",
"self",
",",
"name",
"=",
"None",
")",
":",
"if",
"name",
"is",
"None",
":",
"name",
"=",
"'program'",
"+",
"str",
"(",
"self",
".",
"_next_prog_id",
")",
"self",
".",
"_next_prog_id",
"+=",
"1",
"if",
"name",
"in",
"self",... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | MultiShader._new_program | New program was added to the multiprogram; update items in the
shader. | glue_vispy_viewers/extern/vispy/visuals/shaders/multiprogram.py | def _new_program(self, p):
"""New program was added to the multiprogram; update items in the
shader.
"""
for k, v in self._set_items.items():
getattr(p, self._shader)[k] = v | def _new_program(self, p):
"""New program was added to the multiprogram; update items in the
shader.
"""
for k, v in self._set_items.items():
getattr(p, self._shader)[k] = v | [
"New",
"program",
"was",
"added",
"to",
"the",
"multiprogram",
";",
"update",
"items",
"in",
"the",
"shader",
"."
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/shaders/multiprogram.py#L125-L130 | [
"def",
"_new_program",
"(",
"self",
",",
"p",
")",
":",
"for",
"k",
",",
"v",
"in",
"self",
".",
"_set_items",
".",
"items",
"(",
")",
":",
"getattr",
"(",
"p",
",",
"self",
".",
"_shader",
")",
"[",
"k",
"]",
"=",
"v"
] | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | PanZoomTransform.attach | Attach this tranform to a canvas
Parameters
----------
canvas : instance of Canvas
The canvas. | glue_vispy_viewers/extern/vispy/visuals/transforms/interactive.py | def attach(self, canvas):
"""Attach this tranform to a canvas
Parameters
----------
canvas : instance of Canvas
The canvas.
"""
self._canvas = canvas
canvas.events.resize.connect(self.on_resize)
canvas.events.mouse_wheel.connect(self.on_mouse_... | def attach(self, canvas):
"""Attach this tranform to a canvas
Parameters
----------
canvas : instance of Canvas
The canvas.
"""
self._canvas = canvas
canvas.events.resize.connect(self.on_resize)
canvas.events.mouse_wheel.connect(self.on_mouse_... | [
"Attach",
"this",
"tranform",
"to",
"a",
"canvas"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/transforms/interactive.py#L28-L39 | [
"def",
"attach",
"(",
"self",
",",
"canvas",
")",
":",
"self",
".",
"_canvas",
"=",
"canvas",
"canvas",
".",
"events",
".",
"resize",
".",
"connect",
"(",
"self",
".",
"on_resize",
")",
"canvas",
".",
"events",
".",
"mouse_wheel",
".",
"connect",
"(",
... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | PanZoomTransform.on_resize | Resize handler
Parameters
----------
event : instance of Event
The event. | glue_vispy_viewers/extern/vispy/visuals/transforms/interactive.py | def on_resize(self, event):
"""Resize handler
Parameters
----------
event : instance of Event
The event.
"""
if self._aspect is None:
return
w, h = self._canvas.size
aspect = self._aspect / (w / h)
self.scale = (self.scale[... | def on_resize(self, event):
"""Resize handler
Parameters
----------
event : instance of Event
The event.
"""
if self._aspect is None:
return
w, h = self._canvas.size
aspect = self._aspect / (w / h)
self.scale = (self.scale[... | [
"Resize",
"handler"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/transforms/interactive.py#L47-L60 | [
"def",
"on_resize",
"(",
"self",
",",
"event",
")",
":",
"if",
"self",
".",
"_aspect",
"is",
"None",
":",
"return",
"w",
",",
"h",
"=",
"self",
".",
"_canvas",
".",
"size",
"aspect",
"=",
"self",
".",
"_aspect",
"/",
"(",
"w",
"/",
"h",
")",
"s... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | PanZoomTransform.on_mouse_move | Mouse move handler
Parameters
----------
event : instance of Event
The event. | glue_vispy_viewers/extern/vispy/visuals/transforms/interactive.py | def on_mouse_move(self, event):
"""Mouse move handler
Parameters
----------
event : instance of Event
The event.
"""
if event.is_dragging:
dxy = event.pos - event.last_event.pos
button = event.press_event.button
if button ... | def on_mouse_move(self, event):
"""Mouse move handler
Parameters
----------
event : instance of Event
The event.
"""
if event.is_dragging:
dxy = event.pos - event.last_event.pos
button = event.press_event.button
if button ... | [
"Mouse",
"move",
"handler"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/transforms/interactive.py#L62-L87 | [
"def",
"on_mouse_move",
"(",
"self",
",",
"event",
")",
":",
"if",
"event",
".",
"is_dragging",
":",
"dxy",
"=",
"event",
".",
"pos",
"-",
"event",
".",
"last_event",
".",
"pos",
"button",
"=",
"event",
".",
"press_event",
".",
"button",
"if",
"button"... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | PanZoomTransform.on_mouse_wheel | Mouse wheel handler
Parameters
----------
event : instance of Event
The event. | glue_vispy_viewers/extern/vispy/visuals/transforms/interactive.py | def on_mouse_wheel(self, event):
"""Mouse wheel handler
Parameters
----------
event : instance of Event
The event.
"""
self.zoom(np.exp(event.delta * (0.01, -0.01)), event.pos) | def on_mouse_wheel(self, event):
"""Mouse wheel handler
Parameters
----------
event : instance of Event
The event.
"""
self.zoom(np.exp(event.delta * (0.01, -0.01)), event.pos) | [
"Mouse",
"wheel",
"handler"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/transforms/interactive.py#L89-L97 | [
"def",
"on_mouse_wheel",
"(",
"self",
",",
"event",
")",
":",
"self",
".",
"zoom",
"(",
"np",
".",
"exp",
"(",
"event",
".",
"delta",
"*",
"(",
"0.01",
",",
"-",
"0.01",
")",
")",
",",
"event",
".",
"pos",
")"
] | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | _frenet_frames | Calculates and returns the tangents, normals and binormals for
the tube. | glue_vispy_viewers/extern/vispy/visuals/tube.py | def _frenet_frames(points, closed):
'''Calculates and returns the tangents, normals and binormals for
the tube.'''
tangents = np.zeros((len(points), 3))
normals = np.zeros((len(points), 3))
epsilon = 0.0001
# Compute tangent vectors for each segment
tangents = np.roll(points, -1, axis=0) -... | def _frenet_frames(points, closed):
'''Calculates and returns the tangents, normals and binormals for
the tube.'''
tangents = np.zeros((len(points), 3))
normals = np.zeros((len(points), 3))
epsilon = 0.0001
# Compute tangent vectors for each segment
tangents = np.roll(points, -1, axis=0) -... | [
"Calculates",
"and",
"returns",
"the",
"tangents",
"normals",
"and",
"binormals",
"for",
"the",
"tube",
"."
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/tube.py#L109-L160 | [
"def",
"_frenet_frames",
"(",
"points",
",",
"closed",
")",
":",
"tangents",
"=",
"np",
".",
"zeros",
"(",
"(",
"len",
"(",
"points",
")",
",",
"3",
")",
")",
"normals",
"=",
"np",
".",
"zeros",
"(",
"(",
"len",
"(",
"points",
")",
",",
"3",
")... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | AbstractMOC.max_order | Depth of the smallest HEALPix cells found in the MOC instance. | mocpy/abstract_moc.py | def max_order(self):
"""
Depth of the smallest HEALPix cells found in the MOC instance.
"""
# TODO: cache value
combo = int(0)
for iv in self._interval_set._intervals:
combo |= iv[0] | iv[1]
ret = AbstractMOC.HPY_MAX_NORDER - (utils.number_trailing_ze... | def max_order(self):
"""
Depth of the smallest HEALPix cells found in the MOC instance.
"""
# TODO: cache value
combo = int(0)
for iv in self._interval_set._intervals:
combo |= iv[0] | iv[1]
ret = AbstractMOC.HPY_MAX_NORDER - (utils.number_trailing_ze... | [
"Depth",
"of",
"the",
"smallest",
"HEALPix",
"cells",
"found",
"in",
"the",
"MOC",
"instance",
"."
] | cds-astro/mocpy | python | https://github.com/cds-astro/mocpy/blob/09472cabe537f6bfdb049eeea64d3ea57b391c21/mocpy/abstract_moc.py#L70-L83 | [
"def",
"max_order",
"(",
"self",
")",
":",
"# TODO: cache value",
"combo",
"=",
"int",
"(",
"0",
")",
"for",
"iv",
"in",
"self",
".",
"_interval_set",
".",
"_intervals",
":",
"combo",
"|=",
"iv",
"[",
"0",
"]",
"|",
"iv",
"[",
"1",
"]",
"ret",
"=",... | 09472cabe537f6bfdb049eeea64d3ea57b391c21 |
train | AbstractMOC.intersection | Intersection between the MOC instance and other MOCs.
Parameters
----------
another_moc : `~mocpy.moc.MOC`
The MOC used for performing the intersection with self.
args : `~mocpy.moc.MOC`
Other additional MOCs to perform the intersection with.
Returns
... | mocpy/abstract_moc.py | def intersection(self, another_moc, *args):
"""
Intersection between the MOC instance and other MOCs.
Parameters
----------
another_moc : `~mocpy.moc.MOC`
The MOC used for performing the intersection with self.
args : `~mocpy.moc.MOC`
Other additi... | def intersection(self, another_moc, *args):
"""
Intersection between the MOC instance and other MOCs.
Parameters
----------
another_moc : `~mocpy.moc.MOC`
The MOC used for performing the intersection with self.
args : `~mocpy.moc.MOC`
Other additi... | [
"Intersection",
"between",
"the",
"MOC",
"instance",
"and",
"other",
"MOCs",
"."
] | cds-astro/mocpy | python | https://github.com/cds-astro/mocpy/blob/09472cabe537f6bfdb049eeea64d3ea57b391c21/mocpy/abstract_moc.py#L85-L105 | [
"def",
"intersection",
"(",
"self",
",",
"another_moc",
",",
"*",
"args",
")",
":",
"interval_set",
"=",
"self",
".",
"_interval_set",
".",
"intersection",
"(",
"another_moc",
".",
"_interval_set",
")",
"for",
"moc",
"in",
"args",
":",
"interval_set",
"=",
... | 09472cabe537f6bfdb049eeea64d3ea57b391c21 |
train | AbstractMOC.union | Union between the MOC instance and other MOCs.
Parameters
----------
another_moc : `~mocpy.moc.MOC`
The MOC used for performing the union with self.
args : `~mocpy.moc.MOC`
Other additional MOCs to perform the union with.
Returns
-------
... | mocpy/abstract_moc.py | def union(self, another_moc, *args):
"""
Union between the MOC instance and other MOCs.
Parameters
----------
another_moc : `~mocpy.moc.MOC`
The MOC used for performing the union with self.
args : `~mocpy.moc.MOC`
Other additional MOCs to perform ... | def union(self, another_moc, *args):
"""
Union between the MOC instance and other MOCs.
Parameters
----------
another_moc : `~mocpy.moc.MOC`
The MOC used for performing the union with self.
args : `~mocpy.moc.MOC`
Other additional MOCs to perform ... | [
"Union",
"between",
"the",
"MOC",
"instance",
"and",
"other",
"MOCs",
"."
] | cds-astro/mocpy | python | https://github.com/cds-astro/mocpy/blob/09472cabe537f6bfdb049eeea64d3ea57b391c21/mocpy/abstract_moc.py#L107-L127 | [
"def",
"union",
"(",
"self",
",",
"another_moc",
",",
"*",
"args",
")",
":",
"interval_set",
"=",
"self",
".",
"_interval_set",
".",
"union",
"(",
"another_moc",
".",
"_interval_set",
")",
"for",
"moc",
"in",
"args",
":",
"interval_set",
"=",
"interval_set... | 09472cabe537f6bfdb049eeea64d3ea57b391c21 |
train | AbstractMOC.difference | Difference between the MOC instance and other MOCs.
Parameters
----------
another_moc : `~mocpy.moc.MOC`
The MOC used that will be substracted to self.
args : `~mocpy.moc.MOC`
Other additional MOCs to perform the difference with.
Returns
-------
... | mocpy/abstract_moc.py | def difference(self, another_moc, *args):
"""
Difference between the MOC instance and other MOCs.
Parameters
----------
another_moc : `~mocpy.moc.MOC`
The MOC used that will be substracted to self.
args : `~mocpy.moc.MOC`
Other additional MOCs to ... | def difference(self, another_moc, *args):
"""
Difference between the MOC instance and other MOCs.
Parameters
----------
another_moc : `~mocpy.moc.MOC`
The MOC used that will be substracted to self.
args : `~mocpy.moc.MOC`
Other additional MOCs to ... | [
"Difference",
"between",
"the",
"MOC",
"instance",
"and",
"other",
"MOCs",
"."
] | cds-astro/mocpy | python | https://github.com/cds-astro/mocpy/blob/09472cabe537f6bfdb049eeea64d3ea57b391c21/mocpy/abstract_moc.py#L129-L149 | [
"def",
"difference",
"(",
"self",
",",
"another_moc",
",",
"*",
"args",
")",
":",
"interval_set",
"=",
"self",
".",
"_interval_set",
".",
"difference",
"(",
"another_moc",
".",
"_interval_set",
")",
"for",
"moc",
"in",
"args",
":",
"interval_set",
"=",
"in... | 09472cabe537f6bfdb049eeea64d3ea57b391c21 |
train | AbstractMOC._neighbour_pixels | Returns all the pixels neighbours of ``ipix`` | mocpy/abstract_moc.py | def _neighbour_pixels(hp, ipix):
"""
Returns all the pixels neighbours of ``ipix``
"""
neigh_ipix = np.unique(hp.neighbours(ipix).ravel())
# Remove negative pixel values returned by `~astropy_healpix.HEALPix.neighbours`
return neigh_ipix[np.where(neigh_ipix >= 0)] | def _neighbour_pixels(hp, ipix):
"""
Returns all the pixels neighbours of ``ipix``
"""
neigh_ipix = np.unique(hp.neighbours(ipix).ravel())
# Remove negative pixel values returned by `~astropy_healpix.HEALPix.neighbours`
return neigh_ipix[np.where(neigh_ipix >= 0)] | [
"Returns",
"all",
"the",
"pixels",
"neighbours",
"of",
"ipix"
] | cds-astro/mocpy | python | https://github.com/cds-astro/mocpy/blob/09472cabe537f6bfdb049eeea64d3ea57b391c21/mocpy/abstract_moc.py#L187-L193 | [
"def",
"_neighbour_pixels",
"(",
"hp",
",",
"ipix",
")",
":",
"neigh_ipix",
"=",
"np",
".",
"unique",
"(",
"hp",
".",
"neighbours",
"(",
"ipix",
")",
".",
"ravel",
"(",
")",
")",
"# Remove negative pixel values returned by `~astropy_healpix.HEALPix.neighbours`",
"... | 09472cabe537f6bfdb049eeea64d3ea57b391c21 |
train | AbstractMOC.from_cells | Creates a MOC from a numpy array representing the HEALPix cells.
Parameters
----------
cells : `numpy.ndarray`
Must be a numpy structured array (See https://docs.scipy.org/doc/numpy-1.15.0/user/basics.rec.html).
The structure of a cell contains 3 attributes:
... | mocpy/abstract_moc.py | def from_cells(cls, cells):
"""
Creates a MOC from a numpy array representing the HEALPix cells.
Parameters
----------
cells : `numpy.ndarray`
Must be a numpy structured array (See https://docs.scipy.org/doc/numpy-1.15.0/user/basics.rec.html).
The structu... | def from_cells(cls, cells):
"""
Creates a MOC from a numpy array representing the HEALPix cells.
Parameters
----------
cells : `numpy.ndarray`
Must be a numpy structured array (See https://docs.scipy.org/doc/numpy-1.15.0/user/basics.rec.html).
The structu... | [
"Creates",
"a",
"MOC",
"from",
"a",
"numpy",
"array",
"representing",
"the",
"HEALPix",
"cells",
"."
] | cds-astro/mocpy | python | https://github.com/cds-astro/mocpy/blob/09472cabe537f6bfdb049eeea64d3ea57b391c21/mocpy/abstract_moc.py#L196-L222 | [
"def",
"from_cells",
"(",
"cls",
",",
"cells",
")",
":",
"shift",
"=",
"(",
"AbstractMOC",
".",
"HPY_MAX_NORDER",
"-",
"cells",
"[",
"\"depth\"",
"]",
")",
"<<",
"1",
"p1",
"=",
"cells",
"[",
"\"ipix\"",
"]",
"p2",
"=",
"cells",
"[",
"\"ipix\"",
"]",... | 09472cabe537f6bfdb049eeea64d3ea57b391c21 |
train | AbstractMOC.from_json | Creates a MOC from a dictionary of HEALPix cell arrays indexed by their depth.
Parameters
----------
json_moc : dict(str : [int]
A dictionary of HEALPix cell arrays indexed by their depth.
Returns
-------
moc : `~mocpy.moc.MOC` or `~mocpy.tmoc.TimeMOC`
... | mocpy/abstract_moc.py | def from_json(cls, json_moc):
"""
Creates a MOC from a dictionary of HEALPix cell arrays indexed by their depth.
Parameters
----------
json_moc : dict(str : [int]
A dictionary of HEALPix cell arrays indexed by their depth.
Returns
-------
moc... | def from_json(cls, json_moc):
"""
Creates a MOC from a dictionary of HEALPix cell arrays indexed by their depth.
Parameters
----------
json_moc : dict(str : [int]
A dictionary of HEALPix cell arrays indexed by their depth.
Returns
-------
moc... | [
"Creates",
"a",
"MOC",
"from",
"a",
"dictionary",
"of",
"HEALPix",
"cell",
"arrays",
"indexed",
"by",
"their",
"depth",
"."
] | cds-astro/mocpy | python | https://github.com/cds-astro/mocpy/blob/09472cabe537f6bfdb049eeea64d3ea57b391c21/mocpy/abstract_moc.py#L225-L254 | [
"def",
"from_json",
"(",
"cls",
",",
"json_moc",
")",
":",
"intervals",
"=",
"np",
".",
"array",
"(",
"[",
"]",
")",
"for",
"order",
",",
"pix_l",
"in",
"json_moc",
".",
"items",
"(",
")",
":",
"if",
"len",
"(",
"pix_l",
")",
"==",
"0",
":",
"c... | 09472cabe537f6bfdb049eeea64d3ea57b391c21 |
train | AbstractMOC._uniq_pixels_iterator | Generator giving the NUNIQ HEALPix pixels of the MOC.
Returns
-------
uniq :
the NUNIQ HEALPix pixels iterator | mocpy/abstract_moc.py | def _uniq_pixels_iterator(self):
"""
Generator giving the NUNIQ HEALPix pixels of the MOC.
Returns
-------
uniq :
the NUNIQ HEALPix pixels iterator
"""
intervals_uniq_l = IntervalSet.to_nuniq_interval_set(self._interval_set)._intervals
for uni... | def _uniq_pixels_iterator(self):
"""
Generator giving the NUNIQ HEALPix pixels of the MOC.
Returns
-------
uniq :
the NUNIQ HEALPix pixels iterator
"""
intervals_uniq_l = IntervalSet.to_nuniq_interval_set(self._interval_set)._intervals
for uni... | [
"Generator",
"giving",
"the",
"NUNIQ",
"HEALPix",
"pixels",
"of",
"the",
"MOC",
"."
] | cds-astro/mocpy | python | https://github.com/cds-astro/mocpy/blob/09472cabe537f6bfdb049eeea64d3ea57b391c21/mocpy/abstract_moc.py#L256-L268 | [
"def",
"_uniq_pixels_iterator",
"(",
"self",
")",
":",
"intervals_uniq_l",
"=",
"IntervalSet",
".",
"to_nuniq_interval_set",
"(",
"self",
".",
"_interval_set",
")",
".",
"_intervals",
"for",
"uniq_iv",
"in",
"intervals_uniq_l",
":",
"for",
"uniq",
"in",
"range",
... | 09472cabe537f6bfdb049eeea64d3ea57b391c21 |
train | AbstractMOC.from_fits | Loads a MOC from a FITS file.
The specified FITS file must store the MOC (i.e. the list of HEALPix cells it contains) in a binary HDU table.
Parameters
----------
filename : str
The path to the FITS file.
Returns
-------
result : `~mocpy.moc.MOC` or... | mocpy/abstract_moc.py | def from_fits(cls, filename):
"""
Loads a MOC from a FITS file.
The specified FITS file must store the MOC (i.e. the list of HEALPix cells it contains) in a binary HDU table.
Parameters
----------
filename : str
The path to the FITS file.
Returns
... | def from_fits(cls, filename):
"""
Loads a MOC from a FITS file.
The specified FITS file must store the MOC (i.e. the list of HEALPix cells it contains) in a binary HDU table.
Parameters
----------
filename : str
The path to the FITS file.
Returns
... | [
"Loads",
"a",
"MOC",
"from",
"a",
"FITS",
"file",
"."
] | cds-astro/mocpy | python | https://github.com/cds-astro/mocpy/blob/09472cabe537f6bfdb049eeea64d3ea57b391c21/mocpy/abstract_moc.py#L271-L293 | [
"def",
"from_fits",
"(",
"cls",
",",
"filename",
")",
":",
"table",
"=",
"Table",
".",
"read",
"(",
"filename",
")",
"intervals",
"=",
"np",
".",
"vstack",
"(",
"(",
"table",
"[",
"'UNIQ'",
"]",
",",
"table",
"[",
"'UNIQ'",
"]",
"+",
"1",
")",
")... | 09472cabe537f6bfdb049eeea64d3ea57b391c21 |
train | AbstractMOC.from_str | Create a MOC from a str.
This grammar is expressed is the `MOC IVOA <http://ivoa.net/documents/MOC/20190215/WD-MOC-1.1-20190215.pdf>`__
specification at section 2.3.2.
Parameters
----------
value : str
The MOC as a string following the grammar rules.
... | mocpy/abstract_moc.py | def from_str(cls, value):
"""
Create a MOC from a str.
This grammar is expressed is the `MOC IVOA <http://ivoa.net/documents/MOC/20190215/WD-MOC-1.1-20190215.pdf>`__
specification at section 2.3.2.
Parameters
----------
value : str
The MOC as... | def from_str(cls, value):
"""
Create a MOC from a str.
This grammar is expressed is the `MOC IVOA <http://ivoa.net/documents/MOC/20190215/WD-MOC-1.1-20190215.pdf>`__
specification at section 2.3.2.
Parameters
----------
value : str
The MOC as... | [
"Create",
"a",
"MOC",
"from",
"a",
"str",
".",
"This",
"grammar",
"is",
"expressed",
"is",
"the",
"MOC",
"IVOA",
"<http",
":",
"//",
"ivoa",
".",
"net",
"/",
"documents",
"/",
"MOC",
"/",
"20190215",
"/",
"WD",
"-",
"MOC",
"-",
"1",
".",
"1",
"-"... | cds-astro/mocpy | python | https://github.com/cds-astro/mocpy/blob/09472cabe537f6bfdb049eeea64d3ea57b391c21/mocpy/abstract_moc.py#L296-L377 | [
"def",
"from_str",
"(",
"cls",
",",
"value",
")",
":",
"# Import lark parser when from_str is called",
"# at least one time",
"from",
"lark",
"import",
"Lark",
",",
"Transformer",
"class",
"ParsingException",
"(",
"Exception",
")",
":",
"pass",
"class",
"TreeToJson",
... | 09472cabe537f6bfdb049eeea64d3ea57b391c21 |
train | AbstractMOC._to_json | Serializes a MOC to the JSON format.
Parameters
----------
uniq : `~numpy.ndarray`
The array of HEALPix cells representing the MOC to serialize.
Returns
-------
result_json : {str : [int]}
A dictionary of HEALPix cell lists indexed by their depth... | mocpy/abstract_moc.py | def _to_json(uniq):
"""
Serializes a MOC to the JSON format.
Parameters
----------
uniq : `~numpy.ndarray`
The array of HEALPix cells representing the MOC to serialize.
Returns
-------
result_json : {str : [int]}
A dictionary of H... | def _to_json(uniq):
"""
Serializes a MOC to the JSON format.
Parameters
----------
uniq : `~numpy.ndarray`
The array of HEALPix cells representing the MOC to serialize.
Returns
-------
result_json : {str : [int]}
A dictionary of H... | [
"Serializes",
"a",
"MOC",
"to",
"the",
"JSON",
"format",
"."
] | cds-astro/mocpy | python | https://github.com/cds-astro/mocpy/blob/09472cabe537f6bfdb049eeea64d3ea57b391c21/mocpy/abstract_moc.py#L380-L407 | [
"def",
"_to_json",
"(",
"uniq",
")",
":",
"result_json",
"=",
"{",
"}",
"depth",
",",
"ipix",
"=",
"utils",
".",
"uniq2orderipix",
"(",
"uniq",
")",
"min_depth",
"=",
"np",
".",
"min",
"(",
"depth",
"[",
"0",
"]",
")",
"max_depth",
"=",
"np",
".",
... | 09472cabe537f6bfdb049eeea64d3ea57b391c21 |
train | AbstractMOC._to_str | Serializes a MOC to the STRING format.
HEALPix cells are separated by a comma. The HEALPix cell at order 0 and number 10 is encoded
by the string: "0/10", the first digit representing the depth and the second the HEALPix cell number
for this depth. HEALPix cells next to each other within a spec... | mocpy/abstract_moc.py | def _to_str(uniq):
"""
Serializes a MOC to the STRING format.
HEALPix cells are separated by a comma. The HEALPix cell at order 0 and number 10 is encoded
by the string: "0/10", the first digit representing the depth and the second the HEALPix cell number
for this depth. HEALPix... | def _to_str(uniq):
"""
Serializes a MOC to the STRING format.
HEALPix cells are separated by a comma. The HEALPix cell at order 0 and number 10 is encoded
by the string: "0/10", the first digit representing the depth and the second the HEALPix cell number
for this depth. HEALPix... | [
"Serializes",
"a",
"MOC",
"to",
"the",
"STRING",
"format",
"."
] | cds-astro/mocpy | python | https://github.com/cds-astro/mocpy/blob/09472cabe537f6bfdb049eeea64d3ea57b391c21/mocpy/abstract_moc.py#L410-L487 | [
"def",
"_to_str",
"(",
"uniq",
")",
":",
"def",
"write_cells",
"(",
"serial",
",",
"a",
",",
"b",
",",
"sep",
"=",
"''",
")",
":",
"if",
"a",
"==",
"b",
":",
"serial",
"+=",
"'{0}{1}'",
".",
"format",
"(",
"a",
",",
"sep",
")",
"else",
":",
"... | 09472cabe537f6bfdb049eeea64d3ea57b391c21 |
train | AbstractMOC._to_fits | Serializes a MOC to the FITS format.
Parameters
----------
uniq : `numpy.ndarray`
The array of HEALPix cells representing the MOC to serialize.
optional_kw_dict : dict
Optional keywords arguments added to the FITS header.
Returns
-------
... | mocpy/abstract_moc.py | def _to_fits(self, uniq, optional_kw_dict=None):
"""
Serializes a MOC to the FITS format.
Parameters
----------
uniq : `numpy.ndarray`
The array of HEALPix cells representing the MOC to serialize.
optional_kw_dict : dict
Optional keywords argument... | def _to_fits(self, uniq, optional_kw_dict=None):
"""
Serializes a MOC to the FITS format.
Parameters
----------
uniq : `numpy.ndarray`
The array of HEALPix cells representing the MOC to serialize.
optional_kw_dict : dict
Optional keywords argument... | [
"Serializes",
"a",
"MOC",
"to",
"the",
"FITS",
"format",
"."
] | cds-astro/mocpy | python | https://github.com/cds-astro/mocpy/blob/09472cabe537f6bfdb049eeea64d3ea57b391c21/mocpy/abstract_moc.py#L489-L525 | [
"def",
"_to_fits",
"(",
"self",
",",
"uniq",
",",
"optional_kw_dict",
"=",
"None",
")",
":",
"depth",
"=",
"self",
".",
"max_order",
"if",
"depth",
"<=",
"13",
":",
"fits_format",
"=",
"'1J'",
"else",
":",
"fits_format",
"=",
"'1K'",
"tbhdu",
"=",
"fit... | 09472cabe537f6bfdb049eeea64d3ea57b391c21 |
train | AbstractMOC.serialize | Serializes the MOC into a specific format.
Possible formats are FITS, JSON and STRING
Parameters
----------
format : str
'fits' by default. The other possible choice is 'json' or 'str'.
optional_kw_dict : dict
Optional keywords arguments added to the FIT... | mocpy/abstract_moc.py | def serialize(self, format='fits', optional_kw_dict=None):
"""
Serializes the MOC into a specific format.
Possible formats are FITS, JSON and STRING
Parameters
----------
format : str
'fits' by default. The other possible choice is 'json' or 'str'.
o... | def serialize(self, format='fits', optional_kw_dict=None):
"""
Serializes the MOC into a specific format.
Possible formats are FITS, JSON and STRING
Parameters
----------
format : str
'fits' by default. The other possible choice is 'json' or 'str'.
o... | [
"Serializes",
"the",
"MOC",
"into",
"a",
"specific",
"format",
"."
] | cds-astro/mocpy | python | https://github.com/cds-astro/mocpy/blob/09472cabe537f6bfdb049eeea64d3ea57b391c21/mocpy/abstract_moc.py#L527-L564 | [
"def",
"serialize",
"(",
"self",
",",
"format",
"=",
"'fits'",
",",
"optional_kw_dict",
"=",
"None",
")",
":",
"formats",
"=",
"(",
"'fits'",
",",
"'json'",
",",
"'str'",
")",
"if",
"format",
"not",
"in",
"formats",
":",
"raise",
"ValueError",
"(",
"'f... | 09472cabe537f6bfdb049eeea64d3ea57b391c21 |
train | AbstractMOC.write | Writes the MOC to a file.
Format can be 'fits' or 'json', though only the fits format is officially supported by the IVOA.
Parameters
----------
path : str, optional
The path to the file to save the MOC in.
format : str, optional
The format in which the ... | mocpy/abstract_moc.py | def write(self, path, format='fits', overwrite=False, optional_kw_dict=None):
"""
Writes the MOC to a file.
Format can be 'fits' or 'json', though only the fits format is officially supported by the IVOA.
Parameters
----------
path : str, optional
The path t... | def write(self, path, format='fits', overwrite=False, optional_kw_dict=None):
"""
Writes the MOC to a file.
Format can be 'fits' or 'json', though only the fits format is officially supported by the IVOA.
Parameters
----------
path : str, optional
The path t... | [
"Writes",
"the",
"MOC",
"to",
"a",
"file",
"."
] | cds-astro/mocpy | python | https://github.com/cds-astro/mocpy/blob/09472cabe537f6bfdb049eeea64d3ea57b391c21/mocpy/abstract_moc.py#L566-L590 | [
"def",
"write",
"(",
"self",
",",
"path",
",",
"format",
"=",
"'fits'",
",",
"overwrite",
"=",
"False",
",",
"optional_kw_dict",
"=",
"None",
")",
":",
"serialization",
"=",
"self",
".",
"serialize",
"(",
"format",
"=",
"format",
",",
"optional_kw_dict",
... | 09472cabe537f6bfdb049eeea64d3ea57b391c21 |
train | AbstractMOC.degrade_to_order | Degrades the MOC instance to a new, less precise, MOC.
The maximum depth (i.e. the depth of the smallest HEALPix cells that can be found in the MOC) of the
degraded MOC is set to ``new_order``.
Parameters
----------
new_order : int
Maximum depth of the output degra... | mocpy/abstract_moc.py | def degrade_to_order(self, new_order):
"""
Degrades the MOC instance to a new, less precise, MOC.
The maximum depth (i.e. the depth of the smallest HEALPix cells that can be found in the MOC) of the
degraded MOC is set to ``new_order``.
Parameters
----------
ne... | def degrade_to_order(self, new_order):
"""
Degrades the MOC instance to a new, less precise, MOC.
The maximum depth (i.e. the depth of the smallest HEALPix cells that can be found in the MOC) of the
degraded MOC is set to ``new_order``.
Parameters
----------
ne... | [
"Degrades",
"the",
"MOC",
"instance",
"to",
"a",
"new",
"less",
"precise",
"MOC",
"."
] | cds-astro/mocpy | python | https://github.com/cds-astro/mocpy/blob/09472cabe537f6bfdb049eeea64d3ea57b391c21/mocpy/abstract_moc.py#L592-L623 | [
"def",
"degrade_to_order",
"(",
"self",
",",
"new_order",
")",
":",
"shift",
"=",
"2",
"*",
"(",
"AbstractMOC",
".",
"HPY_MAX_NORDER",
"-",
"new_order",
")",
"ofs",
"=",
"(",
"int",
"(",
"1",
")",
"<<",
"shift",
")",
"-",
"1",
"mask",
"=",
"~",
"of... | 09472cabe537f6bfdb049eeea64d3ea57b391c21 |
train | Screen.set_name | Set Screen Name | mpdlcd/vendor/lcdproc/screen.py | def set_name(self, name):
""" Set Screen Name """
self.name = name
self.server.request("screen_set %s name %s" % (self.ref, self.name)) | def set_name(self, name):
""" Set Screen Name """
self.name = name
self.server.request("screen_set %s name %s" % (self.ref, self.name)) | [
"Set",
"Screen",
"Name"
] | rbarrois/mpdlcd | python | https://github.com/rbarrois/mpdlcd/blob/85f16c8cc0883f8abb4c2cc7f69729c3e2f857da/mpdlcd/vendor/lcdproc/screen.py#L53-L57 | [
"def",
"set_name",
"(",
"self",
",",
"name",
")",
":",
"self",
".",
"name",
"=",
"name",
"self",
".",
"server",
".",
"request",
"(",
"\"screen_set %s name %s\"",
"%",
"(",
"self",
".",
"ref",
",",
"self",
".",
"name",
")",
")"
] | 85f16c8cc0883f8abb4c2cc7f69729c3e2f857da |
train | Screen.set_width | Set Screen Width | mpdlcd/vendor/lcdproc/screen.py | def set_width(self, width):
""" Set Screen Width """
if width > 0 and width <= self.server.server_info.get("screen_width"):
self.width = width
self.server.request("screen_set %s wid %i" % (self.ref, self.width)) | def set_width(self, width):
""" Set Screen Width """
if width > 0 and width <= self.server.server_info.get("screen_width"):
self.width = width
self.server.request("screen_set %s wid %i" % (self.ref, self.width)) | [
"Set",
"Screen",
"Width"
] | rbarrois/mpdlcd | python | https://github.com/rbarrois/mpdlcd/blob/85f16c8cc0883f8abb4c2cc7f69729c3e2f857da/mpdlcd/vendor/lcdproc/screen.py#L59-L64 | [
"def",
"set_width",
"(",
"self",
",",
"width",
")",
":",
"if",
"width",
">",
"0",
"and",
"width",
"<=",
"self",
".",
"server",
".",
"server_info",
".",
"get",
"(",
"\"screen_width\"",
")",
":",
"self",
".",
"width",
"=",
"width",
"self",
".",
"server... | 85f16c8cc0883f8abb4c2cc7f69729c3e2f857da |
train | Screen.set_height | Set Screen Height | mpdlcd/vendor/lcdproc/screen.py | def set_height(self, height):
""" Set Screen Height """
if height > 0 and height <= self.server.server_info.get("screen_height"):
self.height = height
self.server.request("screen_set %s hgt %i" % (self.ref, self.height)) | def set_height(self, height):
""" Set Screen Height """
if height > 0 and height <= self.server.server_info.get("screen_height"):
self.height = height
self.server.request("screen_set %s hgt %i" % (self.ref, self.height)) | [
"Set",
"Screen",
"Height"
] | rbarrois/mpdlcd | python | https://github.com/rbarrois/mpdlcd/blob/85f16c8cc0883f8abb4c2cc7f69729c3e2f857da/mpdlcd/vendor/lcdproc/screen.py#L66-L71 | [
"def",
"set_height",
"(",
"self",
",",
"height",
")",
":",
"if",
"height",
">",
"0",
"and",
"height",
"<=",
"self",
".",
"server",
".",
"server_info",
".",
"get",
"(",
"\"screen_height\"",
")",
":",
"self",
".",
"height",
"=",
"height",
"self",
".",
... | 85f16c8cc0883f8abb4c2cc7f69729c3e2f857da |
train | Screen.set_cursor_x | Set Screen Cursor X Position | mpdlcd/vendor/lcdproc/screen.py | def set_cursor_x(self, x):
""" Set Screen Cursor X Position """
if x >= 0 and x <= self.server.server_info.get("screen_width"):
self.cursor_x = x
self.server.request("screen_set %s cursor_x %i" % (self.ref, self.cursor_x)) | def set_cursor_x(self, x):
""" Set Screen Cursor X Position """
if x >= 0 and x <= self.server.server_info.get("screen_width"):
self.cursor_x = x
self.server.request("screen_set %s cursor_x %i" % (self.ref, self.cursor_x)) | [
"Set",
"Screen",
"Cursor",
"X",
"Position"
] | rbarrois/mpdlcd | python | https://github.com/rbarrois/mpdlcd/blob/85f16c8cc0883f8abb4c2cc7f69729c3e2f857da/mpdlcd/vendor/lcdproc/screen.py#L73-L78 | [
"def",
"set_cursor_x",
"(",
"self",
",",
"x",
")",
":",
"if",
"x",
">=",
"0",
"and",
"x",
"<=",
"self",
".",
"server",
".",
"server_info",
".",
"get",
"(",
"\"screen_width\"",
")",
":",
"self",
".",
"cursor_x",
"=",
"x",
"self",
".",
"server",
".",... | 85f16c8cc0883f8abb4c2cc7f69729c3e2f857da |
train | Screen.set_cursor_y | Set Screen Cursor Y Position | mpdlcd/vendor/lcdproc/screen.py | def set_cursor_y(self, y):
""" Set Screen Cursor Y Position """
if y >= 0 and y <= self.server.server_info.get("screen_height"):
self.cursor_y = y
self.server.request("screen_set %s cursor_y %i" % (self.ref, self.cursor_y)) | def set_cursor_y(self, y):
""" Set Screen Cursor Y Position """
if y >= 0 and y <= self.server.server_info.get("screen_height"):
self.cursor_y = y
self.server.request("screen_set %s cursor_y %i" % (self.ref, self.cursor_y)) | [
"Set",
"Screen",
"Cursor",
"Y",
"Position"
] | rbarrois/mpdlcd | python | https://github.com/rbarrois/mpdlcd/blob/85f16c8cc0883f8abb4c2cc7f69729c3e2f857da/mpdlcd/vendor/lcdproc/screen.py#L80-L85 | [
"def",
"set_cursor_y",
"(",
"self",
",",
"y",
")",
":",
"if",
"y",
">=",
"0",
"and",
"y",
"<=",
"self",
".",
"server",
".",
"server_info",
".",
"get",
"(",
"\"screen_height\"",
")",
":",
"self",
".",
"cursor_y",
"=",
"y",
"self",
".",
"server",
"."... | 85f16c8cc0883f8abb4c2cc7f69729c3e2f857da |
train | Screen.set_duration | Set Screen Change Interval Duration | mpdlcd/vendor/lcdproc/screen.py | def set_duration(self, duration):
""" Set Screen Change Interval Duration """
if duration > 0:
self.duration = duration
self.server.request("screen_set %s duration %i" % (self.ref, (self.duration * 8))) | def set_duration(self, duration):
""" Set Screen Change Interval Duration """
if duration > 0:
self.duration = duration
self.server.request("screen_set %s duration %i" % (self.ref, (self.duration * 8))) | [
"Set",
"Screen",
"Change",
"Interval",
"Duration"
] | rbarrois/mpdlcd | python | https://github.com/rbarrois/mpdlcd/blob/85f16c8cc0883f8abb4c2cc7f69729c3e2f857da/mpdlcd/vendor/lcdproc/screen.py#L87-L92 | [
"def",
"set_duration",
"(",
"self",
",",
"duration",
")",
":",
"if",
"duration",
">",
"0",
":",
"self",
".",
"duration",
"=",
"duration",
"self",
".",
"server",
".",
"request",
"(",
"\"screen_set %s duration %i\"",
"%",
"(",
"self",
".",
"ref",
",",
"(",... | 85f16c8cc0883f8abb4c2cc7f69729c3e2f857da |
train | Screen.set_timeout | Set Screen Timeout Duration | mpdlcd/vendor/lcdproc/screen.py | def set_timeout(self, timeout):
""" Set Screen Timeout Duration """
if timeout > 0:
self.timeout = timeout
self.server.request("screen_set %s timeout %i" % (self.ref, (self.timeout * 8))) | def set_timeout(self, timeout):
""" Set Screen Timeout Duration """
if timeout > 0:
self.timeout = timeout
self.server.request("screen_set %s timeout %i" % (self.ref, (self.timeout * 8))) | [
"Set",
"Screen",
"Timeout",
"Duration"
] | rbarrois/mpdlcd | python | https://github.com/rbarrois/mpdlcd/blob/85f16c8cc0883f8abb4c2cc7f69729c3e2f857da/mpdlcd/vendor/lcdproc/screen.py#L94-L99 | [
"def",
"set_timeout",
"(",
"self",
",",
"timeout",
")",
":",
"if",
"timeout",
">",
"0",
":",
"self",
".",
"timeout",
"=",
"timeout",
"self",
".",
"server",
".",
"request",
"(",
"\"screen_set %s timeout %i\"",
"%",
"(",
"self",
".",
"ref",
",",
"(",
"se... | 85f16c8cc0883f8abb4c2cc7f69729c3e2f857da |
train | Screen.set_priority | Set Screen Priority Class | mpdlcd/vendor/lcdproc/screen.py | def set_priority(self, priority):
""" Set Screen Priority Class """
if priority in ["hidden", "background", "info", "foreground", "alert", "input"]:
self.priority = priority
self.server.request("screen_set %s priority %s" % (self.ref, self.priority)) | def set_priority(self, priority):
""" Set Screen Priority Class """
if priority in ["hidden", "background", "info", "foreground", "alert", "input"]:
self.priority = priority
self.server.request("screen_set %s priority %s" % (self.ref, self.priority)) | [
"Set",
"Screen",
"Priority",
"Class"
] | rbarrois/mpdlcd | python | https://github.com/rbarrois/mpdlcd/blob/85f16c8cc0883f8abb4c2cc7f69729c3e2f857da/mpdlcd/vendor/lcdproc/screen.py#L101-L106 | [
"def",
"set_priority",
"(",
"self",
",",
"priority",
")",
":",
"if",
"priority",
"in",
"[",
"\"hidden\"",
",",
"\"background\"",
",",
"\"info\"",
",",
"\"foreground\"",
",",
"\"alert\"",
",",
"\"input\"",
"]",
":",
"self",
".",
"priority",
"=",
"priority",
... | 85f16c8cc0883f8abb4c2cc7f69729c3e2f857da |
train | Screen.set_backlight | Set Screen Backlight Mode | mpdlcd/vendor/lcdproc/screen.py | def set_backlight(self, state):
""" Set Screen Backlight Mode """
if state in ["on", "off", "toggle", "open", "blink", "flash"]:
self.backlight = state
self.server.request("screen_set %s backlight %s" % (self.ref, self.backlight)) | def set_backlight(self, state):
""" Set Screen Backlight Mode """
if state in ["on", "off", "toggle", "open", "blink", "flash"]:
self.backlight = state
self.server.request("screen_set %s backlight %s" % (self.ref, self.backlight)) | [
"Set",
"Screen",
"Backlight",
"Mode"
] | rbarrois/mpdlcd | python | https://github.com/rbarrois/mpdlcd/blob/85f16c8cc0883f8abb4c2cc7f69729c3e2f857da/mpdlcd/vendor/lcdproc/screen.py#L108-L113 | [
"def",
"set_backlight",
"(",
"self",
",",
"state",
")",
":",
"if",
"state",
"in",
"[",
"\"on\"",
",",
"\"off\"",
",",
"\"toggle\"",
",",
"\"open\"",
",",
"\"blink\"",
",",
"\"flash\"",
"]",
":",
"self",
".",
"backlight",
"=",
"state",
"self",
".",
"ser... | 85f16c8cc0883f8abb4c2cc7f69729c3e2f857da |
train | Screen.set_heartbeat | Set Screen Heartbeat Display Mode | mpdlcd/vendor/lcdproc/screen.py | def set_heartbeat(self, state):
""" Set Screen Heartbeat Display Mode """
if state in ["on", "off", "open"]:
self.heartbeat = state
self.server.request("screen_set %s heartbeat %s" % (self.ref, self.heartbeat)) | def set_heartbeat(self, state):
""" Set Screen Heartbeat Display Mode """
if state in ["on", "off", "open"]:
self.heartbeat = state
self.server.request("screen_set %s heartbeat %s" % (self.ref, self.heartbeat)) | [
"Set",
"Screen",
"Heartbeat",
"Display",
"Mode"
] | rbarrois/mpdlcd | python | https://github.com/rbarrois/mpdlcd/blob/85f16c8cc0883f8abb4c2cc7f69729c3e2f857da/mpdlcd/vendor/lcdproc/screen.py#L115-L120 | [
"def",
"set_heartbeat",
"(",
"self",
",",
"state",
")",
":",
"if",
"state",
"in",
"[",
"\"on\"",
",",
"\"off\"",
",",
"\"open\"",
"]",
":",
"self",
".",
"heartbeat",
"=",
"state",
"self",
".",
"server",
".",
"request",
"(",
"\"screen_set %s heartbeat %s\""... | 85f16c8cc0883f8abb4c2cc7f69729c3e2f857da |
train | Screen.set_cursor | Set Screen Cursor Mode | mpdlcd/vendor/lcdproc/screen.py | def set_cursor(self, cursor):
""" Set Screen Cursor Mode """
if cursor in ["on", "off", "under", "block"]:
self.cursor = cursor
self.server.request("screen_set %s cursor %s" % (self.ref, self.cursor)) | def set_cursor(self, cursor):
""" Set Screen Cursor Mode """
if cursor in ["on", "off", "under", "block"]:
self.cursor = cursor
self.server.request("screen_set %s cursor %s" % (self.ref, self.cursor)) | [
"Set",
"Screen",
"Cursor",
"Mode"
] | rbarrois/mpdlcd | python | https://github.com/rbarrois/mpdlcd/blob/85f16c8cc0883f8abb4c2cc7f69729c3e2f857da/mpdlcd/vendor/lcdproc/screen.py#L122-L127 | [
"def",
"set_cursor",
"(",
"self",
",",
"cursor",
")",
":",
"if",
"cursor",
"in",
"[",
"\"on\"",
",",
"\"off\"",
",",
"\"under\"",
",",
"\"block\"",
"]",
":",
"self",
".",
"cursor",
"=",
"cursor",
"self",
".",
"server",
".",
"request",
"(",
"\"screen_se... | 85f16c8cc0883f8abb4c2cc7f69729c3e2f857da |
train | Screen.clear | Clear Screen | mpdlcd/vendor/lcdproc/screen.py | def clear(self):
""" Clear Screen """
widgets.StringWidget(self, ref="_w1_", text=" " * 20, x=1, y=1)
widgets.StringWidget(self, ref="_w2_", text=" " * 20, x=1, y=2)
widgets.StringWidget(self, ref="_w3_", text=" " * 20, x=1, y=3)
widgets.StringWidget(self, ref="_w4_", text=" " * ... | def clear(self):
""" Clear Screen """
widgets.StringWidget(self, ref="_w1_", text=" " * 20, x=1, y=1)
widgets.StringWidget(self, ref="_w2_", text=" " * 20, x=1, y=2)
widgets.StringWidget(self, ref="_w3_", text=" " * 20, x=1, y=3)
widgets.StringWidget(self, ref="_w4_", text=" " * ... | [
"Clear",
"Screen"
] | rbarrois/mpdlcd | python | https://github.com/rbarrois/mpdlcd/blob/85f16c8cc0883f8abb4c2cc7f69729c3e2f857da/mpdlcd/vendor/lcdproc/screen.py#L129-L134 | [
"def",
"clear",
"(",
"self",
")",
":",
"widgets",
".",
"StringWidget",
"(",
"self",
",",
"ref",
"=",
"\"_w1_\"",
",",
"text",
"=",
"\" \"",
"*",
"20",
",",
"x",
"=",
"1",
",",
"y",
"=",
"1",
")",
"widgets",
".",
"StringWidget",
"(",
"self",
",",
... | 85f16c8cc0883f8abb4c2cc7f69729c3e2f857da |
train | Screen.add_string_widget | Add String Widget | mpdlcd/vendor/lcdproc/screen.py | def add_string_widget(self, ref, text="Text", x=1, y=1):
""" Add String Widget """
if ref not in self.widgets:
widget = widgets.StringWidget(screen=self, ref=ref, text=text, x=x, y=y)
self.widgets[ref] = widget
return self.widgets[ref] | def add_string_widget(self, ref, text="Text", x=1, y=1):
""" Add String Widget """
if ref not in self.widgets:
widget = widgets.StringWidget(screen=self, ref=ref, text=text, x=x, y=y)
self.widgets[ref] = widget
return self.widgets[ref] | [
"Add",
"String",
"Widget"
] | rbarrois/mpdlcd | python | https://github.com/rbarrois/mpdlcd/blob/85f16c8cc0883f8abb4c2cc7f69729c3e2f857da/mpdlcd/vendor/lcdproc/screen.py#L136-L142 | [
"def",
"add_string_widget",
"(",
"self",
",",
"ref",
",",
"text",
"=",
"\"Text\"",
",",
"x",
"=",
"1",
",",
"y",
"=",
"1",
")",
":",
"if",
"ref",
"not",
"in",
"self",
".",
"widgets",
":",
"widget",
"=",
"widgets",
".",
"StringWidget",
"(",
"screen"... | 85f16c8cc0883f8abb4c2cc7f69729c3e2f857da |
train | Screen.add_title_widget | Add Title Widget | mpdlcd/vendor/lcdproc/screen.py | def add_title_widget(self, ref, text="Title"):
""" Add Title Widget """
if ref not in self.widgets:
widget = widgets.TitleWidget(screen=self, ref=ref, text=text)
self.widgets[ref] = widget
return self.widgets[ref] | def add_title_widget(self, ref, text="Title"):
""" Add Title Widget """
if ref not in self.widgets:
widget = widgets.TitleWidget(screen=self, ref=ref, text=text)
self.widgets[ref] = widget
return self.widgets[ref] | [
"Add",
"Title",
"Widget"
] | rbarrois/mpdlcd | python | https://github.com/rbarrois/mpdlcd/blob/85f16c8cc0883f8abb4c2cc7f69729c3e2f857da/mpdlcd/vendor/lcdproc/screen.py#L144-L150 | [
"def",
"add_title_widget",
"(",
"self",
",",
"ref",
",",
"text",
"=",
"\"Title\"",
")",
":",
"if",
"ref",
"not",
"in",
"self",
".",
"widgets",
":",
"widget",
"=",
"widgets",
".",
"TitleWidget",
"(",
"screen",
"=",
"self",
",",
"ref",
"=",
"ref",
",",... | 85f16c8cc0883f8abb4c2cc7f69729c3e2f857da |
train | Screen.add_hbar_widget | Add Horizontal Bar Widget | mpdlcd/vendor/lcdproc/screen.py | def add_hbar_widget(self, ref, x=1, y=1, length=10):
""" Add Horizontal Bar Widget """
if ref not in self.widgets:
widget = widgets.HBarWidget(screen=self, ref=ref, x=x, y=y, length=length)
self.widgets[ref] = widget
return self.widgets[ref] | def add_hbar_widget(self, ref, x=1, y=1, length=10):
""" Add Horizontal Bar Widget """
if ref not in self.widgets:
widget = widgets.HBarWidget(screen=self, ref=ref, x=x, y=y, length=length)
self.widgets[ref] = widget
return self.widgets[ref] | [
"Add",
"Horizontal",
"Bar",
"Widget"
] | rbarrois/mpdlcd | python | https://github.com/rbarrois/mpdlcd/blob/85f16c8cc0883f8abb4c2cc7f69729c3e2f857da/mpdlcd/vendor/lcdproc/screen.py#L152-L158 | [
"def",
"add_hbar_widget",
"(",
"self",
",",
"ref",
",",
"x",
"=",
"1",
",",
"y",
"=",
"1",
",",
"length",
"=",
"10",
")",
":",
"if",
"ref",
"not",
"in",
"self",
".",
"widgets",
":",
"widget",
"=",
"widgets",
".",
"HBarWidget",
"(",
"screen",
"=",... | 85f16c8cc0883f8abb4c2cc7f69729c3e2f857da |
train | Screen.add_vbar_widget | Add Vertical Bar Widget | mpdlcd/vendor/lcdproc/screen.py | def add_vbar_widget(self, ref, x=1, y=1, length=10):
""" Add Vertical Bar Widget """
if ref not in self.widgets:
widget = widgets.VBarWidget(screen=self, ref=ref, x=x, y=y, length=length)
self.widgets[ref] = widget
return self.widgets[ref] | def add_vbar_widget(self, ref, x=1, y=1, length=10):
""" Add Vertical Bar Widget """
if ref not in self.widgets:
widget = widgets.VBarWidget(screen=self, ref=ref, x=x, y=y, length=length)
self.widgets[ref] = widget
return self.widgets[ref] | [
"Add",
"Vertical",
"Bar",
"Widget"
] | rbarrois/mpdlcd | python | https://github.com/rbarrois/mpdlcd/blob/85f16c8cc0883f8abb4c2cc7f69729c3e2f857da/mpdlcd/vendor/lcdproc/screen.py#L160-L166 | [
"def",
"add_vbar_widget",
"(",
"self",
",",
"ref",
",",
"x",
"=",
"1",
",",
"y",
"=",
"1",
",",
"length",
"=",
"10",
")",
":",
"if",
"ref",
"not",
"in",
"self",
".",
"widgets",
":",
"widget",
"=",
"widgets",
".",
"VBarWidget",
"(",
"screen",
"=",... | 85f16c8cc0883f8abb4c2cc7f69729c3e2f857da |
train | Screen.add_frame_widget | Add Frame Widget | mpdlcd/vendor/lcdproc/screen.py | def add_frame_widget(self, ref, left=1, top=1, right=20, bottom=1, width=20, height=4, direction="h", speed=1):
""" Add Frame Widget """
if ref not in self.widgets:
widget = widgets.FrameWidget(
screen=self, ref=ref, left=left, top=top, right=right, bottom=bottom, width=widt... | def add_frame_widget(self, ref, left=1, top=1, right=20, bottom=1, width=20, height=4, direction="h", speed=1):
""" Add Frame Widget """
if ref not in self.widgets:
widget = widgets.FrameWidget(
screen=self, ref=ref, left=left, top=top, right=right, bottom=bottom, width=widt... | [
"Add",
"Frame",
"Widget"
] | rbarrois/mpdlcd | python | https://github.com/rbarrois/mpdlcd/blob/85f16c8cc0883f8abb4c2cc7f69729c3e2f857da/mpdlcd/vendor/lcdproc/screen.py#L187-L196 | [
"def",
"add_frame_widget",
"(",
"self",
",",
"ref",
",",
"left",
"=",
"1",
",",
"top",
"=",
"1",
",",
"right",
"=",
"20",
",",
"bottom",
"=",
"1",
",",
"width",
"=",
"20",
",",
"height",
"=",
"4",
",",
"direction",
"=",
"\"h\"",
",",
"speed",
"... | 85f16c8cc0883f8abb4c2cc7f69729c3e2f857da |
train | Screen.add_number_widget | Add Number Widget | mpdlcd/vendor/lcdproc/screen.py | def add_number_widget(self, ref, x=1, value=1):
""" Add Number Widget """
if ref not in self.widgets:
widget = widgets.NumberWidget(screen=self, ref=ref, x=x, value=value)
self.widgets[ref] = widget
return self.widgets[ref] | def add_number_widget(self, ref, x=1, value=1):
""" Add Number Widget """
if ref not in self.widgets:
widget = widgets.NumberWidget(screen=self, ref=ref, x=x, value=value)
self.widgets[ref] = widget
return self.widgets[ref] | [
"Add",
"Number",
"Widget"
] | rbarrois/mpdlcd | python | https://github.com/rbarrois/mpdlcd/blob/85f16c8cc0883f8abb4c2cc7f69729c3e2f857da/mpdlcd/vendor/lcdproc/screen.py#L198-L204 | [
"def",
"add_number_widget",
"(",
"self",
",",
"ref",
",",
"x",
"=",
"1",
",",
"value",
"=",
"1",
")",
":",
"if",
"ref",
"not",
"in",
"self",
".",
"widgets",
":",
"widget",
"=",
"widgets",
".",
"NumberWidget",
"(",
"screen",
"=",
"self",
",",
"ref",... | 85f16c8cc0883f8abb4c2cc7f69729c3e2f857da |
train | Screen.del_widget | Delete/Remove A Widget | mpdlcd/vendor/lcdproc/screen.py | def del_widget(self, ref):
""" Delete/Remove A Widget """
self.server.request("widget_del %s %s" % (self.name, ref))
del(self.widgets[ref]) | def del_widget(self, ref):
""" Delete/Remove A Widget """
self.server.request("widget_del %s %s" % (self.name, ref))
del(self.widgets[ref]) | [
"Delete",
"/",
"Remove",
"A",
"Widget"
] | rbarrois/mpdlcd | python | https://github.com/rbarrois/mpdlcd/blob/85f16c8cc0883f8abb4c2cc7f69729c3e2f857da/mpdlcd/vendor/lcdproc/screen.py#L206-L209 | [
"def",
"del_widget",
"(",
"self",
",",
"ref",
")",
":",
"self",
".",
"server",
".",
"request",
"(",
"\"widget_del %s %s\"",
"%",
"(",
"self",
".",
"name",
",",
"ref",
")",
")",
"del",
"(",
"self",
".",
"widgets",
"[",
"ref",
"]",
")"
] | 85f16c8cc0883f8abb4c2cc7f69729c3e2f857da |
train | TurntableCamera.orbit | Orbits the camera around the center position.
Parameters
----------
azim : float
Angle in degrees to rotate horizontally around the center point.
elev : float
Angle in degrees to rotate vertically around the center point. | glue_vispy_viewers/extern/vispy/scene/cameras/turntable.py | def orbit(self, azim, elev):
""" Orbits the camera around the center position.
Parameters
----------
azim : float
Angle in degrees to rotate horizontally around the center point.
elev : float
Angle in degrees to rotate vertically around the center point.
... | def orbit(self, azim, elev):
""" Orbits the camera around the center position.
Parameters
----------
azim : float
Angle in degrees to rotate horizontally around the center point.
elev : float
Angle in degrees to rotate vertically around the center point.
... | [
"Orbits",
"the",
"camera",
"around",
"the",
"center",
"position",
"."
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/scene/cameras/turntable.py#L111-L123 | [
"def",
"orbit",
"(",
"self",
",",
"azim",
",",
"elev",
")",
":",
"self",
".",
"azimuth",
"+=",
"azim",
"self",
".",
"elevation",
"=",
"np",
".",
"clip",
"(",
"self",
".",
"elevation",
"+",
"elev",
",",
"-",
"90",
",",
"90",
")",
"self",
".",
"v... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | TurntableCamera._update_rotation | Update rotation parmeters based on mouse movement | glue_vispy_viewers/extern/vispy/scene/cameras/turntable.py | def _update_rotation(self, event):
"""Update rotation parmeters based on mouse movement"""
p1 = event.mouse_event.press_event.pos
p2 = event.mouse_event.pos
if self._event_value is None:
self._event_value = self.azimuth, self.elevation
self.azimuth = self._event_value... | def _update_rotation(self, event):
"""Update rotation parmeters based on mouse movement"""
p1 = event.mouse_event.press_event.pos
p2 = event.mouse_event.pos
if self._event_value is None:
self._event_value = self.azimuth, self.elevation
self.azimuth = self._event_value... | [
"Update",
"rotation",
"parmeters",
"based",
"on",
"mouse",
"movement"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/scene/cameras/turntable.py#L125-L132 | [
"def",
"_update_rotation",
"(",
"self",
",",
"event",
")",
":",
"p1",
"=",
"event",
".",
"mouse_event",
".",
"press_event",
".",
"pos",
"p2",
"=",
"event",
".",
"mouse_event",
".",
"pos",
"if",
"self",
".",
"_event_value",
"is",
"None",
":",
"self",
".... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | TurntableCamera._rotate_tr | Rotate the transformation matrix based on camera parameters | glue_vispy_viewers/extern/vispy/scene/cameras/turntable.py | def _rotate_tr(self):
"""Rotate the transformation matrix based on camera parameters"""
up, forward, right = self._get_dim_vectors()
self.transform.rotate(self.elevation, -right)
self.transform.rotate(self.azimuth, up) | def _rotate_tr(self):
"""Rotate the transformation matrix based on camera parameters"""
up, forward, right = self._get_dim_vectors()
self.transform.rotate(self.elevation, -right)
self.transform.rotate(self.azimuth, up) | [
"Rotate",
"the",
"transformation",
"matrix",
"based",
"on",
"camera",
"parameters"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/scene/cameras/turntable.py#L134-L138 | [
"def",
"_rotate_tr",
"(",
"self",
")",
":",
"up",
",",
"forward",
",",
"right",
"=",
"self",
".",
"_get_dim_vectors",
"(",
")",
"self",
".",
"transform",
".",
"rotate",
"(",
"self",
".",
"elevation",
",",
"-",
"right",
")",
"self",
".",
"transform",
... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | TurntableCamera._dist_to_trans | Convert mouse x, y movement into x, y, z translations | glue_vispy_viewers/extern/vispy/scene/cameras/turntable.py | def _dist_to_trans(self, dist):
"""Convert mouse x, y movement into x, y, z translations"""
rae = np.array([self.roll, self.azimuth, self.elevation]) * np.pi / 180
sro, saz, sel = np.sin(rae)
cro, caz, cel = np.cos(rae)
dx = (+ dist[0] * (cro * caz + sro * sel * saz)
... | def _dist_to_trans(self, dist):
"""Convert mouse x, y movement into x, y, z translations"""
rae = np.array([self.roll, self.azimuth, self.elevation]) * np.pi / 180
sro, saz, sel = np.sin(rae)
cro, caz, cel = np.cos(rae)
dx = (+ dist[0] * (cro * caz + sro * sel * saz)
... | [
"Convert",
"mouse",
"x",
"y",
"movement",
"into",
"x",
"y",
"z",
"translations"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/scene/cameras/turntable.py#L140-L150 | [
"def",
"_dist_to_trans",
"(",
"self",
",",
"dist",
")",
":",
"rae",
"=",
"np",
".",
"array",
"(",
"[",
"self",
".",
"roll",
",",
"self",
".",
"azimuth",
",",
"self",
".",
"elevation",
"]",
")",
"*",
"np",
".",
"pi",
"/",
"180",
"sro",
",",
"saz... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | _set_config | Set gl configuration for GLFW | glue_vispy_viewers/extern/vispy/app/backends/_glfw.py | def _set_config(c):
"""Set gl configuration for GLFW """
glfw.glfwWindowHint(glfw.GLFW_RED_BITS, c['red_size'])
glfw.glfwWindowHint(glfw.GLFW_GREEN_BITS, c['green_size'])
glfw.glfwWindowHint(glfw.GLFW_BLUE_BITS, c['blue_size'])
glfw.glfwWindowHint(glfw.GLFW_ALPHA_BITS, c['alpha_size'])
glfw.glf... | def _set_config(c):
"""Set gl configuration for GLFW """
glfw.glfwWindowHint(glfw.GLFW_RED_BITS, c['red_size'])
glfw.glfwWindowHint(glfw.GLFW_GREEN_BITS, c['green_size'])
glfw.glfwWindowHint(glfw.GLFW_BLUE_BITS, c['blue_size'])
glfw.glfwWindowHint(glfw.GLFW_ALPHA_BITS, c['alpha_size'])
glfw.glf... | [
"Set",
"gl",
"configuration",
"for",
"GLFW"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/app/backends/_glfw.py#L133-L154 | [
"def",
"_set_config",
"(",
"c",
")",
":",
"glfw",
".",
"glfwWindowHint",
"(",
"glfw",
".",
"GLFW_RED_BITS",
",",
"c",
"[",
"'red_size'",
"]",
")",
"glfw",
".",
"glfwWindowHint",
"(",
"glfw",
".",
"GLFW_GREEN_BITS",
",",
"c",
"[",
"'green_size'",
"]",
")"... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | CanvasBackend._process_mod | Process (possible) keyboard modifiers
GLFW provides "mod" with many callbacks, but not (critically) the
scroll callback, so we keep track on our own here. | glue_vispy_viewers/extern/vispy/app/backends/_glfw.py | def _process_mod(self, key, down):
"""Process (possible) keyboard modifiers
GLFW provides "mod" with many callbacks, but not (critically) the
scroll callback, so we keep track on our own here.
"""
if key in MOD_KEYS:
if down:
if key not in self._mod:
... | def _process_mod(self, key, down):
"""Process (possible) keyboard modifiers
GLFW provides "mod" with many callbacks, but not (critically) the
scroll callback, so we keep track on our own here.
"""
if key in MOD_KEYS:
if down:
if key not in self._mod:
... | [
"Process",
"(",
"possible",
")",
"keyboard",
"modifiers"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/app/backends/_glfw.py#L483-L495 | [
"def",
"_process_mod",
"(",
"self",
",",
"key",
",",
"down",
")",
":",
"if",
"key",
"in",
"MOD_KEYS",
":",
"if",
"down",
":",
"if",
"key",
"not",
"in",
"self",
".",
"_mod",
":",
"self",
".",
"_mod",
".",
"append",
"(",
"key",
")",
"elif",
"key",
... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | _patch | Monkey-patch pyopengl to fix a bug in glBufferSubData. | glue_vispy_viewers/extern/vispy/gloo/gl/pyopengl2.py | def _patch():
""" Monkey-patch pyopengl to fix a bug in glBufferSubData. """
import sys
from OpenGL import GL
if sys.version_info > (3,):
buffersubdatafunc = GL.glBufferSubData
if hasattr(buffersubdatafunc, 'wrapperFunction'):
buffersubdatafunc = buffersubdatafunc.wrapperFunc... | def _patch():
""" Monkey-patch pyopengl to fix a bug in glBufferSubData. """
import sys
from OpenGL import GL
if sys.version_info > (3,):
buffersubdatafunc = GL.glBufferSubData
if hasattr(buffersubdatafunc, 'wrapperFunction'):
buffersubdatafunc = buffersubdatafunc.wrapperFunc... | [
"Monkey",
"-",
"patch",
"pyopengl",
"to",
"fix",
"a",
"bug",
"in",
"glBufferSubData",
"."
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/gl/pyopengl2.py#L18-L34 | [
"def",
"_patch",
"(",
")",
":",
"import",
"sys",
"from",
"OpenGL",
"import",
"GL",
"if",
"sys",
".",
"version_info",
">",
"(",
"3",
",",
")",
":",
"buffersubdatafunc",
"=",
"GL",
".",
"glBufferSubData",
"if",
"hasattr",
"(",
"buffersubdatafunc",
",",
"'w... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | _get_function_from_pyopengl | Try getting the given function from PyOpenGL, return
a dummy function (that shows a warning when called) if it
could not be found. | glue_vispy_viewers/extern/vispy/gloo/gl/pyopengl2.py | def _get_function_from_pyopengl(funcname):
""" Try getting the given function from PyOpenGL, return
a dummy function (that shows a warning when called) if it
could not be found.
"""
func = None
# Get function from GL
try:
func = getattr(_GL, funcname)
except AttributeError:
... | def _get_function_from_pyopengl(funcname):
""" Try getting the given function from PyOpenGL, return
a dummy function (that shows a warning when called) if it
could not be found.
"""
func = None
# Get function from GL
try:
func = getattr(_GL, funcname)
except AttributeError:
... | [
"Try",
"getting",
"the",
"given",
"function",
"from",
"PyOpenGL",
"return",
"a",
"dummy",
"function",
"(",
"that",
"shows",
"a",
"warning",
"when",
"called",
")",
"if",
"it",
"could",
"not",
"be",
"found",
"."
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/gl/pyopengl2.py#L48-L79 | [
"def",
"_get_function_from_pyopengl",
"(",
"funcname",
")",
":",
"func",
"=",
"None",
"# Get function from GL",
"try",
":",
"func",
"=",
"getattr",
"(",
"_GL",
",",
"funcname",
")",
"except",
"AttributeError",
":",
"# Get function from FBO",
"try",
":",
"func",
... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | _inject | Copy functions from OpenGL.GL into _pyopengl namespace. | glue_vispy_viewers/extern/vispy/gloo/gl/pyopengl2.py | def _inject():
""" Copy functions from OpenGL.GL into _pyopengl namespace.
"""
NS = _pyopengl2.__dict__
for glname, ourname in _pyopengl2._functions_to_import:
func = _get_function_from_pyopengl(glname)
NS[ourname] = func | def _inject():
""" Copy functions from OpenGL.GL into _pyopengl namespace.
"""
NS = _pyopengl2.__dict__
for glname, ourname in _pyopengl2._functions_to_import:
func = _get_function_from_pyopengl(glname)
NS[ourname] = func | [
"Copy",
"functions",
"from",
"OpenGL",
".",
"GL",
"into",
"_pyopengl",
"namespace",
"."
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/gl/pyopengl2.py#L82-L88 | [
"def",
"_inject",
"(",
")",
":",
"NS",
"=",
"_pyopengl2",
".",
"__dict__",
"for",
"glname",
",",
"ourname",
"in",
"_pyopengl2",
".",
"_functions_to_import",
":",
"func",
"=",
"_get_function_from_pyopengl",
"(",
"glname",
")",
"NS",
"[",
"ourname",
"]",
"=",
... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | _get_vispy_font_filename | Fetch a remote vispy font | glue_vispy_viewers/extern/vispy/util/fonts/_vispy_fonts.py | def _get_vispy_font_filename(face, bold, italic):
"""Fetch a remote vispy font"""
name = face + '-'
name += 'Regular' if not bold and not italic else ''
name += 'Bold' if bold else ''
name += 'Italic' if italic else ''
name += '.ttf'
return load_data_file('fonts/%s' % name) | def _get_vispy_font_filename(face, bold, italic):
"""Fetch a remote vispy font"""
name = face + '-'
name += 'Regular' if not bold and not italic else ''
name += 'Bold' if bold else ''
name += 'Italic' if italic else ''
name += '.ttf'
return load_data_file('fonts/%s' % name) | [
"Fetch",
"a",
"remote",
"vispy",
"font"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/util/fonts/_vispy_fonts.py#L13-L20 | [
"def",
"_get_vispy_font_filename",
"(",
"face",
",",
"bold",
",",
"italic",
")",
":",
"name",
"=",
"face",
"+",
"'-'",
"name",
"+=",
"'Regular'",
"if",
"not",
"bold",
"and",
"not",
"italic",
"else",
"''",
"name",
"+=",
"'Bold'",
"if",
"bold",
"else",
"... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | _check_color_dim | Ensure val is Nx(n_col), usually Nx3 | glue_vispy_viewers/extern/vispy/color/color_space.py | def _check_color_dim(val):
"""Ensure val is Nx(n_col), usually Nx3"""
val = np.atleast_2d(val)
if val.shape[1] not in (3, 4):
raise RuntimeError('Value must have second dimension of size 3 or 4')
return val, val.shape[1] | def _check_color_dim(val):
"""Ensure val is Nx(n_col), usually Nx3"""
val = np.atleast_2d(val)
if val.shape[1] not in (3, 4):
raise RuntimeError('Value must have second dimension of size 3 or 4')
return val, val.shape[1] | [
"Ensure",
"val",
"is",
"Nx",
"(",
"n_col",
")",
"usually",
"Nx3"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/color/color_space.py#L14-L19 | [
"def",
"_check_color_dim",
"(",
"val",
")",
":",
"val",
"=",
"np",
".",
"atleast_2d",
"(",
"val",
")",
"if",
"val",
".",
"shape",
"[",
"1",
"]",
"not",
"in",
"(",
"3",
",",
"4",
")",
":",
"raise",
"RuntimeError",
"(",
"'Value must have second dimension... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | _hex_to_rgba | Convert hex to rgba, permitting alpha values in hex | glue_vispy_viewers/extern/vispy/color/color_space.py | def _hex_to_rgba(hexs):
"""Convert hex to rgba, permitting alpha values in hex"""
hexs = np.atleast_1d(np.array(hexs, '|U9'))
out = np.ones((len(hexs), 4), np.float32)
for hi, h in enumerate(hexs):
assert isinstance(h, string_types)
off = 1 if h[0] == '#' else 0
assert len(h) in ... | def _hex_to_rgba(hexs):
"""Convert hex to rgba, permitting alpha values in hex"""
hexs = np.atleast_1d(np.array(hexs, '|U9'))
out = np.ones((len(hexs), 4), np.float32)
for hi, h in enumerate(hexs):
assert isinstance(h, string_types)
off = 1 if h[0] == '#' else 0
assert len(h) in ... | [
"Convert",
"hex",
"to",
"rgba",
"permitting",
"alpha",
"values",
"in",
"hex"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/color/color_space.py#L25-L36 | [
"def",
"_hex_to_rgba",
"(",
"hexs",
")",
":",
"hexs",
"=",
"np",
".",
"atleast_1d",
"(",
"np",
".",
"array",
"(",
"hexs",
",",
"'|U9'",
")",
")",
"out",
"=",
"np",
".",
"ones",
"(",
"(",
"len",
"(",
"hexs",
")",
",",
"4",
")",
",",
"np",
".",... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | _rgb_to_hex | Convert rgb to hex triplet | glue_vispy_viewers/extern/vispy/color/color_space.py | def _rgb_to_hex(rgbs):
"""Convert rgb to hex triplet"""
rgbs, n_dim = _check_color_dim(rgbs)
return np.array(['#%02x%02x%02x' % tuple((255*rgb[:3]).astype(np.uint8))
for rgb in rgbs], '|U7') | def _rgb_to_hex(rgbs):
"""Convert rgb to hex triplet"""
rgbs, n_dim = _check_color_dim(rgbs)
return np.array(['#%02x%02x%02x' % tuple((255*rgb[:3]).astype(np.uint8))
for rgb in rgbs], '|U7') | [
"Convert",
"rgb",
"to",
"hex",
"triplet"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/color/color_space.py#L39-L43 | [
"def",
"_rgb_to_hex",
"(",
"rgbs",
")",
":",
"rgbs",
",",
"n_dim",
"=",
"_check_color_dim",
"(",
"rgbs",
")",
"return",
"np",
".",
"array",
"(",
"[",
"'#%02x%02x%02x'",
"%",
"tuple",
"(",
"(",
"255",
"*",
"rgb",
"[",
":",
"3",
"]",
")",
".",
"astyp... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | _rgb_to_hsv | Convert Nx3 or Nx4 rgb to hsv | glue_vispy_viewers/extern/vispy/color/color_space.py | def _rgb_to_hsv(rgbs):
"""Convert Nx3 or Nx4 rgb to hsv"""
rgbs, n_dim = _check_color_dim(rgbs)
hsvs = list()
for rgb in rgbs:
rgb = rgb[:3] # don't use alpha here
idx = np.argmax(rgb)
val = rgb[idx]
c = val - np.min(rgb)
if c == 0:
hue = 0
... | def _rgb_to_hsv(rgbs):
"""Convert Nx3 or Nx4 rgb to hsv"""
rgbs, n_dim = _check_color_dim(rgbs)
hsvs = list()
for rgb in rgbs:
rgb = rgb[:3] # don't use alpha here
idx = np.argmax(rgb)
val = rgb[idx]
c = val - np.min(rgb)
if c == 0:
hue = 0
... | [
"Convert",
"Nx3",
"or",
"Nx4",
"rgb",
"to",
"hsv"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/color/color_space.py#L49-L75 | [
"def",
"_rgb_to_hsv",
"(",
"rgbs",
")",
":",
"rgbs",
",",
"n_dim",
"=",
"_check_color_dim",
"(",
"rgbs",
")",
"hsvs",
"=",
"list",
"(",
")",
"for",
"rgb",
"in",
"rgbs",
":",
"rgb",
"=",
"rgb",
"[",
":",
"3",
"]",
"# don't use alpha here",
"idx",
"=",... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | _hsv_to_rgb | Convert Nx3 or Nx4 hsv to rgb | glue_vispy_viewers/extern/vispy/color/color_space.py | def _hsv_to_rgb(hsvs):
"""Convert Nx3 or Nx4 hsv to rgb"""
hsvs, n_dim = _check_color_dim(hsvs)
# In principle, we *might* be able to vectorize this, but might as well
# wait until a compelling use case appears
rgbs = list()
for hsv in hsvs:
c = hsv[1] * hsv[2]
m = hsv[2] - c
... | def _hsv_to_rgb(hsvs):
"""Convert Nx3 or Nx4 hsv to rgb"""
hsvs, n_dim = _check_color_dim(hsvs)
# In principle, we *might* be able to vectorize this, but might as well
# wait until a compelling use case appears
rgbs = list()
for hsv in hsvs:
c = hsv[1] * hsv[2]
m = hsv[2] - c
... | [
"Convert",
"Nx3",
"or",
"Nx4",
"hsv",
"to",
"rgb"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/color/color_space.py#L78-L106 | [
"def",
"_hsv_to_rgb",
"(",
"hsvs",
")",
":",
"hsvs",
",",
"n_dim",
"=",
"_check_color_dim",
"(",
"hsvs",
")",
"# In principle, we *might* be able to vectorize this, but might as well",
"# wait until a compelling use case appears",
"rgbs",
"=",
"list",
"(",
")",
"for",
"hs... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | _lab_to_rgb | Convert Nx3 or Nx4 lab to rgb | glue_vispy_viewers/extern/vispy/color/color_space.py | def _lab_to_rgb(labs):
"""Convert Nx3 or Nx4 lab to rgb"""
# adapted from BSD-licensed work in MATLAB by Mark Ruzon
# Based on ITU-R Recommendation BT.709 using the D65
labs, n_dim = _check_color_dim(labs)
# Convert Lab->XYZ (silly indexing used to preserve dimensionality)
y = (labs[:, 0] + 16.... | def _lab_to_rgb(labs):
"""Convert Nx3 or Nx4 lab to rgb"""
# adapted from BSD-licensed work in MATLAB by Mark Ruzon
# Based on ITU-R Recommendation BT.709 using the D65
labs, n_dim = _check_color_dim(labs)
# Convert Lab->XYZ (silly indexing used to preserve dimensionality)
y = (labs[:, 0] + 16.... | [
"Convert",
"Nx3",
"or",
"Nx4",
"lab",
"to",
"rgb"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/color/color_space.py#L160-L183 | [
"def",
"_lab_to_rgb",
"(",
"labs",
")",
":",
"# adapted from BSD-licensed work in MATLAB by Mark Ruzon",
"# Based on ITU-R Recommendation BT.709 using the D65",
"labs",
",",
"n_dim",
"=",
"_check_color_dim",
"(",
"labs",
")",
"# Convert Lab->XYZ (silly indexing used to preserve dimen... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | SongTag.get | Find an adequate value for this field from a dict of tags. | mpdlcd/mpdwrapper.py | def get(self, tags):
"""Find an adequate value for this field from a dict of tags."""
# Try to find our name
value = tags.get(self.name, '')
for name in self.alternate_tags:
# Iterate of alternates until a non-empty value is found
value = value or tags.get(name, ... | def get(self, tags):
"""Find an adequate value for this field from a dict of tags."""
# Try to find our name
value = tags.get(self.name, '')
for name in self.alternate_tags:
# Iterate of alternates until a non-empty value is found
value = value or tags.get(name, ... | [
"Find",
"an",
"adequate",
"value",
"for",
"this",
"field",
"from",
"a",
"dict",
"of",
"tags",
"."
] | rbarrois/mpdlcd | python | https://github.com/rbarrois/mpdlcd/blob/85f16c8cc0883f8abb4c2cc7f69729c3e2f857da/mpdlcd/mpdwrapper.py#L135-L146 | [
"def",
"get",
"(",
"self",
",",
"tags",
")",
":",
"# Try to find our name",
"value",
"=",
"tags",
".",
"get",
"(",
"self",
".",
"name",
",",
"''",
")",
"for",
"name",
"in",
"self",
".",
"alternate_tags",
":",
"# Iterate of alternates until a non-empty value is... | 85f16c8cc0883f8abb4c2cc7f69729c3e2f857da |
train | parse_function_signature | Return the name, arguments, and return type of the first function
definition found in *code*. Arguments are returned as [(type, name), ...]. | glue_vispy_viewers/extern/vispy/visuals/shaders/parsing.py | def parse_function_signature(code):
"""
Return the name, arguments, and return type of the first function
definition found in *code*. Arguments are returned as [(type, name), ...].
"""
m = re.search("^\s*" + re_func_decl + "\s*{", code, re.M)
if m is None:
print(code)
raise Excep... | def parse_function_signature(code):
"""
Return the name, arguments, and return type of the first function
definition found in *code*. Arguments are returned as [(type, name), ...].
"""
m = re.search("^\s*" + re_func_decl + "\s*{", code, re.M)
if m is None:
print(code)
raise Excep... | [
"Return",
"the",
"name",
"arguments",
"and",
"return",
"type",
"of",
"the",
"first",
"function",
"definition",
"found",
"in",
"*",
"code",
"*",
".",
"Arguments",
"are",
"returned",
"as",
"[",
"(",
"type",
"name",
")",
"...",
"]",
"."
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/shaders/parsing.py#L55-L70 | [
"def",
"parse_function_signature",
"(",
"code",
")",
":",
"m",
"=",
"re",
".",
"search",
"(",
"\"^\\s*\"",
"+",
"re_func_decl",
"+",
"\"\\s*{\"",
",",
"code",
",",
"re",
".",
"M",
")",
"if",
"m",
"is",
"None",
":",
"print",
"(",
"code",
")",
"raise",... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | find_functions | Return a list of (name, arguments, return type) for all function
definition2 found in *code*. Arguments are returned as [(type, name), ...]. | glue_vispy_viewers/extern/vispy/visuals/shaders/parsing.py | def find_functions(code):
"""
Return a list of (name, arguments, return type) for all function
definition2 found in *code*. Arguments are returned as [(type, name), ...].
"""
regex = "^\s*" + re_func_decl + "\s*{"
funcs = []
while True:
m = re.search(regex, code, re.M)
... | def find_functions(code):
"""
Return a list of (name, arguments, return type) for all function
definition2 found in *code*. Arguments are returned as [(type, name), ...].
"""
regex = "^\s*" + re_func_decl + "\s*{"
funcs = []
while True:
m = re.search(regex, code, re.M)
... | [
"Return",
"a",
"list",
"of",
"(",
"name",
"arguments",
"return",
"type",
")",
"for",
"all",
"function",
"definition2",
"found",
"in",
"*",
"code",
"*",
".",
"Arguments",
"are",
"returned",
"as",
"[",
"(",
"type",
"name",
")",
"...",
"]",
"."
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/shaders/parsing.py#L73-L93 | [
"def",
"find_functions",
"(",
"code",
")",
":",
"regex",
"=",
"\"^\\s*\"",
"+",
"re_func_decl",
"+",
"\"\\s*{\"",
"funcs",
"=",
"[",
"]",
"while",
"True",
":",
"m",
"=",
"re",
".",
"search",
"(",
"regex",
",",
"code",
",",
"re",
".",
"M",
")",
"if"... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | find_prototypes | Return a list of signatures for each function prototype declared in *code*.
Format is [(name, [args], rtype), ...]. | glue_vispy_viewers/extern/vispy/visuals/shaders/parsing.py | def find_prototypes(code):
"""
Return a list of signatures for each function prototype declared in *code*.
Format is [(name, [args], rtype), ...].
"""
prots = []
lines = code.split('\n')
for line in lines:
m = re.match("\s*" + re_func_prot, line)
if m is not None:
... | def find_prototypes(code):
"""
Return a list of signatures for each function prototype declared in *code*.
Format is [(name, [args], rtype), ...].
"""
prots = []
lines = code.split('\n')
for line in lines:
m = re.match("\s*" + re_func_prot, line)
if m is not None:
... | [
"Return",
"a",
"list",
"of",
"signatures",
"for",
"each",
"function",
"prototype",
"declared",
"in",
"*",
"code",
"*",
".",
"Format",
"is",
"[",
"(",
"name",
"[",
"args",
"]",
"rtype",
")",
"...",
"]",
"."
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/shaders/parsing.py#L96-L115 | [
"def",
"find_prototypes",
"(",
"code",
")",
":",
"prots",
"=",
"[",
"]",
"lines",
"=",
"code",
".",
"split",
"(",
"'\\n'",
")",
"for",
"line",
"in",
"lines",
":",
"m",
"=",
"re",
".",
"match",
"(",
"\"\\s*\"",
"+",
"re_func_prot",
",",
"line",
")",... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | find_program_variables | Return a dict describing program variables::
{'var_name': ('uniform|attribute|varying', type), ...} | glue_vispy_viewers/extern/vispy/visuals/shaders/parsing.py | def find_program_variables(code):
"""
Return a dict describing program variables::
{'var_name': ('uniform|attribute|varying', type), ...}
"""
vars = {}
lines = code.split('\n')
for line in lines:
m = re.match(r"\s*" + re_prog_var_declaration + r"\s*(=|;)", line)
if m is... | def find_program_variables(code):
"""
Return a dict describing program variables::
{'var_name': ('uniform|attribute|varying', type), ...}
"""
vars = {}
lines = code.split('\n')
for line in lines:
m = re.match(r"\s*" + re_prog_var_declaration + r"\s*(=|;)", line)
if m is... | [
"Return",
"a",
"dict",
"describing",
"program",
"variables",
"::"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/shaders/parsing.py#L118-L133 | [
"def",
"find_program_variables",
"(",
"code",
")",
":",
"vars",
"=",
"{",
"}",
"lines",
"=",
"code",
".",
"split",
"(",
"'\\n'",
")",
"for",
"line",
"in",
"lines",
":",
"m",
"=",
"re",
".",
"match",
"(",
"r\"\\s*\"",
"+",
"re_prog_var_declaration",
"+"... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | _set_config | Set gl configuration for SDL2 | glue_vispy_viewers/extern/vispy/app/backends/_sdl2.py | def _set_config(c):
"""Set gl configuration for SDL2"""
func = sdl2.SDL_GL_SetAttribute
func(sdl2.SDL_GL_RED_SIZE, c['red_size'])
func(sdl2.SDL_GL_GREEN_SIZE, c['green_size'])
func(sdl2.SDL_GL_BLUE_SIZE, c['blue_size'])
func(sdl2.SDL_GL_ALPHA_SIZE, c['alpha_size'])
func(sdl2.SDL_GL_DEPTH_SIZ... | def _set_config(c):
"""Set gl configuration for SDL2"""
func = sdl2.SDL_GL_SetAttribute
func(sdl2.SDL_GL_RED_SIZE, c['red_size'])
func(sdl2.SDL_GL_GREEN_SIZE, c['green_size'])
func(sdl2.SDL_GL_BLUE_SIZE, c['blue_size'])
func(sdl2.SDL_GL_ALPHA_SIZE, c['alpha_size'])
func(sdl2.SDL_GL_DEPTH_SIZ... | [
"Set",
"gl",
"configuration",
"for",
"SDL2"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/app/backends/_sdl2.py#L119-L132 | [
"def",
"_set_config",
"(",
"c",
")",
":",
"func",
"=",
"sdl2",
".",
"SDL_GL_SetAttribute",
"func",
"(",
"sdl2",
".",
"SDL_GL_RED_SIZE",
",",
"c",
"[",
"'red_size'",
"]",
")",
"func",
"(",
"sdl2",
".",
"SDL_GL_GREEN_SIZE",
",",
"c",
"[",
"'green_size'",
"... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | ResponseBuilder.create_response | message - text message to be spoken out by the Echo
end_session - flag to determine whether this interaction should end the session
card_obj = JSON card object to substitute the 'card' field in the raw_response | ask/alexa_io.py | def create_response(self, message=None, end_session=False, card_obj=None,
reprompt_message=None, is_ssml=None):
"""
message - text message to be spoken out by the Echo
end_session - flag to determine whether this interaction should end the session
card_obj = JSON ... | def create_response(self, message=None, end_session=False, card_obj=None,
reprompt_message=None, is_ssml=None):
"""
message - text message to be spoken out by the Echo
end_session - flag to determine whether this interaction should end the session
card_obj = JSON ... | [
"message",
"-",
"text",
"message",
"to",
"be",
"spoken",
"out",
"by",
"the",
"Echo",
"end_session",
"-",
"flag",
"to",
"determine",
"whether",
"this",
"interaction",
"should",
"end",
"the",
"session",
"card_obj",
"=",
"JSON",
"card",
"object",
"to",
"substit... | anjishnu/ask-alexa-pykit | python | https://github.com/anjishnu/ask-alexa-pykit/blob/a47c278ca7a60532bbe1a9b789f6c37e609fea8b/ask/alexa_io.py#L103-L118 | [
"def",
"create_response",
"(",
"self",
",",
"message",
"=",
"None",
",",
"end_session",
"=",
"False",
",",
"card_obj",
"=",
"None",
",",
"reprompt_message",
"=",
"None",
",",
"is_ssml",
"=",
"None",
")",
":",
"response",
"=",
"dict",
"(",
"self",
".",
... | a47c278ca7a60532bbe1a9b789f6c37e609fea8b |
train | ResponseBuilder.create_card | card_obj = JSON card object to substitute the 'card' field in the raw_response
format:
{
"type": "Simple", #COMPULSORY
"title": "string", #OPTIONAL
"subtitle": "string", #OPTIONAL
"content": "string" #OPTIONAL
} | ask/alexa_io.py | def create_card(self, title=None, subtitle=None, content=None, card_type="Simple"):
"""
card_obj = JSON card object to substitute the 'card' field in the raw_response
format:
{
"type": "Simple", #COMPULSORY
"title": "string", #OPTIONAL
"subtitle": "string", ... | def create_card(self, title=None, subtitle=None, content=None, card_type="Simple"):
"""
card_obj = JSON card object to substitute the 'card' field in the raw_response
format:
{
"type": "Simple", #COMPULSORY
"title": "string", #OPTIONAL
"subtitle": "string", ... | [
"card_obj",
"=",
"JSON",
"card",
"object",
"to",
"substitute",
"the",
"card",
"field",
"in",
"the",
"raw_response",
"format",
":",
"{",
"type",
":",
"Simple",
"#COMPULSORY",
"title",
":",
"string",
"#OPTIONAL",
"subtitle",
":",
"string",
"#OPTIONAL",
"content"... | anjishnu/ask-alexa-pykit | python | https://github.com/anjishnu/ask-alexa-pykit/blob/a47c278ca7a60532bbe1a9b789f6c37e609fea8b/ask/alexa_io.py#L135-L150 | [
"def",
"create_card",
"(",
"self",
",",
"title",
"=",
"None",
",",
"subtitle",
"=",
"None",
",",
"content",
"=",
"None",
",",
"card_type",
"=",
"\"Simple\"",
")",
":",
"card",
"=",
"{",
"\"type\"",
":",
"card_type",
"}",
"if",
"title",
":",
"card",
"... | a47c278ca7a60532bbe1a9b789f6c37e609fea8b |
train | VoiceHandler.intent | Decorator to register intent handler | ask/alexa_io.py | def intent(self, intent):
''' Decorator to register intent handler'''
def _handler(func):
self._handlers['IntentRequest'][intent] = func
return func
return _handler | def intent(self, intent):
''' Decorator to register intent handler'''
def _handler(func):
self._handlers['IntentRequest'][intent] = func
return func
return _handler | [
"Decorator",
"to",
"register",
"intent",
"handler"
] | anjishnu/ask-alexa-pykit | python | https://github.com/anjishnu/ask-alexa-pykit/blob/a47c278ca7a60532bbe1a9b789f6c37e609fea8b/ask/alexa_io.py#L177-L184 | [
"def",
"intent",
"(",
"self",
",",
"intent",
")",
":",
"def",
"_handler",
"(",
"func",
")",
":",
"self",
".",
"_handlers",
"[",
"'IntentRequest'",
"]",
"[",
"intent",
"]",
"=",
"func",
"return",
"func",
"return",
"_handler"
] | a47c278ca7a60532bbe1a9b789f6c37e609fea8b |
train | VoiceHandler.request | Decorator to register generic request handler | ask/alexa_io.py | def request(self, request_type):
''' Decorator to register generic request handler '''
def _handler(func):
self._handlers[request_type] = func
return func
return _handler | def request(self, request_type):
''' Decorator to register generic request handler '''
def _handler(func):
self._handlers[request_type] = func
return func
return _handler | [
"Decorator",
"to",
"register",
"generic",
"request",
"handler"
] | anjishnu/ask-alexa-pykit | python | https://github.com/anjishnu/ask-alexa-pykit/blob/a47c278ca7a60532bbe1a9b789f6c37e609fea8b/ask/alexa_io.py#L186-L193 | [
"def",
"request",
"(",
"self",
",",
"request_type",
")",
":",
"def",
"_handler",
"(",
"func",
")",
":",
"self",
".",
"_handlers",
"[",
"request_type",
"]",
"=",
"func",
"return",
"func",
"return",
"_handler"
] | a47c278ca7a60532bbe1a9b789f6c37e609fea8b |
train | VoiceHandler.route_request | Route the request object to the right handler function | ask/alexa_io.py | def route_request(self, request_json, metadata=None):
''' Route the request object to the right handler function '''
request = Request(request_json)
request.metadata = metadata
# add reprompt handler or some such for default?
handler_fn = self._handlers[self._default] # Set defa... | def route_request(self, request_json, metadata=None):
''' Route the request object to the right handler function '''
request = Request(request_json)
request.metadata = metadata
# add reprompt handler or some such for default?
handler_fn = self._handlers[self._default] # Set defa... | [
"Route",
"the",
"request",
"object",
"to",
"the",
"right",
"handler",
"function"
] | anjishnu/ask-alexa-pykit | python | https://github.com/anjishnu/ask-alexa-pykit/blob/a47c278ca7a60532bbe1a9b789f6c37e609fea8b/ask/alexa_io.py#L195-L213 | [
"def",
"route_request",
"(",
"self",
",",
"request_json",
",",
"metadata",
"=",
"None",
")",
":",
"request",
"=",
"Request",
"(",
"request_json",
")",
"request",
".",
"metadata",
"=",
"metadata",
"# add reprompt handler or some such for default?",
"handler_fn",
"=",... | a47c278ca7a60532bbe1a9b789f6c37e609fea8b |
train | BaseCamera._viewbox_set | Friend method of viewbox to register itself. | glue_vispy_viewers/extern/vispy/scene/cameras/base_camera.py | def _viewbox_set(self, viewbox):
""" Friend method of viewbox to register itself.
"""
self._viewbox = viewbox
# Connect
viewbox.events.mouse_press.connect(self.viewbox_mouse_event)
viewbox.events.mouse_release.connect(self.viewbox_mouse_event)
viewbox.events.mouse... | def _viewbox_set(self, viewbox):
""" Friend method of viewbox to register itself.
"""
self._viewbox = viewbox
# Connect
viewbox.events.mouse_press.connect(self.viewbox_mouse_event)
viewbox.events.mouse_release.connect(self.viewbox_mouse_event)
viewbox.events.mouse... | [
"Friend",
"method",
"of",
"viewbox",
"to",
"register",
"itself",
"."
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/scene/cameras/base_camera.py#L118-L127 | [
"def",
"_viewbox_set",
"(",
"self",
",",
"viewbox",
")",
":",
"self",
".",
"_viewbox",
"=",
"viewbox",
"# Connect",
"viewbox",
".",
"events",
".",
"mouse_press",
".",
"connect",
"(",
"self",
".",
"viewbox_mouse_event",
")",
"viewbox",
".",
"events",
".",
"... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | BaseCamera._viewbox_unset | Friend method of viewbox to unregister itself. | glue_vispy_viewers/extern/vispy/scene/cameras/base_camera.py | def _viewbox_unset(self, viewbox):
""" Friend method of viewbox to unregister itself.
"""
self._viewbox = None
# Disconnect
viewbox.events.mouse_press.disconnect(self.viewbox_mouse_event)
viewbox.events.mouse_release.disconnect(self.viewbox_mouse_event)
viewbox.ev... | def _viewbox_unset(self, viewbox):
""" Friend method of viewbox to unregister itself.
"""
self._viewbox = None
# Disconnect
viewbox.events.mouse_press.disconnect(self.viewbox_mouse_event)
viewbox.events.mouse_release.disconnect(self.viewbox_mouse_event)
viewbox.ev... | [
"Friend",
"method",
"of",
"viewbox",
"to",
"unregister",
"itself",
"."
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/scene/cameras/base_camera.py#L130-L139 | [
"def",
"_viewbox_unset",
"(",
"self",
",",
"viewbox",
")",
":",
"self",
".",
"_viewbox",
"=",
"None",
"# Disconnect",
"viewbox",
".",
"events",
".",
"mouse_press",
".",
"disconnect",
"(",
"self",
".",
"viewbox_mouse_event",
")",
"viewbox",
".",
"events",
"."... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | BaseCamera.set_range | Set the range of the view region for the camera
Parameters
----------
x : tuple | None
X range.
y : tuple | None
Y range.
z : tuple | None
Z range.
margin : float
Margin to use.
Notes
-----
The view... | glue_vispy_viewers/extern/vispy/scene/cameras/base_camera.py | def set_range(self, x=None, y=None, z=None, margin=0.05):
""" Set the range of the view region for the camera
Parameters
----------
x : tuple | None
X range.
y : tuple | None
Y range.
z : tuple | None
Z range.
margin : float
... | def set_range(self, x=None, y=None, z=None, margin=0.05):
""" Set the range of the view region for the camera
Parameters
----------
x : tuple | None
X range.
y : tuple | None
Y range.
z : tuple | None
Z range.
margin : float
... | [
"Set",
"the",
"range",
"of",
"the",
"view",
"region",
"for",
"the",
"camera"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/scene/cameras/base_camera.py#L228-L294 | [
"def",
"set_range",
"(",
"self",
",",
"x",
"=",
"None",
",",
"y",
"=",
"None",
",",
"z",
"=",
"None",
",",
"margin",
"=",
"0.05",
")",
":",
"# Flag to indicate that this is an initializing (not user-invoked)",
"init",
"=",
"self",
".",
"_xlim",
"is",
"None",... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | BaseCamera.get_state | Get the current view state of the camera
Returns a dict of key-value pairs. The exact keys depend on the
camera. Can be passed to set_state() (of this or another camera
of the same type) to reproduce the state. | glue_vispy_viewers/extern/vispy/scene/cameras/base_camera.py | def get_state(self):
""" Get the current view state of the camera
Returns a dict of key-value pairs. The exact keys depend on the
camera. Can be passed to set_state() (of this or another camera
of the same type) to reproduce the state.
"""
D = {}
for key in self.... | def get_state(self):
""" Get the current view state of the camera
Returns a dict of key-value pairs. The exact keys depend on the
camera. Can be passed to set_state() (of this or another camera
of the same type) to reproduce the state.
"""
D = {}
for key in self.... | [
"Get",
"the",
"current",
"view",
"state",
"of",
"the",
"camera"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/scene/cameras/base_camera.py#L310-L320 | [
"def",
"get_state",
"(",
"self",
")",
":",
"D",
"=",
"{",
"}",
"for",
"key",
"in",
"self",
".",
"_state_props",
":",
"D",
"[",
"key",
"]",
"=",
"getattr",
"(",
"self",
",",
"key",
")",
"return",
"D"
] | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | BaseCamera.set_state | Set the view state of the camera
Should be a dict (or kwargs) as returned by get_state. It can
be an incomlete dict, in which case only the specified
properties are set.
Parameters
----------
state : dict
The camera state.
**kwargs : dict
... | glue_vispy_viewers/extern/vispy/scene/cameras/base_camera.py | def set_state(self, state=None, **kwargs):
""" Set the view state of the camera
Should be a dict (or kwargs) as returned by get_state. It can
be an incomlete dict, in which case only the specified
properties are set.
Parameters
----------
state : dict
... | def set_state(self, state=None, **kwargs):
""" Set the view state of the camera
Should be a dict (or kwargs) as returned by get_state. It can
be an incomlete dict, in which case only the specified
properties are set.
Parameters
----------
state : dict
... | [
"Set",
"the",
"view",
"state",
"of",
"the",
"camera"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/scene/cameras/base_camera.py#L322-L341 | [
"def",
"set_state",
"(",
"self",
",",
"state",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"D",
"=",
"state",
"or",
"{",
"}",
"D",
".",
"update",
"(",
"kwargs",
")",
"for",
"key",
",",
"val",
"in",
"D",
".",
"items",
"(",
")",
":",
"if",
... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | BaseCamera.link | Link this camera with another camera of the same type
Linked camera's keep each-others' state in sync.
Parameters
----------
camera : instance of Camera
The other camera to link. | glue_vispy_viewers/extern/vispy/scene/cameras/base_camera.py | def link(self, camera):
""" Link this camera with another camera of the same type
Linked camera's keep each-others' state in sync.
Parameters
----------
camera : instance of Camera
The other camera to link.
"""
cam1, cam2 = self, camera
# Rem... | def link(self, camera):
""" Link this camera with another camera of the same type
Linked camera's keep each-others' state in sync.
Parameters
----------
camera : instance of Camera
The other camera to link.
"""
cam1, cam2 = self, camera
# Rem... | [
"Link",
"this",
"camera",
"with",
"another",
"camera",
"of",
"the",
"same",
"type"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/scene/cameras/base_camera.py#L343-L361 | [
"def",
"link",
"(",
"self",
",",
"camera",
")",
":",
"cam1",
",",
"cam2",
"=",
"self",
",",
"camera",
"# Remove if already linked",
"while",
"cam1",
"in",
"cam2",
".",
"_linked_cameras",
":",
"cam2",
".",
"_linked_cameras",
".",
"remove",
"(",
"cam1",
")",... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | BaseCamera.view_changed | Called when this camera is changes its view. Also called
when its associated with a viewbox. | glue_vispy_viewers/extern/vispy/scene/cameras/base_camera.py | def view_changed(self):
""" Called when this camera is changes its view. Also called
when its associated with a viewbox.
"""
if self._resetting:
return # don't update anything while resetting (are in set_range)
if self._viewbox:
# Set range if necessary
... | def view_changed(self):
""" Called when this camera is changes its view. Also called
when its associated with a viewbox.
"""
if self._resetting:
return # don't update anything while resetting (are in set_range)
if self._viewbox:
# Set range if necessary
... | [
"Called",
"when",
"this",
"camera",
"is",
"changes",
"its",
"view",
".",
"Also",
"called",
"when",
"its",
"associated",
"with",
"a",
"viewbox",
"."
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/scene/cameras/base_camera.py#L365-L380 | [
"def",
"view_changed",
"(",
"self",
")",
":",
"if",
"self",
".",
"_resetting",
":",
"return",
"# don't update anything while resetting (are in set_range)",
"if",
"self",
".",
"_viewbox",
":",
"# Set range if necessary",
"if",
"self",
".",
"_xlim",
"is",
"None",
":",... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | BaseCamera.on_canvas_change | Canvas change event handler
Parameters
----------
event : instance of Event
The event. | glue_vispy_viewers/extern/vispy/scene/cameras/base_camera.py | def on_canvas_change(self, event):
"""Canvas change event handler
Parameters
----------
event : instance of Event
The event.
"""
# Connect key events from canvas to camera.
# TODO: canvas should keep track of a single node with keyboard focus.
... | def on_canvas_change(self, event):
"""Canvas change event handler
Parameters
----------
event : instance of Event
The event.
"""
# Connect key events from canvas to camera.
# TODO: canvas should keep track of a single node with keyboard focus.
... | [
"Canvas",
"change",
"event",
"handler"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/scene/cameras/base_camera.py#L404-L419 | [
"def",
"on_canvas_change",
"(",
"self",
",",
"event",
")",
":",
"# Connect key events from canvas to camera. ",
"# TODO: canvas should keep track of a single node with keyboard focus.",
"if",
"event",
".",
"old",
"is",
"not",
"None",
":",
"event",
".",
"old",
".",
"events... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | BaseCamera._set_scene_transform | Called by subclasses to configure the viewbox scene transform. | glue_vispy_viewers/extern/vispy/scene/cameras/base_camera.py | def _set_scene_transform(self, tr):
""" Called by subclasses to configure the viewbox scene transform.
"""
# todo: check whether transform has changed, connect to
# transform.changed event
pre_tr = self.pre_transform
if pre_tr is None:
self._scene_transform = ... | def _set_scene_transform(self, tr):
""" Called by subclasses to configure the viewbox scene transform.
"""
# todo: check whether transform has changed, connect to
# transform.changed event
pre_tr = self.pre_transform
if pre_tr is None:
self._scene_transform = ... | [
"Called",
"by",
"subclasses",
"to",
"configure",
"the",
"viewbox",
"scene",
"transform",
"."
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/scene/cameras/base_camera.py#L448-L477 | [
"def",
"_set_scene_transform",
"(",
"self",
",",
"tr",
")",
":",
"# todo: check whether transform has changed, connect to",
"# transform.changed event",
"pre_tr",
"=",
"self",
".",
"pre_transform",
"if",
"pre_tr",
"is",
"None",
":",
"self",
".",
"_scene_transform",
"=",... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | _set_config | Set the OpenGL configuration | glue_vispy_viewers/extern/vispy/app/backends/_qt.py | def _set_config(c):
"""Set the OpenGL configuration"""
glformat = QGLFormat()
glformat.setRedBufferSize(c['red_size'])
glformat.setGreenBufferSize(c['green_size'])
glformat.setBlueBufferSize(c['blue_size'])
glformat.setAlphaBufferSize(c['alpha_size'])
if QT5_NEW_API:
# Qt5 >= 5.4.0 -... | def _set_config(c):
"""Set the OpenGL configuration"""
glformat = QGLFormat()
glformat.setRedBufferSize(c['red_size'])
glformat.setGreenBufferSize(c['green_size'])
glformat.setBlueBufferSize(c['blue_size'])
glformat.setAlphaBufferSize(c['alpha_size'])
if QT5_NEW_API:
# Qt5 >= 5.4.0 -... | [
"Set",
"the",
"OpenGL",
"configuration"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/app/backends/_qt.py#L195-L219 | [
"def",
"_set_config",
"(",
"c",
")",
":",
"glformat",
"=",
"QGLFormat",
"(",
")",
"glformat",
".",
"setRedBufferSize",
"(",
"c",
"[",
"'red_size'",
"]",
")",
"glformat",
".",
"setGreenBufferSize",
"(",
"c",
"[",
"'green_size'",
"]",
")",
"glformat",
".",
... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | CanvasBackendEgl.get_window_id | Get the window id of a PySide Widget. Might also work for PyQt4. | glue_vispy_viewers/extern/vispy/app/backends/_qt.py | def get_window_id(self):
""" Get the window id of a PySide Widget. Might also work for PyQt4.
"""
# Get Qt win id
winid = self.winId()
# On Linux this is it
if IS_RPI:
nw = (ctypes.c_int * 3)(winid, self.width(), self.height())
return ctypes.point... | def get_window_id(self):
""" Get the window id of a PySide Widget. Might also work for PyQt4.
"""
# Get Qt win id
winid = self.winId()
# On Linux this is it
if IS_RPI:
nw = (ctypes.c_int * 3)(winid, self.width(), self.height())
return ctypes.point... | [
"Get",
"the",
"window",
"id",
"of",
"a",
"PySide",
"Widget",
".",
"Might",
"also",
"work",
"for",
"PyQt4",
"."
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/app/backends/_qt.py#L576-L603 | [
"def",
"get_window_id",
"(",
"self",
")",
":",
"# Get Qt win id",
"winid",
"=",
"self",
".",
"winId",
"(",
")",
"# On Linux this is it",
"if",
"IS_RPI",
":",
"nw",
"=",
"(",
"ctypes",
".",
"c_int",
"*",
"3",
")",
"(",
"winid",
",",
"self",
".",
"width"... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | obj | Six-hump camelback function | doc/tutorialfig.py | def obj(x):
"""Six-hump camelback function"""
x1 = x[0]
x2 = x[1]
f = (4 - 2.1*(x1*x1) + (x1*x1*x1*x1)/3.0)*(x1*x1) + x1*x2 + (-4 + 4*(x2*x2))*(x2*x2)
return f | def obj(x):
"""Six-hump camelback function"""
x1 = x[0]
x2 = x[1]
f = (4 - 2.1*(x1*x1) + (x1*x1*x1*x1)/3.0)*(x1*x1) + x1*x2 + (-4 + 4*(x2*x2))*(x2*x2)
return f | [
"Six",
"-",
"hump",
"camelback",
"function"
] | andim/scipydirect | python | https://github.com/andim/scipydirect/blob/ad36ab19e6ad64054a1d2abd22f1c993fc4b87be/doc/tutorialfig.py#L9-L16 | [
"def",
"obj",
"(",
"x",
")",
":",
"x1",
"=",
"x",
"[",
"0",
"]",
"x2",
"=",
"x",
"[",
"1",
"]",
"f",
"=",
"(",
"4",
"-",
"2.1",
"*",
"(",
"x1",
"*",
"x1",
")",
"+",
"(",
"x1",
"*",
"x1",
"*",
"x1",
"*",
"x1",
")",
"/",
"3.0",
")",
... | ad36ab19e6ad64054a1d2abd22f1c993fc4b87be |
train | PathCollection | mode: string
- "raw" (speed: fastest, size: small, output: ugly, no dash,
no thickness)
- "agg" (speed: medium, size: medium output: nice, some flaws, no dash)
- "agg+" (speed: slow, size: big, output: perfect, no dash) | glue_vispy_viewers/extern/vispy/visuals/collections/path_collection.py | def PathCollection(mode="agg", *args, **kwargs):
"""
mode: string
- "raw" (speed: fastest, size: small, output: ugly, no dash,
no thickness)
- "agg" (speed: medium, size: medium output: nice, some flaws, no dash)
- "agg+" (speed: slow, size: big, output: perfect, no dash)... | def PathCollection(mode="agg", *args, **kwargs):
"""
mode: string
- "raw" (speed: fastest, size: small, output: ugly, no dash,
no thickness)
- "agg" (speed: medium, size: medium output: nice, some flaws, no dash)
- "agg+" (speed: slow, size: big, output: perfect, no dash)... | [
"mode",
":",
"string",
"-",
"raw",
"(",
"speed",
":",
"fastest",
"size",
":",
"small",
"output",
":",
"ugly",
"no",
"dash",
"no",
"thickness",
")",
"-",
"agg",
"(",
"speed",
":",
"medium",
"size",
":",
"medium",
"output",
":",
"nice",
"some",
"flaws"... | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/collections/path_collection.py#L11-L24 | [
"def",
"PathCollection",
"(",
"mode",
"=",
"\"agg\"",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"mode",
"==",
"\"raw\"",
":",
"return",
"RawPathCollection",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"elif",
"mode",
"==",
"\"agg... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | STTransform.map | Map coordinates
Parameters
----------
coords : array-like
Coordinates to map.
Returns
-------
coords : ndarray
Coordinates. | glue_vispy_viewers/extern/vispy/visuals/transforms/linear.py | def map(self, coords):
"""Map coordinates
Parameters
----------
coords : array-like
Coordinates to map.
Returns
-------
coords : ndarray
Coordinates.
"""
m = np.empty(coords.shape)
m[:, :3] = (coords[:, :3] * self.... | def map(self, coords):
"""Map coordinates
Parameters
----------
coords : array-like
Coordinates to map.
Returns
-------
coords : ndarray
Coordinates.
"""
m = np.empty(coords.shape)
m[:, :3] = (coords[:, :3] * self.... | [
"Map",
"coordinates"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/transforms/linear.py#L96-L113 | [
"def",
"map",
"(",
"self",
",",
"coords",
")",
":",
"m",
"=",
"np",
".",
"empty",
"(",
"coords",
".",
"shape",
")",
"m",
"[",
":",
",",
":",
"3",
"]",
"=",
"(",
"coords",
"[",
":",
",",
":",
"3",
"]",
"*",
"self",
".",
"scale",
"[",
"np",... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | STTransform.move | Change the translation of this transform by the amount given.
Parameters
----------
move : array-like
The values to be added to the current translation of the transform. | glue_vispy_viewers/extern/vispy/visuals/transforms/linear.py | def move(self, move):
"""Change the translation of this transform by the amount given.
Parameters
----------
move : array-like
The values to be added to the current translation of the transform.
"""
move = as_vec4(move, default=(0, 0, 0, 0))
self.tran... | def move(self, move):
"""Change the translation of this transform by the amount given.
Parameters
----------
move : array-like
The values to be added to the current translation of the transform.
"""
move = as_vec4(move, default=(0, 0, 0, 0))
self.tran... | [
"Change",
"the",
"translation",
"of",
"this",
"transform",
"by",
"the",
"amount",
"given",
"."
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/transforms/linear.py#L181-L190 | [
"def",
"move",
"(",
"self",
",",
"move",
")",
":",
"move",
"=",
"as_vec4",
"(",
"move",
",",
"default",
"=",
"(",
"0",
",",
"0",
",",
"0",
",",
"0",
")",
")",
"self",
".",
"translate",
"=",
"self",
".",
"translate",
"+",
"move"
] | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | STTransform.zoom | Update the transform such that its scale factor is changed, but
the specified center point is left unchanged.
Parameters
----------
zoom : array-like
Values to multiply the transform's current scale
factors.
center : array-like
The center poin... | glue_vispy_viewers/extern/vispy/visuals/transforms/linear.py | def zoom(self, zoom, center=(0, 0, 0), mapped=True):
"""Update the transform such that its scale factor is changed, but
the specified center point is left unchanged.
Parameters
----------
zoom : array-like
Values to multiply the transform's current scale
... | def zoom(self, zoom, center=(0, 0, 0), mapped=True):
"""Update the transform such that its scale factor is changed, but
the specified center point is left unchanged.
Parameters
----------
zoom : array-like
Values to multiply the transform's current scale
... | [
"Update",
"the",
"transform",
"such",
"that",
"its",
"scale",
"factor",
"is",
"changed",
"but",
"the",
"specified",
"center",
"point",
"is",
"left",
"unchanged",
"."
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/transforms/linear.py#L192-L214 | [
"def",
"zoom",
"(",
"self",
",",
"zoom",
",",
"center",
"=",
"(",
"0",
",",
"0",
",",
"0",
")",
",",
"mapped",
"=",
"True",
")",
":",
"zoom",
"=",
"as_vec4",
"(",
"zoom",
",",
"default",
"=",
"(",
"1",
",",
"1",
",",
"1",
",",
"1",
")",
"... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | STTransform.from_mapping | Create an STTransform from the given mapping
See `set_mapping` for details.
Parameters
----------
x0 : array-like
Start.
x1 : array-like
End.
Returns
-------
t : instance of STTransform
The transform. | glue_vispy_viewers/extern/vispy/visuals/transforms/linear.py | def from_mapping(cls, x0, x1):
""" Create an STTransform from the given mapping
See `set_mapping` for details.
Parameters
----------
x0 : array-like
Start.
x1 : array-like
End.
Returns
-------
t : instance of STTransform
... | def from_mapping(cls, x0, x1):
""" Create an STTransform from the given mapping
See `set_mapping` for details.
Parameters
----------
x0 : array-like
Start.
x1 : array-like
End.
Returns
-------
t : instance of STTransform
... | [
"Create",
"an",
"STTransform",
"from",
"the",
"given",
"mapping"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/transforms/linear.py#L223-L242 | [
"def",
"from_mapping",
"(",
"cls",
",",
"x0",
",",
"x1",
")",
":",
"t",
"=",
"cls",
"(",
")",
"t",
".",
"set_mapping",
"(",
"x0",
",",
"x1",
")",
"return",
"t"
] | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | STTransform.set_mapping | Configure this transform such that it maps points x0 => x1
Parameters
----------
x0 : array-like, shape (2, 2) or (2, 3)
Start location.
x1 : array-like, shape (2, 2) or (2, 3)
End location.
update : bool
If False, then the update event is not... | glue_vispy_viewers/extern/vispy/visuals/transforms/linear.py | def set_mapping(self, x0, x1, update=True):
"""Configure this transform such that it maps points x0 => x1
Parameters
----------
x0 : array-like, shape (2, 2) or (2, 3)
Start location.
x1 : array-like, shape (2, 2) or (2, 3)
End location.
update : ... | def set_mapping(self, x0, x1, update=True):
"""Configure this transform such that it maps points x0 => x1
Parameters
----------
x0 : array-like, shape (2, 2) or (2, 3)
Start location.
x1 : array-like, shape (2, 2) or (2, 3)
End location.
update : ... | [
"Configure",
"this",
"transform",
"such",
"that",
"it",
"maps",
"points",
"x0",
"=",
">",
"x1"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/transforms/linear.py#L244-L294 | [
"def",
"set_mapping",
"(",
"self",
",",
"x0",
",",
"x1",
",",
"update",
"=",
"True",
")",
":",
"# if args are Rect, convert to array first",
"if",
"isinstance",
"(",
"x0",
",",
"Rect",
")",
":",
"x0",
"=",
"x0",
".",
"_transform_in",
"(",
")",
"[",
":",
... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | MatrixTransform.translate | Translate the matrix
The translation is applied *after* the transformations already present
in the matrix.
Parameters
----------
pos : arrayndarray
Position to translate by. | glue_vispy_viewers/extern/vispy/visuals/transforms/linear.py | def translate(self, pos):
"""
Translate the matrix
The translation is applied *after* the transformations already present
in the matrix.
Parameters
----------
pos : arrayndarray
Position to translate by.
"""
self.matrix = np.dot(self.... | def translate(self, pos):
"""
Translate the matrix
The translation is applied *after* the transformations already present
in the matrix.
Parameters
----------
pos : arrayndarray
Position to translate by.
"""
self.matrix = np.dot(self.... | [
"Translate",
"the",
"matrix"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/transforms/linear.py#L410-L422 | [
"def",
"translate",
"(",
"self",
",",
"pos",
")",
":",
"self",
".",
"matrix",
"=",
"np",
".",
"dot",
"(",
"self",
".",
"matrix",
",",
"transforms",
".",
"translate",
"(",
"pos",
"[",
"0",
",",
":",
"3",
"]",
")",
")"
] | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | MatrixTransform.scale | Scale the matrix about a given origin.
The scaling is applied *after* the transformations already present
in the matrix.
Parameters
----------
scale : array-like
Scale factors along x, y and z axes.
center : array-like or None
The x, y and z coor... | glue_vispy_viewers/extern/vispy/visuals/transforms/linear.py | def scale(self, scale, center=None):
"""
Scale the matrix about a given origin.
The scaling is applied *after* the transformations already present
in the matrix.
Parameters
----------
scale : array-like
Scale factors along x, y and z axes.
ce... | def scale(self, scale, center=None):
"""
Scale the matrix about a given origin.
The scaling is applied *after* the transformations already present
in the matrix.
Parameters
----------
scale : array-like
Scale factors along x, y and z axes.
ce... | [
"Scale",
"the",
"matrix",
"about",
"a",
"given",
"origin",
"."
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/transforms/linear.py#L424-L444 | [
"def",
"scale",
"(",
"self",
",",
"scale",
",",
"center",
"=",
"None",
")",
":",
"scale",
"=",
"transforms",
".",
"scale",
"(",
"as_vec4",
"(",
"scale",
",",
"default",
"=",
"(",
"1",
",",
"1",
",",
"1",
",",
"1",
")",
")",
"[",
"0",
",",
":"... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | MatrixTransform.rotate | Rotate the matrix by some angle about a given axis.
The rotation is applied *after* the transformations already present
in the matrix.
Parameters
----------
angle : float
The angle of rotation, in degrees.
axis : array-like
The x, y and z coordin... | glue_vispy_viewers/extern/vispy/visuals/transforms/linear.py | def rotate(self, angle, axis):
"""
Rotate the matrix by some angle about a given axis.
The rotation is applied *after* the transformations already present
in the matrix.
Parameters
----------
angle : float
The angle of rotation, in degrees.
a... | def rotate(self, angle, axis):
"""
Rotate the matrix by some angle about a given axis.
The rotation is applied *after* the transformations already present
in the matrix.
Parameters
----------
angle : float
The angle of rotation, in degrees.
a... | [
"Rotate",
"the",
"matrix",
"by",
"some",
"angle",
"about",
"a",
"given",
"axis",
"."
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/transforms/linear.py#L446-L460 | [
"def",
"rotate",
"(",
"self",
",",
"angle",
",",
"axis",
")",
":",
"self",
".",
"matrix",
"=",
"np",
".",
"dot",
"(",
"self",
".",
"matrix",
",",
"transforms",
".",
"rotate",
"(",
"angle",
",",
"axis",
")",
")"
] | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | MatrixTransform.set_mapping | Set to a 3D transformation matrix that maps points1 onto points2.
Parameters
----------
points1 : array-like, shape (4, 3)
Four starting 3D coordinates.
points2 : array-like, shape (4, 3)
Four ending 3D coordinates. | glue_vispy_viewers/extern/vispy/visuals/transforms/linear.py | def set_mapping(self, points1, points2):
""" Set to a 3D transformation matrix that maps points1 onto points2.
Parameters
----------
points1 : array-like, shape (4, 3)
Four starting 3D coordinates.
points2 : array-like, shape (4, 3)
Four ending 3D coordin... | def set_mapping(self, points1, points2):
""" Set to a 3D transformation matrix that maps points1 onto points2.
Parameters
----------
points1 : array-like, shape (4, 3)
Four starting 3D coordinates.
points2 : array-like, shape (4, 3)
Four ending 3D coordin... | [
"Set",
"to",
"a",
"3D",
"transformation",
"matrix",
"that",
"maps",
"points1",
"onto",
"points2",
"."
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/transforms/linear.py#L462-L474 | [
"def",
"set_mapping",
"(",
"self",
",",
"points1",
",",
"points2",
")",
":",
"# note: need to transpose because util.functions uses opposite",
"# of standard linear algebra order.",
"self",
".",
"matrix",
"=",
"transforms",
".",
"affine_map",
"(",
"points1",
",",
"points2... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | MatrixTransform.set_ortho | Set ortho transform
Parameters
----------
l : float
Left.
r : float
Right.
b : float
Bottom.
t : float
Top.
n : float
Near.
f : float
Far. | glue_vispy_viewers/extern/vispy/visuals/transforms/linear.py | def set_ortho(self, l, r, b, t, n, f):
"""Set ortho transform
Parameters
----------
l : float
Left.
r : float
Right.
b : float
Bottom.
t : float
Top.
n : float
Near.
f : float
... | def set_ortho(self, l, r, b, t, n, f):
"""Set ortho transform
Parameters
----------
l : float
Left.
r : float
Right.
b : float
Bottom.
t : float
Top.
n : float
Near.
f : float
... | [
"Set",
"ortho",
"transform"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/transforms/linear.py#L476-L494 | [
"def",
"set_ortho",
"(",
"self",
",",
"l",
",",
"r",
",",
"b",
",",
"t",
",",
"n",
",",
"f",
")",
":",
"self",
".",
"matrix",
"=",
"transforms",
".",
"ortho",
"(",
"l",
",",
"r",
",",
"b",
",",
"t",
",",
"n",
",",
"f",
")"
] | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | MatrixTransform.set_perspective | Set the perspective
Parameters
----------
fov : float
Field of view.
aspect : float
Aspect ratio.
near : float
Near location.
far : float
Far location. | glue_vispy_viewers/extern/vispy/visuals/transforms/linear.py | def set_perspective(self, fov, aspect, near, far):
"""Set the perspective
Parameters
----------
fov : float
Field of view.
aspect : float
Aspect ratio.
near : float
Near location.
far : float
Far location.
"... | def set_perspective(self, fov, aspect, near, far):
"""Set the perspective
Parameters
----------
fov : float
Field of view.
aspect : float
Aspect ratio.
near : float
Near location.
far : float
Far location.
"... | [
"Set",
"the",
"perspective"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/transforms/linear.py#L516-L530 | [
"def",
"set_perspective",
"(",
"self",
",",
"fov",
",",
"aspect",
",",
"near",
",",
"far",
")",
":",
"self",
".",
"matrix",
"=",
"transforms",
".",
"perspective",
"(",
"fov",
",",
"aspect",
",",
"near",
",",
"far",
")"
] | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | MatrixTransform.set_frustum | Set the frustum
Parameters
----------
l : float
Left.
r : float
Right.
b : float
Bottom.
t : float
Top.
n : float
Near.
f : float
Far. | glue_vispy_viewers/extern/vispy/visuals/transforms/linear.py | def set_frustum(self, l, r, b, t, n, f):
"""Set the frustum
Parameters
----------
l : float
Left.
r : float
Right.
b : float
Bottom.
t : float
Top.
n : float
Near.
f : float
F... | def set_frustum(self, l, r, b, t, n, f):
"""Set the frustum
Parameters
----------
l : float
Left.
r : float
Right.
b : float
Bottom.
t : float
Top.
n : float
Near.
f : float
F... | [
"Set",
"the",
"frustum"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/transforms/linear.py#L532-L550 | [
"def",
"set_frustum",
"(",
"self",
",",
"l",
",",
"r",
",",
"b",
",",
"t",
",",
"n",
",",
"f",
")",
":",
"self",
".",
"matrix",
"=",
"transforms",
".",
"frustum",
"(",
"l",
",",
"r",
",",
"b",
",",
"t",
",",
"n",
",",
"f",
")"
] | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | log2_lut | See `this algo <https://graphics.stanford.edu/~seander/bithacks.html#IntegerLogLookup>`__ for
computing the log2 of a 32 bit integer using a look up table
Parameters
----------
v : int
32 bit integer
Returns
------- | mocpy/utils.py | def log2_lut(v):
"""
See `this algo <https://graphics.stanford.edu/~seander/bithacks.html#IntegerLogLookup>`__ for
computing the log2 of a 32 bit integer using a look up table
Parameters
----------
v : int
32 bit integer
Returns
-------
"""
res = np.zeros(v.shape, dtyp... | def log2_lut(v):
"""
See `this algo <https://graphics.stanford.edu/~seander/bithacks.html#IntegerLogLookup>`__ for
computing the log2 of a 32 bit integer using a look up table
Parameters
----------
v : int
32 bit integer
Returns
-------
"""
res = np.zeros(v.shape, dtyp... | [
"See",
"this",
"algo",
"<https",
":",
"//",
"graphics",
".",
"stanford",
".",
"edu",
"/",
"~seander",
"/",
"bithacks",
".",
"html#IntegerLogLookup",
">",
"__",
"for",
"computing",
"the",
"log2",
"of",
"a",
"32",
"bit",
"integer",
"using",
"a",
"look",
"u... | cds-astro/mocpy | python | https://github.com/cds-astro/mocpy/blob/09472cabe537f6bfdb049eeea64d3ea57b391c21/mocpy/utils.py#L27-L61 | [
"def",
"log2_lut",
"(",
"v",
")",
":",
"res",
"=",
"np",
".",
"zeros",
"(",
"v",
".",
"shape",
",",
"dtype",
"=",
"np",
".",
"int32",
")",
"tt",
"=",
"v",
">>",
"16",
"tt_zero",
"=",
"(",
"tt",
"==",
"0",
")",
"tt_not_zero",
"=",
"~",
"tt_zer... | 09472cabe537f6bfdb049eeea64d3ea57b391c21 |
train | uniq2orderipix_lut | ~30% faster than the method below
Parameters
----------
uniq
Returns
------- | mocpy/utils.py | def uniq2orderipix_lut(uniq):
"""
~30% faster than the method below
Parameters
----------
uniq
Returns
-------
"""
order = log2_lut(uniq >> 2) >> 1
ipix = uniq - (1 << (2 * (order + 1)))
return order, ipix | def uniq2orderipix_lut(uniq):
"""
~30% faster than the method below
Parameters
----------
uniq
Returns
-------
"""
order = log2_lut(uniq >> 2) >> 1
ipix = uniq - (1 << (2 * (order + 1)))
return order, ipix | [
"~30%",
"faster",
"than",
"the",
"method",
"below",
"Parameters",
"----------",
"uniq"
] | cds-astro/mocpy | python | https://github.com/cds-astro/mocpy/blob/09472cabe537f6bfdb049eeea64d3ea57b391c21/mocpy/utils.py#L64-L77 | [
"def",
"uniq2orderipix_lut",
"(",
"uniq",
")",
":",
"order",
"=",
"log2_lut",
"(",
"uniq",
">>",
"2",
")",
">>",
"1",
"ipix",
"=",
"uniq",
"-",
"(",
"1",
"<<",
"(",
"2",
"*",
"(",
"order",
"+",
"1",
")",
")",
")",
"return",
"order",
",",
"ipix"... | 09472cabe537f6bfdb049eeea64d3ea57b391c21 |
train | uniq2orderipix | convert a HEALPix pixel coded as a NUNIQ number
to a (norder, ipix) tuple | mocpy/utils.py | def uniq2orderipix(uniq):
"""
convert a HEALPix pixel coded as a NUNIQ number
to a (norder, ipix) tuple
"""
order = ((np.log2(uniq//4)) // 2)
order = order.astype(int)
ipix = uniq - 4 * (4**order)
return order, ipix | def uniq2orderipix(uniq):
"""
convert a HEALPix pixel coded as a NUNIQ number
to a (norder, ipix) tuple
"""
order = ((np.log2(uniq//4)) // 2)
order = order.astype(int)
ipix = uniq - 4 * (4**order)
return order, ipix | [
"convert",
"a",
"HEALPix",
"pixel",
"coded",
"as",
"a",
"NUNIQ",
"number",
"to",
"a",
"(",
"norder",
"ipix",
")",
"tuple"
] | cds-astro/mocpy | python | https://github.com/cds-astro/mocpy/blob/09472cabe537f6bfdb049eeea64d3ea57b391c21/mocpy/utils.py#L80-L89 | [
"def",
"uniq2orderipix",
"(",
"uniq",
")",
":",
"order",
"=",
"(",
"(",
"np",
".",
"log2",
"(",
"uniq",
"//",
"4",
")",
")",
"//",
"2",
")",
"order",
"=",
"order",
".",
"astype",
"(",
"int",
")",
"ipix",
"=",
"uniq",
"-",
"4",
"*",
"(",
"4",
... | 09472cabe537f6bfdb049eeea64d3ea57b391c21 |
train | glBufferData | Data can be numpy array or the size of data to allocate. | glue_vispy_viewers/extern/vispy/gloo/gl/_pyopengl2.py | def glBufferData(target, data, usage):
""" Data can be numpy array or the size of data to allocate.
"""
if isinstance(data, int):
size = data
data = None
else:
size = data.nbytes
GL.glBufferData(target, size, data, usage) | def glBufferData(target, data, usage):
""" Data can be numpy array or the size of data to allocate.
"""
if isinstance(data, int):
size = data
data = None
else:
size = data.nbytes
GL.glBufferData(target, size, data, usage) | [
"Data",
"can",
"be",
"numpy",
"array",
"or",
"the",
"size",
"of",
"data",
"to",
"allocate",
"."
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/gl/_pyopengl2.py#L22-L30 | [
"def",
"glBufferData",
"(",
"target",
",",
"data",
",",
"usage",
")",
":",
"if",
"isinstance",
"(",
"data",
",",
"int",
")",
":",
"size",
"=",
"data",
"data",
"=",
"None",
"else",
":",
"size",
"=",
"data",
".",
"nbytes",
"GL",
".",
"glBufferData",
... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | LinePlotVisual.set_data | Set the line data
Parameters
----------
data : array-like
The data.
**kwargs : dict
Keywoard arguments to pass to MarkerVisual and LineVisal. | glue_vispy_viewers/extern/vispy/visuals/line_plot.py | def set_data(self, data=None, **kwargs):
"""Set the line data
Parameters
----------
data : array-like
The data.
**kwargs : dict
Keywoard arguments to pass to MarkerVisual and LineVisal.
"""
if data is None:
pos = None
e... | def set_data(self, data=None, **kwargs):
"""Set the line data
Parameters
----------
data : array-like
The data.
**kwargs : dict
Keywoard arguments to pass to MarkerVisual and LineVisal.
"""
if data is None:
pos = None
e... | [
"Set",
"the",
"line",
"data"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/line_plot.py#L72-L128 | [
"def",
"set_data",
"(",
"self",
",",
"data",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"data",
"is",
"None",
":",
"pos",
"=",
"None",
"else",
":",
"if",
"isinstance",
"(",
"data",
",",
"tuple",
")",
":",
"pos",
"=",
"np",
".",
"arra... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.