LSST Applications g0f08755f38+9c285cab97,g1635faa6d4+13f3999e92,g1653933729+a8ce1bb630,g1a0ca8cf93+bf6eb00ceb,g28da252d5a+0829b12dee,g29321ee8c0+5700dc9eac,g2bbee38e9b+9634bc57db,g2bc492864f+9634bc57db,g2cdde0e794+c2c89b37c4,g3156d2b45e+41e33cbcdc,g347aa1857d+9634bc57db,g35bb328faa+a8ce1bb630,g3a166c0a6a+9634bc57db,g3e281a1b8c+9f2c4e2fc3,g414038480c+077ccc18e7,g41af890bb2+fde0dd39b6,g5fbc88fb19+17cd334064,g781aacb6e4+a8ce1bb630,g80478fca09+55a9465950,g82479be7b0+d730eedb7d,g858d7b2824+9c285cab97,g9125e01d80+a8ce1bb630,g9726552aa6+10f999ec6a,ga5288a1d22+2a84bb7594,gacf8899fa4+c69c5206e8,gae0086650b+a8ce1bb630,gb58c049af0+d64f4d3760,gc28159a63d+9634bc57db,gcf0d15dbbd+4b7d09cae4,gda3e153d99+9c285cab97,gda6a2b7d83+4b7d09cae4,gdaeeff99f8+1711a396fd,ge2409df99d+5e831397f4,ge79ae78c31+9634bc57db,gf0baf85859+147a0692ba,gf3967379c6+41c94011de,gf3fb38a9a8+8f07a9901b,gfb92a5be7c+9c285cab97,w.2024.46
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.