sp_validation.plots¶
PLOTS.
- Name:
plots.py
- Description:
This script contains methods for plots.
- Author:
Martin Kilbinger
- class SquareRootScale(axis, **kwargs)[source]¶
Bases:
ScaleBaseScaleBase class for generating square root scale.
Usage example: axis.set_yscale(‘squareroot’)
- name = 'squareroot'¶
- set_default_locators_and_formatters(axis)[source]¶
Set the locators and formatters of axis to instances suitable for this scale.
- limit_range_for_scale(vmin, vmax, minpos)[source]¶
Return the range vmin, vmax, restricted to the domain supported by this scale (if any).
minpos should be the minimum positive value in the data. This is used by log scales to determine a minimum value.
- class SquareRootTransform(shorthand_name=None)[source]¶
Bases:
Transform- input_dims = 1¶
The number of input dimensions of this transform. Must be overridden (with integers) in the subclass.
- output_dims = 1¶
The number of output dimensions of this transform. Must be overridden (with integers) in the subclass.
- is_separable = True¶
True if this transform is separable in the x- and y- dimensions.
- transform_non_affine(a)[source]¶
Apply only the non-affine part of this transformation.
transform(values)is always equivalent totransform_affine(transform_non_affine(values)).In non-affine transformations, this is generally equivalent to
transform(values). In affine transformations, this is always a no-op.- Parameters:
values (array) – The input values as an array of length
input_dimsor shape (N,input_dims).- Returns:
The output values as an array of length
output_dimsor shape (N,output_dims), depending on the input.- Return type:
array
- inverted()[source]¶
Return the corresponding inverse transformation.
It holds
x == self.inverted().transform(self.transform(x)).The return value of this method should be treated as temporary. An update to self does not cause a corresponding update to its inverted copy.
- has_inverse = True¶
True if this transform has a corresponding inverse transform.
- class InvertedSquareRootTransform(shorthand_name=None)[source]¶
Bases:
Transform- input_dims = 1¶
The number of input dimensions of this transform. Must be overridden (with integers) in the subclass.
- output_dims = 1¶
The number of output dimensions of this transform. Must be overridden (with integers) in the subclass.
- is_separable = True¶
True if this transform is separable in the x- and y- dimensions.
- transform(a)[source]¶
Apply this transformation on the given array of values.
- Parameters:
values (array-like) – The input values as an array of length
input_dimsor shape (N,input_dims).- Returns:
The output values as an array of length
output_dimsor shape (N,output_dims), depending on the input.- Return type:
array
- inverted()[source]¶
Return the corresponding inverse transformation.
It holds
x == self.inverted().transform(self.transform(x)).The return value of this method should be treated as temporary. An update to self does not cause a corresponding update to its inverted copy.
- has_inverse = True¶
True if this transform has a corresponding inverse transform.
- plot_spatial_density(ra, dec, title, x_label, y_label, cbar_label, out_path, n_grid=1000, verbose=False)[source]¶
Plot Spatial Density.
Plot spatial density distribution of objects.
- Parameters:
ra (array of float) – coordinates
dec (array of float) – coordinates
title (string) – plot title
x_label (string) – x-/y-axis label
y_label (string) – x-/y-axis label
cbar_label (string) – color bar label
out_path (string) – output file path
n_grid (int, optional, default=1000) – number of hex grid points
verbose (bool, optional, default=False) – verbose output if True
- plot_map(m, ra, dec, min_x, max_x, min_y, max_y, Nx, Ny, title, out_path, vlim=None, grid=True, clusters=None, map_cut_coords=None, dpi=100, colorbar=True)[source]¶
Plot Map.
Plots 2D map.
- Parameters:
m (2D array of float) – map
ra (array of float) – coordinates, for axis ticks
dec (array of float) – coordinates, for axis ticks
title (string) – plot title
out_path (string) – output file path
vlim (array(2) of float, optional, default=None) – limits of map values, if not given compute from map
grid (bool, optional) – if True (default) plot grid lines
clusters – dictionary of cluster information, optional, default=None
- plot_binned_one(ax, quantity, bin_edges_x, bin_edges_y, vmin=None, vmax=None, title=None, xlabel=None, ylabel=None)[source]¶
- plot_binned(quantities, key, bin_edges_x, bin_edges_y, title_base, vmin=None, vmax=None, xlabel=None, ylabel=None)[source]¶