lsst.afw  15.0-17-g0b88e3da8+6
Functions
lsst.afw.geom.utils Namespace Reference

Functions

def extraMsg (msg)
 
def assertAnglesAlmostEqual (testCase, ang0, ang1, maxDiff=0.001 *arcseconds, ignoreWrap=True, msg="Angles differ")
 Assert that two angles are almost equal, ignoring wrap differences by default. More...
 
def assertPairsAlmostEqual (testCase, pair0, pair1, maxDiff=1e-7, msg="Pairs differ")
 Assert that two Cartesian points are almost equal. More...
 
def assertPairListsAlmostEqual (testCase, list0, list1, maxDiff=1e-7, msg=None)
 Assert that two lists of Cartesian points are almost equal. More...
 
def assertSpherePointsAlmostEqual (testCase, sp0, sp1, maxSep=0.001 *arcseconds, msg="")
 Assert that two SpherePoints are almost equal. More...
 
def assertSpherePointListsAlmostEqual (testCase, splist0, splist1, maxSep=0.001 *arcseconds, msg=None)
 Assert that two lists of SpherePoints are almost equal. More...
 
def assertBoxesAlmostEqual (testCase, box0, box1, maxDiff=1e-7, msg="Boxes differ")
 Assert that two boxes (Box2D or Box2I) are almost equal. More...
 
def wcsAlmostEqualOverBBox (wcs0, wcs1, bbox, maxDiffSky=0.01 *arcseconds, maxDiffPix=0.01, nx=5, ny=5)
 Return True if two WCS are almost equal over a grid of pixel positions, else False. More...
 
def assertWcsAlmostEqualOverBBox (testCase, wcs0, wcs1, bbox, maxDiffSky=0.01 *arcseconds, maxDiffPix=0.01, nx=5, ny=5, msg="WCSs differ")
 Assert that two WCS are almost equal over a grid of pixel positions. More...
 
def assertWcsNearlyEqualOverBBox (args, kwargs)
 
def makeEndpoints (testCase)
 
def assertAnglesNearlyEqual (args, kwargs)
 
def assertPairsNearlyEqual (args, kwargs)
 
def assertBoxesNearlyEqual (args, kwargs)
 

Function Documentation

◆ assertAnglesAlmostEqual()

def lsst.afw.geom.utils.assertAnglesAlmostEqual (   testCase,
  ang0,
  ang1,
  maxDiff = 0.001*arcseconds,
  ignoreWrap = True,
  msg = "Angles differ" 
)

Assert that two angles are almost equal, ignoring wrap differences by default.

Parameters
[in]testCaseunittest.TestCase instance the test is part of; an object supporting one method: fail(self, msgStr)
[in]ang0angle 0 (an lsst.afw.geom.Angle)
[in]ang1angle 1 (an lsst.afw.geom.Angle)
[in]maxDiffmaximum difference between the two angles (an lsst.afw.geom.Angle)
[in]ignoreWrapignore wrap when comparing the angles?
  • if True then wrap is ignored, e.g. 0 and 360 degrees are considered equal
  • if False then wrap matters, e.g. 0 and 360 degrees are considered different
[in]msgexception message prefix; details of the error are appended after ": "
Exceptions
AssertionErrorif the difference is greater than maxDiff

Definition at line 53 of file utils.py.

◆ assertAnglesNearlyEqual()

def lsst.afw.geom.utils.assertAnglesNearlyEqual (   args,
  kwargs 
)

Definition at line 346 of file utils.py.

◆ assertBoxesAlmostEqual()

def lsst.afw.geom.utils.assertBoxesAlmostEqual (   testCase,
  box0,
  box1,
  maxDiff = 1e-7,
  msg = "Boxes differ" 
)

Assert that two boxes (Box2D or Box2I) are almost equal.

Warning
Does not compare types, just compares values.
Parameters
[in]testCaseunittest.TestCase instance the test is part of; an object supporting one method: fail(self, msgStr)
[in]box0box 0
[in]box1box 1
[in]maxDiffmaximum radial separation between the min points and max points
[in]msgexception message prefix; details of the error are appended after ": "
Exceptions
AssertionErrorif the radial difference of the min points or max points is greater than maxDiff

Definition at line 179 of file utils.py.

◆ assertBoxesNearlyEqual()

def lsst.afw.geom.utils.assertBoxesNearlyEqual (   args,
  kwargs 
)

Definition at line 359 of file utils.py.

◆ assertPairListsAlmostEqual()

def lsst.afw.geom.utils.assertPairListsAlmostEqual (   testCase,
  list0,
  list1,
  maxDiff = 1e-7,
  msg = None 
)

Assert that two lists of Cartesian points are almost equal.

Each point can be any indexable pair of two floats, including Point2D or Extent2D, a list or a tuple.

Warning
Does not compare types, just values.
Parameters
[in]testCaseunittest.TestCase instance the test is part of; an object supporting one method: fail(self, msgStr)
[in]list0list of pairs 0 (each element a pair of floats)
[in]list1list of pairs 1
[in]maxDiffmaximum radial separation between the two points
[in]msgadditional information for the error message; appended after ": "
Exceptions
AssertionErrorif the radial difference is greater than maxDiff

