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

Поисковые слова: п п п п п п п п п п п п п п
lsst.tcc: python/tcc/cmd/showInstrument.py Source File
lsst.tcc  1.2.2-3-g89ecb63
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
showInstrument.py
Go to the documentation of this file.
1 from __future__ import division, absolute_import
2 """
3  notes:
4  I do not--
5  worry about name lengths & truncation as old tcc behaves
6  show filters not on inst blk
7  show guide probe info
8 """
9 from RO.StringUtil import quoteStr
10 
11 from .showFocus import showFocus
12 from tcc.msg import showAxeLim
13 
14 __all__ = ["showInstrument"]
15 
16 def showInstrument(tccActor, userCmd, setDone=True, showFull=None):
17  """
18  @param[in] tccActor tcc actor
19  reads tccActor.inst
20  @param[in,out] userCmd user command; if showFull is None then parsedCmd attribute must be set
21  @param[in] setDone set userCmd done when finished? (ignored if userCmd is already done)
22  @param[in] showFull if True then show all data; if False then show an abbreviated version;
23  if None then use the "full" qualifier in userCmd, if present, else use True
24  """
25  if showFull is None:
26  if "full" in userCmd.parsedCmd.qualDict:
27  showFull = userCmd.parsedCmd.qualDict["full"].boolValue
28  else:
29  showFull = True
30  kwStrs = []
31  inst = tccActor.inst
32  instPos = inst.instPos.getName()
33  if instPos == "?":
34  instPos = "non"
35  kwStrs.append("Inst=%s; InstPos=%s; GCView=%s" % (
36  quoteStr(tccActor.inst.instName),
37  instPos,
38  quoteStr(inst.gcViewName),
39  ))
40  if showFull:
41  ipConfig = "".join((
42  "T" if (inst.rotID > 0) else "F",
43  "T" if (inst.gcamID > 0) else "F",
44  "T" if (inst.gmechID > 0) else "F"
45  ))
46  kwStrs.append("IPConfig=%s; RotID=%i, 0; GCamID=%i, 0; GMechID=%i" % \
47  (ipConfig, inst.rotID, inst.gcamID, inst.gmechID))
48  kwStrs.append("IImScale=%0.4f, %0.4f; IImCtr=%0.2f, %0.2f; IImLim=%0.2f, %0.2f, %0.2f, %0.2f" % (
49  inst.iim_scale[0], inst.iim_scale[1],
50  inst.iim_ctr[0], inst.iim_ctr[1],
51  inst.iim_minXY[0], inst.iim_minXY[1],
52  inst.iim_maxXY[0], inst.iim_maxXY[1],
53  ))
54  kwStrs.append("InstFocus=%0.2f" % (inst.inst_foc,))
55  kwStrs.append("RotInstXYAng=%0.6f, %0.6f, %0.6f" % (
56  inst.rot_inst_xy[0],
57  inst.rot_inst_xy[1],
58  inst.rot_inst_ang,
59  ))
60  if (inst.gcamID > 0):
61  kwStrs.append("GImScale=%0.4f, %0.4f; GImCtr=%0.2f, %0.2f; GImLim=%0.2f, %0.2f, %0.2f, %0.2f" % (
62  inst.gim_scale[0], inst.gim_scale[1],
63  inst.gim_ctr[0], inst.gim_ctr[1],
64  inst.gim_minXY[0], inst.gim_minXY[1],
65  inst.gim_maxXY[0], inst.gim_maxXY[1],
66  ))
67  kwStrs.append("GCNomFocus=%0.2f" % (inst.gcNomFocus,))
68  else:
69  kwStrs.append("GImScale=NaN, NaN; GImCtr=NaN, NaN; GImLim=NaN, NaN, NaN, NaN")
70  kwStrs.append("GCNomFocus=NaN")
71  kwStrs.append("PtErrProbe=%d" % (inst.ptErrProbe),)
72  for i, probe in enumerate(inst.gProbe):
73  probeNum = i + 1
74  kwStrs.append("GProbeInfo=%d, %s, %0.2f, %0.2f, %0.2f, %0.2f, %0.2f, %0.2f, %0.6f, %0.6f, %0.5f" % (
75  probeNum,
76  "T" if probe.exists else "F",
77  probe.ctr[0], probe.ctr[1],
78  probe.minXY[0], probe.minXY[1],
79  probe.maxXY[0], probe.maxXY[1],
80  probe.rot_gp_xy[0], probe.rot_gp_xy[1],
81  probe.rot_gim_ang,
82  ))
83  # the following is a deprecated version of gProbeInfo; remove when it is safe to do so
84  kwStrs.append("GProbe=%d; GPCtr=%0.2f, %0.2f; GPLim=%0.2f, %0.2f, %0.2f, %0.2f" % (
85  probeNum,
86  probe.ctr[0], probe.ctr[1],
87  probe.minXY[0], probe.minXY[1],
88  probe.maxXY[0], probe.maxXY[1],
89  ))
90 
91  for kwStr in kwStrs:
92  tccActor.writeToUsers("i", kwStr, userCmd)
93  if showFull:
94  showAxeLim(tccActor, userCmd)
95  showFocus(tccActor, userCmd, setDone=False)
96  if setDone and not userCmd.isDone:
97  userCmd.setState(userCmd.Done)