LSSTApplications  19.0.0-14-gb0260a2+72efe9b372,20.0.0+7927753e06,20.0.0+8829bf0056,20.0.0+995114c5d2,20.0.0+b6f4b2abd1,20.0.0+bddc4f4cbe,20.0.0-1-g253301a+8829bf0056,20.0.0-1-g2b7511a+0d71a2d77f,20.0.0-1-g5b95a8c+7461dd0434,20.0.0-12-g321c96ea+23efe4bbff,20.0.0-16-gfab17e72e+fdf35455f6,20.0.0-2-g0070d88+ba3ffc8f0b,20.0.0-2-g4dae9ad+ee58a624b3,20.0.0-2-g61b8584+5d3db074ba,20.0.0-2-gb780d76+d529cf1a41,20.0.0-2-ged6426c+226a441f5f,20.0.0-2-gf072044+8829bf0056,20.0.0-2-gf1f7952+ee58a624b3,20.0.0-20-geae50cf+e37fec0aee,20.0.0-25-g3dcad98+544a109665,20.0.0-25-g5eafb0f+ee58a624b3,20.0.0-27-g64178ef+f1f297b00a,20.0.0-3-g4cc78c6+e0676b0dc8,20.0.0-3-g8f21e14+4fd2c12c9a,20.0.0-3-gbd60e8c+187b78b4b8,20.0.0-3-gbecbe05+48431fa087,20.0.0-38-ge4adf513+a12e1f8e37,20.0.0-4-g97dc21a+544a109665,20.0.0-4-gb4befbc+087873070b,20.0.0-4-gf910f65+5d3db074ba,20.0.0-5-gdfe0fee+199202a608,20.0.0-5-gfbfe500+d529cf1a41,20.0.0-6-g64f541c+d529cf1a41,20.0.0-6-g9a5b7a1+a1cd37312e,20.0.0-68-ga3f3dda+5fca18c6a4,20.0.0-9-g4aef684+e18322736b,w.2020.45
LSSTDataManagementBasePackage
Classes | Functions
astshim.test Namespace Reference

Classes

class  MappingTestCase
 
class  ObjectTestCase
 

Functions

def makePolyMapCoeffs (nIn, nOut)
 
def makeTwoWayPolyMap (nIn, nOut)
 
def makeForwardPolyMap (nIn, nOut)
 

Function Documentation

◆ makeForwardPolyMap()

def astshim.test.makeForwardPolyMap (   nIn,
  nOut 
)
Make an astshim.PolyMap suitable for testing

The forward transform is the same as for `makeTwoWayPolyMap`.
This map does not have a reverse transform.

The equation is chosen for the following reasons:
- It is well defined for any positive value of nIn, nOut.
- It stays small for small x, to avoid wraparound of angles for
  SpherePoint endpoints.

Definition at line 313 of file test.py.

313 def makeForwardPolyMap(nIn, nOut):
314  """Make an astshim.PolyMap suitable for testing
315 
316  The forward transform is the same as for `makeTwoWayPolyMap`.
317  This map does not have a reverse transform.
318 
319  The equation is chosen for the following reasons:
320  - It is well defined for any positive value of nIn, nOut.
321  - It stays small for small x, to avoid wraparound of angles for
322  SpherePoint endpoints.
323  """
324  forwardCoeffs = makePolyMapCoeffs(nIn, nOut)
325  polyMap = PolyMap(forwardCoeffs, nOut, "IterInverse=0")
326  assert polyMap.nIn == nIn
327  assert polyMap.nOut == nOut
328  assert polyMap.hasForward
329  assert not polyMap.hasInverse
330  return polyMap

◆ makePolyMapCoeffs()

def astshim.test.makePolyMapCoeffs (   nIn,
  nOut 
)
Make an array of coefficients for astshim.PolyMap for the following
equation:

fj(x) = C0j x0^2 + C1j x1^2 + C2j x2^2 + ... + CNj xN^2
where:
* i ranges from 0 to N=nIn-1
* j ranges from 0 to nOut-1,
* Cij = 0.001 (i+j+1)

Definition at line 266 of file test.py.

266 def makePolyMapCoeffs(nIn, nOut):
267  """Make an array of coefficients for astshim.PolyMap for the following
268  equation:
269 
270  fj(x) = C0j x0^2 + C1j x1^2 + C2j x2^2 + ... + CNj xN^2
271  where:
272  * i ranges from 0 to N=nIn-1
273  * j ranges from 0 to nOut-1,
274  * Cij = 0.001 (i+j+1)
275  """
276  baseCoeff = 0.001
277  forwardCoeffs = []
278  for out_ind in range(nOut):
279  coeffOffset = baseCoeff * out_ind
280  for in_ind in range(nIn):
281  coeff = baseCoeff * (in_ind + 1) + coeffOffset
282  coeffArr = [coeff, out_ind + 1] + [2 if i == in_ind else 0 for i in range(nIn)]
283  forwardCoeffs.append(coeffArr)
284  return np.array(forwardCoeffs, dtype=float)
285 
286 

◆ makeTwoWayPolyMap()

def astshim.test.makeTwoWayPolyMap (   nIn,
  nOut 
)
Make an astshim.PolyMap suitable for testing

The forward transform is as follows:
fj(x) = C0j x0^2 + C1j x1^2 + C2j x2^2 + ...
        + CNj xN^2 where Cij = 0.001 (i+j+1)

The reverse transform is the same equation with i and j reversed
thus it is NOT the inverse of the forward direction,
but is something that can be easily evaluated.

The equation is chosen for the following reasons:
- It is well defined for any positive value of nIn, nOut.
- It stays small for small x, to avoid wraparound of angles for
  SpherePoint endpoints.

Definition at line 287 of file test.py.

287 def makeTwoWayPolyMap(nIn, nOut):
288  """Make an astshim.PolyMap suitable for testing
289 
290  The forward transform is as follows:
291  fj(x) = C0j x0^2 + C1j x1^2 + C2j x2^2 + ...
292  + CNj xN^2 where Cij = 0.001 (i+j+1)
293 
294  The reverse transform is the same equation with i and j reversed
295  thus it is NOT the inverse of the forward direction,
296  but is something that can be easily evaluated.
297 
298  The equation is chosen for the following reasons:
299  - It is well defined for any positive value of nIn, nOut.
300  - It stays small for small x, to avoid wraparound of angles for
301  SpherePoint endpoints.
302  """
303  forwardCoeffs = makePolyMapCoeffs(nIn, nOut)
304  reverseCoeffs = makePolyMapCoeffs(nOut, nIn)
305  polyMap = PolyMap(forwardCoeffs, reverseCoeffs)
306  assert polyMap.nIn == nIn
307  assert polyMap.nOut == nOut
308  assert polyMap.hasForward
309  assert polyMap.hasInverse
310  return polyMap
311 
312 
astshim.test.makeForwardPolyMap
def makeForwardPolyMap(nIn, nOut)
Definition: test.py:313
astshim.test.makePolyMapCoeffs
def makePolyMapCoeffs(nIn, nOut)
Definition: test.py:266
astshim.test.makeTwoWayPolyMap
def makeTwoWayPolyMap(nIn, nOut)
Definition: test.py:287