# Commits

committed 5bd2ed6

Moving stuff around, renaming

• Participants
• Parent commits 5f03899

# Files changed (2)

-import numpy as np
-
-    yind,xind = np.indices(image.shape)
-    dist = np.sqrt((xind-x)**2+(yind-y)**2)
-    return dist
-
-''' Do a radial profile of image 'im' centered on (cx,cy), weighted by
-image 'weight'.  imwidth can be used to rescale the returned radius
-array by some physically relevant distance in units of fraction of the
-image width.  if average is False, it will return a straight sum of
-the radial bins, and not average them either by pixel number or the
-weight field.
-'''
-def rprof(im,cx,cy,weight=None,imwidth=1.0,average=True):
-    ind = np.argsort(r.flat) # indices for sorted radii (need to use with im)
-    sr = r.flat[ind] # the sorted radii
-    sim = im.flat[ind] # image values sorted by radii
-    if average:
-        if weight is not None:
-            sw = weight.flat[ind] # weight values sorted by radii
-            sim *= sw
-    ri = sr.astype(np.int16) # integer part of radii (bin size = 1)
-    # The particularly tricky part, must average values within each radii bin
-    # Start by looking for where radii change values
-    deltar = ri[1:] - ri[:-1] # assume all radii represented (more work if not)
-    rind = np.where(deltar)[0] # location of changed radius
-    nr = rind[1:] - rind[:-1] # number of pixels in radius bin
-    if average:
-        if weight is not None:
-            cssw = np.cumsum(sw, dtype=np.float64)
-    csim = np.cumsum(sim, dtype=np.float64) # cumulative sum for increasing radius
-    # total in one bin is simply difference between cumulative sum for adjacent bins
-    tbin = csim[rind[1:]] - csim[rind[:-1]] # sum for image values in radius bins
-
-    maxr = np.max(r)*(imwidth)/(im.shape[0])
-
-    if average:
-        if weight is not None:
-            twbin = cssw[rind[1:]] - cssw[rind[:-1]]
-        radialprofile = tbin/nr # compute average for each bin
-    else:
-

# File rprof2d.py

+import numpy as np
+
+    yind,xind = np.indices(image.shape)
+    dist = np.sqrt((xind-x)**2+(yind-y)**2)
+    return dist
+
+''' Do a radial profile of image 'im' centered on (cx,cy), weighted by
+image 'weight'.  imwidth can be used to rescale the returned radius
+array by some physically relevant distance in units of fraction of the
+image width.  if average is False, it will return a straight sum of
+the radial bins, and not average them either by pixel number or the
+weight field.
+'''
+def rprof2d(im,cx,cy,weight=None,imwidth=1.0,average=True):
+    ind = np.argsort(r.flat) # indices for sorted radii (need to use with im)
+    sr = r.flat[ind] # the sorted radii
+    sim = im.flat[ind] # image values sorted by radii
+    if average:
+        if weight is not None:
+            sw = weight.flat[ind] # weight values sorted by radii
+            sim *= sw
+    ri = sr.astype(np.int16) # integer part of radii (bin size = 1)
+    # The particularly tricky part, must average values within each radii bin
+    # Start by looking for where radii change values
+    deltar = ri[1:] - ri[:-1] # assume all radii represented (more work if not)
+    rind = np.where(deltar)[0] # location of changed radius
+    nr = rind[1:] - rind[:-1] # number of pixels in radius bin
+    if average:
+        if weight is not None:
+            cssw = np.cumsum(sw, dtype=np.float64)
+    csim = np.cumsum(sim, dtype=np.float64) # cumulative sum for increasing radius
+    # total in one bin is simply difference between cumulative sum for adjacent bins
+    tbin = csim[rind[1:]] - csim[rind[:-1]] # sum for image values in radius bins
+
+    maxr = np.max(r)*(imwidth)/(im.shape[0])