musicflower.util.get_time_traces
- musicflower.util.get_time_traces(x, y, z, colors, n_steps=None, times=None, 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-coordinatesy (
ndarray
) – array with y-coordinatesz (
ndarray
) – array with z-coordinatescolors (
ndarray
) – array with RGB colours (last dimension must correspond to colours and have size 3)n_steps (
Optional
[int
]) – create n_steps + 1 traces from time 0 to time 1 (instead of using explicittimes
)times (
Optional
[ndarray
]) – array with values in [0, 1]; create traces for these times (instead ofn_steps
equally spaced)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.