import os from taskinit import * from math import * import string def radplot(img, wc, maxrad, rs, azav, runit, title, rlab, azavlab): """ Plots the azimuthal average of an image about a point. For now it assumes you are only interested in the first plane of img, and that it has square pixels. Keyword arguments: img -- Name of image to made a radial plot of. wc -- World coordinate to use as center. rs -- An optional list or array of radii to use instead of calculating. azav -- An optional list or array of azimuthal averages to use instead of calculating. blunit -- Unit of the radii. Derived from img if necessary. title -- Title for the plot. Defaults to 'Azimuthal average of %s about %s' % (img, wc). rlab -- Label for the radial axis. Defaults to 'Radius (runit)'. azavlab -- Label for the azimuthal average axis. Defaults to 'Azimuthal average (azavunit)' """ try: if rs == None or azav == None: rs, azav, wts, runit = radav(img, wc, maxrad) pl.clf() pl.ion() pl.plot(rs, azav) ia.open(img) imgsummary = ia.summary() ia.close() imgsummary = imgsummary['header'] if azavlab == None: azavlab = 'Azimuthal average (%s)' % imgsummary['unit'] pl.ylabel(azavlab) if rlab == None: rlab = 'Radius' if runit == None: runit = imgsummary['axisunits'][0] pl.xlabel('%s (%s)' % (rlab, runit)) if title == None: title = 'Azimuthal average of %s about %s' % (img, wc) pl.title(title) except Exception, instance: print '***Error***', instance raise Exception, instance