lsst.afw g10abae039c+de8826df4f
Loading...
Searching...
No Matches
lsst.afw.geom.testUtils.TransformTestBaseClass Class Reference
Inheritance diagram for lsst.afw.geom.testUtils.TransformTestBaseClass:

Public Member Functions

 setUp (self)
 
 makeGoodFrame (cls, name, nAxes=None)
 
 makeFrameSet (self, baseFrame, currFrame)
 
 checkTransformation (self, transform, mapping, msg="")
 
 checkInverseTransformation (self, forward, inverse, msg="")
 
 checkTransformFromMapping (self, fromName, toName)
 
 checkTransformFromFrameSet (self, fromName, toName)
 
 checkInverted (self, fromName, toName)
 
 checkInverseMapping (self, TransformClass, mapping, msg)
 
 checkGetJacobian (self, fromName, toName)
 
 checkThen (self, fromName, midName, toName)
 
 assertTransformsEqual (self, transform1, transform2)
 
 checkPersistence (self, transform)
 

Static Public Member Functions

 makeRawArrayData (nPoints, nAxes, delta=0.123)
 
 makeRawPointData (nAxes, delta=0.123)
 
 makeEndpoint (name, nAxes=None)
 
 makeBadFrames (name)
 
 permuteFrameSetIter (frameSet)
 
 makeJacobian (nIn, nOut, inPoint)
 

Public Attributes

bool longMessage = True
 
tuple endpointPrefixes = ("Generic", "Point2", "SpherePoint")
 
dict goodNAxes
 
dict badNAxes
 
dict frameIdentDict
 

Detailed Description

Base class for unit tests of Transform<X>To<Y>

Subclasses must call `TransformTestBaseClass.setUp(self)`
if they provide their own version.

Definition at line 329 of file testUtils.py.

Member Function Documentation

◆ assertTransformsEqual()

lsst.afw.geom.testUtils.TransformTestBaseClass.assertTransformsEqual ( self,
transform1,
transform2 )
Assert that two transforms are equal

Definition at line 1039 of file testUtils.py.

◆ checkGetJacobian()

lsst.afw.geom.testUtils.TransformTestBaseClass.checkGetJacobian ( self,
fromName,
toName )
Test Transform<fromName>To<toName>.getJacobian

Parameters
----------
fromName, toName : `str`
    Endpoint name prefix for "from" and "to" endpoints, respectively,
    e.g. "Point2" for `lsst.afw.geom.Point2Endpoint`

Definition at line 927 of file testUtils.py.

◆ checkInverseMapping()

lsst.afw.geom.testUtils.TransformTestBaseClass.checkInverseMapping ( self,
TransformClass,
mapping,
msg )
Test Transform<fromName>To<toName>.inverted for a specific
mapping.

Also check that inverted() and getInverted() return the same
transform.

Parameters
----------
TransformClass : `type`
    The class of transform to test, such as TransformPoint2ToPoint2
mapping : `ast.Mapping`
    The mapping to use for the transform
msg : `str`
    Error message suffix

Definition at line 903 of file testUtils.py.

◆ checkInverseTransformation()

lsst.afw.geom.testUtils.TransformTestBaseClass.checkInverseTransformation ( self,
forward,
inverse,
msg = "" )
Check that two Transforms are each others' inverses.

Parameters
----------
forward : `lsst.afw.geom.Transform`
    the reference Transform to test
inverse : `lsst.afw.geom.Transform`
    the transform that should be the inverse of `forward`
msg : `str`
    error message suffix describing test parameters

Definition at line 683 of file testUtils.py.

◆ checkInverted()

lsst.afw.geom.testUtils.TransformTestBaseClass.checkInverted ( self,
fromName,
toName )
Test Transform<fromName>To<toName>.inverted

Parameters
----------
fromName, toName : `str`
    Endpoint name prefix for "from" and "to" endpoints, respectively,
    e.g. "Point2" for `lsst.afw.geom.Point2Endpoint`

Definition at line 875 of file testUtils.py.

◆ checkPersistence()

lsst.afw.geom.testUtils.TransformTestBaseClass.checkPersistence ( self,
transform )
Check persistence of a transform

Definition at line 1072 of file testUtils.py.

◆ checkThen()

