parseltongue:get_small_source_stats_main
function: get_small_source_stats_main
def get_small_source_stats_main(aips_image, \ source_radius, noise_inner_radius, \ noise_outer_radius, edge_width=10, \ print_level=1): """User version for statistis from an image for a \"small\" source. This function takes an AIPSImage, and returns physical (Jy/beam and Jy) values. Note that the returned position is a C position!!! This function will inspect an image to locate a single, strong, mostly circular-ish source. The source will be found from the strongest pixel in the image, excluding edge pixels. This function will the conpute the integrated source brightness within source_radius pixels of the max pixel, and the RMS noise level for pixels at least noise_radius pixels away from max, again, excluding edge pixels. aips_image I the incoming image as an AIPSImage source_radius I the radius from the center of the source to sum pixels noise_inner_radius I inner radius of an annulus to calculate the noise level noise_outer_radius I outer radius of an annulus to calculate the noise level edge_width I width in pixels to avoid at the edge of the image print_level I how much should the user be informed. 0 None 1 Some It returns information as (max, max_pos, sum, rms), where max is the maximum pixel value, in specific intensity (Jy/beam) max_pos is the position list (array) [y,x] of the maximum pixel position sum is the integrated brightness of the source (may be affected by previous masking of pixels). Note that this function returns the sum in flux density (Jy) units, rms is the RMS value off-source for pixels in radius range noise_inner_radius to noise_outer_radius (Jy/beam) """ # Get a Wizardry image to work on the pixels w = Wizardry.AIPSData.AIPSImage(aips_image.name, aips_image.klass, \ aips_image.disk, aips_image.seq) # make a masked array x = numarray.ma.array(w.pixels.copy(), \ mask=numarray.ma.make_mask_none((aips_image.header.naxis[1],aips_image.header.naxis[0]))) (image_max, image_max_pos, image_sum, image_rms) = \ get_small_source_stats(x, source_radius, noise_inner_radius, noise_outer_radius, print_level) # Now correct the sum for the beam size factor = aips_image.header.bmaj * aips_image.header.bmin / \ math.fabs(aips_image.header.cdelt[1] * aips_image.header.cdelt[0]) image_sum = image_sum / factor if(print_level > 0): print 'Got information from image of:' print 'Max:', image_max print 'Pos:', image_max_pos print 'Sum:', image_sum print 'RMS:', image_rms return (image_max, image_max_pos, image_sum, image_rms)
parseltongue/get_small_source_stats_main.txt · Last modified: 2007/07/09 15:14 by 127.0.0.1