LSSTApplications  20.0.0
LSSTDataManagementBasePackage
_source.py
Go to the documentation of this file.
1 # This file is part of afw.
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 
22 __all__ = []
23 
24 from lsst.utils import continueClass
25 from lsst.utils.deprecated import deprecate_pybind11
26 from ._base import Catalog
27 from ._table import SourceCatalog, SourceTable
28 
29 Catalog.register("Source", SourceCatalog)
30 
31 
32 @continueClass # noqa: F811
34 
35  def getChildren(self, parent, *args):
36  """Return the subset of self for which the parent field equals the given value.
37 
38  In order for this method to return the correct result, it must be sorted by parent
39  (i.e. self.isSorted(SourceTable.getParentKey()) must be True). This is naturally the
40  case with SourceCatalogs produced by the detection and deblending tasks, but it may
41  not be true when concatenating multiple such catalogs.
42 
43  Additional Catalogs or sequences whose elements correspond in order to the records
44  of self (i.e. zip(self, *args) is valid) will be subset using the same slice object
45  used on self, and these subsets will be returned along with the subset of self.
46 
47  Parameters
48  ----------
49  parent : `int`
50  ID of the parent to get children for.
51  args : `~lsst.afw.table.Catalog`
52  Additional catalogs to subset for the childrens to return.
53 
54  Returns
55  -------
56  children : iterable of `~lsst.afw.table.SourceRecord`
57  Children sources.
58  """
59  if not self.isSorted(SourceTable.getParentKey()):
60  raise AssertionError(
61  "The table is not sorted by parent, so cannot getChildren")
62  s = self.equal_range(parent, SourceTable.getParentKey())
63  if args:
64  return (self[s],) + tuple(arg[s] for arg in args)
65  else:
66  return self[s]
67 
68 
69 SourceTable.getCentroidDefinition = deprecate_pybind11(
70  SourceTable.getCentroidDefinition,
71  reason='Use `getSchema().getAliasMap().get("slot_Centroid")` instead. To be removed after 20.0.0.')
72 SourceTable.hasCentroidSlot = deprecate_pybind11(
73  SourceTable.hasCentroidSlot,
74  reason='Use `getCentroidSlot().isValid()` instead. To be removed after 20.0.0.')
75 SourceTable.getCentroidKey = deprecate_pybind11(
76  SourceTable.getCentroidKey,
77  reason='Use `getCentroidSlot().getMeasKey()` instead. To be removed after 20.0.0.')
78 SourceTable.getCentroidErrKey = deprecate_pybind11(
79  SourceTable.getCentroidErrKey,
80  reason='Use `getCentroidSlot().getErrKey()` instead. To be removed after 20.0.0.')
81 SourceTable.getCentroidFlagKey = deprecate_pybind11(
82  SourceTable.getCentroidFlagKey,
83  reason='Use `getCentroidSlot().getFlagKey()` instead. To be removed after 20.0.0.')
84 SourceTable.getShapeDefinition = deprecate_pybind11(
85  SourceTable.getShapeDefinition,
86  reason='Use `getSchema().getAliasMap().get("slot_Shape")` instead. To be removed after 20.0.0.')
87 SourceTable.hasShapeSlot = deprecate_pybind11(
88  SourceTable.hasShapeSlot,
89  reason='Use `getShapeSlot().isValid()` instead. To be removed after 20.0.0.')
90 SourceTable.getShapeKey = deprecate_pybind11(
91  SourceTable.getShapeKey,
92  reason='Use `getShapeSlot().getMeasKey()` instead. To be removed after 20.0.0.')
93 SourceTable.getShapeErrKey = deprecate_pybind11(
94  SourceTable.getShapeErrKey,
95  reason='Use `getShapeSlot().getErrKey()` instead. To be removed after 20.0.0.')
96 SourceTable.getShapeFlagKey = deprecate_pybind11(
97  SourceTable.getShapeFlagKey,
98  reason='Use `getShapeSlot().getFlagKey()` instead. To be removed after 20.0.0.')
lsst::afw::table._source.SourceCatalog
Definition: _source.py:33
lsst::utils.deprecated
Definition: deprecated.py:1
lsst::utils
Definition: Backtrace.h:29
lsst::afw::table._source.SourceCatalog.getChildren
def getChildren(self, parent, *args)
Definition: _source.py:35
lsst::utils.deprecated.deprecate_pybind11
def deprecate_pybind11(obj, reason, category=FutureWarning)
Definition: deprecated.py:32