LSST Applications g013ef56533+63812263fb,g083dd6704c+a047e97985,g199a45376c+0ba108daf9,g1fd858c14a+fde7a7a78c,g210f2d0738+db0c280453,g262e1987ae+abed931625,g29ae962dfc+058d1915d8,g2cef7863aa+aef1011c0b,g35bb328faa+8c5ae1fdc5,g3fd5ace14f+64337f1634,g47891489e3+f459a6810c,g53246c7159+8c5ae1fdc5,g54cd7ddccb+890c8e1e5d,g5a60e81ecd+d9e514a434,g64539dfbff+db0c280453,g67b6fd64d1+f459a6810c,g6ebf1fc0d4+8c5ae1fdc5,g7382096ae9+36d16ea71a,g74acd417e5+c70e70fbf6,g786e29fd12+668abc6043,g87389fa792+8856018cbb,g89139ef638+f459a6810c,g8d7436a09f+1b779678e3,g8ea07a8fe4+81eaaadc04,g90f42f885a+34c0557caf,g97be763408+9583a964dd,g98a1a72a9c+028271c396,g98df359435+530b675b85,gb8cb2b794d+4e54f68785,gbf99507273+8c5ae1fdc5,gc2a301910b+db0c280453,gca7fc764a6+f459a6810c,gd7ef33dd92+f459a6810c,gdab6d2f7ff+c70e70fbf6,ge410e46f29+f459a6810c,ge41e95a9f2+db0c280453,geaed405ab2+e3b4b2a692,gf9a733ac38+8c5ae1fdc5,w.2025.43
LSST Data Management Base Package
Loading...
Searching...
No Matches
lsst.pipe.tasks.diffractionSpikeMask Namespace Reference

Classes

class  DiffractionSpikeMaskConfig
 
class  DiffractionSpikeMaskTask
 

Functions

 getRegion (exposure, margin=None)
 
 computePsfWidthFromMoments (psf, angle=0.)
 

Function Documentation

◆ computePsfWidthFromMoments()

lsst.pipe.tasks.diffractionSpikeMask.computePsfWidthFromMoments ( psf,
angle = 0. )
Calculate the width of an elliptical PSF along a given direction.

Parameters
----------
psf : `lsst.afw.detection.Psf`
    The point spread function of the image.
angle : `float`, optional
    Rotation CCW from the +x axis to calculate the width of the PSF along.

Returns
-------
fwhm : `float`
    Full width at half maximum of the fitted shape of the PSF along the
    given `angle`. In pixels.

Definition at line 456 of file diffractionSpikeMask.py.

456def computePsfWidthFromMoments(psf, angle=0.):
457 """Calculate the width of an elliptical PSF along a given direction.
458
459 Parameters
460 ----------
461 psf : `lsst.afw.detection.Psf`
462 The point spread function of the image.
463 angle : `float`, optional
464 Rotation CCW from the +x axis to calculate the width of the PSF along.
465
466 Returns
467 -------
468 fwhm : `float`
469 Full width at half maximum of the fitted shape of the PSF along the
470 given `angle`. In pixels.
471 """
472 psfShape = psf.computeShape(psf.getAveragePosition())
473 c = np.cos(np.deg2rad(angle))
474 s = np.sin(np.deg2rad(angle))
475 sigma2 = c*c*psfShape.getIxx() + 2*c*s*psfShape.getIxy() + s*s*psfShape.getIyy()
476 sigma = np.sqrt(max(sigma2, 0.0)) # rms width in pixels
477
478 # 5) optional: Gaussian-equivalent FWHM along angle
479 fwhm = 2.0 * np.sqrt(2.0 * np.log(2.0)) * sigma
480 return fwhm

◆ getRegion()

lsst.pipe.tasks.diffractionSpikeMask.getRegion ( exposure,
margin = None )
Calculate an enveloping region for an exposure.

Parameters
----------
exposure : `lsst.afw.image.Exposure`
    Exposure object with calibrated WCS.

Returns
-------
region : `lsst.sphgeom.Region`
    Region enveloping an exposure.

Definition at line 424 of file diffractionSpikeMask.py.

424def getRegion(exposure, margin=None):
425 """Calculate an enveloping region for an exposure.
426
427 Parameters
428 ----------
429 exposure : `lsst.afw.image.Exposure`
430 Exposure object with calibrated WCS.
431
432 Returns
433 -------
434 region : `lsst.sphgeom.Region`
435 Region enveloping an exposure.
436 """
437 # Bounding box needs to be a `Box2D` not a `Box2I` for `wcs.pixelToSky()`
438 bbox = lsst.geom.Box2D(exposure.getBBox())
439 wcs = exposure.getWcs()
440
441 region = lsst.sphgeom.ConvexPolygon([pp.getVector() for pp in wcs.pixelToSky(bbox.getCorners())])
442 if margin is not None:
443 # This is an ad-hoc, approximate implementation. It should be good
444 # enough for catalog loading, but is not a general-purpose solution.
445 center = lsst.geom.SpherePoint(region.getCentroid())
446 corners = [lsst.geom.SpherePoint(c) for c in region.getVertices()]
447 # Approximate the region as a Euclidian square
448 # geom.Angle(sphgeom.Angle) converter not pybind-wrapped???
449 diagonal_margin = lsst.geom.Angle(margin.asRadians() * math.sqrt(2.0))
450 padded = [c.offset(center.bearingTo(c), diagonal_margin) for c in corners]
451 return lsst.sphgeom.ConvexPolygon.convexHull([c.getVector() for c in padded])
452
453 return region
454
455
A class representing an angle.
Definition Angle.h:128
A floating-point coordinate rectangle geometry.
Definition Box.h:413
Point in an unspecified spherical coordinate system.
Definition SpherePoint.h:57
ConvexPolygon is a closed convex polygon on the unit sphere.
static ConvexPolygon convexHull(std::vector< UnitVector3d > const &points)
convexHull returns the convex hull of the given set of points if it exists and throws an exception ot...