LSST Applications g07dc498a13+cb17356775,g1409bbee79+cb17356775,g1a7e361dbc+cb17356775,g1fd858c14a+d1a2a640a9,g33399d78f5+fe6948661d,g35bb328faa+e55fef2c71,g3bd4b5ce2c+cac9e18807,g3c79e8cd92+2359a18b76,g43bc871e57+a58ba40925,g53246c7159+e55fef2c71,g60b5630c4e+8133a3545f,g78460c75b0+8427c4cc8f,g78619a8342+55305cb8f0,g786e29fd12+307f82e6af,g8534526c7b+8e1c6b434f,g89139ef638+cb17356775,g8b49a6ea8e+8133a3545f,g8ffcb69f3d+818ab6c36e,g9125e01d80+e55fef2c71,g97b8272a79+98425f45f6,g989de1cb63+cb17356775,g9f33ca652e+4245ceb508,gaaedd4e678+cb17356775,gabe3b4be73+9c0c3c7524,gb1101e3267+3e5ef1d639,gb58c049af0+28045f66fd,gc1fe0db326+8133a3545f,gca43fec769+e55fef2c71,gcf25f946ba+fe6948661d,gd397e13551+64039f84ea,gd6cbbdb0b4+f6e5445f66,gde0f65d7ad+7eb368c542,ge278dab8ac+b4c2c8faf7,geab183fbe5+8133a3545f,gecb8035dfe+1f480bec5e,gefa07fa684+e7bc33f3ea,gf58bf46354+e55fef2c71,gfe7187db8c+e55afb4430,w.2025.03
LSST Data Management Base Package
Loading...
Searching...
No Matches
lsst.pipe.tasks.functors.Color Class Reference
Inheritance diagram for lsst.pipe.tasks.functors.Color:
lsst.pipe.tasks.functors.Functor

Public Member Functions

 __init__ (self, col, filt2, filt1, **kwargs)
 
 filt (self)
 
 filt (self, filt)
 
 columns (self)
 
 multilevelColumns (self, parq, **kwargs)
 
 name (self)
 
 shortname (self)
 

Public Attributes

 col
 
 filt2
 
 filt1
 
 mag2
 
 mag1
 
 dataset
 

Protected Member Functions

 _func (self, df)
 

Static Protected Attributes

str _defaultDataset = 'forced_src'
 
tuple _dfLevels = ('band', 'column')
 
bool _defaultNoDup = True
 

Detailed Description

Compute the color between two filters.

Computes color by initializing two different `Mag` functors based on the
``col`` and filters provided, and then returning the difference.

This is enabled by the `_func` method expecting a DataFrame with a
multilevel column index, with both ``'band'`` and ``'column'``, instead of
just ``'column'``, which is the `Functor` default.
This is controlled by the `_dfLevels` attribute.

Also of note, the default dataset for `Color` is ``forced_src'``, whereas
for `Mag` it is ``'meas'``.

Parameters
----------
col : str
    Name of the flux column from which to compute; same as would be passed
    to `~lsst.pipe.tasks.functors.Mag`.

filt2, filt1 : str
    Filters from which to compute magnitude difference.
    Color computed is ``Mag(filt2) - Mag(filt1)``.

Definition at line 906 of file functors.py.

Constructor & Destructor Documentation

◆ __init__()

lsst.pipe.tasks.functors.Color.__init__ ( self,
col,
filt2,
filt1,
** kwargs )

Reimplemented from lsst.pipe.tasks.functors.Functor.

Definition at line 934 of file functors.py.

934 def __init__(self, col, filt2, filt1, **kwargs):
935 self.col = fluxName(col)
936 if filt2 == filt1:
937 raise RuntimeError("Cannot compute Color for %s: %s - %s " % (col, filt2, filt1))
938 self.filt2 = filt2
939 self.filt1 = filt1
940
941 self.mag2 = Mag(col, filt=filt2, **kwargs)
942 self.mag1 = Mag(col, filt=filt1, **kwargs)
943
944 super().__init__(**kwargs)
945

Member Function Documentation

◆ _func()

lsst.pipe.tasks.functors.Color._func ( self,
df )
protected

Reimplemented from lsst.pipe.tasks.functors.Functor.

