LSST Applications  21.0.0-172-gfb10e10a+18fedfabac,22.0.0+297cba6710,22.0.0+80564b0ff1,22.0.0+8d77f4f51a,22.0.0+a28f4c53b1,22.0.0+dcf3732eb2,22.0.1-1-g7d6de66+2a20fdde0d,22.0.1-1-g8e32f31+297cba6710,22.0.1-1-geca5380+7fa3b7d9b6,22.0.1-12-g44dc1dc+2a20fdde0d,22.0.1-15-g6a90155+515f58c32b,22.0.1-16-g9282f48+790f5f2caa,22.0.1-2-g92698f7+dcf3732eb2,22.0.1-2-ga9b0f51+7fa3b7d9b6,22.0.1-2-gd1925c9+bf4f0e694f,22.0.1-24-g1ad7a390+a9625a72a8,22.0.1-25-g5bf6245+3ad8ecd50b,22.0.1-25-gb120d7b+8b5510f75f,22.0.1-27-g97737f7+2a20fdde0d,22.0.1-32-gf62ce7b1+aa4237961e,22.0.1-4-g0b3f228+2a20fdde0d,22.0.1-4-g243d05b+871c1b8305,22.0.1-4-g3a563be+32dcf1063f,22.0.1-4-g44f2e3d+9e4ab0f4fa,22.0.1-42-gca6935d93+ba5e5ca3eb,22.0.1-5-g15c806e+85460ae5f3,22.0.1-5-g58711c4+611d128589,22.0.1-5-g75bb458+99c117b92f,22.0.1-6-g1c63a23+7fa3b7d9b6,22.0.1-6-g50866e6+84ff5a128b,22.0.1-6-g8d3140d+720564cf76,22.0.1-6-gd805d02+cc5644f571,22.0.1-8-ge5750ce+85460ae5f3,master-g6e05de7fdc+babf819c66,master-g99da0e417a+8d77f4f51a,w.2021.48
LSST Data Management Base Package
Public Member Functions | Static Public Attributes | List of all members
lsst.pipe.tasks.computeExposureSummaryStats.ComputeExposureSummaryStatsTask Class Reference
Inheritance diagram for lsst.pipe.tasks.computeExposureSummaryStats.ComputeExposureSummaryStatsTask:

Public Member Functions

def run (self, exposure, sources, background)
 

Static Public Attributes

 ConfigClass = ComputeExposureSummaryStatsConfig
 

Detailed Description

Task to compute exposure summary statistics.

This task computes various quantities suitable for DPDD and other
downstream processing at the detector centers, including:
- psfSigma
- psfArea
- psfIxx
- psfIyy
- psfIxy
- ra
- decl
- zenithDistance
- zeroPoint
- skyBg
- skyNoise
- meanVar
- raCorners
- decCorners
- astromOffsetMean
- astromOffsetStd

These additional quantities are computed from the stars in the detector:
- psfStarDeltaE1Median
- psfStarDeltaE2Median
- psfStarDeltaE1Scatter
- psfStarDeltaE2Scatter
- psfStarDeltaSizeMedian
- psfStarDeltaSizeScatter
- psfStarScaledDeltaSizeScatter

Definition at line 74 of file computeExposureSummaryStats.py.

Member Function Documentation

◆ run()

def lsst.pipe.tasks.computeExposureSummaryStats.ComputeExposureSummaryStatsTask.run (   self,
  exposure,
  sources,
  background 
)
Measure exposure statistics from the exposure, sources, and background.

Parameters
----------
exposure : `lsst.afw.image.ExposureF`
sources : `lsst.afw.table.SourceCatalog`
background : `lsst.afw.math.BackgroundList`

Returns
-------
summary : `lsst.afw.image.ExposureSummary`

Definition at line 109 of file computeExposureSummaryStats.py.

