dimage.measure package

Package for measurements on images.

Includes functions for elliptical Petrosian quantities:

  • petro(): calculates elliptical Petrosian quantities
  • apcorr(): calculates aperture corrections to Petrosian quantities
  • curve2image(): utility used by apcorr()
dimage.measure.apcorr(radius, sb, aprad, psf, ba=1.0, phi=0.0, apmin=1e-10, apmax=10000000000.0)[source]

Calculates an aperture correction given elliptical profile

Parameters:

radius : np.float32 array

1-D ndarray with radii in pixels

sb : np.float32 array

1-D ndarray with surface brightness

aprad : int

aperture radius, in pixels

psf : np.float32 array

2-D ndarray with PSF to calculate for

ba : float

axis ratio (b/a) between 0 and 1 (default 1)

phi : float

position angle in deg (default 0); (direction of major axis, defined s.t. tan(phi) = -x/y)

apmin : float

minimum aperture correction (default 1.e-10)

apmax : float

maximum aperture correction (default 1.e+10)

Returns:

apcorr : np.float32

correction factor to apply to PSF-convolved flux for this aperture

Notes

For a North-up (+y), East-left (-x) image, position angle phi definition corresponds to astronomical standard (deg East of North).

dimage.measure.curve2image(radius, sb, nx, ny, ba=1.0, phi=0.0, xcen=None, ycen=None)[source]

Converts an elliptical surface brightness distribution to an image.

Parameters:

radius : np.float32

1-D ndarray with radii

sb : np.float32

1-D ndarray with surface brightness

nx : int

x size of image

ny : int

y size of image

ba : float

axis ratio (b/a) between 0.2 and 1 (default 1); if input < 0.2 then 0.2 is used.

phi : float

position angle in deg (default 0); direction of major axis, is defined such that tan(phi) = -x/y

xcen : float

X center to use (default float(nx)*0.5)

ycen : float

Y center to use (default float(ny)*0.5)

Returns:

image : np.float32

[nx, ny] 2-D array with image in it

Notes

The resulting image has an axis ratio and position angle as input, with the given surface brightness distribution.

For a North-up (+y), East-left (-x) image, position angle phi definition corresponds to astronomical standard (deg East of North).

dimage.measure.petro(image, ivar, ba=1.0, phi=0.0, xcen=None, ycen=None, petroratio0=0.2, npetro=2.0, minpetrorad=2.0, nfilter=11, ofilter=1, petrorad=None, forceflux=None, fixmedian=0.0)[source]

Calculates Petrosian quantities for an image

Parameters:

image : np.float32

2-D ndarray

ba : float

axis ratio (b/a) between 0 and 1 (default 1)

phi : float

position angle in deg (default 0); (direction of major axis, defined such that tan(phi) = -x/y)

petroratio0 : float

limit to use for Petrosian ratio to define radius

minpetrorad : float

minimum Petrosian radius to use (default 10.)

npetro : int

number of Petrosian radii for aperture definition

xcen : float

X center to use (default center of image)

ycen : float

Y center to use (default center of image)

nfilter : int

number of pixels to filter over for surface brightness (must be odd)

ofilter : int

order of Salizsky-Golay filter

petrorad : float

if not None, uses this Petrosian radius by fiat (default None)

forceflux : float

if not None, assumes this for total flux and only calculates r50 and r90

Returns:

filename : str

File name for the corresponding dust model, or None if non-existent.

Notes

For a North-up (+y), East-left (-x) image, position angle phi definition corresponds to astronomical standard (deg East of North).

dimage.measure.sigma(image, sp=10)[source]

Calculates standard deviation in image by checking pixel pairs

Parameters:

image : np.float32

2-D ndarray

sp : int

spacing between pixel pairs (default 10)

Returns:

sigma : np.float32

standard deviation

Notes

Calls dsigma.c in libdimage.so

dimage.measure.simplexy(image, psf_sigma=1.0, plim=8.0, dlim=1.0, saddle=3.0, maxper=1000, maxnpeaks=100000)[source]

Determines positions of stars in an image.

Parameters:

image : np.float32

2-D ndarray

psf_sigma : float

sigma of Gaussian PSF to assume (default 1 pixel)

plim : float

significance to select objects on (default 8)

dlim : float

tolerance for closeness of pairs of objects (default 1 pixel)

saddle : float

tolerance for depth of saddle point to separate sources (default 3 sigma)

maxper : int

maximum number of children per parent (default 1000)

maxnpeaks : int

maximum number of stars to find total (default 100000)

Returns:

(x, y, flux) : (np.float32, np.float32, np.float32)

ndarrays with pixel positions and peak pixel values of stars

Notes

Calls simplexy.c in libdimage.so