LSST Applications g1653933729+34a971ddd9,g1a997c3884+34a971ddd9,g28da252d5a+e9c12036e6,g2bbee38e9b+387d105147,g2bc492864f+387d105147,g2ca4be77d2+2af33ed832,g2cdde0e794+704103fe75,g3156d2b45e+6e87dc994a,g347aa1857d+387d105147,g35bb328faa+34a971ddd9,g3a166c0a6a+387d105147,g3bc1096a96+da0d0eec6b,g3e281a1b8c+8ec26ec694,g4005a62e65+ba0306790b,g414038480c+9f5be647b3,g41af890bb2+260fbe2614,g5065538af8+ba676e4b71,g5a0bb5165c+019e928339,g717e5f8c0f+90540262f6,g80478fca09+bbe9b7c29a,g8204df1d8d+90540262f6,g82479be7b0+c8d705dbd9,g858d7b2824+90540262f6,g9125e01d80+34a971ddd9,g91f4dbe722+fd1343598d,ga5288a1d22+cbf2f5b209,gae0086650b+34a971ddd9,gb58c049af0+ace264a4f2,gc28159a63d+387d105147,gcf0d15dbbd+c403bb023e,gd6b7c0dfd1+f7139e6704,gda6a2b7d83+c403bb023e,gdaeeff99f8+7774323b41,ge2409df99d+d3bbf40f76,ge33fd446bb+90540262f6,ge79ae78c31+387d105147,gf0baf85859+890af219f9,gf5289d68f6+d7e5a322af,w.2024.37
LSST Data Management Base Package
Loading...
Searching...
No Matches
Classes | Functions | Variables
lsst.pipe.tasks.peekExposure Namespace Reference

Classes

class  DonutPsf
 
class  PeekDonutTask
 
class  PeekDonutTaskConfig
 
class  PeekExposureTask
 
class  PeekExposureTaskConfig
 
class  PeekPhotoTask
 
class  PeekPhotoTaskConfig
 
class  PeekSpecTask
 
class  PeekSpecTaskConfig
 
class  PeekTask
 
class  PeekTaskConfig
 

Functions

 isDispersedExp (exp)
 
float _estimateMode (npt.NDArray[np.float64] data, float frac=0.5)
 
geom.Extent2D _bearingToUnitVector (afwGeom.SkyWcs wcs, geom.Angle bearing, geom.Point2D imagePoint, geom.SpherePoint|None skyPoint=None)
 
dict roseVectors (afwGeom.SkyWcs wcs, geom.Point2D imagePoint, geom.Angle|None parAng=None)
 
None plotRose (afwDisplay.Display display, afwGeom.SkyWcs wcs, geom.Point2D imagePoint, geom.Angle|None parAng=None, float len=50)
 

Variables

int IDX_SENTINEL = -99999
 
str FILTER_DELIMITER = "~"
 

Function Documentation

◆ _bearingToUnitVector()

geom.Extent2D lsst.pipe.tasks.peekExposure._bearingToUnitVector ( afwGeom.SkyWcs wcs,
geom.Angle bearing,
geom.Point2D imagePoint,
geom.SpherePoint | None skyPoint = None )
protected
Compute unit vector along given bearing at given point in the sky.

Parameters
----------
wcs : `lsst.afw.geom.SkyWcs`
    World Coordinate System of image.
bearing : `lsst.geom.Angle`
    Bearing (angle North of East) at which to compute unit vector.
imagePoint : `lsst.geom.Point2D`
    Point in the image.
skyPoint : `lsst.geom.SpherePoint`, optional
    Point in the sky.

Returns
-------
unitVector : `lsst.geom.Extent2D`
    Unit vector in the direction of bearing.

Definition at line 118 of file peekExposure.py.

