LSSTApplications  18.0.0+106,18.0.0+50,19.0.0,19.0.0+1,19.0.0+10,19.0.0+11,19.0.0+13,19.0.0+17,19.0.0+2,19.0.0-1-g20d9b18+6,19.0.0-1-g425ff20,19.0.0-1-g5549ca4,19.0.0-1-g580fafe+6,19.0.0-1-g6fe20d0+1,19.0.0-1-g7011481+9,19.0.0-1-g8c57eb9+6,19.0.0-1-gb5175dc+11,19.0.0-1-gdc0e4a7+9,19.0.0-1-ge272bc4+6,19.0.0-1-ge3aa853,19.0.0-10-g448f008b,19.0.0-12-g6990b2c,19.0.0-2-g0d9f9cd+11,19.0.0-2-g3d9e4fb2+11,19.0.0-2-g5037de4,19.0.0-2-gb96a1c4+3,19.0.0-2-gd955cfd+15,19.0.0-3-g2d13df8,19.0.0-3-g6f3c7dc,19.0.0-4-g725f80e+11,19.0.0-4-ga671dab3b+1,19.0.0-4-gad373c5+3,19.0.0-5-ga2acb9c+2,19.0.0-5-gfe96e6c+2,w.2020.01
LSSTDataManagementBasePackage
Functions
lsst.afw.geom.utils Namespace Reference

Functions

def wcsAlmostEqualOverBBox (wcs0, wcs1, bbox, maxDiffSky=0.01 *lsst.geom.arcseconds, maxDiffPix=0.01, nx=5, ny=5)
 
def assertWcsAlmostEqualOverBBox (testCase, wcs0, wcs1, bbox, maxDiffSky=0.01 *lsst.geom.arcseconds, maxDiffPix=0.01, nx=5, ny=5, msg="WCSs differ")
 
def makeEndpoints (testCase)
 

Function Documentation

◆ assertWcsAlmostEqualOverBBox()

def lsst.afw.geom.utils.assertWcsAlmostEqualOverBBox (   testCase,
  wcs0,
  wcs1,
  bbox,
  maxDiffSky = 0.01*lsst.geom.arcseconds,
  maxDiffPix = 0.01,
  nx = 5,
  ny = 5,
  msg = "WCSs differ" 
)
Assert that two :py:class:`WCS <lsst.afw.geom.SkyWcs>` are almost equal over a grid of pixel positions

Compare pixelToSky and skyToPixel for two WCS over a rectangular grid of pixel positions.
If the WCS are too divergent at any point, call testCase.fail; the message describes
the largest error measured in pixel coordinates (if sky to pixel error was excessive)
and sky coordinates (if pixel to sky error was excessive) across the entire pixel grid.

Parameters
----------
testCase : `unittest.TestCase`
    test case the test is part of; an object supporting one method: fail(self, msgStr)
wcs0 : `lsst.afw.geom.SkyWcs`
    WCS 0
wcs1 : `lsst.afw.geom.SkyWcs`
    WCS 1
bbox : `lsst.geom.Box2I` or `lsst.geom.Box2D`
    boundaries of pixel grid over which to compare the WCSs
maxDiffSky : `lsst.geom.Angle`
    maximum separation between sky positions computed using Wcs.pixelToSky
maxDiffPix : `float`
    maximum separation between pixel positions computed using Wcs.skyToPixel
nx : `int`
    number of points in x for the grid of pixel positions
ny : `int`
    number of points in y for the grid of pixel positions
msg : `str`
    exception message prefix; details of the error are appended after ": "

Definition at line 155 of file utils.py.

155  maxDiffPix=0.01, nx=5, ny=5, msg="WCSs differ"):
156  """Assert that two :py:class:`WCS <lsst.afw.geom.SkyWcs>` are almost equal over a grid of pixel positions
157 
158  Compare pixelToSky and skyToPixel for two WCS over a rectangular grid of pixel positions.
159  If the WCS are too divergent at any point, call testCase.fail; the message describes
160  the largest error measured in pixel coordinates (if sky to pixel error was excessive)
161  and sky coordinates (if pixel to sky error was excessive) across the entire pixel grid.
162 
163  Parameters
164  ----------
165  testCase : `unittest.TestCase`
166  test case the test is part of; an object supporting one method: fail(self, msgStr)
167  wcs0 : `lsst.afw.geom.SkyWcs`
168  WCS 0
169  wcs1 : `lsst.afw.geom.SkyWcs`
170  WCS 1
171  bbox : `lsst.geom.Box2I` or `lsst.geom.Box2D`
172  boundaries of pixel grid over which to compare the WCSs
173  maxDiffSky : `lsst.geom.Angle`
174  maximum separation between sky positions computed using Wcs.pixelToSky
175  maxDiffPix : `float`
176  maximum separation between pixel positions computed using Wcs.skyToPixel
177  nx : `int`
178  number of points in x for the grid of pixel positions
179  ny : `int`
180  number of points in y for the grid of pixel positions
181  msg : `str`
182  exception message prefix; details of the error are appended after ": "
183  """
184  errMsg = _compareWcsOverBBox(
185  wcs0=wcs0,
186  wcs1=wcs1,
187  bbox=bbox,
188  maxDiffSky=maxDiffSky,
189  maxDiffPix=maxDiffPix,
190  nx=nx,
191  ny=ny,
192  doShortCircuit=False,
193  )
194  if errMsg:
195  testCase.fail("%s: %s" % (msg, errMsg))
196 
197 
198 @lsst.utils.tests.inTestCase

