LSST Applications g0265f82a02+d6b5cd48b5,g02d81e74bb+a41d3748ce,g1470d8bcf6+6be6c9203b,g2079a07aa2+14824f138e,g212a7c68fe+a4f2ea4efa,g2305ad1205+72971fe858,g295015adf3+ab2c85acae,g2bbee38e9b+d6b5cd48b5,g337abbeb29+d6b5cd48b5,g3ddfee87b4+31b3a28dff,g487adcacf7+082e807817,g50ff169b8f+5929b3527e,g52b1c1532d+a6fc98d2e7,g591dd9f2cf+b2918d57ae,g5a732f18d5+66d966b544,g64a986408d+a41d3748ce,g858d7b2824+a41d3748ce,g8a8a8dda67+a6fc98d2e7,g99cad8db69+7fe4acdf18,g9ddcbc5298+d4bad12328,ga1e77700b3+246acaaf9c,ga8c6da7877+84af8b3ff8,gb0e22166c9+3863383f4c,gb6a65358fc+d6b5cd48b5,gba4ed39666+9664299f35,gbb8dafda3b+d8d527deb2,gc07e1c2157+b2dbe6b631,gc120e1dc64+61440b2abb,gc28159a63d+d6b5cd48b5,gcf0d15dbbd+31b3a28dff,gdaeeff99f8+a38ce5ea23,ge6526c86ff+39927bb362,ge79ae78c31+d6b5cd48b5,gee10cc3b42+a6fc98d2e7,gf1cff7945b+a41d3748ce,v24.1.5.rc1
LSST Data Management Base Package
Loading...
Searching...
No Matches
Classes | Functions
lsst.pipe.tasks.computeExposureSummaryStats Namespace Reference

Classes

class  ComputeExposureSummaryStatsConfig
 
class  ComputeExposureSummaryStatsTask
 

Functions

 maximum_nearest_psf_distance (image_mask, psf_cat, sampling=8, bad_mask_bits=["BAD", "CR", "INTRP", "SAT", "SUSPECT", "NO_DATA", "EDGE"])
 
 psf_trace_radius_delta (image_mask, image_psf, sampling=96, bad_mask_bits=["BAD", "CR", "INTRP", "SAT", "SUSPECT", "NO_DATA", "EDGE"])
 

Function Documentation

◆ maximum_nearest_psf_distance()

lsst.pipe.tasks.computeExposureSummaryStats.maximum_nearest_psf_distance ( image_mask,
psf_cat,
sampling = 8,
bad_mask_bits = ["BAD", "CR", "INTRP", "SAT", "SUSPECT", "NO_DATA", "EDGE"] )
Compute the maximum distance of an unmasked pixel to its nearest PSF.

Parameters
----------
image_mask : `lsst.afw.image.Mask`
    The mask plane associated with the exposure.
psf_cat : `lsst.afw.table.SourceCatalog` or `astropy.table.Table`
    Catalog containing only the stars used in the PSF modeling.
sampling : `int`
    Sampling rate in each dimension to create the grid of points on which
    to evaluate the distance to the nearest PSF star. The tradeoff is
    between adequate sampling versus speed.
bad_mask_bits : `list` [`str`]
    Mask bits required to be absent for a pixel to be considered
    "unmasked".

Returns
-------
max_dist_to_nearest_psf : `float`
    The maximum distance (in pixels) of an unmasked pixel to its nearest
    PSF model star.

Definition at line 604 of file computeExposureSummaryStats.py.

