NRAO Home > CASA > CASA Toolkit Reference Manual
image.getprofile - Function

1.1.1 Get values and mask for a one dimensional profile along a specified image axis by applying an aggregate function.


Description

This application returns information on a one-dimensional profile taken along a specified image axis. The region of interest is collapsed (a’la ia.collapse() along all axes orthogonal to the one specified, and) the specified aggregate function is applied to these pixels to generate the returned values.

The aggregate function must be one of the functions supported by ia.collapse; ie, ’flux’, ’max’, ’mean’, ’median’, ’min’, ’rms’, ’stdev’, ’sum’, and ’variance’. See the help for ia.collapse() for details regarding these functions. Minimum match and case insenstivity is supported.

One may specify the unit of the returned coordinate values. Unless axis is the spectral axis, unit must be conformant with the corresponding axis unit in the image coordinate system or it must be ’pixel’ which signifies, pixel, rather than world, coordinate values should be calculated. If axis is the spectral axis, unit may be a velocity unit (assuming the coordinate system has a rest frequency or restfreq is specified) or a length unit. In these cases, the returned coordinate values will be converted to velocity or wavelength, respectively.

The parameter spectype may be used to specify the velocity or wavelength type for the returned coordinate values if profile is taken along spectral axis. Supported (minimum match, case insensitive) values) are ”relativistic velocity”, ”beta”, ”radio velocity”, ”optical velocity”, ”wavelength”, ”air wavelength”, ”default”. The ”default” value is equivalent to ”relativistic” if unit is a velocity unit or ”wavelength” if unit is a length unit.

The restfreq parameter allows one to set the rest frequency for the coordinates to be returned if axis is the spectral axis and unit is a velocity unit. If blank, the rest frequency associated with the image coordinate system is used.

The frame allows one to specify which kinematic reference frame that the returned coordinate values should be calculated in. It is only used if axis is the spectral axis and unit is unspecified or is specified and a frequency unit. If blank, the reference frame associated with the image coordinate system is used.

The returned dictionary contains the keys:

values: one-dimensional array along the specified axis containing values resulting from applying the specified aggregate function to corresponding pixels at the same location along that axis. mask: one-dimensional array of booleans of the resulting mask after applying the aggregate function, formed in the same way as that formed by ia.collapse. coords One-dimensional array of corresponding coordinate values along the specified axis in the specified unit (or the unit associated with the axis in the image coordinate system if unspecified). xUnit The unit used for calculating the values the coords array.

Arguments





Inputs

axis

Axis along which to determine profile. Must be specified

allowed:

int

Default:

-1

function

Aggregate function to apply for collapse along axes orthogonal to specified axis.

allowed:

string

Default:

mean

region

Region selection. Default is to use the full image.

allowed:

any

Default:

variant

mask

Mask to use. Default is none.

allowed:

string

Default:

unit

Unit of the returned abscissa values. Must either be ’pixel’ or be conformant with image axis unit unless axis is the spectral axis. Default is the unit associated with axis in the image coordinate system.

allowed:

string

Default:

stretch

Stretch the mask if necessary and possible? Default False

allowed:

bool

Default:

false

spectype

Velocity or wavelength type if profile taken along spectral axis. Supported (minimum match, case insensitive) values are ”relativistic velocity”, ”beta”, ”radio velocity”, ”optical velocity”, ”wavelength”, ”air wavelength”, ”default”.

allowed:

string

Default:

default

restfreq

Rest frequency to use when calculating coordinate values. Used only if axis is spectral axis and unit is not the unit associated with the axis in the coordinate system. Empty string means use the rest frequency associated with the image coordinate system

allowed:

any

Default:

variant

frame

Reference frame to use when calculating coordinate values. Used only if axis is spectral axis and unit is not the unit associated with the axis in the coordinate system. Empty string means use the reference frame associated with the image coordinate system

allowed:

string

Default:

logfile

File to which to write profile.

allowed:

string

Default:

Returns
record

Example

 
ia.open(’myimage’)  
# get the max pixel values along axis 2  
res = ia.getprofile(axis=2, function=’max’)  
 
# axis 2 is the spectral axis. Get the minimum pixel values along this axis  
# and specify that the returned coordinate values should be optical velocities  
# in km/s  
 
res2 = ia.getprofile(axis=2, function=’min’, unit=’km/s’, spectype=’optical’)  
 
ia.done()  
 

__________________________________________________________________


More information about CASA may be found at the CASA web page

Copyright © 2016 Associated Universities Inc., Washington, D.C.

This code is available under the terms of the GNU General Public Lincense


Home | Contact Us | Directories | Site Map | Help | Privacy Policy | Search