◆ makeEndpoints()

def lsst.afw.geom.utils.makeEndpoints (   testCase)
Generate a representative sample of ``Endpoints``.

Parameters
----------
testCase : `unittest.TestCase`
    test case the test is part of; an object supporting one method: fail(self, msgStr)

Returns
-------
endpoints : `list`
    List of endpoints with enough diversity to exercise ``Endpoint``-related
    code. Each invocation of this method shall return independent objects.

Definition at line 199 of file utils.py.

199 def makeEndpoints(testCase):
200  """Generate a representative sample of ``Endpoints``.
201 
202  Parameters
203  ----------
204  testCase : `unittest.TestCase`
205  test case the test is part of; an object supporting one method: fail(self, msgStr)
206 
207  Returns
208  -------
209  endpoints : `list`
210  List of endpoints with enough diversity to exercise ``Endpoint``-related
211  code. Each invocation of this method shall return independent objects.
212  """
213  return [GenericEndpoint(n) for n in range(1, 6)] + \
214  [Point2Endpoint(), SpherePointEndpoint()]
215 
def makeEndpoints(testCase)
Definition: utils.py:199

◆ wcsAlmostEqualOverBBox()

def lsst.afw.geom.utils.wcsAlmostEqualOverBBox (   wcs0,
  wcs1,
  bbox,
  maxDiffSky = 0.01*lsst.geom.arcseconds,
  maxDiffPix = 0.01,
  nx = 5,
  ny = 5 
)
Test if two :py:class:`WCS <lsst.afw.geom.SkyWcs>` are almost equal over a grid of pixel positions.

Parameters
----------
wcs0 : `lsst.afw.geom.SkyWcs`
    WCS 0
wcs1 : `lsst.afw.geom.SkyWcs`
    WCS 1
bbox : `lsst.geom.Box2I` or `lsst.geom.Box2D`
    boundaries of pixel grid over which to compare the WCSs
maxDiffSky : `lsst.geom.Angle`
    maximum separation between sky positions computed using Wcs.pixelToSky
maxDiffPix : `float`
    maximum separation between pixel positions computed using Wcs.skyToPixel
nx : `int`
    number of points in x for the grid of pixel positions
ny : `int`
    number of points in y for the grid of pixel positions

Returns
-------
almostEqual: `bool`
    `True` if two WCS are almost equal over a grid of pixel positions, else `False`

Definition at line 116 of file utils.py.

116  maxDiffPix=0.01, nx=5, ny=5):
117  """Test if two :py:class:`WCS <lsst.afw.geom.SkyWcs>` are almost equal over a grid of pixel positions.
118 
119  Parameters
120  ----------
121  wcs0 : `lsst.afw.geom.SkyWcs`
122  WCS 0
123  wcs1 : `lsst.afw.geom.SkyWcs`
124  WCS 1
125  bbox : `lsst.geom.Box2I` or `lsst.geom.Box2D`
126  boundaries of pixel grid over which to compare the WCSs
127  maxDiffSky : `lsst.geom.Angle`
128  maximum separation between sky positions computed using Wcs.pixelToSky
129  maxDiffPix : `float`
130  maximum separation between pixel positions computed using Wcs.skyToPixel
131  nx : `int`
132  number of points in x for the grid of pixel positions
133  ny : `int`
134  number of points in y for the grid of pixel positions
135 
136  Returns
137  -------
138  almostEqual: `bool`
139  `True` if two WCS are almost equal over a grid of pixel positions, else `False`
140  """
141  return not bool(_compareWcsOverBBox(
142  wcs0=wcs0,
143  wcs1=wcs1,
144  bbox=bbox,
145  maxDiffSky=maxDiffSky,
146  maxDiffPix=maxDiffPix,
147  nx=nx,
148  ny=ny,
149  doShortCircuit=True,
150  ))
151 
152 
153 @lsst.utils.tests.inTestCase