123) -> geom.Extent2D:
124 """Compute unit vector along given bearing at given point in the sky.
125
126 Parameters
127 ----------
128 wcs : `lsst.afw.geom.SkyWcs`
129 World Coordinate System of image.
130 bearing : `lsst.geom.Angle`
131 Bearing (angle North of East) at which to compute unit vector.
132 imagePoint : `lsst.geom.Point2D`
133 Point in the image.
134 skyPoint : `lsst.geom.SpherePoint`, optional
135 Point in the sky.
136
137 Returns
138 -------
139 unitVector : `lsst.geom.Extent2D`
140 Unit vector in the direction of bearing.
141 """
142 if skyPoint is None:
143 skyPoint = wcs.pixelToSky(imagePoint)
144 dpt = wcs.skyToPixel(skyPoint.offset(bearing, 1e-4 * degrees)) - imagePoint
145 return dpt / dpt.computeNorm()
146
147

◆ _estimateMode()

float lsst.pipe.tasks.peekExposure._estimateMode ( npt.NDArray[np.float64] data,
float frac = 0.5 )
protected
Estimate the mode of a 1d distribution.

Finds the smallest interval containing the fraction ``frac`` of the data,
then takes the median of the values in that interval.

Parameters
----------
data : array-like
    1d array of data values
frac : float, optional
    Fraction of data to include in the mode interval.  Default is 0.5.

Returns
-------
mode : float
    Estimated mode of the data.

Definition at line 86 of file peekExposure.py.

86def _estimateMode(data: npt.NDArray[np.float64], frac: float = 0.5) -> float:
87 """Estimate the mode of a 1d distribution.
88
89 Finds the smallest interval containing the fraction ``frac`` of the data,
90 then takes the median of the values in that interval.
91
92 Parameters
93 ----------
94 data : array-like
95 1d array of data values
96 frac : float, optional
97 Fraction of data to include in the mode interval. Default is 0.5.
98
99 Returns
100 -------
101 mode : float
102 Estimated mode of the data.
103 """
104
105 data = data[np.isfinite(data)]
106 if len(data) == 0:
107 return np.nan
108 elif len(data) == 1:
109 return data[0]
110
111 data = np.sort(data)
112 interval = int(np.ceil(frac * len(data)))
113 spans = data[interval:] - data[:-interval]
114 start = np.argmin(spans)
115 return np.median(data[start: start + interval])
116
117

◆ isDispersedExp()

lsst.pipe.tasks.peekExposure.isDispersedExp ( exp)
Check if an exposure is dispersed.

Note this is copied from `atmospec.utils.isDispersedExp` to avoid a
circular import.

Parameters
----------
exp : `lsst.afw.image.Exposure`
    The exposure.

Returns
-------
isDispersed : `bool`
    Whether it is a dispersed image or not.

Definition at line 61 of file peekExposure.py.

61def isDispersedExp(exp):
62 """Check if an exposure is dispersed.
63
64 Note this is copied from `atmospec.utils.isDispersedExp` to avoid a
65 circular import.
66
67 Parameters
68 ----------
69 exp : `lsst.afw.image.Exposure`
70 The exposure.
71
72 Returns
73 -------
74 isDispersed : `bool`
75 Whether it is a dispersed image or not.
76 """
77 filterFullName = exp.filter.physicalLabel
78 if FILTER_DELIMITER not in filterFullName:
79 raise RuntimeError(f"Error parsing filter name {filterFullName}")
80 filt, grating = filterFullName.split(FILTER_DELIMITER)
81 if grating.upper().startswith('EMPTY'):
82 return False
83 return True
84
85

◆ plotRose()

None lsst.pipe.tasks.peekExposure.plotRose ( afwDisplay.Display display,
afwGeom.SkyWcs wcs,
geom.Point2D imagePoint,
geom.Angle | None parAng = None,
float len = 50 )
Display unit vectors along N/W and optionally alt/az directions.

Parameters
----------
display : `lsst.afw.display.Display`
    Display on which to render rose.
wcs : `lsst.afw.geom.SkyWcs`
    World Coordinate System of image.
imagePoint : `lsst.geom.Point2D`
    Point in the image at which to render rose.
