Skip to content

Commit

Permalink
Fix mypy linting errors
Browse files Browse the repository at this point in the history
  • Loading branch information
bechtol committed Aug 2, 2022
1 parent 1101645 commit bb118f0
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
1 change: 1 addition & 0 deletions python/lsst/analysis/tools/actions/scalar/scalarActions.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ def getInputSchema(self, **kwargs) -> KeyedDataSchema:
return ((self.vectorKey.format(**kwargs), Vector),)

def __call__(self, data: KeyedData, **kwargs) -> Scalar:
values: Vector
mask = self.getMask(**kwargs)
values = data[self.vectorKey.format(**kwargs)][mask]
values = values[np.logical_not(np.isnan(values))]
Expand Down
16 changes: 14 additions & 2 deletions python/lsst/analysis/tools/actions/vector/selectors.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,11 @@
import numpy as np
from lsst.pex.config import Field
from lsst.pex.config.listField import ListField
from lsst.pipe.tasks.configurableActions import ConfigurableActionStructField

from ...interfaces import KeyedData, KeyedDataSchema, Vector, VectorAction

# from lsst.pipe.tasks.configurableActions import ConfigurableActionStructField


class FlagSelector(VectorAction):
"""The base flag selector to use to select valid sources for QA"""
Expand Down Expand Up @@ -382,6 +383,17 @@ def getInputSchema(self) -> KeyedDataSchema:
return ((self.vectorKey, Vector),)

def __call__(self, data: KeyedData, **kwargs) -> Vector:
# bands: Union[tuple | None]
# match kwargs:
# case {"band": band}:
# bands = (band,)
# case {"bands": bands} if not self.bands:
# bands = bands
# case _ if self.bands:
# bands = tuple(self.bands)
# case _:
# bands = None
bands: Optional[tuple[str, ...]]
match kwargs:
case {"band": band}:
bands = (band,)
Expand All @@ -395,5 +407,5 @@ def __call__(self, data: KeyedData, **kwargs) -> Vector:
mask = np.in1d(data[self.vectorKey], bands)
else:
# No band selection is applied, i.e., select all rows
mask = np.full(len(data[self.vectorKey]), True)
mask = np.full(len(data[self.vectorKey]), True) # type: ignore
return cast(Vector, mask)
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@

__all__ = ("StellarPhotometricRepeatabilityMetric",)

from astropy import units as u

from ..actions.scalar.scalarActions import FracThreshold, MedianAction
from ..actions.vector import (
BandSelector,
Expand Down

0 comments on commit bb118f0

Please sign in to comment.