def radialAverage(arr, center=None):
<EOL>s0, s1 = arr.shape[:<NUM_LIT:2>]<EOL>if center is None:<EOL><INDENT>center = s0/<NUM_LIT:2>, s1/<NUM_LIT:2><EOL><DEDENT>y, x = np.indices((s0, s1))<EOL>r = np.sqrt((x - center[<NUM_LIT:0>])**<NUM_LIT:2> + (y - center[<NUM_LIT:1>])**<NUM_LIT:2>)<EOL>r = r.astype(np.int)<EOL>tbin = np.bincount(r.ravel(), arr.ravel())<EOL>nr = np.bincount(r.ravel())<EOL>radialprofile = tbin/ nr<EOL>return radialprofile<EOL>
radial average a 2darray around a center
if no center is given, take middle