id
int32
0
252k
repo
stringlengths
7
55
path
stringlengths
4
127
func_name
stringlengths
1
88
original_string
stringlengths
75
19.8k
language
stringclasses
1 value
code
stringlengths
75
19.8k
code_tokens
list
docstring
stringlengths
3
17.3k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
87
242
222,600
vtkiorg/vtki
vtki/container.py
MultiBlock.keys
def keys(self): """Get all the block names in the dataset""" names = [] for i in range(self.n_blocks): names.append(self.get_block_name(i)) return names
python
def keys(self): """Get all the block names in the dataset""" names = [] for i in range(self.n_blocks): names.append(self.get_block_name(i)) return names
[ "def", "keys", "(", "self", ")", ":", "names", "=", "[", "]", "for", "i", "in", "range", "(", "self", ".", "n_blocks", ")", ":", "names", ".", "append", "(", "self", ".", "get_block_name", "(", "i", ")", ")", "return", "names" ]
Get all the block names in the dataset
[ "Get", "all", "the", "block", "names", "in", "the", "dataset" ]
5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1
https://github.com/vtkiorg/vtki/blob/5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1/vtki/container.py#L263-L268
222,601
vtkiorg/vtki
vtki/container.py
MultiBlock.next
def next(self): """Get the next block from the iterator""" if self._iter_n < self.n_blocks: result = self[self._iter_n] self._iter_n += 1 return result else: raise StopIteration
python
def next(self): """Get the next block from the iterator""" if self._iter_n < self.n_blocks: result = self[self._iter_n] self._iter_n += 1 return result else: raise StopIteration
[ "def", "next", "(", "self", ")", ":", "if", "self", ".", "_iter_n", "<", "self", ".", "n_blocks", ":", "result", "=", "self", "[", "self", ".", "_iter_n", "]", "self", ".", "_iter_n", "+=", "1", "return", "result", "else", ":", "raise", "StopIteratio...
Get the next block from the iterator
[ "Get", "the", "next", "block", "from", "the", "iterator" ]
5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1
https://github.com/vtkiorg/vtki/blob/5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1/vtki/container.py#L321-L328
222,602
vtkiorg/vtki
vtki/container.py
MultiBlock._repr_html_
def _repr_html_(self): """A pretty representation for Jupyter notebooks""" fmt = "" fmt += "<table>" fmt += "<tr><th>Information</th><th>Blocks</th></tr>" fmt += "<tr><td>" fmt += "\n" fmt += "<table>\n" fmt += "<tr><th>{}</th><th>Values</th></tr>\n".forma...
python
def _repr_html_(self): """A pretty representation for Jupyter notebooks""" fmt = "" fmt += "<table>" fmt += "<tr><th>Information</th><th>Blocks</th></tr>" fmt += "<tr><td>" fmt += "\n" fmt += "<table>\n" fmt += "<tr><th>{}</th><th>Values</th></tr>\n".forma...
[ "def", "_repr_html_", "(", "self", ")", ":", "fmt", "=", "\"\"", "fmt", "+=", "\"<table>\"", "fmt", "+=", "\"<tr><th>Information</th><th>Blocks</th></tr>\"", "fmt", "+=", "\"<tr><td>\"", "fmt", "+=", "\"\\n\"", "fmt", "+=", "\"<table>\\n\"", "fmt", "+=", "\"<tr><t...
A pretty representation for Jupyter notebooks
[ "A", "pretty", "representation", "for", "Jupyter", "notebooks" ]
5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1
https://github.com/vtkiorg/vtki/blob/5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1/vtki/container.py#L367-L400
222,603
vtkiorg/vtki
vtki/geometric_objects.py
translate
def translate(surf, center, direction): """ Translates and orientates a mesh centered at the origin and facing in the x direction to a new center and direction """ normx = np.array(direction)/np.linalg.norm(direction) normz = np.cross(normx, [0, 1.0, 0.0000001]) normz /= np.linalg.norm(normz...
python
def translate(surf, center, direction): """ Translates and orientates a mesh centered at the origin and facing in the x direction to a new center and direction """ normx = np.array(direction)/np.linalg.norm(direction) normz = np.cross(normx, [0, 1.0, 0.0000001]) normz /= np.linalg.norm(normz...
[ "def", "translate", "(", "surf", ",", "center", ",", "direction", ")", ":", "normx", "=", "np", ".", "array", "(", "direction", ")", "/", "np", ".", "linalg", ".", "norm", "(", "direction", ")", "normz", "=", "np", ".", "cross", "(", "normx", ",", ...
Translates and orientates a mesh centered at the origin and facing in the x direction to a new center and direction
[ "Translates", "and", "orientates", "a", "mesh", "centered", "at", "the", "origin", "and", "facing", "in", "the", "x", "direction", "to", "a", "new", "center", "and", "direction" ]
5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1
https://github.com/vtkiorg/vtki/blob/5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1/vtki/geometric_objects.py#L24-L41
222,604
vtkiorg/vtki
vtki/geometric_objects.py
Cylinder
def Cylinder(center=(0.,0.,0.), direction=(1.,0.,0.), radius=0.5, height=1.0, resolution=100, **kwargs): """ Create the surface of a cylinder. Parameters ---------- center : list or np.ndarray Location of the centroid in [x, y, z] direction : list or np.ndarray Di...
python
def Cylinder(center=(0.,0.,0.), direction=(1.,0.,0.), radius=0.5, height=1.0, resolution=100, **kwargs): """ Create the surface of a cylinder. Parameters ---------- center : list or np.ndarray Location of the centroid in [x, y, z] direction : list or np.ndarray Di...
[ "def", "Cylinder", "(", "center", "=", "(", "0.", ",", "0.", ",", "0.", ")", ",", "direction", "=", "(", "1.", ",", "0.", ",", "0.", ")", ",", "radius", "=", "0.5", ",", "height", "=", "1.0", ",", "resolution", "=", "100", ",", "*", "*", "kwa...
Create the surface of a cylinder. Parameters ---------- center : list or np.ndarray Location of the centroid in [x, y, z] direction : list or np.ndarray Direction cylinder points to in [x, y, z] radius : float Radius of the cylinder. height : float Height of ...
[ "Create", "the", "surface", "of", "a", "cylinder", "." ]
5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1
https://github.com/vtkiorg/vtki/blob/5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1/vtki/geometric_objects.py#L44-L93
222,605
vtkiorg/vtki
vtki/geometric_objects.py
Arrow
def Arrow(start=(0.,0.,0.), direction=(1.,0.,0.), tip_length=0.25, tip_radius=0.1, shaft_radius=0.05, shaft_resolution=20): """ Create a vtk Arrow Parameters ---------- start : np.ndarray Start location in [x, y, z] direction : list or np.ndarray Direction the arrow p...
python
def Arrow(start=(0.,0.,0.), direction=(1.,0.,0.), tip_length=0.25, tip_radius=0.1, shaft_radius=0.05, shaft_resolution=20): """ Create a vtk Arrow Parameters ---------- start : np.ndarray Start location in [x, y, z] direction : list or np.ndarray Direction the arrow p...
[ "def", "Arrow", "(", "start", "=", "(", "0.", ",", "0.", ",", "0.", ")", ",", "direction", "=", "(", "1.", ",", "0.", ",", "0.", ")", ",", "tip_length", "=", "0.25", ",", "tip_radius", "=", "0.1", ",", "shaft_radius", "=", "0.05", ",", "shaft_res...
Create a vtk Arrow Parameters ---------- start : np.ndarray Start location in [x, y, z] direction : list or np.ndarray Direction the arrow points to in [x, y, z] tip_length : float, optional Length of the tip. tip_radius : float, optional Radius of the tip. ...
[ "Create", "a", "vtk", "Arrow" ]
5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1
https://github.com/vtkiorg/vtki/blob/5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1/vtki/geometric_objects.py#L96-L135
222,606
vtkiorg/vtki
vtki/geometric_objects.py
Sphere
def Sphere(radius=0.5, center=(0, 0, 0), direction=(0, 0, 1), theta_resolution=30, phi_resolution=30, start_theta=0, end_theta=360, start_phi=0, end_phi=180): """ Create a vtk Sphere Parameters ---------- radius : float, optional Sphere radius center : np.ndarray or list, op...
python
def Sphere(radius=0.5, center=(0, 0, 0), direction=(0, 0, 1), theta_resolution=30, phi_resolution=30, start_theta=0, end_theta=360, start_phi=0, end_phi=180): """ Create a vtk Sphere Parameters ---------- radius : float, optional Sphere radius center : np.ndarray or list, op...
[ "def", "Sphere", "(", "radius", "=", "0.5", ",", "center", "=", "(", "0", ",", "0", ",", "0", ")", ",", "direction", "=", "(", "0", ",", "0", ",", "1", ")", ",", "theta_resolution", "=", "30", ",", "phi_resolution", "=", "30", ",", "start_theta",...
Create a vtk Sphere Parameters ---------- radius : float, optional Sphere radius center : np.ndarray or list, optional Center in [x, y, z] direction : list or np.ndarray Direction the top of the sphere points to in [x, y, z] theta_resolution: int , optional Se...
[ "Create", "a", "vtk", "Sphere" ]
5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1
https://github.com/vtkiorg/vtki/blob/5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1/vtki/geometric_objects.py#L138-L191
222,607
vtkiorg/vtki
vtki/geometric_objects.py
Plane
def Plane(center=(0, 0, 0), direction=(0, 0, 1), i_size=1, j_size=1, i_resolution=10, j_resolution=10): """ Create a plane Parameters ---------- center : list or np.ndarray Location of the centroid in [x, y, z] direction : list or np.ndarray Direction cylinder points ...
python
def Plane(center=(0, 0, 0), direction=(0, 0, 1), i_size=1, j_size=1, i_resolution=10, j_resolution=10): """ Create a plane Parameters ---------- center : list or np.ndarray Location of the centroid in [x, y, z] direction : list or np.ndarray Direction cylinder points ...
[ "def", "Plane", "(", "center", "=", "(", "0", ",", "0", ",", "0", ")", ",", "direction", "=", "(", "0", ",", "0", ",", "1", ")", ",", "i_size", "=", "1", ",", "j_size", "=", "1", ",", "i_resolution", "=", "10", ",", "j_resolution", "=", "10",...
Create a plane Parameters ---------- center : list or np.ndarray Location of the centroid in [x, y, z] direction : list or np.ndarray Direction cylinder points to in [x, y, z] i_size : float Size of the plane in the i direction. j_size : float Size of the pla...
[ "Create", "a", "plane" ]
5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1
https://github.com/vtkiorg/vtki/blob/5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1/vtki/geometric_objects.py#L194-L236
222,608
vtkiorg/vtki
vtki/geometric_objects.py
Line
def Line(pointa=(-0.5, 0., 0.), pointb=(0.5, 0., 0.), resolution=1): """Create a line Parameters ---------- pointa : np.ndarray or list Location in [x, y, z]. pointb : np.ndarray or list Location in [x, y, z]. resolution : int number of pieces to divide line into "...
python
def Line(pointa=(-0.5, 0., 0.), pointb=(0.5, 0., 0.), resolution=1): """Create a line Parameters ---------- pointa : np.ndarray or list Location in [x, y, z]. pointb : np.ndarray or list Location in [x, y, z]. resolution : int number of pieces to divide line into "...
[ "def", "Line", "(", "pointa", "=", "(", "-", "0.5", ",", "0.", ",", "0.", ")", ",", "pointb", "=", "(", "0.5", ",", "0.", ",", "0.", ")", ",", "resolution", "=", "1", ")", ":", "if", "np", ".", "array", "(", "pointa", ")", ".", "size", "!="...
Create a line Parameters ---------- pointa : np.ndarray or list Location in [x, y, z]. pointb : np.ndarray or list Location in [x, y, z]. resolution : int number of pieces to divide line into
[ "Create", "a", "line" ]
5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1
https://github.com/vtkiorg/vtki/blob/5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1/vtki/geometric_objects.py#L239-L262
222,609
vtkiorg/vtki
vtki/geometric_objects.py
Cube
def Cube(center=(0., 0., 0.), x_length=1.0, y_length=1.0, z_length=1.0, bounds=None): """Create a cube by either specifying the center and side lengths or just the bounds of the cube. If ``bounds`` are given, all other arguments are ignored. Parameters ---------- center : np.ndarray or list ...
python
def Cube(center=(0., 0., 0.), x_length=1.0, y_length=1.0, z_length=1.0, bounds=None): """Create a cube by either specifying the center and side lengths or just the bounds of the cube. If ``bounds`` are given, all other arguments are ignored. Parameters ---------- center : np.ndarray or list ...
[ "def", "Cube", "(", "center", "=", "(", "0.", ",", "0.", ",", "0.", ")", ",", "x_length", "=", "1.0", ",", "y_length", "=", "1.0", ",", "z_length", "=", "1.0", ",", "bounds", "=", "None", ")", ":", "src", "=", "vtk", ".", "vtkCubeSource", "(", ...
Create a cube by either specifying the center and side lengths or just the bounds of the cube. If ``bounds`` are given, all other arguments are ignored. Parameters ---------- center : np.ndarray or list Center in [x, y, z]. x_length : float length of the cube in the x-direction...
[ "Create", "a", "cube", "by", "either", "specifying", "the", "center", "and", "side", "lengths", "or", "just", "the", "bounds", "of", "the", "cube", ".", "If", "bounds", "are", "given", "all", "other", "arguments", "are", "ignored", "." ]
5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1
https://github.com/vtkiorg/vtki/blob/5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1/vtki/geometric_objects.py#L265-L299
222,610
vtkiorg/vtki
vtki/readers.py
standard_reader_routine
def standard_reader_routine(reader, filename, attrs=None): """Use a given reader from the ``READERS`` mapping in the common VTK reading pipeline routine. Parameters ---------- reader : vtkReader Any instantiated VTK reader class filename : str The string filename to the data fi...
python
def standard_reader_routine(reader, filename, attrs=None): """Use a given reader from the ``READERS`` mapping in the common VTK reading pipeline routine. Parameters ---------- reader : vtkReader Any instantiated VTK reader class filename : str The string filename to the data fi...
[ "def", "standard_reader_routine", "(", "reader", ",", "filename", ",", "attrs", "=", "None", ")", ":", "if", "attrs", "is", "None", ":", "attrs", "=", "{", "}", "if", "not", "isinstance", "(", "attrs", ",", "dict", ")", ":", "raise", "TypeError", "(", ...
Use a given reader from the ``READERS`` mapping in the common VTK reading pipeline routine. Parameters ---------- reader : vtkReader Any instantiated VTK reader class filename : str The string filename to the data file to read. attrs : dict, optional A dictionary of at...
[ "Use", "a", "given", "reader", "from", "the", "READERS", "mapping", "in", "the", "common", "VTK", "reading", "pipeline", "routine", "." ]
5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1
https://github.com/vtkiorg/vtki/blob/5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1/vtki/readers.py#L85-L119
222,611
vtkiorg/vtki
vtki/readers.py
read_legacy
def read_legacy(filename): """Use VTK's legacy reader to read a file""" reader = vtk.vtkDataSetReader() reader.SetFileName(filename) # Ensure all data is fetched with poorly formated legacy files reader.ReadAllScalarsOn() reader.ReadAllColorScalarsOn() reader.ReadAllNormalsOn() reader.Re...
python
def read_legacy(filename): """Use VTK's legacy reader to read a file""" reader = vtk.vtkDataSetReader() reader.SetFileName(filename) # Ensure all data is fetched with poorly formated legacy files reader.ReadAllScalarsOn() reader.ReadAllColorScalarsOn() reader.ReadAllNormalsOn() reader.Re...
[ "def", "read_legacy", "(", "filename", ")", ":", "reader", "=", "vtk", ".", "vtkDataSetReader", "(", ")", "reader", ".", "SetFileName", "(", "filename", ")", "# Ensure all data is fetched with poorly formated legacy files", "reader", ".", "ReadAllScalarsOn", "(", ")",...
Use VTK's legacy reader to read a file
[ "Use", "VTK", "s", "legacy", "reader", "to", "read", "a", "file" ]
5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1
https://github.com/vtkiorg/vtki/blob/5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1/vtki/readers.py#L122-L137
222,612
vtkiorg/vtki
vtki/readers.py
read
def read(filename, attrs=None): """This will read any VTK file! It will figure out what reader to use then wrap the VTK object for use in ``vtki``. Parameters ---------- attrs : dict, optional A dictionary of attributes to call on the reader. Keys of dictionary are the attribute/met...
python
def read(filename, attrs=None): """This will read any VTK file! It will figure out what reader to use then wrap the VTK object for use in ``vtki``. Parameters ---------- attrs : dict, optional A dictionary of attributes to call on the reader. Keys of dictionary are the attribute/met...
[ "def", "read", "(", "filename", ",", "attrs", "=", "None", ")", ":", "filename", "=", "os", ".", "path", ".", "abspath", "(", "os", ".", "path", ".", "expanduser", "(", "filename", ")", ")", "ext", "=", "get_ext", "(", "filename", ")", "# From the ex...
This will read any VTK file! It will figure out what reader to use then wrap the VTK object for use in ``vtki``. Parameters ---------- attrs : dict, optional A dictionary of attributes to call on the reader. Keys of dictionary are the attribute/method names and values are the arguments ...
[ "This", "will", "read", "any", "VTK", "file!", "It", "will", "figure", "out", "what", "reader", "to", "use", "then", "wrap", "the", "VTK", "object", "for", "use", "in", "vtki", "." ]
5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1
https://github.com/vtkiorg/vtki/blob/5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1/vtki/readers.py#L140-L183
222,613
vtkiorg/vtki
vtki/readers.py
read_texture
def read_texture(filename, attrs=None): """Loads a ``vtkTexture`` from an image file.""" filename = os.path.abspath(os.path.expanduser(filename)) try: # intitialize the reader using the extnesion to find it reader = get_reader(filename) image = standard_reader_routine(reader, filenam...
python
def read_texture(filename, attrs=None): """Loads a ``vtkTexture`` from an image file.""" filename = os.path.abspath(os.path.expanduser(filename)) try: # intitialize the reader using the extnesion to find it reader = get_reader(filename) image = standard_reader_routine(reader, filenam...
[ "def", "read_texture", "(", "filename", ",", "attrs", "=", "None", ")", ":", "filename", "=", "os", ".", "path", ".", "abspath", "(", "os", ".", "path", ".", "expanduser", "(", "filename", ")", ")", "try", ":", "# intitialize the reader using the extnesion t...
Loads a ``vtkTexture`` from an image file.
[ "Loads", "a", "vtkTexture", "from", "an", "image", "file", "." ]
5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1
https://github.com/vtkiorg/vtki/blob/5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1/vtki/readers.py#L186-L197
222,614
vtkiorg/vtki
vtki/examples/downloads.py
delete_downloads
def delete_downloads(): """Delete all downloaded examples to free space or update the files""" shutil.rmtree(vtki.EXAMPLES_PATH) os.makedirs(vtki.EXAMPLES_PATH) return True
python
def delete_downloads(): """Delete all downloaded examples to free space or update the files""" shutil.rmtree(vtki.EXAMPLES_PATH) os.makedirs(vtki.EXAMPLES_PATH) return True
[ "def", "delete_downloads", "(", ")", ":", "shutil", ".", "rmtree", "(", "vtki", ".", "EXAMPLES_PATH", ")", "os", ".", "makedirs", "(", "vtki", ".", "EXAMPLES_PATH", ")", "return", "True" ]
Delete all downloaded examples to free space or update the files
[ "Delete", "all", "downloaded", "examples", "to", "free", "space", "or", "update", "the", "files" ]
5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1
https://github.com/vtkiorg/vtki/blob/5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1/vtki/examples/downloads.py#L13-L17
222,615
vtkiorg/vtki
vtki/examples/downloads.py
download_blood_vessels
def download_blood_vessels(): """data representing the bifurcation of blood vessels.""" local_path, _ = _download_file('pvtu_blood_vessels/blood_vessels.zip') filename = os.path.join(local_path, 'T0000000500.pvtu') mesh = vtki.read(filename) mesh.set_active_vectors('velocity') return mesh
python
def download_blood_vessels(): """data representing the bifurcation of blood vessels.""" local_path, _ = _download_file('pvtu_blood_vessels/blood_vessels.zip') filename = os.path.join(local_path, 'T0000000500.pvtu') mesh = vtki.read(filename) mesh.set_active_vectors('velocity') return mesh
[ "def", "download_blood_vessels", "(", ")", ":", "local_path", ",", "_", "=", "_download_file", "(", "'pvtu_blood_vessels/blood_vessels.zip'", ")", "filename", "=", "os", ".", "path", ".", "join", "(", "local_path", ",", "'T0000000500.pvtu'", ")", "mesh", "=", "v...
data representing the bifurcation of blood vessels.
[ "data", "representing", "the", "bifurcation", "of", "blood", "vessels", "." ]
5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1
https://github.com/vtkiorg/vtki/blob/5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1/vtki/examples/downloads.py#L137-L143
222,616
vtkiorg/vtki
vtki/examples/downloads.py
download_sparse_points
def download_sparse_points(): """Used with ``download_saddle_surface``""" saved_file, _ = _download_file('sparsePoints.txt') points_reader = vtk.vtkDelimitedTextReader() points_reader.SetFileName(saved_file) points_reader.DetectNumericColumnsOn() points_reader.SetFieldDelimiterCharacters('\t') ...
python
def download_sparse_points(): """Used with ``download_saddle_surface``""" saved_file, _ = _download_file('sparsePoints.txt') points_reader = vtk.vtkDelimitedTextReader() points_reader.SetFileName(saved_file) points_reader.DetectNumericColumnsOn() points_reader.SetFieldDelimiterCharacters('\t') ...
[ "def", "download_sparse_points", "(", ")", ":", "saved_file", ",", "_", "=", "_download_file", "(", "'sparsePoints.txt'", ")", "points_reader", "=", "vtk", ".", "vtkDelimitedTextReader", "(", ")", "points_reader", ".", "SetFileName", "(", "saved_file", ")", "point...
Used with ``download_saddle_surface``
[ "Used", "with", "download_saddle_surface" ]
5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1
https://github.com/vtkiorg/vtki/blob/5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1/vtki/examples/downloads.py#L154-L168
222,617
vtkiorg/vtki
vtki/examples/downloads.py
download_kitchen
def download_kitchen(split=False): """Download structured grid of kitchen with velocity field. Use the ``split`` argument to extract all of the furniture in the kitchen. """ mesh = _download_and_read('kitchen.vtk') if not split: return mesh extents = { 'door' : (27, 27, 14, 18, ...
python
def download_kitchen(split=False): """Download structured grid of kitchen with velocity field. Use the ``split`` argument to extract all of the furniture in the kitchen. """ mesh = _download_and_read('kitchen.vtk') if not split: return mesh extents = { 'door' : (27, 27, 14, 18, ...
[ "def", "download_kitchen", "(", "split", "=", "False", ")", ":", "mesh", "=", "_download_and_read", "(", "'kitchen.vtk'", ")", "if", "not", "split", ":", "return", "mesh", "extents", "=", "{", "'door'", ":", "(", "27", ",", "27", ",", "14", ",", "18", ...
Download structured grid of kitchen with velocity field. Use the ``split`` argument to extract all of the furniture in the kitchen.
[ "Download", "structured", "grid", "of", "kitchen", "with", "velocity", "field", ".", "Use", "the", "split", "argument", "to", "extract", "all", "of", "the", "furniture", "in", "the", "kitchen", "." ]
5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1
https://github.com/vtkiorg/vtki/blob/5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1/vtki/examples/downloads.py#L324-L358
222,618
vtkiorg/vtki
vtki/ipy_tools.py
InteractiveTool._get_scalar_names
def _get_scalar_names(self, limit=None): """Only give scalar options that have a varying range""" names = [] if limit == 'point': inpnames = list(self.input_dataset.point_arrays.keys()) elif limit == 'cell': inpnames = list(self.input_dataset.cell_arrays.keys()) ...
python
def _get_scalar_names(self, limit=None): """Only give scalar options that have a varying range""" names = [] if limit == 'point': inpnames = list(self.input_dataset.point_arrays.keys()) elif limit == 'cell': inpnames = list(self.input_dataset.cell_arrays.keys()) ...
[ "def", "_get_scalar_names", "(", "self", ",", "limit", "=", "None", ")", ":", "names", "=", "[", "]", "if", "limit", "==", "'point'", ":", "inpnames", "=", "list", "(", "self", ".", "input_dataset", ".", "point_arrays", ".", "keys", "(", ")", ")", "e...
Only give scalar options that have a varying range
[ "Only", "give", "scalar", "options", "that", "have", "a", "varying", "range" ]
5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1
https://github.com/vtkiorg/vtki/blob/5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1/vtki/ipy_tools.py#L133-L151
222,619
vtkiorg/vtki
vtki/ipy_tools.py
InteractiveTool._initialize
def _initialize(self, show_bounds, reset_camera, outline): """Outlines the input dataset and sets up the scene""" self.plotter.subplot(*self.loc) if outline is None: self.plotter.add_mesh(self.input_dataset.outline_corners(), reset_camera=False, color=vtki.rcParam...
python
def _initialize(self, show_bounds, reset_camera, outline): """Outlines the input dataset and sets up the scene""" self.plotter.subplot(*self.loc) if outline is None: self.plotter.add_mesh(self.input_dataset.outline_corners(), reset_camera=False, color=vtki.rcParam...
[ "def", "_initialize", "(", "self", ",", "show_bounds", ",", "reset_camera", ",", "outline", ")", ":", "self", ".", "plotter", ".", "subplot", "(", "*", "self", ".", "loc", ")", "if", "outline", "is", "None", ":", "self", ".", "plotter", ".", "add_mesh"...
Outlines the input dataset and sets up the scene
[ "Outlines", "the", "input", "dataset", "and", "sets", "up", "the", "scene" ]
5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1
https://github.com/vtkiorg/vtki/blob/5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1/vtki/ipy_tools.py#L160-L178
222,620
vtkiorg/vtki
vtki/ipy_tools.py
InteractiveTool._update_plotting_params
def _update_plotting_params(self, **kwargs): """Some plotting parameters can be changed through the tool; this updataes those plotting parameters. """ scalars = kwargs.get('scalars', None) if scalars is not None: old = self.display_params['scalars'] self.d...
python
def _update_plotting_params(self, **kwargs): """Some plotting parameters can be changed through the tool; this updataes those plotting parameters. """ scalars = kwargs.get('scalars', None) if scalars is not None: old = self.display_params['scalars'] self.d...
[ "def", "_update_plotting_params", "(", "self", ",", "*", "*", "kwargs", ")", ":", "scalars", "=", "kwargs", ".", "get", "(", "'scalars'", ",", "None", ")", "if", "scalars", "is", "not", "None", ":", "old", "=", "self", ".", "display_params", "[", "'sca...
Some plotting parameters can be changed through the tool; this updataes those plotting parameters.
[ "Some", "plotting", "parameters", "can", "be", "changed", "through", "the", "tool", ";", "this", "updataes", "those", "plotting", "parameters", "." ]
5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1
https://github.com/vtkiorg/vtki/blob/5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1/vtki/ipy_tools.py#L181-L197
222,621
vtkiorg/vtki
vtki/renderer.py
_remove_mapper_from_plotter
def _remove_mapper_from_plotter(plotter, actor, reset_camera): """removes this actor's mapper from the given plotter's _scalar_bar_mappers""" try: mapper = actor.GetMapper() except AttributeError: return for name in list(plotter._scalar_bar_mappers.keys()): try: plott...
python
def _remove_mapper_from_plotter(plotter, actor, reset_camera): """removes this actor's mapper from the given plotter's _scalar_bar_mappers""" try: mapper = actor.GetMapper() except AttributeError: return for name in list(plotter._scalar_bar_mappers.keys()): try: plott...
[ "def", "_remove_mapper_from_plotter", "(", "plotter", ",", "actor", ",", "reset_camera", ")", ":", "try", ":", "mapper", "=", "actor", ".", "GetMapper", "(", ")", "except", "AttributeError", ":", "return", "for", "name", "in", "list", "(", "plotter", ".", ...
removes this actor's mapper from the given plotter's _scalar_bar_mappers
[ "removes", "this", "actor", "s", "mapper", "from", "the", "given", "plotter", "s", "_scalar_bar_mappers" ]
5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1
https://github.com/vtkiorg/vtki/blob/5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1/vtki/renderer.py#L774-L791
222,622
vtkiorg/vtki
vtki/renderer.py
Renderer.add_axes_at_origin
def add_axes_at_origin(self): """ Add axes actor at origin Returns -------- marker_actor : vtk.vtkAxesActor vtkAxesActor actor """ self.marker_actor = vtk.vtkAxesActor() # renderer = self.renderers[self.loc_to_index(loc)] self.AddActor...
python
def add_axes_at_origin(self): """ Add axes actor at origin Returns -------- marker_actor : vtk.vtkAxesActor vtkAxesActor actor """ self.marker_actor = vtk.vtkAxesActor() # renderer = self.renderers[self.loc_to_index(loc)] self.AddActor...
[ "def", "add_axes_at_origin", "(", "self", ")", ":", "self", ".", "marker_actor", "=", "vtk", ".", "vtkAxesActor", "(", ")", "# renderer = self.renderers[self.loc_to_index(loc)]", "self", ".", "AddActor", "(", "self", ".", "marker_actor", ")", "self", ".", "parent"...
Add axes actor at origin Returns -------- marker_actor : vtk.vtkAxesActor vtkAxesActor actor
[ "Add", "axes", "actor", "at", "origin" ]
5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1
https://github.com/vtkiorg/vtki/blob/5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1/vtki/renderer.py#L128-L141
222,623
vtkiorg/vtki
vtki/renderer.py
Renderer.remove_bounding_box
def remove_bounding_box(self): """ Removes bounding box """ if hasattr(self, '_box_object'): actor = self.bounding_box_actor self.bounding_box_actor = None del self._box_object self.remove_actor(actor, reset_camera=False)
python
def remove_bounding_box(self): """ Removes bounding box """ if hasattr(self, '_box_object'): actor = self.bounding_box_actor self.bounding_box_actor = None del self._box_object self.remove_actor(actor, reset_camera=False)
[ "def", "remove_bounding_box", "(", "self", ")", ":", "if", "hasattr", "(", "self", ",", "'_box_object'", ")", ":", "actor", "=", "self", ".", "bounding_box_actor", "self", ".", "bounding_box_actor", "=", "None", "del", "self", ".", "_box_object", "self", "."...
Removes bounding box
[ "Removes", "bounding", "box" ]
5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1
https://github.com/vtkiorg/vtki/blob/5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1/vtki/renderer.py#L433-L439
222,624
vtkiorg/vtki
vtki/renderer.py
Renderer.camera_position
def camera_position(self): """ Returns camera position of active render window """ return [self.camera.GetPosition(), self.camera.GetFocalPoint(), self.camera.GetViewUp()]
python
def camera_position(self): """ Returns camera position of active render window """ return [self.camera.GetPosition(), self.camera.GetFocalPoint(), self.camera.GetViewUp()]
[ "def", "camera_position", "(", "self", ")", ":", "return", "[", "self", ".", "camera", ".", "GetPosition", "(", ")", ",", "self", ".", "camera", ".", "GetFocalPoint", "(", ")", ",", "self", ".", "camera", ".", "GetViewUp", "(", ")", "]" ]
Returns camera position of active render window
[ "Returns", "camera", "position", "of", "active", "render", "window" ]
5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1
https://github.com/vtkiorg/vtki/blob/5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1/vtki/renderer.py#L499-L503
222,625
vtkiorg/vtki
vtki/renderer.py
Renderer.camera_position
def camera_position(self, camera_location): """ Set camera position of all active render windows """ if camera_location is None: return if isinstance(camera_location, str): camera_location = camera_location.lower() if camera_location == 'xy': ...
python
def camera_position(self, camera_location): """ Set camera position of all active render windows """ if camera_location is None: return if isinstance(camera_location, str): camera_location = camera_location.lower() if camera_location == 'xy': ...
[ "def", "camera_position", "(", "self", ",", "camera_location", ")", ":", "if", "camera_location", "is", "None", ":", "return", "if", "isinstance", "(", "camera_location", ",", "str", ")", ":", "camera_location", "=", "camera_location", ".", "lower", "(", ")", ...
Set camera position of all active render windows
[ "Set", "camera", "position", "of", "all", "active", "render", "windows" ]
5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1
https://github.com/vtkiorg/vtki/blob/5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1/vtki/renderer.py#L506-L537
222,626
vtkiorg/vtki
vtki/renderer.py
Renderer.remove_actor
def remove_actor(self, actor, reset_camera=False): """ Removes an actor from the Renderer. Parameters ---------- actor : vtk.vtkActor Actor that has previously added to the Renderer. reset_camera : bool, optional Resets camera so all actors can b...
python
def remove_actor(self, actor, reset_camera=False): """ Removes an actor from the Renderer. Parameters ---------- actor : vtk.vtkActor Actor that has previously added to the Renderer. reset_camera : bool, optional Resets camera so all actors can b...
[ "def", "remove_actor", "(", "self", ",", "actor", ",", "reset_camera", "=", "False", ")", ":", "name", "=", "None", "if", "isinstance", "(", "actor", ",", "str", ")", ":", "name", "=", "actor", "keys", "=", "list", "(", "self", ".", "_actors", ".", ...
Removes an actor from the Renderer. Parameters ---------- actor : vtk.vtkActor Actor that has previously added to the Renderer. reset_camera : bool, optional Resets camera so all actors can be seen. Returns ------- success : bool ...
[ "Removes", "an", "actor", "from", "the", "Renderer", "." ]
5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1
https://github.com/vtkiorg/vtki/blob/5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1/vtki/renderer.py#L544-L603
222,627
vtkiorg/vtki
vtki/renderer.py
Renderer.set_scale
def set_scale(self, xscale=None, yscale=None, zscale=None, reset_camera=True): """ Scale all the datasets in the scene. Scaling in performed independently on the X, Y and Z axis. A scale of zero is illegal and will be replaced with one. """ if xscale is None: ...
python
def set_scale(self, xscale=None, yscale=None, zscale=None, reset_camera=True): """ Scale all the datasets in the scene. Scaling in performed independently on the X, Y and Z axis. A scale of zero is illegal and will be replaced with one. """ if xscale is None: ...
[ "def", "set_scale", "(", "self", ",", "xscale", "=", "None", ",", "yscale", "=", "None", ",", "zscale", "=", "None", ",", "reset_camera", "=", "True", ")", ":", "if", "xscale", "is", "None", ":", "xscale", "=", "self", ".", "scale", "[", "0", "]", ...
Scale all the datasets in the scene. Scaling in performed independently on the X, Y and Z axis. A scale of zero is illegal and will be replaced with one.
[ "Scale", "all", "the", "datasets", "in", "the", "scene", ".", "Scaling", "in", "performed", "independently", "on", "the", "X", "Y", "and", "Z", "axis", ".", "A", "scale", "of", "zero", "is", "illegal", "and", "will", "be", "replaced", "with", "one", "....
5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1
https://github.com/vtkiorg/vtki/blob/5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1/vtki/renderer.py#L605-L626
222,628
vtkiorg/vtki
vtki/renderer.py
Renderer.bounds
def bounds(self): """ Bounds of all actors present in the rendering window """ the_bounds = [np.inf, -np.inf, np.inf, -np.inf, np.inf, -np.inf] def _update_bounds(bounds): def update_axis(ax): if bounds[ax*2] < the_bounds[ax*2]: the_bounds[ax*2] =...
python
def bounds(self): """ Bounds of all actors present in the rendering window """ the_bounds = [np.inf, -np.inf, np.inf, -np.inf, np.inf, -np.inf] def _update_bounds(bounds): def update_axis(ax): if bounds[ax*2] < the_bounds[ax*2]: the_bounds[ax*2] =...
[ "def", "bounds", "(", "self", ")", ":", "the_bounds", "=", "[", "np", ".", "inf", ",", "-", "np", ".", "inf", ",", "np", ".", "inf", ",", "-", "np", ".", "inf", ",", "np", ".", "inf", ",", "-", "np", ".", "inf", "]", "def", "_update_bounds", ...
Bounds of all actors present in the rendering window
[ "Bounds", "of", "all", "actors", "present", "in", "the", "rendering", "window" ]
5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1
https://github.com/vtkiorg/vtki/blob/5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1/vtki/renderer.py#L629-L650
222,629
vtkiorg/vtki
vtki/renderer.py
Renderer.center
def center(self): """Center of the bounding box around all data present in the scene""" bounds = self.bounds x = (bounds[1] + bounds[0])/2 y = (bounds[3] + bounds[2])/2 z = (bounds[5] + bounds[4])/2 return [x, y, z]
python
def center(self): """Center of the bounding box around all data present in the scene""" bounds = self.bounds x = (bounds[1] + bounds[0])/2 y = (bounds[3] + bounds[2])/2 z = (bounds[5] + bounds[4])/2 return [x, y, z]
[ "def", "center", "(", "self", ")", ":", "bounds", "=", "self", ".", "bounds", "x", "=", "(", "bounds", "[", "1", "]", "+", "bounds", "[", "0", "]", ")", "/", "2", "y", "=", "(", "bounds", "[", "3", "]", "+", "bounds", "[", "2", "]", ")", ...
Center of the bounding box around all data present in the scene
[ "Center", "of", "the", "bounding", "box", "around", "all", "data", "present", "in", "the", "scene" ]
5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1
https://github.com/vtkiorg/vtki/blob/5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1/vtki/renderer.py#L653-L659
222,630
vtkiorg/vtki
vtki/renderer.py
Renderer.get_default_cam_pos
def get_default_cam_pos(self): """ Returns the default focal points and viewup. Uses ResetCamera to make a useful view. """ focal_pt = self.center return [np.array(rcParams['camera']['position']) + np.array(focal_pt), focal_pt, rcParams['camera']['viewup']...
python
def get_default_cam_pos(self): """ Returns the default focal points and viewup. Uses ResetCamera to make a useful view. """ focal_pt = self.center return [np.array(rcParams['camera']['position']) + np.array(focal_pt), focal_pt, rcParams['camera']['viewup']...
[ "def", "get_default_cam_pos", "(", "self", ")", ":", "focal_pt", "=", "self", ".", "center", "return", "[", "np", ".", "array", "(", "rcParams", "[", "'camera'", "]", "[", "'position'", "]", ")", "+", "np", ".", "array", "(", "focal_pt", ")", ",", "f...
Returns the default focal points and viewup. Uses ResetCamera to make a useful view.
[ "Returns", "the", "default", "focal", "points", "and", "viewup", ".", "Uses", "ResetCamera", "to", "make", "a", "useful", "view", "." ]
5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1
https://github.com/vtkiorg/vtki/blob/5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1/vtki/renderer.py#L661-L668
222,631
vtkiorg/vtki
vtki/renderer.py
Renderer.update_bounds_axes
def update_bounds_axes(self): """Update the bounds axes of the render window """ if (hasattr(self, '_box_object') and self._box_object is not None and self.bounding_box_actor is not None): if not np.allclose(self._box_object.bounds, self.bounds): color = self....
python
def update_bounds_axes(self): """Update the bounds axes of the render window """ if (hasattr(self, '_box_object') and self._box_object is not None and self.bounding_box_actor is not None): if not np.allclose(self._box_object.bounds, self.bounds): color = self....
[ "def", "update_bounds_axes", "(", "self", ")", ":", "if", "(", "hasattr", "(", "self", ",", "'_box_object'", ")", "and", "self", ".", "_box_object", "is", "not", "None", "and", "self", ".", "bounding_box_actor", "is", "not", "None", ")", ":", "if", "not"...
Update the bounds axes of the render window
[ "Update", "the", "bounds", "axes", "of", "the", "render", "window" ]
5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1
https://github.com/vtkiorg/vtki/blob/5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1/vtki/renderer.py#L670-L683
222,632
vtkiorg/vtki
vtki/renderer.py
Renderer.view_isometric
def view_isometric(self): """ Resets the camera to a default isometric view showing all the actors in the scene. """ self.camera_position = self.get_default_cam_pos() self.camera_set = False return self.reset_camera()
python
def view_isometric(self): """ Resets the camera to a default isometric view showing all the actors in the scene. """ self.camera_position = self.get_default_cam_pos() self.camera_set = False return self.reset_camera()
[ "def", "view_isometric", "(", "self", ")", ":", "self", ".", "camera_position", "=", "self", ".", "get_default_cam_pos", "(", ")", "self", ".", "camera_set", "=", "False", "return", "self", ".", "reset_camera", "(", ")" ]
Resets the camera to a default isometric view showing all the actors in the scene.
[ "Resets", "the", "camera", "to", "a", "default", "isometric", "view", "showing", "all", "the", "actors", "in", "the", "scene", "." ]
5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1
https://github.com/vtkiorg/vtki/blob/5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1/vtki/renderer.py#L697-L704
222,633
vtkiorg/vtki
vtki/renderer.py
Renderer.view_vector
def view_vector(self, vector, viewup=None): """Point the camera in the direction of the given vector""" focal_pt = self.center if viewup is None: viewup = rcParams['camera']['viewup'] cpos = [vector + np.array(focal_pt), focal_pt, viewup] self.camera_p...
python
def view_vector(self, vector, viewup=None): """Point the camera in the direction of the given vector""" focal_pt = self.center if viewup is None: viewup = rcParams['camera']['viewup'] cpos = [vector + np.array(focal_pt), focal_pt, viewup] self.camera_p...
[ "def", "view_vector", "(", "self", ",", "vector", ",", "viewup", "=", "None", ")", ":", "focal_pt", "=", "self", ".", "center", "if", "viewup", "is", "None", ":", "viewup", "=", "rcParams", "[", "'camera'", "]", "[", "'viewup'", "]", "cpos", "=", "["...
Point the camera in the direction of the given vector
[ "Point", "the", "camera", "in", "the", "direction", "of", "the", "given", "vector" ]
5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1
https://github.com/vtkiorg/vtki/blob/5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1/vtki/renderer.py#L706-L714
222,634
vtkiorg/vtki
vtki/renderer.py
Renderer.view_xy
def view_xy(self, negative=False): """View the XY plane""" vec = np.array([0,0,1]) viewup = np.array([0,1,0]) if negative: vec = np.array([0,0,-1]) return self.view_vector(vec, viewup)
python
def view_xy(self, negative=False): """View the XY plane""" vec = np.array([0,0,1]) viewup = np.array([0,1,0]) if negative: vec = np.array([0,0,-1]) return self.view_vector(vec, viewup)
[ "def", "view_xy", "(", "self", ",", "negative", "=", "False", ")", ":", "vec", "=", "np", ".", "array", "(", "[", "0", ",", "0", ",", "1", "]", ")", "viewup", "=", "np", ".", "array", "(", "[", "0", ",", "1", ",", "0", "]", ")", "if", "ne...
View the XY plane
[ "View", "the", "XY", "plane" ]
5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1
https://github.com/vtkiorg/vtki/blob/5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1/vtki/renderer.py#L716-L722
222,635
vtkiorg/vtki
vtki/utilities.py
cell_scalar
def cell_scalar(mesh, name): """ Returns cell scalars of a vtk object """ vtkarr = mesh.GetCellData().GetArray(name) if vtkarr: if isinstance(vtkarr, vtk.vtkBitArray): vtkarr = vtk_bit_array_to_char(vtkarr) return vtk_to_numpy(vtkarr)
python
def cell_scalar(mesh, name): """ Returns cell scalars of a vtk object """ vtkarr = mesh.GetCellData().GetArray(name) if vtkarr: if isinstance(vtkarr, vtk.vtkBitArray): vtkarr = vtk_bit_array_to_char(vtkarr) return vtk_to_numpy(vtkarr)
[ "def", "cell_scalar", "(", "mesh", ",", "name", ")", ":", "vtkarr", "=", "mesh", ".", "GetCellData", "(", ")", ".", "GetArray", "(", "name", ")", "if", "vtkarr", ":", "if", "isinstance", "(", "vtkarr", ",", "vtk", ".", "vtkBitArray", ")", ":", "vtkar...
Returns cell scalars of a vtk object
[ "Returns", "cell", "scalars", "of", "a", "vtk", "object" ]
5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1
https://github.com/vtkiorg/vtki/blob/5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1/vtki/utilities.py#L44-L50
222,636
vtkiorg/vtki
vtki/utilities.py
vtk_points
def vtk_points(points, deep=True): """ Convert numpy points to a vtkPoints object """ if not points.flags['C_CONTIGUOUS']: points = np.ascontiguousarray(points) vtkpts = vtk.vtkPoints() vtkpts.SetData(numpy_to_vtk(points, deep=deep)) return vtkpts
python
def vtk_points(points, deep=True): """ Convert numpy points to a vtkPoints object """ if not points.flags['C_CONTIGUOUS']: points = np.ascontiguousarray(points) vtkpts = vtk.vtkPoints() vtkpts.SetData(numpy_to_vtk(points, deep=deep)) return vtkpts
[ "def", "vtk_points", "(", "points", ",", "deep", "=", "True", ")", ":", "if", "not", "points", ".", "flags", "[", "'C_CONTIGUOUS'", "]", ":", "points", "=", "np", ".", "ascontiguousarray", "(", "points", ")", "vtkpts", "=", "vtk", ".", "vtkPoints", "("...
Convert numpy points to a vtkPoints object
[ "Convert", "numpy", "points", "to", "a", "vtkPoints", "object" ]
5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1
https://github.com/vtkiorg/vtki/blob/5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1/vtki/utilities.py#L109-L115
222,637
vtkiorg/vtki
vtki/utilities.py
lines_from_points
def lines_from_points(points): """ Generates line from points. Assumes points are ordered as line segments. Parameters ---------- points : np.ndarray Points representing line segments. For example, two line segments would be represented as: np.array([[0, 0, 0], [1, 0, 0],...
python
def lines_from_points(points): """ Generates line from points. Assumes points are ordered as line segments. Parameters ---------- points : np.ndarray Points representing line segments. For example, two line segments would be represented as: np.array([[0, 0, 0], [1, 0, 0],...
[ "def", "lines_from_points", "(", "points", ")", ":", "# Assuming ordered points, create array defining line order", "npoints", "=", "points", ".", "shape", "[", "0", "]", "-", "1", "lines", "=", "np", ".", "vstack", "(", "(", "2", "*", "np", ".", "ones", "("...
Generates line from points. Assumes points are ordered as line segments. Parameters ---------- points : np.ndarray Points representing line segments. For example, two line segments would be represented as: np.array([[0, 0, 0], [1, 0, 0], [1, 0, 0], [1, 1, 0]]) Returns --...
[ "Generates", "line", "from", "points", ".", "Assumes", "points", "are", "ordered", "as", "line", "segments", "." ]
5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1
https://github.com/vtkiorg/vtki/blob/5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1/vtki/utilities.py#L118-L152
222,638
vtkiorg/vtki
vtki/utilities.py
vector_poly_data
def vector_poly_data(orig, vec): """ Creates a vtkPolyData object composed of vectors """ # shape, dimention checking if not isinstance(orig, np.ndarray): orig = np.asarray(orig) if not isinstance(vec, np.ndarray): vec = np.asarray(vec) if orig.ndim != 2: orig = orig.resha...
python
def vector_poly_data(orig, vec): """ Creates a vtkPolyData object composed of vectors """ # shape, dimention checking if not isinstance(orig, np.ndarray): orig = np.asarray(orig) if not isinstance(vec, np.ndarray): vec = np.asarray(vec) if orig.ndim != 2: orig = orig.resha...
[ "def", "vector_poly_data", "(", "orig", ",", "vec", ")", ":", "# shape, dimention checking", "if", "not", "isinstance", "(", "orig", ",", "np", ".", "ndarray", ")", ":", "orig", "=", "np", ".", "asarray", "(", "orig", ")", "if", "not", "isinstance", "(",...
Creates a vtkPolyData object composed of vectors
[ "Creates", "a", "vtkPolyData", "object", "composed", "of", "vectors" ]
5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1
https://github.com/vtkiorg/vtki/blob/5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1/vtki/utilities.py#L155-L209
222,639
vtkiorg/vtki
vtki/utilities.py
trans_from_matrix
def trans_from_matrix(matrix): """ Convert a vtk matrix to a numpy.ndarray """ t = np.zeros((4, 4)) for i in range(4): for j in range(4): t[i, j] = matrix.GetElement(i, j) return t
python
def trans_from_matrix(matrix): """ Convert a vtk matrix to a numpy.ndarray """ t = np.zeros((4, 4)) for i in range(4): for j in range(4): t[i, j] = matrix.GetElement(i, j) return t
[ "def", "trans_from_matrix", "(", "matrix", ")", ":", "t", "=", "np", ".", "zeros", "(", "(", "4", ",", "4", ")", ")", "for", "i", "in", "range", "(", "4", ")", ":", "for", "j", "in", "range", "(", "4", ")", ":", "t", "[", "i", ",", "j", "...
Convert a vtk matrix to a numpy.ndarray
[ "Convert", "a", "vtk", "matrix", "to", "a", "numpy", ".", "ndarray" ]
5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1
https://github.com/vtkiorg/vtki/blob/5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1/vtki/utilities.py#L212-L218
222,640
vtkiorg/vtki
vtki/utilities.py
wrap
def wrap(vtkdataset): """This is a convenience method to safely wrap any given VTK data object to its appropriate ``vtki`` data object. """ wrappers = { 'vtkUnstructuredGrid' : vtki.UnstructuredGrid, 'vtkRectilinearGrid' : vtki.RectilinearGrid, 'vtkStructuredGrid' : vtki.Structur...
python
def wrap(vtkdataset): """This is a convenience method to safely wrap any given VTK data object to its appropriate ``vtki`` data object. """ wrappers = { 'vtkUnstructuredGrid' : vtki.UnstructuredGrid, 'vtkRectilinearGrid' : vtki.RectilinearGrid, 'vtkStructuredGrid' : vtki.Structur...
[ "def", "wrap", "(", "vtkdataset", ")", ":", "wrappers", "=", "{", "'vtkUnstructuredGrid'", ":", "vtki", ".", "UnstructuredGrid", ",", "'vtkRectilinearGrid'", ":", "vtki", ".", "RectilinearGrid", ",", "'vtkStructuredGrid'", ":", "vtki", ".", "StructuredGrid", ",", ...
This is a convenience method to safely wrap any given VTK data object to its appropriate ``vtki`` data object.
[ "This", "is", "a", "convenience", "method", "to", "safely", "wrap", "any", "given", "VTK", "data", "object", "to", "its", "appropriate", "vtki", "data", "object", "." ]
5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1
https://github.com/vtkiorg/vtki/blob/5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1/vtki/utilities.py#L221-L240
222,641
vtkiorg/vtki
vtki/utilities.py
image_to_texture
def image_to_texture(image): """Converts ``vtkImageData`` to a ``vtkTexture``""" vtex = vtk.vtkTexture() vtex.SetInputDataObject(image) vtex.Update() return vtex
python
def image_to_texture(image): """Converts ``vtkImageData`` to a ``vtkTexture``""" vtex = vtk.vtkTexture() vtex.SetInputDataObject(image) vtex.Update() return vtex
[ "def", "image_to_texture", "(", "image", ")", ":", "vtex", "=", "vtk", ".", "vtkTexture", "(", ")", "vtex", ".", "SetInputDataObject", "(", "image", ")", "vtex", ".", "Update", "(", ")", "return", "vtex" ]
Converts ``vtkImageData`` to a ``vtkTexture``
[ "Converts", "vtkImageData", "to", "a", "vtkTexture" ]
5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1
https://github.com/vtkiorg/vtki/blob/5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1/vtki/utilities.py#L243-L248
222,642
vtkiorg/vtki
vtki/utilities.py
numpy_to_texture
def numpy_to_texture(image): """Convert a NumPy image array to a vtk.vtkTexture""" if not isinstance(image, np.ndarray): raise TypeError('Unknown input type ({})'.format(type(image))) if image.ndim != 3 or image.shape[2] != 3: raise AssertionError('Input image must be nn by nm by RGB') g...
python
def numpy_to_texture(image): """Convert a NumPy image array to a vtk.vtkTexture""" if not isinstance(image, np.ndarray): raise TypeError('Unknown input type ({})'.format(type(image))) if image.ndim != 3 or image.shape[2] != 3: raise AssertionError('Input image must be nn by nm by RGB') g...
[ "def", "numpy_to_texture", "(", "image", ")", ":", "if", "not", "isinstance", "(", "image", ",", "np", ".", "ndarray", ")", ":", "raise", "TypeError", "(", "'Unknown input type ({})'", ".", "format", "(", "type", "(", "image", ")", ")", ")", "if", "image...
Convert a NumPy image array to a vtk.vtkTexture
[ "Convert", "a", "NumPy", "image", "array", "to", "a", "vtk", ".", "vtkTexture" ]
5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1
https://github.com/vtkiorg/vtki/blob/5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1/vtki/utilities.py#L251-L260
222,643
vtkiorg/vtki
vtki/utilities.py
is_inside_bounds
def is_inside_bounds(point, bounds): """ Checks if a point is inside a set of bounds. This is implemented through recursion so that this is N-dimensional. """ if isinstance(point, (int, float)): point = [point] if isinstance(point, collections.Iterable) and not isinstance(point, collections....
python
def is_inside_bounds(point, bounds): """ Checks if a point is inside a set of bounds. This is implemented through recursion so that this is N-dimensional. """ if isinstance(point, (int, float)): point = [point] if isinstance(point, collections.Iterable) and not isinstance(point, collections....
[ "def", "is_inside_bounds", "(", "point", ",", "bounds", ")", ":", "if", "isinstance", "(", "point", ",", "(", "int", ",", "float", ")", ")", ":", "point", "=", "[", "point", "]", "if", "isinstance", "(", "point", ",", "collections", ".", "Iterable", ...
Checks if a point is inside a set of bounds. This is implemented through recursion so that this is N-dimensional.
[ "Checks", "if", "a", "point", "is", "inside", "a", "set", "of", "bounds", ".", "This", "is", "implemented", "through", "recursion", "so", "that", "this", "is", "N", "-", "dimensional", "." ]
5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1
https://github.com/vtkiorg/vtki/blob/5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1/vtki/utilities.py#L263-L283
222,644
vtkiorg/vtki
vtki/utilities.py
fit_plane_to_points
def fit_plane_to_points(points, return_meta=False): """ Fits a plane to a set of points Parameters ---------- points : np.ndarray Size n by 3 array of points to fit a plane through return_meta : bool If true, also returns the center and normal used to generate the plane """...
python
def fit_plane_to_points(points, return_meta=False): """ Fits a plane to a set of points Parameters ---------- points : np.ndarray Size n by 3 array of points to fit a plane through return_meta : bool If true, also returns the center and normal used to generate the plane """...
[ "def", "fit_plane_to_points", "(", "points", ",", "return_meta", "=", "False", ")", ":", "data", "=", "np", ".", "array", "(", "points", ")", "center", "=", "data", ".", "mean", "(", "axis", "=", "0", ")", "result", "=", "np", ".", "linalg", ".", "...
Fits a plane to a set of points Parameters ---------- points : np.ndarray Size n by 3 array of points to fit a plane through return_meta : bool If true, also returns the center and normal used to generate the plane
[ "Fits", "a", "plane", "to", "a", "set", "of", "points" ]
5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1
https://github.com/vtkiorg/vtki/blob/5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1/vtki/utilities.py#L286-L305
222,645
vtkiorg/vtki
vtki/plotting.py
set_plot_theme
def set_plot_theme(theme): """Set the plotting parameters to a predefined theme""" if theme.lower() in ['paraview', 'pv']: rcParams['background'] = PV_BACKGROUND rcParams['cmap'] = 'coolwarm' rcParams['font']['family'] = 'arial' rcParams['font']['label_size'] = 16 rcParam...
python
def set_plot_theme(theme): """Set the plotting parameters to a predefined theme""" if theme.lower() in ['paraview', 'pv']: rcParams['background'] = PV_BACKGROUND rcParams['cmap'] = 'coolwarm' rcParams['font']['family'] = 'arial' rcParams['font']['label_size'] = 16 rcParam...
[ "def", "set_plot_theme", "(", "theme", ")", ":", "if", "theme", ".", "lower", "(", ")", "in", "[", "'paraview'", ",", "'pv'", "]", ":", "rcParams", "[", "'background'", "]", "=", "PV_BACKGROUND", "rcParams", "[", "'cmap'", "]", "=", "'coolwarm'", "rcPara...
Set the plotting parameters to a predefined theme
[ "Set", "the", "plotting", "parameters", "to", "a", "predefined", "theme" ]
5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1
https://github.com/vtkiorg/vtki/blob/5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1/vtki/plotting.py#L85-L112
222,646
vtkiorg/vtki
vtki/plotting.py
plot
def plot(var_item, off_screen=None, full_screen=False, screenshot=None, interactive=True, cpos=None, window_size=None, show_bounds=False, show_axes=True, notebook=None, background=None, text='', return_img=False, eye_dome_lighting=False, use_panel=None, **kwargs): """ Conveni...
python
def plot(var_item, off_screen=None, full_screen=False, screenshot=None, interactive=True, cpos=None, window_size=None, show_bounds=False, show_axes=True, notebook=None, background=None, text='', return_img=False, eye_dome_lighting=False, use_panel=None, **kwargs): """ Conveni...
[ "def", "plot", "(", "var_item", ",", "off_screen", "=", "None", ",", "full_screen", "=", "False", ",", "screenshot", "=", "None", ",", "interactive", "=", "True", ",", "cpos", "=", "None", ",", "window_size", "=", "None", ",", "show_bounds", "=", "False"...
Convenience plotting function for a vtk or numpy object. Parameters ---------- item : vtk or numpy object VTK object or numpy array to be plotted. off_screen : bool Plots off screen when True. Helpful for saving screenshots without a window popping up. full_screen : bool,...
[ "Convenience", "plotting", "function", "for", "a", "vtk", "or", "numpy", "object", "." ]
5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1
https://github.com/vtkiorg/vtki/blob/5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1/vtki/plotting.py#L140-L260
222,647
vtkiorg/vtki
vtki/plotting.py
system_supports_plotting
def system_supports_plotting(): """ Check if x server is running Returns ------- system_supports_plotting : bool True when on Linux and running an xserver. Returns None when on a non-linux platform. """ try: if os.environ['ALLOW_PLOTTING'].lower() == 'true': ...
python
def system_supports_plotting(): """ Check if x server is running Returns ------- system_supports_plotting : bool True when on Linux and running an xserver. Returns None when on a non-linux platform. """ try: if os.environ['ALLOW_PLOTTING'].lower() == 'true': ...
[ "def", "system_supports_plotting", "(", ")", ":", "try", ":", "if", "os", ".", "environ", "[", "'ALLOW_PLOTTING'", "]", ".", "lower", "(", ")", "==", "'true'", ":", "return", "True", "except", "KeyError", ":", "pass", "try", ":", "p", "=", "Popen", "("...
Check if x server is running Returns ------- system_supports_plotting : bool True when on Linux and running an xserver. Returns None when on a non-linux platform.
[ "Check", "if", "x", "server", "is", "running" ]
5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1
https://github.com/vtkiorg/vtki/blob/5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1/vtki/plotting.py#L287-L308
222,648
vtkiorg/vtki
vtki/plotting.py
single_triangle
def single_triangle(): """ A single PolyData triangle """ points = np.zeros((3, 3)) points[1] = [1, 0, 0] points[2] = [0.5, 0.707, 0] cells = np.array([[3, 0, 1, 2]], ctypes.c_long) return vtki.PolyData(points, cells)
python
def single_triangle(): """ A single PolyData triangle """ points = np.zeros((3, 3)) points[1] = [1, 0, 0] points[2] = [0.5, 0.707, 0] cells = np.array([[3, 0, 1, 2]], ctypes.c_long) return vtki.PolyData(points, cells)
[ "def", "single_triangle", "(", ")", ":", "points", "=", "np", ".", "zeros", "(", "(", "3", ",", "3", ")", ")", "points", "[", "1", "]", "=", "[", "1", ",", "0", ",", "0", "]", "points", "[", "2", "]", "=", "[", "0.5", ",", "0.707", ",", "...
A single PolyData triangle
[ "A", "single", "PolyData", "triangle" ]
5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1
https://github.com/vtkiorg/vtki/blob/5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1/vtki/plotting.py#L2970-L2976
222,649
vtkiorg/vtki
vtki/plotting.py
parse_color
def parse_color(color): """ Parses color into a vtk friendly rgb list """ if color is None: color = rcParams['color'] if isinstance(color, str): return vtki.string_to_rgb(color) elif len(color) == 3: return color else: raise Exception(""" Invalid color input M...
python
def parse_color(color): """ Parses color into a vtk friendly rgb list """ if color is None: color = rcParams['color'] if isinstance(color, str): return vtki.string_to_rgb(color) elif len(color) == 3: return color else: raise Exception(""" Invalid color input M...
[ "def", "parse_color", "(", "color", ")", ":", "if", "color", "is", "None", ":", "color", "=", "rcParams", "[", "'color'", "]", "if", "isinstance", "(", "color", ",", "str", ")", ":", "return", "vtki", ".", "string_to_rgb", "(", "color", ")", "elif", ...
Parses color into a vtk friendly rgb list
[ "Parses", "color", "into", "a", "vtk", "friendly", "rgb", "list" ]
5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1
https://github.com/vtkiorg/vtki/blob/5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1/vtki/plotting.py#L2979-L2994
222,650
vtkiorg/vtki
vtki/plotting.py
plot_compare_four
def plot_compare_four(data_a, data_b, data_c, data_d, disply_kwargs=None, plotter_kwargs=None, show_kwargs=None, screenshot=None, camera_position=None, outline=None, outline_color='k', labels=('A', 'B', 'C', 'D')): """Plot a 2 by 2 comparison of data...
python
def plot_compare_four(data_a, data_b, data_c, data_d, disply_kwargs=None, plotter_kwargs=None, show_kwargs=None, screenshot=None, camera_position=None, outline=None, outline_color='k', labels=('A', 'B', 'C', 'D')): """Plot a 2 by 2 comparison of data...
[ "def", "plot_compare_four", "(", "data_a", ",", "data_b", ",", "data_c", ",", "data_d", ",", "disply_kwargs", "=", "None", ",", "plotter_kwargs", "=", "None", ",", "show_kwargs", "=", "None", ",", "screenshot", "=", "None", ",", "camera_position", "=", "None...
Plot a 2 by 2 comparison of data objects. Plotting parameters and camera positions will all be the same.
[ "Plot", "a", "2", "by", "2", "comparison", "of", "data", "objects", ".", "Plotting", "parameters", "and", "camera", "positions", "will", "all", "be", "the", "same", "." ]
5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1
https://github.com/vtkiorg/vtki/blob/5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1/vtki/plotting.py#L3008-L3037
222,651
vtkiorg/vtki
vtki/plotting.py
BasePlotter.set_focus
def set_focus(self, point): """ sets focus to a point """ if isinstance(point, np.ndarray): if point.ndim != 1: point = point.ravel() self.camera.SetFocalPoint(point) self._render()
python
def set_focus(self, point): """ sets focus to a point """ if isinstance(point, np.ndarray): if point.ndim != 1: point = point.ravel() self.camera.SetFocalPoint(point) self._render()
[ "def", "set_focus", "(", "self", ",", "point", ")", ":", "if", "isinstance", "(", "point", ",", "np", ".", "ndarray", ")", ":", "if", "point", ".", "ndim", "!=", "1", ":", "point", "=", "point", ".", "ravel", "(", ")", "self", ".", "camera", ".",...
sets focus to a point
[ "sets", "focus", "to", "a", "point" ]
5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1
https://github.com/vtkiorg/vtki/blob/5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1/vtki/plotting.py#L480-L486
222,652
vtkiorg/vtki
vtki/plotting.py
BasePlotter.set_position
def set_position(self, point, reset=False): """ sets camera position to a point """ if isinstance(point, np.ndarray): if point.ndim != 1: point = point.ravel() self.camera.SetPosition(point) if reset: self.reset_camera() self.camera_set = T...
python
def set_position(self, point, reset=False): """ sets camera position to a point """ if isinstance(point, np.ndarray): if point.ndim != 1: point = point.ravel() self.camera.SetPosition(point) if reset: self.reset_camera() self.camera_set = T...
[ "def", "set_position", "(", "self", ",", "point", ",", "reset", "=", "False", ")", ":", "if", "isinstance", "(", "point", ",", "np", ".", "ndarray", ")", ":", "if", "point", ".", "ndim", "!=", "1", ":", "point", "=", "point", ".", "ravel", "(", "...
sets camera position to a point
[ "sets", "camera", "position", "to", "a", "point" ]
5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1
https://github.com/vtkiorg/vtki/blob/5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1/vtki/plotting.py#L488-L497
222,653
vtkiorg/vtki
vtki/plotting.py
BasePlotter.set_viewup
def set_viewup(self, vector): """ sets camera viewup vector """ if isinstance(vector, np.ndarray): if vector.ndim != 1: vector = vector.ravel() self.camera.SetViewUp(vector) self._render()
python
def set_viewup(self, vector): """ sets camera viewup vector """ if isinstance(vector, np.ndarray): if vector.ndim != 1: vector = vector.ravel() self.camera.SetViewUp(vector) self._render()
[ "def", "set_viewup", "(", "self", ",", "vector", ")", ":", "if", "isinstance", "(", "vector", ",", "np", ".", "ndarray", ")", ":", "if", "vector", ".", "ndim", "!=", "1", ":", "vector", "=", "vector", ".", "ravel", "(", ")", "self", ".", "camera", ...
sets camera viewup vector
[ "sets", "camera", "viewup", "vector" ]
5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1
https://github.com/vtkiorg/vtki/blob/5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1/vtki/plotting.py#L499-L505
222,654
vtkiorg/vtki
vtki/plotting.py
BasePlotter._render
def _render(self): """ redraws render window if the render window exists """ if hasattr(self, 'ren_win'): if hasattr(self, 'render_trigger'): self.render_trigger.emit() elif not self._first_time: self.render()
python
def _render(self): """ redraws render window if the render window exists """ if hasattr(self, 'ren_win'): if hasattr(self, 'render_trigger'): self.render_trigger.emit() elif not self._first_time: self.render()
[ "def", "_render", "(", "self", ")", ":", "if", "hasattr", "(", "self", ",", "'ren_win'", ")", ":", "if", "hasattr", "(", "self", ",", "'render_trigger'", ")", ":", "self", ".", "render_trigger", ".", "emit", "(", ")", "elif", "not", "self", ".", "_fi...
redraws render window if the render window exists
[ "redraws", "render", "window", "if", "the", "render", "window", "exists" ]
5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1
https://github.com/vtkiorg/vtki/blob/5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1/vtki/plotting.py#L507-L513
222,655
vtkiorg/vtki
vtki/plotting.py
BasePlotter.add_axes
def add_axes(self, interactive=None, color=None): """ Add an interactive axes widget """ if interactive is None: interactive = rcParams['interactive'] if hasattr(self, 'axes_widget'): self.axes_widget.SetInteractive(interactive) self._update_axes_color(color) ...
python
def add_axes(self, interactive=None, color=None): """ Add an interactive axes widget """ if interactive is None: interactive = rcParams['interactive'] if hasattr(self, 'axes_widget'): self.axes_widget.SetInteractive(interactive) self._update_axes_color(color) ...
[ "def", "add_axes", "(", "self", ",", "interactive", "=", "None", ",", "color", "=", "None", ")", ":", "if", "interactive", "is", "None", ":", "interactive", "=", "rcParams", "[", "'interactive'", "]", "if", "hasattr", "(", "self", ",", "'axes_widget'", "...
Add an interactive axes widget
[ "Add", "an", "interactive", "axes", "widget" ]
5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1
https://github.com/vtkiorg/vtki/blob/5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1/vtki/plotting.py#L515-L531
222,656
vtkiorg/vtki
vtki/plotting.py
BasePlotter.key_press_event
def key_press_event(self, obj, event): """ Listens for key press event """ key = self.iren.GetKeySym() log.debug('Key %s pressed' % key) if key == 'q': self.q_pressed = True # Grab screenshot right before renderer closes self.last_image = self.screensh...
python
def key_press_event(self, obj, event): """ Listens for key press event """ key = self.iren.GetKeySym() log.debug('Key %s pressed' % key) if key == 'q': self.q_pressed = True # Grab screenshot right before renderer closes self.last_image = self.screensh...
[ "def", "key_press_event", "(", "self", ",", "obj", ",", "event", ")", ":", "key", "=", "self", ".", "iren", ".", "GetKeySym", "(", ")", "log", ".", "debug", "(", "'Key %s pressed'", "%", "key", ")", "if", "key", "==", "'q'", ":", "self", ".", "q_pr...
Listens for key press event
[ "Listens", "for", "key", "press", "event" ]
5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1
https://github.com/vtkiorg/vtki/blob/5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1/vtki/plotting.py#L545-L557
222,657
vtkiorg/vtki
vtki/plotting.py
BasePlotter.left_button_down
def left_button_down(self, obj, event_type): """Register the event for a left button down click""" # Get 2D click location on window click_pos = self.iren.GetEventPosition() # Get corresponding click location in the 3D plot picker = vtk.vtkWorldPointPicker() picker.Pick(...
python
def left_button_down(self, obj, event_type): """Register the event for a left button down click""" # Get 2D click location on window click_pos = self.iren.GetEventPosition() # Get corresponding click location in the 3D plot picker = vtk.vtkWorldPointPicker() picker.Pick(...
[ "def", "left_button_down", "(", "self", ",", "obj", ",", "event_type", ")", ":", "# Get 2D click location on window", "click_pos", "=", "self", ".", "iren", ".", "GetEventPosition", "(", ")", "# Get corresponding click location in the 3D plot", "picker", "=", "vtk", "...
Register the event for a left button down click
[ "Register", "the", "event", "for", "a", "left", "button", "down", "click" ]
5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1
https://github.com/vtkiorg/vtki/blob/5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1/vtki/plotting.py#L559-L569
222,658
vtkiorg/vtki
vtki/plotting.py
BasePlotter.isometric_view_interactive
def isometric_view_interactive(self): """ sets the current interactive render window to isometric view """ interactor = self.iren.GetInteractorStyle() renderer = interactor.GetCurrentRenderer() renderer.view_isometric()
python
def isometric_view_interactive(self): """ sets the current interactive render window to isometric view """ interactor = self.iren.GetInteractorStyle() renderer = interactor.GetCurrentRenderer() renderer.view_isometric()
[ "def", "isometric_view_interactive", "(", "self", ")", ":", "interactor", "=", "self", ".", "iren", ".", "GetInteractorStyle", "(", ")", "renderer", "=", "interactor", ".", "GetCurrentRenderer", "(", ")", "renderer", ".", "view_isometric", "(", ")" ]
sets the current interactive render window to isometric view
[ "sets", "the", "current", "interactive", "render", "window", "to", "isometric", "view" ]
5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1
https://github.com/vtkiorg/vtki/blob/5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1/vtki/plotting.py#L571-L575
222,659
vtkiorg/vtki
vtki/plotting.py
BasePlotter.update
def update(self, stime=1, force_redraw=True): """ Update window, redraw, process messages query Parameters ---------- stime : int, optional Duration of timer that interrupt vtkRenderWindowInteractor in milliseconds. force_redraw : bool, optional ...
python
def update(self, stime=1, force_redraw=True): """ Update window, redraw, process messages query Parameters ---------- stime : int, optional Duration of timer that interrupt vtkRenderWindowInteractor in milliseconds. force_redraw : bool, optional ...
[ "def", "update", "(", "self", ",", "stime", "=", "1", ",", "force_redraw", "=", "True", ")", ":", "if", "stime", "<=", "0", ":", "stime", "=", "1", "curr_time", "=", "time", ".", "time", "(", ")", "if", "Plotter", ".", "last_update_time", ">", "cur...
Update window, redraw, process messages query Parameters ---------- stime : int, optional Duration of timer that interrupt vtkRenderWindowInteractor in milliseconds. force_redraw : bool, optional Call vtkRenderWindowInteractor.Render() immediately.
[ "Update", "window", "redraw", "process", "messages", "query" ]
5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1
https://github.com/vtkiorg/vtki/blob/5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1/vtki/plotting.py#L577-L612
222,660
vtkiorg/vtki
vtki/plotting.py
BasePlotter.update_scalar_bar_range
def update_scalar_bar_range(self, clim, name=None): """Update the value range of the active or named scalar bar. Parameters ---------- 2 item list The new range of scalar bar. Example: ``[-1, 2]``. name : str, optional The title of the scalar bar to upda...
python
def update_scalar_bar_range(self, clim, name=None): """Update the value range of the active or named scalar bar. Parameters ---------- 2 item list The new range of scalar bar. Example: ``[-1, 2]``. name : str, optional The title of the scalar bar to upda...
[ "def", "update_scalar_bar_range", "(", "self", ",", "clim", ",", "name", "=", "None", ")", ":", "if", "isinstance", "(", "clim", ",", "float", ")", "or", "isinstance", "(", "clim", ",", "int", ")", ":", "clim", "=", "[", "-", "clim", ",", "clim", "...
Update the value range of the active or named scalar bar. Parameters ---------- 2 item list The new range of scalar bar. Example: ``[-1, 2]``. name : str, optional The title of the scalar bar to update
[ "Update", "the", "value", "range", "of", "the", "active", "or", "named", "scalar", "bar", "." ]
5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1
https://github.com/vtkiorg/vtki/blob/5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1/vtki/plotting.py#L1087-L1114
222,661
vtkiorg/vtki
vtki/plotting.py
BasePlotter.clear
def clear(self): """ Clears plot by removing all actors and properties """ for renderer in self.renderers: renderer.RemoveAllViewProps() self._scalar_bar_slots = set(range(MAX_N_COLOR_BARS)) self._scalar_bar_slot_lookup = {} self._scalar_bar_ranges = {} self._...
python
def clear(self): """ Clears plot by removing all actors and properties """ for renderer in self.renderers: renderer.RemoveAllViewProps() self._scalar_bar_slots = set(range(MAX_N_COLOR_BARS)) self._scalar_bar_slot_lookup = {} self._scalar_bar_ranges = {} self._...
[ "def", "clear", "(", "self", ")", ":", "for", "renderer", "in", "self", ".", "renderers", ":", "renderer", ".", "RemoveAllViewProps", "(", ")", "self", ".", "_scalar_bar_slots", "=", "set", "(", "range", "(", "MAX_N_COLOR_BARS", ")", ")", "self", ".", "_...
Clears plot by removing all actors and properties
[ "Clears", "plot", "by", "removing", "all", "actors", "and", "properties" ]
5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1
https://github.com/vtkiorg/vtki/blob/5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1/vtki/plotting.py#L1150-L1159
222,662
vtkiorg/vtki
vtki/plotting.py
BasePlotter.remove_actor
def remove_actor(self, actor, reset_camera=False): """ Removes an actor from the Plotter. Parameters ---------- actor : vtk.vtkActor Actor that has previously added to the Renderer. reset_camera : bool, optional Resets camera so all actors can be...
python
def remove_actor(self, actor, reset_camera=False): """ Removes an actor from the Plotter. Parameters ---------- actor : vtk.vtkActor Actor that has previously added to the Renderer. reset_camera : bool, optional Resets camera so all actors can be...
[ "def", "remove_actor", "(", "self", ",", "actor", ",", "reset_camera", "=", "False", ")", ":", "for", "renderer", "in", "self", ".", "renderers", ":", "renderer", ".", "remove_actor", "(", "actor", ",", "reset_camera", ")", "return", "True" ]
Removes an actor from the Plotter. Parameters ---------- actor : vtk.vtkActor Actor that has previously added to the Renderer. reset_camera : bool, optional Resets camera so all actors can be seen. Returns ------- success : bool ...
[ "Removes", "an", "actor", "from", "the", "Plotter", "." ]
5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1
https://github.com/vtkiorg/vtki/blob/5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1/vtki/plotting.py#L1161-L1181
222,663
vtkiorg/vtki
vtki/plotting.py
BasePlotter.loc_to_index
def loc_to_index(self, loc): """ Return index of the render window given a location index. Parameters ---------- loc : int, tuple, or list Index of the renderer to add the actor to. For example, ``loc=2`` or ``loc=(1, 1)``. Returns -----...
python
def loc_to_index(self, loc): """ Return index of the render window given a location index. Parameters ---------- loc : int, tuple, or list Index of the renderer to add the actor to. For example, ``loc=2`` or ``loc=(1, 1)``. Returns -----...
[ "def", "loc_to_index", "(", "self", ",", "loc", ")", ":", "if", "loc", "is", "None", ":", "return", "self", ".", "_active_renderer_index", "elif", "isinstance", "(", "loc", ",", "int", ")", ":", "return", "loc", "elif", "isinstance", "(", "loc", ",", "...
Return index of the render window given a location index. Parameters ---------- loc : int, tuple, or list Index of the renderer to add the actor to. For example, ``loc=2`` or ``loc=(1, 1)``. Returns ------- idx : int Index of the ren...
[ "Return", "index", "of", "the", "render", "window", "given", "a", "location", "index", "." ]
5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1
https://github.com/vtkiorg/vtki/blob/5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1/vtki/plotting.py#L1222-L1244
222,664
vtkiorg/vtki
vtki/plotting.py
BasePlotter.index_to_loc
def index_to_loc(self, index): """Convert a 1D index location to the 2D location on the plotting grid """ sz = int(self.shape[0] * self.shape[1]) idxs = np.array([i for i in range(sz)], dtype=int).reshape(self.shape) args = np.argwhere(idxs == index) if len(args) < 1: ...
python
def index_to_loc(self, index): """Convert a 1D index location to the 2D location on the plotting grid """ sz = int(self.shape[0] * self.shape[1]) idxs = np.array([i for i in range(sz)], dtype=int).reshape(self.shape) args = np.argwhere(idxs == index) if len(args) < 1: ...
[ "def", "index_to_loc", "(", "self", ",", "index", ")", ":", "sz", "=", "int", "(", "self", ".", "shape", "[", "0", "]", "*", "self", ".", "shape", "[", "1", "]", ")", "idxs", "=", "np", ".", "array", "(", "[", "i", "for", "i", "in", "range", ...
Convert a 1D index location to the 2D location on the plotting grid
[ "Convert", "a", "1D", "index", "location", "to", "the", "2D", "location", "on", "the", "plotting", "grid" ]
5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1
https://github.com/vtkiorg/vtki/blob/5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1/vtki/plotting.py#L1246-L1254
222,665
vtkiorg/vtki
vtki/plotting.py
BasePlotter.add_axes_at_origin
def add_axes_at_origin(self, loc=None): """ Add axes actor at the origin of a render window. Parameters ---------- loc : int, tuple, or list Index of the renderer to add the actor to. For example, ``loc=2`` or ``loc=(1, 1)``. When None, defaults to the ...
python
def add_axes_at_origin(self, loc=None): """ Add axes actor at the origin of a render window. Parameters ---------- loc : int, tuple, or list Index of the renderer to add the actor to. For example, ``loc=2`` or ``loc=(1, 1)``. When None, defaults to the ...
[ "def", "add_axes_at_origin", "(", "self", ",", "loc", "=", "None", ")", ":", "self", ".", "_active_renderer_index", "=", "self", ".", "loc_to_index", "(", "loc", ")", "return", "self", ".", "renderers", "[", "self", ".", "_active_renderer_index", "]", ".", ...
Add axes actor at the origin of a render window. Parameters ---------- loc : int, tuple, or list Index of the renderer to add the actor to. For example, ``loc=2`` or ``loc=(1, 1)``. When None, defaults to the active render window. Returns -...
[ "Add", "axes", "actor", "at", "the", "origin", "of", "a", "render", "window", "." ]
5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1
https://github.com/vtkiorg/vtki/blob/5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1/vtki/plotting.py#L1262-L1279
222,666
vtkiorg/vtki
vtki/plotting.py
BasePlotter.remove_bounding_box
def remove_bounding_box(self, loc=None): """ Removes bounding box from the active renderer. Parameters ---------- loc : int, tuple, or list Index of the renderer to add the actor to. For example, ``loc=2`` or ``loc=(1, 1)``. If None, selects the last ...
python
def remove_bounding_box(self, loc=None): """ Removes bounding box from the active renderer. Parameters ---------- loc : int, tuple, or list Index of the renderer to add the actor to. For example, ``loc=2`` or ``loc=(1, 1)``. If None, selects the last ...
[ "def", "remove_bounding_box", "(", "self", ",", "loc", "=", "None", ")", ":", "self", ".", "_active_renderer_index", "=", "self", ".", "loc_to_index", "(", "loc", ")", "renderer", "=", "self", ".", "renderers", "[", "self", ".", "_active_renderer_index", "]"...
Removes bounding box from the active renderer. Parameters ---------- loc : int, tuple, or list Index of the renderer to add the actor to. For example, ``loc=2`` or ``loc=(1, 1)``. If None, selects the last active Renderer.
[ "Removes", "bounding", "box", "from", "the", "active", "renderer", "." ]
5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1
https://github.com/vtkiorg/vtki/blob/5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1/vtki/plotting.py#L1460-L1473
222,667
vtkiorg/vtki
vtki/plotting.py
BasePlotter.remove_bounds_axes
def remove_bounds_axes(self, loc=None): """ Removes bounds axes from the active renderer. Parameters ---------- loc : int, tuple, or list Index of the renderer to add the actor to. For example, ``loc=2`` or ``loc=(1, 1)``. If None, selects the last ...
python
def remove_bounds_axes(self, loc=None): """ Removes bounds axes from the active renderer. Parameters ---------- loc : int, tuple, or list Index of the renderer to add the actor to. For example, ``loc=2`` or ``loc=(1, 1)``. If None, selects the last ...
[ "def", "remove_bounds_axes", "(", "self", ",", "loc", "=", "None", ")", ":", "self", ".", "_active_renderer_index", "=", "self", ".", "loc_to_index", "(", "loc", ")", "renderer", "=", "self", ".", "renderers", "[", "self", ".", "_active_renderer_index", "]",...
Removes bounds axes from the active renderer. Parameters ---------- loc : int, tuple, or list Index of the renderer to add the actor to. For example, ``loc=2`` or ``loc=(1, 1)``. If None, selects the last active Renderer.
[ "Removes", "bounds", "axes", "from", "the", "active", "renderer", "." ]
5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1
https://github.com/vtkiorg/vtki/blob/5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1/vtki/plotting.py#L1475-L1488
222,668
vtkiorg/vtki
vtki/plotting.py
BasePlotter.subplot
def subplot(self, index_x, index_y): """ Sets the active subplot. Parameters ---------- index_x : int Index of the subplot to activate in the x direction. index_y : int Index of the subplot to activate in the y direction. """ sel...
python
def subplot(self, index_x, index_y): """ Sets the active subplot. Parameters ---------- index_x : int Index of the subplot to activate in the x direction. index_y : int Index of the subplot to activate in the y direction. """ sel...
[ "def", "subplot", "(", "self", ",", "index_x", ",", "index_y", ")", ":", "self", ".", "_active_renderer_index", "=", "self", ".", "loc_to_index", "(", "(", "index_x", ",", "index_y", ")", ")" ]
Sets the active subplot. Parameters ---------- index_x : int Index of the subplot to activate in the x direction. index_y : int Index of the subplot to activate in the y direction.
[ "Sets", "the", "active", "subplot", "." ]
5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1
https://github.com/vtkiorg/vtki/blob/5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1/vtki/plotting.py#L1490-L1503
222,669
vtkiorg/vtki
vtki/plotting.py
BasePlotter.show_grid
def show_grid(self, **kwargs): """ A wrapped implementation of ``show_bounds`` to change default behaviour to use gridlines and showing the axes labels on the outer edges. This is intended to be silimar to ``matplotlib``'s ``grid`` function. """ kwargs.setdefault(...
python
def show_grid(self, **kwargs): """ A wrapped implementation of ``show_bounds`` to change default behaviour to use gridlines and showing the axes labels on the outer edges. This is intended to be silimar to ``matplotlib``'s ``grid`` function. """ kwargs.setdefault(...
[ "def", "show_grid", "(", "self", ",", "*", "*", "kwargs", ")", ":", "kwargs", ".", "setdefault", "(", "'grid'", ",", "'back'", ")", "kwargs", ".", "setdefault", "(", "'location'", ",", "'outer'", ")", "kwargs", ".", "setdefault", "(", "'ticks'", ",", "...
A wrapped implementation of ``show_bounds`` to change default behaviour to use gridlines and showing the axes labels on the outer edges. This is intended to be silimar to ``matplotlib``'s ``grid`` function.
[ "A", "wrapped", "implementation", "of", "show_bounds", "to", "change", "default", "behaviour", "to", "use", "gridlines", "and", "showing", "the", "axes", "labels", "on", "the", "outer", "edges", ".", "This", "is", "intended", "to", "be", "silimar", "to", "ma...
5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1
https://github.com/vtkiorg/vtki/blob/5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1/vtki/plotting.py#L1505-L1515
222,670
vtkiorg/vtki
vtki/plotting.py
BasePlotter.set_scale
def set_scale(self, xscale=None, yscale=None, zscale=None, reset_camera=True): """ Scale all the datasets in the scene of the active renderer. Scaling in performed independently on the X, Y and Z axis. A scale of zero is illegal and will be replaced with one. Parameters ...
python
def set_scale(self, xscale=None, yscale=None, zscale=None, reset_camera=True): """ Scale all the datasets in the scene of the active renderer. Scaling in performed independently on the X, Y and Z axis. A scale of zero is illegal and will be replaced with one. Parameters ...
[ "def", "set_scale", "(", "self", ",", "xscale", "=", "None", ",", "yscale", "=", "None", ",", "zscale", "=", "None", ",", "reset_camera", "=", "True", ")", ":", "self", ".", "renderer", ".", "set_scale", "(", "xscale", ",", "yscale", ",", "zscale", "...
Scale all the datasets in the scene of the active renderer. Scaling in performed independently on the X, Y and Z axis. A scale of zero is illegal and will be replaced with one. Parameters ---------- xscale : float, optional Scaling of the x axis. Must be greater th...
[ "Scale", "all", "the", "datasets", "in", "the", "scene", "of", "the", "active", "renderer", "." ]
5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1
https://github.com/vtkiorg/vtki/blob/5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1/vtki/plotting.py#L1517-L1539
222,671
vtkiorg/vtki
vtki/plotting.py
BasePlotter._update_axes_color
def _update_axes_color(self, color): """Internal helper to set the axes label color""" prop_x = self.axes_actor.GetXAxisCaptionActor2D().GetCaptionTextProperty() prop_y = self.axes_actor.GetYAxisCaptionActor2D().GetCaptionTextProperty() prop_z = self.axes_actor.GetZAxisCaptionActor2D().G...
python
def _update_axes_color(self, color): """Internal helper to set the axes label color""" prop_x = self.axes_actor.GetXAxisCaptionActor2D().GetCaptionTextProperty() prop_y = self.axes_actor.GetYAxisCaptionActor2D().GetCaptionTextProperty() prop_z = self.axes_actor.GetZAxisCaptionActor2D().G...
[ "def", "_update_axes_color", "(", "self", ",", "color", ")", ":", "prop_x", "=", "self", ".", "axes_actor", ".", "GetXAxisCaptionActor2D", "(", ")", ".", "GetCaptionTextProperty", "(", ")", "prop_y", "=", "self", ".", "axes_actor", ".", "GetYAxisCaptionActor2D",...
Internal helper to set the axes label color
[ "Internal", "helper", "to", "set", "the", "axes", "label", "color" ]
5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1
https://github.com/vtkiorg/vtki/blob/5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1/vtki/plotting.py#L1546-L1557
222,672
vtkiorg/vtki
vtki/plotting.py
BasePlotter.update_scalars
def update_scalars(self, scalars, mesh=None, render=True): """ Updates scalars of the an object in the plotter. Parameters ---------- scalars : np.ndarray Scalars to replace existing scalars. mesh : vtk.PolyData or vtk.UnstructuredGrid, optional ...
python
def update_scalars(self, scalars, mesh=None, render=True): """ Updates scalars of the an object in the plotter. Parameters ---------- scalars : np.ndarray Scalars to replace existing scalars. mesh : vtk.PolyData or vtk.UnstructuredGrid, optional ...
[ "def", "update_scalars", "(", "self", ",", "scalars", ",", "mesh", "=", "None", ",", "render", "=", "True", ")", ":", "if", "mesh", "is", "None", ":", "mesh", "=", "self", ".", "mesh", "if", "isinstance", "(", "mesh", ",", "(", "collections", ".", ...
Updates scalars of the an object in the plotter. Parameters ---------- scalars : np.ndarray Scalars to replace existing scalars. mesh : vtk.PolyData or vtk.UnstructuredGrid, optional Object that has already been added to the Plotter. If None, uses l...
[ "Updates", "scalars", "of", "the", "an", "object", "in", "the", "plotter", "." ]
5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1
https://github.com/vtkiorg/vtki/blob/5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1/vtki/plotting.py#L1809-L1867
222,673
vtkiorg/vtki
vtki/plotting.py
BasePlotter.update_coordinates
def update_coordinates(self, points, mesh=None, render=True): """ Updates the points of the an object in the plotter. Parameters ---------- points : np.ndarray Points to replace existing points. mesh : vtk.PolyData or vtk.UnstructuredGrid, optional ...
python
def update_coordinates(self, points, mesh=None, render=True): """ Updates the points of the an object in the plotter. Parameters ---------- points : np.ndarray Points to replace existing points. mesh : vtk.PolyData or vtk.UnstructuredGrid, optional ...
[ "def", "update_coordinates", "(", "self", ",", "points", ",", "mesh", "=", "None", ",", "render", "=", "True", ")", ":", "if", "mesh", "is", "None", ":", "mesh", "=", "self", ".", "mesh", "mesh", ".", "points", "=", "points", "if", "render", ":", "...
Updates the points of the an object in the plotter. Parameters ---------- points : np.ndarray Points to replace existing points. mesh : vtk.PolyData or vtk.UnstructuredGrid, optional Object that has already been added to the Plotter. If None, uses l...
[ "Updates", "the", "points", "of", "the", "an", "object", "in", "the", "plotter", "." ]
5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1
https://github.com/vtkiorg/vtki/blob/5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1/vtki/plotting.py#L1869-L1892
222,674
vtkiorg/vtki
vtki/plotting.py
BasePlotter.close
def close(self): """ closes render window """ # must close out axes marker if hasattr(self, 'axes_widget'): del self.axes_widget # reset scalar bar stuff self._scalar_bar_slots = set(range(MAX_N_COLOR_BARS)) self._scalar_bar_slot_lookup = {} self._sca...
python
def close(self): """ closes render window """ # must close out axes marker if hasattr(self, 'axes_widget'): del self.axes_widget # reset scalar bar stuff self._scalar_bar_slots = set(range(MAX_N_COLOR_BARS)) self._scalar_bar_slot_lookup = {} self._sca...
[ "def", "close", "(", "self", ")", ":", "# must close out axes marker", "if", "hasattr", "(", "self", ",", "'axes_widget'", ")", ":", "del", "self", ".", "axes_widget", "# reset scalar bar stuff", "self", ".", "_scalar_bar_slots", "=", "set", "(", "range", "(", ...
closes render window
[ "closes", "render", "window" ]
5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1
https://github.com/vtkiorg/vtki/blob/5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1/vtki/plotting.py#L1894-L1925
222,675
vtkiorg/vtki
vtki/plotting.py
BasePlotter.add_text
def add_text(self, text, position=None, font_size=50, color=None, font=None, shadow=False, name=None, loc=None): """ Adds text to plot object in the top left corner by default Parameters ---------- text : str The text to add the the rendering ...
python
def add_text(self, text, position=None, font_size=50, color=None, font=None, shadow=False, name=None, loc=None): """ Adds text to plot object in the top left corner by default Parameters ---------- text : str The text to add the the rendering ...
[ "def", "add_text", "(", "self", ",", "text", ",", "position", "=", "None", ",", "font_size", "=", "50", ",", "color", "=", "None", ",", "font", "=", "None", ",", "shadow", "=", "False", ",", "name", "=", "None", ",", "loc", "=", "None", ")", ":",...
Adds text to plot object in the top left corner by default Parameters ---------- text : str The text to add the the rendering position : tuple(float) Length 2 tuple of the pixelwise position to place the bottom left corner of the text box. Default is...
[ "Adds", "text", "to", "plot", "object", "in", "the", "top", "left", "corner", "by", "default" ]
5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1
https://github.com/vtkiorg/vtki/blob/5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1/vtki/plotting.py#L1927-L1984
222,676
vtkiorg/vtki
vtki/plotting.py
BasePlotter.open_movie
def open_movie(self, filename, framerate=24): """ Establishes a connection to the ffmpeg writer Parameters ---------- filename : str Filename of the movie to open. Filename should end in mp4, but other filetypes may be supported. See "imagio.get_writer"...
python
def open_movie(self, filename, framerate=24): """ Establishes a connection to the ffmpeg writer Parameters ---------- filename : str Filename of the movie to open. Filename should end in mp4, but other filetypes may be supported. See "imagio.get_writer"...
[ "def", "open_movie", "(", "self", ",", "filename", ",", "framerate", "=", "24", ")", ":", "if", "isinstance", "(", "vtki", ".", "FIGURE_PATH", ",", "str", ")", "and", "not", "os", ".", "path", ".", "isabs", "(", "filename", ")", ":", "filename", "=",...
Establishes a connection to the ffmpeg writer Parameters ---------- filename : str Filename of the movie to open. Filename should end in mp4, but other filetypes may be supported. See "imagio.get_writer" framerate : int, optional Frames per second.
[ "Establishes", "a", "connection", "to", "the", "ffmpeg", "writer" ]
5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1
https://github.com/vtkiorg/vtki/blob/5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1/vtki/plotting.py#L1986-L2002
222,677
vtkiorg/vtki
vtki/plotting.py
BasePlotter.open_gif
def open_gif(self, filename): """ Open a gif file. Parameters ---------- filename : str Filename of the gif to open. Filename must end in gif. """ if filename[-3:] != 'gif': raise Exception('Unsupported filetype. Must end in .gif') ...
python
def open_gif(self, filename): """ Open a gif file. Parameters ---------- filename : str Filename of the gif to open. Filename must end in gif. """ if filename[-3:] != 'gif': raise Exception('Unsupported filetype. Must end in .gif') ...
[ "def", "open_gif", "(", "self", ",", "filename", ")", ":", "if", "filename", "[", "-", "3", ":", "]", "!=", "'gif'", ":", "raise", "Exception", "(", "'Unsupported filetype. Must end in .gif'", ")", "if", "isinstance", "(", "vtki", ".", "FIGURE_PATH", ",", ...
Open a gif file. Parameters ---------- filename : str Filename of the gif to open. Filename must end in gif.
[ "Open", "a", "gif", "file", "." ]
5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1
https://github.com/vtkiorg/vtki/blob/5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1/vtki/plotting.py#L2004-L2019
222,678
vtkiorg/vtki
vtki/plotting.py
BasePlotter.write_frame
def write_frame(self): """ Writes a single frame to the movie file """ if not hasattr(self, 'mwriter'): raise AssertionError('This plotter has not opened a movie or GIF file.') self.mwriter.append_data(self.image)
python
def write_frame(self): """ Writes a single frame to the movie file """ if not hasattr(self, 'mwriter'): raise AssertionError('This plotter has not opened a movie or GIF file.') self.mwriter.append_data(self.image)
[ "def", "write_frame", "(", "self", ")", ":", "if", "not", "hasattr", "(", "self", ",", "'mwriter'", ")", ":", "raise", "AssertionError", "(", "'This plotter has not opened a movie or GIF file.'", ")", "self", ".", "mwriter", ".", "append_data", "(", "self", ".",...
Writes a single frame to the movie file
[ "Writes", "a", "single", "frame", "to", "the", "movie", "file" ]
5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1
https://github.com/vtkiorg/vtki/blob/5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1/vtki/plotting.py#L2021-L2025
222,679
vtkiorg/vtki
vtki/plotting.py
BasePlotter.add_lines
def add_lines(self, lines, color=(1, 1, 1), width=5, label=None, name=None): """ Adds lines to the plotting object. Parameters ---------- lines : np.ndarray or vtki.PolyData Points representing line segments. For example, two line segments would be repre...
python
def add_lines(self, lines, color=(1, 1, 1), width=5, label=None, name=None): """ Adds lines to the plotting object. Parameters ---------- lines : np.ndarray or vtki.PolyData Points representing line segments. For example, two line segments would be repre...
[ "def", "add_lines", "(", "self", ",", "lines", ",", "color", "=", "(", "1", ",", "1", ",", "1", ")", ",", "width", "=", "5", ",", "label", "=", "None", ",", "name", "=", "None", ")", ":", "if", "not", "isinstance", "(", "lines", ",", "np", "....
Adds lines to the plotting object. Parameters ---------- lines : np.ndarray or vtki.PolyData Points representing line segments. For example, two line segments would be represented as: np.array([[0, 0, 0], [1, 0, 0], [1, 0, 0], [1, 1, 0]]) color : s...
[ "Adds", "lines", "to", "the", "plotting", "object", "." ]
5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1
https://github.com/vtkiorg/vtki/blob/5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1/vtki/plotting.py#L2081-L2142
222,680
vtkiorg/vtki
vtki/plotting.py
BasePlotter.remove_scalar_bar
def remove_scalar_bar(self): """ Removes scalar bar """ if hasattr(self, 'scalar_bar'): self.remove_actor(self.scalar_bar, reset_camera=False)
python
def remove_scalar_bar(self): """ Removes scalar bar """ if hasattr(self, 'scalar_bar'): self.remove_actor(self.scalar_bar, reset_camera=False)
[ "def", "remove_scalar_bar", "(", "self", ")", ":", "if", "hasattr", "(", "self", ",", "'scalar_bar'", ")", ":", "self", ".", "remove_actor", "(", "self", ".", "scalar_bar", ",", "reset_camera", "=", "False", ")" ]
Removes scalar bar
[ "Removes", "scalar", "bar" ]
5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1
https://github.com/vtkiorg/vtki/blob/5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1/vtki/plotting.py#L2144-L2147
222,681
vtkiorg/vtki
vtki/plotting.py
BasePlotter.add_point_labels
def add_point_labels(self, points, labels, italic=False, bold=True, font_size=None, text_color='k', font_family=None, shadow=False, show_points=True, point_color='k', point_size=5, name=None): """ Creates...
python
def add_point_labels(self, points, labels, italic=False, bold=True, font_size=None, text_color='k', font_family=None, shadow=False, show_points=True, point_color='k', point_size=5, name=None): """ Creates...
[ "def", "add_point_labels", "(", "self", ",", "points", ",", "labels", ",", "italic", "=", "False", ",", "bold", "=", "True", ",", "font_size", "=", "None", ",", "text_color", "=", "'k'", ",", "font_family", "=", "None", ",", "shadow", "=", "False", ","...
Creates a point actor with one label from list labels assigned to each point. Parameters ---------- points : np.ndarray n x 3 numpy array of points. labels : list List of labels. Must be the same length as points. italic : bool, optional ...
[ "Creates", "a", "point", "actor", "with", "one", "label", "from", "list", "labels", "assigned", "to", "each", "point", "." ]
5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1
https://github.com/vtkiorg/vtki/blob/5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1/vtki/plotting.py#L2149-L2257
222,682
vtkiorg/vtki
vtki/plotting.py
BasePlotter.add_arrows
def add_arrows(self, cent, direction, mag=1, **kwargs): """ Adds arrows to plotting object """ direction = direction.copy() if cent.ndim != 2: cent = cent.reshape((-1, 3)) if direction.ndim != 2: direction = direction.reshape((-1, 3)) direction[:,0] *= m...
python
def add_arrows(self, cent, direction, mag=1, **kwargs): """ Adds arrows to plotting object """ direction = direction.copy() if cent.ndim != 2: cent = cent.reshape((-1, 3)) if direction.ndim != 2: direction = direction.reshape((-1, 3)) direction[:,0] *= m...
[ "def", "add_arrows", "(", "self", ",", "cent", ",", "direction", ",", "mag", "=", "1", ",", "*", "*", "kwargs", ")", ":", "direction", "=", "direction", ".", "copy", "(", ")", "if", "cent", ".", "ndim", "!=", "2", ":", "cent", "=", "cent", ".", ...
Adds arrows to plotting object
[ "Adds", "arrows", "to", "plotting", "object" ]
5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1
https://github.com/vtkiorg/vtki/blob/5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1/vtki/plotting.py#L2264-L2289
222,683
vtkiorg/vtki
vtki/plotting.py
BasePlotter._save_image
def _save_image(image, filename, return_img=None): """Internal helper for saving a NumPy image array""" if not image.size: raise Exception('Empty image. Have you run plot() first?') # write screenshot to file if isinstance(filename, str): if isinstance(vtki.FIGU...
python
def _save_image(image, filename, return_img=None): """Internal helper for saving a NumPy image array""" if not image.size: raise Exception('Empty image. Have you run plot() first?') # write screenshot to file if isinstance(filename, str): if isinstance(vtki.FIGU...
[ "def", "_save_image", "(", "image", ",", "filename", ",", "return_img", "=", "None", ")", ":", "if", "not", "image", ".", "size", ":", "raise", "Exception", "(", "'Empty image. Have you run plot() first?'", ")", "# write screenshot to file", "if", "isinstance", "...
Internal helper for saving a NumPy image array
[ "Internal", "helper", "for", "saving", "a", "NumPy", "image", "array" ]
5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1
https://github.com/vtkiorg/vtki/blob/5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1/vtki/plotting.py#L2293-L2306
222,684
vtkiorg/vtki
vtki/plotting.py
BasePlotter.screenshot
def screenshot(self, filename=None, transparent_background=None, return_img=None, window_size=None): """ Takes screenshot at current camera position Parameters ---------- filename : str, optional Location to write image to. If None, no image is wr...
python
def screenshot(self, filename=None, transparent_background=None, return_img=None, window_size=None): """ Takes screenshot at current camera position Parameters ---------- filename : str, optional Location to write image to. If None, no image is wr...
[ "def", "screenshot", "(", "self", ",", "filename", "=", "None", ",", "transparent_background", "=", "None", ",", "return_img", "=", "None", ",", "window_size", "=", "None", ")", ":", "if", "window_size", "is", "not", "None", ":", "self", ".", "window_size"...
Takes screenshot at current camera position Parameters ---------- filename : str, optional Location to write image to. If None, no image is written. transparent_background : bool, optional Makes the background transparent. Default False. return_img : ...
[ "Takes", "screenshot", "at", "current", "camera", "position" ]
5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1
https://github.com/vtkiorg/vtki/blob/5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1/vtki/plotting.py#L2308-L2369
222,685
vtkiorg/vtki
vtki/plotting.py
BasePlotter.add_legend
def add_legend(self, labels=None, bcolor=(0.5, 0.5, 0.5), border=False, size=None, name=None): """ Adds a legend to render window. Entries must be a list containing one string and color entry for each item. Parameters ---------- labels : list, optiona...
python
def add_legend(self, labels=None, bcolor=(0.5, 0.5, 0.5), border=False, size=None, name=None): """ Adds a legend to render window. Entries must be a list containing one string and color entry for each item. Parameters ---------- labels : list, optiona...
[ "def", "add_legend", "(", "self", ",", "labels", "=", "None", ",", "bcolor", "=", "(", "0.5", ",", "0.5", ",", "0.5", ")", ",", "border", "=", "False", ",", "size", "=", "None", ",", "name", "=", "None", ")", ":", "self", ".", "legend", "=", "v...
Adds a legend to render window. Entries must be a list containing one string and color entry for each item. Parameters ---------- labels : list, optional When set to None, uses existing labels as specified by - add_mesh - add_lines - add...
[ "Adds", "a", "legend", "to", "render", "window", ".", "Entries", "must", "be", "a", "list", "containing", "one", "string", "and", "color", "entry", "for", "each", "item", "." ]
5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1
https://github.com/vtkiorg/vtki/blob/5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1/vtki/plotting.py#L2371-L2479
222,686
vtkiorg/vtki
vtki/plotting.py
BasePlotter.set_background
def set_background(self, color, loc='all'): """ Sets background color Parameters ---------- color : string or 3 item list, optional, defaults to white Either a string, rgb list, or hex color string. For example: color='white' color='w...
python
def set_background(self, color, loc='all'): """ Sets background color Parameters ---------- color : string or 3 item list, optional, defaults to white Either a string, rgb list, or hex color string. For example: color='white' color='w...
[ "def", "set_background", "(", "self", ",", "color", ",", "loc", "=", "'all'", ")", ":", "if", "color", "is", "None", ":", "color", "=", "rcParams", "[", "'background'", "]", "if", "isinstance", "(", "color", ",", "str", ")", ":", "if", "color", ".", ...
Sets background color Parameters ---------- color : string or 3 item list, optional, defaults to white Either a string, rgb list, or hex color string. For example: color='white' color='w' color=[1, 1, 1] color='#FFFFFF...
[ "Sets", "background", "color" ]
5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1
https://github.com/vtkiorg/vtki/blob/5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1/vtki/plotting.py#L2533-L2566
222,687
vtkiorg/vtki
vtki/plotting.py
BasePlotter.remove_legend
def remove_legend(self): """ Removes legend actor """ if hasattr(self, 'legend'): self.remove_actor(self.legend, reset_camera=False) self._render()
python
def remove_legend(self): """ Removes legend actor """ if hasattr(self, 'legend'): self.remove_actor(self.legend, reset_camera=False) self._render()
[ "def", "remove_legend", "(", "self", ")", ":", "if", "hasattr", "(", "self", ",", "'legend'", ")", ":", "self", ".", "remove_actor", "(", "self", ".", "legend", ",", "reset_camera", "=", "False", ")", "self", ".", "_render", "(", ")" ]
Removes legend actor
[ "Removes", "legend", "actor" ]
5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1
https://github.com/vtkiorg/vtki/blob/5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1/vtki/plotting.py#L2578-L2582
222,688
vtkiorg/vtki
vtki/plotting.py
BasePlotter.enable_cell_picking
def enable_cell_picking(self, mesh=None, callback=None): """ Enables picking of cells. Press r to enable retangle based selection. Press "r" again to turn it off. Selection will be saved to self.picked_cells. Uses last input mesh for input Parameters --------...
python
def enable_cell_picking(self, mesh=None, callback=None): """ Enables picking of cells. Press r to enable retangle based selection. Press "r" again to turn it off. Selection will be saved to self.picked_cells. Uses last input mesh for input Parameters --------...
[ "def", "enable_cell_picking", "(", "self", ",", "mesh", "=", "None", ",", "callback", "=", "None", ")", ":", "if", "mesh", "is", "None", ":", "if", "not", "hasattr", "(", "self", ",", "'mesh'", ")", ":", "raise", "Exception", "(", "'Input a mesh into the...
Enables picking of cells. Press r to enable retangle based selection. Press "r" again to turn it off. Selection will be saved to self.picked_cells. Uses last input mesh for input Parameters ---------- mesh : vtk.UnstructuredGrid, optional UnstructuredGrid...
[ "Enables", "picking", "of", "cells", ".", "Press", "r", "to", "enable", "retangle", "based", "selection", ".", "Press", "r", "again", "to", "turn", "it", "off", ".", "Selection", "will", "be", "saved", "to", "self", ".", "picked_cells", "." ]
5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1
https://github.com/vtkiorg/vtki/blob/5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1/vtki/plotting.py#L2584-L2624
222,689
vtkiorg/vtki
vtki/plotting.py
BasePlotter.generate_orbital_path
def generate_orbital_path(self, factor=3., n_points=20, viewup=None, z_shift=None): """Genrates an orbital path around the data scene Parameters ---------- facotr : float A scaling factor when biulding the orbital extent n_points : int number of points o...
python
def generate_orbital_path(self, factor=3., n_points=20, viewup=None, z_shift=None): """Genrates an orbital path around the data scene Parameters ---------- facotr : float A scaling factor when biulding the orbital extent n_points : int number of points o...
[ "def", "generate_orbital_path", "(", "self", ",", "factor", "=", "3.", ",", "n_points", "=", "20", ",", "viewup", "=", "None", ",", "z_shift", "=", "None", ")", ":", "if", "viewup", "is", "None", ":", "viewup", "=", "rcParams", "[", "'camera'", "]", ...
Genrates an orbital path around the data scene Parameters ---------- facotr : float A scaling factor when biulding the orbital extent n_points : int number of points on the orbital path viewup : list(float) the normal to the orbital plane ...
[ "Genrates", "an", "orbital", "path", "around", "the", "data", "scene" ]
5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1
https://github.com/vtkiorg/vtki/blob/5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1/vtki/plotting.py#L2627-L2655
222,690
vtkiorg/vtki
vtki/plotting.py
BasePlotter.orbit_on_path
def orbit_on_path(self, path=None, focus=None, step=0.5, viewup=None, bkg=True): """Orbit on the given path focusing on the focus point Parameters ---------- path : vtki.PolyData Path of orbital points. The order in the points is the order of travel focu...
python
def orbit_on_path(self, path=None, focus=None, step=0.5, viewup=None, bkg=True): """Orbit on the given path focusing on the focus point Parameters ---------- path : vtki.PolyData Path of orbital points. The order in the points is the order of travel focu...
[ "def", "orbit_on_path", "(", "self", ",", "path", "=", "None", ",", "focus", "=", "None", ",", "step", "=", "0.5", ",", "viewup", "=", "None", ",", "bkg", "=", "True", ")", ":", "if", "focus", "is", "None", ":", "focus", "=", "self", ".", "center...
Orbit on the given path focusing on the focus point Parameters ---------- path : vtki.PolyData Path of orbital points. The order in the points is the order of travel focus : list(float) of length 3, optional The point ot focus the camera. st...
[ "Orbit", "on", "the", "given", "path", "focusing", "on", "the", "focus", "point" ]
5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1
https://github.com/vtkiorg/vtki/blob/5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1/vtki/plotting.py#L2666-L2708
222,691
vtkiorg/vtki
vtki/plotting.py
BasePlotter.export_vtkjs
def export_vtkjs(self, filename, compress_arrays=False): """ Export the current rendering scene as a VTKjs scene for rendering in a web browser """ if not hasattr(self, 'ren_win'): raise RuntimeError('Export must be called before showing/closing the scene.') i...
python
def export_vtkjs(self, filename, compress_arrays=False): """ Export the current rendering scene as a VTKjs scene for rendering in a web browser """ if not hasattr(self, 'ren_win'): raise RuntimeError('Export must be called before showing/closing the scene.') i...
[ "def", "export_vtkjs", "(", "self", ",", "filename", ",", "compress_arrays", "=", "False", ")", ":", "if", "not", "hasattr", "(", "self", ",", "'ren_win'", ")", ":", "raise", "RuntimeError", "(", "'Export must be called before showing/closing the scene.'", ")", "i...
Export the current rendering scene as a VTKjs scene for rendering in a web browser
[ "Export", "the", "current", "rendering", "scene", "as", "a", "VTKjs", "scene", "for", "rendering", "in", "a", "web", "browser" ]
5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1
https://github.com/vtkiorg/vtki/blob/5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1/vtki/plotting.py#L2711-L2720
222,692
vtkiorg/vtki
vtki/plotting.py
Plotter.show
def show(self, title=None, window_size=None, interactive=True, auto_close=True, interactive_update=False, full_screen=False, screenshot=False, return_img=False, use_panel=None): """ Creates plotting window Parameters ---------- title : string, optional ...
python
def show(self, title=None, window_size=None, interactive=True, auto_close=True, interactive_update=False, full_screen=False, screenshot=False, return_img=False, use_panel=None): """ Creates plotting window Parameters ---------- title : string, optional ...
[ "def", "show", "(", "self", ",", "title", "=", "None", ",", "window_size", "=", "None", ",", "interactive", "=", "True", ",", "auto_close", "=", "True", ",", "interactive_update", "=", "False", ",", "full_screen", "=", "False", ",", "screenshot", "=", "F...
Creates plotting window Parameters ---------- title : string, optional Title of plotting window. window_size : list, optional Window size in pixels. Defaults to [1024, 768] interactive : bool, optional Enabled by default. Allows user to pa...
[ "Creates", "plotting", "window" ]
5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1
https://github.com/vtkiorg/vtki/blob/5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1/vtki/plotting.py#L2834-L2958
222,693
vtkiorg/vtki
vtki/examples/examples.py
load_structured
def load_structured(): """ Loads a simple StructuredGrid """ x = np.arange(-10, 10, 0.25) y = np.arange(-10, 10, 0.25) x, y = np.meshgrid(x, y) r = np.sqrt(x**2 + y**2) z = np.sin(r) return vtki.StructuredGrid(x, y, z)
python
def load_structured(): """ Loads a simple StructuredGrid """ x = np.arange(-10, 10, 0.25) y = np.arange(-10, 10, 0.25) x, y = np.meshgrid(x, y) r = np.sqrt(x**2 + y**2) z = np.sin(r) return vtki.StructuredGrid(x, y, z)
[ "def", "load_structured", "(", ")", ":", "x", "=", "np", ".", "arange", "(", "-", "10", ",", "10", ",", "0.25", ")", "y", "=", "np", ".", "arange", "(", "-", "10", ",", "10", ",", "0.25", ")", "x", ",", "y", "=", "np", ".", "meshgrid", "(",...
Loads a simple StructuredGrid
[ "Loads", "a", "simple", "StructuredGrid" ]
5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1
https://github.com/vtkiorg/vtki/blob/5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1/vtki/examples/examples.py#L53-L60
222,694
vtkiorg/vtki
vtki/examples/examples.py
plot_ants_plane
def plot_ants_plane(off_screen=False, notebook=None): """ Demonstrate how to create a plot class to plot multiple meshes while adding scalars and text. Plot two ants and airplane """ # load and shrink airplane airplane = vtki.PolyData(planefile) airplane.points /= 10 # pts = airpla...
python
def plot_ants_plane(off_screen=False, notebook=None): """ Demonstrate how to create a plot class to plot multiple meshes while adding scalars and text. Plot two ants and airplane """ # load and shrink airplane airplane = vtki.PolyData(planefile) airplane.points /= 10 # pts = airpla...
[ "def", "plot_ants_plane", "(", "off_screen", "=", "False", ",", "notebook", "=", "None", ")", ":", "# load and shrink airplane", "airplane", "=", "vtki", ".", "PolyData", "(", "planefile", ")", "airplane", ".", "points", "/=", "10", "# pts = airplane.points # gets...
Demonstrate how to create a plot class to plot multiple meshes while adding scalars and text. Plot two ants and airplane
[ "Demonstrate", "how", "to", "create", "a", "plot", "class", "to", "plot", "multiple", "meshes", "while", "adding", "scalars", "and", "text", "." ]
5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1
https://github.com/vtkiorg/vtki/blob/5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1/vtki/examples/examples.py#L77-L109
222,695
vtkiorg/vtki
vtki/examples/examples.py
plot_wave
def plot_wave(fps=30, frequency=1, wavetime=3, interactive=False, off_screen=False, notebook=None): """ Plot a 3D moving wave in a render window. Parameters ---------- fps : int, optional Maximum frames per second to display. Defaults to 30. frequency: float, optional ...
python
def plot_wave(fps=30, frequency=1, wavetime=3, interactive=False, off_screen=False, notebook=None): """ Plot a 3D moving wave in a render window. Parameters ---------- fps : int, optional Maximum frames per second to display. Defaults to 30. frequency: float, optional ...
[ "def", "plot_wave", "(", "fps", "=", "30", ",", "frequency", "=", "1", ",", "wavetime", "=", "3", ",", "interactive", "=", "False", ",", "off_screen", "=", "False", ",", "notebook", "=", "None", ")", ":", "# camera position", "cpos", "=", "[", "(", "...
Plot a 3D moving wave in a render window. Parameters ---------- fps : int, optional Maximum frames per second to display. Defaults to 30. frequency: float, optional Wave cycles per second. Defaults to 1 wavetime : float, optional The desired total display time in seconds...
[ "Plot", "a", "3D", "moving", "wave", "in", "a", "render", "window", "." ]
5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1
https://github.com/vtkiorg/vtki/blob/5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1/vtki/examples/examples.py#L145-L235
222,696
vtkiorg/vtki
vtki/filters.py
_get_output
def _get_output(algorithm, iport=0, iconnection=0, oport=0, active_scalar=None, active_scalar_field='point'): """A helper to get the algorithm's output and copy input's vtki meta info""" ido = algorithm.GetInputDataObject(iport, iconnection) data = wrap(algorithm.GetOutputDataObject(oport)) ...
python
def _get_output(algorithm, iport=0, iconnection=0, oport=0, active_scalar=None, active_scalar_field='point'): """A helper to get the algorithm's output and copy input's vtki meta info""" ido = algorithm.GetInputDataObject(iport, iconnection) data = wrap(algorithm.GetOutputDataObject(oport)) ...
[ "def", "_get_output", "(", "algorithm", ",", "iport", "=", "0", ",", "iconnection", "=", "0", ",", "oport", "=", "0", ",", "active_scalar", "=", "None", ",", "active_scalar_field", "=", "'point'", ")", ":", "ido", "=", "algorithm", ".", "GetInputDataObject...
A helper to get the algorithm's output and copy input's vtki meta info
[ "A", "helper", "to", "get", "the", "algorithm", "s", "output", "and", "copy", "input", "s", "vtki", "meta", "info" ]
5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1
https://github.com/vtkiorg/vtki/blob/5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1/vtki/filters.py#L44-L52
222,697
vtkiorg/vtki
vtki/filters.py
_generate_plane
def _generate_plane(normal, origin): """ Returns a vtk.vtkPlane """ plane = vtk.vtkPlane() plane.SetNormal(normal[0], normal[1], normal[2]) plane.SetOrigin(origin[0], origin[1], origin[2]) return plane
python
def _generate_plane(normal, origin): """ Returns a vtk.vtkPlane """ plane = vtk.vtkPlane() plane.SetNormal(normal[0], normal[1], normal[2]) plane.SetOrigin(origin[0], origin[1], origin[2]) return plane
[ "def", "_generate_plane", "(", "normal", ",", "origin", ")", ":", "plane", "=", "vtk", ".", "vtkPlane", "(", ")", "plane", ".", "SetNormal", "(", "normal", "[", "0", "]", ",", "normal", "[", "1", "]", ",", "normal", "[", "2", "]", ")", "plane", "...
Returns a vtk.vtkPlane
[ "Returns", "a", "vtk", ".", "vtkPlane" ]
5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1
https://github.com/vtkiorg/vtki/blob/5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1/vtki/filters.py#L55-L60
222,698
vtkiorg/vtki
vtki/filters.py
DataSetFilters.clip
def clip(dataset, normal='x', origin=None, invert=True): """ Clip a dataset by a plane by specifying the origin and normal. If no parameters are given the clip will occur in the center of that dataset Parameters ---------- normal : tuple(float) or str Length ...
python
def clip(dataset, normal='x', origin=None, invert=True): """ Clip a dataset by a plane by specifying the origin and normal. If no parameters are given the clip will occur in the center of that dataset Parameters ---------- normal : tuple(float) or str Length ...
[ "def", "clip", "(", "dataset", ",", "normal", "=", "'x'", ",", "origin", "=", "None", ",", "invert", "=", "True", ")", ":", "if", "isinstance", "(", "normal", ",", "str", ")", ":", "normal", "=", "NORMALS", "[", "normal", ".", "lower", "(", ")", ...
Clip a dataset by a plane by specifying the origin and normal. If no parameters are given the clip will occur in the center of that dataset Parameters ---------- normal : tuple(float) or str Length 3 tuple for the normal vector direction. Can also be specified as...
[ "Clip", "a", "dataset", "by", "a", "plane", "by", "specifying", "the", "origin", "and", "normal", ".", "If", "no", "parameters", "are", "given", "the", "clip", "will", "occur", "in", "the", "center", "of", "that", "dataset" ]
5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1
https://github.com/vtkiorg/vtki/blob/5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1/vtki/filters.py#L73-L106
222,699
vtkiorg/vtki
vtki/filters.py
DataSetFilters.clip_box
def clip_box(dataset, bounds=None, invert=True, factor=0.35): """Clips a dataset by a bounding box defined by the bounds. If no bounds are given, a corner of the dataset bounds will be removed. Parameters ---------- bounds : tuple(float) Length 6 iterable of floats: ...
python
def clip_box(dataset, bounds=None, invert=True, factor=0.35): """Clips a dataset by a bounding box defined by the bounds. If no bounds are given, a corner of the dataset bounds will be removed. Parameters ---------- bounds : tuple(float) Length 6 iterable of floats: ...
[ "def", "clip_box", "(", "dataset", ",", "bounds", "=", "None", ",", "invert", "=", "True", ",", "factor", "=", "0.35", ")", ":", "if", "bounds", "is", "None", ":", "def", "_get_quarter", "(", "dmin", ",", "dmax", ")", ":", "\"\"\"internal helper to get a...
Clips a dataset by a bounding box defined by the bounds. If no bounds are given, a corner of the dataset bounds will be removed. Parameters ---------- bounds : tuple(float) Length 6 iterable of floats: (xmin, xmax, ymin, ymax, zmin, zmax) invert : bool F...
[ "Clips", "a", "dataset", "by", "a", "bounding", "box", "defined", "by", "the", "bounds", ".", "If", "no", "bounds", "are", "given", "a", "corner", "of", "the", "dataset", "bounds", "will", "be", "removed", "." ]
5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1
https://github.com/vtkiorg/vtki/blob/5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1/vtki/filters.py#L108-L151