109  def run(self, exposure, sources, background):
110  """Measure exposure statistics from the exposure, sources, and background.
111 
112  Parameters
113  ----------
114  exposure : `lsst.afw.image.ExposureF`
115  sources : `lsst.afw.table.SourceCatalog`
116  background : `lsst.afw.math.BackgroundList`
117 
118  Returns
119  -------
120  summary : `lsst.afw.image.ExposureSummary`
121  """
122  self.log.info("Measuring exposure statistics")
123 
124  bbox = exposure.getBBox()
125 
126  psf = exposure.getPsf()
127  if psf is not None:
128  shape = psf.computeShape(bbox.getCenter())
129  psfSigma = shape.getDeterminantRadius()
130  psfIxx = shape.getIxx()
131  psfIyy = shape.getIyy()
132  psfIxy = shape.getIxy()
133  im = psf.computeKernelImage(bbox.getCenter())
134  # The calculation of effective psf area is taken from
135  # meas_base/src/PsfFlux.cc#L112. See
136  # https://github.com/lsst/meas_base/blob/
137  # 750bffe6620e565bda731add1509507f5c40c8bb/src/PsfFlux.cc#L112
138  psfArea = np.sum(im.array)/np.sum(im.array**2.)
139  else:
140  psfSigma = np.nan
141  psfIxx = np.nan
142  psfIyy = np.nan
143  psfIxy = np.nan
144  psfArea = np.nan
145 
146  wcs = exposure.getWcs()
147  if wcs is not None:
148  sph_pts = wcs.pixelToSky(lsst.geom.Box2D(bbox).getCorners())
149  raCorners = [float(sph.getRa().asDegrees()) for sph in sph_pts]
150  decCorners = [float(sph.getDec().asDegrees()) for sph in sph_pts]
151 
152  sph_pt = wcs.pixelToSky(bbox.getCenter())
153  ra = sph_pt.getRa().asDegrees()
154  decl = sph_pt.getDec().asDegrees()
155  else:
156  raCorners = [float(np.nan)]*4
157  decCorners = [float(np.nan)]*4
158  ra = np.nan
159  decl = np.nan
160 
161  photoCalib = exposure.getPhotoCalib()
162  if photoCalib is not None:
163  zeroPoint = 2.5*np.log10(photoCalib.getInstFluxAtZeroMagnitude())
164  else:
165  zeroPoint = np.nan
166 
167  visitInfo = exposure.getInfo().getVisitInfo()
168  date = visitInfo.getDate()
169 
170  if date.isValid():
171  # We compute the zenithDistance at the center of the detector rather
172  # than use the boresight value available via the visitInfo, because
173  # the zenithDistance may vary significantly over a large field of view.
174  observatory = visitInfo.getObservatory()
175  loc = EarthLocation(lat=observatory.getLatitude().asDegrees()*units.deg,
176  lon=observatory.getLongitude().asDegrees()*units.deg,
177  height=observatory.getElevation()*units.m)
178  obstime = Time(visitInfo.getDate().get(system=DateTime.MJD),
179  location=loc, format='mjd')
180  coord = SkyCoord(ra*units.degree, decl*units.degree, obstime=obstime, location=loc)
181  with warnings.catch_warnings():
182  warnings.simplefilter('ignore')
183  altaz = coord.transform_to(AltAz)
184 
185  zenithDistance = 90.0 - altaz.alt.degree
186  else:
187  zenithDistance = np.nan
188 
189  if background is not None:
190  bgStats = (bg[0].getStatsImage().getImage().array
191  for bg in background)
192  skyBg = sum(np.median(bg[np.isfinite(bg)]) for bg in bgStats)
193  else:
194  skyBg = np.nan
195 
196  statsCtrl = afwMath.StatisticsControl()
197  statsCtrl.setNumSigmaClip(self.config.sigmaClip)
198  statsCtrl.setNumIter(self.config.clipIter)
199  statsCtrl.setAndMask(afwImage.Mask.getPlaneBitMask(self.config.badMaskPlanes))
200  statsCtrl.setNanSafe(True)
201 
202  statObj = afwMath.makeStatistics(exposure.getMaskedImage(), afwMath.STDEVCLIP,
203  statsCtrl)
204  skyNoise, _ = statObj.getResult(afwMath.STDEVCLIP)
205 
206  statObj = afwMath.makeStatistics(exposure.getMaskedImage().getVariance(),
207  exposure.getMaskedImage().getMask(),
208  afwMath.MEANCLIP, statsCtrl)
209  meanVar, _ = statObj.getResult(afwMath.MEANCLIP)
210 
211  md = exposure.getMetadata()
212  if 'SFM_ASTROM_OFFSET_MEAN' in md:
213  astromOffsetMean = md['SFM_ASTROM_OFFSET_MEAN']
214  astromOffsetStd = md['SFM_ASTROM_OFFSET_STD']
215  else:
216  astromOffsetMean = np.nan
217  astromOffsetStd = np.nan
218 
219  psfStats = self._computePsfStats(sources)
220 
221  # Note that all numpy values have to be explicitly converted to
222  # python floats for yaml serialization.
224  psfSigma=float(psfSigma),
225  psfArea=float(psfArea),
226  psfIxx=float(psfIxx),
227  psfIyy=float(psfIyy),
228  psfIxy=float(psfIxy),
229  ra=float(ra),
230  decl=float(decl),
231  zenithDistance=float(zenithDistance),
232  zeroPoint=float(zeroPoint),
233  skyBg=float(skyBg),
234  skyNoise=float(skyNoise),
235  meanVar=float(meanVar),
236  raCorners=raCorners,
237  decCorners=decCorners,
238  astromOffsetMean=astromOffsetMean,
239  astromOffsetStd=astromOffsetStd,
240  nPsfStar=psfStats.nPsfStar,
241  psfStarDeltaE1Median=psfStats.psfStarDeltaE1Median,
242  psfStarDeltaE2Median=psfStats.psfStarDeltaE2Median,
243  psfStarDeltaE1Scatter=psfStats.psfStarDeltaE1Scatter,
244  psfStarDeltaE2Scatter=psfStats.psfStarDeltaE2Scatter,
245  psfStarDeltaSizeMedian=psfStats.psfStarDeltaSizeMedian,
246  psfStarDeltaSizeScatter=psfStats.psfStarDeltaSizeScatter,
247  psfStarScaledDeltaSizeScatter=psfStats.psfStarScaledDeltaSizeScatter
248  )
249 
250  return summary
251 
Pass parameters to a Statistics object.
Definition: Statistics.h:92
A floating-point coordinate rectangle geometry.
Definition: Box.h:413
Statistics makeStatistics(lsst::afw::image::Image< Pixel > const &img, lsst::afw::image::Mask< image::MaskPixel > const &msk, int const flags, StatisticsControl const &sctrl=StatisticsControl())
Handle a watered-down front-end to the constructor (no variance)
Definition: Statistics.h:359
def run(self, coaddExposures, bbox, wcs)
Definition: getTemplate.py:603

Member Data Documentation

◆ ConfigClass

lsst.pipe.tasks.computeExposureSummaryStats.ComputeExposureSummaryStatsTask.ConfigClass = ComputeExposureSummaryStatsConfig
static

Definition at line 105 of file computeExposureSummaryStats.py.


The documentation for this class was generated from the following file: