hypertools.DataGeometry

class hypertools.DataGeometry(fig=None, ax=None, line_ani=None, data=None, xform_data=None, reduce=None, align=None, normalize=None, kwargs=None, version='0.4.0')[source]

Hypertools data object class

A DataGeometry object contains the data, figure handles and transform functions used to create a plot. Note: this class should not be called directly, but is used by the hyp.plot function to create a plot object.

Parameters:

fig : matplotlib.Figure

The matplotlib figure handle for the plot

ax : matplotlib.Axes

The matplotlib axes handle for the plot

line_ani : matplotlib.animation.FuncAnimation

The matplotlib animation handle (if the plot is an animation)

data : list

A list of numpy arrays representing the raw data

xform_data : list

A list of numpy arrays representing the transformed data

reduce : dict

A dictionary containing the reduction model and parameters

align : dict

A dictionary containing align model and parameters

normalize : str

A string representing the kind of normalization

kwargs : dict

A dictionary containing all kwargs passed to the plot function

version : str

The version of the software used to create the class instance

Methods

plot([data]) Plot the data
save(fname[, compression]) Save method for the data geometry object
transform([data]) Return transformed data, or transform new data using the same model
plot(data=None, **kwargs)[source]

Plot the data

Parameters:

data : numpy array, pandas dataframe or list of arrays/dfs

The data to plot. If no data is passed, the xform_data from the DataGeometry object will be returned.

kwargs : keyword arguments

Any keyword arguments supported by hypertools.plot are also supported by this method

Returns:

geo : hypertools.DataGeometry

A new data geometry object

save(fname, compression='blosc')[source]

Save method for the data geometry object

The data will be saved as a ‘geo’ file, which is a dictionary containing the elements of a data geometry object saved in the hd5 format using deepdish.

Parameters:

fname : str

A name for the file. If the file extension (.geo) is not specified, it will be appended.

compression : str

The kind of compression to use. See the deepdish documentation for options: http://deepdish.readthedocs.io/en/latest/api_io.html#deepdish.io.save

transform(data=None)[source]

Return transformed data, or transform new data using the same model parameters

Parameters:

data : numpy array, pandas dataframe or list of arrays/dfs

The data to transform. If no data is passed, the xform_data from the DataGeometry object will be returned.

Returns:

xformed_data : list of numpy arrays

The transformed data