@classmethod<EOL><INDENT>def change_normalization(cls, arr, source, target):<DEDENT>
ia.do_assert(ia.is_np_array(arr))<EOL>if isinstance(source, HeatmapsOnImage):<EOL><INDENT>source = (source.min_value, source.max_value)<EOL><DEDENT>else:<EOL><INDENT>ia.do_assert(isinstance(source, tuple))<EOL>ia.do_assert(len(source) == <NUM_LIT:2>)<EOL>ia.do_assert(source[<NUM_LIT:0>] < source[<NUM_LIT:1>])<EOL><DEDENT>if isinstance(target, HeatmapsOnImage):<EOL><INDENT>target = (target.min_value, target.max_value)<EOL><DEDENT>else:<EOL><INDENT>ia.do_assert(isinstance(target, tuple))<EOL>ia.do_assert(len(target) == <NUM_LIT:2>)<EOL>ia.do_assert(target[<NUM_LIT:0>] < target[<NUM_LIT:1>])<EOL><DEDENT>eps = np.finfo(arr.dtype).eps<EOL>mins_same = source[<NUM_LIT:0>] - <NUM_LIT:10>*eps < target[<NUM_LIT:0>] < source[<NUM_LIT:0>] + <NUM_LIT:10>*eps<EOL>maxs_same = source[<NUM_LIT:1>] - <NUM_LIT:10>*eps < target[<NUM_LIT:1>] < source[<NUM_LIT:1>] + <NUM_LIT:10>*eps<EOL>if mins_same and maxs_same:<EOL><INDENT>return np.copy(arr)<EOL><DEDENT>min_source, max_source = source<EOL>min_target, max_target = target<EOL>diff_source = max_source - min_source<EOL>diff_target = max_target - min_target<EOL>arr_0to1 = (arr - min_source) / diff_source<EOL>arr_target = min_target + arr_0to1 * diff_target<EOL>return arr_target<EOL>
Change the value range of a heatmap from one min-max to another min-max.

E.g. the value range may be changed from min=0.0, max=1.0 to min=-1.0, max=1.0.

Parameters
----------
arr : ndarray
    Heatmap array to modify.

source : tuple of float
    Current value range of the input array, given as (min, max), where both are float values.

target : tuple of float
    Desired output value range of the array, given as (min, max), where both are float values.

Returns
-------
arr_target : ndarray
    Input array, with value range projected to the desired target value range.