Definition at line 107 of file utils.py.

◆ assertPairsAlmostEqual()

def lsst.afw.geom.utils.assertPairsAlmostEqual (   testCase,
  pair0,
  pair1,
  maxDiff = 1e-7,
  msg = "Pairs differ" 
)

Assert that two Cartesian points are almost equal.

Each point can be any indexable pair of two floats, including Point2D or Extent2D, a list or a tuple.

Warning
Does not compare types, just compares values.
Parameters
[in]testCaseunittest.TestCase instance the test is part of; an object supporting one method: fail(self, msgStr)
[in]pair0pair 0 (a pair of floats)
[in]pair1pair 1 (a pair of floats)
[in]maxDiffmaximum radial separation between the two points
[in]msgexception message prefix; details of the error are appended after ": "
Exceptions
AssertionErrorif the radial difference is greater than maxDiff

Definition at line 77 of file utils.py.

◆ assertPairsNearlyEqual()

def lsst.afw.geom.utils.assertPairsNearlyEqual (   args,
  kwargs 
)

Definition at line 353 of file utils.py.

◆ assertSpherePointListsAlmostEqual()

def lsst.afw.geom.utils.assertSpherePointListsAlmostEqual (   testCase,
  splist0,
  splist1,
  maxSep = 0.001*arcseconds,
  msg = None 
)

Assert that two lists of SpherePoints are almost equal.

Parameters
[in]testCaseunittest.TestCase instance the test is part of; an object supporting one method: fail(self, msgStr)
[in]splist0list of SpherePoints 0
[in]splist1list of SpherePoints 1
[in]maxSepmaximum separation, an lsst.afw.geom.Angle
[in]msgexception message prefix; details of the error are appended after ": "

Definition at line 157 of file utils.py.

◆ assertSpherePointsAlmostEqual()

def lsst.afw.geom.utils.assertSpherePointsAlmostEqual (   testCase,
  sp0,
  sp1,
  maxSep = 0.001*arcseconds,
  msg = "" 
)

Assert that two SpherePoints are almost equal.

Parameters
[in]testCaseunittest.TestCase instance the test is part of; an object supporting one method: fail(self, msgStr)
[in]sp0SpherePoint 0
[in]sp1SpherePoint 1
[in]maxSepmaximum separation, an lsst.afw.geom.Angle
[in]msgextra information to be printed with any error message

Definition at line 141 of file utils.py.

◆ assertWcsAlmostEqualOverBBox()

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

Assert that two WCS 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
[in]testCaseunittest.TestCase instance the test is part of; an object supporting one method: fail(self, msgStr)
[in]wcs0WCS 0 (an lsst.afw.geom.SkyWcs)
[in]wcs1WCS 1 (an lsst.afw.geom.SkyWcs)
[in]bboxboundaries of pixel grid over which to compare the WCSs (an lsst.afw.geom.Box2I or Box2D)
[in]maxDiffSkymaximum separation between sky positions computed using Wcs.pixelToSky (an lsst.afw.geom.Angle)
[in]maxDiffPixmaximum separation between pixel positions computed using Wcs.skyToPixel
[in]nxnumber of points in x for the grid of pixel positions
[in]nynumber of points in y for the grid of pixel positions
[in]msgexception message prefix; details of the error are appended after ": "

Definition at line 290 of file utils.py.

◆ assertWcsNearlyEqualOverBBox()

def lsst.afw.geom.utils.assertWcsNearlyEqualOverBBox (   args,
  kwargs 
)

Definition at line 325 of file utils.py.

◆ extraMsg()

def lsst.afw.geom.utils.extraMsg (   msg)
Format extra error message, if any

Definition at line 43 of file utils.py.

◆ makeEndpoints()

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

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

Definition at line 332 of file utils.py.

◆ wcsAlmostEqualOverBBox()

def lsst.afw.geom.utils.wcsAlmostEqualOverBBox (   wcs0,
  wcs1,
  bbox,
  maxDiffSky = 0.01*arcseconds,
  maxDiffPix = 0.01,
  nx = 5,
  ny = 5 
)

Return True if two WCS are almost equal over a grid of pixel positions, else False.

Parameters
[in]wcs0WCS 0 (an lsst.afw.geom.SkyWcs)
[in]wcs1WCS 1 (an lsst.afw.geom.SkyWcs)
[in]bboxboundaries of pixel grid over which to compare the WCSs (an lsst.afw.geom.Box2I or Box2D)
[in]maxDiffSkymaximum separation between sky positions computed using Wcs.pixelToSky (an lsst.afw.geom.Angle)
[in]maxDiffPixmaximum separation between pixel positions computed using Wcs.skyToPixel
[in]nxnumber of points in x for the grid of pixel positions
[in]nynumber of points in y for the grid of pixel positions

Definition at line 264 of file utils.py.