lsst.afw.geom.testUtils.TransformTestBaseClass.checkThen ( self,
fromName,
midName,
toName )
Test Transform<fromName>To<midName>.then(Transform<midName>To<toName>)

Parameters
----------
fromName : `str`
    the prefix of the starting endpoint (e.g., "Point2" for a
    Point2Endpoint) for the final, concatenated Transform
midName : `str`
    the prefix for the shared endpoint where two Transforms will be
    concatenated
toName : `str`
    the prefix of the ending endpoint for the final, concatenated
    Transform

Definition at line 959 of file testUtils.py.

◆ checkTransformation()

lsst.afw.geom.testUtils.TransformTestBaseClass.checkTransformation ( self,
transform,
mapping,
msg = "" )
Check applyForward and applyInverse for a transform

Parameters
----------
transform : `lsst.afw.geom.Transform`
    The transform to check
mapping : `ast.Mapping`
    The mapping the transform should use. This mapping
    must contain valid forward or inverse transformations,
    but they need not match if both present. Hence the
    mappings returned by make*PolyMap are acceptable.
msg : `str`
    Error message suffix describing test parameters

Definition at line 609 of file testUtils.py.

◆ checkTransformFromFrameSet()

lsst.afw.geom.testUtils.TransformTestBaseClass.checkTransformFromFrameSet ( self,
fromName,
toName )
Check Transform_<fromName>_<toName> using the FrameSet constructor

Parameters
----------
fromName, toName : `str`
    Endpoint name prefix for "from" and "to" endpoints, respectively,
    e.g. "Point2" for `lsst.afw.geom.Point2Endpoint`

Definition at line 803 of file testUtils.py.

◆ checkTransformFromMapping()

lsst.afw.geom.testUtils.TransformTestBaseClass.checkTransformFromMapping ( self,
fromName,
toName )
Check Transform_<fromName>_<toName> using the Mapping constructor

Parameters
----------
fromName, toName : `str`
    Endpoint name prefix for "from" and "to" endpoints, respectively,
    e.g. "Point2" for `lsst.afw.geom.Point2Endpoint`
fromAxes, toAxes : `int`
    number of axes in fromFrame and toFrame, respectively

Definition at line 748 of file testUtils.py.

◆ makeBadFrames()

lsst.afw.geom.testUtils.TransformTestBaseClass.makeBadFrames ( name)
static
Return a list of 0 or more frames that are not a valid match for the
named endpoint

Parameters
----------
name : `str`
    Endpoint class name prefix; the full class name is name + "Endpoint"

Returns
-------
Collection of `ast.Frame`
    A collection of 0 or more frames

Definition at line 478 of file testUtils.py.

◆ makeEndpoint()

lsst.afw.geom.testUtils.TransformTestBaseClass.makeEndpoint ( name,
nAxes = None )
static
Make an endpoint

Parameters
----------
name : `str`
    Endpoint class name prefix; the full class name is name + "Endpoint"
nAxes : `int` or `None`, optional
    number of axes; an int is required if `name` == "Generic";
    otherwise ignored

Returns
-------
subclass of `lsst.afw.geom.BaseEndpoint`
    The constructed endpoint

Raises
------
TypeError
    If `name` == "Generic" and `nAxes` is None or <= 0

Definition at line 424 of file testUtils.py.

◆ makeFrameSet()

lsst.afw.geom.testUtils.TransformTestBaseClass.makeFrameSet ( self,
baseFrame,
currFrame )
Make a FrameSet

The FrameSet will contain 4 frames and three transforms connecting them.
The idenity of each frame is provided by self.frameIdentDict

Frame       Index   Mapping from this frame to the next
`baseFrame`   1     `ast.UnitMap(nIn)`
Frame(nIn)    2     `polyMap`
Frame(nOut)   3     `ast.UnitMap(nOut)`
`currFrame`   4

where:
- `nIn` = `baseFrame.nAxes`
- `nOut` = `currFrame.nAxes`
- `polyMap` = `makeTwoWayPolyMap(nIn, nOut)`

Returns
------
`ast.FrameSet`
    The FrameSet as described above

Parameters
----------
baseFrame : `ast.Frame`
    base frame
currFrame : `ast.Frame`
    current frame

Definition at line 506 of file testUtils.py.

◆ makeGoodFrame()

lsst.afw.geom.testUtils.TransformTestBaseClass.makeGoodFrame ( cls,
name,
nAxes = None )
Return the appropriate frame for the given name and nAxes

