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

Поисковые слова: р п р п р п р п р п р п р п р п р п р п р п р п р п р п р п р п р п р п р п р п р п р п
lsst.tcc: python/tcc/mir/mirrorDeviceSet.py Source File
lsst.tcc  1.2.2-3-g89ecb63
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
mirrorDeviceSet.py
Go to the documentation of this file.
1 from __future__ import division, absolute_import
2 
3 from twistedActor import DeviceSet, LinkCommands, UserCmd
4 
5 __all__ = ["MirrorDeviceSet"]
6 
7 class MirrorDeviceSet(DeviceSet):
8  SlotList = ("prim", "sec", "tert")
9  """!Mirror devices
10  """
11  DefaultTimeLim = 2
12  def __init__(self, actor, devList):
13  """!Construct an MirrorDeviceSet
14 
15  @param[in] actor actor (instance of twistedActor.BaseActor);
16  used for writeToUsers in this class, and subclasses may make additonal use of it
17  @param[in] devList prim, sec, and tert device; any can be None if it does not exist
18 
19  @throw RuntimeError if len(devList) != 3
20  """
21  DeviceSet.__init__(self,
22  actor = actor,
23  slotList = self.SlotList,
24  devList = devList,
25  connStateKeyword = "mirrorConnState",
26  )
27  # start keyword forwarding
28  for dev in devList:
29  if dev != None:
30  dev.startKWForwarding()
31 
32  def connectOrInit(self, slotList=None, userCmd=None, timeLim=DefaultTimeLim):
33  """!Connect and stop axis controllers
34 
35  Specified axis controllers that are already connected are simply stopped.
36 
37  @param[in] slotList collection of slot names, or None for all filled slots
38  @param[in] userCmd user command whose set state is set to Done or Failed when all device commands are done;
39  if None a new UserCmd is created and returned
40  @param[in] timeLim time limit for command (sec)
41  @return userCmd: the supplied userCmd or a newly created UserCmd
42  """
43  # print "connectOrInit(slotList=%r, userCmd=%r)" % (slotList, userCmd)
44  expSlotList = self.expandSlotList(slotList)
45  connSlotList = [slot for slot in expSlotList if self.get(slot).isConnected]
46  notConnSlotList = list(set(expSlotList) - set(connSlotList))
47  initUserCmd = self.init(connSlotList, timeLim=timeLim)
48  connUserCmd = self.connect(notConnSlotList, timeLim=timeLim)
49  if userCmd is None:
50  userCmd = UserCmd()
51  LinkCommands(userCmd, (initUserCmd, connUserCmd))
52  return userCmd
53 
54  def status(self, slotList=None, userCmd=None, timeLim=DefaultTimeLim):
55  """!Get status from the mirror controllers
56 
57  @param[in] slotList collection of slot names, or None for all filled slots
58  @param[in] userCmd user command whose set state is set to Done or Failed when all device commands are done;
59  if None a new UserCmd is created and returned
60  @param[in] timeLim time limit for command (sec)
61  @return userCmd: the supplied userCmd or a newly created UserCmd
62 
63  @throw RuntimeError if slotList has empty or non-existent slots
64  """
65  self.showConnState(userCmd=userCmd)
66  return self.startCmd(cmdStrOrList="status", slotList=slotList, userCmd=userCmd, timeLim=timeLim)
67 
68  def init(self, slotList=None, userCmd=None, timeLim=DefaultTimeLim):
69  """!Initialize the mirror controllers
70 
71  @param[in] slotList collection of slot names, or None for all filled slots
72  @param[in] userCmd user command whose set state is set to Done or Failed when all device commands are done;
73  if None a new UserCmd is created and returned
74  @param[in] timeLim time limit for command (sec)
75  @return userCmd: the supplied userCmd or a newly created UserCmd
76 
77  @throw RuntimeError if slotList has empty or non-existent slots
78  """
79  return self.startCmd(cmdStrOrList="stop", slotList = slotList, userCmd=userCmd, timeLim=timeLim)
def __init__
Construct an MirrorDeviceSet.
def connectOrInit
Connect and stop axis controllers.
def init
Initialize the mirror controllers.
def status
Get status from the mirror controllers.