def build_fit_matrix(rot, scale=1):
    '\n    Create an affine transformation matrix (2x2) from the provided rotation\n    angle(s) and scale(s):\n\n    .. math::\n\n        M = \\begin{bmatrix}\n                s_x \\cos(\\theta_x) & s_y \\sin(\\theta_y) \\\\\n                -s_x \\sin(\\theta_x) & s_y \\cos(\\theta_y)\n            \\end{bmatrix}\n\n    Parameters\n    ----------\n    rot: tuple, float, optional\n        Rotation angle in degrees. Two values (one for each axis) can be\n        provided as a tuple.\n\n    scale: tuple, float, optional\n        Scale of the liniar transformation. Two values (one for each axis)\n        can be provided as a tuple.\n\n    Returns\n    -------\n    matrix: numpy.ndarray\n       A 2x2 `numpy.ndarray` containing coefficients of a liniear\n       transformation.\n\n    '
    if hasattr(rot, '__iter__'):
        (rx, ry) = map(np.deg2rad, rot)
    else:
        rx = ry = np.deg2rad(float(rot))
    if hasattr(scale, '__iter__'):
        (sx, sy) = scale
    else:
        sx = sy = float(scale)
    matrix = np.array([[(sx * np.cos(rx)), (sy * np.sin(ry))], [((- sx) * np.sin(rx)), (sy * np.cos(ry))]])
    return matrix
Create an affine transformation matrix (2x2) from the provided rotation
angle(s) and scale(s):

.. math::

    M = \begin{bmatrix}
            s_x \cos(\theta_x) & s_y \sin(\theta_y) \\
            -s_x \sin(\theta_x) & s_y \cos(\theta_y)
        \end{bmatrix}

Parameters
----------
rot: tuple, float, optional
    Rotation angle in degrees. Two values (one for each axis) can be
    provided as a tuple.

scale: tuple, float, optional
    Scale of the liniar transformation. Two values (one for each axis)
    can be provided as a tuple.

Returns
-------
matrix: numpy.ndarray
   A 2x2 `numpy.ndarray` containing coefficients of a liniear
   transformation.
def build_fit_matrix(rot, scale=1):
    '\n    Create an affine transformation matrix (2x2) from the provided rotation\n    angle(s) and scale(s):\n\n    .. math::\n\n        M = \\begin{bmatrix}\n                s_x \\cos(\\theta_x) & s_y \\sin(\\theta_y) \\\\\n                -s_x \\sin(\\theta_x) & s_y \\cos(\\theta_y)\n            \\end{bmatrix}\n\n    Parameters\n    ----------\n    rot: tuple, float, optional\n        Rotation angle in degrees. Two values (one for each axis) can be\n        provided as a tuple.\n\n    scale: tuple, float, optional\n        Scale of the liniar transformation. Two values (one for each axis)\n        can be provided as a tuple.\n\n    Returns\n    -------\n    matrix: numpy.ndarray\n       A 2x2 `numpy.ndarray` containing coefficients of a liniear\n       transformation.\n\n    '
    if hasattr(rot, '__iter__'):
        (rx, ry) = map(np.deg2rad, rot)
    else:
        rx = ry = np.deg2rad(float(rot))
    if hasattr(scale, '__iter__'):
        (sx, sy) = scale
    else:
        sx = sy = float(scale)
    matrix = np.array([[(sx * np.cos(rx)), (sy * np.sin(ry))], [((- sx) * np.sin(rx)), (sy * np.cos(ry))]])
    return matrix