Coverage for python/lsst/sims/coordUtils/LsstCameraUtils.py : 39%

Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
1from __future__ import division
2from builtins import zip
3from builtins import range
4import numpy as np
5import numbers
6import lsst.geom as geom
7from lsst.afw.cameraGeom import FIELD_ANGLE, FOCAL_PLANE, PIXELS
8from lsst.afw.cameraGeom import DetectorType
9from lsst.sims.coordUtils import lsst_camera
10from lsst.sims.coordUtils import focalPlaneCoordsFromPupilCoords
11from lsst.sims.coordUtils import LsstZernikeFitter
12from lsst.sims.coordUtils import pupilCoordsFromPixelCoords, pixelCoordsFromPupilCoords
13from lsst.sims.coordUtils import pupilCoordsFromFocalPlaneCoords
14from lsst.sims.coordUtils import pupilCoordsFromPixelCoords
15from lsst.sims.utils import _pupilCoordsFromRaDec
16from lsst.sims.utils import _raDecFromPupilCoords
17from lsst.sims.coordUtils import getCornerPixels, _validate_inputs_and_chipname
18from lsst.sims.utils.CodeUtilities import _validate_inputs
19from lsst.sims.utils import radiansFromArcsec
21__all__ = ["focalPlaneCoordsFromPupilCoordsLSST",
22 "pupilCoordsFromFocalPlaneCoordsLSST",
23 "chipNameFromPupilCoordsLSST",
24 "_chipNameFromRaDecLSST", "chipNameFromRaDecLSST",
25 "pixelCoordsFromPupilCoordsLSST",
26 "pupilCoordsFromPixelCoordsLSST",
27 "_pixelCoordsFromRaDecLSST", "pixelCoordsFromRaDecLSST",
28 "_raDecFromPixelCoordsLSST", "raDecFromPixelCoordsLSST",
29 "clean_up_lsst_camera"]
31def _lsstCoordUtilsError():
32 msg = "\n\n"
33 msg += "You are calling a method from sims_coordUtils.LsstCameraUtils.\n"
34 msg += "This used to handle sky-to-focal-plane transformations based on "
35 msg += "lsst.obs.lsstSim.\n"
36 msg += "lsst.obs.lsstSim is no longer a supported part of the LSST stack.\n"
37 msg += "It has been replaced with lsst.obs.lsst. Because lsst.obs.lsst uses\n"
38 msg += "different coordinate conventions than lsst.obs.lsstSim, it was\n"
39 msg += "decided not to port the LsstCameraUtils functionality over to\n"
40 msg += "using lsst.obs.lsst. If you would still like to use the functionality\n"
41 msg += "provided by sims_coordUtils for mapping sky coordinates to focal plane\n"
42 msg += "coordinates, it is recommended that you use the methods in\n"
43 msg += "lsst.sims.coordUtils.CameraUtils with a camera instantiated as\n\n"
44 msg += "lsst.obs.lsst.phosim.PhosimMapper().camera\n\n"
46 raise RuntimeError(msg)
49def clean_up_lsst_camera():
50 """
51 Delete member objects associated with the methods below
52 """
53 if hasattr(focalPlaneCoordsFromPupilCoordsLSST, '_z_fitter'):
54 del focalPlaneCoordsFromPupilCoordsLSST._z_fitter
55 if hasattr(pupilCoordsFromFocalPlaneCoordsLSST, '_z_fitter'):
56 del pupilCoordsFromFocalPlaneCoordsLSST._z_fitter
57 if hasattr(chipNameFromPupilCoordsLSST, '_detector_arr'):
58 del chipNameFromPupilCoordsLSST._detector_arr
59 if hasattr(lsst_camera, '_lsst_camera'):
60 del lsst_camera._lsst_camera
62def focalPlaneCoordsFromPupilCoordsLSST(xPupil, yPupil, band='r'):
63 """
64 Deprecated in favor of
65 lsst.sims.coordUtils.CameraUtils.focalPlaneCoordsFromPupilCoords()
66 with camera = lsst.obs.lsst.phosim.PhosimMapper().camera
67 """
69 _lsstCoordUtilsError()
70 return None
73def pupilCoordsFromFocalPlaneCoordsLSST(xmm, ymm, band='r'):
74 """
75 Deprecated in favor of
76 lsst.sims.coordUtils.CameraUtils.pupilCoordsFromFocalPlaneCoords()
77 with camera = lsst.obs.lsst.phosim.PhosimMapper().camera
78 """
79 _lsstCoordUtilsError()
80 return None
83def chipNameFromPupilCoordsLSST(xPupil_in, yPupil_in, allow_multiple_chips=False, band='r'):
84 """
85 Deprecated in favor of
86 lsst.sims.coordUtils.CameraUtils.chipNameFromPupilCoords()
87 with camera = lsst.obs.lsst.phosim.PhosimMapper().camera
88 """
90 _lsstCoordUtilsError()
91 return None
94def _chipNameFromRaDecLSST(ra, dec, pm_ra=None, pm_dec=None, parallax=None, v_rad=None,
95 obs_metadata=None, epoch=2000.0, allow_multiple_chips=False,
96 band='r'):
97 """
98 Deprecated in favor of
99 lsst.sims.coordUtils.CameraUtils._chipNameFromRaDec()
100 with camera = lsst.obs.lsst.phosim.PhosimMapper().camera
101 """
103 _lsstCoordUtilsError()
104 return None
107def chipNameFromRaDecLSST(ra, dec, pm_ra=None, pm_dec=None, parallax=None, v_rad=None,
108 obs_metadata=None, epoch=2000.0, allow_multiple_chips=False,
109 band='r'):
110 """
111 Deprecated in favor of
112 lsst.sims.coordUtils.CameraUtils.chipNameFromRaDec()
113 with camera = lsst.obs.lsst.phosim.PhosimMapper().camera
114 """
116 _lsstCoordUtilsError()
117 return None
120def pupilCoordsFromPixelCoordsLSST(xPix, yPix, chipName=None, band="r",
121 includeDistortion=True):
122 """
123 Deprecated in favor of
124 lsst.sims.coordUtils.CameraUtils.pupilCoordsFromPixelCoords()
125 with camera = lsst.obs.lsst.phosim.PhosimMapper().camera
126 """
128 _lsstCoordUtilsError()
129 return None
132def pixelCoordsFromPupilCoordsLSST(xPupil, yPupil, chipName=None, band="r",
133 includeDistortion=True):
134 """
135 Deprecated in favor of
136 lsst.sims.coordUtils.CameraUtils.pixelCoordsFromPupilCoords()
137 with camera = lsst.obs.lsst.phosim.PhosimMapper().camera
138 """
140 _lsstCoordUtilsError()
141 return None
144def _pixelCoordsFromRaDecLSST(ra, dec, pm_ra=None, pm_dec=None, parallax=None, v_rad=None,
145 obs_metadata=None,
146 chipName=None, camera=None,
147 epoch=2000.0, includeDistortion=True,
148 band='r'):
149 """
150 Deprecated in favor of
151 lsst.sims.coordUtils.CameraUtils._pixelCoordsFromRaDec()
152 with camera = lsst.obs.lsst.phosim.PhosimMapper().camera
153 """
155 _lsstCoordUtilsError()
156 return None
159def pixelCoordsFromRaDecLSST(ra, dec, pm_ra=None, pm_dec=None, parallax=None, v_rad=None,
160 obs_metadata=None, chipName=None,
161 epoch=2000.0, includeDistortion=True,
162 band='r'):
163 """
164 Deprecated in favor of
165 lsst.sims.coordUtils.CameraUtils.pixelCoordsFromRaDec()
166 with camera = lsst.obs.lsst.phosim.PhosimMapper().camera
167 """
169 _lsstCoordUtilsError()
170 return None
173def _raDecFromPixelCoordsLSST(xPix, yPix, chipName, band='r',
174 obs_metadata=None, epoch=2000.0,
175 includeDistortion=True):
176 """
177 Deprecated in favor of
178 lsst.sims.coordUtils.CameraUtils._raDecFromPixelCoords()
179 with camera = lsst.obs.lsst.phosim.PhosimMapper().camera
180 """
182 _lsstCoordUtilsError()
183 return None
186def raDecFromPixelCoordsLSST(xPix, yPix, chipName, band='r',
187 obs_metadata=None, epoch=2000.0,
188 includeDistortion=True):
189 """
190 Deprecated in favor of
191 lsst.sims.coordUtils.CameraUtils.raDecFromPixelCoords()
192 with camera = lsst.obs.lsst.phosim.PhosimMapper().camera
193 """
195 _lsstCoordUtilsError()
196 return None