mdap.MD_Plot

class mdap.MD_Plot(*args, **kwargs)

These methods provide various plotting options for pdist data.

__init__(*args, **kwargs)

Plotting of pdists generated from H5 datasets.

After instantiating this class, input args are all saved as instance attributes.

These can then be updated if needed. Note that if the X, Y, and Z input arrays are not provided, they will be generated using the parent H5_Pdist class using super() and initializing with the input *args and **kwargs lists. So you can input the same args to be passed to H5_Pdist such as h5, data_type, Xname, Yname, Xindex, etc. The raw data arrays being used by H5_Plot and generated by H5_Pdist can be accessed as updated instance attributes (self.X, self.Y, self.Z).

Alternatively the X, Y, and Z arrays can be generated in a separate line by H5_Pdist and then passed to H5_Plot. ` Python X, Y, Z = H5_Pdist(**kwargs).pdist() H5_Plot(X, Y, Z, **kwargs).plot() `

The main method you will call is the H5_Plot.plot() method, which will update the self.ax and self.fig instance attributes with the desired plotting options specified.

Parameters:
  • X, Y (arrays) – x and y axis values, and if using aux_y or evolution (with only aux_x), also must input Z.

  • Z (2darray) – Z is a 2-D matrix of the normalized histogram values.

  • plot_mode (str) – TODO: update and expand. Can be ‘hist’ (default), ‘contour’, ‘line’, ‘scatter3d’.

  • cmap (str) – Can be string or cmap to be input into mpl. Default = viridis.

  • smoothing_level (float) – Optionally add gaussian noise to smooth Z data. A good value is around 0.4 to 1.0.

  • color (str) – Color for 1D plots.

  • ax (mpl axes object)

  • plot_options (kwargs dictionary) – Include mpl based plot options (e.g. xlabel, ylabel, ylim, xlim, title).

  • p_min (int) – The minimum probability limit value.

  • p_max (int) – The maximum probability limit value.

  • contour_interval (int) – Interval to put contour levels if using ‘contour’ plot_mode.

  • cbar_label (str) – Label for the colorbar.

  • cax (MPL axes object) – Optionally define axes object to place colorbar.

  • jointplot (bool) – Whether or not to include marginal plots. Note to use this argument, probabilities for Z or from H5_Pdist must be in raw p_units.

  • data_label (str) – Optionally label the data, e.g. for multiple 1D plots.

  • proj3d (bool) – Optionally use a 3d projection plot, defaut False. Only works with contour and scatter plots.

  • proj4d (bool) – Optionally use a 4d projection plot, defaut False. Only works with scatter plots.

  • C (array) – For color mapping of 3d projection plots.

  • scatter_interval (int) – Interval for displaying scatter plot data, default 1.

  • scatter_s (float) – Int for displaying scatter plot data marker size, default 1.

  • hexbin_grid (int) – Determines gridsize for hexbin plots.

  • linewidth (float) – Linewidth for 1D plots, contour lines, and hexbin edges.

  • linestyle (str) – Linestyle for 1D plots, contour lines, and hexbin edges.

  • postprocess_func (func) – User function to import.

  • ** args

  • ** kwargs

Methods

__init__(*args, **kwargs)

Plotting of pdists generated from H5 datasets.

add_cbar([cax, pad, fontsize])

Add cbar.

aux_to_pdist_1d(iteration)

Take the auxiliary dataset for a single iteration and generate a weighted 1D probability distribution.

aux_to_pdist_2d(iteration)

Take the auxiliary dataset for a single iteration and generate a weighted 2D probability distribution.

average_datasets_3d([interval])

Unique case where Zname is specified and the XYZ datasets are returned.

average_datasets_4d([interval])

Unique case where Zname is specified and the XYZ datasets are returned.

average_pdist_1d()

1 dataset: average pdist for a range of iterations.

average_pdist_2d()

2 datasets: average pdist for a range of iterations.

evolution_pdist()

Returns the pdist for 1 coordinate for the range iterations specified.

find_iter_seg_from_xy_vals(val_x, val_y)

Find and return (iter, seg) closest to input data value(s).

gaussian_filter(data, sigma)

Apply Gaussian smoothing to a 2D array.

get_all_weights()

Returns an 1D array of the weight for every frame of each tau for all segments of all iterations specified.

get_coords(path, data_name, data_index)

Get a list of data coordinates for plotting traces.

get_full_coords(walker_tuple, data_name[, ...])

Returns a full 1D set of data for a single trace (path).

get_parents(walker_tuple)

Get parent of an input (iteration, walker).

get_total_data_array(name[, index, ...])

Loop through all iterations specified and get a 1d raw data array.

instant_datasets_3d()

Unique case where Zname is specified and the XYZ datasets are returned.

instant_pdist_1d()

Returns the x and y pdist datasets for a single iteration.

instant_pdist_2d()

Returns the xyz pdist datasets for a single iteration.

load_module(module_name[, path])

Load and return the given module, recursively loading containing packages as necessary.

make_new_h5([new_weights])

TODO: actually make a new h5 file, see bstate filter code, integrate all.

pdist()

Main public method with pdist generation controls.

pdist_1d()

returns:
  • X (ndarray)

pdist_2d()

returns:
  • X (ndarray)

pdist_3d()

returns:
  • X (ndarray)

plot([cbar])

Main public method.

plot_bar()

Simple bar plot.

plot_contour_f()

2d contour plot, fill.

plot_contour_l()

2d contour plot, lines.

plot_hexbin3d([gridsize])

Hexbin plot.

plot_hist()

2d hist plot.

plot_line()

1d line plot.

plot_margins()

Joint plot of heatmap (pcolormesh).

plot_scatter3d([interval, s])

3d scatter plot.

plot_trace(walker_tuple[, color, linewidth, ...])

Plot trace.

reshape_total_data_array(array)

Take an input 1d array of the data values at every segment for each iteration, and reshape them to make pdists.

succ_pdist_weight_filter()

TODO: Filter weights to be zero for all non successfull trajectories.

timeseries()

returns:
  • X (ndarray)

trace_walker(walker_tuple[, first_iter])

Get trace path of an input (iteration, walker).

w_succ()

Find and return all successfully recycled (iter, seg) pairs.

Attributes

cbar_pad