def similarity1DdiffShapedArrays(arr1, arr2, normalize=False):
<EOL>if len(arr1) < len(arr2):<EOL><INDENT>arr1, arr2 = arr2, arr1<EOL><DEDENT>if not len(arr2):<EOL><INDENT>out = sum(arr1)<EOL><DEDENT>else:<EOL><INDENT>out = _calc(arr1, arr2)<EOL><DEDENT>if normalize:<EOL><INDENT>if not len(arr2):<EOL><INDENT>mn = arr1[<NUM_LIT:0>]<EOL>mx = arr1[-<NUM_LIT:1>]<EOL><DEDENT>else:<EOL><INDENT>mn = min(arr1[<NUM_LIT:0>], arr2[<NUM_LIT:0>])<EOL>mx = max(arr1[-<NUM_LIT:1>], arr2[-<NUM_LIT:1>])<EOL><DEDENT>out = out/ (mx - mn)<EOL><DEDENT>return out<EOL>
compare two strictly monotonous increasing 1d arrays
of same or different size
return a similarity index-> 0=identical