609):
610 """Compute the maximum distance of an unmasked pixel to its nearest PSF.
611
612 Parameters
613 ----------
614 image_mask : `lsst.afw.image.Mask`
615 The mask plane associated with the exposure.
616 psf_cat : `lsst.afw.table.SourceCatalog` or `astropy.table.Table`
617 Catalog containing only the stars used in the PSF modeling.
618 sampling : `int`
619 Sampling rate in each dimension to create the grid of points on which
620 to evaluate the distance to the nearest PSF star. The tradeoff is
621 between adequate sampling versus speed.
622 bad_mask_bits : `list` [`str`]
623 Mask bits required to be absent for a pixel to be considered
624 "unmasked".
625
626 Returns
627 -------
628 max_dist_to_nearest_psf : `float`
629 The maximum distance (in pixels) of an unmasked pixel to its nearest
630 PSF model star.
631 """
632 mask_arr = image_mask.array[::sampling, ::sampling]
633 bitmask = image_mask.getPlaneBitMask(bad_mask_bits)
634 good = ((mask_arr & bitmask) == 0)
635
636 x = np.arange(good.shape[1]) * sampling
637 y = np.arange(good.shape[0]) * sampling
638 xx, yy = np.meshgrid(x, y)
639
640 dist_to_nearest_psf = np.full(good.shape, np.inf)
641 for psf in psf_cat:
642 x_psf = psf["slot_Centroid_x"]
643 y_psf = psf["slot_Centroid_y"]
644 dist_to_nearest_psf = np.minimum(dist_to_nearest_psf, np.hypot(xx - x_psf, yy - y_psf))
645 unmasked_dists = dist_to_nearest_psf * good
646 max_dist_to_nearest_psf = np.max(unmasked_dists)
647
648 return max_dist_to_nearest_psf
649
650

◆ psf_trace_radius_delta()

lsst.pipe.tasks.computeExposureSummaryStats.psf_trace_radius_delta ( image_mask,
image_psf,
sampling = 96,
bad_mask_bits = ["BAD", "CR", "INTRP", "SAT", "SUSPECT", "NO_DATA", "EDGE"] )
Compute the delta between the maximum and minimum model PSF trace radius
values evaluated on a grid of points lying in the unmasked region of the
image.

Parameters
----------
image_mask : `lsst.afw.image.Mask`
    The mask plane associated with the exposure.
image_psf : `lsst.afw.detection.Psf`
    The PSF model associated with the exposure.
sampling : `int`
    Sampling rate in each dimension to create the grid of points at which
    to evaluate ``image_psf``s trace radius value. The tradeoff is between
    adequate sampling versus speed.
bad_mask_bits : `list` [`str`]
    Mask bits required to be absent for a pixel to be considered
    "unmasked".

Returns
-------
psf_trace_radius_delta : `float`
    The delta (in pixels) between the maximum and minimum model PSF trace
    radius values evaluated on the x,y-grid subsampled on the unmasked
    detector pixels by a factor of ``sampling``.  If any model PSF trace
    radius value on the grid evaluates to NaN, then NaN is returned
    immediately.

Definition at line 651 of file computeExposureSummaryStats.py.

656):
657 """Compute the delta between the maximum and minimum model PSF trace radius
658 values evaluated on a grid of points lying in the unmasked region of the
659 image.
660
661 Parameters
662 ----------
663 image_mask : `lsst.afw.image.Mask`
664 The mask plane associated with the exposure.
665 image_psf : `lsst.afw.detection.Psf`
666 The PSF model associated with the exposure.
667 sampling : `int`
668 Sampling rate in each dimension to create the grid of points at which
669 to evaluate ``image_psf``s trace radius value. The tradeoff is between
670 adequate sampling versus speed.
671 bad_mask_bits : `list` [`str`]
672 Mask bits required to be absent for a pixel to be considered
673 "unmasked".
674
675 Returns
676 -------
677 psf_trace_radius_delta : `float`
678 The delta (in pixels) between the maximum and minimum model PSF trace
679 radius values evaluated on the x,y-grid subsampled on the unmasked
680 detector pixels by a factor of ``sampling``. If any model PSF trace
681 radius value on the grid evaluates to NaN, then NaN is returned
682 immediately.
683 """
684 psf_trace_radius_list = []
685 mask_arr = image_mask.array[::sampling, ::sampling]
686 bitmask = image_mask.getPlaneBitMask(bad_mask_bits)
687 good = ((mask_arr & bitmask) == 0)
688
689 x = np.arange(good.shape[1]) * sampling
690 y = np.arange(good.shape[0]) * sampling
691 xx, yy = np.meshgrid(x, y)
692
693 for x_mesh, y_mesh, good_mesh in zip(xx, yy, good):
694 for x_point, y_point, is_good in zip(x_mesh, y_mesh, good_mesh):
695 if is_good:
696 psf_trace_radius = image_psf.computeShape(geom.Point2D(x_point, y_point)).getTraceRadius()
697 if ~np.isfinite(psf_trace_radius):
698 return float("nan")
699 psf_trace_radius_list.append(psf_trace_radius)
700
701 psf_trace_radius_delta = np.max(psf_trace_radius_list) - np.min(psf_trace_radius_list)
702
703 return psf_trace_radius_delta