def distance_to_contact(D, alpha=<NUM_LIT:1>):
if callable(alpha):<EOL><INDENT>distance_function = alpha<EOL><DEDENT>else:<EOL><INDENT>try:<EOL><INDENT>a = np.float64(alpha)<EOL>def distance_function(x):<EOL><INDENT>return <NUM_LIT:1> / (x ** (<NUM_LIT:1> / a))<EOL><DEDENT><DEDENT>except TypeError:<EOL><INDENT>print("<STR_LIT>")<EOL>raise<EOL><DEDENT>except ZeroDivisionError:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT><DEDENT>m = np.max(distance_function(D[D != <NUM_LIT:0>]))<EOL>M = np.zeros(D.shape)<EOL>M[D != <NUM_LIT:0>] = distance_function(D[D != <NUM_LIT:0>])<EOL>M[D == <NUM_LIT:0>] = m<EOL>return M<EOL>
Compute contact matrix from input distance matrix. Distance values of
    zeroes are given the largest contact count otherwise inferred non-zero
    distance values.