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

Поисковые слова: partial solar eclipse
lsst.tcc: python/tcc/axis/coordConvWithFP.py Source File
lsst.tcc  1.2.2-3-g89ecb63
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
coordConvWithFP.py
Go to the documentation of this file.
1 from __future__ import division, absolute_import
2 
3 import coordConv
4 
5 import tcc.base
6 from .instFromObs import instFromObs
7 from .gProbeFromObs import gProbeFromObs
8 from .gImageFromObs import gImageFromObs
9 from .ptCorrFromObs import ptCorrFromObs
10 from .rotFromObs import rotFromObs
11 from .obsFromInst import obsFromInst
12 from .obsFromGProbe import obsFromGProbe
13 from .obsFromGImage import obsFromGImage
14 from .obsFromPtCorr import obsFromPtCorr
15 from .obsFromRot import obsFromRot
16 
17 __all__ = ["coordConvWithFP"]
18 
19 FPNames = set(("instrument", "gprobe", "gimage", "ptcorr", "rotator"))
20 DeltaT = 0.01
21 
22 def coordConvWithFP(fromCoordSys, fromPVTPair, fromPxPMRadVel, fromDir, toCoordSys, obj, inst, zeroPM, useGSWavelen):
23  """!Convert a coord from one coordinate system to another
24 
25  The conversion is performed at obj.updateTime; you may wish to call computeObj
26  before calling this subroutine to set that to your desired date.
27 
28  @param[in] fromCoordSys from coordinate system; a coordConv.CoordSys
29  if one matches, else an object containing getName() and getDate()
30  (for gimage and gprobe coordinates the date is the guide probe number)
31  @param[in] fromPVTPair from position (equatorial or focal plane x,y, depending on fromSys)
32  @param[in] fromPxPMRadVel from parallax, proper motion and radial velocity
33  @param[in] fromDir from direction as a coordConv.PVT
34  @param[in] toCoordSys to coordinate system (a coordConv.CoordSys)
35  @param[in] obj object block computed at desired desired TAI date of conversion
36  @param[in] inst instrument block
37  @param[in] zeroPM zero proper motion and parallax to the current date?
38  Ignored unless fromCoordSys and toCoordSys are both mean, since otherwise proper motion is always zeroed.
39  @param[in] useGSWavelen use guide star wavelength? else use object wavelength
40 
41  @return a tuple:
42  - toPVTPair: resulting pair of PVTs (equatorial or x,y, depending on toSys)
43  - toPxPMRadVel: resulting parallax, proper motion and radial velocity
44  - toDir: angle of fromDir in the "to" system, as a coordConv.PVT
45  - scaleChange: change in scale (a float): output delta sky/input delta sky, measured along the specified direction
46  """
47  taiDate = obj.updateTime
48  # print "coordConvWithFP(fromCoordSys=%s, fromPVTPair=%s,\n fromPxPMRadVel=%s,\n fromDir=%s, toCoordSys=%s, zeroPM=%s, useGSWavelen=%s), obj.updateTime=%0.7f" % \
49  # (fromCoordSys, fromPVTPair, fromPxPMRadVel, fromDir, toCoordSys, zeroPM, useGSWavelen, obj.updateTime)
50  obj = tcc.base.Obj(obj) # make a copy so I can change obj.site if useGSWavelen
51 
52  if fromCoordSys.isMean() and toCoordSys.isMean() and not zeroPM:
53  # convert directly to avoid zeroing proper motion
54  # safe to do before handling useGSWavelen because wavelength is not used for mean->mean conversion
55  fromPVTCoord = tcc.base.pvtCoordFromPVTPair(fromPVTPair, fromPxPMRadVel)
56  toDir = coordConv.PVT()
57  toPVTCoord, scaleChange = toCoordSys.convertFrom(toDir, fromCoordSys, fromPVTCoord, fromDir, obj.site)
58  toPVTPair, toPxPMRadVel = tcc.base.pvtPairFromPVTCoord(toPVTCoord)
59 
60  return toPVTPair, toPxPMRadVel, toDir, scaleChange
61 
62  if useGSWavelen:
63  obj.site = obj.gsSite
64 
65  # compute "intermediate from" position and coordinate system:
66  # - observed if fromSys is a focal-plane coordinate system (instrument, rotator or gprobe)
67  # - the original fromPVTCoord and fromCoordSys otherwise
68  fromSysName = fromCoordSys.getName().lower()
69  if fromSysName in FPNames:
70  intFromSys = obj.obsSysPtr
71 
72  if fromSysName == "instrument":
73  intFromPVTCoord, fromAzIntAng = obsFromInst(fromPVTPair, obj, taiDate)
74  elif fromSysName == "gimage":
75  gProbeNum = int(fromCoordSys.getDate())
76  intFromPVTCoord, fromAzIntAng = obsFromGImage(fromPVTPair, gProbeNum, obj, inst, taiDate)
77  elif fromSysName == "gprobe":
78  gProbeNum = int(fromCoordSys.getDate())
79  intFromPVTCoord, fromAzIntAng = obsFromGProbe(fromPVTPair, gProbeNum, obj, inst, taiDate)
80  elif fromSysName == "ptcorr":
81  intFromPVTCoord, fromAzIntAng = obsFromPtCorr(fromPVTPair, obj, inst, taiDate)
82  elif fromSysName == "rotator":
83  intFromPVTCoord, fromAzIntAng = obsFromRot(fromPVTPair, obj, inst, taiDate)
84  else:
85  raise RuntimeError("Bug: unknown from focal plane coordinate system %s" % (fromCoordSys,))
86  intFromDir = fromDir - fromAzIntAng
87 
88  else:
89  # intFrom = from (null conversion)
90  intFromSys = fromCoordSys
91  intFromPVTCoord = tcc.base.pvtCoordFromPVTPair(fromPVTPair, fromPxPMRadVel)
92  intFromDir = fromDir
93 
94  # compute final position and coordinate system
95  toSysName = toCoordSys.getName().lower()
96  if toSysName in FPNames:
97  # compute "intermediate to" position in observed coordinates
98  intToSys = obj.obsSysPtr
99  intToDir = coordConv.PVT()
100  intToPVTCoord, scaleChange = intToSys.convertFrom(intToDir, intFromSys, intFromPVTCoord, intFromDir, obj.site)
101 
102  # compute final position in focal plane coordinates
103  if toSysName == "instrument":
104  toPVTPair, targAzToAng = instFromObs(intToPVTCoord, obj, taiDate)
105  elif toSysName == "gprobe":
106  gProbeNum = int(toCoordSys.getDate())
107  toPVTPair, targAzToAng = gProbeFromObs(intToPVTCoord, gProbeNum, obj, inst, taiDate)
108  elif toSysName == "gimage":
109  gProbeNum = int(toCoordSys.getDate())
110  toPVTPair, targAzToAng = gImageFromObs(intToPVTCoord, gProbeNum, obj, inst, taiDate)
111  elif toSysName == "ptcorr":
112  toPVTPair, targAzToAng = ptCorrFromObs(intToPVTCoord, obj, inst, taiDate)
113  elif toSysName == "rotator":
114  toPVTPair, targAzToAng = rotFromObs(intToPVTCoord, obj, inst, taiDate)
115  else:
116  raise RuntimeError("Bug: unknown to focal plane coordinate system %s" % (toCoordSys,))
117 
118  toPxPMRadVel = tcc.base.PxPMRadVel()
119  toDir = intToDir + targAzToAng
120 
121  else:
122  # convert directly from intermediate from system to final to system
123  toDir = coordConv.PVT()
124  toPVTCoord, scaleChange = toCoordSys.convertFrom(toDir, intFromSys, intFromPVTCoord, intFromDir, obj.site)
125  toPVTPair, toPxPMRadVel = tcc.base.pvtPairFromPVTCoord(toPVTCoord)
126 
127  return toPVTPair, toPxPMRadVel, toDir, scaleChange
def rotFromObs
Compute instrument position from observed coordinates.
Definition: rotFromObs.py:10
def obsFromGProbe
Compute observed coordinates from guide probe coordinates.
def ptCorrFromObs
Compute pointing correction position from observed coordinates.
def obsFromGImage
Compute observed coordinates from guide probe coordinates.
Definition: obsFromGImage.py:8
def obsFromPtCorr
Compute observed coordinates from pointing correction coordinates.
def obsFromInst
Compute observed coordinates from instrument coordinates.
Definition: obsFromInst.py:9
def coordConvWithFP
Convert a coord from one coordinate system to another.
def instFromObs
Compute instrument position from observed coordinates.
Definition: instFromObs.py:9
def gProbeFromObs
Compute guide probe position from observed coordinates.
def gImageFromObs
Compute guide probe position from observed coordinates.
Definition: gImageFromObs.py:8
def obsFromRot
Compute observed coordinates from rotator coordinates.
Definition: obsFromRot.py:10