parAng : `lsst.geom.Angle`, optional
    Parallactic angle (position angle of zenith measured East from North)
    (default: None)
len : `float`, optional
    Length of the rose vectors (default: 50)

Definition at line 181 of file peekExposure.py.

187) -> None:
188 """Display unit vectors along N/W and optionally alt/az directions.
189
190 Parameters
191 ----------
192 display : `lsst.afw.display.Display`
193 Display on which to render rose.
194 wcs : `lsst.afw.geom.SkyWcs`
195 World Coordinate System of image.
196 imagePoint : `lsst.geom.Point2D`
197 Point in the image at which to render rose.
198 parAng : `lsst.geom.Angle`, optional
199 Parallactic angle (position angle of zenith measured East from North)
200 (default: None)
201 len : `float`, optional
202 Length of the rose vectors (default: 50)
203 """
204 unitVectors = roseVectors(wcs, imagePoint, parAng=parAng)
205 colors = dict(N="r", W="r", alt="g", az="g")
206 for name, unitVector in unitVectors.items():
207 display.line([imagePoint, imagePoint + len * unitVector], ctype=colors[name])
208 display.dot(name, *(imagePoint + 1.6 * len * unitVector), ctype=colors[name])
209
210

◆ roseVectors()

dict lsst.pipe.tasks.peekExposure.roseVectors ( afwGeom.SkyWcs wcs,
geom.Point2D imagePoint,
geom.Angle | None parAng = None )
Compute unit vectors in the N/W and optionally alt/az directions.

Parameters
----------
wcs : `lsst.afw.geom.SkyWcs`
    World Coordinate System of image.
imagePoint : `lsst.geom.Point2D`
    Point in the image
parAng : `lsst.geom.Angle`, optional
    Parallactic angle (position angle of zenith measured East from North)
    (default: None)

Returns
-------
unitVectors : `dict` of `lsst.geom.Extent2D`
    Unit vectors in the N, W, alt, and az directions.

Definition at line 148 of file peekExposure.py.

148def roseVectors(wcs: afwGeom.SkyWcs, imagePoint: geom.Point2D, parAng: geom.Angle | None = None) -> dict:
149 """Compute unit vectors in the N/W and optionally alt/az directions.
150
151 Parameters
152 ----------
153 wcs : `lsst.afw.geom.SkyWcs`
154 World Coordinate System of image.
155 imagePoint : `lsst.geom.Point2D`
156 Point in the image
157 parAng : `lsst.geom.Angle`, optional
158 Parallactic angle (position angle of zenith measured East from North)
159 (default: None)
160
161 Returns
162 -------
163 unitVectors : `dict` of `lsst.geom.Extent2D`
164 Unit vectors in the N, W, alt, and az directions.
165 """
166 ncp = SpherePoint(0 * degrees, 90 * degrees) # North Celestial Pole
167 skyPoint = wcs.pixelToSky(imagePoint)
168 bearing = skyPoint.bearingTo(ncp)
169
170 out = dict()
171 out["N"] = _bearingToUnitVector(wcs, bearing, imagePoint, skyPoint=skyPoint)
172 out["W"] = _bearingToUnitVector(wcs, bearing + 90 * degrees, imagePoint, skyPoint=skyPoint)
173
174 if parAng is not None:
175 out["alt"] = _bearingToUnitVector(wcs, bearing - parAng, imagePoint, skyPoint=skyPoint)
176 out["az"] = _bearingToUnitVector(wcs, bearing - parAng + 90 * degrees, imagePoint, skyPoint=skyPoint)
177
178 return out
179
180
A class representing an angle.
Definition Angle.h:128

Variable Documentation

◆ FILTER_DELIMITER

str lsst.pipe.tasks.peekExposure.FILTER_DELIMITER = "~"

Definition at line 58 of file peekExposure.py.

◆ IDX_SENTINEL

int lsst.pipe.tasks.peekExposure.IDX_SENTINEL = -99999

Definition at line 53 of file peekExposure.py.