Документ взят из кэша поисковой машины. Адрес оригинального документа : http://www.apo.nmsu.edu/Telescopes/TCC/html/get_p_v_t_list_8py_source.html
Дата изменения: Tue Sep 15 02:25:37 2015
Дата индексирования: Sun Apr 10 03:01:25 2016
Кодировка:

Поисковые слова: south pole
lsst.tcc: python/tcc/parse/getPVTList.py Source File
lsst.tcc  1.2.2-3-g89ecb63
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
getPVTList.py
Go to the documentation of this file.
1 from __future__ import division, absolute_import
2 
3 import itertools
4 
5 import coordConv
6 from twistedActor import CommandError
7 
8 __all__ = ["getPVTList"]
9 
10 def getPVTList(pvtParam, numAxes, defTAI):
11  """!Obtain a list of PVTs from a PVT list parameter
12 
13  @param[in] pvtParam the PVT list parameter or qualifier
14  @param[in] numAxes number of axes of PVT data required
15  @param[in] defTAI TAI date (MJD, seconds) to use if time is omitted
16  @return two items:
17  - pvtList: a list of numAxes coordConv.PVT
18  - numValues: the number of values explicitly specified by the user
19  (positions, velocities and TAI, as appropriate)
20 
21  Data must be in one of these forms, determined by the number of values the user provides:
22  num values description
23  0 no values
24  2 two positions, if numAxes>2
25  numAxes position only: pos1, pos2, ... posNAxes
26  2*numAxes position and velocity: pos1, pos2, ... posNAxes, vel1, vel2, ... velNAxes
27  1 + 2*numAxes position, velocity and time: pos1, pos2, ... posNAxes, vel1, vel2, ... velNAxes, tai
28  position defaults to 0, velocity defaults to 0 and tai defaults to current TAI
29 
30  @throw twistedActor.CommandError under the following circumstances:
31  - An invalid number of values is seen
32  """
33  numValues = len(pvtParam.valueList)
34 
35  numPos = numAxes
36  numPosVel = 2*numAxes
37  numPosVelT = 1 + numPosVel
38 
39  if numAxes > 2:
40  # allow 2 positions
41  validNumVals = (0, 2, numPos, numPosVel, numPosVelT)
42  else:
43  validNumVals = (0, numPos, numPosVel, numPosVelT)
44 
45  if numValues not in validNumVals:
46  raise CommandError("Invalid %s: must specify one of: %s values" % (pvtParam.name, validNumVals))
47 
48  # usually velocity and time are defaulted
49  posList = [0.0]*numAxes
50  velList = [0.0]*numAxes
51  tai = defTAI
52 
53  if numValues >= numPos:
54  posList = pvtParam.valueList[0:numPosVel]
55  if numValues >= numPosVel:
56  velList = pvtParam.valueList[numPos:numPosVel]
57  if numValues == numPosVelT:
58  tai = pvtParam.valueList[numPosVelT-1]
59  elif numAxes > 2 and numValues == 2:
60  posList[0:2] = pvtParam.valueList[0:2]
61 
62  pvtList = [coordConv.PVT(pos, vel, tai) for pos, vel in itertools.izip(posList, velList)]
63  return pvtList, numValues
def getPVTList
Obtain a list of PVTs from a PVT list parameter.
Definition: getPVTList.py:10