LSSTApplications  17.0+124,17.0+14,17.0+73,18.0.0+37,18.0.0+80,18.0.0-4-g68ffd23+4,18.1.0-1-g0001055+12,18.1.0-1-g03d53ef+5,18.1.0-1-g1349e88+55,18.1.0-1-g2505f39+44,18.1.0-1-g5315e5e+4,18.1.0-1-g5e4b7ea+14,18.1.0-1-g7e8fceb+4,18.1.0-1-g85f8cd4+48,18.1.0-1-g8ff0b9f+4,18.1.0-1-ga2c679d+1,18.1.0-1-gd55f500+35,18.1.0-10-gb58edde+2,18.1.0-11-g0997b02+4,18.1.0-13-gfe4edf0b+12,18.1.0-14-g259bd21+21,18.1.0-19-gdb69f3f+2,18.1.0-2-g5f9922c+24,18.1.0-2-gd3b74e5+11,18.1.0-2-gfbf3545+32,18.1.0-26-g728bddb4+5,18.1.0-27-g6ff7ca9+2,18.1.0-3-g52aa583+25,18.1.0-3-g8ea57af+9,18.1.0-3-gb69f684+42,18.1.0-3-gfcaddf3+6,18.1.0-32-gd8786685a,18.1.0-4-gf3f9b77+6,18.1.0-5-g1dd662b+2,18.1.0-5-g6dbcb01+41,18.1.0-6-gae77429+3,18.1.0-7-g9d75d83+9,18.1.0-7-gae09a6d+30,18.1.0-9-gc381ef5+4,w.2019.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 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