Basic Image calibrations

Sky

The “Sky” describes the “background” in your images—what the images would look like in the absence of noise or astronomical sources.

class tractor.NullSky[source]

A Sky implementation that does nothing; the background level is zero.

class tractor.ConstantSky(val=0)[source]

A simple constant sky level across the whole image.

This sky object has one parameter, the constant level.

The sky level is specified in the same units as the image (“counts”).

addTo(img, scale=1.0)[source]
getConstant()[source]
getParamDerivatives(tractor, img, srcs)[source]
getParamNames()[source]
scale(s)[source]

Scales this sky model by a factor of s.

shift(x0, y0)[source]
shifted(x0, y0)[source]
subtract(con)[source]
toStandardFitsHeader(hdr)[source]
write_fits(filename, hdr=None)[source]

Astrometry (World Coordinate System, WCS)

class tractor.NullWCS(pixscale=1.0, dx=0.0, dy=0.0)[source]

The “identity” WCS – useful when you are using raw pixel positions rather than RA,Decs.

pixscale: [arcsec/pix]

cdAtPixel(x, y)[source]
hashkey()[source]
pixelToPosition(x, y, src=None)[source]
pixscale_at(x, y)[source]
positionToPixel(pos, src=None)[source]
shifted(x, y)[source]
class tractor.ConstantFitsWcs(wcs)[source]

A WCS implementation that wraps a FITS WCS object (with a pixel offset).

Creates a new ConstantFitsWcs given an underlying WCS object.

cdAtPixel(x, y)[source]

Returns the CD matrix at the given x,y pixel position.

(Returns the constant CD matrix elements)

copy()[source]
getX0Y0()[source]
hashkey()[source]
pixelToPosition(x, y, src=None)[source]

Converts floats x, y to a tractor.RaDecPos.

pixel_scale()[source]
pixscale_at(x, y)[source]

Returns the local pixel scale at the given x,*y* pixel coords, in arcseconds per pixel.

positionToPixel(pos, src=None)[source]

Converts an tractor.RaDecPos to a pixel position. Returns: tuple of floats (x, y)

setX0Y0(x0, y0)[source]

Sets the pixel offset to apply to pixel coordinates before putting them through the wrapped WCS. Useful when using a cropped image.

shifted(dx, dy)[source]
toStandardFitsHeader(hdr)[source]
class tractor.TanWcs(wcs, hdu=0)[source]

The WCS object must be an astrometry.util.util.Tan object, or a convincingly quacking duck.

You can also give it a filename and HDU.

Creates a new FitsWcs given a Tan object. To create one of these from a filename and FITS HDU extension,

::

from astrometry.util.util import Tan

fn = ‘my-file.fits’ ext = 0 TanWcs(Tan(fn, ext))

To create one from WCS parameters,

tanwcs = Tan(crval1, crval2, crpix1, crpix2,
cd11, cd12, cd21, cd22, imagew, imageh)

TanWcs(tanwcs)

copy()[source]
static getNamedParams()[source]
getStepSizes(*args, **kwargs)[source]
shifted(dx, dy)[source]

Photometry calibration (“PhotoCal”)

class tractor.NullPhotoCal[source]

The “identity” PhotoCal, to be used with Flux – the Brightness objects are in units of Image counts.

brightnessToCounts(brightness)[source]
class tractor.LinearPhotoCal(scale, band=None)[source]

A PhotoCal, to be used with Flux or Fluxes brightnesses, that simply scales the flux by a fixed factor; the brightness units are proportional to image counts.

Creates a new LinearPhotoCal object that scales the Fluxes by the given factor to produce image counts.

If ‘band’ is not None, will retrieve that band from a Fluxes object.

brightnessToCounts(brightness)[source]
getScale()[source]
toStandardFitsHeader(hdr)[source]
class tractor.MagsPhotoCal(band, zeropoint)[source]

A PhotoCal implementation to be used with zeropoint-calibrated Mags.

Create a new MagsPhotoCal object with a zeropoint in a band.

The Mags objects you use must have band as one of their available bands.

brightnessToCounts(brightness)[source]
copy()[source]
countsToMag(counts)[source]
static getNamedParams()[source]
getStepSizes(*args, **kwargs)[source]

Point-spread function (PSF)

class tractor.NCircularGaussianPSF(sigmas, weights)[source]

A PSF model using N concentric, circular Gaussians.

Creates a new N-Gaussian (concentric, isotropic) PSF.

sigmas: (list of floats) standard deviations of the components

weights: (list of floats) relative weights of the components; given two components with weights 0.9 and 0.1, the total mass due to the second component will be 0.1. These values will be normalized so that the total mass of the PSF is 1.0.

eg, NCircularGaussianPSF([1.5, 4.0], [0.8, 0.2])

amp
applyTo(image)[source]
constantPsfAt(x, y)[source]
copy()[source]
getMixtureOfGaussians(px=None, py=None)[source]
getNSigma()[source]
static getNamedParams()[source]
getPointSourcePatch(px, py, minval=0.0, radius=None, modelMask=None, **kwargs)[source]
getRadius()[source]
getShifted(x0, y0)[source]
hashkey()[source]
mog
mysigmas
myweights
scale(factor)[source]

Returns a new PSF that is factor times wider.

class tractor.GaussianMixturePSF(amp, mean, var)[source]

A PSF model that is a mixture of general 2-D Gaussians (characterized by amplitude, mean, covariance)

or

GaussianMixturePSF(a0,a1,a2, mx0,my0,mx1,my1,mx2,my2,
vxx0,vyy0,vxy0, vxx1,vyy1,vxy1, vxx2,vyy2,vxy2)

amp: np array (size K) of Gaussian amplitudes mean: np array (size K,2) of means var: np array (size K,2,2) of variances

applyTo(image)[source]
computeRadius()[source]
constantPsfAt(x, y)[source]
classmethod fromFitsHeader(clazz, hdr, prefix='')[source]
static fromStamp(stamp, N=3, P0=None, xy0=None, alpha=0.0, emsteps=1000, v2=False, approx=1e-30, v3=False)[source]

optional P0 = (w,mu,var): initial parameter guess.

w has shape (N,) mu has shape (N,2) var (variance) has shape (N,2,2)

optional xy0 = int x0,y0 origin of stamp.

getMixtureOfGaussians(px=None, py=None)[source]
getNSigma()[source]
getPointSourcePatch(px, py, minval=0.0, radius=None, derivs=False, minradius=None, modelMask=None, clipExtent=None, **kwargs)[source]
getRadius()[source]
getShifted(x0, y0)[source]
get_wmuvar()[source]
mogAt(x, y)[source]
scaleBy(factor)[source]
shiftBy(dx, dy)[source]