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

Поисковые слова: equinox
lsst.tcc: python/tcc/parse/getPVTPxPMRadVel.py Source File
lsst.tcc  1.2.2-3-g89ecb63
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
getPVTPxPMRadVel.py
Go to the documentation of this file.
1 from __future__ import division, absolute_import
2 
3 import coordConv
4 from twistedActor import CommandError
5 
6 from .getPVTList import getPVTList
7 import tcc.base
8 
9 __all__ = ["getPVTPairPxPMRadVel"]
10 
11 def getPVTPairPxPMRadVel(parsedCmd, coordName, defTAI):
12  """!Obtain object data from a parsed command, and perform some sanity checks
13 
14  Read one parameter that contains pos1, pos2, [vel1, [vel2, [tai]]]
15  and the following qualifiers: /Distance /Px /PM /RV.
16 
17  @param[in] parsedCmd the parsed command
18  @param[in] coordName name of coord parameter
19  @param[in] defTAI TAI date to use if time not specified (MJD, seconds)
20  @return:
21  - pvtPair: a pair of PVTs (tcc.base.ArrayPVT2), or None if the pvt parameter is absent
22  - pxPMRadVel: parallax, proper motion and radial velocity, as a tcc.base.PxPMRadVel
23 
24  @throw twistedActor.CommandError under the following circumstances:
25  - /Distance and /Px are both specified
26  - Any of /Distance /Px /PM /RV is specified and no position is provided
27  """
28  pvtParam = parsedCmd.paramDict[coordName]
29  if pvtParam.defaulted:
30  # no position specified; complain if any qualifiers specified and return None
31  if not parsedCmd.qualDict["distance"].boolValueDefaulted:
32  raise CommandError("Must specify new position to specify /Distance")
33  if not parsedCmd.qualDict["px"].boolValueDefaulted:
34  raise CommandError("Must specify new position to specify /Px")
35  if not parsedCmd.qualDict["pm"].boolValueDefaulted:
36  raise CommandError("Must specify new position to specify /PM")
37  if not parsedCmd.qualDict["rv"].boolValueDefaulted:
38  raise CommandError("Must specify new position to specify /RV")
39 
40  return None, tcc.base.PxPMRadVel()
41 
42  if not parsedCmd.qualDict["distance"].boolValueDefaulted and not parsedCmd.qualDict["px"].boolValueDefaulted:
43  raise CommandError("Cannot specify both /Distance and /Px")
44 
45  numVals = len(pvtParam.valueList)
46  if numVals not in (2, 4, 5):
47  raise CommandError("Must specify one of pos, pos + vel or pos + vel + tai")
48 
49  pvtPair = tcc.base.ArrayPVT2()
50  (equatPVT, polarPVT) = getPVTList(pvtParam, numAxes=2, defTAI=defTAI)[0]
51  pvtPair[:] = equatPVT, polarPVT
52  if parsedCmd.qualDict["distance"].boolValueDefaulted:
53  parallax = parsedCmd.qualDict["px"].valueList[0]
54  else:
55  distList = parsedCmd.qualDict["distance"].valueList
56  if len(distList) == 0:
57  parallax = 0
58  else:
59  parallax = coordConv.parallaxFromDistance(distList[0])
60  equatPM, polarPM = parsedCmd.qualDict["pm"].valueList[0:2]
61  radVel = parsedCmd.qualDict["rv"].valueList[0]
62  pxPMRadVel = tcc.base.PxPMRadVel(parallax, equatPM, polarPM, radVel)
63 
64  return pvtPair, pxPMRadVel
def getPVTPairPxPMRadVel
Obtain object data from a parsed command, and perform some sanity checks.
def getPVTList
Obtain a list of PVTs from a PVT list parameter.
Definition: getPVTList.py:10