Документ взят из кэша поисковой машины. Адрес оригинального документа : http://www.apo.nmsu.edu/Telescopes/TCC/html/compute_obj_8py_source.html
Дата изменения: Tue Sep 15 02:25:37 2015
Дата индексирования: Sun Apr 10 02:08:46 2016
Кодировка:
lsst.tcc: python/tcc/axis/computeObj.py Source File
lsst.tcc  1.2.2-3-g89ecb63
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
computeObj.py
Go to the documentation of this file.
1 from __future__ import division, absolute_import
2 
3 import sys
4 
5 import numpy
6 
7 import tcc.base
8 from tcc.mov import checkPos
9 
10 __all__ = ["computeObj"]
11 
12 def computeObj(
13  obj,
14  doWrap,
15  doRestart,
16  reportLim,
17  earth,
18  inst,
19  telMod,
20  axeLim,
21  tai,
22 ):
23  """!Compute all computed obj fields from user-specified fields except path generator outputs
24 
25  @param[in,out] obj object data
26  Input fields include all user inputs and current state
27  Ouput fields include all computed fields
28  @param[in] doWrap if True, obey ojb.wrapPref else force nearest wrap
29  @param[in] doRestart (3 bools) compute new position for (az, alt, rot) axis, if halted?
30  @param[in] reportLim report hitting a position limit? WARNING: IGNORED AND LIKELY TO GO AWAY
31  @param[in] earth earth orientation predictions (tcc.base.Earth)
32  @param[in] inst instrument block (tcc.base.Inst)
33  @param[in] telMod telescope model (tcc.base.TelMod)
34  @param[in] axeLim axes limits (tcc.base.AxeLim)
35  @param[in] tai TAI date at which to compute netUserPos and other values (MJD, seconds)
36  """
37  oldMountList = tuple(pvt.copy() for pvt in obj.targetMount)
38 
39  earth.updateSite(obj.site, tai)
40  earth.updateSite(obj.gsSite, tai)
41 
42  tcc.base.computeNetUser(obj, tai)
43 
44  tcc.base.obsFromNetUser(obj, tai)
45 
46  tcc.base.mountFromObs(obj, inst, telMod, tai)
47 
48  if doWrap:
49  wrapPrefList = (obj.azWrapPref, tcc.base.WrapType_None, obj.rotWrapPref)
50  else:
51  wrapPrefList = (tcc.base.WrapType_Nearest, tcc.base.WrapType_None, tcc.base.WrapType_Nearest)
52 
53  if inst.hasRotator():
54  axisIndList = range(3)
55  else:
56  obj.targetMount[2].invalidate(tai)
57  obj.axisCmdState[2] = tcc.base.AxisState_NotAvailable
58  obj.axisErrCode[2] = tcc.base.AxisErr_NotAvailable
59  axisIndList = range(2)
60 
61  for i in axisIndList:
62  oldMount = oldMountList[i]
63 
64  # keep halted axes halted, unless doRestart
65  if not oldMount.isfinite():
66  if obj.axisCmdState[i] == tcc.base.AxisState_Halting:
67  # oldMount is NaN while halting; don't worry about it
68  pass
69  elif not doRestart[i]:
70  # halt new axis and make sure errCode set
71  obj.targetMount[i].invalidate(tai)
72  obj.axisCmdState[i] = tcc.base.AxisState_Halted
73  if obj.axisErrCode[i] == 0:
74  sys.stderr.write("Warning: old axis %d halted, but error code = 0; setting to NoRestart\n" % (i,))
75  obj.axisErrCode[i] = tcc.base.AxisErr_NoRestart
76 
77  # apply wrap and position limits to moving axes
78  if obj.targetMount[i].isfinite():
79  wrapPref = wrapPrefList[i]
80  nearPos = oldMount.getPos(tai)
81  if not numpy.isfinite(nearPos) and wrapPref == tcc.base.WrapType_Nearest:
82  # set nearPos to last known position; if that is also unknown then use middle wrap
83  nearPos = obj.actMount[i].getPos(tai)
84  if not numpy.isfinite(nearPos):
85  sys.stderr.write("Warning: near wrap wanted but current position unknown; using middle\n")
86  wrapPref = tcc.base.WrapType_Middle
87 
88  obj.targetMount[i].pos, obj.axisErrCode[i] = checkPos(
89  pos = obj.targetMount[i].pos,
90  minPos = axeLim.minPos[i],
91  maxPos = axeLim.maxPos[i],
92  nearPos = nearPos,
93  wrapPref = wrapPref,
94  doWrap = doWrap,
95  )
96 
97  obj.updateTime = tai
def computeObj
Compute all computed obj fields from user-specified fields except path generator outputs.
Definition: computeObj.py:22