Compute azimuthal statistics


radial_data.radial_data(data, annulus_width=1, working_mask=None, x=None, y=None, rmax=None)[source]

r = radial_data(data,annulus_width,working_mask,x,y)

A function to reduce an image to a radial cross-section.

data - whatever data you are radially averaging. Data is

binned into a series of annuli of width ‘annulus_width’ pixels.

annulus_width - width of each annulus. Default is 1.

working_mask - array of same size as ‘data’, with zeros at

whichever ‘data’ points you don’t want included in the radial data computations.

x,y - coordinate system in which the data exists (used to set

the center of the data). By default, these are set to integer meshgrids

rmax – maximum radial value over which to compute statistics

r - a data structure containing the following

statistics, computed across each annulus:

.r - the radial coordinate used (outer edge of annulus)

.mean - mean of the data in the annulus

.sum - the sum of all enclosed values at the given radius

.std - standard deviation of the data in the annulus

.median - median value in the annulus

.max - maximum value in the annulus

.min - minimum value in the annulus

.numel - number of elements in the annulus

import numpy as np
import pylab as py
import radial_data as rad

# Create coordinate grid
npix = 50.
x = np.arange(npix) - npix/2.
xx, yy = np.meshgrid(x, x)
r = np.sqrt(xx**2 + yy**2)
fake_psf = np.exp(-(r/5.)**2)
noise = 0.1 * np.random.normal(0, 1, r.size).reshape(r.shape)
simulation = fake_psf + noise

rad_stats = rad.radial_data(simulation, x=xx, y=yy)

py.plot(rad_stats.r, rad_stats.mean / rad_stats.std)
py.xlabel('Radial coordinate')
py.ylabel('Signal to Noise')

Previous topic

Aperture and simple PSF-fitting photometrymem

Next topic

Spitzer/MIPS 24 micron Analysis Routines

This Page