def log(text, array=None):
    """Prints a text message. And, optionally, if a Numpy array is provided it
    prints it's shape, min, and max values.
    """
    if array is not None:
        text = text.ljust(25)
        text += 'shape: {:20}  '.format(str(array.shape))
        if array.size:
            text += 'min: {:10.5f}  max: {:10.5f}'.format(array.min(),
                array.max())
        else:
            text += 'min: {:10}  max: {:10}'.format('', '')
        text += '  {}'.format(array.dtype)
