coolest.api.plot_util#

Functions#

plot_voronoi(ax, x, y, z[, neg_values_as_bad, norm, ...])

voronoi_finite_polygons_2d(vor[, radius])

Reconstruct infinite voronoi regions in a 2D diagram to finite

std_colorbar(mappable[, label, fontsize, label_kwargs])

std_colorbar_residuals(mappable, res_map, vmin, vmax)

nice_colorbar(mappable[, ax, position, pad, size, ...])

nice_colorbar_residuals(mappable, res_map, vmin, vmax)

cax_colorbar(fig, cax[, norm, cmap, mappable, label, ...])

scale_bar(ax, size[, unit_suffix, loc, color, fontsize])

plot_regular_grid(ax, title, image_[, ...])

plot_irregular_grid(ax, title, points, xylim[, ...])

set_xy_limits(ax, xylim)

panel_label(ax, text, color, fontsize[, alpha, loc])

normalize_across_images(plotter_list, data_model_specifier)

Calculate the vmin and vmax to normalize the colormap across multiple coolest objects

dmr_corner(tar_path[, output_dir])

Given .tar.gz COOLEST file, plots and optionally saves DMR and corner plots for COOLEST file. Returns dictionary of important extracted information.

Module Contents#

plot_voronoi(ax, x, y, z, neg_values_as_bad=False, norm=None, cmap=None, zmin=None, zmax=None, edgecolor=None, zorder=1)[source]#
voronoi_finite_polygons_2d(vor, radius=None)[source]#

Reconstruct infinite voronoi regions in a 2D diagram to finite regions. This function is taken from: https://gist.github.com/pv/8036995

Parameters:
  • vor (Voronoi) – Input diagram

  • radius (float, optional) – Distance to ‘points at infinity’.

Returns:

  • regions (list of tuples) – Indices of vertices in each revised Voronoi regions.

  • vertices (list of tuples) – Coordinates for revised Voronoi vertices. Same as coordinates of input vertices, with ‘points at infinity’ appended to the end.

std_colorbar(mappable, label=None, fontsize=12, label_kwargs={}, **colorbar_kwargs)[source]#
std_colorbar_residuals(mappable, res_map, vmin, vmax, label=None, fontsize=12, label_kwargs={}, **colorbar_kwargs)[source]#
nice_colorbar(mappable, ax=None, position='right', pad=0.1, size='5%', label=None, fontsize=12, invisible=False, divider_kwargs={}, colorbar_kwargs={}, label_kwargs={})[source]#
nice_colorbar_residuals(mappable, res_map, vmin, vmax, ax=None, position='right', pad=0.1, size='5%', invisible=False, label=None, fontsize=12, divider_kwargs={}, colorbar_kwargs={}, label_kwargs={})[source]#
cax_colorbar(fig, cax, norm=None, cmap=None, mappable=None, label=None, fontsize=12, orientation='horizontal', label_kwargs={})[source]#
scale_bar(ax, size, unit_suffix='"', loc='lower left', color='#FFFFFFBB', fontsize=12)[source]#
plot_regular_grid(ax, title, image_, neg_values_as_bad=False, xylim=None, **imshow_kwargs)[source]#
plot_irregular_grid(ax, title, points, xylim, neg_values_as_bad=False, norm=None, cmap=None, plot_points=False)[source]#
set_xy_limits(ax, xylim)[source]#
panel_label(ax, text, color, fontsize, alpha=0.8, loc='upper left')[source]#
normalize_across_images(plotter_list, data_model_specifier, auto_selection=False, kwargs_source=None, kwargs_lens_mass=None, kwargs_lens_light=None, supersampling=5, convolved=True, super_convolution=True)[source]#

Calculate the vmin and vmax to normalize the colormap across multiple coolest objects

Parameters:
  • plotter_list (list) – List of ModelPlotter objects. May be acquired from MultiModelPlotter object

  • data_model_specifier (list) – List of 0s and 1s; 0 = data, 1 = model. Specifies which set of pixel values should be used when finding global minima and maxima – data or model

  • kwargs_source (dict) – Dictionary with “entity_selection” key, same as used in MultiModelPlotters. “Entity_selection” contains list of lists. Selects source entities. Insert dummy None values into dictionary for data.

  • kwargs_lens_mass (dict) – Dictionary with “entity_selection” key, same as used in MultiModelPlotters. “Entity_selection” contains list of lists. Selects lens mass entities. Insert dummy None values into dictionary for data.

  • kwargs_lens_light (dict) – Dictionary with “entity_selection” key, same as used in MultiModelPlotters. “Entity_selection” contains list of lists. Selects lens light entities. Insert dummy None values into dictionary for data.

  • supersampling (int) – Model image generation param

  • convolved (bool) – Model image generation param

  • super_convolution (bool) – Model image generation param

Returns:

  • vmin (float) – global min value across all coolest objects in plotter_list for the specified data/models

  • vmax (float) – global max value across all coolest objects in plotter_list for the specified data/models

dmr_corner(tar_path, output_dir=None)[source]#

Given .tar.gz COOLEST file, plots and optionally saves DMR and corner plots for COOLEST file. Returns dictionary of important extracted information.

Parameters:
  • tar_path (string) – Path to .tar.gz COOLEST file

  • output_dir (string, optional) – Path to automatically save DMR and corner plot to if specified, by default None

Returns:

results – Contains useful information about the COOLEST objects

Return type:

dictionary