Coverage for python / lsst / meas / extensions / multiprofit / pipetasks_merge.py: 0%
35 statements
« prev ^ index » next coverage.py v7.13.5, created at 2026-04-30 09:28 +0000
« prev ^ index » next coverage.py v7.13.5, created at 2026-04-30 09:28 +0000
1# This file is part of meas_extensions_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__ = [
23 "MultiProFitConsolidateTablesConfig",
24 "MultiProFitConsolidateTablesTask",
25]
27from .catalog_actions import MergeMultibandFluxes
28from .consolidate_astropy_table import (
29 ConsolidateAstropyTableConfig,
30 ConsolidateAstropyTableConnections,
31 ConsolidateAstropyTableTask,
32 InputConfig,
33)
34from .pipetasks_fit import MultiProFitCoaddObjectFitConfig, MultiProFitCoaddSersicFitConfig
35from .utils import get_all_subclasses
38class MultiProFitConsolidateTablesConfig(
39 ConsolidateAstropyTableConfig,
40 pipelineConnections=ConsolidateAstropyTableConnections,
41):
42 """PipelineTaskConfig for MultiProFitConsolidateTablesTask."""
44 # Additional user-specified long model names
45 names_long = {}
47 def _get_name_long(self, name_short: str):
48 names_long_default = {
49 cls: cls.get_model_name_full() for cls in get_all_subclasses(MultiProFitCoaddObjectFitConfig)
50 }
51 return names_long_default.get(name_short, self.names_long.get(name_short, "Unspecified"))
53 def add_model(
54 self,
55 name: str,
56 description: str | None = None,
57 has_pointsource: bool = False,
58 is_centroid_fixed: bool = False,
59 is_psf_shapelet: bool = False,
60 ):
61 if description is None:
62 description = self._get_name_long(name)
63 if has_pointsource:
64 description = f"{description} + Point Source"
65 if is_centroid_fixed:
66 description = f"{description} (fixed centroid)"
67 if is_psf_shapelet:
68 description = f"{description} (shapelet PSF)"
69 self.inputs[f"deepCoadd_{name}_multiprofit"] = InputConfig(
70 doc=f"{description} object fit parameters",
71 action=MergeMultibandFluxes(name_model=name),
72 column_id="id",
73 is_multiband=True,
74 )
76 def setDefaults(self):
77 super().setDefaults()
78 inputs = {
79 "deepCoadd_psfs_multiprofit": InputConfig(
80 doc="PSF fit parameters",
81 column_id="id",
82 ),
83 }
84 self.inputs = inputs
85 self.connections.cat_output = "objectTable_tract_multiprofit"
88class MultiProFitConsolidateTablesTask(ConsolidateAstropyTableTask):
89 """Consolidate MultiProFit PSF and object fit tables."""
91 _DefaultName = "multiProFitConsolidateTables"
92 ConfigClass = MultiProFitConsolidateTablesConfig
95class MultiProFitConsolidateTablesSersicConfig(
96 MultiProFitConsolidateTablesConfig,
97 pipelineConnections=ConsolidateAstropyTableConnections,
98):
99 def setDefaults(self):
100 super().setDefaults()
101 self.add_model(MultiProFitCoaddSersicFitConfig.get_model_name_default())
104class MultiProFitConsolidateTablesSersicTask(MultiProFitConsolidateTablesTask):
105 """Consolidate MultiProFit PSF and object fit tables."""
107 _DefaultName = "multiProFitConsolidateTablesSersic"
108 ConfigClass = MultiProFitConsolidateTablesSersicConfig