galfitools.sky package

Submodules

galfitools.sky.GalfitSky module

galfitools.sky.GalfitSky.galfitSky(imgname, maskfile, mgzpt, scale, X, Y, sky) None[source]

Computes the sky using GALFIT

It uses the FITS image and a mask to compute the to make an initial parameter file to compute sky background by GALFIT

Parameters:
  • imgname (str) – name of the FITS image

  • maskfile (str) – name of the mask image

  • mgzpt (float) – magnitud zeropoint

  • scale (float) – plate scale

  • X (float, float x,y position of center)

  • Y (float, float x,y position of center)

  • sky (float) – initial parameter of sky

Notes

The function returns a GALFIT initial parameter file named sky.txt. The user must run GALFIT with this file to obtain the sky background

galfitools.sky.SkyDs9 module

galfitools.sky.SkyDs9.SkyBox(Image, xpos, ypos, rx, ry, angle, ncol, nrow)[source]

Obtains the flux from a box region in an image

galfitools.sky.SkyDs9.SkyDs9(ImageFile, RegFile, maskfile, outliers=False, mgzpt=25, scale=1)[source]

Computes sky background from a Ds9 region file. The DS9 region file can be a box, ellipses or polygons

Parameters:
  • ImageFile (str) – name of the image file

  • RegFile (str) – name of the DS9 region file This can be a box, ellipse or polygon

  • maskfile (str) – name of the mask image

  • outliers (bool) – if True, it removes the top 80% and bottom 20% of the pixel values.

  • mgzpt (float) – magnitud zeropoint

  • scale (float) – plate scale

Returns:

  • mean (float) – returns the mean of sky background in counts

  • std (float) – returns the standard deviation of sky background in counts

  • ms (float) – returns the surface brightness in mag/’’^2

  • mstd (float) – returns the error of the surface brightness in mag/’’^2

galfitools.sky.SkyDs9.SkyEllip(Image, xpos, ypos, rx, ry, angle, ncol, nrow)[source]

Obtains the flux from an ellipse region in an image

galfitools.sky.SkyDs9.SkyKron(imagemat, x, y, R, theta, ell, xmin, xmax, ymin, ymax)[source]

Obtains the flux from a Kron ellipse within a box defined by: xmin, xmax, ymin, ymax

function called by SkyEllip

galfitools.sky.SkyDs9.SkyPolygon(Image, tupVerts, ncol, nrow)[source]

obtains the flux from a polygon region in an image

galfitools.sky.SkyRing module

class galfitools.sky.SkyRing.SkyCal[source]

Bases: object

Computes the sky background through concentric rings around the objects

Parameters:
  • ImageFile (data image matrix)

  • MaskImg (data mask matrix)

  • xx (object's center position)

  • yy (object's center position)

  • thetadeg (angular position)

  • q (axis ratio)

  • Rinit (initial radius)

  • width (width of the rings)

  • namering (name of the output image to draw ring)

  • ringmask (name of the output ring mask)

  • outliers (if True removes the top 80% and bottom 20% of the) – pixels values

many of the parameters are stored as attributes,
except the following two
e
Type:

ellipticity

NumRings
Type:

number of rings per loop

the main method is GetEllipSky
GetEllipSky : rings
GetRingMask : Obtains the ring selected by index idx
CorSize     : Correct size for image border
GetXYRBorder : gets the coordinates of the border
GetSize : Computes the minimum and maximum pixel

positions that encompass the ellipse.

CorSize(xell, yell)[source]

Correct size for image borders

GetEllipSky(ImageFile, MaskImg, xx, yy, thetadeg, q, Rinit, width, namering, ringmask, outliers=True)[source]

Gradient sky method

GetRingMask(masksky, idx)[source]

Obtains the ring selected by index idx

GetSize(x, y, R, theta, q, ncol, nrow)[source]

this subroutine get the maximun and minimim pixels for Kron and sky ellipse

GetXYRBorder()[source]

this subroutine get the coordinates of the border

galfitools.sky.SkyRing.SkyRing(image, mask, ds9regfile, width, center, outliers=False, mgzpt=25, scale=1)[source]

Computes the sky background using concentric rings

Computes the sky background of an object by identifying the gradient when it becomes positive for the second time along concentric rings around the object. For each ring, the sky mean is estimated and stored in a list where the gradient is calculated.

Parameters:
  • image (str) – name of the image file

  • mask (str) – name of the mask file

  • ds9regfile (str) – DS9 region of the ellipse, which should not cover the entire galaxy. The major axis is used as the initial ring.

  • width (int) – value of the width of the rings in pixels

  • center (bool) – if True, it takes the center at the geometrical middle point of the ellipse. Otherwise, it take the pixel position of the peak’s value

  • outliers (bool) – if True removes the top 80% and bottom 20% of pixels values

  • mgzpt (float) – magnitud zeropoint

  • scale (float) – plate scale

Returns:

  • mean (float) – the sky mean in counts

  • std (float) – the standard deviation of sky in counts

  • median (float) – the median of sky

  • rad (float) – the major axis of the ellipse where the sky was estimated

  • ms (float) – returns the surface brightness in mag/’’^2

  • mstd (float) – returns the error of the surface brightness in mag/’’^2

Module contents