yt.visualization.volume_rendering.camera_path module¶
- class yt.visualization.volume_rendering.camera_path.Keyframes(x, y, z=None, north_vectors=None, up_vectors=None, times=None, niter=50000, init_temp=10.0, alpha=0.999, fixed_start=False)[source]¶
Bases:
object
- cartesian_matrix()[source]¶
Create a distance matrix for the city coords that uses straight line distance
- create_path(npoints, path_time=None, tension=0.5, shortest_path=False)[source]¶
Create a interpolated camera path from keyframes.
- Parameters:
npoints (integer) – Number of points to interpolate from keyframes
path_time (array_like, optional) – Times of interpolated points. Default: Linearly spaced
tension (float, optional) – Controls how sharp of a curve the spline takes. A higher tension allows for more sharp turns. Default: 0.5
shortest_path (boolean, optional) – If true, estimate the shortest path between the keyframes. Default: False
- Returns:
path – Dictionary (time, position, north_vectors, up_vectors) of camera path. Also saved to self.path.
- Return type:
- rand_seq()[source]¶
Generates values in random order, equivalent to using shuffle in random without generation all values at once.
- reversed_sections(tour)[source]¶
Generator to return all possible variations where a section between two cities are swapped.
- setup_tsp(niter=50000, init_temp=10.0, alpha=0.999, fixed_start=False)[source]¶
Setup parameters for Travelling Salesman Problem.
- Parameters:
niter (integer, optional) – Maximum number of iterations to find solution. Default: 50000
init_temp (float, optional) – Initial temperature for simulated annealing when finding a solution. Lower initial temperatures result in an initial solution in first several iterations that changes more rapidly. Default: 10.0
alpha (float, optional) – Exponent in cooling function in simulated annealing. Must be < 1. In each iteration, the temperature_new = temperature_old * alpha. Default: 0.999
fixed_start (boolean, optional) – If true, the first point never changes when searching for shortest path. Default: False