Public Member Functions | |
| __init__ (self, np.ndarray|Image images, np.ndarray|Image variance, np.ndarray|Image weights, np.ndarray psfs, np.ndarray|None model_psf=None, np.ndarray|None noise_rms=None, Box|None bbox=None, tuple|None bands=None, int padding=3, str convolution_mode="fft") | |
| tuple | bands (self) |
| Box | bbox (self) |
| Image | convolve (self, Image image, str|None mode=None, bool grad=False) |
| float | log_likelihood (self, Image model) |
| Observation | __getitem__ (self, Any indices) |
| Observation | __copy__ (self) |
| Observation | __deepcopy__ (self, dict[int, Any] memo) |
| Observation | copy (self, bool deep=False) |
| tuple[int, int, int] | shape (self) |
| int | n_bands (self) |
| npt.DTypeLike | dtype (self) |
| tuple[int, int, int, int] | convolution_bounds (self) |
Static Public Member Functions | |
| Observation | empty (tuple[Any] bands, np.ndarray psfs, np.ndarray model_psf, Box bbox, npt.DTypeLike dtype) |
Public Attributes | |
| images = images | |
| variance = _set_image_like(variance, bands, bbox) | |
| weights = _set_image_like(weights, bands, bbox) | |
| psfs = psfs | |
| mode = convolution_mode | |
| noise_rms = noise_rms | |
| model_psf = model_psf | |
| padding = padding | |
| Fourier|None | diff_kernel = cast(Fourier, match_kernel(psfs, model_psf, padding=padding)) |
| Fourier|None | grad_kernel = Fourier(diff_img[:, ::-1, ::-1]) |
| bands | |
Protected Attributes | |
| tuple[int, int, int, int]|None | _convolution_bounds = None |
A single observation
This class contains all of the observed images and derived
properties, like PSFs, variance map, and weight maps,
required for most optimizers.
This includes methods to match a scarlet model PSF to the oberved PSF
in each band.
Notes
-----
This is effectively a combination of the `Observation` and
`Renderer` class from scarlet main, greatly simplified due
to the assumptions that the observations are all resampled
onto the same pixel grid and that the `images` contain all
of the information for all of the model bands.
Parameters
----------
images:
(bands, y, x) array of observed images.
variance:
(bands, y, x) array of variance for each image pixel.
weights:
(bands, y, x) array of weights to use when calculate the
likelihood of each pixel.
psfs:
(bands, y, x) array of the PSF image in each band.
model_psf:
(bands, y, x) array of the model PSF image in each band.
If `model_psf` is `None` then convolution is performed,
which should only be done when the observation is a
PSF matched coadd, and the scarlet model has the same PSF.
noise_rms:
Per-band average noise RMS. If `noise_rms` is `None` then the mean
of the sqrt of the variance is used.
bbox:
The bounding box containing the model. If `bbox` is `None` then
a `Box` is created that is the shape of `images` with an origin
at `(0, 0)`.
padding:
Padding to use when performing an FFT convolution.
convolution_mode:
The method of convolution. This should be either "fft" or "real".
| Observation lsst.scarlet.lite.observation.Observation.__copy__ | ( | self | ) |
Create a copy of the observation
Returns
-------
result:
The copy of the observation.
| Observation lsst.scarlet.lite.observation.Observation.__deepcopy__ | ( | self, | |
| dict[int, Any] | memo ) |
Create a deep copy of the observation
Parameters
----------
memo: dict[int, Any]
The memoization dictionary used by `copy.deepcopy`.
Returns
-------
result:
The deep copy of the observation.
| Observation lsst.scarlet.lite.observation.Observation.__getitem__ | ( | self, | |
| Any | indices ) |
Get a view for the subset of an image
Parameters
----------
indices:
The indices to select a subsection of the image.
Returns
-------
result:
The resulting image obtained by selecting subsets of the iamge
based on the `indices`.
| tuple lsst.scarlet.lite.observation.Observation.bands | ( | self | ) |
The bands in the observations.
| Box lsst.scarlet.lite.observation.Observation.bbox | ( | self | ) |
The bounding box for the full observation.
| tuple[int, int, int, int] lsst.scarlet.lite.observation.Observation.convolution_bounds | ( | self | ) |
Build the slices needed for convolution in real space
| Image lsst.scarlet.lite.observation.Observation.convolve | ( | self, | |
| Image | image, | ||
| str | None | mode = None, | ||
| bool | grad = False ) |
Convolve the model into the observed seeing in each band.
Parameters
----------
image:
The 3D image to convolve.
mode:
The convolution mode to use.
This should be "real" or "fft" or `None`,
where `None` will use the default `convolution_mode`
specified during init.
grad:
Whether this is a backward gradient convolution
(`grad==True`) or a pure convolution with the PSF.
Returns
-------
result:
The convolved image.
Reimplemented in lsst.scarlet.lite.models.fit_psf.FittedPsfObservation.
| Observation lsst.scarlet.lite.observation.Observation.copy | ( | self, | |
| bool | deep = False ) |
Create a copy of the observation
Parameters
----------
deep:
Whether to perform a deep copy or not.
Returns
-------
result:
The copy of the observation.
| npt.DTypeLike lsst.scarlet.lite.observation.Observation.dtype | ( | self | ) |
The dtype of the observation is the dtype of the images
| float lsst.scarlet.lite.observation.Observation.log_likelihood | ( | self, | |
| Image | model ) |
Calculate the log likelihood of the given model
Parameters
----------
model:
Model to compare with the observed images.
Returns
-------
result:
The log-likelihood of the given model.
| int lsst.scarlet.lite.observation.Observation.n_bands | ( | self | ) |
The number of bands in the observation
| tuple[int, int, int] lsst.scarlet.lite.observation.Observation.shape | ( | self | ) |
The shape of the images, variance, etc.