zava

Core

class zava.core.GrandTour(matrix, c=0.0, d=100.0)

Bases: object

Grand Tour object.

__init__(matrix, c=0.0, d=100.0)

ctor

Parameters
  • matrix – Pandas dataframe or 2-D numpy ndarray.

  • c – Minimum value for scaling. Default 0.0.

  • d – Maximum value for scaling. Default 100.0.

property headers

Gets a list of headers. The variable names or column names if the matrix is a Pandas dataframe; otherwise, a list of generic names \(x_0, x_1, \ldots, x_n\) if the matrix is an ndarray.

rotate(degree, transpose=True, return_dataframe=True)

Rotates the matrix. When transpose and return_dataframe are set to True, then a transposed Pandas dataframe is returned. You can just issue df.plot(kind='line') as a start to get the parallel coordinate plot.

Parameters
  • degree – Degree.

  • transpose – Boolean. Default is True.

  • return_dataframe – Boolean. Default is True.

Returns

Pandas dataframe or 2-D numpy ndarray.

zava.core.__get_givens(n, deg)

Computes the Givens rotation matrix based on the specified degree.

Parameters
  • n – The number of rows and columns.

  • deg – Degrees.

Returns

A Givens rotation matrix (squared, n x n).

zava.core._rescale(M, C, D)

Rescales the specified matrix, M, according to the new minimum, C, and maximum, D. C and D should be of the dimension 1 x cols.

  • TODO: avoid recomputing A and B, might not be efficient

Parameters
  • M – Matrix.

  • C – Vector of new target minimums.

  • D – Vector of new target maximums.

Returns

Matrix.

zava.core._rotate(M, C, D, deg=0.0)

Rotates the specified matrix.

Parameters
  • M – Matrix.

  • C – Vector of new target minimums.

  • D – Vector of new target maximums.

  • deg – Rotation in degrees. Default 0.0.

Returns

Matrix (rotated).

Plotting

class zava.plot.MultiPlotter(plotters, ax, **kwargs)

Bases: object

Parallel coordinate and Grand Tour plotter for multiple dataset.

__call__(degree)

Instance method to produce plot.

Parameters

degree – Degree.

__get_gif_frame(degree, figsize)

Gets a GIF frame.

Parameters
  • degree – Degree.

  • figsize – Tuple of figure size (matplotlib).

Returns

None.

__get_gif_frames(start=0, stop=360, figsize=(15, 3))

Gets a list of GIF frames.

Parameters
  • start – Start degree.

  • stop – Stop degree.

  • figsize – Figure size. Default is (15, 3).

Returns

List of frames.

__init__(plotters, ax, **kwargs)

ctor.

Parameters
  • plotters – List of SinglePlotter.

  • ax – Plotting axis.

  • kwargs – Additional arguments (e.g. title for plot).

init()

Initialization.

save_gif(output, duration, start=0, stop=360, figsize=(15, 3), unit='s')

Saves the animation as an animated GIF.

Parameters
  • output – Output path.

  • duration – Duration per frame.

  • start – Start degree.

  • stop – Stop degree.

  • figsize – Figure size. Default is (15, 3).

  • unit – Time units. Default is ‘s’ for seconds.

Returns

None.

class zava.plot.SinglePlotter(grand_tour, params={})

Bases: object

Parallel coordinate and Grand Tour plotter for a single dataset.

__call__(degree, ax)

Instance method that performs rotation and plot.

Parameters
  • degree – Degree.

  • ax – Plotting axis.

__init__(grand_tour, params={})

ctor.

Parameters
  • grand_tour – Grand Tour instance.

  • params – Parameters for line plots.

property grand_tour

Gets the Grand Tour instance.

Returns

Grand Tour.

init()

Initialization. Does nothing for now.