def rmp_rng(aryVls, varNewMin, varNewMax, varOldThrMin=None,<EOL>varOldAbsMax=None):
if varOldThrMin is None:<EOL><INDENT>varOldMin = aryVls.min()<EOL><DEDENT>else:<EOL><INDENT>varOldMin = varOldThrMin<EOL><DEDENT>if varOldAbsMax is None:<EOL><INDENT>varOldMax = aryVls.max()<EOL><DEDENT>else:<EOL><INDENT>varOldMax = varOldAbsMax<EOL><DEDENT>aryNewVls = np.empty((aryVls.shape), dtype=aryVls.dtype)<EOL>for ind, val in enumerate(aryVls):<EOL><INDENT>aryNewVls[ind] = (((val - varOldMin) * (varNewMax - varNewMin)) /<EOL>(varOldMax - varOldMin)) + varNewMin<EOL><DEDENT>return aryNewVls<EOL>
Remap values in an array from one range to another.

    Parameters
    ----------
    aryVls : 1D numpy array
        Array with values that need to be remapped.
    varNewMin : float
        Desired minimum value of new, remapped array.
    varNewMax : float
        Desired maximum value of new, remapped array.
    varOldThrMin : float
        Theoretical minimum of old distribution. Can be specified if this
        theoretical minimum does not occur in empirical distribution but
        should be considered nontheless.
    varOldThrMin : float
        Theoretical maximum of old distribution. Can be specified if this
        theoretical maximum does not occur in empirical distribution but
        should be considered nontheless.

    Returns
    -------
    aryVls : 1D numpy array
        Array with remapped values.