TransportMaps.Diagnostics.Plotting

Module Contents

Classes

AlignedConditionalsObject

Base object for every object in the module.

RandomConditionalsObject

Base object for every object in the module.

Functions

computeAlignedConditionals(distribution[, ...])

Compute the conditionals aligned with the axis

plotAlignedConditionals([distribution, data, ...])

Plot the conditionals aligned with the axis

plotAlignedSliceMap(tr_map[, dimensions_vec, ...])

Plot the conditionals aligned with the axis

computeRandomConditionals(distribution[, ...])

Compute the random conditionals

plotRandomConditionals([distribution, data, ...])

Plot the random conditionals

plotAlignedMarginals(mat_points[, mat_points2, ...])

Plot the marginals aligned with the axis

plotAlignedScatters(mat_points[, dimensions_vec, ...])

Plot the marginals aligned with the axis

plotGradXMap(tmap[, base_distribution, nsamples, ...])

plotLinearityMap(tmap[, nlevels, threshold, title, ...])

niceSpy(mat[, title, cmap, show_flag, vrange, ...])

class TransportMaps.Diagnostics.Plotting.AlignedConditionalsObject(nplots, X_list, Y_list, pdfEval_list)[source]

Bases: TransportMaps.ObjectBase.TMO

Base object for every object in the module.

This object provides functions for storage and parallelization.

TransportMaps.Diagnostics.Plotting.computeAlignedConditionals(distribution, dimensions_vec=0, range_vec=[-3, 3], numPointsXax=30, do_diag=True, mpi_pool=None)[source]

Compute the conditionals aligned with the axis

Parameters:
  • distribution (Distribution) – distribution \(\pi\)

  • dimensions_vec (list of int) – list of dimensions to be displayed. Default 0: display 10 dimensions at most.

  • range_vec (list) – range to be displayed. Either a list [2] of integers, or a list [d] of list [2] of integers.

  • numPointsXax (int) – number of points for each axis.

  • do_diag (bool) – whether to include the one dimensional conditionals on the diagonal

  • mpi_pool (mpi_map.MPI_Pool) – pool of processes

Returns:

(AlignedConditionalsObject) – object

storing all the necessary evaluated values

TransportMaps.Diagnostics.Plotting.plotAlignedConditionals(distribution=None, data=None, dimensions_vec=0, range_vec=[-3, 3], numPointsXax=30, numCont=15, figname=None, show_flag=True, do_diag=True, show_title=False, show_axis=True, title='Aligned conditionals', vartitles=None, fig=None, ret_handles=False, mpi_pool=None)[source]

Plot the conditionals aligned with the axis

Parameters:
  • distribution (Distribution) – distribution \(\pi\)

  • data (AlignedConditionalsObject) – output of computeAlignedConditionals()

  • dimensions_vec (list of int) – list of dimensions to be displayed. Default 0: display 10 dimensions at most.

  • range_vec (list) – range to be displayed. Either a list [2] of integers, or a list [d] of list [2] of integers.

  • numPointsXax (int) – number of points for each axis.

  • numCont (int) – number of contours in the contour plots.

  • figname (str) – if defined, store the figure in the provided path.

  • show_flag (bool) – whether to show the plot before returning

  • do_diag (bool) – whether to include the one dimensional conditionals on the diagonal

  • show_title (bool) – whether to show the title

  • show_axis (bool) – whether to show the axis

  • title (str) – title for the figure

  • vartitles (list) – list of titles for each variable

  • fig (figure) – matplotlib figure object if one wants to re-useit.

  • mpi_pool (mpi_map.MPI_Pool) – pool of processes

  • ret_handles (bool) – whether to return the axes handles

TransportMaps.Diagnostics.Plotting.plotAlignedSliceMap(tr_map, dimensions_vec=0, pointEval=0, range_vec=[-4, 4], numPointsXax=30, numCont=30, figname=None, show_flag=True, tickslabelsize=6, show_title=False, fig=None, mpi_pool=None)[source]

Plot the conditionals aligned with the axis

Parameters:
  • tr_map (TriangularTransportMap) – Triangular transport map

  • dimensions_vec (list of int) – list of dimensions to be displayed. Default 0: display 10 dimensions at most.

  • pointEval (ndarray`[:math:`d]) – anchor point. Default is zero.

  • range_vec (list) – range to be displayed. Either a list [2] of integers, or a list [d] of list [2] of integers.

  • numPointsXax (int) – number of points for each axis.

  • numCont (int) – number of contours in the contour plots.

  • figname (str) – if defined, store the figure in the provided path.

  • show_flag (bool) – whether to show the plot before returning

  • show_title (bool) – whether to show a title on top of the figure

  • fig (figure) – matplotlib figure object if one wants to re-use it.

  • mpi_pool (mpi_map.MPI_Pool) – pool of processes

class TransportMaps.Diagnostics.Plotting.RandomConditionalsObject(nplots, X_list, Y_list, pdfEval_list, Q_rand_list)[source]

Bases: TransportMaps.ObjectBase.TMO

Base object for every object in the module.

This object provides functions for storage and parallelization.

