hypertools
hypertools copied to clipboard
option to animate trajectories in serial or parallel
Currently, when you past a list of arrays to hyp.plot and set animate=True, the trajectories are all plotted simultaneously. There are cases when serial plotting may be useful, like plotting a timeseries where different chunks of time are plotted in different colors, or 'single trial' EEG data, where you want to visualize consistency (or divergence) of trajectories over conditions.
Ideas about how to set up the api?
@andrewheusser is the question how serial plotting should be implemented?
I think we could do something analogous to how chemtrails is currently implemented, but in reviewing the code i also think we may want to clean up how chemtrails is implemented. the high level idea is that we can specify two lists of start and end indices: color_inds and alpha_inds, and two lists of values: color_vals and alpha_inds. These four new arguments should be passed to update_lines, and would replace the lines, data_lines, and trail_lines distinction (those would collectively just become lines).
even though the color_inds/color_vals and alpha_inds/alpha_vals get set internally, we should add an assert statement to check that len(color_inds) == len(color_vals) + 1 and len(alpha_inds) == len(alpha_vals) + 1.
then we would define two loops: one over color_vals and one over alpha_vals. for each ind, we set line[ind:ind+1] to val[ind].
we're left with a single line but with different colors and transparency values at different parts of the line. (side note: i think this will fix the multicolored line gaps bug that we had corrected previously-- we could probably remove that hack where we replicate data between color transitions.)
or @andrewheusser if you were asking about how the serial/parallel flags should be specified, what about having "four" animate options (specified via five flag values to maintain backwards compatibility):
False(default): don't animate the plotTrueorparallel: all groups evolve simultaneously and are plotted together (in parallel)serial: each individual group's data evolves in the plot, and each group is plotted one after the otherspin: show the full dataset (from all groups) and rotate the camera the specified number of times around the data cube
I also think we may want to add a precog argument to hyp.plot that (optionally) shows forward "chemtrails" so that we can easily do that cool bullet time animation @andrewheusser showed via slack. (like chemtrails, precog would be ignored unless the plot is animated.)