less convoluted
This commit is contained in:
@ -54,21 +54,21 @@ def calc_radial_integration(results, data, keep_pixels, pixel_mask_pf, center_ra
|
|||||||
|
|
||||||
def radial_profile(data, r, nr, keep_pixels=None):
|
def radial_profile(data, r, nr, keep_pixels=None):
|
||||||
if keep_pixels is not None:
|
if keep_pixels is not None:
|
||||||
tbin = np.bincount(r, data[keep_pixels].ravel())
|
data = data[keep_pixels]
|
||||||
else:
|
data = data.ravel()
|
||||||
tbin = np.bincount(r, data.ravel())
|
tbin = np.bincount(r, data)
|
||||||
radialprofile = tbin / nr
|
rp = tbin / nr
|
||||||
return radialprofile
|
return rp
|
||||||
|
|
||||||
def prepare_radial_profile(data, center, keep_pixels=None):
|
def prepare_radial_profile(data, center, keep_pixels=None):
|
||||||
y, x = np.indices((data.shape))
|
y, x = np.indices(data.shape)
|
||||||
r = np.sqrt((x - center[0])**2 + (y - center[1])**2)
|
x0, y0 = center
|
||||||
|
rad = np.sqrt((x - x0)**2 + (y - y0)**2)
|
||||||
if keep_pixels is not None:
|
if keep_pixels is not None:
|
||||||
r = r[keep_pixels].astype(int).ravel()
|
rad = rad[keep_pixels]
|
||||||
else:
|
rad = rad.astype(int).ravel()
|
||||||
r = r.astype(np.int).ravel()
|
nr = np.bincount(rad)
|
||||||
nr = np.bincount(r)
|
return rad, nr
|
||||||
return r, nr
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user