1 from __future__
import division, absolute_import
6 from twistedActor
import CommandError
8 __all__ = [
"getPVTList"]
11 """!Obtain a list of PVTs from a PVT list parameter
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
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)
21 Data must be in one of these forms, determined by the number of values the user provides:
22 num values description
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
30 @throw twistedActor.CommandError under the following circumstances:
31 - An invalid number of values is seen
33 numValues = len(pvtParam.valueList)
37 numPosVelT = 1 + numPosVel
41 validNumVals = (0, 2, numPos, numPosVel, numPosVelT)
43 validNumVals = (0, numPos, numPosVel, numPosVelT)
45 if numValues
not in validNumVals:
46 raise CommandError(
"Invalid %s: must specify one of: %s values" % (pvtParam.name, validNumVals))
49 posList = [0.0]*numAxes
50 velList = [0.0]*numAxes
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]
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.