LSST Applications g070148d5b3+33e5256705,g0d53e28543+25c8b88941,g0da5cf3356+2dd1178308,g1081da9e2a+62d12e78cb,g17e5ecfddb+7e422d6136,g1c76d35bf8+ede3a706f7,g295839609d+225697d880,g2e2c1a68ba+cc1f6f037e,g2ffcdf413f+853cd4dcde,g38293774b4+62d12e78cb,g3b44f30a73+d953f1ac34,g48ccf36440+885b902d19,g4b2f1765b6+7dedbde6d2,g5320a0a9f6+0c5d6105b6,g56b687f8c9+ede3a706f7,g5c4744a4d9+ef6ac23297,g5ffd174ac0+0c5d6105b6,g6075d09f38+66af417445,g667d525e37+2ced63db88,g670421136f+2ced63db88,g71f27ac40c+2ced63db88,g774830318a+463cbe8d1f,g7876bc68e5+1d137996f1,g7985c39107+62d12e78cb,g7fdac2220c+0fd8241c05,g96f01af41f+368e6903a7,g9ca82378b8+2ced63db88,g9d27549199+ef6ac23297,gabe93b2c52+e3573e3735,gb065e2a02a+3dfbe639da,gbc3249ced9+0c5d6105b6,gbec6a3398f+0c5d6105b6,gc9534b9d65+35b9f25267,gd01420fc67+0c5d6105b6,geee7ff78d7+a14128c129,gf63283c776+ede3a706f7,gfed783d017+0c5d6105b6,w.2022.47
LSST Data Management Base Package
Loading...
Searching...
No Matches
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.

313def 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.

266def 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.

287def 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