colourlab.misc module

misc: Various auxilliary functions, part of the colourlab package

Copyright (C) 2013-2016 Ivar Farup

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

colourlab.misc.plot_ellipses(ellipses, axis=None, alpha=1, facecolor=[0.5, 0.5, 0.5], edgecolor=[0, 0, 0], fill=False)[source]

Plot the list of ellipses on the given axis.

Parameters:
  • ellipses (list) – List of Ellipse objects.
  • axis (AxesSubplot) – Axis on which to plot the ellipses.
  • alpha (float) – Alpha for colour blending.
  • facecolor (ndarray) – RGB array of the ellipse faces.
  • edgecolor (ndarray) – RGB array of the ellipse edges.
  • fill (bool) – Fill the ellipses or not.
colourlab.misc.safe_div(a, b, fill=1.0)[source]

Divide the two arrays, filling with fill value where denominator is zero.

Parameters:
  • a (ndarray) – The nominator
  • b (ndarray) – The denominator
  • fill (float) – The number to fill where the denominator is zeros
Returns:

res – The quotient a / b filled with fill value where b == 0-

Return type:

ndarray