Coverage for python/lsst/pipe/tasks/extended_psf/extended_psf_fit.py: 81%

21 statements  

« prev     ^ index     » next       coverage.py v7.14.1, created at 2026-05-29 01:54 -0700

1# This file is part of pipe_tasks. 

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/>. 

21 

22from __future__ import annotations 

23 

24__all__ = ( 

25 "ExtendedPsfFit", 

26 "ExtendedPsfMoffatFit", 

27) 

28 

29from pydantic import BaseModel 

30 

31 

32class ExtendedPsfFit(BaseModel): 

33 """Base class for ExtendedPsfImage fit information. 

34 

35 Attributes 

36 ---------- 

37 chi2 : `float` 

38 The chi-squared value of the fit. 

39 dof : `int`, optional 

40 Number of degrees of freedom in the fit. 

41 reduced_chi2 : `float`, optional 

42 The reduced chi-squared value of the fit. 

43 """ 

44 

45 chi2: float 

46 dof: int | None = None 

47 reduced_chi2: float | None = None 

48 

49 def __str__(self) -> str: 

50 attrs = ", ".join(f"{k}={v!r}" for k, v in self.__dict__.items()) 

51 return f"ExtendedPsfFit({attrs})" 

52 

53 __repr__ = __str__ 

54 

55 

56class ExtendedPsfMoffatFit(ExtendedPsfFit): 

57 """Moffat-model fit information for an `ExtendedPsfImage`. 

58 

59 Attributes 

60 ---------- 

61 amplitude : `float` 

62 Best-fit Moffat amplitude. 

63 x_0 : `float` 

64 Best-fit x-center. 

65 y_0 : `float` 

66 Best-fit y-center. 

67 gamma : `float` 

68 Best-fit Moffat gamma parameter. 

69 alpha : `float` 

70 Best-fit Moffat alpha parameter. 

71 """ 

72 

73 amplitude: float 

74 x_0: float 

75 y_0: float 

76 gamma: float 

77 alpha: float 

78 

79 def __str__(self) -> str: 

80 attrs = ", ".join(f"{k}={v!r}" for k, v in self.__dict__.items()) 

81 return f"ExtendedPsfMoffatFit({attrs})" 

82 

83 __repr__ = __str__