def edge_average(a):
if len(np.ravel(a)) < <NUM_LIT:2>:<EOL><INDENT>return float(a[<NUM_LIT:0>])<EOL><DEDENT>else:<EOL><INDENT>top_edge = a[<NUM_LIT:0>]<EOL>bottom_edge = a[-<NUM_LIT:1>]<EOL>left_edge = a[<NUM_LIT:1>:-<NUM_LIT:1>,<NUM_LIT:0>]<EOL>right_edge = a[<NUM_LIT:1>:-<NUM_LIT:1>,-<NUM_LIT:1>]<EOL>edge_sum = np.sum(top_edge) + np.sum(bottom_edge) + np.sum(left_edge) + np.sum(right_edge)<EOL>num_values = len(top_edge)+len(bottom_edge)+len(left_edge)+len(right_edge)<EOL>return float(edge_sum)/num_values<EOL><DEDENT>
Return the mean value around the edge of an array.