LSSTApplications  18.1.0
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 307 of file test.py.

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

◆ 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 263 of file test.py.

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

◆ 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 283 of file test.py.

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