Parameters
----------
name : `str`
    Endpoint class name prefix; the full class name is name + "Endpoint"
nAxes : `int` or `None`, optional
    number of axes; an int is required if `name` == "Generic";
    otherwise ignored

Returns
-------
`ast.Frame`
    The constructed frame

Raises
------
TypeError
    If `name` == "Generic" and `nAxes` is `None` or <= 0

Definition at line 454 of file testUtils.py.

◆ makeJacobian()

lsst.afw.geom.testUtils.TransformTestBaseClass.makeJacobian ( nIn,
nOut,
inPoint )
static
Make a Jacobian matrix for the equation described by
`makeTwoWayPolyMap`.

Parameters
----------
nIn, nOut : `int`
    the dimensions of the input and output data; see makeTwoWayPolyMap
inPoint : `numpy.ndarray`
    an array of size `nIn` representing the point at which the Jacobian
    is measured

Returns
-------
J : `numpy.ndarray`
    an `nOut` x `nIn` array of first derivatives

Definition at line 579 of file testUtils.py.

◆ makeRawArrayData()

lsst.afw.geom.testUtils.TransformTestBaseClass.makeRawArrayData ( nPoints,
nAxes,
delta = 0.123 )
static
Make an array of generic point data

The data will be suitable for spherical points

Parameters
----------
nPoints : `int`
    Number of points in the array
nAxes : `int`
    Number of axes in the point

Returns
-------
np.array of floats with shape (nAxes, nPoints)
    The values are as follows; if nAxes != 2:
        The first point has values `[0, delta, 2*delta, ..., (nAxes-1)*delta]`
        The Nth point has those values + N
    if nAxes == 2 then the data is scaled so that the max value of axis 1
        is a bit less than pi/2

Definition at line 373 of file testUtils.py.

◆ makeRawPointData()

lsst.afw.geom.testUtils.TransformTestBaseClass.makeRawPointData ( nAxes,
delta = 0.123 )
static
Make one generic point

Parameters
----------
nAxes : `int`
    Number of axes in the point
delta : `float`
    Increment between axis values

Returns
-------
A list of `nAxes` floats with values `[0, delta, ..., (nAxes-1)*delta]

Definition at line 407 of file testUtils.py.

◆ permuteFrameSetIter()

lsst.afw.geom.testUtils.TransformTestBaseClass.permuteFrameSetIter ( frameSet)
static
Iterator over 0 or more frameSets with SkyFrames axes permuted

Only base and current SkyFrames are permuted. If neither the base nor
the current frame is a SkyFrame then no frames are returned.

Returns
-------
iterator over `PermutedFrameSet`

Definition at line 557 of file testUtils.py.

◆ setUp()

lsst.afw.geom.testUtils.TransformTestBaseClass.setUp ( self)
Set up a test

Subclasses should call this method if they override setUp.

Definition at line 336 of file testUtils.py.

Member Data Documentation

◆ badNAxes

dict lsst.afw.geom.testUtils.TransformTestBaseClass.badNAxes
Initial value:
= {
"Generic": (), # all numbers of axes are valid for GenericEndpoint
"Point2": (1, 3, 4),
"SpherePoint": (1, 3, 4),
}

Definition at line 358 of file testUtils.py.

◆ endpointPrefixes

tuple lsst.afw.geom.testUtils.TransformTestBaseClass.endpointPrefixes = ("Generic", "Point2", "SpherePoint")

Definition at line 346 of file testUtils.py.

◆ frameIdentDict

dict lsst.afw.geom.testUtils.TransformTestBaseClass.frameIdentDict
Initial value:
= {
1: "baseFrame",
2: "frame2",
3: "frame3",
4: "currFrame",
}

Definition at line 365 of file testUtils.py.

◆ goodNAxes

dict lsst.afw.geom.testUtils.TransformTestBaseClass.goodNAxes
Initial value:
= {
"Generic": (1, 2, 3, 4), # all numbers of axes are valid for GenericEndpoint
"Point2": (2,),
"SpherePoint": (2,),
}

Definition at line 350 of file testUtils.py.

◆ longMessage

bool lsst.afw.geom.testUtils.TransformTestBaseClass.longMessage = True

Definition at line 343 of file testUtils.py.


The documentation for this class was generated from the following file: