Документ взят из кэша поисковой машины. Адрес оригинального документа : http://www.apo.nmsu.edu/Telescopes/coordConv/html/test_utils_8py_source.html
Дата изменения: Thu May 7 21:42:46 2015
Дата индексирования: Sun Apr 10 03:58:54 2016
Кодировка:

Поисковые слова: voyager 2
lsst.coordConv: python/coordConv/testUtils.py Source File
lsst.coordConv  unknown
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Pages
testUtils.py
Go to the documentation of this file.
1 from __future__ import absolute_import, division
2 
3 from .coordConvLib import wrapCtr
4 
5 def assertPVTsAlmostEqual(pvt1, pvt2, doWrap=False, posPlaces=7, velPlaces=7, tPlaces=7):
6  """Assert that two PVTs are almost equal
7 
8  @param[in] pvt1 first coordConv.PVT
9  @param[in] pvt2 second coordConv.PVT
10  @param[in] doWrap if True then wrap position difference to [-180, 180] before comparing
11  (ignored for velocity and time comparison).
12  @param[in] posPlaces number of decimal places for position difference
13  @param[in] velPlaces number of decimal places for velocity difference
14  @param[in] tPlaces number of decimal places for time difference
15 
16  For the places arguments the associated value must be less than 10^-places
17  """
18  if abs(pvt1.t - pvt2.t) > 10.0**-tPlaces:
19  raise AssertionError("%s.t != %s.t to within %s places" % (pvt1, pvt2, tPlaces))
20  if abs(pvt1.vel - pvt2.vel) > 10.0**-velPlaces:
21  raise AssertionError("%s.vel != %s.vel to within %s places" % (pvt1, pvt2, velPlaces))
22  if doWrap:
23  if abs(wrapCtr(pvt1.pos - pvt2.pos)) > 10.0**-posPlaces:
24  raise AssertionError("%s.pos != %s.pos to within %s places (wrapped)" % (pvt1, pvt2, posPlaces))
25  else:
26  if abs(pvt1.pos - pvt2.pos) > 10.0**-posPlaces:
27  raise AssertionError("%s.pos != %s.pos to within %s places" % (pvt1, pvt2, posPlaces))
28 
29 def assertAnglesAlmostEqual(angle1, angle2, places=7):
30  """Assert that two PVTs are almost equal
31 
32  @param[in] angle1 first angle
33  @param[in] angle second angle
34  @param[in] places number of decimal places for position difference
35  @throw AssertionError if abs(angle1 - angle2) > 10.0**-places
36  """
37  if abs(wrapCtr(angle1 - angle2)) > 10.0**-places:
38  raise AssertionError("%r != %r to within %s places (wrapped)" % (angle1, angle2, places))
double wrapCtr(double ang)
Definition: mathUtils.cc:33
def assertAnglesAlmostEqual
Definition: testUtils.py:29
def assertPVTsAlmostEqual
Definition: testUtils.py:5