23 __all__ = [
"approximateWcs"]
36 """A fake unit test case class that will enable us to call 37 assertWcsAlmostEqualOverBBox from the method approximateWcs""" 40 raise UserWarning(
"WCS fitting failed " + msgStr)
44 skyTolerance=0.001*lsst.geom.arcseconds, pixelTolerance=0.02, useTanWcs=False):
45 """Approximate an existing WCS as a TAN-SIP WCS 47 The fit is performed by evaluating the WCS at a uniform grid of points 48 within a bounding box. 52 wcs : `lsst.afw.geom.SkyWcs` 54 bbox : `lsst.geom.Box2I` 55 the region over which the WCS will be fit 59 number of grid points along x 61 number of grid points along y 63 number of times to iterate over fitting 64 skyTolerance : `lsst.geom.Angle` 65 maximum allowed difference in world coordinates between 66 input wcs and approximate wcs (default is 0.001 arcsec) 67 pixelTolerance : `float` 68 maximum allowed difference in pixel coordinates between 69 input wcs and approximate wcs (default is 0.02 pixels) 71 send a TAN version of wcs to the fitter? It is documented to require that, 72 but I don't think the fitter actually cares 76 fitWcs : `lsst.afw.geom.SkyWcs` 80 crpix = wcs.getPixelOrigin()
81 crval = wcs.getSkyOrigin()
82 cdMatrix = wcs.getCdMatrix(crpix)
88 refSchema = afwTable.SimpleTable.makeMinimalSchema()
92 sourceSchema = afwTable.SourceTable.makeMinimalSchema()
101 for x
in np.linspace(bboxd.getMinX(), bboxd.getMaxX(), nx):
102 for y
in np.linspace(bboxd.getMinY(), bboxd.getMaxY(), ny):
104 skyCoord = wcs.pixelToSky(pixelPos)
106 refObj = refCat.addNew()
107 refObj.set(refCoordKey, skyCoord)
109 source = sourceCat.addNew()
110 source.set(sourceCentroidKey, pixelPos)
115 for indx
in range(iterations):
117 tanWcs = sipObject.getNewWcs()
118 fitWcs = sipObject.getNewWcs()
122 maxDiffPix=pixelTolerance)
A floating-point coordinate rectangle geometry.
def assertWcsAlmostEqualOverBBox(testCase, wcs0, wcs1, bbox, maxDiffSky=0.01 *lsst.geom.arcseconds, maxDiffPix=0.01, nx=5, ny=5, msg="WCSs differ")
Custom catalog class for record/table subclasses that are guaranteed to have an ID, and should generally be sorted by that ID.
Lightweight representation of a geometric match between two records.
def approximateWcs(wcs, bbox, order=3, nx=20, ny=20, iterations=3, skyTolerance=0.001 *lsst.geom.arcseconds, pixelTolerance=0.02, useTanWcs=False)
std::shared_ptr< SkyWcs > makeSkyWcs(TransformPoint2ToPoint2 const &pixelsToFieldAngle, lsst::geom::Angle const &orientation, bool flipX, lsst::geom::SpherePoint const &boresight, std::string const &projection="TAN")
Construct a FITS SkyWcs from camera geometry.
CreateWcsWithSip< MatchT > makeCreateWcsWithSip(std::vector< MatchT > const &matches, afw::geom::SkyWcs const &linearWcs, int const order, geom::Box2I const &bbox=geom::Box2I(), int const ngrid=0)
Factory function for CreateWcsWithSip.
A FunctorKey used to get or set celestial coordinates from a pair of lsst::geom::Angle keys...