Definition at line 954 of file functors.py.

954 def _func(self, df):
955 mag2 = self.mag2._func(df[self.filt2])
956 mag1 = self.mag1._func(df[self.filt1])
957 return mag2 - mag1
958

◆ columns()

lsst.pipe.tasks.functors.Color.columns ( self)
Columns required to perform calculation.

Reimplemented from lsst.pipe.tasks.functors.Functor.

Definition at line 960 of file functors.py.

960 def columns(self):
961 return [self.mag1.col, self.mag2.col]
962

◆ filt() [1/2]

lsst.pipe.tasks.functors.Color.filt ( self)

Reimplemented from lsst.pipe.tasks.functors.Functor.

Definition at line 947 of file functors.py.

947 def filt(self):
948 return None
949

◆ filt() [2/2]

lsst.pipe.tasks.functors.Color.filt ( self,
filt )

Reimplemented from lsst.pipe.tasks.functors.Functor.

Definition at line 951 of file functors.py.

951 def filt(self, filt):
952 pass
953

◆ multilevelColumns()

lsst.pipe.tasks.functors.Color.multilevelColumns ( self,
data,
** columnIndex )
Returns columns needed by functor from multilevel dataset.

To access tables with multilevel column structure, the
`~lsst.daf.butler.DeferredDatasetHandle` or
`~lsst.pipe.base.InMemoryDatasetHandle` needs to be passed
either a list of tuples or a dictionary.

Parameters
----------
data : various
    The data as either `~lsst.daf.butler.DeferredDatasetHandle`, or
    `~lsst.pipe.base.InMemoryDatasetHandle`.
columnIndex (optional): pandas `~pandas.Index` object
    Either passed or read in from
    `~lsst.daf.butler.DeferredDatasetHandle`.
`returnTuple` : `bool`
    If true, then return a list of tuples rather than the column
    dictionary specification.
    This is set to `True` by `CompositeFunctor` in order to be able to
    combine columns from the various component functors.

Reimplemented from lsst.pipe.tasks.functors.Functor.

Definition at line 963 of file functors.py.

963 def multilevelColumns(self, parq, **kwargs):
964 return [(self.dataset, self.filt1, self.col), (self.dataset, self.filt2, self.col)]
965

◆ name()

lsst.pipe.tasks.functors.Color.name ( self)

Reimplemented from lsst.pipe.tasks.functors.Functor.

Definition at line 967 of file functors.py.

967 def name(self):
968 return f'{self.filt2} - {self.filt1} ({self.col})'
969
table::Key< std::string > name
Definition Amplifier.cc:116

◆ shortname()

lsst.pipe.tasks.functors.Color.shortname ( self)
Short name of functor (suitable for column name/dict key).

Reimplemented from lsst.pipe.tasks.functors.Functor.

Definition at line 971 of file functors.py.

971 def shortname(self):
972 return f"{self.col}_{self.filt2.replace('-', '')}m{self.filt1.replace('-', '')}"
973
974

Member Data Documentation

◆ _defaultDataset

str lsst.pipe.tasks.functors.Color._defaultDataset = 'forced_src'
staticprotected

Definition at line 930 of file functors.py.

◆ _defaultNoDup

bool lsst.pipe.tasks.functors.Color._defaultNoDup = True
staticprotected

Definition at line 932 of file functors.py.

◆ _dfLevels

tuple lsst.pipe.tasks.functors.Color._dfLevels = ('band', 'column')
staticprotected

Definition at line 931 of file functors.py.

◆ col

lsst.pipe.tasks.functors.Color.col

Definition at line 935 of file functors.py.

◆ dataset

lsst.pipe.tasks.functors.Color.dataset

Definition at line 964 of file functors.py.

◆ filt1

lsst.pipe.tasks.functors.Color.filt1

Definition at line 939 of file functors.py.

◆ filt2

lsst.pipe.tasks.functors.Color.filt2

Definition at line 938 of file functors.py.

◆ mag1

lsst.pipe.tasks.functors.Color.mag1

Definition at line 942 of file functors.py.

◆ mag2

lsst.pipe.tasks.functors.Color.mag2

Definition at line 941 of file functors.py.


The documentation for this class was generated from the following file: