NAME

rrprof - create radial profiles from an image


SYNOPSIS

rrprof [options] image x y


DESCRIPTION

rrprof operates upon an image, generating radial profiles. It can use an image mask to determine which parts of the image should be used in the profiles and can generate profiles in different regions of the image.

rrprof uses an optional mask image to determine which pixels should be included in the radial profiles (--mask). If a region file (--regfile) or region mask file (--regmask) is specified, it operates separately on the valid pixels in each region, else it operates on all valid pixels.

The pixels are sorted by distance from the specified center (x, y), and then binned. The surface brightness in each bin is calculated, and is output along with its error, the bin boundaries, and other quantities (see Output).

Binning Schemes

rrprof can bin the input data using one of several algorithms. The --bin option is used to specify the scheme and its arguments.

Binning Specification

The specification string can take one of two forms:

concise

In this form the binning parameters are specified via a colon (:) delimited list:

  algorithm:p1:p2:p3

The first element in the list is the name of the binning algorithm, followed by parameter values. The parameter values must occur in the specified order.

For example:

  linear:0:11:10

Some parameters may be optional, but the separating colons must still be specified:

  linear:::10

In the following documentation, square brackets ([, ]) surrounding a parameter name indicate that that parameter is optional. The separating : delimiter may be left out from an optional trailing element if it is not specified.

verbose

This takes the form

  algorithm:k1=v1,k2=v2

For example,

  linear:min=0,max=11,binw=10

In the following documentation, the verbose form is only described if there is some deviation from the above format. The concise form is always described. A parameter is mandatory unless otherwise documented.

Binning Algorithms

The following algorithms are available:

linear

Bin widths are constant. Either the number of bins or the bin width must be specified.

The parameters are:

rmin

The minimum radius at which to start binning. Optional, defaults to 0.

rmax

The maximum radius at which to stop binning. Optional, defaults to no limit.

binw

The bin width. Do not also specify nbins.

nbins

The number of bins. Do not also specify binw.

Binning specification:

concise
  linear:[rmin]:[rmax]:binw
  linear:[rmin]:[rmax]:#nbins

The # character in the latter specification is required to indicate that the parameter is the number of bins.

dratio

Bin widths increase by a geometric factor:

  binw = binw0 * factor**n

where n is the zero-based index of a bin.

The parameters are:

rmin

The minimum radius at which to start binning. Optional, defaults to 0.

rmax

The maximum radius at which to stop binning. Optional, defaults to no limit.

binw0

The initial bin width.

factor

The multiplicative factor

Binning specifications

concise
  dratio:[rmin]:[rmax]:binw0:factor
ratio

Bin bounds increase by a geometric factor. The initial bound may be specified as an absolute radius or as an offset from the minimum:

  Absolute        Relative
  --------------  ---------------------
  r0 * factor**n  rmin + r0 * factor**n

The parameters are:

rmin

The minimum radius at which to start binning. Optional, defaults to 0.

rmax

The maximum radius at which to stop binning. Optional, defaults to no limit.

abs

Whether or not the initial bound is absolute or relative to rmin. In the concise specification the abs parameter is not explicitly specified. Instead, the r0 parameter is prefixed with a + to indicate that the initial bound is relative.

In the verbose form this parameter may take the values yes, no, 1, or 0.

The default is for the initial bound to be absolute.

r0

The initial bound.

Binning specifications:

concise
  ratio:[rmin]:[rmax]:r0:factor
  ratio:[rmin]:[rmax]:+r0:factor

where the + in the latter indicates a relative offset.

snr

Bins are adaptively constructed to achieve a minimum signal-to-noise ratio in each bin.

The parameters are:

rmin

The minimum radius at which to start binning. Optional, defaults to 0.

rmax

The maximum radius at which to stop binning. Optional, defaults to no limit.

min_snr

The minimum Signal to Noise Ratio (SNR) in each bin.

min_npix

The minimum number of pixels in each bin. It must be at least 2.

Optional, defaults to 2.

max_npix

The maximum number of pixels in each bin.

Optional, defaults to no limit.

min_width
max_width

The minimum and maximum widths of a bin, where width is approximately the distance between the first and last pixels in a bin.

Optional, defaults to no limit.

Binning specifications:

concise
  snr:[rmin]:[rmax]:min_snr[:[min_npix][:[max_npix[:[min_width][:max_width]]]]
file

Bins limits are read from an RDB formatted file which contains two columns, rmin and rmax, corresponding to the lower and upper limits of the bins. Bins must be contiguous.

The parameters are:

filename

The name of the file containing the bin limits.

Binning specification:

concise
  file:filename

Errors

Errors (noise) are calculated based upon the following combinations of options:

errimg

If set, this specifies another image (of the same size as the image specified on the command line) whose pixels contain errors. A bin's error is the RSS of the error in each included pixel.

errimg and errcnts

If these are set, the image specified by errimg contains counts; the errors are assumed to be Poisson and are the square root of the pixel values. A bin's error is the RSS of the error in each included pixel.

errcnts

The error is assumed to be Poisson and is the square root of the image specified on the command line. A bin's error is the RSS of the error in each included pixel.

neither errimg nor errcnts is specified.

A bin's error is the standard deviation of the included pixel values.

Background Subtraction

rrprof will subtract the mean counts in an area of the image from the radial profile if the --bgregfile option is specified. At present it is only possible to perform background subtraction if either --errcnts or --errimg options are specified.

Output

rrprof will by default output a separate file containing the surface brightness data for each region (--outfile). By default only bins with a non-zero number of pixels are output (see --output-all-bins).

If the --combine option is specified, all of the output is written to a single file.

By default, the radii will be output in units of pixels. If --runits is specified and the input image has WCS information in its header, the radii will be converted to the specified units. If --rscale is specified, the radii will be multiplied by that scale factor. Note that --runits and --rscale may both be specified, in which case the radii are first converted to the unit specified by --runits and the multiplied by the --rscale factor. The --units option provides a label for the resultant units. It need not be specified if --rscale is not.

The following data are output for each region:

id

The region identifier. This is output only if --combine is set or if the output is sent to the standard output stream and a region file or mask has been specified.

bidx

The unary based bin index.

rmin
rmax

The bin upper and lower bounds.

r

The bin center.

rhw

The half-width of the bin.

sum

The sum of the pixel values in each bin.

sb
sb_err

The surface brightness in the bin (counts/pixel**2) and its error.

n

The number of pixels in the bin.


ARGUMENTS AND OPTIONS

Required Arguments

The following arguments must appear on the command line in the specified order.

image

The FITS image file upon which to operate.

x

The x position about which to generate the profile, in image coordinates.

y

The y position about which to generate the profile, in image coordinates.

Options

Options may be abbreviated. Options which take values may be separated from the values by whitespace or the "=" character.

--mask maskfile

A FITS mask image. It should have the same size as the original image. It is used to determine which pixels in the original image are valid (e.g. on the detector). A non-zero mask value indicates a valid image pixel. Exposure maps can be used here.

--regmask maskfile

A FITS region mask image. This differs from the mask image in that the values of pixels are used to identify individual regions. The mask should be of integer type. Zero valued pixels are ignored. Here's an example of how to create such an image using funimage:

  funimage /dev/null'[TEXT(x:I:256,y:I:256),panda(128,128,0,360,4,0,100,1)]'\
     mask.fits bitpix=8,mask=all

This option may be used in conjunction with --mask, but not with --regfile.

--regfile regionfile

A ds9 region file. It must be in image coordinates. rrprof will use this to generate a mask file matched to the input image file. The maskfile may be saved with the --saveregmask option.

--saveregmask maskfile

If --regfile is also specified, the resulting mask will be written as a FITS image to the specified file.

--bgregfile regionfile

A ds9 region file. It must be in image coordinates. rrprof will use this to extract a background count rate which will be subtracted from the image.

--combine

If specified, surface brightness profiles for all regions are written to a single file. This parameter is automatically set if the output is written to the standard output stream and --regfile or --regmask is specified.

--outfile outputfile

The name of the file to which to write the profile. If there are multiple regions, each profile is written to a separate file; the region number will be appended to the base of the given file name. For example, if the name is foo.rdb, separate profiles will be written to foo_01.rdb, foo_02.rdb, etc.

If this is not specified all output is written to the standard output stream. In this case, if --regfile or --regmask is specified, then --combine is automatically set.

--outputfmt format

The format in which the radial profiles will be written. The available formats are:

  rdb
--errcnts

The error is the square root of the number of counts. If --errimg is specified, than the square root of that image is used. If --errimg is not specified, the square root of the input image is used.

--errimg errorfile

errorfile is a FITS image file containing errors for each pixel. If --errcnts is also specified, the image data are treated as counts. See --errcnts for more information.

--bin=specification

The binning specification. See Binning Schemes for more information. It defaults to

  linear:mbins=10
--binclean

Some of the binning methods result in non-contiguous bins because the bin boundaries are determined from the distances of the included pixels to the image center, which are quantized. This option "cleans" the bins so that they are contiguous by setting the inner boundary of each bin to the outer boundary of the next innermost bin. The inner boundary of the innermost bin is set to 0.

--output-all-bins

Normally only bins with a non-zero number of pixels in them are output. Specifying this option results in all bins being output.

--units text

The units of the output radii. This is merely a label written to the output file. It need not be specified if --rscale is not used.

--runits unit designation

This may be one of

arcmin
arcsec
degree

The input image world coordinate system will be used to convert the pixel size into the specified units.

This may be used in combination with --rscale, in which case this conversion is performed first, and then the scale parameter is applied.

--rscale radius scale factor

A scale factor applied to the bin radii, after the possible units conversion specified by --runits. The --units option may be used in conjunction with this to label the units in the output files.

--version

Output the version and exit.

--usage
--help
--man

Print the usual program information


VERSION

This documents version @VERSION@ of rrprof.


COPYRIGHT AND LICENSE

Copyright 2008-2009 The Smithsonian Astrophysical Observatory. rrprof is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.


AUTHOR

Diab Jerius <djerius@cfa.harvard.edu>