TransportMaps.Diagnostics.Plotting.computeRandomConditionals(distribution, num_conditionalsXax=0, pointEval=None, range_vec=[-3, 3], numPointsXax=30, Q_rand_list=None, mpi_pool=None)[source]

Compute the random conditionals

Parameters:
  • distribution (Distribution) – distribution \(\pi\)

  • num_conditionalsXax (int) – number of random conditionals per axis

  • pointEval (ndarray`[:math:`d]) – anchor point. Default is zero.

  • range_vec (:class:`tuple`[2]) – range to be displayed.

  • numPointsXax (int) – number of points for each axis.

  • Q_rand_list (list) – list of random directions.

  • mpi_pool (mpi_map.MPI_Pool) – pool of processes

TransportMaps.Diagnostics.Plotting.plotRandomConditionals(distribution=None, data=None, num_conditionalsXax=0, pointEval=None, range_vec=[-3, 3], numPointsXax=30, numCont=15, Q_rand_list=None, figname=None, show_flag=True, show_title=False, title='Random conditionals', fig=None, mpi_pool=None)[source]

Plot the random conditionals

Parameters:
  • distribution (Distribution) – distribution \(\pi\)

  • data (RandomConditionalsObject) – output of computeRandomConditionals()

  • num_conditionalsXax (int) – number of random conditionals per axis

  • pointEval (ndarray`[:math:`d]) – anchor point. Default is zero.

  • range_vec (:class:`tuple`[2]) – range to be displayed.

  • numPointsXax (int) – number of points for each axis.

  • numCont (int) – number of contours in the contour plots.

  • figname (str) – if defined, store the figure in the provided path.

  • show_flag (bool) – whether to show the plot before returning

  • show_title (bool) – whether to show the title

  • fig (figure) – matplotlib figure object if one wants to re-use it.

  • mpi_pool (mpi_map.MPI_Pool) – pool of processes

TransportMaps.Diagnostics.Plotting.plotAlignedMarginals(mat_points, mat_points2=None, dimensions_vec=0, range_vec=None, scatter=False, colormap='jet', white_background=True, levels=10, do_diag=True, figname=None, show_flag=True, show_axis=False, title='Marginals along coordinate axes', vartitles=None, fig=None, ret_handles=False, mpi_pool=None)[source]

Plot the marginals aligned with the axis

Parameters:
  • mat_points (ndarray) – first dataset

  • mat_points2 (ndarray) – second dataset (optional)

  • dimensions_vec (list of int) – list of dimensions to be displayed. Default 0: display 10 dimensions at most.

  • range_vec (list of tuple [2]) – range to be displayed.

  • scatter (bool) – whether to plot a scatter plots instead of densities

  • colormap (str) – colormap to be used

  • white_background (bool) – whether to have a white background of to use the last layer of the colormap

  • levels (int or list) – number of levels to be displayed or list of values defining the levels.

  • do_diag (bool) – whether to include the one dimensional marginals on the diagonal

  • numPointsXax (int) – number of points for each axis.

  • numCont (int) – number of contours in the contour plots.

  • figname (str) – if defined, store the figure in the provided path.

  • show_flag (bool) – whether to show the plot before returning

  • show_axis (bool) – whether to show the axis of the plot

  • vartitles (list) – list of titles for each variable

  • fig (figure) – matplotlib figure object if one wants to re-use it.

  • mpi_pool (mpi_map.MPI_Pool) – pool of processes

  • ret_handles (bool) – whether to return the axes handles

Returns:

(fig, [list]) – figure handle and dictionary of handles

TransportMaps.Diagnostics.Plotting.plotAlignedScatters(mat_points, dimensions_vec=0, do_diag=True, s=5, bins=10, show_axis=True, axis_fmt=None, figname=None, show_flag=True, show_title=False, title='Marginals along coordinate axes', vartitles=None, fig=None)[source]

Plot the marginals aligned with the axis

Parameters:
  • mat_points (ndarray [\(m,d\)]) – samples

  • dimensions_vec (list of int) – list of dimensions to be displayed. Default 0: display 10 dimensions at most.

  • do_diag (bool) – whether to include the one dimensional marginals on the diagonal

  • s (int) – size of scatter points

  • bins (int) – number of bins for one dimensional plots

  • show_axis (bool) – whether to show the axis

  • axis_fmt (list) – list of matplotlib formatters

  • figname (str) – if defined, store the figure in the provided path.

  • show_flag (bool) – whether to show the plot before returning

  • show_title (bool) – whether to show the title

  • title (str) – title for the figure

  • vartitles (list) – list of titles for each variable

  • fig (figure) – matplotlib figure object if one wants to re-use it.

TransportMaps.Diagnostics.Plotting.plotGradXMap(tmap, base_distribution=None, nsamples=1000, show_cbar=True, show_ticks=True, title='Intensity coefficients map', cmap='Blues', mpi_pool=None, show_flag=True)[source]
TransportMaps.Diagnostics.Plotting.plotLinearityMap(tmap, nlevels=2, threshold=0.01, title='Linearity pattern', cmap='Blues', show_flag=True)[source]
TransportMaps.Diagnostics.Plotting.niceSpy(mat, title=None, cmap='Blues', show_flag=True, vrange=None, show_cbar=True, show_ticks=True)[source]