Coverage for python / lsst / multiprofit / model_utils.py: 46%
11 statements
« prev ^ index » next coverage.py v7.13.5, created at 2026-04-17 08:58 +0000
« prev ^ index » next coverage.py v7.13.5, created at 2026-04-17 08:58 +0000
1# This file is part of multiprofit.
2#
3# Developed for the LSST Data Management System.
4# This product includes software developed by the LSST Project
5# (https://www.lsst.org).
6# See the COPYRIGHT file at the top-level directory of this distribution
7# for details of code ownership.
8#
9# This program is free software: you can redistribute it and/or modify
10# it under the terms of the GNU General Public License as published by
11# the Free Software Foundation, either version 3 of the License, or
12# (at your option) any later version.
13#
14# This program is distributed in the hope that it will be useful,
15# but WITHOUT ANY WARRANTY; without even the implied warranty of
16# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17# GNU General Public License for more details.
18#
19# You should have received a copy of the GNU General Public License
20# along with this program. If not, see <https://www.gnu.org/licenses/>.
22__all__ = ["make_image_gaussians", "make_psf_model_null"]
24from typing import Any
26import lsst.gauss2d as g2
27import lsst.gauss2d.fit as g2f
30def make_image_gaussians(
31 gaussians_source: g2.Gaussians,
32 gaussians_kernel: g2.Gaussians | None = None,
33 **kwargs: Any,
34) -> g2.ImageD:
35 """Make an image array from a set of Gaussians.
37 Parameters
38 ----------
39 gaussians_source
40 Gaussians representing components of sources.
41 gaussians_kernel
42 Gaussians representing the smoothing kernel.
43 **kwargs
44 Additional keyword arguments to pass to
45 lsst.gauss2d.make_gaussians_pixel_D (i.e. image size, etc.).
47 Returns
48 -------
49 image
50 The rendered image of the given Gaussians.
51 """
52 if gaussians_kernel is None:
53 gaussians_kernel = g2.Gaussians([g2.Gaussian()])
54 gaussians = g2.ConvolvedGaussians(
55 [
56 g2.ConvolvedGaussian(source=source, kernel=kernel)
57 for source in gaussians_source
58 for kernel in gaussians_kernel
59 ]
60 )
61 return g2.make_gaussians_pixel_D(gaussians=gaussians, **kwargs)
64def make_psf_model_null() -> g2f.PsfModel:
65 """Make a default (null) PSF model.
67 Returns
68 -------
69 model
70 A null PSF model consisting of a single, normalized, zero-size
71 Gaussian.
72 """
73 return g2f.PsfModel(g2f.GaussianComponent.make_uniq_default_gaussians([0], True))