repo stringlengths 7 55 | path stringlengths 4 223 | func_name stringlengths 1 134 | original_string stringlengths 75 104k | language stringclasses 1
value | code stringlengths 75 104k | code_tokens listlengths 19 28.4k | docstring stringlengths 1 46.9k | docstring_tokens listlengths 1 1.97k | sha stringlengths 40 40 | url stringlengths 87 315 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
glue-viz/glue-vispy-viewers | glue_vispy_viewers/extern/vispy/util/quaternion.py | Quaternion.create_from_euler_angles | def create_from_euler_angles(cls, rx, ry, rz, degrees=False):
""" Classmethod to create a quaternion given the euler angles.
"""
if degrees:
rx, ry, rz = np.radians([rx, ry, rz])
# Obtain quaternions
qx = Quaternion(np.cos(rx/2), 0, 0, np.sin(rx/2))
qy = Quate... | python | def create_from_euler_angles(cls, rx, ry, rz, degrees=False):
""" Classmethod to create a quaternion given the euler angles.
"""
if degrees:
rx, ry, rz = np.radians([rx, ry, rz])
# Obtain quaternions
qx = Quaternion(np.cos(rx/2), 0, 0, np.sin(rx/2))
qy = Quate... | [
"def",
"create_from_euler_angles",
"(",
"cls",
",",
"rx",
",",
"ry",
",",
"rz",
",",
"degrees",
"=",
"False",
")",
":",
"if",
"degrees",
":",
"rx",
",",
"ry",
",",
"rz",
"=",
"np",
".",
"radians",
"(",
"[",
"rx",
",",
"ry",
",",
"rz",
"]",
")",... | Classmethod to create a quaternion given the euler angles. | [
"Classmethod",
"to",
"create",
"a",
"quaternion",
"given",
"the",
"euler",
"angles",
"."
] | 54a4351d98c1f90dfb1a557d1b447c1f57470eea | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/util/quaternion.py#L226-L236 | train |
glue-viz/glue-vispy-viewers | glue_vispy_viewers/extern/vispy/gloo/glir.py | as_enum | def as_enum(enum):
""" Turn a possibly string enum into an integer enum.
"""
if isinstance(enum, string_types):
try:
enum = getattr(gl, 'GL_' + enum.upper())
except AttributeError:
try:
enum = _internalformats['GL_' + enum.upper()]
except K... | python | def as_enum(enum):
""" Turn a possibly string enum into an integer enum.
"""
if isinstance(enum, string_types):
try:
enum = getattr(gl, 'GL_' + enum.upper())
except AttributeError:
try:
enum = _internalformats['GL_' + enum.upper()]
except K... | [
"def",
"as_enum",
"(",
"enum",
")",
":",
"if",
"isinstance",
"(",
"enum",
",",
"string_types",
")",
":",
"try",
":",
"enum",
"=",
"getattr",
"(",
"gl",
",",
"'GL_'",
"+",
"enum",
".",
"upper",
"(",
")",
")",
"except",
"AttributeError",
":",
"try",
... | Turn a possibly string enum into an integer enum. | [
"Turn",
"a",
"possibly",
"string",
"enum",
"into",
"an",
"integer",
"enum",
"."
] | 54a4351d98c1f90dfb1a557d1b447c1f57470eea | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/glir.py#L58-L69 | train |
glue-viz/glue-vispy-viewers | glue_vispy_viewers/extern/vispy/gloo/glir.py | convert_shaders | def convert_shaders(convert, shaders):
""" Modify shading code so that we can write code once
and make it run "everywhere".
"""
# New version of the shaders
out = []
if convert == 'es2':
for isfragment, shader in enumerate(shaders):
has_version = False
has_prec... | python | def convert_shaders(convert, shaders):
""" Modify shading code so that we can write code once
and make it run "everywhere".
"""
# New version of the shaders
out = []
if convert == 'es2':
for isfragment, shader in enumerate(shaders):
has_version = False
has_prec... | [
"def",
"convert_shaders",
"(",
"convert",
",",
"shaders",
")",
":",
"# New version of the shaders",
"out",
"=",
"[",
"]",
"if",
"convert",
"==",
"'es2'",
":",
"for",
"isfragment",
",",
"shader",
"in",
"enumerate",
"(",
"shaders",
")",
":",
"has_version",
"="... | Modify shading code so that we can write code once
and make it run "everywhere". | [
"Modify",
"shading",
"code",
"so",
"that",
"we",
"can",
"write",
"code",
"once",
"and",
"make",
"it",
"run",
"everywhere",
"."
] | 54a4351d98c1f90dfb1a557d1b447c1f57470eea | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/glir.py#L235-L293 | train |
glue-viz/glue-vispy-viewers | glue_vispy_viewers/extern/vispy/gloo/glir.py | as_es2_command | def as_es2_command(command):
""" Modify a desktop command so it works on es2.
"""
if command[0] == 'FUNC':
return (command[0], re.sub(r'^gl([A-Z])',
lambda m: m.group(1).lower(), command[1])) + command[2:]
if command[0] == 'SHADERS':
return command[:2] + convert_shaders(... | python | def as_es2_command(command):
""" Modify a desktop command so it works on es2.
"""
if command[0] == 'FUNC':
return (command[0], re.sub(r'^gl([A-Z])',
lambda m: m.group(1).lower(), command[1])) + command[2:]
if command[0] == 'SHADERS':
return command[:2] + convert_shaders(... | [
"def",
"as_es2_command",
"(",
"command",
")",
":",
"if",
"command",
"[",
"0",
"]",
"==",
"'FUNC'",
":",
"return",
"(",
"command",
"[",
"0",
"]",
",",
"re",
".",
"sub",
"(",
"r'^gl([A-Z])'",
",",
"lambda",
"m",
":",
"m",
".",
"group",
"(",
"1",
")... | Modify a desktop command so it works on es2. | [
"Modify",
"a",
"desktop",
"command",
"so",
"it",
"works",
"on",
"es2",
"."
] | 54a4351d98c1f90dfb1a557d1b447c1f57470eea | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/glir.py#L296-L307 | train |
glue-viz/glue-vispy-viewers | glue_vispy_viewers/extern/vispy/gloo/glir.py | _check_pyopengl_3D | def _check_pyopengl_3D():
"""Helper to ensure users have OpenGL for 3D texture support (for now)"""
global USE_TEX_3D
USE_TEX_3D = True
try:
import OpenGL.GL as _gl
except ImportError:
raise ImportError('PyOpenGL is required for 3D texture support')
return _gl | python | def _check_pyopengl_3D():
"""Helper to ensure users have OpenGL for 3D texture support (for now)"""
global USE_TEX_3D
USE_TEX_3D = True
try:
import OpenGL.GL as _gl
except ImportError:
raise ImportError('PyOpenGL is required for 3D texture support')
return _gl | [
"def",
"_check_pyopengl_3D",
"(",
")",
":",
"global",
"USE_TEX_3D",
"USE_TEX_3D",
"=",
"True",
"try",
":",
"import",
"OpenGL",
".",
"GL",
"as",
"_gl",
"except",
"ImportError",
":",
"raise",
"ImportError",
"(",
"'PyOpenGL is required for 3D texture support'",
")",
... | Helper to ensure users have OpenGL for 3D texture support (for now) | [
"Helper",
"to",
"ensure",
"users",
"have",
"OpenGL",
"for",
"3D",
"texture",
"support",
"(",
"for",
"now",
")"
] | 54a4351d98c1f90dfb1a557d1b447c1f57470eea | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/glir.py#L1133-L1141 | train |
glue-viz/glue-vispy-viewers | glue_vispy_viewers/extern/vispy/gloo/glir.py | _GlirQueueShare.show | def show(self, filter=None):
""" Print the list of commands currently in the queue. If filter is
given, print only commands that match the filter.
"""
for command in self._commands:
if command[0] is None: # or command[1] in self._invalid_objects:
continue # ... | python | def show(self, filter=None):
""" Print the list of commands currently in the queue. If filter is
given, print only commands that match the filter.
"""
for command in self._commands:
if command[0] is None: # or command[1] in self._invalid_objects:
continue # ... | [
"def",
"show",
"(",
"self",
",",
"filter",
"=",
"None",
")",
":",
"for",
"command",
"in",
"self",
".",
"_commands",
":",
"if",
"command",
"[",
"0",
"]",
"is",
"None",
":",
"# or command[1] in self._invalid_objects:",
"continue",
"# Skip nill commands",
"if",
... | Print the list of commands currently in the queue. If filter is
given, print only commands that match the filter. | [
"Print",
"the",
"list",
"of",
"commands",
"currently",
"in",
"the",
"queue",
".",
"If",
"filter",
"is",
"given",
"print",
"only",
"commands",
"that",
"match",
"the",
"filter",
"."
] | 54a4351d98c1f90dfb1a557d1b447c1f57470eea | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/glir.py#L110-L130 | train |
glue-viz/glue-vispy-viewers | glue_vispy_viewers/extern/vispy/gloo/glir.py | _GlirQueueShare.flush | def flush(self, parser):
""" Flush all current commands to the GLIR interpreter.
"""
if self._verbose:
show = self._verbose if isinstance(self._verbose, str) else None
self.show(show)
parser.parse(self._filter(self.clear(), parser)) | python | def flush(self, parser):
""" Flush all current commands to the GLIR interpreter.
"""
if self._verbose:
show = self._verbose if isinstance(self._verbose, str) else None
self.show(show)
parser.parse(self._filter(self.clear(), parser)) | [
"def",
"flush",
"(",
"self",
",",
"parser",
")",
":",
"if",
"self",
".",
"_verbose",
":",
"show",
"=",
"self",
".",
"_verbose",
"if",
"isinstance",
"(",
"self",
".",
"_verbose",
",",
"str",
")",
"else",
"None",
"self",
".",
"show",
"(",
"show",
")"... | Flush all current commands to the GLIR interpreter. | [
"Flush",
"all",
"current",
"commands",
"to",
"the",
"GLIR",
"interpreter",
"."
] | 54a4351d98c1f90dfb1a557d1b447c1f57470eea | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/glir.py#L140-L146 | train |
glue-viz/glue-vispy-viewers | glue_vispy_viewers/extern/vispy/gloo/glir.py | _GlirQueueShare._filter | def _filter(self, commands, parser):
""" Filter DATA/SIZE commands that are overridden by a
SIZE command.
"""
resized = set()
commands2 = []
for command in reversed(commands):
if command[0] == 'SHADERS':
convert = parser.convert_shaders()
... | python | def _filter(self, commands, parser):
""" Filter DATA/SIZE commands that are overridden by a
SIZE command.
"""
resized = set()
commands2 = []
for command in reversed(commands):
if command[0] == 'SHADERS':
convert = parser.convert_shaders()
... | [
"def",
"_filter",
"(",
"self",
",",
"commands",
",",
"parser",
")",
":",
"resized",
"=",
"set",
"(",
")",
"commands2",
"=",
"[",
"]",
"for",
"command",
"in",
"reversed",
"(",
"commands",
")",
":",
"if",
"command",
"[",
"0",
"]",
"==",
"'SHADERS'",
... | Filter DATA/SIZE commands that are overridden by a
SIZE command. | [
"Filter",
"DATA",
"/",
"SIZE",
"commands",
"that",
"are",
"overridden",
"by",
"a",
"SIZE",
"command",
"."
] | 54a4351d98c1f90dfb1a557d1b447c1f57470eea | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/glir.py#L148-L166 | train |
glue-viz/glue-vispy-viewers | glue_vispy_viewers/extern/vispy/gloo/glir.py | GlirQueue.associate | def associate(self, queue):
"""Merge this queue with another.
Both queues will use a shared command list and either one can be used
to fill or flush the shared queue.
"""
assert isinstance(queue, GlirQueue)
if queue._shared is self._shared:
return
# ... | python | def associate(self, queue):
"""Merge this queue with another.
Both queues will use a shared command list and either one can be used
to fill or flush the shared queue.
"""
assert isinstance(queue, GlirQueue)
if queue._shared is self._shared:
return
# ... | [
"def",
"associate",
"(",
"self",
",",
"queue",
")",
":",
"assert",
"isinstance",
"(",
"queue",
",",
"GlirQueue",
")",
"if",
"queue",
".",
"_shared",
"is",
"self",
".",
"_shared",
":",
"return",
"# merge commands",
"self",
".",
"_shared",
".",
"_commands",
... | Merge this queue with another.
Both queues will use a shared command list and either one can be used
to fill or flush the shared queue. | [
"Merge",
"this",
"queue",
"with",
"another",
"."
] | 54a4351d98c1f90dfb1a557d1b447c1f57470eea | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/glir.py#L209-L227 | train |
glue-viz/glue-vispy-viewers | glue_vispy_viewers/extern/vispy/gloo/glir.py | GlirParser._parse | def _parse(self, command):
""" Parse a single command.
"""
cmd, id_, args = command[0], command[1], command[2:]
if cmd == 'CURRENT':
# This context is made current
self.env.clear()
self._gl_initialize()
self.env['fbo'] = args[0]
... | python | def _parse(self, command):
""" Parse a single command.
"""
cmd, id_, args = command[0], command[1], command[2:]
if cmd == 'CURRENT':
# This context is made current
self.env.clear()
self._gl_initialize()
self.env['fbo'] = args[0]
... | [
"def",
"_parse",
"(",
"self",
",",
"command",
")",
":",
"cmd",
",",
"id_",
",",
"args",
"=",
"command",
"[",
"0",
"]",
",",
"command",
"[",
"1",
"]",
",",
"command",
"[",
"2",
":",
"]",
"if",
"cmd",
"==",
"'CURRENT'",
":",
"# This context is made c... | Parse a single command. | [
"Parse",
"a",
"single",
"command",
"."
] | 54a4351d98c1f90dfb1a557d1b447c1f57470eea | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/glir.py#L377-L443 | train |
glue-viz/glue-vispy-viewers | glue_vispy_viewers/extern/vispy/gloo/glir.py | GlirParser.parse | def parse(self, commands):
""" Parse a list of commands.
"""
# Get rid of dummy objects that represented deleted objects in
# the last parsing round.
to_delete = []
for id_, val in self._objects.items():
if val == JUST_DELETED:
to_delete.appen... | python | def parse(self, commands):
""" Parse a list of commands.
"""
# Get rid of dummy objects that represented deleted objects in
# the last parsing round.
to_delete = []
for id_, val in self._objects.items():
if val == JUST_DELETED:
to_delete.appen... | [
"def",
"parse",
"(",
"self",
",",
"commands",
")",
":",
"# Get rid of dummy objects that represented deleted objects in",
"# the last parsing round.",
"to_delete",
"=",
"[",
"]",
"for",
"id_",
",",
"val",
"in",
"self",
".",
"_objects",
".",
"items",
"(",
")",
":",... | Parse a list of commands. | [
"Parse",
"a",
"list",
"of",
"commands",
"."
] | 54a4351d98c1f90dfb1a557d1b447c1f57470eea | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/glir.py#L445-L459 | train |
glue-viz/glue-vispy-viewers | glue_vispy_viewers/extern/vispy/gloo/glir.py | GlirParser._gl_initialize | def _gl_initialize(self):
""" Deal with compatibility; desktop does not have sprites
enabled by default. ES has.
"""
if '.es' in gl.current_backend.__name__:
pass # ES2: no action required
else:
# Desktop, enable sprites
GL_VERTEX_PROGRAM_POIN... | python | def _gl_initialize(self):
""" Deal with compatibility; desktop does not have sprites
enabled by default. ES has.
"""
if '.es' in gl.current_backend.__name__:
pass # ES2: no action required
else:
# Desktop, enable sprites
GL_VERTEX_PROGRAM_POIN... | [
"def",
"_gl_initialize",
"(",
"self",
")",
":",
"if",
"'.es'",
"in",
"gl",
".",
"current_backend",
".",
"__name__",
":",
"pass",
"# ES2: no action required",
"else",
":",
"# Desktop, enable sprites",
"GL_VERTEX_PROGRAM_POINT_SIZE",
"=",
"34370",
"GL_POINT_SPRITE",
"="... | Deal with compatibility; desktop does not have sprites
enabled by default. ES has. | [
"Deal",
"with",
"compatibility",
";",
"desktop",
"does",
"not",
"have",
"sprites",
"enabled",
"by",
"default",
".",
"ES",
"has",
"."
] | 54a4351d98c1f90dfb1a557d1b447c1f57470eea | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/glir.py#L466-L483 | train |
glue-viz/glue-vispy-viewers | glue_vispy_viewers/extern/vispy/gloo/glir.py | GlirProgram.activate | def activate(self):
""" Avoid overhead in calling glUseProgram with same arg.
Warning: this will break if glUseProgram is used somewhere else.
Per context we keep track of one current program.
"""
if self._handle != self._parser.env.get('current_program', False):
self... | python | def activate(self):
""" Avoid overhead in calling glUseProgram with same arg.
Warning: this will break if glUseProgram is used somewhere else.
Per context we keep track of one current program.
"""
if self._handle != self._parser.env.get('current_program', False):
self... | [
"def",
"activate",
"(",
"self",
")",
":",
"if",
"self",
".",
"_handle",
"!=",
"self",
".",
"_parser",
".",
"env",
".",
"get",
"(",
"'current_program'",
",",
"False",
")",
":",
"self",
".",
"_parser",
".",
"env",
"[",
"'current_program'",
"]",
"=",
"s... | Avoid overhead in calling glUseProgram with same arg.
Warning: this will break if glUseProgram is used somewhere else.
Per context we keep track of one current program. | [
"Avoid",
"overhead",
"in",
"calling",
"glUseProgram",
"with",
"same",
"arg",
".",
"Warning",
":",
"this",
"will",
"break",
"if",
"glUseProgram",
"is",
"used",
"somewhere",
"else",
".",
"Per",
"context",
"we",
"keep",
"track",
"of",
"one",
"current",
"program... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/glir.py#L596-L603 | train |
glue-viz/glue-vispy-viewers | glue_vispy_viewers/extern/vispy/gloo/glir.py | GlirProgram.deactivate | def deactivate(self):
""" Avoid overhead in calling glUseProgram with same arg.
Warning: this will break if glUseProgram is used somewhere else.
Per context we keep track of one current program.
"""
if self._parser.env.get('current_program', 0) != 0:
self._parser.env[... | python | def deactivate(self):
""" Avoid overhead in calling glUseProgram with same arg.
Warning: this will break if glUseProgram is used somewhere else.
Per context we keep track of one current program.
"""
if self._parser.env.get('current_program', 0) != 0:
self._parser.env[... | [
"def",
"deactivate",
"(",
"self",
")",
":",
"if",
"self",
".",
"_parser",
".",
"env",
".",
"get",
"(",
"'current_program'",
",",
"0",
")",
"!=",
"0",
":",
"self",
".",
"_parser",
".",
"env",
"[",
"'current_program'",
"]",
"=",
"0",
"gl",
".",
"glUs... | Avoid overhead in calling glUseProgram with same arg.
Warning: this will break if glUseProgram is used somewhere else.
Per context we keep track of one current program. | [
"Avoid",
"overhead",
"in",
"calling",
"glUseProgram",
"with",
"same",
"arg",
".",
"Warning",
":",
"this",
"will",
"break",
"if",
"glUseProgram",
"is",
"used",
"somewhere",
"else",
".",
"Per",
"context",
"we",
"keep",
"track",
"of",
"one",
"current",
"program... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/glir.py#L605-L612 | train |
glue-viz/glue-vispy-viewers | glue_vispy_viewers/extern/vispy/gloo/glir.py | GlirProgram.set_shaders | def set_shaders(self, vert, frag):
""" This function takes care of setting the shading code and
compiling+linking it into a working program object that is ready
to use.
"""
self._linked = False
# Create temporary shader objects
vert_handle = gl.glCreateShader(gl.G... | python | def set_shaders(self, vert, frag):
""" This function takes care of setting the shading code and
compiling+linking it into a working program object that is ready
to use.
"""
self._linked = False
# Create temporary shader objects
vert_handle = gl.glCreateShader(gl.G... | [
"def",
"set_shaders",
"(",
"self",
",",
"vert",
",",
"frag",
")",
":",
"self",
".",
"_linked",
"=",
"False",
"# Create temporary shader objects",
"vert_handle",
"=",
"gl",
".",
"glCreateShader",
"(",
"gl",
".",
"GL_VERTEX_SHADER",
")",
"frag_handle",
"=",
"gl"... | This function takes care of setting the shading code and
compiling+linking it into a working program object that is ready
to use. | [
"This",
"function",
"takes",
"care",
"of",
"setting",
"the",
"shading",
"code",
"and",
"compiling",
"+",
"linking",
"it",
"into",
"a",
"working",
"program",
"object",
"that",
"is",
"ready",
"to",
"use",
"."
] | 54a4351d98c1f90dfb1a557d1b447c1f57470eea | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/glir.py#L614-L653 | train |
glue-viz/glue-vispy-viewers | glue_vispy_viewers/extern/vispy/gloo/glir.py | GlirProgram._get_active_attributes_and_uniforms | def _get_active_attributes_and_uniforms(self):
""" Retrieve active attributes and uniforms to be able to check that
all uniforms/attributes are set by the user.
Other GLIR implementations may omit this.
"""
# This match a name of the form "name[size]" (= array)
regex = re... | python | def _get_active_attributes_and_uniforms(self):
""" Retrieve active attributes and uniforms to be able to check that
all uniforms/attributes are set by the user.
Other GLIR implementations may omit this.
"""
# This match a name of the form "name[size]" (= array)
regex = re... | [
"def",
"_get_active_attributes_and_uniforms",
"(",
"self",
")",
":",
"# This match a name of the form \"name[size]\" (= array)",
"regex",
"=",
"re",
".",
"compile",
"(",
"\"\"\"(?P<name>\\w+)\\s*(\\[(?P<size>\\d+)\\])\\s*\"\"\"",
")",
"# Get how many active attributes and uniforms ther... | Retrieve active attributes and uniforms to be able to check that
all uniforms/attributes are set by the user.
Other GLIR implementations may omit this. | [
"Retrieve",
"active",
"attributes",
"and",
"uniforms",
"to",
"be",
"able",
"to",
"check",
"that",
"all",
"uniforms",
"/",
"attributes",
"are",
"set",
"by",
"the",
"user",
".",
"Other",
"GLIR",
"implementations",
"may",
"omit",
"this",
"."
] | 54a4351d98c1f90dfb1a557d1b447c1f57470eea | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/glir.py#L655-L680 | train |
glue-viz/glue-vispy-viewers | glue_vispy_viewers/extern/vispy/gloo/glir.py | GlirProgram._parse_error | def _parse_error(self, error):
""" Parses a single GLSL error and extracts the linenr and description
Other GLIR implementations may omit this.
"""
error = str(error)
# Nvidia
# 0(7): error C1008: undefined variable "MV"
m = re.match(r'(\d+)\((\d+)\)\s*:\s(.*)', e... | python | def _parse_error(self, error):
""" Parses a single GLSL error and extracts the linenr and description
Other GLIR implementations may omit this.
"""
error = str(error)
# Nvidia
# 0(7): error C1008: undefined variable "MV"
m = re.match(r'(\d+)\((\d+)\)\s*:\s(.*)', e... | [
"def",
"_parse_error",
"(",
"self",
",",
"error",
")",
":",
"error",
"=",
"str",
"(",
"error",
")",
"# Nvidia",
"# 0(7): error C1008: undefined variable \"MV\"",
"m",
"=",
"re",
".",
"match",
"(",
"r'(\\d+)\\((\\d+)\\)\\s*:\\s(.*)'",
",",
"error",
")",
"if",
"m"... | Parses a single GLSL error and extracts the linenr and description
Other GLIR implementations may omit this. | [
"Parses",
"a",
"single",
"GLSL",
"error",
"and",
"extracts",
"the",
"linenr",
"and",
"description",
"Other",
"GLIR",
"implementations",
"may",
"omit",
"this",
"."
] | 54a4351d98c1f90dfb1a557d1b447c1f57470eea | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/glir.py#L682-L703 | train |
glue-viz/glue-vispy-viewers | glue_vispy_viewers/extern/vispy/gloo/glir.py | GlirProgram._get_error | def _get_error(self, code, errors, indentation=0):
"""Get error and show the faulty line + some context
Other GLIR implementations may omit this.
"""
# Init
results = []
lines = None
if code is not None:
lines = [line.strip() for line in code.split('\n... | python | def _get_error(self, code, errors, indentation=0):
"""Get error and show the faulty line + some context
Other GLIR implementations may omit this.
"""
# Init
results = []
lines = None
if code is not None:
lines = [line.strip() for line in code.split('\n... | [
"def",
"_get_error",
"(",
"self",
",",
"code",
",",
"errors",
",",
"indentation",
"=",
"0",
")",
":",
"# Init",
"results",
"=",
"[",
"]",
"lines",
"=",
"None",
"if",
"code",
"is",
"not",
"None",
":",
"lines",
"=",
"[",
"line",
".",
"strip",
"(",
... | Get error and show the faulty line + some context
Other GLIR implementations may omit this. | [
"Get",
"error",
"and",
"show",
"the",
"faulty",
"line",
"+",
"some",
"context",
"Other",
"GLIR",
"implementations",
"may",
"omit",
"this",
"."
] | 54a4351d98c1f90dfb1a557d1b447c1f57470eea | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/glir.py#L705-L731 | train |
glue-viz/glue-vispy-viewers | glue_vispy_viewers/extern/vispy/gloo/glir.py | GlirProgram.set_texture | def set_texture(self, name, value):
""" Set a texture sampler. Value is the id of the texture to link.
"""
if not self._linked:
raise RuntimeError('Cannot set uniform when program has no code')
# Get handle for the uniform, first try cache
handle = self._handles.get(n... | python | def set_texture(self, name, value):
""" Set a texture sampler. Value is the id of the texture to link.
"""
if not self._linked:
raise RuntimeError('Cannot set uniform when program has no code')
# Get handle for the uniform, first try cache
handle = self._handles.get(n... | [
"def",
"set_texture",
"(",
"self",
",",
"name",
",",
"value",
")",
":",
"if",
"not",
"self",
".",
"_linked",
":",
"raise",
"RuntimeError",
"(",
"'Cannot set uniform when program has no code'",
")",
"# Get handle for the uniform, first try cache",
"handle",
"=",
"self"... | Set a texture sampler. Value is the id of the texture to link. | [
"Set",
"a",
"texture",
"sampler",
".",
"Value",
"is",
"the",
"id",
"of",
"the",
"texture",
"to",
"link",
"."
] | 54a4351d98c1f90dfb1a557d1b447c1f57470eea | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/glir.py#L733-L763 | train |
glue-viz/glue-vispy-viewers | glue_vispy_viewers/extern/vispy/gloo/glir.py | GlirProgram.set_uniform | def set_uniform(self, name, type_, value):
""" Set a uniform value. Value is assumed to have been checked.
"""
if not self._linked:
raise RuntimeError('Cannot set uniform when program has no code')
# Get handle for the uniform, first try cache
handle = self._handles.g... | python | def set_uniform(self, name, type_, value):
""" Set a uniform value. Value is assumed to have been checked.
"""
if not self._linked:
raise RuntimeError('Cannot set uniform when program has no code')
# Get handle for the uniform, first try cache
handle = self._handles.g... | [
"def",
"set_uniform",
"(",
"self",
",",
"name",
",",
"type_",
",",
"value",
")",
":",
"if",
"not",
"self",
".",
"_linked",
":",
"raise",
"RuntimeError",
"(",
"'Cannot set uniform when program has no code'",
")",
"# Get handle for the uniform, first try cache",
"handle... | Set a uniform value. Value is assumed to have been checked. | [
"Set",
"a",
"uniform",
"value",
".",
"Value",
"is",
"assumed",
"to",
"have",
"been",
"checked",
"."
] | 54a4351d98c1f90dfb1a557d1b447c1f57470eea | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/glir.py#L765-L803 | train |
glue-viz/glue-vispy-viewers | glue_vispy_viewers/extern/vispy/gloo/glir.py | GlirProgram.set_attribute | def set_attribute(self, name, type_, value):
""" Set an attribute value. Value is assumed to have been checked.
"""
if not self._linked:
raise RuntimeError('Cannot set attribute when program has no code')
# Get handle for the attribute, first try cache
handle = self._... | python | def set_attribute(self, name, type_, value):
""" Set an attribute value. Value is assumed to have been checked.
"""
if not self._linked:
raise RuntimeError('Cannot set attribute when program has no code')
# Get handle for the attribute, first try cache
handle = self._... | [
"def",
"set_attribute",
"(",
"self",
",",
"name",
",",
"type_",
",",
"value",
")",
":",
"if",
"not",
"self",
".",
"_linked",
":",
"raise",
"RuntimeError",
"(",
"'Cannot set attribute when program has no code'",
")",
"# Get handle for the attribute, first try cache",
"... | Set an attribute value. Value is assumed to have been checked. | [
"Set",
"an",
"attribute",
"value",
".",
"Value",
"is",
"assumed",
"to",
"have",
"been",
"checked",
"."
] | 54a4351d98c1f90dfb1a557d1b447c1f57470eea | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/glir.py#L805-L846 | train |
glue-viz/glue-vispy-viewers | glue_vispy_viewers/extern/vispy/gloo/glir.py | GlirProgram.draw | def draw(self, mode, selection):
""" Draw program in given mode, with given selection (IndexBuffer or
first, count).
"""
if not self._linked:
raise RuntimeError('Cannot draw program if code has not been set')
# Init
gl.check_error('Check before draw')
... | python | def draw(self, mode, selection):
""" Draw program in given mode, with given selection (IndexBuffer or
first, count).
"""
if not self._linked:
raise RuntimeError('Cannot draw program if code has not been set')
# Init
gl.check_error('Check before draw')
... | [
"def",
"draw",
"(",
"self",
",",
"mode",
",",
"selection",
")",
":",
"if",
"not",
"self",
".",
"_linked",
":",
"raise",
"RuntimeError",
"(",
"'Cannot draw program if code has not been set'",
")",
"# Init",
"gl",
".",
"check_error",
"(",
"'Check before draw'",
")... | Draw program in given mode, with given selection (IndexBuffer or
first, count). | [
"Draw",
"program",
"in",
"given",
"mode",
"with",
"given",
"selection",
"(",
"IndexBuffer",
"or",
"first",
"count",
")",
"."
] | 54a4351d98c1f90dfb1a557d1b447c1f57470eea | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/glir.py#L893-L920 | train |
glue-viz/glue-vispy-viewers | glue_vispy_viewers/utils.py | as_matrix_transform | def as_matrix_transform(transform):
"""
Simplify a transform to a single matrix transform, which makes it a lot
faster to compute transformations.
Raises a TypeError if the transform cannot be simplified.
"""
if isinstance(transform, ChainTransform):
matrix = np.identity(4)
for ... | python | def as_matrix_transform(transform):
"""
Simplify a transform to a single matrix transform, which makes it a lot
faster to compute transformations.
Raises a TypeError if the transform cannot be simplified.
"""
if isinstance(transform, ChainTransform):
matrix = np.identity(4)
for ... | [
"def",
"as_matrix_transform",
"(",
"transform",
")",
":",
"if",
"isinstance",
"(",
"transform",
",",
"ChainTransform",
")",
":",
"matrix",
"=",
"np",
".",
"identity",
"(",
"4",
")",
"for",
"tr",
"in",
"transform",
".",
"transforms",
":",
"# We need to do the... | Simplify a transform to a single matrix transform, which makes it a lot
faster to compute transformations.
Raises a TypeError if the transform cannot be simplified. | [
"Simplify",
"a",
"transform",
"to",
"a",
"single",
"matrix",
"transform",
"which",
"makes",
"it",
"a",
"lot",
"faster",
"to",
"compute",
"transformations",
"."
] | 54a4351d98c1f90dfb1a557d1b447c1f57470eea | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/utils.py#L11-L37 | train |
glue-viz/glue-vispy-viewers | glue_vispy_viewers/extern/vispy/visuals/graphs/layouts/circular.py | circular | def circular(adjacency_mat, directed=False):
"""Places all nodes on a single circle.
Parameters
----------
adjacency_mat : matrix or sparse
The graph adjacency matrix
directed : bool
Whether the graph is directed. If this is True, is will also
generate the vertices for arrow... | python | def circular(adjacency_mat, directed=False):
"""Places all nodes on a single circle.
Parameters
----------
adjacency_mat : matrix or sparse
The graph adjacency matrix
directed : bool
Whether the graph is directed. If this is True, is will also
generate the vertices for arrow... | [
"def",
"circular",
"(",
"adjacency_mat",
",",
"directed",
"=",
"False",
")",
":",
"if",
"issparse",
"(",
"adjacency_mat",
")",
":",
"adjacency_mat",
"=",
"adjacency_mat",
".",
"tocoo",
"(",
")",
"num_nodes",
"=",
"adjacency_mat",
".",
"shape",
"[",
"0",
"]... | Places all nodes on a single circle.
Parameters
----------
adjacency_mat : matrix or sparse
The graph adjacency matrix
directed : bool
Whether the graph is directed. If this is True, is will also
generate the vertices for arrows, which can be passed to an
ArrowVisual.
... | [
"Places",
"all",
"nodes",
"on",
"a",
"single",
"circle",
"."
] | 54a4351d98c1f90dfb1a557d1b447c1f57470eea | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/graphs/layouts/circular.py#L16-L49 | train |
glue-viz/glue-vispy-viewers | glue_vispy_viewers/extern/vispy/visuals/collections/agg_path_collection.py | AggPathCollection.append | def append(self, P, closed=False, itemsize=None, **kwargs):
"""
Append a new set of vertices to the collection.
For kwargs argument, n is the number of vertices (local) or the number
of item (shared)
Parameters
----------
P : np.array
Vertices posit... | python | def append(self, P, closed=False, itemsize=None, **kwargs):
"""
Append a new set of vertices to the collection.
For kwargs argument, n is the number of vertices (local) or the number
of item (shared)
Parameters
----------
P : np.array
Vertices posit... | [
"def",
"append",
"(",
"self",
",",
"P",
",",
"closed",
"=",
"False",
",",
"itemsize",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"itemsize",
"=",
"itemsize",
"or",
"len",
"(",
"P",
")",
"itemcount",
"=",
"len",
"(",
"P",
")",
"/",
"itemsize"... | Append a new set of vertices to the collection.
For kwargs argument, n is the number of vertices (local) or the number
of item (shared)
Parameters
----------
P : np.array
Vertices positions of the path(s) to be added
closed: bool
Whether path(s... | [
"Append",
"a",
"new",
"set",
"of",
"vertices",
"to",
"the",
"collection",
"."
] | 54a4351d98c1f90dfb1a557d1b447c1f57470eea | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/collections/agg_path_collection.py#L101-L196 | train |
glue-viz/glue-vispy-viewers | glue_vispy_viewers/extern/vispy/visuals/collections/agg_path_collection.py | AggPathCollection.draw | def draw(self, mode="triangles"):
""" Draw collection """
gl.glDepthMask(0)
Collection.draw(self, mode)
gl.glDepthMask(1) | python | def draw(self, mode="triangles"):
""" Draw collection """
gl.glDepthMask(0)
Collection.draw(self, mode)
gl.glDepthMask(1) | [
"def",
"draw",
"(",
"self",
",",
"mode",
"=",
"\"triangles\"",
")",
":",
"gl",
".",
"glDepthMask",
"(",
"0",
")",
"Collection",
".",
"draw",
"(",
"self",
",",
"mode",
")",
"gl",
".",
"glDepthMask",
"(",
"1",
")"
] | Draw collection | [
"Draw",
"collection"
] | 54a4351d98c1f90dfb1a557d1b447c1f57470eea | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/collections/agg_path_collection.py#L198-L203 | train |
glue-viz/glue-vispy-viewers | glue_vispy_viewers/extern/vispy/visuals/markers.py | MarkersVisual.set_data | def set_data(self, pos=None, symbol='o', size=10., edge_width=1.,
edge_width_rel=None, edge_color='black', face_color='white',
scaling=False):
""" Set the data used to display this visual.
Parameters
----------
pos : array
The array of locat... | python | def set_data(self, pos=None, symbol='o', size=10., edge_width=1.,
edge_width_rel=None, edge_color='black', face_color='white',
scaling=False):
""" Set the data used to display this visual.
Parameters
----------
pos : array
The array of locat... | [
"def",
"set_data",
"(",
"self",
",",
"pos",
"=",
"None",
",",
"symbol",
"=",
"'o'",
",",
"size",
"=",
"10.",
",",
"edge_width",
"=",
"1.",
",",
"edge_width_rel",
"=",
"None",
",",
"edge_color",
"=",
"'black'",
",",
"face_color",
"=",
"'white'",
",",
... | Set the data used to display this visual.
Parameters
----------
pos : array
The array of locations to display each symbol.
symbol : str
The style of symbol to draw (see Notes).
size : float or array
The symbol size in px.
edge_width : ... | [
"Set",
"the",
"data",
"used",
"to",
"display",
"this",
"visual",
"."
] | 54a4351d98c1f90dfb1a557d1b447c1f57470eea | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/markers.py#L502-L573 | train |
rbarrois/mpdlcd | mpdlcd/display_fields.py | Field.hook_changed | def hook_changed(self, hook_name, widget, new_data):
"""Handle a hook upate."""
if hook_name == 'song':
self.song_changed(widget, new_data)
elif hook_name == 'state':
self.state_changed(widget, new_data)
elif hook_name == 'elapsed_and_total':
elapsed, ... | python | def hook_changed(self, hook_name, widget, new_data):
"""Handle a hook upate."""
if hook_name == 'song':
self.song_changed(widget, new_data)
elif hook_name == 'state':
self.state_changed(widget, new_data)
elif hook_name == 'elapsed_and_total':
elapsed, ... | [
"def",
"hook_changed",
"(",
"self",
",",
"hook_name",
",",
"widget",
",",
"new_data",
")",
":",
"if",
"hook_name",
"==",
"'song'",
":",
"self",
".",
"song_changed",
"(",
"widget",
",",
"new_data",
")",
"elif",
"hook_name",
"==",
"'state'",
":",
"self",
"... | Handle a hook upate. | [
"Handle",
"a",
"hook",
"upate",
"."
] | 85f16c8cc0883f8abb4c2cc7f69729c3e2f857da | https://github.com/rbarrois/mpdlcd/blob/85f16c8cc0883f8abb4c2cc7f69729c3e2f857da/mpdlcd/display_fields.py#L104-L112 | train |
glue-viz/glue-vispy-viewers | glue_vispy_viewers/extern/vispy/ext/_bundled/decorator.py | FunctionMaker.update | def update(self, func, **kw):
"Update the signature of func with the data in self"
func.__name__ = self.name
func.__doc__ = getattr(self, 'doc', None)
func.__dict__ = getattr(self, 'dict', {})
func.__defaults__ = getattr(self, 'defaults', ())
func.__kwdefaults__ = getattr... | python | def update(self, func, **kw):
"Update the signature of func with the data in self"
func.__name__ = self.name
func.__doc__ = getattr(self, 'doc', None)
func.__dict__ = getattr(self, 'dict', {})
func.__defaults__ = getattr(self, 'defaults', ())
func.__kwdefaults__ = getattr... | [
"def",
"update",
"(",
"self",
",",
"func",
",",
"*",
"*",
"kw",
")",
":",
"func",
".",
"__name__",
"=",
"self",
".",
"name",
"func",
".",
"__doc__",
"=",
"getattr",
"(",
"self",
",",
"'doc'",
",",
"None",
")",
"func",
".",
"__dict__",
"=",
"getat... | Update the signature of func with the data in self | [
"Update",
"the",
"signature",
"of",
"func",
"with",
"the",
"data",
"in",
"self"
] | 54a4351d98c1f90dfb1a557d1b447c1f57470eea | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/ext/_bundled/decorator.py#L128-L138 | train |
glue-viz/glue-vispy-viewers | glue_vispy_viewers/extern/vispy/ext/_bundled/decorator.py | FunctionMaker.make | def make(self, src_templ, evaldict=None, addsource=False, **attrs):
"Make a new function from a given template and update the signature"
src = src_templ % vars(self) # expand name and signature
evaldict = evaldict or {}
mo = DEF.match(src)
if mo is None:
raise SyntaxE... | python | def make(self, src_templ, evaldict=None, addsource=False, **attrs):
"Make a new function from a given template and update the signature"
src = src_templ % vars(self) # expand name and signature
evaldict = evaldict or {}
mo = DEF.match(src)
if mo is None:
raise SyntaxE... | [
"def",
"make",
"(",
"self",
",",
"src_templ",
",",
"evaldict",
"=",
"None",
",",
"addsource",
"=",
"False",
",",
"*",
"*",
"attrs",
")",
":",
"src",
"=",
"src_templ",
"%",
"vars",
"(",
"self",
")",
"# expand name and signature",
"evaldict",
"=",
"evaldic... | Make a new function from a given template and update the signature | [
"Make",
"a",
"new",
"function",
"from",
"a",
"given",
"template",
"and",
"update",
"the",
"signature"
] | 54a4351d98c1f90dfb1a557d1b447c1f57470eea | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/ext/_bundled/decorator.py#L140-L167 | train |
glue-viz/glue-vispy-viewers | glue_vispy_viewers/extern/vispy/ext/_bundled/decorator.py | FunctionMaker.create | def create(cls, obj, body, evaldict, defaults=None,
doc=None, module=None, addsource=True, **attrs):
"""
Create a function from the strings name, signature and body.
evaldict is the evaluation dictionary. If addsource is true an attribute
__source__ is added to the result.... | python | def create(cls, obj, body, evaldict, defaults=None,
doc=None, module=None, addsource=True, **attrs):
"""
Create a function from the strings name, signature and body.
evaldict is the evaluation dictionary. If addsource is true an attribute
__source__ is added to the result.... | [
"def",
"create",
"(",
"cls",
",",
"obj",
",",
"body",
",",
"evaldict",
",",
"defaults",
"=",
"None",
",",
"doc",
"=",
"None",
",",
"module",
"=",
"None",
",",
"addsource",
"=",
"True",
",",
"*",
"*",
"attrs",
")",
":",
"if",
"isinstance",
"(",
"o... | Create a function from the strings name, signature and body.
evaldict is the evaluation dictionary. If addsource is true an attribute
__source__ is added to the result. The attributes attrs are added,
if any. | [
"Create",
"a",
"function",
"from",
"the",
"strings",
"name",
"signature",
"and",
"body",
".",
"evaldict",
"is",
"the",
"evaluation",
"dictionary",
".",
"If",
"addsource",
"is",
"true",
"an",
"attribute",
"__source__",
"is",
"added",
"to",
"the",
"result",
".... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/ext/_bundled/decorator.py#L170-L189 | train |
glue-viz/glue-vispy-viewers | glue_vispy_viewers/extern/vispy/visuals/isosurface.py | IsosurfaceVisual.set_data | def set_data(self, data=None, vertex_colors=None, face_colors=None,
color=None):
""" Set the scalar array data
Parameters
----------
data : ndarray
A 3D array of scalar values. The isosurface is constructed to show
all locations in the scalar fie... | python | def set_data(self, data=None, vertex_colors=None, face_colors=None,
color=None):
""" Set the scalar array data
Parameters
----------
data : ndarray
A 3D array of scalar values. The isosurface is constructed to show
all locations in the scalar fie... | [
"def",
"set_data",
"(",
"self",
",",
"data",
"=",
"None",
",",
"vertex_colors",
"=",
"None",
",",
"face_colors",
"=",
"None",
",",
"color",
"=",
"None",
")",
":",
"# We only change the internal variables if they are provided",
"if",
"data",
"is",
"not",
"None",
... | Set the scalar array data
Parameters
----------
data : ndarray
A 3D array of scalar values. The isosurface is constructed to show
all locations in the scalar field equal to ``self.level``.
vertex_colors : array-like | None
Colors to use for each verte... | [
"Set",
"the",
"scalar",
"array",
"data"
] | 54a4351d98c1f90dfb1a557d1b447c1f57470eea | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/isosurface.py#L63-L92 | train |
glue-viz/glue-vispy-viewers | glue_vispy_viewers/extern/vispy/scene/widgets/viewbox.py | ViewBox.get_scene_bounds | def get_scene_bounds(self, dim=None):
"""Get the total bounds based on the visuals present in the scene
Parameters
----------
dim : int | None
Dimension to return.
Returns
-------
bounds : list | tuple
If ``dim is None``, Returns a list o... | python | def get_scene_bounds(self, dim=None):
"""Get the total bounds based on the visuals present in the scene
Parameters
----------
dim : int | None
Dimension to return.
Returns
-------
bounds : list | tuple
If ``dim is None``, Returns a list o... | [
"def",
"get_scene_bounds",
"(",
"self",
",",
"dim",
"=",
"None",
")",
":",
"# todo: handle sub-children",
"# todo: handle transformations",
"# Init",
"bounds",
"=",
"[",
"(",
"np",
".",
"inf",
",",
"-",
"np",
".",
"inf",
")",
",",
"(",
"np",
".",
"inf",
... | Get the total bounds based on the visuals present in the scene
Parameters
----------
dim : int | None
Dimension to return.
Returns
-------
bounds : list | tuple
If ``dim is None``, Returns a list of 3 tuples, otherwise
the bounds for ... | [
"Get",
"the",
"total",
"bounds",
"based",
"on",
"the",
"visuals",
"present",
"in",
"the",
"scene"
] | 54a4351d98c1f90dfb1a557d1b447c1f57470eea | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/scene/widgets/viewbox.py#L126-L163 | train |
glue-viz/glue-vispy-viewers | glue_vispy_viewers/extern/vispy/color/color_array.py | _string_to_rgb | def _string_to_rgb(color):
"""Convert user string or hex color to color array (length 3 or 4)"""
if not color.startswith('#'):
if color.lower() not in _color_dict:
raise ValueError('Color "%s" unknown' % color)
color = _color_dict[color]
assert color[0] == '#'
# hex color... | python | def _string_to_rgb(color):
"""Convert user string or hex color to color array (length 3 or 4)"""
if not color.startswith('#'):
if color.lower() not in _color_dict:
raise ValueError('Color "%s" unknown' % color)
color = _color_dict[color]
assert color[0] == '#'
# hex color... | [
"def",
"_string_to_rgb",
"(",
"color",
")",
":",
"if",
"not",
"color",
".",
"startswith",
"(",
"'#'",
")",
":",
"if",
"color",
".",
"lower",
"(",
")",
"not",
"in",
"_color_dict",
":",
"raise",
"ValueError",
"(",
"'Color \"%s\" unknown'",
"%",
"color",
")... | Convert user string or hex color to color array (length 3 or 4) | [
"Convert",
"user",
"string",
"or",
"hex",
"color",
"to",
"color",
"array",
"(",
"length",
"3",
"or",
"4",
")"
] | 54a4351d98c1f90dfb1a557d1b447c1f57470eea | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/color/color_array.py#L20-L37 | train |
glue-viz/glue-vispy-viewers | glue_vispy_viewers/extern/vispy/color/color_array.py | _user_to_rgba | def _user_to_rgba(color, expand=True, clip=False):
"""Convert color(s) from any set of fmts (str/hex/arr) to RGB(A) array"""
if color is None:
color = np.zeros(4, np.float32)
if isinstance(color, string_types):
color = _string_to_rgb(color)
elif isinstance(color, ColorArray):
col... | python | def _user_to_rgba(color, expand=True, clip=False):
"""Convert color(s) from any set of fmts (str/hex/arr) to RGB(A) array"""
if color is None:
color = np.zeros(4, np.float32)
if isinstance(color, string_types):
color = _string_to_rgb(color)
elif isinstance(color, ColorArray):
col... | [
"def",
"_user_to_rgba",
"(",
"color",
",",
"expand",
"=",
"True",
",",
"clip",
"=",
"False",
")",
":",
"if",
"color",
"is",
"None",
":",
"color",
"=",
"np",
".",
"zeros",
"(",
"4",
",",
"np",
".",
"float32",
")",
"if",
"isinstance",
"(",
"color",
... | Convert color(s) from any set of fmts (str/hex/arr) to RGB(A) array | [
"Convert",
"color",
"(",
"s",
")",
"from",
"any",
"set",
"of",
"fmts",
"(",
"str",
"/",
"hex",
"/",
"arr",
")",
"to",
"RGB",
"(",
"A",
")",
"array"
] | 54a4351d98c1f90dfb1a557d1b447c1f57470eea | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/color/color_array.py#L40-L67 | train |
glue-viz/glue-vispy-viewers | glue_vispy_viewers/extern/vispy/color/color_array.py | _array_clip_val | def _array_clip_val(val):
"""Helper to turn val into array and clip between 0 and 1"""
val = np.array(val)
if val.max() > 1 or val.min() < 0:
logger.warning('value will be clipped between 0 and 1')
val[...] = np.clip(val, 0, 1)
return val | python | def _array_clip_val(val):
"""Helper to turn val into array and clip between 0 and 1"""
val = np.array(val)
if val.max() > 1 or val.min() < 0:
logger.warning('value will be clipped between 0 and 1')
val[...] = np.clip(val, 0, 1)
return val | [
"def",
"_array_clip_val",
"(",
"val",
")",
":",
"val",
"=",
"np",
".",
"array",
"(",
"val",
")",
"if",
"val",
".",
"max",
"(",
")",
">",
"1",
"or",
"val",
".",
"min",
"(",
")",
"<",
"0",
":",
"logger",
".",
"warning",
"(",
"'value will be clipped... | Helper to turn val into array and clip between 0 and 1 | [
"Helper",
"to",
"turn",
"val",
"into",
"array",
"and",
"clip",
"between",
"0",
"and",
"1"
] | 54a4351d98c1f90dfb1a557d1b447c1f57470eea | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/color/color_array.py#L70-L76 | train |
glue-viz/glue-vispy-viewers | glue_vispy_viewers/extern/vispy/color/color_array.py | ColorArray.extend | def extend(self, colors):
"""Extend a ColorArray with new colors
Parameters
----------
colors : instance of ColorArray
The new colors.
"""
colors = ColorArray(colors)
self._rgba = np.vstack((self._rgba, colors._rgba))
return self | python | def extend(self, colors):
"""Extend a ColorArray with new colors
Parameters
----------
colors : instance of ColorArray
The new colors.
"""
colors = ColorArray(colors)
self._rgba = np.vstack((self._rgba, colors._rgba))
return self | [
"def",
"extend",
"(",
"self",
",",
"colors",
")",
":",
"colors",
"=",
"ColorArray",
"(",
"colors",
")",
"self",
".",
"_rgba",
"=",
"np",
".",
"vstack",
"(",
"(",
"self",
".",
"_rgba",
",",
"colors",
".",
"_rgba",
")",
")",
"return",
"self"
] | Extend a ColorArray with new colors
Parameters
----------
colors : instance of ColorArray
The new colors. | [
"Extend",
"a",
"ColorArray",
"with",
"new",
"colors"
] | 54a4351d98c1f90dfb1a557d1b447c1f57470eea | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/color/color_array.py#L204-L214 | train |
glue-viz/glue-vispy-viewers | glue_vispy_viewers/extern/vispy/color/color_array.py | ColorArray.rgba | def rgba(self, val):
"""Set the color using an Nx4 array of RGBA floats"""
# Note: all other attribute sets get routed here!
# This method is meant to do the heavy lifting of setting data
rgba = _user_to_rgba(val, expand=False)
if self._rgba is None:
self._rgba = rgba... | python | def rgba(self, val):
"""Set the color using an Nx4 array of RGBA floats"""
# Note: all other attribute sets get routed here!
# This method is meant to do the heavy lifting of setting data
rgba = _user_to_rgba(val, expand=False)
if self._rgba is None:
self._rgba = rgba... | [
"def",
"rgba",
"(",
"self",
",",
"val",
")",
":",
"# Note: all other attribute sets get routed here!",
"# This method is meant to do the heavy lifting of setting data",
"rgba",
"=",
"_user_to_rgba",
"(",
"val",
",",
"expand",
"=",
"False",
")",
"if",
"self",
".",
"_rgba... | Set the color using an Nx4 array of RGBA floats | [
"Set",
"the",
"color",
"using",
"an",
"Nx4",
"array",
"of",
"RGBA",
"floats"
] | 54a4351d98c1f90dfb1a557d1b447c1f57470eea | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/color/color_array.py#L223-L231 | train |
glue-viz/glue-vispy-viewers | glue_vispy_viewers/extern/vispy/color/color_array.py | ColorArray.RGBA | def RGBA(self, val):
"""Set the color using an Nx4 array of RGBA uint8 values"""
# need to convert to normalized float
val = np.atleast_1d(val).astype(np.float32) / 255
self.rgba = val | python | def RGBA(self, val):
"""Set the color using an Nx4 array of RGBA uint8 values"""
# need to convert to normalized float
val = np.atleast_1d(val).astype(np.float32) / 255
self.rgba = val | [
"def",
"RGBA",
"(",
"self",
",",
"val",
")",
":",
"# need to convert to normalized float",
"val",
"=",
"np",
".",
"atleast_1d",
"(",
"val",
")",
".",
"astype",
"(",
"np",
".",
"float32",
")",
"/",
"255",
"self",
".",
"rgba",
"=",
"val"
] | Set the color using an Nx4 array of RGBA uint8 values | [
"Set",
"the",
"color",
"using",
"an",
"Nx4",
"array",
"of",
"RGBA",
"uint8",
"values"
] | 54a4351d98c1f90dfb1a557d1b447c1f57470eea | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/color/color_array.py#L249-L253 | train |
glue-viz/glue-vispy-viewers | glue_vispy_viewers/extern/vispy/color/color_array.py | ColorArray.RGB | def RGB(self, val):
"""Set the color using an Nx3 array of RGB uint8 values"""
# need to convert to normalized float
val = np.atleast_1d(val).astype(np.float32) / 255.
self.rgba = val | python | def RGB(self, val):
"""Set the color using an Nx3 array of RGB uint8 values"""
# need to convert to normalized float
val = np.atleast_1d(val).astype(np.float32) / 255.
self.rgba = val | [
"def",
"RGB",
"(",
"self",
",",
"val",
")",
":",
"# need to convert to normalized float",
"val",
"=",
"np",
".",
"atleast_1d",
"(",
"val",
")",
".",
"astype",
"(",
"np",
".",
"float32",
")",
"/",
"255.",
"self",
".",
"rgba",
"=",
"val"
] | Set the color using an Nx3 array of RGB uint8 values | [
"Set",
"the",
"color",
"using",
"an",
"Nx3",
"array",
"of",
"RGB",
"uint8",
"values"
] | 54a4351d98c1f90dfb1a557d1b447c1f57470eea | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/color/color_array.py#L261-L265 | train |
glue-viz/glue-vispy-viewers | glue_vispy_viewers/extern/vispy/color/color_array.py | ColorArray.value | def value(self, val):
"""Set the color using length-N array of (from HSV)"""
hsv = self._hsv
hsv[:, 2] = _array_clip_val(val)
self.rgba = _hsv_to_rgb(hsv) | python | def value(self, val):
"""Set the color using length-N array of (from HSV)"""
hsv = self._hsv
hsv[:, 2] = _array_clip_val(val)
self.rgba = _hsv_to_rgb(hsv) | [
"def",
"value",
"(",
"self",
",",
"val",
")",
":",
"hsv",
"=",
"self",
".",
"_hsv",
"hsv",
"[",
":",
",",
"2",
"]",
"=",
"_array_clip_val",
"(",
"val",
")",
"self",
".",
"rgba",
"=",
"_hsv_to_rgb",
"(",
"hsv",
")"
] | Set the color using length-N array of (from HSV) | [
"Set",
"the",
"color",
"using",
"length",
"-",
"N",
"array",
"of",
"(",
"from",
"HSV",
")"
] | 54a4351d98c1f90dfb1a557d1b447c1f57470eea | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/color/color_array.py#L313-L317 | train |
glue-viz/glue-vispy-viewers | glue_vispy_viewers/extern/vispy/color/color_array.py | ColorArray.lighter | def lighter(self, dv=0.1, copy=True):
"""Produce a lighter color (if possible)
Parameters
----------
dv : float
Amount to increase the color value by.
copy : bool
If False, operation will be carried out in-place.
Returns
-------
c... | python | def lighter(self, dv=0.1, copy=True):
"""Produce a lighter color (if possible)
Parameters
----------
dv : float
Amount to increase the color value by.
copy : bool
If False, operation will be carried out in-place.
Returns
-------
c... | [
"def",
"lighter",
"(",
"self",
",",
"dv",
"=",
"0.1",
",",
"copy",
"=",
"True",
")",
":",
"color",
"=",
"self",
".",
"copy",
"(",
")",
"if",
"copy",
"else",
"self",
"color",
".",
"value",
"+=",
"dv",
"return",
"color"
] | Produce a lighter color (if possible)
Parameters
----------
dv : float
Amount to increase the color value by.
copy : bool
If False, operation will be carried out in-place.
Returns
-------
color : instance of ColorArray
The lig... | [
"Produce",
"a",
"lighter",
"color",
"(",
"if",
"possible",
")"
] | 54a4351d98c1f90dfb1a557d1b447c1f57470eea | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/color/color_array.py#L319-L336 | train |
glue-viz/glue-vispy-viewers | glue_vispy_viewers/extern/vispy/color/color_array.py | ColorArray.darker | def darker(self, dv=0.1, copy=True):
"""Produce a darker color (if possible)
Parameters
----------
dv : float
Amount to decrease the color value by.
copy : bool
If False, operation will be carried out in-place.
Returns
-------
col... | python | def darker(self, dv=0.1, copy=True):
"""Produce a darker color (if possible)
Parameters
----------
dv : float
Amount to decrease the color value by.
copy : bool
If False, operation will be carried out in-place.
Returns
-------
col... | [
"def",
"darker",
"(",
"self",
",",
"dv",
"=",
"0.1",
",",
"copy",
"=",
"True",
")",
":",
"color",
"=",
"self",
".",
"copy",
"(",
")",
"if",
"copy",
"else",
"self",
"color",
".",
"value",
"-=",
"dv",
"return",
"color"
] | Produce a darker color (if possible)
Parameters
----------
dv : float
Amount to decrease the color value by.
copy : bool
If False, operation will be carried out in-place.
Returns
-------
color : instance of ColorArray
The dark... | [
"Produce",
"a",
"darker",
"color",
"(",
"if",
"possible",
")"
] | 54a4351d98c1f90dfb1a557d1b447c1f57470eea | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/color/color_array.py#L338-L355 | train |
glue-viz/glue-vispy-viewers | glue_vispy_viewers/extern/vispy/scene/cameras/perspective.py | PerspectiveCamera.viewbox_mouse_event | def viewbox_mouse_event(self, event):
""" The ViewBox received a mouse event; update transform
accordingly.
Default implementation adjusts scale factor when scolling.
Parameters
----------
event : instance of Event
The event.
"""
BaseCamera.vi... | python | def viewbox_mouse_event(self, event):
""" The ViewBox received a mouse event; update transform
accordingly.
Default implementation adjusts scale factor when scolling.
Parameters
----------
event : instance of Event
The event.
"""
BaseCamera.vi... | [
"def",
"viewbox_mouse_event",
"(",
"self",
",",
"event",
")",
":",
"BaseCamera",
".",
"viewbox_mouse_event",
"(",
"self",
",",
"event",
")",
"if",
"event",
".",
"type",
"==",
"'mouse_wheel'",
":",
"s",
"=",
"1.1",
"**",
"-",
"event",
".",
"delta",
"[",
... | The ViewBox received a mouse event; update transform
accordingly.
Default implementation adjusts scale factor when scolling.
Parameters
----------
event : instance of Event
The event. | [
"The",
"ViewBox",
"received",
"a",
"mouse",
"event",
";",
"update",
"transform",
"accordingly",
".",
"Default",
"implementation",
"adjusts",
"scale",
"factor",
"when",
"scolling",
"."
] | 54a4351d98c1f90dfb1a557d1b447c1f57470eea | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/scene/cameras/perspective.py#L48-L64 | train |
glue-viz/glue-vispy-viewers | glue_vispy_viewers/extern/vispy/scene/cameras/perspective.py | PerspectiveCamera._set_range | def _set_range(self, init):
""" Reset the camera view using the known limits.
"""
if init and (self._scale_factor is not None):
return # We don't have to set our scale factor
# Get window size (and store factor now to sync with resizing)
w, h = self._viewbox.size
... | python | def _set_range(self, init):
""" Reset the camera view using the known limits.
"""
if init and (self._scale_factor is not None):
return # We don't have to set our scale factor
# Get window size (and store factor now to sync with resizing)
w, h = self._viewbox.size
... | [
"def",
"_set_range",
"(",
"self",
",",
"init",
")",
":",
"if",
"init",
"and",
"(",
"self",
".",
"_scale_factor",
"is",
"not",
"None",
")",
":",
"return",
"# We don't have to set our scale factor",
"# Get window size (and store factor now to sync with resizing)",
"w",
... | Reset the camera view using the known limits. | [
"Reset",
"the",
"camera",
"view",
"using",
"the",
"known",
"limits",
"."
] | 54a4351d98c1f90dfb1a557d1b447c1f57470eea | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/scene/cameras/perspective.py#L86-L118 | train |
glue-viz/glue-vispy-viewers | glue_vispy_viewers/extern/vispy/scene/cameras/perspective.py | Base3DRotationCamera.viewbox_mouse_event | def viewbox_mouse_event(self, event):
"""
The viewbox received a mouse event; update transform
accordingly.
Parameters
----------
event : instance of Event
The event.
"""
if event.handled or not self.interactive:
return
Pe... | python | def viewbox_mouse_event(self, event):
"""
The viewbox received a mouse event; update transform
accordingly.
Parameters
----------
event : instance of Event
The event.
"""
if event.handled or not self.interactive:
return
Pe... | [
"def",
"viewbox_mouse_event",
"(",
"self",
",",
"event",
")",
":",
"if",
"event",
".",
"handled",
"or",
"not",
"self",
".",
"interactive",
":",
"return",
"PerspectiveCamera",
".",
"viewbox_mouse_event",
"(",
"self",
",",
"event",
")",
"if",
"event",
".",
"... | The viewbox received a mouse event; update transform
accordingly.
Parameters
----------
event : instance of Event
The event. | [
"The",
"viewbox",
"received",
"a",
"mouse",
"event",
";",
"update",
"transform",
"accordingly",
"."
] | 54a4351d98c1f90dfb1a557d1b447c1f57470eea | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/scene/cameras/perspective.py#L194-L260 | train |
glue-viz/glue-vispy-viewers | glue_vispy_viewers/extern/vispy/scene/cameras/perspective.py | Base3DRotationCamera._update_camera_pos | def _update_camera_pos(self):
""" Set the camera position and orientation"""
# transform will be updated several times; do not update camera
# transform until we are done.
ch_em = self.events.transform_change
with ch_em.blocker(self._update_transform):
tr = self.tran... | python | def _update_camera_pos(self):
""" Set the camera position and orientation"""
# transform will be updated several times; do not update camera
# transform until we are done.
ch_em = self.events.transform_change
with ch_em.blocker(self._update_transform):
tr = self.tran... | [
"def",
"_update_camera_pos",
"(",
"self",
")",
":",
"# transform will be updated several times; do not update camera",
"# transform until we are done.",
"ch_em",
"=",
"self",
".",
"events",
".",
"transform_change",
"with",
"ch_em",
".",
"blocker",
"(",
"self",
".",
"_upda... | Set the camera position and orientation | [
"Set",
"the",
"camera",
"position",
"and",
"orientation"
] | 54a4351d98c1f90dfb1a557d1b447c1f57470eea | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/scene/cameras/perspective.py#L262-L282 | train |
glue-viz/glue-vispy-viewers | glue_vispy_viewers/extern/vispy/app/application.py | Application.is_interactive | def is_interactive(self):
""" Determine if the user requested interactive mode.
"""
# The Python interpreter sets sys.flags correctly, so use them!
if sys.flags.interactive:
return True
# IPython does not set sys.flags when -i is specified, so first
# check i... | python | def is_interactive(self):
""" Determine if the user requested interactive mode.
"""
# The Python interpreter sets sys.flags correctly, so use them!
if sys.flags.interactive:
return True
# IPython does not set sys.flags when -i is specified, so first
# check i... | [
"def",
"is_interactive",
"(",
"self",
")",
":",
"# The Python interpreter sets sys.flags correctly, so use them!",
"if",
"sys",
".",
"flags",
".",
"interactive",
":",
"return",
"True",
"# IPython does not set sys.flags when -i is specified, so first",
"# check it if it is already i... | Determine if the user requested interactive mode. | [
"Determine",
"if",
"the",
"user",
"requested",
"interactive",
"mode",
"."
] | 54a4351d98c1f90dfb1a557d1b447c1f57470eea | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/app/application.py#L100-L118 | train |
glue-viz/glue-vispy-viewers | glue_vispy_viewers/extern/vispy/app/application.py | Application.run | def run(self, allow_interactive=True):
""" Enter the native GUI event loop.
Parameters
----------
allow_interactive : bool
Is the application allowed to handle interactive mode for console
terminals? By default, typing ``python -i main.py`` results in
... | python | def run(self, allow_interactive=True):
""" Enter the native GUI event loop.
Parameters
----------
allow_interactive : bool
Is the application allowed to handle interactive mode for console
terminals? By default, typing ``python -i main.py`` results in
... | [
"def",
"run",
"(",
"self",
",",
"allow_interactive",
"=",
"True",
")",
":",
"if",
"allow_interactive",
"and",
"self",
".",
"is_interactive",
"(",
")",
":",
"inputhook",
".",
"set_interactive",
"(",
"enabled",
"=",
"True",
",",
"app",
"=",
"self",
")",
"e... | Enter the native GUI event loop.
Parameters
----------
allow_interactive : bool
Is the application allowed to handle interactive mode for console
terminals? By default, typing ``python -i main.py`` results in
an interactive shell that also regularly calls th... | [
"Enter",
"the",
"native",
"GUI",
"event",
"loop",
"."
] | 54a4351d98c1f90dfb1a557d1b447c1f57470eea | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/app/application.py#L120-L137 | train |
glue-viz/glue-vispy-viewers | glue_vispy_viewers/extern/vispy/app/application.py | Application._use | def _use(self, backend_name=None):
"""Select a backend by name. See class docstring for details.
"""
# See if we're in a specific testing mode, if so DONT check to see
# if it's a valid backend. If it isn't, it's a good thing we
# get an error later because we should have decorat... | python | def _use(self, backend_name=None):
"""Select a backend by name. See class docstring for details.
"""
# See if we're in a specific testing mode, if so DONT check to see
# if it's a valid backend. If it isn't, it's a good thing we
# get an error later because we should have decorat... | [
"def",
"_use",
"(",
"self",
",",
"backend_name",
"=",
"None",
")",
":",
"# See if we're in a specific testing mode, if so DONT check to see",
"# if it's a valid backend. If it isn't, it's a good thing we",
"# get an error later because we should have decorated our test",
"# with requires_a... | Select a backend by name. See class docstring for details. | [
"Select",
"a",
"backend",
"by",
"name",
".",
"See",
"class",
"docstring",
"for",
"details",
"."
] | 54a4351d98c1f90dfb1a557d1b447c1f57470eea | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/app/application.py#L158-L241 | train |
glue-viz/glue-vispy-viewers | glue_vispy_viewers/extern/vispy/app/backends/_wx.py | _set_config | def _set_config(c):
"""Set gl configuration"""
gl_attribs = [glcanvas.WX_GL_RGBA,
glcanvas.WX_GL_DEPTH_SIZE, c['depth_size'],
glcanvas.WX_GL_STENCIL_SIZE, c['stencil_size'],
glcanvas.WX_GL_MIN_RED, c['red_size'],
glcanvas.WX_GL_MIN_GREEN, c... | python | def _set_config(c):
"""Set gl configuration"""
gl_attribs = [glcanvas.WX_GL_RGBA,
glcanvas.WX_GL_DEPTH_SIZE, c['depth_size'],
glcanvas.WX_GL_STENCIL_SIZE, c['stencil_size'],
glcanvas.WX_GL_MIN_RED, c['red_size'],
glcanvas.WX_GL_MIN_GREEN, c... | [
"def",
"_set_config",
"(",
"c",
")",
":",
"gl_attribs",
"=",
"[",
"glcanvas",
".",
"WX_GL_RGBA",
",",
"glcanvas",
".",
"WX_GL_DEPTH_SIZE",
",",
"c",
"[",
"'depth_size'",
"]",
",",
"glcanvas",
".",
"WX_GL_STENCIL_SIZE",
",",
"c",
"[",
"'stencil_size'",
"]",
... | Set gl configuration | [
"Set",
"gl",
"configuration"
] | 54a4351d98c1f90dfb1a557d1b447c1f57470eea | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/app/backends/_wx.py#L107-L118 | train |
glue-viz/glue-vispy-viewers | glue_vispy_viewers/extern/vispy/app/backends/_wx.py | _get_mods | def _get_mods(evt):
"""Helper to extract list of mods from event"""
mods = []
mods += [keys.CONTROL] if evt.ControlDown() else []
mods += [keys.ALT] if evt.AltDown() else []
mods += [keys.SHIFT] if evt.ShiftDown() else []
mods += [keys.META] if evt.MetaDown() else []
return mods | python | def _get_mods(evt):
"""Helper to extract list of mods from event"""
mods = []
mods += [keys.CONTROL] if evt.ControlDown() else []
mods += [keys.ALT] if evt.AltDown() else []
mods += [keys.SHIFT] if evt.ShiftDown() else []
mods += [keys.META] if evt.MetaDown() else []
return mods | [
"def",
"_get_mods",
"(",
"evt",
")",
":",
"mods",
"=",
"[",
"]",
"mods",
"+=",
"[",
"keys",
".",
"CONTROL",
"]",
"if",
"evt",
".",
"ControlDown",
"(",
")",
"else",
"[",
"]",
"mods",
"+=",
"[",
"keys",
".",
"ALT",
"]",
"if",
"evt",
".",
"AltDown... | Helper to extract list of mods from event | [
"Helper",
"to",
"extract",
"list",
"of",
"mods",
"from",
"event"
] | 54a4351d98c1f90dfb1a557d1b447c1f57470eea | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/app/backends/_wx.py#L165-L172 | train |
glue-viz/glue-vispy-viewers | glue_vispy_viewers/extern/vispy/app/backends/_wx.py | _process_key | def _process_key(evt):
"""Helper to convert from wx keycode to vispy keycode"""
key = evt.GetKeyCode()
if key in KEYMAP:
return KEYMAP[key], ''
if 97 <= key <= 122:
key -= 32
if key >= 32 and key <= 127:
return keys.Key(chr(key)), chr(key)
else:
return None, None | python | def _process_key(evt):
"""Helper to convert from wx keycode to vispy keycode"""
key = evt.GetKeyCode()
if key in KEYMAP:
return KEYMAP[key], ''
if 97 <= key <= 122:
key -= 32
if key >= 32 and key <= 127:
return keys.Key(chr(key)), chr(key)
else:
return None, None | [
"def",
"_process_key",
"(",
"evt",
")",
":",
"key",
"=",
"evt",
".",
"GetKeyCode",
"(",
")",
"if",
"key",
"in",
"KEYMAP",
":",
"return",
"KEYMAP",
"[",
"key",
"]",
",",
"''",
"if",
"97",
"<=",
"key",
"<=",
"122",
":",
"key",
"-=",
"32",
"if",
"... | Helper to convert from wx keycode to vispy keycode | [
"Helper",
"to",
"convert",
"from",
"wx",
"keycode",
"to",
"vispy",
"keycode"
] | 54a4351d98c1f90dfb1a557d1b447c1f57470eea | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/app/backends/_wx.py#L175-L185 | train |
glue-viz/glue-vispy-viewers | glue_vispy_viewers/extern/vispy/scene/node.py | Node.is_child | def is_child(self, node):
"""Check if a node is a child of the current node
Parameters
----------
node : instance of Node
The potential child.
Returns
-------
child : bool
Whether or not the node is a child.
"""
if node in... | python | def is_child(self, node):
"""Check if a node is a child of the current node
Parameters
----------
node : instance of Node
The potential child.
Returns
-------
child : bool
Whether or not the node is a child.
"""
if node in... | [
"def",
"is_child",
"(",
"self",
",",
"node",
")",
":",
"if",
"node",
"in",
"self",
".",
"children",
":",
"return",
"True",
"for",
"c",
"in",
"self",
".",
"children",
":",
"if",
"c",
".",
"is_child",
"(",
"node",
")",
":",
"return",
"True",
"return"... | Check if a node is a child of the current node
Parameters
----------
node : instance of Node
The potential child.
Returns
-------
child : bool
Whether or not the node is a child. | [
"Check",
"if",
"a",
"node",
"is",
"a",
"child",
"of",
"the",
"current",
"node"
] | 54a4351d98c1f90dfb1a557d1b447c1f57470eea | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/scene/node.py#L234-L252 | train |
glue-viz/glue-vispy-viewers | glue_vispy_viewers/extern/vispy/scene/node.py | Node.scene_node | def scene_node(self):
"""The first ancestor of this node that is a SubScene instance, or self
if no such node exists.
"""
if self._scene_node is None:
from .subscene import SubScene
p = self.parent
while True:
if isinstance(p, SubScene)... | python | def scene_node(self):
"""The first ancestor of this node that is a SubScene instance, or self
if no such node exists.
"""
if self._scene_node is None:
from .subscene import SubScene
p = self.parent
while True:
if isinstance(p, SubScene)... | [
"def",
"scene_node",
"(",
"self",
")",
":",
"if",
"self",
".",
"_scene_node",
"is",
"None",
":",
"from",
".",
"subscene",
"import",
"SubScene",
"p",
"=",
"self",
".",
"parent",
"while",
"True",
":",
"if",
"isinstance",
"(",
"p",
",",
"SubScene",
")",
... | The first ancestor of this node that is a SubScene instance, or self
if no such node exists. | [
"The",
"first",
"ancestor",
"of",
"this",
"node",
"that",
"is",
"a",
"SubScene",
"instance",
"or",
"self",
"if",
"no",
"such",
"node",
"exists",
"."
] | 54a4351d98c1f90dfb1a557d1b447c1f57470eea | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/scene/node.py#L279-L293 | train |
glue-viz/glue-vispy-viewers | glue_vispy_viewers/extern/vispy/scene/node.py | Node.update | def update(self):
"""
Emit an event to inform listeners that properties of this Node have
changed. Also request a canvas update.
"""
self.events.update()
c = getattr(self, 'canvas', None)
if c is not None:
c.update(node=self) | python | def update(self):
"""
Emit an event to inform listeners that properties of this Node have
changed. Also request a canvas update.
"""
self.events.update()
c = getattr(self, 'canvas', None)
if c is not None:
c.update(node=self) | [
"def",
"update",
"(",
"self",
")",
":",
"self",
".",
"events",
".",
"update",
"(",
")",
"c",
"=",
"getattr",
"(",
"self",
",",
"'canvas'",
",",
"None",
")",
"if",
"c",
"is",
"not",
"None",
":",
"c",
".",
"update",
"(",
"node",
"=",
"self",
")"
... | Emit an event to inform listeners that properties of this Node have
changed. Also request a canvas update. | [
"Emit",
"an",
"event",
"to",
"inform",
"listeners",
"that",
"properties",
"of",
"this",
"Node",
"have",
"changed",
".",
"Also",
"request",
"a",
"canvas",
"update",
"."
] | 54a4351d98c1f90dfb1a557d1b447c1f57470eea | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/scene/node.py#L325-L333 | train |
glue-viz/glue-vispy-viewers | glue_vispy_viewers/extern/vispy/scene/node.py | Node.set_transform | def set_transform(self, type_, *args, **kwargs):
""" Create a new transform of *type* and assign it to this node.
All extra arguments are used in the construction of the transform.
Parameters
----------
type_ : str
The transform type.
*args : tuple
... | python | def set_transform(self, type_, *args, **kwargs):
""" Create a new transform of *type* and assign it to this node.
All extra arguments are used in the construction of the transform.
Parameters
----------
type_ : str
The transform type.
*args : tuple
... | [
"def",
"set_transform",
"(",
"self",
",",
"type_",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"transform",
"=",
"create_transform",
"(",
"type_",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | Create a new transform of *type* and assign it to this node.
All extra arguments are used in the construction of the transform.
Parameters
----------
type_ : str
The transform type.
*args : tuple
Arguments.
**kwargs : dict
Keywoard ar... | [
"Create",
"a",
"new",
"transform",
"of",
"*",
"type",
"*",
"and",
"assign",
"it",
"to",
"this",
"node",
"."
] | 54a4351d98c1f90dfb1a557d1b447c1f57470eea | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/scene/node.py#L371-L385 | train |
glue-viz/glue-vispy-viewers | glue_vispy_viewers/extern/vispy/scene/node.py | Node._update_trsys | def _update_trsys(self, event):
"""Called when has changed.
This allows the node and its children to react (notably, VisualNode
uses this to update its TransformSystem).
Note that this method is only called when one transform is replaced by
another; it is not c... | python | def _update_trsys(self, event):
"""Called when has changed.
This allows the node and its children to react (notably, VisualNode
uses this to update its TransformSystem).
Note that this method is only called when one transform is replaced by
another; it is not c... | [
"def",
"_update_trsys",
"(",
"self",
",",
"event",
")",
":",
"for",
"ch",
"in",
"self",
".",
"children",
":",
"ch",
".",
"_update_trsys",
"(",
"event",
")",
"self",
".",
"events",
".",
"transform_change",
"(",
")",
"self",
".",
"update",
"(",
")"
] | Called when has changed.
This allows the node and its children to react (notably, VisualNode
uses this to update its TransformSystem).
Note that this method is only called when one transform is replaced by
another; it is not called if an existing transform internally c... | [
"Called",
"when",
"has",
"changed",
".",
"This",
"allows",
"the",
"node",
"and",
"its",
"children",
"to",
"react",
"(",
"notably",
"VisualNode",
"uses",
"this",
"to",
"update",
"its",
"TransformSystem",
")",
".",
"Note",
"that",
"this",
"method",
"is",
"on... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/scene/node.py#L387-L400 | train |
glue-viz/glue-vispy-viewers | glue_vispy_viewers/extern/vispy/scene/node.py | Node.parent_chain | def parent_chain(self):
"""
Return the list of parents starting from this node. The chain ends
at the first node with no parents.
"""
chain = [self]
while True:
try:
parent = chain[-1].parent
except Exception:
break
... | python | def parent_chain(self):
"""
Return the list of parents starting from this node. The chain ends
at the first node with no parents.
"""
chain = [self]
while True:
try:
parent = chain[-1].parent
except Exception:
break
... | [
"def",
"parent_chain",
"(",
"self",
")",
":",
"chain",
"=",
"[",
"self",
"]",
"while",
"True",
":",
"try",
":",
"parent",
"=",
"chain",
"[",
"-",
"1",
"]",
".",
"parent",
"except",
"Exception",
":",
"break",
"if",
"parent",
"is",
"None",
":",
"brea... | Return the list of parents starting from this node. The chain ends
at the first node with no parents. | [
"Return",
"the",
"list",
"of",
"parents",
"starting",
"from",
"this",
"node",
".",
"The",
"chain",
"ends",
"at",
"the",
"first",
"node",
"with",
"no",
"parents",
"."
] | 54a4351d98c1f90dfb1a557d1b447c1f57470eea | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/scene/node.py#L402-L416 | train |
glue-viz/glue-vispy-viewers | glue_vispy_viewers/extern/vispy/scene/node.py | Node._describe_tree | def _describe_tree(self, prefix, with_transform):
"""Helper function to actuall construct the tree"""
extra = ': "%s"' % self.name if self.name is not None else ''
if with_transform:
extra += (' [%s]' % self.transform.__class__.__name__)
output = ''
if len(prefix) > 0... | python | def _describe_tree(self, prefix, with_transform):
"""Helper function to actuall construct the tree"""
extra = ': "%s"' % self.name if self.name is not None else ''
if with_transform:
extra += (' [%s]' % self.transform.__class__.__name__)
output = ''
if len(prefix) > 0... | [
"def",
"_describe_tree",
"(",
"self",
",",
"prefix",
",",
"with_transform",
")",
":",
"extra",
"=",
"': \"%s\"'",
"%",
"self",
".",
"name",
"if",
"self",
".",
"name",
"is",
"not",
"None",
"else",
"''",
"if",
"with_transform",
":",
"extra",
"+=",
"(",
"... | Helper function to actuall construct the tree | [
"Helper",
"function",
"to",
"actuall",
"construct",
"the",
"tree"
] | 54a4351d98c1f90dfb1a557d1b447c1f57470eea | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/scene/node.py#L434-L449 | train |
glue-viz/glue-vispy-viewers | glue_vispy_viewers/extern/vispy/scene/node.py | Node.common_parent | def common_parent(self, node):
"""
Return the common parent of two entities
If the entities have no common parent, return None.
Parameters
----------
node : instance of Node
The other node.
Returns
-------
parent : instance of Node |... | python | def common_parent(self, node):
"""
Return the common parent of two entities
If the entities have no common parent, return None.
Parameters
----------
node : instance of Node
The other node.
Returns
-------
parent : instance of Node |... | [
"def",
"common_parent",
"(",
"self",
",",
"node",
")",
":",
"p1",
"=",
"self",
".",
"parent_chain",
"(",
")",
"p2",
"=",
"node",
".",
"parent_chain",
"(",
")",
"for",
"p",
"in",
"p1",
":",
"if",
"p",
"in",
"p2",
":",
"return",
"p",
"return",
"Non... | Return the common parent of two entities
If the entities have no common parent, return None.
Parameters
----------
node : instance of Node
The other node.
Returns
-------
parent : instance of Node | None
The parent. | [
"Return",
"the",
"common",
"parent",
"of",
"two",
"entities"
] | 54a4351d98c1f90dfb1a557d1b447c1f57470eea | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/scene/node.py#L451-L472 | train |
glue-viz/glue-vispy-viewers | glue_vispy_viewers/extern/vispy/scene/node.py | Node.node_path_to_child | def node_path_to_child(self, node):
"""Return a list describing the path from this node to a child node
If *node* is not a (grand)child of this node, then raise RuntimeError.
Parameters
----------
node : instance of Node
The child node.
Returns
----... | python | def node_path_to_child(self, node):
"""Return a list describing the path from this node to a child node
If *node* is not a (grand)child of this node, then raise RuntimeError.
Parameters
----------
node : instance of Node
The child node.
Returns
----... | [
"def",
"node_path_to_child",
"(",
"self",
",",
"node",
")",
":",
"if",
"node",
"is",
"self",
":",
"return",
"[",
"]",
"# Go up from the child node as far as we can",
"path1",
"=",
"[",
"node",
"]",
"child",
"=",
"node",
"while",
"child",
".",
"parent",
"is",... | Return a list describing the path from this node to a child node
If *node* is not a (grand)child of this node, then raise RuntimeError.
Parameters
----------
node : instance of Node
The child node.
Returns
-------
path : list | None
The ... | [
"Return",
"a",
"list",
"describing",
"the",
"path",
"from",
"this",
"node",
"to",
"a",
"child",
"node"
] | 54a4351d98c1f90dfb1a557d1b447c1f57470eea | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/scene/node.py#L474-L523 | train |
glue-viz/glue-vispy-viewers | glue_vispy_viewers/extern/vispy/scene/node.py | Node.node_path | def node_path(self, node):
"""Return two lists describing the path from this node to another
Parameters
----------
node : instance of Node
The other node.
Returns
-------
p1 : list
First path (see below).
p2 : list
Sec... | python | def node_path(self, node):
"""Return two lists describing the path from this node to another
Parameters
----------
node : instance of Node
The other node.
Returns
-------
p1 : list
First path (see below).
p2 : list
Sec... | [
"def",
"node_path",
"(",
"self",
",",
"node",
")",
":",
"p1",
"=",
"self",
".",
"parent_chain",
"(",
")",
"p2",
"=",
"node",
".",
"parent_chain",
"(",
")",
"cp",
"=",
"None",
"for",
"p",
"in",
"p1",
":",
"if",
"p",
"in",
"p2",
":",
"cp",
"=",
... | Return two lists describing the path from this node to another
Parameters
----------
node : instance of Node
The other node.
Returns
-------
p1 : list
First path (see below).
p2 : list
Second path (see below).
Notes
... | [
"Return",
"two",
"lists",
"describing",
"the",
"path",
"from",
"this",
"node",
"to",
"another"
] | 54a4351d98c1f90dfb1a557d1b447c1f57470eea | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/scene/node.py#L525-L570 | train |
glue-viz/glue-vispy-viewers | glue_vispy_viewers/extern/vispy/scene/node.py | Node.node_path_transforms | def node_path_transforms(self, node):
"""Return the list of transforms along the path to another node.
The transforms are listed in reverse order, such that the last
transform should be applied first when mapping from this node to
the other.
Parameters
-------... | python | def node_path_transforms(self, node):
"""Return the list of transforms along the path to another node.
The transforms are listed in reverse order, such that the last
transform should be applied first when mapping from this node to
the other.
Parameters
-------... | [
"def",
"node_path_transforms",
"(",
"self",
",",
"node",
")",
":",
"a",
",",
"b",
"=",
"self",
".",
"node_path",
"(",
"node",
")",
"return",
"(",
"[",
"n",
".",
"transform",
"for",
"n",
"in",
"a",
"[",
":",
"-",
"1",
"]",
"]",
"+",
"[",
"n",
... | Return the list of transforms along the path to another node.
The transforms are listed in reverse order, such that the last
transform should be applied first when mapping from this node to
the other.
Parameters
----------
node : instance of Node
T... | [
"Return",
"the",
"list",
"of",
"transforms",
"along",
"the",
"path",
"to",
"another",
"node",
".",
"The",
"transforms",
"are",
"listed",
"in",
"reverse",
"order",
"such",
"that",
"the",
"last",
"transform",
"should",
"be",
"applied",
"first",
"when",
"mappin... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/scene/node.py#L572-L591 | train |
glue-viz/glue-vispy-viewers | glue_vispy_viewers/extern/vispy/io/wavefront.py | WavefrontReader.read | def read(cls, fname):
""" read(fname, fmt)
This classmethod is the entry point for reading OBJ files.
Parameters
----------
fname : str
The name of the file to read.
fmt : str
Can be "obj" or "gz" to specify the file format.
"""
#... | python | def read(cls, fname):
""" read(fname, fmt)
This classmethod is the entry point for reading OBJ files.
Parameters
----------
fname : str
The name of the file to read.
fmt : str
Can be "obj" or "gz" to specify the file format.
"""
#... | [
"def",
"read",
"(",
"cls",
",",
"fname",
")",
":",
"# Open file",
"fmt",
"=",
"op",
".",
"splitext",
"(",
"fname",
")",
"[",
"1",
"]",
".",
"lower",
"(",
")",
"assert",
"fmt",
"in",
"(",
"'.obj'",
",",
"'.gz'",
")",
"opener",
"=",
"open",
"if",
... | read(fname, fmt)
This classmethod is the entry point for reading OBJ files.
Parameters
----------
fname : str
The name of the file to read.
fmt : str
Can be "obj" or "gz" to specify the file format. | [
"read",
"(",
"fname",
"fmt",
")"
] | 54a4351d98c1f90dfb1a557d1b447c1f57470eea | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/io/wavefront.py#L55-L85 | train |
glue-viz/glue-vispy-viewers | glue_vispy_viewers/extern/vispy/io/wavefront.py | WavefrontReader.readLine | def readLine(self):
""" The method that reads a line and processes it.
"""
# Read line
line = self._f.readline().decode('ascii', 'ignore')
if not line:
raise EOFError()
line = line.strip()
if line.startswith('v '):
# self._vertices.append... | python | def readLine(self):
""" The method that reads a line and processes it.
"""
# Read line
line = self._f.readline().decode('ascii', 'ignore')
if not line:
raise EOFError()
line = line.strip()
if line.startswith('v '):
# self._vertices.append... | [
"def",
"readLine",
"(",
"self",
")",
":",
"# Read line",
"line",
"=",
"self",
".",
"_f",
".",
"readline",
"(",
")",
".",
"decode",
"(",
"'ascii'",
",",
"'ignore'",
")",
"if",
"not",
"line",
":",
"raise",
"EOFError",
"(",
")",
"line",
"=",
"line",
"... | The method that reads a line and processes it. | [
"The",
"method",
"that",
"reads",
"a",
"line",
"and",
"processes",
"it",
"."
] | 54a4351d98c1f90dfb1a557d1b447c1f57470eea | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/io/wavefront.py#L87-L117 | train |
glue-viz/glue-vispy-viewers | glue_vispy_viewers/extern/vispy/io/wavefront.py | WavefrontReader.readTuple | def readTuple(self, line, n=3):
""" Reads a tuple of numbers. e.g. vertices, normals or teture coords.
"""
numbers = [num for num in line.split(' ') if num]
return [float(num) for num in numbers[1:n + 1]] | python | def readTuple(self, line, n=3):
""" Reads a tuple of numbers. e.g. vertices, normals or teture coords.
"""
numbers = [num for num in line.split(' ') if num]
return [float(num) for num in numbers[1:n + 1]] | [
"def",
"readTuple",
"(",
"self",
",",
"line",
",",
"n",
"=",
"3",
")",
":",
"numbers",
"=",
"[",
"num",
"for",
"num",
"in",
"line",
".",
"split",
"(",
"' '",
")",
"if",
"num",
"]",
"return",
"[",
"float",
"(",
"num",
")",
"for",
"num",
"in",
... | Reads a tuple of numbers. e.g. vertices, normals or teture coords. | [
"Reads",
"a",
"tuple",
"of",
"numbers",
".",
"e",
".",
"g",
".",
"vertices",
"normals",
"or",
"teture",
"coords",
"."
] | 54a4351d98c1f90dfb1a557d1b447c1f57470eea | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/io/wavefront.py#L119-L123 | train |
glue-viz/glue-vispy-viewers | glue_vispy_viewers/extern/vispy/io/wavefront.py | WavefrontReader.readFace | def readFace(self, line):
""" Each face consists of three or more sets of indices. Each set
consists of 1, 2 or 3 indices to vertices/normals/texcords.
"""
# Get parts (skip first)
indexSets = [num for num in line.split(' ') if num][1:]
final_face = []
for index... | python | def readFace(self, line):
""" Each face consists of three or more sets of indices. Each set
consists of 1, 2 or 3 indices to vertices/normals/texcords.
"""
# Get parts (skip first)
indexSets = [num for num in line.split(' ') if num][1:]
final_face = []
for index... | [
"def",
"readFace",
"(",
"self",
",",
"line",
")",
":",
"# Get parts (skip first)",
"indexSets",
"=",
"[",
"num",
"for",
"num",
"in",
"line",
".",
"split",
"(",
"' '",
")",
"if",
"num",
"]",
"[",
"1",
":",
"]",
"final_face",
"=",
"[",
"]",
"for",
"i... | Each face consists of three or more sets of indices. Each set
consists of 1, 2 or 3 indices to vertices/normals/texcords. | [
"Each",
"face",
"consists",
"of",
"three",
"or",
"more",
"sets",
"of",
"indices",
".",
"Each",
"set",
"consists",
"of",
"1",
"2",
"or",
"3",
"indices",
"to",
"vertices",
"/",
"normals",
"/",
"texcords",
"."
] | 54a4351d98c1f90dfb1a557d1b447c1f57470eea | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/io/wavefront.py#L125-L183 | train |
glue-viz/glue-vispy-viewers | glue_vispy_viewers/extern/vispy/io/wavefront.py | WavefrontReader.finish | def finish(self):
""" Converts gathere lists to numpy arrays and creates
BaseMesh instance.
"""
self._vertices = np.array(self._vertices, 'float32')
if self._faces:
self._faces = np.array(self._faces, 'uint32')
else:
# Use vertices only
... | python | def finish(self):
""" Converts gathere lists to numpy arrays and creates
BaseMesh instance.
"""
self._vertices = np.array(self._vertices, 'float32')
if self._faces:
self._faces = np.array(self._faces, 'uint32')
else:
# Use vertices only
... | [
"def",
"finish",
"(",
"self",
")",
":",
"self",
".",
"_vertices",
"=",
"np",
".",
"array",
"(",
"self",
".",
"_vertices",
",",
"'float32'",
")",
"if",
"self",
".",
"_faces",
":",
"self",
".",
"_faces",
"=",
"np",
".",
"array",
"(",
"self",
".",
"... | Converts gathere lists to numpy arrays and creates
BaseMesh instance. | [
"Converts",
"gathere",
"lists",
"to",
"numpy",
"arrays",
"and",
"creates",
"BaseMesh",
"instance",
"."
] | 54a4351d98c1f90dfb1a557d1b447c1f57470eea | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/io/wavefront.py#L200-L220 | train |
glue-viz/glue-vispy-viewers | glue_vispy_viewers/extern/vispy/io/wavefront.py | WavefrontWriter.write | def write(cls, fname, vertices, faces, normals,
texcoords, name='', reshape_faces=True):
""" This classmethod is the entry point for writing mesh data to OBJ.
Parameters
----------
fname : string
The filename to write to. Must end with ".obj" or ".gz".
... | python | def write(cls, fname, vertices, faces, normals,
texcoords, name='', reshape_faces=True):
""" This classmethod is the entry point for writing mesh data to OBJ.
Parameters
----------
fname : string
The filename to write to. Must end with ".obj" or ".gz".
... | [
"def",
"write",
"(",
"cls",
",",
"fname",
",",
"vertices",
",",
"faces",
",",
"normals",
",",
"texcoords",
",",
"name",
"=",
"''",
",",
"reshape_faces",
"=",
"True",
")",
":",
"# Open file",
"fmt",
"=",
"op",
".",
"splitext",
"(",
"fname",
")",
"[",
... | This classmethod is the entry point for writing mesh data to OBJ.
Parameters
----------
fname : string
The filename to write to. Must end with ".obj" or ".gz".
vertices : numpy array
The vertex data
faces : numpy array
The face data
te... | [
"This",
"classmethod",
"is",
"the",
"entry",
"point",
"for",
"writing",
"mesh",
"data",
"to",
"OBJ",
"."
] | 54a4351d98c1f90dfb1a557d1b447c1f57470eea | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/io/wavefront.py#L229-L263 | train |
glue-viz/glue-vispy-viewers | glue_vispy_viewers/extern/vispy/io/wavefront.py | WavefrontWriter.writeTuple | def writeTuple(self, val, what):
""" Writes a tuple of numbers (on one line).
"""
# Limit to three values. so RGBA data drops the alpha channel
# Format can handle up to 3 texcords
val = val[:3]
# Make string
val = ' '.join([str(v) for v in val])
# Write l... | python | def writeTuple(self, val, what):
""" Writes a tuple of numbers (on one line).
"""
# Limit to three values. so RGBA data drops the alpha channel
# Format can handle up to 3 texcords
val = val[:3]
# Make string
val = ' '.join([str(v) for v in val])
# Write l... | [
"def",
"writeTuple",
"(",
"self",
",",
"val",
",",
"what",
")",
":",
"# Limit to three values. so RGBA data drops the alpha channel",
"# Format can handle up to 3 texcords",
"val",
"=",
"val",
"[",
":",
"3",
"]",
"# Make string",
"val",
"=",
"' '",
".",
"join",
"(",... | Writes a tuple of numbers (on one line). | [
"Writes",
"a",
"tuple",
"of",
"numbers",
"(",
"on",
"one",
"line",
")",
"."
] | 54a4351d98c1f90dfb1a557d1b447c1f57470eea | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/io/wavefront.py#L272-L281 | train |
glue-viz/glue-vispy-viewers | glue_vispy_viewers/extern/vispy/io/wavefront.py | WavefrontWriter.writeFace | def writeFace(self, val, what='f'):
""" Write the face info to the net line.
"""
# OBJ counts from 1
val = [v + 1 for v in val]
# Make string
if self._hasValues and self._hasNormals:
val = ' '.join(['%i/%i/%i' % (v, v, v) for v in val])
elif self._hasN... | python | def writeFace(self, val, what='f'):
""" Write the face info to the net line.
"""
# OBJ counts from 1
val = [v + 1 for v in val]
# Make string
if self._hasValues and self._hasNormals:
val = ' '.join(['%i/%i/%i' % (v, v, v) for v in val])
elif self._hasN... | [
"def",
"writeFace",
"(",
"self",
",",
"val",
",",
"what",
"=",
"'f'",
")",
":",
"# OBJ counts from 1",
"val",
"=",
"[",
"v",
"+",
"1",
"for",
"v",
"in",
"val",
"]",
"# Make string",
"if",
"self",
".",
"_hasValues",
"and",
"self",
".",
"_hasNormals",
... | Write the face info to the net line. | [
"Write",
"the",
"face",
"info",
"to",
"the",
"net",
"line",
"."
] | 54a4351d98c1f90dfb1a557d1b447c1f57470eea | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/io/wavefront.py#L283-L298 | train |
glue-viz/glue-vispy-viewers | glue_vispy_viewers/extern/vispy/io/wavefront.py | WavefrontWriter.writeMesh | def writeMesh(self, vertices, faces, normals, values,
name='', reshape_faces=True):
""" Write the given mesh instance.
"""
# Store properties
self._hasNormals = normals is not None
self._hasValues = values is not None
self._hasFaces = faces is not None
... | python | def writeMesh(self, vertices, faces, normals, values,
name='', reshape_faces=True):
""" Write the given mesh instance.
"""
# Store properties
self._hasNormals = normals is not None
self._hasValues = values is not None
self._hasFaces = faces is not None
... | [
"def",
"writeMesh",
"(",
"self",
",",
"vertices",
",",
"faces",
",",
"normals",
",",
"values",
",",
"name",
"=",
"''",
",",
"reshape_faces",
"=",
"True",
")",
":",
"# Store properties",
"self",
".",
"_hasNormals",
"=",
"normals",
"is",
"not",
"None",
"se... | Write the given mesh instance. | [
"Write",
"the",
"given",
"mesh",
"instance",
"."
] | 54a4351d98c1f90dfb1a557d1b447c1f57470eea | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/io/wavefront.py#L300-L363 | train |
glue-viz/glue-vispy-viewers | glue_vispy_viewers/extern/vispy/geometry/calculations.py | _fast_cross_3d | def _fast_cross_3d(x, y):
"""Compute cross product between list of 3D vectors
Much faster than np.cross() when the number of cross products
becomes large (>500). This is because np.cross() methods become
less memory efficient at this stage.
Parameters
----------
x : array
Input arr... | python | def _fast_cross_3d(x, y):
"""Compute cross product between list of 3D vectors
Much faster than np.cross() when the number of cross products
becomes large (>500). This is because np.cross() methods become
less memory efficient at this stage.
Parameters
----------
x : array
Input arr... | [
"def",
"_fast_cross_3d",
"(",
"x",
",",
"y",
")",
":",
"assert",
"x",
".",
"ndim",
"==",
"2",
"assert",
"y",
".",
"ndim",
"==",
"2",
"assert",
"x",
".",
"shape",
"[",
"1",
"]",
"==",
"3",
"assert",
"y",
".",
"shape",
"[",
"1",
"]",
"==",
"3",... | Compute cross product between list of 3D vectors
Much faster than np.cross() when the number of cross products
becomes large (>500). This is because np.cross() methods become
less memory efficient at this stage.
Parameters
----------
x : array
Input array 1.
y : array
Input... | [
"Compute",
"cross",
"product",
"between",
"list",
"of",
"3D",
"vectors"
] | 54a4351d98c1f90dfb1a557d1b447c1f57470eea | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/geometry/calculations.py#L16-L50 | train |
glue-viz/glue-vispy-viewers | glue_vispy_viewers/extern/vispy/geometry/calculations.py | _calculate_normals | def _calculate_normals(rr, tris):
"""Efficiently compute vertex normals for triangulated surface"""
# ensure highest precision for our summation/vectorization "trick"
rr = rr.astype(np.float64)
# first, compute triangle normals
r1 = rr[tris[:, 0], :]
r2 = rr[tris[:, 1], :]
r3 = rr[tris[:, 2]... | python | def _calculate_normals(rr, tris):
"""Efficiently compute vertex normals for triangulated surface"""
# ensure highest precision for our summation/vectorization "trick"
rr = rr.astype(np.float64)
# first, compute triangle normals
r1 = rr[tris[:, 0], :]
r2 = rr[tris[:, 1], :]
r3 = rr[tris[:, 2]... | [
"def",
"_calculate_normals",
"(",
"rr",
",",
"tris",
")",
":",
"# ensure highest precision for our summation/vectorization \"trick\"",
"rr",
"=",
"rr",
".",
"astype",
"(",
"np",
".",
"float64",
")",
"# first, compute triangle normals",
"r1",
"=",
"rr",
"[",
"tris",
... | Efficiently compute vertex normals for triangulated surface | [
"Efficiently",
"compute",
"vertex",
"normals",
"for",
"triangulated",
"surface"
] | 54a4351d98c1f90dfb1a557d1b447c1f57470eea | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/geometry/calculations.py#L53-L83 | train |
glue-viz/glue-vispy-viewers | glue_vispy_viewers/extern/vispy/geometry/calculations.py | resize | def resize(image, shape, kind='linear'):
"""Resize an image
Parameters
----------
image : ndarray
Array of shape (N, M, ...).
shape : tuple
2-element shape.
kind : str
Interpolation, either "linear" or "nearest".
Returns
-------
scaled_image : ndarray
... | python | def resize(image, shape, kind='linear'):
"""Resize an image
Parameters
----------
image : ndarray
Array of shape (N, M, ...).
shape : tuple
2-element shape.
kind : str
Interpolation, either "linear" or "nearest".
Returns
-------
scaled_image : ndarray
... | [
"def",
"resize",
"(",
"image",
",",
"shape",
",",
"kind",
"=",
"'linear'",
")",
":",
"image",
"=",
"np",
".",
"array",
"(",
"image",
",",
"float",
")",
"shape",
"=",
"np",
".",
"array",
"(",
"shape",
",",
"int",
")",
"if",
"shape",
".",
"ndim",
... | Resize an image
Parameters
----------
image : ndarray
Array of shape (N, M, ...).
shape : tuple
2-element shape.
kind : str
Interpolation, either "linear" or "nearest".
Returns
-------
scaled_image : ndarray
New image, will have dtype np.float64. | [
"Resize",
"an",
"image"
] | 54a4351d98c1f90dfb1a557d1b447c1f57470eea | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/geometry/calculations.py#L86-L137 | train |
glue-viz/glue-vispy-viewers | glue_vispy_viewers/extern/vispy/visuals/collections/raw_segment_collection.py | RawSegmentCollection.append | def append(self, P0, P1, itemsize=None, **kwargs):
"""
Append a new set of segments to the collection.
For kwargs argument, n is the number of vertices (local) or the number
of item (shared)
Parameters
----------
P : np.array
Vertices positions of t... | python | def append(self, P0, P1, itemsize=None, **kwargs):
"""
Append a new set of segments to the collection.
For kwargs argument, n is the number of vertices (local) or the number
of item (shared)
Parameters
----------
P : np.array
Vertices positions of t... | [
"def",
"append",
"(",
"self",
",",
"P0",
",",
"P1",
",",
"itemsize",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"itemsize",
"=",
"itemsize",
"or",
"1",
"itemcount",
"=",
"len",
"(",
"P0",
")",
"/",
"itemsize",
"V",
"=",
"np",
".",
"empty",
... | Append a new set of segments to the collection.
For kwargs argument, n is the number of vertices (local) or the number
of item (shared)
Parameters
----------
P : np.array
Vertices positions of the path(s) to be added
closed: bool
Whether path(s... | [
"Append",
"a",
"new",
"set",
"of",
"segments",
"to",
"the",
"collection",
"."
] | 54a4351d98c1f90dfb1a557d1b447c1f57470eea | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/collections/raw_segment_collection.py#L71-L117 | train |
rbarrois/mpdlcd | mpdlcd/display_pattern.py | ScreenPattern.parse | def parse(self):
"""Parse the lines, and fill self.line_fields accordingly."""
for line in self.lines:
# Parse the line
field_defs = self.parse_line(line)
fields = []
# Convert field parameters into Field objects
for (kind, options) in field_d... | python | def parse(self):
"""Parse the lines, and fill self.line_fields accordingly."""
for line in self.lines:
# Parse the line
field_defs = self.parse_line(line)
fields = []
# Convert field parameters into Field objects
for (kind, options) in field_d... | [
"def",
"parse",
"(",
"self",
")",
":",
"for",
"line",
"in",
"self",
".",
"lines",
":",
"# Parse the line",
"field_defs",
"=",
"self",
".",
"parse_line",
"(",
"line",
")",
"fields",
"=",
"[",
"]",
"# Convert field parameters into Field objects",
"for",
"(",
"... | Parse the lines, and fill self.line_fields accordingly. | [
"Parse",
"the",
"lines",
"and",
"fill",
"self",
".",
"line_fields",
"accordingly",
"."
] | 85f16c8cc0883f8abb4c2cc7f69729c3e2f857da | https://github.com/rbarrois/mpdlcd/blob/85f16c8cc0883f8abb4c2cc7f69729c3e2f857da/mpdlcd/display_pattern.py#L42-L59 | train |
rbarrois/mpdlcd | mpdlcd/display_pattern.py | ScreenPattern.compute_positions | def compute_positions(cls, screen_width, line):
"""Compute the relative position of the fields on a given line.
Args:
screen_width (int): the width of the screen
line (mpdlcd.display_fields.Field list): the list of fields on the
line
Returns:
... | python | def compute_positions(cls, screen_width, line):
"""Compute the relative position of the fields on a given line.
Args:
screen_width (int): the width of the screen
line (mpdlcd.display_fields.Field list): the list of fields on the
line
Returns:
... | [
"def",
"compute_positions",
"(",
"cls",
",",
"screen_width",
",",
"line",
")",
":",
"# First index",
"left",
"=",
"1",
"# Last index",
"right",
"=",
"screen_width",
"+",
"1",
"# Current 'flexible' field",
"flexible",
"=",
"None",
"# Compute the space to the left and t... | Compute the relative position of the fields on a given line.
Args:
screen_width (int): the width of the screen
line (mpdlcd.display_fields.Field list): the list of fields on the
line
Returns:
((int, mpdlcd.display_fields.Field) list): the positions o... | [
"Compute",
"the",
"relative",
"position",
"of",
"the",
"fields",
"on",
"a",
"given",
"line",
"."
] | 85f16c8cc0883f8abb4c2cc7f69729c3e2f857da | https://github.com/rbarrois/mpdlcd/blob/85f16c8cc0883f8abb4c2cc7f69729c3e2f857da/mpdlcd/display_pattern.py#L67-L126 | train |
rbarrois/mpdlcd | mpdlcd/display_pattern.py | ScreenPattern.add_to_screen | def add_to_screen(self, screen_width, screen):
"""Add the pattern to a screen.
Also fills self.widgets.
Args:
screen_width (int): the width of the screen
screen (lcdprod.Screen): the screen to fill.
"""
for lineno, fields in enumerate(self.line_fields):
... | python | def add_to_screen(self, screen_width, screen):
"""Add the pattern to a screen.
Also fills self.widgets.
Args:
screen_width (int): the width of the screen
screen (lcdprod.Screen): the screen to fill.
"""
for lineno, fields in enumerate(self.line_fields):
... | [
"def",
"add_to_screen",
"(",
"self",
",",
"screen_width",
",",
"screen",
")",
":",
"for",
"lineno",
",",
"fields",
"in",
"enumerate",
"(",
"self",
".",
"line_fields",
")",
":",
"for",
"left",
",",
"field",
"in",
"self",
".",
"compute_positions",
"(",
"sc... | Add the pattern to a screen.
Also fills self.widgets.
Args:
screen_width (int): the width of the screen
screen (lcdprod.Screen): the screen to fill. | [
"Add",
"the",
"pattern",
"to",
"a",
"screen",
"."
] | 85f16c8cc0883f8abb4c2cc7f69729c3e2f857da | https://github.com/rbarrois/mpdlcd/blob/85f16c8cc0883f8abb4c2cc7f69729c3e2f857da/mpdlcd/display_pattern.py#L128-L145 | train |
rbarrois/mpdlcd | mpdlcd/display_pattern.py | ScreenPattern.register_hooks | def register_hooks(self, field):
"""Register a field on its target hooks."""
for hook, subhooks in field.register_hooks():
self.hooks[hook].append(field)
self.subhooks[hook] |= set(subhooks) | python | def register_hooks(self, field):
"""Register a field on its target hooks."""
for hook, subhooks in field.register_hooks():
self.hooks[hook].append(field)
self.subhooks[hook] |= set(subhooks) | [
"def",
"register_hooks",
"(",
"self",
",",
"field",
")",
":",
"for",
"hook",
",",
"subhooks",
"in",
"field",
".",
"register_hooks",
"(",
")",
":",
"self",
".",
"hooks",
"[",
"hook",
"]",
".",
"append",
"(",
"field",
")",
"self",
".",
"subhooks",
"[",... | Register a field on its target hooks. | [
"Register",
"a",
"field",
"on",
"its",
"target",
"hooks",
"."
] | 85f16c8cc0883f8abb4c2cc7f69729c3e2f857da | https://github.com/rbarrois/mpdlcd/blob/85f16c8cc0883f8abb4c2cc7f69729c3e2f857da/mpdlcd/display_pattern.py#L147-L151 | train |
rbarrois/mpdlcd | mpdlcd/display_pattern.py | ScreenPattern.hook_changed | def hook_changed(self, hook, new_data):
"""Called whenever the data for a hook changed."""
for field in self.hooks[hook]:
widget = self.widgets[field]
field.hook_changed(hook, widget, new_data) | python | def hook_changed(self, hook, new_data):
"""Called whenever the data for a hook changed."""
for field in self.hooks[hook]:
widget = self.widgets[field]
field.hook_changed(hook, widget, new_data) | [
"def",
"hook_changed",
"(",
"self",
",",
"hook",
",",
"new_data",
")",
":",
"for",
"field",
"in",
"self",
".",
"hooks",
"[",
"hook",
"]",
":",
"widget",
"=",
"self",
".",
"widgets",
"[",
"field",
"]",
"field",
".",
"hook_changed",
"(",
"hook",
",",
... | Called whenever the data for a hook changed. | [
"Called",
"whenever",
"the",
"data",
"for",
"a",
"hook",
"changed",
"."
] | 85f16c8cc0883f8abb4c2cc7f69729c3e2f857da | https://github.com/rbarrois/mpdlcd/blob/85f16c8cc0883f8abb4c2cc7f69729c3e2f857da/mpdlcd/display_pattern.py#L153-L157 | train |
rbarrois/mpdlcd | mpdlcd/display_pattern.py | ScreenPattern.parse_line | def parse_line(self, line):
"""Parse a line of text.
A format contains fields, within curly brackets, and free text.
Maximum one 'variable width' field is allowed per line.
You cannot use the '{' or '}' characters in the various text/... fields.
Format:
'''{<field_k... | python | def parse_line(self, line):
"""Parse a line of text.
A format contains fields, within curly brackets, and free text.
Maximum one 'variable width' field is allowed per line.
You cannot use the '{' or '}' characters in the various text/... fields.
Format:
'''{<field_k... | [
"def",
"parse_line",
"(",
"self",
",",
"line",
")",
":",
"logger",
".",
"debug",
"(",
"'Parsing line %s'",
",",
"line",
")",
"OUT_FIELD",
"=",
"0",
"IN_FIELD_KIND",
"=",
"1",
"IN_FIELD_OPTION_NAME",
"=",
"2",
"IN_FIELD_OPTION_VALUE",
"=",
"3",
"class",
"Pars... | Parse a line of text.
A format contains fields, within curly brackets, and free text.
Maximum one 'variable width' field is allowed per line.
You cannot use the '{' or '}' characters in the various text/... fields.
Format:
'''{<field_kind>[ <field_option>,<field_option]} te... | [
"Parse",
"a",
"line",
"of",
"text",
"."
] | 85f16c8cc0883f8abb4c2cc7f69729c3e2f857da | https://github.com/rbarrois/mpdlcd/blob/85f16c8cc0883f8abb4c2cc7f69729c3e2f857da/mpdlcd/display_pattern.py#L163-L424 | train |
rbarrois/mpdlcd | mpdlcd/display_pattern.py | ScreenPatternList.add | def add(self, pattern_txt):
"""Add a pattern to the list.
Args:
pattern_txt (str list): the pattern, as a list of lines.
"""
self.patterns[len(pattern_txt)] = pattern_txt
low = 0
high = len(pattern_txt) - 1
while not pattern_txt[low]:
lo... | python | def add(self, pattern_txt):
"""Add a pattern to the list.
Args:
pattern_txt (str list): the pattern, as a list of lines.
"""
self.patterns[len(pattern_txt)] = pattern_txt
low = 0
high = len(pattern_txt) - 1
while not pattern_txt[low]:
lo... | [
"def",
"add",
"(",
"self",
",",
"pattern_txt",
")",
":",
"self",
".",
"patterns",
"[",
"len",
"(",
"pattern_txt",
")",
"]",
"=",
"pattern_txt",
"low",
"=",
"0",
"high",
"=",
"len",
"(",
"pattern_txt",
")",
"-",
"1",
"while",
"not",
"pattern_txt",
"["... | Add a pattern to the list.
Args:
pattern_txt (str list): the pattern, as a list of lines. | [
"Add",
"a",
"pattern",
"to",
"the",
"list",
"."
] | 85f16c8cc0883f8abb4c2cc7f69729c3e2f857da | https://github.com/rbarrois/mpdlcd/blob/85f16c8cc0883f8abb4c2cc7f69729c3e2f857da/mpdlcd/display_pattern.py#L446-L464 | train |
glue-viz/glue-vispy-viewers | glue_vispy_viewers/extern/vispy/scene/cameras/arcball.py | _arcball | def _arcball(xy, wh):
"""Convert x,y coordinates to w,x,y,z Quaternion parameters
Adapted from:
linalg library
Copyright (c) 2010-2015, Renaud Blanch <rndblnch at gmail dot com>
Licence at your convenience:
GPLv3 or higher <http://www.gnu.org/licenses/gpl.html>
BSD new <http://opensource.... | python | def _arcball(xy, wh):
"""Convert x,y coordinates to w,x,y,z Quaternion parameters
Adapted from:
linalg library
Copyright (c) 2010-2015, Renaud Blanch <rndblnch at gmail dot com>
Licence at your convenience:
GPLv3 or higher <http://www.gnu.org/licenses/gpl.html>
BSD new <http://opensource.... | [
"def",
"_arcball",
"(",
"xy",
",",
"wh",
")",
":",
"x",
",",
"y",
"=",
"xy",
"w",
",",
"h",
"=",
"wh",
"r",
"=",
"(",
"w",
"+",
"h",
")",
"/",
"2.",
"x",
",",
"y",
"=",
"-",
"(",
"2.",
"*",
"x",
"-",
"w",
")",
"/",
"r",
",",
"(",
... | Convert x,y coordinates to w,x,y,z Quaternion parameters
Adapted from:
linalg library
Copyright (c) 2010-2015, Renaud Blanch <rndblnch at gmail dot com>
Licence at your convenience:
GPLv3 or higher <http://www.gnu.org/licenses/gpl.html>
BSD new <http://opensource.org/licenses/BSD-3-Clause> | [
"Convert",
"x",
"y",
"coordinates",
"to",
"w",
"x",
"y",
"z",
"Quaternion",
"parameters"
] | 54a4351d98c1f90dfb1a557d1b447c1f57470eea | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/scene/cameras/arcball.py#L84-L101 | train |
glue-viz/glue-vispy-viewers | glue_vispy_viewers/extern/vispy/scene/cameras/arcball.py | ArcballCamera._update_rotation | def _update_rotation(self, event):
"""Update rotation parmeters based on mouse movement"""
p2 = event.mouse_event.pos
if self._event_value is None:
self._event_value = p2
wh = self._viewbox.size
self._quaternion = (Quaternion(*_arcball(p2, wh)) *
... | python | def _update_rotation(self, event):
"""Update rotation parmeters based on mouse movement"""
p2 = event.mouse_event.pos
if self._event_value is None:
self._event_value = p2
wh = self._viewbox.size
self._quaternion = (Quaternion(*_arcball(p2, wh)) *
... | [
"def",
"_update_rotation",
"(",
"self",
",",
"event",
")",
":",
"p2",
"=",
"event",
".",
"mouse_event",
".",
"pos",
"if",
"self",
".",
"_event_value",
"is",
"None",
":",
"self",
".",
"_event_value",
"=",
"p2",
"wh",
"=",
"self",
".",
"_viewbox",
".",
... | Update rotation parmeters based on mouse movement | [
"Update",
"rotation",
"parmeters",
"based",
"on",
"mouse",
"movement"
] | 54a4351d98c1f90dfb1a557d1b447c1f57470eea | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/scene/cameras/arcball.py#L53-L63 | train |
glue-viz/glue-vispy-viewers | glue_vispy_viewers/extern/vispy/scene/cameras/arcball.py | ArcballCamera._rotate_tr | def _rotate_tr(self):
"""Rotate the transformation matrix based on camera parameters"""
rot, x, y, z = self._quaternion.get_axis_angle()
up, forward, right = self._get_dim_vectors()
self.transform.rotate(180 * rot / np.pi, (x, z, y)) | python | def _rotate_tr(self):
"""Rotate the transformation matrix based on camera parameters"""
rot, x, y, z = self._quaternion.get_axis_angle()
up, forward, right = self._get_dim_vectors()
self.transform.rotate(180 * rot / np.pi, (x, z, y)) | [
"def",
"_rotate_tr",
"(",
"self",
")",
":",
"rot",
",",
"x",
",",
"y",
",",
"z",
"=",
"self",
".",
"_quaternion",
".",
"get_axis_angle",
"(",
")",
"up",
",",
"forward",
",",
"right",
"=",
"self",
".",
"_get_dim_vectors",
"(",
")",
"self",
".",
"tra... | Rotate the transformation matrix based on camera parameters | [
"Rotate",
"the",
"transformation",
"matrix",
"based",
"on",
"camera",
"parameters"
] | 54a4351d98c1f90dfb1a557d1b447c1f57470eea | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/scene/cameras/arcball.py#L65-L69 | train |
glue-viz/glue-vispy-viewers | glue_vispy_viewers/extern/vispy/scene/cameras/arcball.py | ArcballCamera._dist_to_trans | def _dist_to_trans(self, dist):
"""Convert mouse x, y movement into x, y, z translations"""
rot, x, y, z = self._quaternion.get_axis_angle()
tr = MatrixTransform()
tr.rotate(180 * rot / np.pi, (x, y, z))
dx, dz, dy = np.dot(tr.matrix[:3, :3], (dist[0], dist[1], 0.))
retur... | python | def _dist_to_trans(self, dist):
"""Convert mouse x, y movement into x, y, z translations"""
rot, x, y, z = self._quaternion.get_axis_angle()
tr = MatrixTransform()
tr.rotate(180 * rot / np.pi, (x, y, z))
dx, dz, dy = np.dot(tr.matrix[:3, :3], (dist[0], dist[1], 0.))
retur... | [
"def",
"_dist_to_trans",
"(",
"self",
",",
"dist",
")",
":",
"rot",
",",
"x",
",",
"y",
",",
"z",
"=",
"self",
".",
"_quaternion",
".",
"get_axis_angle",
"(",
")",
"tr",
"=",
"MatrixTransform",
"(",
")",
"tr",
".",
"rotate",
"(",
"180",
"*",
"rot",... | Convert mouse x, y movement into x, y, z translations | [
"Convert",
"mouse",
"x",
"y",
"movement",
"into",
"x",
"y",
"z",
"translations"
] | 54a4351d98c1f90dfb1a557d1b447c1f57470eea | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/scene/cameras/arcball.py#L71-L77 | train |
glue-viz/glue-vispy-viewers | glue_vispy_viewers/extern/vispy/visuals/transforms/_util.py | arg_to_array | def arg_to_array(func):
"""
Decorator to convert argument to array.
Parameters
----------
func : function
The function to decorate.
Returns
-------
func : function
The decorated function.
"""
def fn(self, arg, *args, **kwargs):
"""Function
Param... | python | def arg_to_array(func):
"""
Decorator to convert argument to array.
Parameters
----------
func : function
The function to decorate.
Returns
-------
func : function
The decorated function.
"""
def fn(self, arg, *args, **kwargs):
"""Function
Param... | [
"def",
"arg_to_array",
"(",
"func",
")",
":",
"def",
"fn",
"(",
"self",
",",
"arg",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"\"\"\"Function\n\n Parameters\n ----------\n arg : array-like\n Argument to convert.\n *args : tu... | Decorator to convert argument to array.
Parameters
----------
func : function
The function to decorate.
Returns
-------
func : function
The decorated function. | [
"Decorator",
"to",
"convert",
"argument",
"to",
"array",
"."
] | 54a4351d98c1f90dfb1a557d1b447c1f57470eea | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/transforms/_util.py#L12-L44 | train |
glue-viz/glue-vispy-viewers | glue_vispy_viewers/extern/vispy/visuals/transforms/_util.py | as_vec4 | def as_vec4(obj, default=(0, 0, 0, 1)):
"""
Convert `obj` to 4-element vector (numpy array with shape[-1] == 4)
Parameters
----------
obj : array-like
Original object.
default : array-like
The defaults to use if the object does not have 4 entries.
Returns
-------
ob... | python | def as_vec4(obj, default=(0, 0, 0, 1)):
"""
Convert `obj` to 4-element vector (numpy array with shape[-1] == 4)
Parameters
----------
obj : array-like
Original object.
default : array-like
The defaults to use if the object does not have 4 entries.
Returns
-------
ob... | [
"def",
"as_vec4",
"(",
"obj",
",",
"default",
"=",
"(",
"0",
",",
"0",
",",
"0",
",",
"1",
")",
")",
":",
"obj",
"=",
"np",
".",
"atleast_2d",
"(",
"obj",
")",
"# For multiple vectors, reshape to (..., 4)",
"if",
"obj",
".",
"shape",
"[",
"-",
"1",
... | Convert `obj` to 4-element vector (numpy array with shape[-1] == 4)
Parameters
----------
obj : array-like
Original object.
default : array-like
The defaults to use if the object does not have 4 entries.
Returns
-------
obj : array-like
The object promoted to have 4... | [
"Convert",
"obj",
"to",
"4",
"-",
"element",
"vector",
"(",
"numpy",
"array",
"with",
"shape",
"[",
"-",
"1",
"]",
"==",
"4",
")"
] | 54a4351d98c1f90dfb1a557d1b447c1f57470eea | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/transforms/_util.py#L47-L82 | train |
glue-viz/glue-vispy-viewers | glue_vispy_viewers/extern/vispy/visuals/transforms/_util.py | arg_to_vec4 | def arg_to_vec4(func, self_, arg, *args, **kwargs):
"""
Decorator for converting argument to vec4 format suitable for 4x4 matrix
multiplication.
[x, y] => [[x, y, 0, 1]]
[x, y, z] => [[x, y, z, 1]]
[[x1, y1], [[x1, y1, 0, 1],
[x2, y2], => [x2, y2, 0, 1],
[x3, y3]] ... | python | def arg_to_vec4(func, self_, arg, *args, **kwargs):
"""
Decorator for converting argument to vec4 format suitable for 4x4 matrix
multiplication.
[x, y] => [[x, y, 0, 1]]
[x, y, z] => [[x, y, z, 1]]
[[x1, y1], [[x1, y1, 0, 1],
[x2, y2], => [x2, y2, 0, 1],
[x3, y3]] ... | [
"def",
"arg_to_vec4",
"(",
"func",
",",
"self_",
",",
"arg",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"isinstance",
"(",
"arg",
",",
"(",
"tuple",
",",
"list",
",",
"np",
".",
"ndarray",
")",
")",
":",
"arg",
"=",
"np",
".",
... | Decorator for converting argument to vec4 format suitable for 4x4 matrix
multiplication.
[x, y] => [[x, y, 0, 1]]
[x, y, z] => [[x, y, z, 1]]
[[x1, y1], [[x1, y1, 0, 1],
[x2, y2], => [x2, y2, 0, 1],
[x3, y3]] [x3, y3, 0, 1]]
If 1D input is provided, then the retu... | [
"Decorator",
"for",
"converting",
"argument",
"to",
"vec4",
"format",
"suitable",
"for",
"4x4",
"matrix",
"multiplication",
"."
] | 54a4351d98c1f90dfb1a557d1b447c1f57470eea | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/transforms/_util.py#L86-L122 | train |
glue-viz/glue-vispy-viewers | glue_vispy_viewers/extern/vispy/visuals/transforms/_util.py | TransformCache.get | def get(self, path):
""" Get a transform from the cache that maps along *path*, which must
be a list of Transforms to apply in reverse order (last transform is
applied first).
Accessed items have their age reset to 0.
"""
key = tuple(map(id, path))
item = self._c... | python | def get(self, path):
""" Get a transform from the cache that maps along *path*, which must
be a list of Transforms to apply in reverse order (last transform is
applied first).
Accessed items have their age reset to 0.
"""
key = tuple(map(id, path))
item = self._c... | [
"def",
"get",
"(",
"self",
",",
"path",
")",
":",
"key",
"=",
"tuple",
"(",
"map",
"(",
"id",
",",
"path",
")",
")",
"item",
"=",
"self",
".",
"_cache",
".",
"get",
"(",
"key",
",",
"None",
")",
"if",
"item",
"is",
"None",
":",
"logger",
".",... | Get a transform from the cache that maps along *path*, which must
be a list of Transforms to apply in reverse order (last transform is
applied first).
Accessed items have their age reset to 0. | [
"Get",
"a",
"transform",
"from",
"the",
"cache",
"that",
"maps",
"along",
"*",
"path",
"*",
"which",
"must",
"be",
"a",
"list",
"of",
"Transforms",
"to",
"apply",
"in",
"reverse",
"order",
"(",
"last",
"transform",
"is",
"applied",
"first",
")",
"."
] | 54a4351d98c1f90dfb1a557d1b447c1f57470eea | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/transforms/_util.py#L143-L164 | train |
glue-viz/glue-vispy-viewers | glue_vispy_viewers/extern/vispy/visuals/transforms/_util.py | TransformCache.roll | def roll(self):
""" Increase the age of all items in the cache by 1. Items whose age
is greater than self.max_age will be removed from the cache.
"""
rem = []
for key, item in self._cache.items():
if item[0] > self.max_age:
rem.append(key)
... | python | def roll(self):
""" Increase the age of all items in the cache by 1. Items whose age
is greater than self.max_age will be removed from the cache.
"""
rem = []
for key, item in self._cache.items():
if item[0] > self.max_age:
rem.append(key)
... | [
"def",
"roll",
"(",
"self",
")",
":",
"rem",
"=",
"[",
"]",
"for",
"key",
",",
"item",
"in",
"self",
".",
"_cache",
".",
"items",
"(",
")",
":",
"if",
"item",
"[",
"0",
"]",
">",
"self",
".",
"max_age",
":",
"rem",
".",
"append",
"(",
"key",
... | Increase the age of all items in the cache by 1. Items whose age
is greater than self.max_age will be removed from the cache. | [
"Increase",
"the",
"age",
"of",
"all",
"items",
"in",
"the",
"cache",
"by",
"1",
".",
"Items",
"whose",
"age",
"is",
"greater",
"than",
"self",
".",
"max_age",
"will",
"be",
"removed",
"from",
"the",
"cache",
"."
] | 54a4351d98c1f90dfb1a557d1b447c1f57470eea | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/transforms/_util.py#L171-L183 | train |
glue-viz/glue-vispy-viewers | glue_vispy_viewers/extern/vispy/plot/plotwidget.py | PlotWidget.histogram | def histogram(self, data, bins=10, color='w', orientation='h'):
"""Calculate and show a histogram of data
Parameters
----------
data : array-like
Data to histogram. Currently only 1D data is supported.
bins : int | array-like
Number of bins, or bin edges.... | python | def histogram(self, data, bins=10, color='w', orientation='h'):
"""Calculate and show a histogram of data
Parameters
----------
data : array-like
Data to histogram. Currently only 1D data is supported.
bins : int | array-like
Number of bins, or bin edges.... | [
"def",
"histogram",
"(",
"self",
",",
"data",
",",
"bins",
"=",
"10",
",",
"color",
"=",
"'w'",
",",
"orientation",
"=",
"'h'",
")",
":",
"self",
".",
"_configure_2d",
"(",
")",
"hist",
"=",
"scene",
".",
"Histogram",
"(",
"data",
",",
"bins",
",",... | Calculate and show a histogram of data
Parameters
----------
data : array-like
Data to histogram. Currently only 1D data is supported.
bins : int | array-like
Number of bins, or bin edges.
color : instance of Color
Color of the histogram.
... | [
"Calculate",
"and",
"show",
"a",
"histogram",
"of",
"data"
] | 54a4351d98c1f90dfb1a557d1b447c1f57470eea | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/plot/plotwidget.py#L159-L182 | train |
glue-viz/glue-vispy-viewers | glue_vispy_viewers/extern/vispy/plot/plotwidget.py | PlotWidget.image | def image(self, data, cmap='cubehelix', clim='auto', fg_color=None):
"""Show an image
Parameters
----------
data : ndarray
Should have shape (N, M), (N, M, 3) or (N, M, 4).
cmap : str
Colormap name.
clim : str | tuple
Colormap limits. ... | python | def image(self, data, cmap='cubehelix', clim='auto', fg_color=None):
"""Show an image
Parameters
----------
data : ndarray
Should have shape (N, M), (N, M, 3) or (N, M, 4).
cmap : str
Colormap name.
clim : str | tuple
Colormap limits. ... | [
"def",
"image",
"(",
"self",
",",
"data",
",",
"cmap",
"=",
"'cubehelix'",
",",
"clim",
"=",
"'auto'",
",",
"fg_color",
"=",
"None",
")",
":",
"self",
".",
"_configure_2d",
"(",
"fg_color",
")",
"image",
"=",
"scene",
".",
"Image",
"(",
"data",
",",
... | Show an image
Parameters
----------
data : ndarray
Should have shape (N, M), (N, M, 3) or (N, M, 4).
cmap : str
Colormap name.
clim : str | tuple
Colormap limits. Should be ``'auto'`` or a two-element tuple of
min and max values.
... | [
"Show",
"an",
"image"
] | 54a4351d98c1f90dfb1a557d1b447c1f57470eea | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/plot/plotwidget.py#L184-L214 | train |
glue-viz/glue-vispy-viewers | glue_vispy_viewers/extern/vispy/plot/plotwidget.py | PlotWidget.mesh | def mesh(self, vertices=None, faces=None, vertex_colors=None,
face_colors=None, color=(0.5, 0.5, 1.), fname=None,
meshdata=None):
"""Show a 3D mesh
Parameters
----------
vertices : array
Vertices.
faces : array | None
Face defini... | python | def mesh(self, vertices=None, faces=None, vertex_colors=None,
face_colors=None, color=(0.5, 0.5, 1.), fname=None,
meshdata=None):
"""Show a 3D mesh
Parameters
----------
vertices : array
Vertices.
faces : array | None
Face defini... | [
"def",
"mesh",
"(",
"self",
",",
"vertices",
"=",
"None",
",",
"faces",
"=",
"None",
",",
"vertex_colors",
"=",
"None",
",",
"face_colors",
"=",
"None",
",",
"color",
"=",
"(",
"0.5",
",",
"0.5",
",",
"1.",
")",
",",
"fname",
"=",
"None",
",",
"m... | Show a 3D mesh
Parameters
----------
vertices : array
Vertices.
faces : array | None
Face definitions.
vertex_colors : array | None
Vertex colors.
face_colors : array | None
Face colors.
color : instance of Color
... | [
"Show",
"a",
"3D",
"mesh"
] | 54a4351d98c1f90dfb1a557d1b447c1f57470eea | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/plot/plotwidget.py#L216-L262 | train |
glue-viz/glue-vispy-viewers | glue_vispy_viewers/extern/vispy/plot/plotwidget.py | PlotWidget.plot | def plot(self, data, color='k', symbol=None, line_kind='-', width=1.,
marker_size=10., edge_color='k', face_color='b', edge_width=1.,
title=None, xlabel=None, ylabel=None):
"""Plot a series of data using lines and markers
Parameters
----------
data : array | tw... | python | def plot(self, data, color='k', symbol=None, line_kind='-', width=1.,
marker_size=10., edge_color='k', face_color='b', edge_width=1.,
title=None, xlabel=None, ylabel=None):
"""Plot a series of data using lines and markers
Parameters
----------
data : array | tw... | [
"def",
"plot",
"(",
"self",
",",
"data",
",",
"color",
"=",
"'k'",
",",
"symbol",
"=",
"None",
",",
"line_kind",
"=",
"'-'",
",",
"width",
"=",
"1.",
",",
"marker_size",
"=",
"10.",
",",
"edge_color",
"=",
"'k'",
",",
"face_color",
"=",
"'b'",
",",... | Plot a series of data using lines and markers
Parameters
----------
data : array | two arrays
Arguments can be passed as ``(Y,)``, ``(X, Y)`` or
``np.array((X, Y))``.
color : instance of Color
Color of the line.
symbol : str
Marker... | [
"Plot",
"a",
"series",
"of",
"data",
"using",
"lines",
"and",
"markers"
] | 54a4351d98c1f90dfb1a557d1b447c1f57470eea | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/plot/plotwidget.py#L264-L325 | train |
glue-viz/glue-vispy-viewers | glue_vispy_viewers/extern/vispy/plot/plotwidget.py | PlotWidget.spectrogram | def spectrogram(self, x, n_fft=256, step=None, fs=1., window='hann',
color_scale='log', cmap='cubehelix', clim='auto'):
"""Calculate and show a spectrogram
Parameters
----------
x : array-like
1D signal to operate on. ``If len(x) < n_fft``, x will be
... | python | def spectrogram(self, x, n_fft=256, step=None, fs=1., window='hann',
color_scale='log', cmap='cubehelix', clim='auto'):
"""Calculate and show a spectrogram
Parameters
----------
x : array-like
1D signal to operate on. ``If len(x) < n_fft``, x will be
... | [
"def",
"spectrogram",
"(",
"self",
",",
"x",
",",
"n_fft",
"=",
"256",
",",
"step",
"=",
"None",
",",
"fs",
"=",
"1.",
",",
"window",
"=",
"'hann'",
",",
"color_scale",
"=",
"'log'",
",",
"cmap",
"=",
"'cubehelix'",
",",
"clim",
"=",
"'auto'",
")",... | Calculate and show a spectrogram
Parameters
----------
x : array-like
1D signal to operate on. ``If len(x) < n_fft``, x will be
zero-padded to length ``n_fft``.
n_fft : int
Number of FFT points. Much faster for powers of two.
step : int | None... | [
"Calculate",
"and",
"show",
"a",
"spectrogram"
] | 54a4351d98c1f90dfb1a557d1b447c1f57470eea | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/plot/plotwidget.py#L327-L370 | train |
glue-viz/glue-vispy-viewers | glue_vispy_viewers/extern/vispy/plot/plotwidget.py | PlotWidget.volume | def volume(self, vol, clim=None, method='mip', threshold=None,
cmap='grays'):
"""Show a 3D volume
Parameters
----------
vol : ndarray
Volume to render.
clim : tuple of two floats | None
The contrast limits. The values in the volume are mapp... | python | def volume(self, vol, clim=None, method='mip', threshold=None,
cmap='grays'):
"""Show a 3D volume
Parameters
----------
vol : ndarray
Volume to render.
clim : tuple of two floats | None
The contrast limits. The values in the volume are mapp... | [
"def",
"volume",
"(",
"self",
",",
"vol",
",",
"clim",
"=",
"None",
",",
"method",
"=",
"'mip'",
",",
"threshold",
"=",
"None",
",",
"cmap",
"=",
"'grays'",
")",
":",
"self",
".",
"_configure_3d",
"(",
")",
"volume",
"=",
"scene",
".",
"Volume",
"(... | Show a 3D volume
Parameters
----------
vol : ndarray
Volume to render.
clim : tuple of two floats | None
The contrast limits. The values in the volume are mapped to
black and white corresponding to these values. Default maps
between min an... | [
"Show",
"a",
"3D",
"volume"
] | 54a4351d98c1f90dfb1a557d1b447c1f57470eea | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/plot/plotwidget.py#L372-L406 | train |
glue-viz/glue-vispy-viewers | glue_vispy_viewers/extern/vispy/plot/plotwidget.py | PlotWidget.surface | def surface(self, zdata, **kwargs):
"""Show a 3D surface plot.
Extra keyword arguments are passed to `SurfacePlot()`.
Parameters
----------
zdata : array-like
A 2D array of the surface Z values.
"""
self._configure_3d()
surf = scene.SurfaceP... | python | def surface(self, zdata, **kwargs):
"""Show a 3D surface plot.
Extra keyword arguments are passed to `SurfacePlot()`.
Parameters
----------
zdata : array-like
A 2D array of the surface Z values.
"""
self._configure_3d()
surf = scene.SurfaceP... | [
"def",
"surface",
"(",
"self",
",",
"zdata",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"_configure_3d",
"(",
")",
"surf",
"=",
"scene",
".",
"SurfacePlot",
"(",
"z",
"=",
"zdata",
",",
"*",
"*",
"kwargs",
")",
"self",
".",
"view",
".",
"add... | Show a 3D surface plot.
Extra keyword arguments are passed to `SurfacePlot()`.
Parameters
----------
zdata : array-like
A 2D array of the surface Z values. | [
"Show",
"a",
"3D",
"surface",
"plot",
"."
] | 54a4351d98c1f90dfb1a557d1b447c1f57470eea | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/plot/plotwidget.py#L408-L423 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.