Coverage for python/lsst/afw/image/exposure/multiband.py : 68%
Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
|
# This file is part of afw. # # Developed for the LSST Data Management System. # This product includes software developed by the LSST Project # (http://www.lsst.org). # See the COPYRIGHT file at the top-level directory of this distribution # for details of code ownership. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>.
"""MultibandExposure class
This class acts as a container for multiple `afw.Exposure` objects. All exposures must have the same bounding box, and the associated images must all have the same data type.
See `MultibandTripleBase` for parameter definitions. """
def fromExposures(filters, singles): """Construct a MultibandImage from a collection of single band images
see `tripleFromExposures` for a description of parameters """ return tripleFromSingles(MultibandExposure, filters, singles)
"""Construct a MultibandExposure from a collection of arrays
see `tripleFromArrays` for a description of parameters """ return tripleFromArrays(MultibandExposure, filters, image, mask, variance, bbox)
"""Build a MultibandImage from a set of keyword arguments
see `makeTripleFromKwargs` for a description of parameters """ return makeTripleFromKwargs(MultibandExposure, filters, filterKwargs, singleType, **kwargs)
"""Make a new list of single band objects
Parameters ---------- image: `list` List of `Image` objects that represent the image in each band. mask: `list` List of `Mask` objects that represent the mask in each band. variance: `list` List of `Image` objects that represent the variance in each band.
Returns ------- singles: tuple Tuple of `MaskedImage` objects for each band, where the `image`, `mask`, and `variance` of each `single` point to the multiband objects. """ image = self.image mask = self.mask variance = self.variance
def fromButler(butler, filters, filterKwargs, *args, **kwargs): """Load a multiband exposure from a butler
Because each band is stored in a separate exposure file, this method can be used to load all of the exposures for a given set of bands
Parameters ---------- butler: `Butler` Butler connection to use to load the single band calibrated images filters: `list` or `str` List of filter names for each band filterKwargs: `dict` Keyword arguments to pass to the Butler that are different for each filter. The keys are the names of the arguments and the values should also be dictionaries, with filter names as keys and the value of the argument for the given filter as values. args: `list` Arguments to the Butler. kwargs: `dict` Keyword arguments to pass to the Butler that are the same in all bands.
Returns ------- result: `MultibandExposure` The new `MultibandExposure` created by combining all of the single band exposures. """ # Load the Exposure in each band exposures = [] for f in filters: if filterKwargs is not None: for key, value in filterKwargs: kwargs[key] = value[f] exposures.append(butler.get(*args, filter=f, **kwargs)) return MultibandExposure.fromExposures(filters, exposures)
"""Get a multiband PSF image
The PSF Kernel Image is computed for each band and combined into a (filter, y, x) array and stored as `self._psfImage`. The result is not cached, so if the same PSF is expected to be used multiple times it is a good idea to store the result in another variable.
Parameters ---------- position: `Point2D` or `tuple` Coordinates to evaluate the PSF. If `position` is `None` then `Psf.getAveragePosition()` is used.
Returns ------- self._psfImage: array The multiband PSF image. """ # Make the coordinates into a Point2D (if necessary) position = Point2D(position[0], position[1]) else: psfs.append(single.getPsf().computeKernelImage(position).array)
"""Get a multiband PSF image
The PSF Kernel Image is computed for each band and combined into a (filter, y, x) array and stored as `self._psfImage`. The result is not cached, so if the same PSF is expected to be used multiple times it is a good idea to store the result in another variable.
Parameters ---------- position: `Point2D` or `tuple` Coordinates to evaluate the PSF. If `position` is `None` then `Psf.getAveragePosition()` is used.
Returns ------- self._psfImage: array The multiband PSF image. """ # Make the coordinates into a Point2D (if necessary) position = Point2D(position[0], position[1]) else: psfs.append(single.getPsf().computeImage(position).array) |