musicflower.util.get_time_traces

musicflower.util.get_time_traces(x, y, z, colors, n_steps, axis=0)[source]

Compute n_steps + 1 traces that run from the top of the triangular map to its bottom by interpolating along rows. The input arrays can have an arbitrary number of additional batch dimensions.

Each trace has the same number of points as there are rows in the triangular map. As time runs from 0 to 1, the points run from left to right along the rows, interpolating linearly between points.

Parameters
  • x (ndarray) – array with x-coordinates

  • y (ndarray) – array with y-coordinates

  • z (ndarray) – array with z-coordinates

  • colors (ndarray) – array with RGB colours (last dimension must correspond to colours and have size 3)

  • n_steps (int) – create n_steps + 1 traces from time 0 to time 1

  • axis – Axis of the input arrays that corresponds to the triangular map. It must have a compatible length (i.e. a length of n(n+1)/2 for some integer n).

Return type

Tuple[ndarray, ndarray]

Returns

xyz, colors: two arrays of shape (n_steps + 1, n, …, 3) with xyz-coordinates and colours, where corresponds to any additional batch dimensions.